2014-01-14 23:22:29 +01:00
|
|
|
/*
|
|
|
|
* JavaScript functions for agenda.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-09-03 15:08:20 +02:00
|
|
|
function hideClosedSlides(hide) {
|
|
|
|
if (hide) {
|
2012-07-04 13:12:07 +02:00
|
|
|
$('#hidelink').attr('title', 'show');
|
2011-09-03 18:11:05 +02:00
|
|
|
$('#hidelink').removeClass('hide').addClass('show');
|
2013-11-12 21:33:57 +01:00
|
|
|
$('.agenda_list .icon-checked-new').each(function() {
|
2013-03-16 17:02:14 +01:00
|
|
|
$(this).parents("li").first().hide();
|
2011-09-03 15:08:20 +02:00
|
|
|
});
|
2013-03-16 17:02:14 +01:00
|
|
|
var hidden = $(".agenda_list li:hidden").length;
|
2012-12-09 12:59:56 +01:00
|
|
|
$('#hiddencount').text(interpolate(gettext(', of which %s are hidden.'), [hidden]));
|
2011-09-03 15:08:20 +02:00
|
|
|
} else {
|
2013-03-16 17:02:14 +01:00
|
|
|
$('.agenda_list li').show();
|
2011-09-03 18:11:05 +02:00
|
|
|
$('#hidelink').attr('title','hide');
|
|
|
|
$('#hidelink').removeClass('show').addClass('hide');
|
2011-09-03 15:08:20 +02:00
|
|
|
$('#hiddencount').text('');
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-09-03 11:42:44 +02:00
|
|
|
|
2013-04-29 20:03:50 +02:00
|
|
|
$('#coming_speakers_changed_form').submit(function() {
|
|
|
|
$('#sort_order').val($('#coming_speakers').sortable("toArray"));
|
2013-03-18 12:34:47 +01:00
|
|
|
});
|
|
|
|
|
2011-09-03 15:08:20 +02:00
|
|
|
$(function() {
|
2013-01-31 10:19:56 +01:00
|
|
|
// change participant status (on/off)
|
|
|
|
$('.close_link').click(function(event) {
|
2011-08-31 23:47:31 +02:00
|
|
|
event.preventDefault();
|
2013-01-08 23:05:35 +01:00
|
|
|
var link = $(this);
|
2011-08-31 23:47:31 +02:00
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
2013-01-08 23:05:35 +01:00
|
|
|
url: $(this).attr('href'),
|
2011-08-31 23:47:31 +02:00
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (data.closed) {
|
2013-01-31 10:19:56 +01:00
|
|
|
newclass = 'icon-checked-new';
|
|
|
|
link.parent().parent().addClass('offline');
|
|
|
|
link.addClass('btn-success');
|
2011-08-31 23:47:31 +02:00
|
|
|
} else {
|
2013-01-31 10:19:56 +01:00
|
|
|
newclass = 'icon-unchecked-new';
|
|
|
|
link.parent().parent().removeClass('offline');
|
|
|
|
link.removeClass('btn-success');
|
2011-08-31 23:47:31 +02:00
|
|
|
}
|
2013-01-31 10:19:56 +01:00
|
|
|
link.children('i').removeClass('icon-checked-new icon-unchecked-new').addClass(newclass);
|
2013-01-08 23:05:35 +01:00
|
|
|
link.attr('href', data.link);
|
2011-08-31 23:47:31 +02:00
|
|
|
}
|
|
|
|
});
|
2011-08-31 18:25:03 +02:00
|
|
|
});
|
2012-04-18 18:29:31 +02:00
|
|
|
// filter to show/hide closed items
|
|
|
|
$('#hide_closed_items').click(function(event) {
|
|
|
|
// show all items
|
2011-09-03 15:08:20 +02:00
|
|
|
if ($.cookie('Slide.HideClosed') == 1) {
|
|
|
|
$.cookie('Slide.HideClosed', 0);
|
|
|
|
hideClosedSlides(false);
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', false);
|
2012-07-04 13:12:07 +02:00
|
|
|
}
|
2012-04-18 18:29:31 +02:00
|
|
|
else { // hide closed items
|
2011-09-03 15:08:20 +02:00
|
|
|
$.cookie('Slide.HideClosed', 1);
|
|
|
|
hideClosedSlides(true);
|
2012-04-18 18:29:31 +02:00
|
|
|
$('#hide_closed_items').attr('checked', true);
|
2011-09-03 15:08:20 +02:00
|
|
|
}
|
2012-04-18 18:29:31 +02:00
|
|
|
});
|
2013-03-18 12:34:47 +01:00
|
|
|
|
|
|
|
// TODO: Fix this code and reactivate it again
|
|
|
|
//# if ($.cookie('Slide.HideClosed') === null) {
|
|
|
|
//# $('#hide_closed_items').attr('checked', false);
|
|
|
|
//# $.cookie('Slide.HideClosed', 0);
|
|
|
|
//# } else if ($.cookie('Slide.HideClosed') == 1) {
|
|
|
|
//# hideClosedSlides(true);
|
|
|
|
//# $('#hide_closed_items').attr('checked', true);
|
|
|
|
//# }
|
|
|
|
|
2013-04-29 20:03:50 +02:00
|
|
|
if ($('#coming_speakers').length > 0) {
|
|
|
|
$('#coming_speakers').sortable({axis: "y", containment: "parent", update: function(event, ui) {
|
|
|
|
$('#coming_speakers_changed_form').show();
|
2013-04-24 19:51:33 +02:00
|
|
|
}});
|
2013-04-29 20:03:50 +02:00
|
|
|
$('#coming_speakers').disableSelection();
|
2013-04-24 19:51:33 +02:00
|
|
|
}
|
2014-01-14 23:22:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* function for sorting agenda items
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
var $agenda_list = $('ol.agenda_list');
|
|
|
|
var rebuildOpenersClosers = function ( ) {
|
|
|
|
$agenda_list.find("li").each(function() {
|
|
|
|
var $li = $(this);
|
|
|
|
if ($li.find("> ol").length > 0) $li.find("> div .opener_closer").show();
|
|
|
|
else $li.find("> div .opener_closer").hide();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
var rebuildNesting = function( $root, level, parent_id ) {
|
|
|
|
var $children = $root.find('> li'),
|
|
|
|
curr_weight = -50;
|
|
|
|
|
|
|
|
$children.each(function() {
|
|
|
|
var $child = $(this),
|
|
|
|
$curr_element = $child.find('> div'),
|
|
|
|
my_id = $curr_element.find('.menu-mlid').val();
|
|
|
|
$curr_element.find('.menu-plid').val(parent_id);
|
|
|
|
$curr_element.find('.menu-weight').val(curr_weight);
|
|
|
|
curr_weight++;
|
|
|
|
$child.find('> ol').each(function() {
|
|
|
|
rebuildNesting( $(this), level + 1, my_id );
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
if ($agenda_list.hasClass("sortable")) $agenda_list.nestedSortable({
|
|
|
|
forcePlaceholderSize: true,
|
|
|
|
handle: 'div',
|
|
|
|
helper: 'clone',
|
|
|
|
items: 'li',
|
|
|
|
opacity: .6,
|
|
|
|
placeholder: 'placeholder',
|
|
|
|
revert: 250,
|
|
|
|
tabSize: 25,
|
|
|
|
tolerance: 'pointer',
|
|
|
|
toleranceElement: '> div',
|
|
|
|
isTree: true,
|
|
|
|
expandOnHover: 700,
|
|
|
|
startCollapsed: true,
|
|
|
|
update: function (event, ui) {
|
|
|
|
var $this = $(this);
|
|
|
|
rebuildNesting($this, 0, 0);
|
|
|
|
$('#changed-order-message').show();
|
|
|
|
rebuildOpenersClosers();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
rebuildOpenersClosers();
|
|
|
|
$agenda_list.find(".opener_closer .opener").click(function(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
$(this).parents("li").first().removeClass("closed");
|
|
|
|
});
|
|
|
|
$agenda_list.find(".opener_closer .closer").click(function(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
$(this).parents("li").first().addClass("closed");
|
|
|
|
});
|
2011-08-31 18:25:03 +02:00
|
|
|
});
|