CC-3174 : showbuilder/library
adding new context menu, link to view on soundcloud doesn't seem to work.
|
@ -38,7 +38,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js','text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
|
||||
|
@ -52,7 +52,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css');
|
||||
|
@ -77,11 +77,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$params = '/format/json/id/#id#/type/#type#';
|
||||
|
||||
$paramsPop = str_replace('#id#', $id, $params);
|
||||
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
|
@ -89,15 +84,23 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => '/Library/edit-file-md/id/#id#'),
|
||||
'title' => 'Edit Metadata');
|
||||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu["delete"] = array("name"=> "Delete", "icon" => "delete");
|
||||
}
|
||||
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
$menu["download"] = array("name" => "Download", "url" => $url);
|
||||
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
//create a menu separator
|
||||
$menu["sep1"] = "-----------";
|
||||
|
||||
//create a sub menu for Soundcloud actions.
|
||||
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
|
||||
|
||||
$scid = $file->getSoundCloudId();
|
||||
|
||||
if (!is_null($scid)){
|
||||
|
@ -107,30 +110,24 @@ class LibraryController extends Zend_Controller_Action
|
|||
$text = "Upload to SoundCloud";
|
||||
}
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/upload-file-soundcloud/id/#id#',
|
||||
'callback'=>"window['addProgressIcon']('$file_id')"),'title' => $text);
|
||||
|
||||
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "url" => "/library/upload-file-soundcloud/id/{$id}");
|
||||
|
||||
if ($scid > 0){
|
||||
$link_to_file = $file->getSoundCloudLinkToFile();
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $link_to_file, 'target' => '_blank'),
|
||||
'title' => 'View on Soundcloud');
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "url" => $url);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($type === "playlist") {
|
||||
|
||||
if (!isset($this->pl_sess->id) || $this->pl_sess->id !== $id) {
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/edit'.$params,
|
||||
'callback' => 'window["openDiffSPL"]'),
|
||||
'title' => 'Edit');
|
||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit");
|
||||
}
|
||||
|
||||
$menu["delete"] = array("name"=> "Delete", "icon" => "delete");
|
||||
}
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
die(json_encode($menu));
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
|
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 412 B |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
Before Width: | Height: | Size: 620 B After Width: | Height: | Size: 620 B |
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
.context-menu-item {
|
||||
padding: 2px 2px 2px 24px;
|
||||
padding: 2px 2px 2px 28px;
|
||||
background-color: #EEE;
|
||||
position: relative;
|
||||
-moz-user-select: -moz-none;
|
||||
|
@ -82,12 +82,13 @@
|
|||
.context-menu-item.icon:before {}
|
||||
*/
|
||||
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
|
||||
.context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
|
||||
.context-menu-item.icon-cut { background-image: url(images/cut.png); }
|
||||
.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
|
||||
.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
|
||||
.context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
|
||||
.context-menu-item.icon-quit { background-image: url(images/door.png); }
|
||||
.context-menu-item.icon-edit { background-image: url(images/icon_edit.png); }
|
||||
.context-menu-item.icon-cut { background-image: url(images/icon_cut.png); }
|
||||
.context-menu-item.icon-copy { background-image: url(images/icon_copy.png); }
|
||||
.context-menu-item.icon-paste { background-image: url(images/icon_paste.png); }
|
||||
.context-menu-item.icon-delete { background-image: url(images/icon_delete.png); }
|
||||
.context-menu-item.icon-quit { background-image: url(images/icon_door.png); }
|
||||
.context-menu-item.icon-soundcloud { background-image: url(images/icon_soundcloud.png); }
|
||||
|
||||
/* vertically align inside labels */
|
||||
.context-menu-input > label > * { vertical-align: top; }
|
|
@ -128,10 +128,10 @@ select {
|
|||
/* Info Tooltip Ends */
|
||||
|
||||
/* Clearfix */
|
||||
.clearfix:after, li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;}
|
||||
.clearfix, li { display: inline-block; }
|
||||
.clearfix:after, #side_playlist li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;}
|
||||
.clearfix, #side_playlist li { display: inline-block; }
|
||||
* html .clearfix, * html li { height: 1%;}
|
||||
.clearfix, li { display: block; }
|
||||
.clearfix, #side_playlist li { display: block; }
|
||||
|
||||
|
||||
/* Master Panel */
|
||||
|
|
|
@ -3,11 +3,16 @@ function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFul
|
|||
$(nRow).attr("id", aData["tr_id"]);
|
||||
$(nRow).data("aData", aData);
|
||||
|
||||
//var oTT = TableTools.fnGetInstance('library_display');
|
||||
//oTT.fnSelect(el);
|
||||
|
||||
/*
|
||||
$(nRow).find('td')
|
||||
.jjmenu("rightClick",
|
||||
[{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}],
|
||||
{id: aData["id"], type: aData["ftype"]},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
*/
|
||||
}
|
||||
|
||||
function fnLibraryTableDrawCallback() {
|
||||
|
|
|
@ -199,6 +199,15 @@ function addQtipToSCIcons(){
|
|||
}
|
||||
|
||||
function fnCreatedRow( nRow, aData, iDataIndex ) {
|
||||
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
|
||||
var x;
|
||||
|
||||
$(this).contextMenu();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
//add a tool tip to appear when the user clicks on the type icon.
|
||||
$(nRow.children[1]).qtip({
|
||||
|
@ -369,4 +378,97 @@ $(document).ready(function() {
|
|||
//setInterval( "checkSCUploadStatus()", 5000 );
|
||||
|
||||
addQtipToSCIcons();
|
||||
|
||||
$.contextMenu({
|
||||
selector: 'td:not(.library_checkbox):not(.library_type)',
|
||||
trigger: "left",
|
||||
ignoreRightClick: true,
|
||||
|
||||
build: function($el, e) {
|
||||
var x, request, data, items, callback;
|
||||
|
||||
data = $el.parent().data("aData");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
//define an edit callback.
|
||||
if (oItems.edit !== undefined) {
|
||||
|
||||
if (data.ftype === "audioclip") {
|
||||
callback = function() {
|
||||
document.location.href = oItems.edit.url;
|
||||
};
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
oItems.edit.callback = callback;
|
||||
}
|
||||
|
||||
//define a download callback.
|
||||
if (oItems.download !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
document.location.href = oItems.download.url;
|
||||
};
|
||||
oItems.download.callback = callback;
|
||||
}
|
||||
//add callbacks for Soundcloud menu items.
|
||||
if (oItems.soundcloud !== undefined) {
|
||||
var soundcloud = oItems.soundcloud.items;
|
||||
|
||||
//define an upload to soundcloud callback.
|
||||
if (soundcloud.upload !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$.post(soundcloud.upload.url, function(){
|
||||
addProgressIcon(data.id);
|
||||
});
|
||||
};
|
||||
soundcloud.upload.callback = callback;
|
||||
}
|
||||
|
||||
//define a view on soundcloud callback
|
||||
if (soundcloud.view !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
window.open(soundcloud.view.url);
|
||||
};
|
||||
soundcloud.view.callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
request = $.ajax({
|
||||
url: "/library/context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, type: data.ftype, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
processMenuItems(json.items);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// this callback is executed every time the menu is to be shown
|
||||
// its results are destroyed every time the menu is hidden
|
||||
// e is the original contextmenu event, containing e.pageX and e.pageY (amongst other data)
|
||||
return {
|
||||
callback: function(key, options) {
|
||||
var m = "clicked: " + key;
|
||||
window.console && console.log(m) || alert(m);
|
||||
},
|
||||
items: items,
|
||||
determinePosition : function($menu, x, y) {
|
||||
$menu.css('display', 'block')
|
||||
.position({ my: "left top", at: "right top", of: this, offset: "-20 10", collision: "fit"})
|
||||
.css('display', 'none');
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|