2012-04-25 22:48:27 +02:00
|
|
|
/**
|
|
|
|
* OpenSlides projector functions
|
|
|
|
*
|
|
|
|
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
* :license: GNU GPL, see LICENSE for more details.
|
|
|
|
*/
|
|
|
|
|
2012-09-10 23:28:19 +02:00
|
|
|
// function that writes the widget list order to a cookie
|
2012-07-04 02:43:26 +02:00
|
|
|
function saveOrder() {
|
|
|
|
$(".column").each(function(index, value){
|
|
|
|
var colid = value.id;
|
|
|
|
var cookieName = "cookie-" + colid;
|
|
|
|
// Get the order for this column.
|
|
|
|
var order = $('#' + colid).sortable("toArray");
|
|
|
|
$.cookie(cookieName, order, { path: "/", expiry: new Date(2012, 1, 1)});
|
|
|
|
});
|
|
|
|
}
|
2012-09-10 23:28:19 +02:00
|
|
|
// function that restores the widget list order from a cookie
|
2012-07-04 02:43:26 +02:00
|
|
|
function restoreOrder() {
|
|
|
|
$(".column").each(function(index, value) {
|
|
|
|
var colid = value.id;
|
|
|
|
var cookieName = "cookie-" + colid
|
|
|
|
var cookie = $.cookie(cookieName);
|
|
|
|
if ( cookie == null ) { return; }
|
|
|
|
var IDs = cookie.split(",");
|
|
|
|
for (var i = 0, n = IDs.length; i < n; i++ ) {
|
2012-09-10 23:28:19 +02:00
|
|
|
var widgetID = IDs[i];
|
|
|
|
var widget = $(".column")
|
|
|
|
.find('#' + widgetID)
|
2012-07-04 02:43:26 +02:00
|
|
|
.appendTo($('#' + colid));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-03-06 08:19:49 +01:00
|
|
|
$(function() {
|
2012-07-04 02:43:26 +02:00
|
|
|
$( ".column" ).sortable({
|
|
|
|
connectWith: ".column",
|
|
|
|
stop: function() { saveOrder(); }
|
|
|
|
});
|
|
|
|
|
|
|
|
restoreOrder();
|
|
|
|
|
|
|
|
if ($.browser.msie) {
|
|
|
|
if ($.browser.version >= 8.0 && $.browser.version < 9.0)
|
|
|
|
{
|
|
|
|
/* scaling bug in IE8.. iframe has to be 4 times bigger */
|
|
|
|
$( "#iframe" ).css('width', 1024 * 4);
|
|
|
|
$( "#iframe" ).css('height', 768 * 4);
|
|
|
|
}
|
|
|
|
$( "#iframe" ).css('zoom', '0.25');
|
|
|
|
}
|
2012-07-04 03:21:03 +02:00
|
|
|
|
2012-07-04 02:43:26 +02:00
|
|
|
$('a.overlay').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var link = $(this);
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: $(this).attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (data['active']) {
|
|
|
|
$('#' + data['def_name'] + '_active').show();
|
|
|
|
$('#' + data['def_name'] + '_inactive').hide();
|
|
|
|
} else {
|
|
|
|
$('#' + data['def_name'] + '_active').hide();
|
|
|
|
$('#' + data['def_name'] + '_inactive').show();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-03-06 08:19:49 +01:00
|
|
|
// control the projector
|
|
|
|
$('.projector_edit').click(function(event) {
|
|
|
|
event.preventDefault();
|
2012-04-20 22:41:57 +02:00
|
|
|
var link = $(this);
|
2012-03-06 08:19:49 +01:00
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: link.attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// control countdown
|
2012-07-04 02:43:26 +02:00
|
|
|
$('.countdown_control').click(function(event) {
|
2012-03-06 08:19:49 +01:00
|
|
|
event.preventDefault();
|
2012-04-20 22:41:57 +02:00
|
|
|
var link = $(this);
|
2012-04-26 12:43:35 +02:00
|
|
|
var requestData = {};
|
|
|
|
|
|
|
|
if (link.attr('id') == "countdown_set") {
|
|
|
|
requestData = { "countdown_time" : $( "#countdown_time" ).val() };
|
|
|
|
}
|
2012-03-06 08:19:49 +01:00
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: link.attr('href'),
|
2012-04-26 12:43:35 +02:00
|
|
|
data: requestData,
|
2012-03-06 08:19:49 +01:00
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
2012-07-04 02:43:26 +02:00
|
|
|
if (data['state'] == 'active') {
|
|
|
|
$('#countdown_play').hide();
|
|
|
|
$('#countdown_stop').show();
|
|
|
|
} else {
|
|
|
|
$('#countdown_play').show();
|
|
|
|
$('#countdown_stop').hide();
|
|
|
|
}
|
|
|
|
$('#countdown_time').val(data['countdown_time'])
|
2012-03-06 08:19:49 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-04-26 12:43:35 +02:00
|
|
|
|
2012-03-06 08:19:49 +01:00
|
|
|
$('.countdown_visible_link').click(function(event) {
|
|
|
|
event.preventDefault();
|
2012-04-20 22:41:57 +02:00
|
|
|
var link = $(this);
|
2012-03-06 08:19:49 +01:00
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: link.attr('href'),
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (data.countdown_visible == "True") {
|
|
|
|
newclass = 'open';
|
|
|
|
} else {
|
|
|
|
newclass = 'closed';
|
|
|
|
}
|
|
|
|
link.removeClass('closed open').addClass(newclass);
|
|
|
|
link.attr('href', data.link);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-07-04 02:43:26 +02:00
|
|
|
|
2012-07-04 03:21:03 +02:00
|
|
|
$('#overlay_message').ajaxForm({
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
$('#overlay_message_text').val(data['overlay_message']);
|
|
|
|
}
|
2012-07-04 02:43:26 +02:00
|
|
|
});
|
2012-03-06 08:19:49 +01:00
|
|
|
});
|