Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
james 2012-03-15 14:29:48 -04:00
commit 04c2c2f920
5 changed files with 101 additions and 3 deletions

View File

@ -73,8 +73,6 @@ class LibraryController extends Zend_Controller_Action
public function contextMenuAction()
{
global $CC_CONFIG;
$id = $this->_getParam('id');
$type = $this->_getParam('type');
//playlist||timeline

View File

@ -12,6 +12,7 @@ class ShowbuilderController extends Zend_Controller_Action
->addActionContext('builder-dialog', 'json')
->addActionContext('check-builder-feed', 'json')
->addActionContext('builder-feed', 'json')
->addActionContext('context-menu', 'json')
->initContext();
}
@ -94,6 +95,28 @@ class ShowbuilderController extends Zend_Controller_Action
$this->_helper->actionStack('library', 'library');
$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() {

View File

@ -329,6 +329,8 @@ var AIRTIME = (function(AIRTIME) {
addQtipToSCIcons();
//begin context menu initialization.
$.contextMenu({
selector: '#library_display td:not(.library_checkbox)',
trigger: "left",

View File

@ -752,4 +752,24 @@ $(document).ready(function() {
AIRTIME.library.libraryInit();
AIRTIME.playlist.init();
pl.find(".ui-icon-alert").qtip({
content: {
text: "File does not exist on disk..."
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark"
},
show: 'mouseover',
hide: 'mouseout'
});
});

View File

@ -128,7 +128,7 @@ var AIRTIME = (function(AIRTIME){
oTable = tableDiv.dataTable( {
"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"},
/* ends */{"mDataProp": "ends", "sTitle": "End"},
/* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
@ -214,6 +214,14 @@ var AIRTIME = (function(AIRTIME){
node,
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.
$(nRow).data({"aData": aData});
@ -565,6 +573,53 @@ var AIRTIME = (function(AIRTIME){
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) {