Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
4f055788d4
14 changed files with 111 additions and 483 deletions
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
function contextMenu(action, el, pos) {
|
||||
var method = action.split('/').pop(),
|
||||
url, tr_id, id;
|
||||
|
||||
tr_id = $(el).attr('id');
|
||||
id = tr_id.split("_").pop();
|
||||
url = '/'+action;
|
||||
|
||||
if (method === 'delete') {
|
||||
url = url + '/format/json';
|
||||
url = url + '/id/' + id;
|
||||
$.post(url, function(json) {
|
||||
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
return;
|
||||
}
|
||||
|
||||
$("#library_display tr#" +tr_id).remove();
|
||||
});
|
||||
}
|
||||
else if (method === 'add-item') {
|
||||
url = url + '/format/json';
|
||||
url = url + '/id/' + id;
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function contextMenu() {
|
||||
alert("callback");
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
function setUpQuickSearch() {
|
||||
|
||||
$("#library_quick_search input").keyup(function(ev){
|
||||
var url, string;
|
||||
//alert(x);
|
||||
|
||||
url = "/Library/quick-search/format/json";
|
||||
string = $(this).val();
|
||||
|
||||
$.post(url, {search: string}, function(json){
|
||||
var html, data;
|
||||
//hacky way until I can figure out paginator better.
|
||||
html = json.html.replace(/quick-search\/format\/json/g, "index");
|
||||
|
||||
var el = $(html);
|
||||
|
||||
data = el.find("tr:not(:first-child)");
|
||||
setLibraryContents(data);
|
||||
|
||||
var lib = $("#library_content");
|
||||
|
||||
lib.find("div.paginationControl").remove();
|
||||
lib.append(el[2]);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
|
@ -120,7 +120,11 @@ $(document).ready(function() {
|
|||
defaultView: 'agendaDay',
|
||||
editable: false,
|
||||
allDaySlot: false,
|
||||
lazyFetching: false,
|
||||
axisFormat: 'H:mm',
|
||||
timeFormat: {
|
||||
agenda: 'H:mm{ - H:mm}',
|
||||
month: 'H:mm{ - H:mm}'
|
||||
},
|
||||
|
||||
events: getFullCalendarEvents,
|
||||
|
||||
|
|
|
@ -59,20 +59,22 @@ function eventRender(event, element, view) {
|
|||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
var today = new Date();
|
||||
|
||||
if(event.isHost === true && event.start > today) {
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_host_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
else{
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_default_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
function getStartTS() {
|
||||
var start = makeTimeStamp(event.start);
|
||||
return start;
|
||||
}
|
||||
|
||||
$(element).data({'event': event});
|
||||
function getEndTS() {
|
||||
var start = makeTimeStamp(event.end);
|
||||
return start;
|
||||
}
|
||||
|
||||
$(element)
|
||||
.jjmenu("rightClick",
|
||||
[{get:"/Schedule/make-context-menu/format/json/id/#id#/start/#start#/end/#end#"}],
|
||||
{id: event.id, start: getStartTS, end: getEndTS},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
}
|
||||
|
||||
function eventClick(event, jsEvent, view) {
|
||||
|
|
|
@ -165,69 +165,29 @@ function makeScheduleDialog(dialog, json) {
|
|||
setScheduleDialogEvents(dialog);
|
||||
}
|
||||
|
||||
function openScheduleDialog(show) {
|
||||
var url, start_date, end_date;
|
||||
function buildScheduleDialog(json){
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
url = '/Schedule/schedule-show-dialog/format/json';
|
||||
|
||||
start_date = makeTimeStamp(show.start);
|
||||
end_date = makeTimeStamp(show.end);
|
||||
makeScheduleDialog(dialog, json);
|
||||
|
||||
$.post(url,
|
||||
{start: start_date, end: end_date, showId: show.id},
|
||||
function(json){
|
||||
var dialog = $(json.dialog);
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Playlist',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
makeScheduleDialog(dialog, json, show);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Playlist',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
});
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function eventMenu(action, el, pos) {
|
||||
var method, event, start_timestamp, url;
|
||||
|
||||
method = action.split('/').pop();
|
||||
event = $(el).data('event');
|
||||
start_timestamp = makeTimeStamp(event.start);
|
||||
|
||||
if (method === 'delete-show') {
|
||||
|
||||
url = '/Schedule/delete-show';
|
||||
|
||||
$.post(action,
|
||||
{format: "json", showId: event.id, date: start_timestamp},
|
||||
function(json){
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
}
|
||||
else if (method === 'schedule-show') {
|
||||
|
||||
openScheduleDialog(event);
|
||||
}
|
||||
else if (method === 'clear-show') {
|
||||
|
||||
url = '/Schedule/clear-show';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", start: start_timestamp, showId: event.id},
|
||||
function(json){
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
}
|
||||
function scheduleRefetchEvents() {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@ -241,10 +201,15 @@ $(document).ready(function() {
|
|||
defaultView: 'agendaDay',
|
||||
editable: false,
|
||||
allDaySlot: false,
|
||||
|
||||
axisFormat: 'H:mm',
|
||||
timeFormat: {
|
||||
agenda: 'H:mm{ - H:mm}',
|
||||
month: 'H:mm{ - H:mm}'
|
||||
},
|
||||
|
||||
events: getFullCalendarEvents,
|
||||
|
||||
//callbacks (from full-calendar-functions.js
|
||||
//callbacks (in full-calendar-functions.js)
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
|
@ -253,9 +218,7 @@ $(document).ready(function() {
|
|||
eventMouseout: eventMouseout,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(window).load(function() {
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
// jQuery Context Menu Plugin
|
||||
//
|
||||
// Version 1.01
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
//
|
||||
// More info: http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/
|
||||
//
|
||||
// Terms of Use
|
||||
//
|
||||
// This plugin is dual-licensed under the GNU General Public License
|
||||
// and the MIT License and is copyright A Beautiful Site, LLC.
|
||||
//
|
||||
if(jQuery)( function() {
|
||||
$.extend($.fn, {
|
||||
|
||||
contextMenu: function(o, callback) {
|
||||
// Defaults
|
||||
if( o.menu == undefined ) return false;
|
||||
if( o.inSpeed == undefined ) o.inSpeed = 150;
|
||||
if( o.outSpeed == undefined ) o.outSpeed = 75;
|
||||
// 0 needs to be -1 for expected results (no fade)
|
||||
if( o.inSpeed == 0 ) o.inSpeed = -1;
|
||||
if( o.outSpeed == 0 ) o.outSpeed = -1;
|
||||
// Loop each context menu
|
||||
$(this).each( function() {
|
||||
var el = $(this);
|
||||
var offset = $(el).offset();
|
||||
// Add contextMenu class
|
||||
$('#' + o.menu).addClass('contextMenu');
|
||||
// Simulate a true right click
|
||||
$(this).mousedown( function(e) {
|
||||
var evt = e;
|
||||
evt.stopPropagation();
|
||||
$(this).mouseup( function(e) {
|
||||
e.stopPropagation();
|
||||
var srcElement = $(this);
|
||||
$(this).unbind('mouseup');
|
||||
if( evt.button == 2 ) {
|
||||
// Hide context menus that may be showing
|
||||
$(".contextMenu").hide();
|
||||
// Get this context menu
|
||||
var menu = $('#' + o.menu);
|
||||
|
||||
if( $(el).hasClass('disabled') ) return false;
|
||||
|
||||
// Detect mouse position
|
||||
var d = {}, x, y;
|
||||
if( self.innerHeight ) {
|
||||
d.pageYOffset = self.pageYOffset;
|
||||
d.pageXOffset = self.pageXOffset;
|
||||
d.innerHeight = self.innerHeight;
|
||||
d.innerWidth = self.innerWidth;
|
||||
} else if( document.documentElement &&
|
||||
document.documentElement.clientHeight ) {
|
||||
d.pageYOffset = document.documentElement.scrollTop;
|
||||
d.pageXOffset = document.documentElement.scrollLeft;
|
||||
d.innerHeight = document.documentElement.clientHeight;
|
||||
d.innerWidth = document.documentElement.clientWidth;
|
||||
} else if( document.body ) {
|
||||
d.pageYOffset = document.body.scrollTop;
|
||||
d.pageXOffset = document.body.scrollLeft;
|
||||
d.innerHeight = document.body.clientHeight;
|
||||
d.innerWidth = document.body.clientWidth;
|
||||
}
|
||||
(e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
|
||||
(e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
|
||||
|
||||
// Show the menu
|
||||
$(document).unbind('click');
|
||||
$(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
|
||||
// Hover events
|
||||
$(menu).find('A').mouseover( function() {
|
||||
$(menu).find('LI.hover').removeClass('hover');
|
||||
$(this).parent().addClass('hover');
|
||||
}).mouseout( function() {
|
||||
$(menu).find('LI.hover').removeClass('hover');
|
||||
});
|
||||
|
||||
// Keyboard
|
||||
$(document).keypress( function(e) {
|
||||
switch( e.keyCode ) {
|
||||
case 38: // up
|
||||
if( $(menu).find('LI.hover').size() == 0 ) {
|
||||
$(menu).find('LI:last').addClass('hover');
|
||||
} else {
|
||||
$(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
|
||||
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
|
||||
}
|
||||
break;
|
||||
case 40: // down
|
||||
if( $(menu).find('LI.hover').size() == 0 ) {
|
||||
$(menu).find('LI:first').addClass('hover');
|
||||
} else {
|
||||
$(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
|
||||
if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
|
||||
}
|
||||
break;
|
||||
case 13: // enter
|
||||
$(menu).find('LI.hover A').trigger('click');
|
||||
break;
|
||||
case 27: // esc
|
||||
$(document).trigger('click');
|
||||
break
|
||||
}
|
||||
});
|
||||
|
||||
// When items are selected
|
||||
$('#' + o.menu).find('A').unbind('click');
|
||||
$('#' + o.menu).find('LI:not(.disabled) A').click( function() {
|
||||
$(document).unbind('click').unbind('keypress');
|
||||
$(".contextMenu").hide();
|
||||
// Callback
|
||||
if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
|
||||
return false;
|
||||
});
|
||||
|
||||
// Hide bindings
|
||||
setTimeout( function() { // Delay for Mozilla
|
||||
$(document).click( function() {
|
||||
$(document).unbind('click').unbind('keypress');
|
||||
$(menu).fadeOut(o.outSpeed);
|
||||
return false;
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Disable text selection
|
||||
if( $.browser.mozilla ) {
|
||||
$('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
|
||||
} else if( $.browser.msie ) {
|
||||
$('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
|
||||
} else {
|
||||
$('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
|
||||
}
|
||||
// Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
|
||||
$(el).add($('UL.contextMenu')).bind('contextmenu', function() { return false; });
|
||||
|
||||
});
|
||||
return $(this);
|
||||
},
|
||||
|
||||
// Disable context menu items on the fly
|
||||
disableContextMenuItems: function(o) {
|
||||
if( o == undefined ) {
|
||||
// Disable all
|
||||
$(this).find('LI').addClass('disabled');
|
||||
return( $(this) );
|
||||
}
|
||||
$(this).each( function() {
|
||||
if( o != undefined ) {
|
||||
var d = o.split(',');
|
||||
for( var i = 0; i < d.length; i++ ) {
|
||||
$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Enable context menu items on the fly
|
||||
enableContextMenuItems: function(o) {
|
||||
if( o == undefined ) {
|
||||
// Enable all
|
||||
$(this).find('LI.disabled').removeClass('disabled');
|
||||
return( $(this) );
|
||||
}
|
||||
$(this).each( function() {
|
||||
if( o != undefined ) {
|
||||
var d = o.split(',');
|
||||
for( var i = 0; i < d.length; i++ ) {
|
||||
$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Disable context menu(s)
|
||||
disableContextMenu: function() {
|
||||
$(this).each( function() {
|
||||
$(this).addClass('disabled');
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Enable context menu(s)
|
||||
enableContextMenu: function() {
|
||||
$(this).each( function() {
|
||||
$(this).removeClass('disabled');
|
||||
});
|
||||
return( $(this) );
|
||||
},
|
||||
|
||||
// Destroy context menu(s)
|
||||
destroyContextMenu: function() {
|
||||
// Destroy specified context menus
|
||||
$(this).each( function() {
|
||||
// Disable action
|
||||
$(this).unbind('mousedown').unbind('mouseup');
|
||||
});
|
||||
return( $(this) );
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue