2
* Xibo - Digitial Signage - http://www.xibo.org.uk
3
* Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
var region_options_callback = function(outputDiv)
23
//Get all the tooltip_hidden
24
$(".tooltip_hidden").parent().hover(function() {
25
var html = $(".tooltip_hidden",this).html();
26
var left = this.offsetLeft - this.offsetParent.scrollLeft;;
28
//Change the hidden div's content
29
$('#tooltip_hover') .html(html)
33
$('#tooltip_hover').hide();
36
// Make the elements draggable
37
$(".timebar_ctl").draggable({
38
containment: document.getElementById("timeline_ctl")
41
$(".mediabreak").droppable({
42
accept: ".timebar_ctl",
44
drop: function(ev, ui) {
45
orderRegion(ui.draggable, this);
50
var background_button_callback = function()
52
//Want to attach an onchange event to the drop down for the bg-image
53
var fileUrl = $('#bg_image').val();
55
$('#bg_image_image').attr("src", "index.php?p=module&q=GetImage&file="+"tn_" + fileUrl);
58
var text_callback = function()
60
//Create the FCK editor
61
var oFCKeditor = new FCKeditor( 'ta_text' ) ;
62
oFCKeditor.BasePath = "3rdparty/fckeditor/" ;
63
oFCKeditor.ReplaceTextarea();
65
var regionid = $("#iRegionId").val();
66
var width = $("#region_"+regionid).width();
67
var height = $("#region_"+regionid).height();
70
if (width < 800) width = 800;
71
height = height + 75 //the width of the toolbar
73
$('#ta_text___Frame').attr("width",width+"px");
74
$('#ta_text___Frame').attr("height",height+"px");
78
height = height + 220;
80
$('#div_dialog').height(height+"px");
81
$('#div_dialog').dialog('option', 'width', width);
82
$('#div_dialog').dialog('option', 'height', height);
83
$('#div_dialog').dialog('option', 'position', 'center');
85
return false; //prevent submit
88
$(document).ready(function() {
90
var container = document.getElementById('layout');
92
$('.region').draggable({containment:container, stop:function(e, ui){
93
//Called when draggable is finished
94
submitBackground(this);
95
}}).resizable({containment:container, minWidth:25, minHeight:25, stop:function(e, ui){
96
//Called when resizable is finished
97
submitBackground(this);
98
}}).contextMenu('regionMenu', {
100
'options': function(t) {
101
XiboFormRender($(t).attr("href"));
103
'deleteRegion': function(t) {
107
'setAsHomepage': function(t) {
108
var layoutid = $(t).attr("layoutid");
109
var regionid = $(t).attr("regionid");
111
XiboFormRender("index.php?p=user&q=SetUserHomepageForm&layoutid="+layoutid+"®ionid="+regionid);
116
$('#layout').contextMenu('layoutMenu', {
118
'addRegion': function(t){
121
'editBackground': function(t) {
122
XiboFormRender($('#background_button').attr("href"));
124
'layoutProperties': function(t) {
125
XiboFormRender($('#edit_button').attr("href"));
127
'templateSave': function(t) {
128
var layoutid = $(t).attr("layoutid");
130
XiboFormRender("index.php?p=template&q=TemplateForm&layoutid="+layoutid);
137
$('.region').each(function(){
138
var preview = new Preview(this);
144
* Adds a region to the specified layout
145
* @param {Object} layout
147
function addRegion(layout)
149
var layoutid = $(layout).attr("layoutid");
151
$.ajax({type:"post", url:"index.php?p=layout&q=AddRegion&layoutid="+layoutid+"&ajax=true", cache:false, dataType:"json",success: XiboSubmitResponse});
155
* Submits the background changes from draggable / resizable
156
* @param {Object} region
158
function submitBackground(region)
160
var width = $(region).css("width");
161
var height = $(region).css("height");
162
var top = $(region).css("top");
163
var left = $(region).css("left");
164
var regionid = $(region).attr("regionid");
165
var layoutid = $(region).attr("layoutid");
167
$.ajax({type:"post", url:"index.php?p=layout&q=RegionChange&layoutid="+layoutid+"&ajax=true", cache:false, dataType:"json",
168
data:{"width":width,"height":height,"top":top,"left":left,"regionid":regionid},success: XiboSubmitResponse});
174
function deleteRegion(region) {
175
var regionid = $(region).attr("regionid");
176
var layoutid = $(region).attr("layoutid");
178
XiboFormRender("index.php?p=layout&q=DeleteRegionForm&layoutid="+layoutid+"®ionid="+regionid);
182
* Reorders the Region specified by the timebar and its position
183
* @param {Object} timeBar
184
* @param {Object} mediaBreak
186
function orderRegion(timeBar, mediaBreak) {
187
var timeLine = $(timeBar).parent().parent();
189
var layoutid = timeLine.attr("layoutid");
190
var regionid = timeLine.attr("regionid");
191
var mediaid = $(timeBar).attr("mediaid");
192
var sequence = $(mediaBreak).attr("breakid");
194
$.ajax({type:"post", url:"index.php?p=layout&q=RegionOrder&layoutid="+layoutid+"&callingpage=layout&ajax=true", cache:false, dataType:"json",
195
data:{"mediaid":mediaid,"sequence":sequence,"regionid":regionid},success: XiboSubmitResponse});
199
* Handles the tRegionOptions trigger
201
function tRegionOptions() {
202
var regionid = gup("regionid");
203
var layoutid = gup("layoutid");
205
XiboFormRender('index.php?p=layout&layoutid='+layoutid+'®ionid='+regionid+'&q=RegionOptions');
209
function Preview(regionElement)
212
// Load the preview - sequence 1
214
this.layoutid = $(regionElement).attr("layoutid");
215
this.regionid = $(regionElement).attr("regionid");
216
this.regionElement = regionElement;
217
this.width = $(regionElement).width();
218
this.height = $(regionElement).height();
220
var regionHeight = $(regionElement).height();
221
var arrowsTop = regionHeight / 2 - 28;
222
var regionid = this.regionid;
224
this.previewElement = $('.preview',regionElement);
225
this.previewContent = $('.previewContent', this.previewElement);
227
// Setup global control tracking
228
Preview.instances[this.regionid] = this;
230
// Create the Nav Buttons
231
$('.previewNav',this.previewElement)
232
.append("<div class='prevSeq' style='position:absolute; left:1px; top:"+ arrowsTop +"px'><img src='img/arrow_left.gif' /></div>")
233
.append("<div class='nextSeq' style='position:absolute; right:1px; top:"+ arrowsTop +"px'><img src='img/arrow_right.gif' /></div>");
235
// Bind the events to the Nav Buttons
236
$(regionElement).hover(function(){
238
$('.previewNav, .info', regionElement).fadeIn("slow");
241
$('.previewNav, .info', regionElement).fadeOut("slow");
244
$('.prevSeq', $(this.previewElement)).click(function() {
245
var preview = Preview.instances[regionid];
246
var maxSeq = $('#maxSeq', preview.previewContent[0]).val();
248
var currentSeq = preview.seq;
256
preview.SetSequence(currentSeq);
259
$('.nextSeq', $(this.previewElement)).click(function() {
260
var preview = Preview.instances[regionid];
261
var maxSeq = $('#maxSeq', preview.previewContent[0]).val();
263
var currentSeq = preview.seq;
266
if (currentSeq > maxSeq)
271
preview.SetSequence(currentSeq);
277
Preview.instances = {};
279
Preview.prototype.SetSequence = function(seq)
283
var layoutid = this.layoutid;
284
var regionid = this.regionid;
285
var previewContent = this.previewContent;
286
var previewElement = this.previewElement;
287
var maxSeq = $('#maxSeq', previewContent[0]).val();
289
this.width = $(this.regionElement).width();
290
this.height = $(this.regionElement).height();
292
//Get the sequence via AJAX
294
url:"index.php?p=layout&q=RegionPreview&ajax=true",
297
data:{"layoutid":layoutid,"seq":seq,"regionid":regionid,"width":this.width, "height":this.height},
298
success:function(response) {
300
if (response.success) {
301
// Success - what do we do now?
302
$(previewContent).html(response.html);
306
if (response.login) {
307
// We were logged out
308
LoginBox(response.message);
312
// Likely just an error that we want to report on
313
$(previewContent).html(response.html);
2
* Xibo - Digitial Signage - http://www.xibo.org.uk
3
* Copyright (C) 2006,2007,2008 Daniel Garner and James Packer
5
* This file is part of Xibo.
7
* Xibo is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Affero General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
12
* Xibo is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Affero General Public License for more details.
17
* You should have received a copy of the GNU Affero General Public License
18
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
var region_options_callback = function(outputDiv)
23
//Get all the tooltip_hidden
24
$(".tooltip_hidden").parent().hover(function() {
25
var html = $(".tooltip_hidden",this).html();
26
var left = this.offsetLeft - this.offsetParent.scrollLeft;;
28
//Change the hidden div's content
29
$('#tooltip_hover') .html(html)
33
$('#tooltip_hover').hide();
36
// Make the elements draggable
37
$(".timebar_ctl").draggable({
38
containment: document.getElementById("timeline_ctl")
41
$(".mediabreak").droppable({
42
accept: ".timebar_ctl",
44
drop: function(ev, ui) {
45
orderRegion(ui.draggable, this);
50
var background_button_callback = function()
52
//Want to attach an onchange event to the drop down for the bg-image
53
var fileUrl = $('#bg_image').val();
55
$('#bg_image_image').attr("src", "index.php?p=module&q=GetImage&file="+"tn_" + fileUrl);
58
var text_callback = function()
60
//Create the FCK editor
61
var oFCKeditor = new FCKeditor( 'ta_text' ) ;
62
oFCKeditor.BasePath = "3rdparty/fckeditor/" ;
63
oFCKeditor.ReplaceTextarea();
65
var regionid = $("#iRegionId").val();
66
var width = $("#region_"+regionid).width();
67
var height = $("#region_"+regionid).height();
70
if (width < 800) width = 800;
71
height = height + 75 //the width of the toolbar
73
$('#ta_text___Frame').attr("width",width+"px");
74
$('#ta_text___Frame').attr("height",height+"px");
78
height = height + 220;
80
$('#div_dialog').height(height+"px");
81
$('#div_dialog').dialog('option', 'width', width);
82
$('#div_dialog').dialog('option', 'height', height);
83
$('#div_dialog').dialog('option', 'position', 'center');
85
return false; //prevent submit
88
$(document).ready(function() {
90
var container = document.getElementById('layout');
92
$('.region').draggable({containment:container, stop:function(e, ui){
93
//Called when draggable is finished
94
submitBackground(this);
95
}}).resizable({containment:container, minWidth:25, minHeight:25, stop:function(e, ui){
96
//Called when resizable is finished
97
submitBackground(this);
98
}}).contextMenu('regionMenu', {
100
'options': function(t) {
101
XiboFormRender($(t).attr("href"));
103
'deleteRegion': function(t) {
107
'setAsHomepage': function(t) {
108
var layoutid = $(t).attr("layoutid");
109
var regionid = $(t).attr("regionid");
111
XiboFormRender("index.php?p=user&q=SetUserHomepageForm&layoutid="+layoutid+"®ionid="+regionid);
116
$('#layout').contextMenu('layoutMenu', {
118
'addRegion': function(t){
121
'editBackground': function(t) {
122
XiboFormRender($('#background_button').attr("href"));
124
'layoutProperties': function(t) {
125
XiboFormRender($('#edit_button').attr("href"));
127
'templateSave': function(t) {
128
var layoutid = $(t).attr("layoutid");
130
XiboFormRender("index.php?p=template&q=TemplateForm&layoutid="+layoutid);
137
$('.region').each(function(){
138
var preview = new Preview(this);
144
* Adds a region to the specified layout
145
* @param {Object} layout
147
function addRegion(layout)
149
var layoutid = $(layout).attr("layoutid");
151
$.ajax({type:"post", url:"index.php?p=layout&q=AddRegion&layoutid="+layoutid+"&ajax=true", cache:false, dataType:"json",success: XiboSubmitResponse});
155
* Submits the background changes from draggable / resizable
156
* @param {Object} region
158
function submitBackground(region)
160
var width = $(region).css("width");
161
var height = $(region).css("height");
162
var top = $(region).css("top");
163
var left = $(region).css("left");
164
var regionid = $(region).attr("regionid");
165
var layoutid = $(region).attr("layoutid");
167
$.ajax({type:"post", url:"index.php?p=layout&q=RegionChange&layoutid="+layoutid+"&ajax=true", cache:false, dataType:"json",
168
data:{"width":width,"height":height,"top":top,"left":left,"regionid":regionid},success: XiboSubmitResponse});
174
function deleteRegion(region) {
175
var regionid = $(region).attr("regionid");
176
var layoutid = $(region).attr("layoutid");
178
XiboFormRender("index.php?p=layout&q=DeleteRegionForm&layoutid="+layoutid+"®ionid="+regionid);
182
* Reorders the Region specified by the timebar and its position
183
* @param {Object} timeBar
184
* @param {Object} mediaBreak
186
function orderRegion(timeBar, mediaBreak) {
187
var timeLine = $(timeBar).parent().parent();
189
var layoutid = timeLine.attr("layoutid");
190
var regionid = timeLine.attr("regionid");
191
var mediaid = $(timeBar).attr("mediaid");
192
var sequence = $(mediaBreak).attr("breakid");
194
$.ajax({type:"post", url:"index.php?p=layout&q=RegionOrder&layoutid="+layoutid+"&callingpage=layout&ajax=true", cache:false, dataType:"json",
195
data:{"mediaid":mediaid,"sequence":sequence,"regionid":regionid},success: XiboSubmitResponse});
199
* Handles the tRegionOptions trigger
201
function tRegionOptions() {
202
var regionid = gup("regionid");
203
var layoutid = gup("layoutid");
205
XiboFormRender('index.php?p=layout&layoutid='+layoutid+'®ionid='+regionid+'&q=RegionOptions');
209
function Preview(regionElement)
212
// Load the preview - sequence 1
214
this.layoutid = $(regionElement).attr("layoutid");
215
this.regionid = $(regionElement).attr("regionid");
216
this.regionElement = regionElement;
217
this.width = $(regionElement).width();
218
this.height = $(regionElement).height();
220
var regionHeight = $(regionElement).height();
221
var arrowsTop = regionHeight / 2 - 28;
222
var regionid = this.regionid;
224
this.previewElement = $('.preview',regionElement);
225
this.previewContent = $('.previewContent', this.previewElement);
227
// Setup global control tracking
228
Preview.instances[this.regionid] = this;
230
// Create the Nav Buttons
231
$('.previewNav',this.previewElement)
232
.append("<div class='prevSeq' style='position:absolute; left:1px; top:"+ arrowsTop +"px'><img src='img/arrow_left.gif' /></div>")
233
.append("<div class='nextSeq' style='position:absolute; right:1px; top:"+ arrowsTop +"px'><img src='img/arrow_right.gif' /></div>");
235
// Bind the events to the Nav Buttons
236
$(regionElement).hover(function(){
238
$('.previewNav, .info', regionElement).fadeIn("slow");
241
$('.previewNav, .info', regionElement).fadeOut("slow");
244
$('.prevSeq', $(this.previewElement)).click(function() {
245
var preview = Preview.instances[regionid];
246
var maxSeq = $('#maxSeq', preview.previewContent[0]).val();
248
var currentSeq = preview.seq;
256
preview.SetSequence(currentSeq);
259
$('.nextSeq', $(this.previewElement)).click(function() {
260
var preview = Preview.instances[regionid];
261
var maxSeq = $('#maxSeq', preview.previewContent[0]).val();
263
var currentSeq = preview.seq;
266
if (currentSeq > maxSeq)
271
preview.SetSequence(currentSeq);
277
Preview.instances = {};
279
Preview.prototype.SetSequence = function(seq)
283
var layoutid = this.layoutid;
284
var regionid = this.regionid;
285
var previewContent = this.previewContent;
286
var previewElement = this.previewElement;
287
var maxSeq = $('#maxSeq', previewContent[0]).val();
289
this.width = $(this.regionElement).width();
290
this.height = $(this.regionElement).height();
292
//Get the sequence via AJAX
294
url:"index.php?p=layout&q=RegionPreview&ajax=true",
297
data:{"layoutid":layoutid,"seq":seq,"regionid":regionid,"width":this.width, "height":this.height},
298
success:function(response) {
300
if (response.success) {
301
// Success - what do we do now?
302
$(previewContent).html(response.html);
306
if (response.login) {
307
// We were logged out
308
LoginBox(response.message);
312
// Likely just an error that we want to report on
313
$(previewContent).html(response.html);
b'\\ No newline at end of file'