2012-03-31 21:16:31 +00:00
|
|
|
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: 'programme',
|
|
|
|
is: function () { return false; },
|
|
|
|
format: function(s) {
|
|
|
|
return s.toLowerCase().replace(/---/, 'zzz');
|
|
|
|
},
|
|
|
|
type: 'text'
|
|
|
|
});
|
|
|
|
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: 'date',
|
|
|
|
is: function () { return false; },
|
|
|
|
format: function(s) {
|
|
|
|
var d = new Date(s.substring(0, s.length - 4));
|
|
|
|
return d.getTime();
|
|
|
|
},
|
|
|
|
type: 'numeric'
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
$('table.tablesorter').tablesorter({
|
|
|
|
headers: {
|
|
|
|
1: { sorter: false },
|
|
|
|
3: { sorter: 'programme' },
|
|
|
|
4: { sorter: 'date' },
|
|
|
|
5: { sorter: 'date' },
|
|
|
|
5: { sorter: false },
|
|
|
|
6: { sorter: false },
|
|
|
|
7: { sorter: false }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('table.tablesorter thead th').filter('[class!=header]')
|
|
|
|
.addClass('headerplain');
|
|
|
|
|
|
|
|
function docancel()
|
|
|
|
{
|
2012-11-29 22:28:08 +00:00
|
|
|
var table = $('#sdialogue').attr('table');
|
|
|
|
var slot = $('#sdialogue').attr('slot');
|
2012-03-31 21:16:31 +00:00
|
|
|
|
|
|
|
if (confirm('Really remove scheduled event?'))
|
|
|
|
{
|
|
|
|
$.get('cancel.jim?slot=' + slot +
|
|
|
|
'&table=' + table, function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
2012-11-29 22:28:08 +00:00
|
|
|
$('#sdialogue').dialog('close');
|
2012-03-31 21:16:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var $buttons1 = {
|
|
|
|
"Close" : function() {$(this).dialog('close');}
|
|
|
|
};
|
|
|
|
var $buttons2 = $.extend(
|
|
|
|
{"Cancel Event": function() { docancel() }},
|
|
|
|
$buttons1);
|
|
|
|
|
2012-11-29 22:28:08 +00:00
|
|
|
var $dialog = $('#sdialogue').dialog({
|
2012-03-31 21:16:31 +00:00
|
|
|
title: "Schedule Details",
|
|
|
|
modal: false, autoOpen: false,
|
|
|
|
height: 500, width: 700,
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: true, resizable: true,
|
|
|
|
buttons: $buttons2,
|
2012-11-29 22:28:08 +00:00
|
|
|
close: function(e,u) { $('#sdialogue').empty().html(
|
2012-03-31 21:16:31 +00:00
|
|
|
'<img src="/img/loading.gif" alt="loading">'); }
|
|
|
|
});
|
|
|
|
|
|
|
|
function schedpopup(e, o)
|
|
|
|
{
|
|
|
|
e.preventDefault();
|
|
|
|
var slot = o.attr('slot');
|
|
|
|
var table = o.attr('table');
|
2012-11-29 22:28:08 +00:00
|
|
|
$('#sdialogue').attr('slot', slot).attr('table', table);
|
2012-03-31 21:16:31 +00:00
|
|
|
|
|
|
|
var url = 'info.jim?slot=' + slot +
|
|
|
|
'&table=' + table;
|
2012-11-29 22:28:08 +00:00
|
|
|
$('#sdialogue').load(url);
|
2012-03-31 21:16:31 +00:00
|
|
|
$dialog.dialog('open');
|
|
|
|
}
|
|
|
|
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
|
|
|
|
|
|
|
|
$('table.tablesorter tbody tr').hover(
|
|
|
|
function() { $(this).addClass('hover'); },
|
|
|
|
function() { $(this).removeClass('hover'); });
|
|
|
|
|
|
|
|
$('button').button();
|
|
|
|
|
|
|
|
// Menu
|
|
|
|
|
|
|
|
var $paddialog = $('#padding').dialog({
|
|
|
|
title: "Padding values",
|
|
|
|
modal: true, autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: false, resizable: false,
|
|
|
|
buttons: {
|
|
|
|
"Confirm": function() {
|
|
|
|
$('#paddingf').ajaxSubmit({
|
|
|
|
dataType: 'text',
|
|
|
|
success: function(data) {
|
|
|
|
window.location.reload(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
"Cancel": function() { $(this).dialog('close'); }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#fchange').dialog({
|
|
|
|
autoOpen: false,
|
|
|
|
height: 'auto', width: 'auto',
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
"Update": function() {
|
|
|
|
var s = $('#fchangeform').serialize();
|
|
|
|
$.get('folder.jim?' + s,
|
|
|
|
function() { window.location.reload(true); });
|
|
|
|
},
|
|
|
|
"Close": function() {
|
|
|
|
$(this).dialog('close');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
close: function() {
|
|
|
|
$('#changeslot').val(0);
|
|
|
|
$('#fchangename').val('');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function preparemenu(el, menu)
|
|
|
|
{
|
|
|
|
if (!$(el).is("tr"))
|
|
|
|
el = $(el).closest('tr');
|
|
|
|
|
|
|
|
if ($(el).attr('table') != 'pending' && $(el).attr('rsvtype') == 3)
|
|
|
|
{
|
|
|
|
if ($(el).attr('ar') == 1)
|
|
|
|
$('#optmenu').changeContextMenuItem('#ar',
|
|
|
|
'Disable AR');
|
|
|
|
else
|
|
|
|
$('#optmenu').changeContextMenuItem('#ar',
|
|
|
|
'Enable AR');
|
|
|
|
$('#optmenu').enableContextMenuItems('#ar');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$('#optmenu').disableContextMenuItems('#ar');
|
|
|
|
|
2012-04-10 19:45:49 +00:00
|
|
|
if ($(el).attr('table') != 'pending' && (
|
|
|
|
$(el).attr('reckind') == 4 || $(el).attr('reckind') == 1))
|
2012-03-31 21:16:31 +00:00
|
|
|
$('#optmenu').enableContextMenuItems('#folder');
|
|
|
|
else
|
|
|
|
$('#optmenu').disableContextMenuItems('#folder');
|
|
|
|
}
|
|
|
|
|
|
|
|
function menuclick(action, el, pos)
|
|
|
|
{
|
|
|
|
if (!$(el).is("tr"))
|
|
|
|
el = $(el).closest('tr');
|
|
|
|
var sid = $(el).attr('sid');
|
|
|
|
//if (window.console)
|
|
|
|
//console.log("Got %s, el: %o, id: %d", action, el, sid);
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case 'delete':
|
|
|
|
var table = $(el).attr('table');
|
|
|
|
if (confirm('Are you sure you want to delete this entry?'))
|
|
|
|
$.get('cancel.jim?slot=' + sid +
|
|
|
|
'&table=' + table,
|
|
|
|
function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'ar':
|
|
|
|
if ($(el).attr('ar') == 1)
|
|
|
|
{
|
|
|
|
$('#paddingsid').val(sid);
|
|
|
|
$paddialog.dialog('open');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$.get('ar.jim?slot=' + sid,
|
|
|
|
function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'folder':
|
|
|
|
$('#fchangeslot').val(sid);
|
|
|
|
$('#fchangename').val($(el).find('a.schedule').text());
|
|
|
|
$('#fchange').dialog('open');
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
alert('Unhandled menu event, ' + action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('table.schedule tbody tr').hover(
|
|
|
|
function() { $(this).addClass('hover'); },
|
|
|
|
function() { $(this).removeClass('hover'); })
|
|
|
|
.contextMenu({menu: 'optmenu', beforeShow: preparemenu}, menuclick);
|
|
|
|
|
|
|
|
$('a.smenu')
|
|
|
|
.contextMenu({menu: 'optmenu', leftButton: true, beforeShow: preparemenu}, menuclick);
|
|
|
|
|
|
|
|
});
|
|
|
|
|