CC-3174 : showbuilder

have to replace context menus on calendar page.
This commit is contained in:
Naomi Aro 2012-02-08 11:16:23 +01:00
parent c6addf37ba
commit 216ce80ceb
3 changed files with 65 additions and 30 deletions

View File

@ -41,7 +41,7 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.filemtime($baseDir.'/js/contextmenu/jjmenu.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.filemtime($baseDir.'/js/contextmenu/jquery.contextMenu.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
@ -50,7 +50,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js?'.filemtime($baseDir.'/js/airtime/schedule/full-calendar-functions.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js?'.filemtime($baseDir.'/js/fullcalendar/fullcalendar.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.filemtime($baseDir.'/js/timepicker/jquery.ui.timepicker.js'),'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js?'.filemtime($baseDir.'/js/colorpicker/js/colorpicker.js'),'text/javascript');
@ -63,7 +62,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css?'.filemtime($baseDir.'/css/fullcalendar.css'));
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css?'.filemtime($baseDir.'/css/colorpicker/css/colorpicker.css'));
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css?'.filemtime($baseDir.'/css/add-show.css'));
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css?'.filemtime($baseDir.'/css/contextmenu.css'));
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.filemtime($baseDir.'/css/jquery.contextMenu.css'));
Application_Model_Schedule::createNewFormSections($this->view);

View File

@ -6,7 +6,7 @@
function scheduleRefetchEvents(json) {
if(json.show_error == true){
alert("The show instance doesn't exist anymore!")
alert("The show instance doesn't exist anymore!");
}
if(json.show_id) {
var dialog_id = parseInt($("#add_show_id").val(), 10);
@ -41,9 +41,9 @@ function openAddShowForm() {
$.mask.masks = $.extend($.mask.masks,{
date:{ mask: '9999-19-39', selectCharsOnFocus: true, autoTab: false},
time:{ mask: '29:69', selectCharsOnFocus: true, autoTab: false}
})
});
$('input:text').setMask()
$('input:text').setMask();
}
function makeAddShowButton(){
@ -280,14 +280,10 @@ function eventRender(event, element, view) {
}
function eventAfterRender( event, element, view ) {
$(element)
.jjmenu("click",
[{get:"/Schedule/make-context-menu/format/json/id/#id#"}],
{id: event.id},
{xposition: "mouse", yposition: "mouse"});
$(element).find(".small-icon").live('mouseover',function(){
addQtipToSCIcons($(this));
})
});
}
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
@ -354,7 +350,7 @@ function checkSCUploadStatus(){
$("span[id="+id+"]").removeClass("progress").addClass("sc-error");
}
});
})
});
}
function addQtipToSCIcons(ele){
@ -376,7 +372,7 @@ function addQtipToSCIcons(ele){
show: {
ready: true // Needed to make it show on first mouseover event
}
})
});
}else if($(ele).hasClass("soundcloud")){
$(ele).qtip({
content: {
@ -386,7 +382,7 @@ function addQtipToSCIcons(ele){
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id)
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id);
}
}
},
@ -402,7 +398,7 @@ function addQtipToSCIcons(ele){
show: {
ready: true // Needed to make it show on first mouseover event
}
})
});
}else if($(ele).hasClass("sc-error")){
$(ele).qtip({
content: {
@ -413,7 +409,7 @@ function addQtipToSCIcons(ele){
data: ({format: "json", id : id, type: "show"}),
success: function(json, status){
this.set('content.text', "There was error while uploading to soundcloud.<br>"+"Error code: "+json.error_code+
"<br>"+"Error msg: "+json.error_msg+"<br>")
"<br>"+"Error msg: "+json.error_msg+"<br>");
}
}
},
@ -429,7 +425,7 @@ function addQtipToSCIcons(ele){
show: {
ready: true // Needed to make it show on first mouseover event
}
})
});
}
}
@ -442,4 +438,4 @@ function alertShowErrorAndReload(){
$(document).ready(function(){
setInterval( "checkSCUploadStatus()", 5000 );
})
});

View File

@ -208,22 +208,13 @@ function uploadToSoundCloud(show_instance_id){
if(span.length == 0){
span = $(window.triggerElement).find(".soundcloud");
span.removeClass("soundcloud")
.addClass("progress")
.addClass("progress");
}else{
span.removeClass("recording")
.addClass("progress");
.addClass("progress");
}
}
//used by jjmenu
function getId() {
var tr_id = $(this.triggerElement).attr("id");
tr_id = tr_id.split("_");
return tr_id[1];
}
//end functions used by jjmenu
function buildContentDialog(json){
if(json.show_error == true){
alertShowErrorAndReload();
@ -380,4 +371,53 @@ function alertShowErrorAndReload(){
$(window).load(function() {
$.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:createFullCalendar
, error:function(jqXHR, textStatus, errorThrown){}});
$.contextMenu({
selector: 'div.fc-event',
trigger: "left",
ignoreRightClick: true,
build: function($el, e) {
var x, request, data, screen, items, callback, $tr;
$tr = $el.parent();
data = $tr.data("aData");
screen = $tr.data("screen");
function processMenuItems(oItems) {
//define a download callback.
if (oItems.download !== undefined) {
callback = function() {
document.location.href = oItems.download.url;
};
oItems.download.callback = callback;
}
items = oItems;
}
request = $.ajax({
url: "/library/context-menu",
type: "GET",
data: {id : data.id, type: data.ftype, format: "json", "screen": screen},
dataType: "json",
async: false,
success: function(json){
processMenuItems(json.items);
}
});
return {
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');
}
};
}
});
});