CC-3174 : showbuilder
including context menu to delete items from timeline.
This commit is contained in:
parent
2beadc9301
commit
7a8398bd32
4 changed files with 81 additions and 3 deletions
|
@ -73,8 +73,6 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function contextMenuAction()
|
public function contextMenuAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
|
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
//playlist||timeline
|
//playlist||timeline
|
||||||
|
|
|
@ -12,6 +12,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
->addActionContext('builder-dialog', 'json')
|
->addActionContext('builder-dialog', 'json')
|
||||||
->addActionContext('check-builder-feed', 'json')
|
->addActionContext('check-builder-feed', 'json')
|
||||||
->addActionContext('builder-feed', 'json')
|
->addActionContext('builder-feed', 'json')
|
||||||
|
->addActionContext('context-menu', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +96,28 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->_helper->actionStack('builder', 'showbuilder');
|
$this->_helper->actionStack('builder', 'showbuilder');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function contextMenuAction()
|
||||||
|
{
|
||||||
|
$id = $this->_getParam('id');
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
$menu = array();
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
|
||||||
|
$item = CcScheduleQuery::create()->findPK($id);
|
||||||
|
$instance = $item->getCcShowInstances();
|
||||||
|
|
||||||
|
if ($now < intval($item->getDbStarts("U")) && $user->canSchedule($instance->getDbShowId())) {
|
||||||
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->items = $menu;
|
||||||
|
}
|
||||||
|
|
||||||
public function builderAction() {
|
public function builderAction() {
|
||||||
|
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
|
@ -329,6 +329,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
addQtipToSCIcons();
|
addQtipToSCIcons();
|
||||||
|
|
||||||
|
|
||||||
|
//begin context menu initialization.
|
||||||
$.contextMenu({
|
$.contextMenu({
|
||||||
selector: '#library_display td:not(.library_checkbox)',
|
selector: '#library_display td:not(.library_checkbox)',
|
||||||
trigger: "left",
|
trigger: "left",
|
||||||
|
|
|
@ -128,7 +128,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
oTable = tableDiv.dataTable( {
|
oTable = tableDiv.dataTable( {
|
||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
|
/* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px", "sClass": "sb_checkbox"},
|
||||||
/* starts */{"mDataProp": "starts", "sTitle": "Start"},
|
/* starts */{"mDataProp": "starts", "sTitle": "Start"},
|
||||||
/* ends */{"mDataProp": "ends", "sTitle": "End"},
|
/* ends */{"mDataProp": "ends", "sTitle": "End"},
|
||||||
/* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
|
/* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
|
||||||
|
@ -214,6 +214,14 @@ var AIRTIME = (function(AIRTIME){
|
||||||
node,
|
node,
|
||||||
cl="";
|
cl="";
|
||||||
|
|
||||||
|
//call the context menu so we can prevent the event from propagating.
|
||||||
|
$(nRow).find('td:not(.sb_checkbox)').click(function(e){
|
||||||
|
|
||||||
|
$(this).contextMenu({x: e.pageX, y: e.pageY});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
//save some info for reordering purposes.
|
//save some info for reordering purposes.
|
||||||
$(nRow).data({"aData": aData});
|
$(nRow).data({"aData": aData});
|
||||||
|
|
||||||
|
@ -565,6 +573,53 @@ var AIRTIME = (function(AIRTIME){
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//begin context menu initialization.
|
||||||
|
$.contextMenu({
|
||||||
|
selector: '#show_builder_table td:not(.sb_checkbox)',
|
||||||
|
trigger: "left",
|
||||||
|
ignoreRightClick: true,
|
||||||
|
|
||||||
|
build: function($el, e) {
|
||||||
|
var data, items, callback, $tr;
|
||||||
|
|
||||||
|
$tr = $el.parent();
|
||||||
|
data = $tr.data("aData");
|
||||||
|
|
||||||
|
function processMenuItems(oItems) {
|
||||||
|
|
||||||
|
//define a delete callback.
|
||||||
|
if (oItems.del !== undefined) {
|
||||||
|
|
||||||
|
callback = function() {
|
||||||
|
AIRTIME.showbuilder.fnRemove([{
|
||||||
|
id: data.id,
|
||||||
|
timestamp: data.timestamp,
|
||||||
|
instance: data.instance
|
||||||
|
}]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oItems.del.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
items = oItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
request = $.ajax({
|
||||||
|
url: "/showbuilder/context-menu",
|
||||||
|
type: "GET",
|
||||||
|
data: {id : data.id, format: "json"},
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json){
|
||||||
|
processMenuItems(json.items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
items: items
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.init = function(oTable) {
|
mod.init = function(oTable) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue