CC-3819 : Add View on Soundcloud context menu option on calendar page

This commit is contained in:
Naomi Aro 2012-05-14 15:48:09 +02:00
parent f8900d4b05
commit 803c44611a
4 changed files with 36 additions and 13 deletions

View file

@ -80,7 +80,12 @@ class LibraryController extends Zend_Controller_Action
//create a sub menu for Soundcloud actions. //create a sub menu for Soundcloud actions.
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array()); $menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
$scid = $file->getSoundCloudId(); $scid = $file->getSoundCloudId();
if ($scid > 0){
$url = $file->getSoundCloudLinkToFile();
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
}
if (!is_null($scid)){ if (!is_null($scid)){
$text = "Re-upload to SoundCloud"; $text = "Re-upload to SoundCloud";
@ -90,11 +95,6 @@ class LibraryController extends Zend_Controller_Action
} }
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}"); $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
if ($scid > 0){
$url = $file->getSoundCloudLinkToFile();
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
}
} }
$this->view->items = $menu; $this->view->items = $menu;

View file

@ -257,9 +257,18 @@ class ScheduleController extends Zend_Controller_Action
if ($showEndLocalDT->getTimestamp() <= $epochNow if ($showEndLocalDT->getTimestamp() <= $epochNow
&& $instance->isRecorded() && $instance->isRecorded()
&& Application_Model_Preference::GetUploadToSoundcloudOption()) { && Application_Model_Preference::GetUploadToSoundcloudOption()) {
$file = $instance->getRecordedFile();
$fileId = $file->getId();
$scid = $instance->getSoundCloudFileId();
if ($scid > 0){
$url = $file->getSoundCloudLinkToFile();
$menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
}
$text = is_null($instance->getSoundCloudFileId()) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud'; $text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud';
$menu["soundcloud"] = array("name"=> $text, "icon" => "soundcloud"); $menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud");
} }
if ($showStartLocalDT->getTimestamp() <= $epochNow && if ($showStartLocalDT->getTimestamp() <= $epochNow &&

View file

@ -35,17 +35,22 @@
font-size: 11px; font-size: 11px;
} }
.context-menu-item.icon { .context-menu-item {
padding: 2px 2px 2px 28px; padding: 2px 5px;
background-color: #f0f0f0; background-color: #f0f0f0;
position: relative; position: relative;
min-height: 18px; min-height: 18px;
-moz-user-select: -moz-none; -moz-user-select: -moz-none;
} }
.context-menu-item.icon {
padding: 2px 2px 2px 28px;
}
.context-menu-separator { .context-menu-separator {
padding-bottom:0; padding-bottom:0;
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
min-height: 2px;
} }
.context-menu-item > label { .context-menu-item > label {

View file

@ -336,13 +336,22 @@ $(document).ready(function() {
oItems.content.callback = callback; oItems.content.callback = callback;
} }
//define a soundcloud callback. //define a soundcloud upload callback.
if (oItems.soundcloud !== undefined) { if (oItems.soundcloud_upload !== undefined) {
callback = function() { callback = function() {
uploadToSoundCloud(data.id); uploadToSoundCloud(data.id);
}; };
oItems.soundcloud.callback = callback; oItems.soundcloud_upload.callback = callback;
}
//define a view on soundcloud callback.
if (oItems.soundcloud_view !== undefined) {
callback = function() {
window.open(oItems.soundcloud_view.url);
};
oItems.soundcloud_view.callback = callback;
} }
//define a cancel recorded show callback. //define a cancel recorded show callback.