Merge lp:~dangarner/xibo/106-server into lp:xibo/1.0
- 106-server
- Merge into halley
Proposed by
Dan Garner
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xibo Maintainters | Pending | ||
Review via email: mp+18470@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'server/install/database/1.sql' |
2 | --- server/install/database/1.sql 2009-12-31 11:48:37 +0000 |
3 | +++ server/install/database/1.sql 2010-02-02 19:48:16 +0000 |
4 | @@ -572,7 +572,7 @@ |
5 | -- Constraints for table `pages` |
6 | -- |
7 | ALTER TABLE `pages` |
8 | - ADD CONSTRAINT `pages_ibfk_1` FOREIGN KEY (`pagegroupID`) REFERENCES `pages` (`pagegroupID`); |
9 | + ADD CONSTRAINT `pages_ibfk_1` FOREIGN KEY (`pagegroupID`) REFERENCES `pagegroup` (`pagegroupID`); |
10 | |
11 | -- |
12 | -- Constraints for table `schedule` |
13 | |
14 | === added file 'server/install/database/10.sql' |
15 | --- server/install/database/10.sql 1970-01-01 00:00:00 +0000 |
16 | +++ server/install/database/10.sql 2010-02-02 19:48:16 +0000 |
17 | @@ -0,0 +1,30 @@ |
18 | +INSERT INTO `pagegroup` ( |
19 | +`pagegroupID` , |
20 | +`pagegroup` |
21 | +) |
22 | +VALUES ( |
23 | +NULL , 'Templates' |
24 | +); |
25 | + |
26 | +ALTER TABLE `pages` DROP FOREIGN KEY `pages_ibfk_1` ; |
27 | + |
28 | +ALTER TABLE `pages` ADD FOREIGN KEY ( `pagegroupID` ) REFERENCES `pagegroup` ( |
29 | +`pagegroupID` |
30 | +); |
31 | + |
32 | +INSERT INTO `pages` (name, pagegroupid) |
33 | +SELECT 'resolution', pagegroupid FROM `pagegroup` WHERE pagegroup = 'Templates'; |
34 | + |
35 | +INSERT INTO `menuitem` (`MenuID`, `PageID`, `Args`, `Text`, `Class`, `Img`, `Sequence`) |
36 | +SELECT '4', pageID, NULL, 'Resolutions', NULL, NULL, '10' FROM pages WHERE name = 'resolution'; |
37 | + |
38 | +INSERT INTO `menuitem` (`MenuID`, `PageID`, `Args`, `Text`, `Class`, `Img`, `Sequence`) |
39 | +SELECT '4', pageID, NULL, 'Templates', NULL, NULL, '10' FROM pages WHERE name = 'template'; |
40 | + |
41 | +UPDATE `module` SET `Module` = 'PowerPoint' WHERE `module`.`ModuleID` = 4 LIMIT 1 ; |
42 | + |
43 | +ALTER TABLE `layout` CHANGE `xml` `xml` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; |
44 | + |
45 | +UPDATE `version` SET `app_ver` = '1.0.6'; |
46 | +UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE'; |
47 | +UPDATE `version` SET `DBVersion` = '10'; |
48 | \ No newline at end of file |
49 | |
50 | === modified file 'server/install/database/9.sql' |
51 | --- server/install/database/9.sql 2009-12-31 11:48:37 +0000 |
52 | +++ server/install/database/9.sql 2010-02-02 19:48:16 +0000 |
53 | @@ -1,14 +1,13 @@ |
54 | INSERT INTO `pages` ( |
55 | -`pageID` , |
56 | `name` , |
57 | `pagegroupID` |
58 | ) |
59 | VALUES ( |
60 | -28 , 'manual', '2' |
61 | +'manual', '2' |
62 | ); |
63 | |
64 | -INSERT INTO `menuitem` (`MenuItemID`, `MenuID`, `PageID`, `Args`, `Text`, `Class`, `Img`, `Sequence`) |
65 | -VALUES (NULL, 2, 28, 'http://wiki.xibo.org.uk/wiki/Manual:TOC', 'Manual', 'help_button', 'img/dashboard/help.png', '10'); |
66 | +INSERT INTO `menuitem` (`MenuID`, `PageID`, `Args`, `Text`, `Class`, `Img`, `Sequence`) |
67 | +SELECT '2', pageID, 'http://wiki.xibo.org.uk/wiki/Manual:TOC', 'Manual', 'help_button', 'img/dashboard/help.png', '10' FROM pages WHERE name = 'manual'; |
68 | |
69 | UPDATE `module` SET `ValidExtensions` = 'ppt,pps,pptx' WHERE `module`.`ModuleID` =4 LIMIT 1 ; |
70 | |
71 | |
72 | === modified file 'server/lib/app/pagemanager.class.php' |
73 | --- server/lib/app/pagemanager.class.php 2009-12-31 11:48:37 +0000 |
74 | +++ server/lib/app/pagemanager.class.php 2010-02-02 19:48:16 +0000 |
75 | @@ -70,7 +70,7 @@ |
76 | // create a user object (will try to login) |
77 | // we must do this after executing any functions otherwise we will be logged |
78 | // out again before exec any log in function calls |
79 | - if ($this->q != 'login' && $this->q != 'forgotten') |
80 | + if ($this->q != 'login' && $this->q != 'logout') |
81 | { |
82 | // Attempt a user login |
83 | if (!$user->attempt_login($this->ajax)) |
84 | |
85 | === modified file 'server/lib/app/session.class.php' |
86 | --- server/lib/app/session.class.php 2009-07-07 20:01:49 +0000 |
87 | +++ server/lib/app/session.class.php 2010-02-02 19:48:16 +0000 |
88 | @@ -101,13 +101,13 @@ |
89 | |
90 | if (!$db->query(sprintf("UPDATE session SET session_expiration = $newExp, isExpired = 0 WHERE session_id = '%s' ", $db->escape_string($key)))) |
91 | { |
92 | - log_entry($db, "error", $db->error()); |
93 | + Debug::LogEntry($db, "error", $db->error()); |
94 | } |
95 | } |
96 | else |
97 | { |
98 | // Its set - but its wrong - not good |
99 | - log_entry($db, "error", "Incorrect SecurityToken from " . $remoteAddr); |
100 | + Debug::LogEntry($db, "error", "Incorrect SecurityToken from " . $remoteAddr); |
101 | |
102 | $this->isExpired = 1; |
103 | } |
104 | @@ -126,12 +126,12 @@ |
105 | |
106 | function write($key, $val) |
107 | { |
108 | - $db =& $this->db; |
109 | + $db =& $this->db; |
110 | |
111 | - $newExp = time() + $this->max_lifetime; |
112 | + $newExp = time() + $this->max_lifetime; |
113 | $lastaccessed = date("Y-m-d H:i:s"); |
114 | - $userAgent = Kit::GetParam('HTTP_USER_AGENT', $_SERVER, _STRING, 'No user agent'); |
115 | - $remoteAddr = Kit::GetParam('REMOTE_ADDR', $_SERVER, _STRING); |
116 | + $userAgent = Kit::GetParam('HTTP_USER_AGENT', $_SERVER, _STRING, 'No user agent'); |
117 | + $remoteAddr = Kit::GetParam('REMOTE_ADDR', $_SERVER, _STRING); |
118 | |
119 | $result = $db->query(sprintf("SELECT session_id FROM session WHERE session_id = '%s'", $db->escape_string($key))); |
120 | |
121 | @@ -158,7 +158,7 @@ |
122 | |
123 | if(!$db->query($SQL)) |
124 | { |
125 | - log_entry($db, "error", $db->error()); |
126 | + Debug::LogEntry($db, "error", $db->error()); |
127 | return(false); |
128 | } |
129 | |
130 | @@ -173,16 +173,20 @@ |
131 | |
132 | $result = $db->query("$SQL"); |
133 | |
134 | - if (!$result) log_entry($db,'audit',$db->error()); |
135 | + if (!$result) Debug::LogEntry($db,'audit',$db->error()); |
136 | |
137 | return $result; |
138 | } |
139 | |
140 | function gc($max_lifetime) |
141 | { |
142 | - $db =& $this->db; |
143 | - |
144 | - return $db->query("UPDATE session SET IsExpired = 1 WHERE session_expiration < ".time()); |
145 | + $db =& $this->db; |
146 | + |
147 | + // Delete sessions older than 10 times the max lifetime |
148 | + $SQL = sprintf("DELETE FROM session WHERE IsExpired = 1 AND session_expiration < %d", time() - ($max_lifetime * 10)); |
149 | + $db->query($SQL); |
150 | + |
151 | + return $db->query(sprintf("UPDATE session SET IsExpired = 1 WHERE session_expiration < %d", time())); |
152 | } |
153 | |
154 | function set_user($key, $userid) |
155 | @@ -203,19 +207,19 @@ |
156 | * Updates the session ID with a new one |
157 | * @return |
158 | */ |
159 | - public function RegenerateSessionID($oldSessionID) |
160 | - { |
161 | - $db =& $this->db; |
162 | - |
163 | - session_regenerate_id(false); |
164 | - |
165 | - $new_sess_id = session_id(); |
166 | - |
167 | - $this->key = $new_sess_id; |
168 | - |
169 | - $query = sprintf("UPDATE session SET session_id = '%s' WHERE session_id = '%s'", $db->escape_string($new_sess_id), $db->escape_string($oldSessionID)); |
170 | - $db->query($query); |
171 | - } |
172 | + public function RegenerateSessionID($oldSessionID) |
173 | + { |
174 | + $db =& $this->db; |
175 | + |
176 | + session_regenerate_id(false); |
177 | + |
178 | + $new_sess_id = session_id(); |
179 | + |
180 | + $this->key = $new_sess_id; |
181 | + |
182 | + $query = sprintf("UPDATE session SET session_id = '%s' WHERE session_id = '%s'", $db->escape_string($new_sess_id), $db->escape_string($oldSessionID)); |
183 | + $db->query($query); |
184 | + } |
185 | |
186 | function set_page($key, $lastpage) |
187 | { |
188 | @@ -243,7 +247,7 @@ |
189 | |
190 | if (!$db->query($SQL)) |
191 | { |
192 | - log_entry($db, "error", $db->error()); |
193 | + Debug::LogEntry($db, "error", $db->error()); |
194 | } |
195 | } |
196 | |
197 | @@ -255,7 +259,7 @@ |
198 | |
199 | if (!$db->query($SQL)) |
200 | { |
201 | - log_entry($db, "error", $db->error()); |
202 | + Debug::LogEntry($db, "error", $db->error()); |
203 | } |
204 | } |
205 | |
206 | |
207 | === added file 'server/lib/data/resolution.data.class.php' |
208 | --- server/lib/data/resolution.data.class.php 1970-01-01 00:00:00 +0000 |
209 | +++ server/lib/data/resolution.data.class.php 2010-02-02 19:48:16 +0000 |
210 | @@ -0,0 +1,99 @@ |
211 | +<?php |
212 | +/* |
213 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
214 | + * Copyright (C) 2009 Daniel Garner |
215 | + * |
216 | + * This file is part of Xibo. |
217 | + * |
218 | + * Xibo is free software: you can redistribute it and/or modify |
219 | + * it under the terms of the GNU Affero General Public License as published by |
220 | + * the Free Software Foundation, either version 3 of the License, or |
221 | + * any later version. |
222 | + * |
223 | + * Xibo is distributed in the hope that it will be useful, |
224 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
225 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
226 | + * GNU Affero General Public License for more details. |
227 | + * |
228 | + * You should have received a copy of the GNU Affero General Public License |
229 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
230 | + */ |
231 | +defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser."); |
232 | + |
233 | +class Resolution extends Data |
234 | +{ |
235 | + /** |
236 | + * Adds a resolution |
237 | + * @param <type> $resolution |
238 | + * @param <type> $width |
239 | + * @param <type> $height |
240 | + * @return <type> |
241 | + */ |
242 | + public function Add($resolution, $width, $height) |
243 | + { |
244 | + $db =& $this->db; |
245 | + |
246 | + $SQL = "INSERT INTO resolution (resolution, width, height) VALUES ('%s', %d, %d)"; |
247 | + $SQL = sprintf($SQL, $db->escape_string($resolution), $width, $height); |
248 | + |
249 | + if(!$db->query($SQL)) |
250 | + { |
251 | + trigger_error($db->error()); |
252 | + $this->SetError(25000, 'Cannot add this resolution.'); |
253 | + |
254 | + return false; |
255 | + } |
256 | + |
257 | + return true; |
258 | + } |
259 | + |
260 | + /** |
261 | + * Edits a resolution |
262 | + * @param <type> $resolutionID |
263 | + * @param <type> $resolution |
264 | + * @param <type> $width |
265 | + * @param <type> $height |
266 | + * @return <type> |
267 | + */ |
268 | + public function Edit($resolutionID, $resolution, $width, $height) |
269 | + { |
270 | + $db =& $this->db; |
271 | + |
272 | + $SQL = "UPDATE resolution SET resolution = '%s', width = %d, height = %d WHERE resolutionID = %d "; |
273 | + $SQL = sprintf($SQL, $db->escape_string($resolution), $width, $height, $resolutionID); |
274 | + |
275 | + if(!$db->query($SQL)) |
276 | + { |
277 | + trigger_error($db->error()); |
278 | + $this->SetError(25000, 'Cannot edit this resolution.'); |
279 | + |
280 | + return false; |
281 | + } |
282 | + |
283 | + return true; |
284 | + } |
285 | + |
286 | + /** |
287 | + * Deletes a Resolution |
288 | + * @param <type> $resolutionID |
289 | + * @return <type> |
290 | + */ |
291 | + public function Delete($resolutionID) |
292 | + { |
293 | + $db =& $this->db; |
294 | + |
295 | + $SQL = "DELETE FROM resolution WHERE resolutionID = %d"; |
296 | + $SQL = sprintf($SQL, $resolutionID); |
297 | + |
298 | + if(!$db->query($SQL)) |
299 | + { |
300 | + trigger_error($db->error()); |
301 | + $this->SetError(25000, 'Cannot delete this resolution.'); |
302 | + |
303 | + return false; |
304 | + } |
305 | + |
306 | + return true; |
307 | + } |
308 | +} |
309 | +?> |
310 | \ No newline at end of file |
311 | |
312 | === modified file 'server/lib/js/layout.js' |
313 | --- server/lib/js/layout.js 2009-12-31 11:48:37 +0000 |
314 | +++ server/lib/js/layout.js 2010-02-02 19:48:16 +0000 |
315 | @@ -45,15 +45,18 @@ |
316 | orderRegion(ui.draggable, this); |
317 | } |
318 | }); |
319 | + |
320 | + // Refresh the preview |
321 | + var preview = Preview.instances[$('#timeline_ctl').attr('regionid')]; |
322 | + preview.SetSequence(preview.seq); |
323 | } |
324 | |
325 | var background_button_callback = function() |
326 | { |
327 | //Want to attach an onchange event to the drop down for the bg-image |
328 | - var libraryloc = $('#libraryloc').val(); |
329 | - var fileUrl = $('#bg_image').val(); |
330 | + var id = $('#bg_image').val(); |
331 | |
332 | - $('#bg_image_image').attr("src", "index.php?p=module&q=GetImage&file="+"tn_" + fileUrl); |
333 | + $('#bg_image_image').attr("src", "index.php?p=module&q=GetImage&id=" + id + "&width=80&height=80&dynamic"); |
334 | } |
335 | |
336 | var text_callback = function() |
337 | @@ -89,25 +92,37 @@ |
338 | $('.region').draggable({containment:container, stop:function(e, ui){ |
339 | //Called when draggable is finished |
340 | submitBackground(this); |
341 | - }}).resizable({containment:container, minWidth:25, minHeight:25, stop:function(e, ui){ |
342 | + }, drag: updateRegionInfo }).resizable({containment:container, minWidth:25, minHeight:25, stop:function(e, ui){ |
343 | //Called when resizable is finished |
344 | submitBackground(this); |
345 | - }}).contextMenu('regionMenu', { |
346 | + }, resize: updateRegionInfo } |
347 | + ).contextMenu('regionMenu', { |
348 | bindings: { |
349 | - 'options': function(t) { |
350 | - XiboFormRender($(t).attr("href")); |
351 | + 'btnTimeline': function(t) { |
352 | + XiboFormRender($(t).attr("href")); |
353 | }, |
354 | - 'deleteRegion': function(t) { |
355 | + 'options' : function(region) { |
356 | + var width = $(region).css("width"); |
357 | + var height = $(region).css("height"); |
358 | + var top = $(region).css("top"); |
359 | + var left = $(region).css("left"); |
360 | + var regionid = $(region).attr("regionid"); |
361 | + var layoutid = $(region).attr("layoutid"); |
362 | + |
363 | + var layout = $('#layout'); |
364 | + |
365 | + XiboFormRender("index.php?p=layout&q=ManualRegionPositionForm&layoutid="+layoutid+"®ionid="+regionid+"&top="+top+"&left="+left+"&width="+width+"&height="+height+"&layoutWidth="+layout.width()+"&layoutHeight="+layout.height()); |
366 | + }, |
367 | + 'deleteRegion': function(t) { |
368 | deleteRegion(t); |
369 | - } |
370 | - , |
371 | - 'setAsHomepage': function(t) { |
372 | - var layoutid = $(t).attr("layoutid"); |
373 | - var regionid = $(t).attr("regionid"); |
374 | + }, |
375 | + 'setAsHomepage': function(t) { |
376 | + var layoutid = $(t).attr("layoutid"); |
377 | + var regionid = $(t).attr("regionid"); |
378 | |
379 | XiboFormRender("index.php?p=user&q=SetUserHomepageForm&layoutid="+layoutid+"®ionid="+regionid); |
380 | } |
381 | - } |
382 | + } |
383 | }); |
384 | |
385 | $('#layout').contextMenu('layoutMenu', { |
386 | @@ -132,11 +147,32 @@ |
387 | |
388 | // Preview |
389 | $('.region').each(function(){ |
390 | - var preview = new Preview(this); |
391 | + new Preview(this); |
392 | }); |
393 | |
394 | + // Aspect ration option |
395 | + $('#lockAspectRatio').change(function(){ |
396 | + var opt = $('#lockAspectRatio').val(); |
397 | + |
398 | + if (opt == "on") { |
399 | + alert("on"); |
400 | + $('.region').resizable('option', 'aspectRatio', true); |
401 | + } |
402 | + else { |
403 | + $('.region').resizable('option', 'aspectRatio', false); |
404 | + } |
405 | + |
406 | + }); |
407 | }); |
408 | |
409 | +/* |
410 | + * Updates the Region Info |
411 | + */ |
412 | +function updateRegionInfo(e, ui) { |
413 | + var pos = $(this).position(); |
414 | + $('.regionInfo', this).html($(this).width() + " x " + $(this).height() + " (" + pos.left + "," + pos.top + ")"); |
415 | +} |
416 | + |
417 | /** |
418 | * Adds a region to the specified layout |
419 | * @param {Object} layout |
420 | @@ -160,6 +196,9 @@ |
421 | var left = $(region).css("left"); |
422 | var regionid = $(region).attr("regionid"); |
423 | var layoutid = $(region).attr("layoutid"); |
424 | + |
425 | + var preview = Preview.instances[regionid]; |
426 | + preview.SetSequence(preview.seq); |
427 | |
428 | $.ajax({type:"post", url:"index.php?p=layout&q=RegionChange&layoutid="+layoutid+"&ajax=true", cache:false, dataType:"json", |
429 | data:{"width":width,"height":height,"top":top,"left":left,"regionid":regionid},success: XiboSubmitResponse}); |
430 | @@ -186,10 +225,11 @@ |
431 | var layoutid = timeLine.attr("layoutid"); |
432 | var regionid = timeLine.attr("regionid"); |
433 | var mediaid = $(timeBar).attr("mediaid"); |
434 | + var lkid = $(timeBar).attr("lkid"); |
435 | var sequence = $(mediaBreak).attr("breakid"); |
436 | |
437 | $.ajax({type:"post", url:"index.php?p=layout&q=RegionOrder&layoutid="+layoutid+"&callingpage=layout&ajax=true", cache:false, dataType:"json", |
438 | - data:{"mediaid":mediaid,"sequence":sequence,"regionid":regionid},success: XiboSubmitResponse}); |
439 | + data:{"mediaid":mediaid,"lkid":lkid,"sequence":sequence,"regionid":regionid},success: XiboSubmitResponse}); |
440 | } |
441 | |
442 | /** |
443 | @@ -202,10 +242,18 @@ |
444 | XiboFormRender('index.php?p=layout&layoutid='+layoutid+'®ionid='+regionid+'&q=RegionOptions'); |
445 | } |
446 | |
447 | +function manualPositionCallback() { |
448 | + $('#btnFullScreen').click(function(){ |
449 | + $('#width', '.XiboForm').val($('#layoutWidth').val()); |
450 | + $('#height', '.XiboForm').val($('#layoutHeight').val()); |
451 | + $('#top', '.XiboForm').val('0'); |
452 | + $('#left', '.XiboForm').val('0'); |
453 | + }) |
454 | +} |
455 | + |
456 | |
457 | function Preview(regionElement) |
458 | { |
459 | - |
460 | // Load the preview - sequence 1 |
461 | this.seq = 1; |
462 | this.layoutid = $(regionElement).attr("layoutid"); |
463 | @@ -229,15 +277,6 @@ |
464 | .append("<div class='prevSeq' style='position:absolute; left:1px; top:"+ arrowsTop +"px'><img src='img/arrow_left.gif' /></div>") |
465 | .append("<div class='nextSeq' style='position:absolute; right:1px; top:"+ arrowsTop +"px'><img src='img/arrow_right.gif' /></div>"); |
466 | |
467 | - // Bind the events to the Nav Buttons |
468 | - $(regionElement).hover(function(){ |
469 | - //In |
470 | - $('.previewNav, .info', regionElement).fadeIn("slow"); |
471 | - }, function(){ |
472 | - //Out |
473 | - $('.previewNav, .info', regionElement).fadeOut("slow"); |
474 | - }); |
475 | - |
476 | $('.prevSeq', $(this.previewElement)).click(function() { |
477 | var preview = Preview.instances[regionid]; |
478 | var maxSeq = $('#maxSeq', preview.previewContent[0]).val(); |
479 | @@ -276,12 +315,13 @@ |
480 | Preview.prototype.SetSequence = function(seq) |
481 | { |
482 | this.seq = seq; |
483 | + |
484 | + //console.log('Setting sequence to: ' + seq); |
485 | |
486 | var layoutid = this.layoutid; |
487 | var regionid = this.regionid; |
488 | var previewContent = this.previewContent; |
489 | - var previewElement = this.previewElement; |
490 | - var maxSeq = $('#maxSeq', previewContent[0]).val(); |
491 | + |
492 | |
493 | this.width = $(this.regionElement).width(); |
494 | this.height = $(this.regionElement).height(); |
495 | |
496 | === added file 'server/lib/js/resolution.js' |
497 | --- server/lib/js/resolution.js 1970-01-01 00:00:00 +0000 |
498 | +++ server/lib/js/resolution.js 2010-02-02 19:48:16 +0000 |
499 | @@ -0,0 +1,19 @@ |
500 | +/* |
501 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
502 | + * Copyright (C) 2009 Daniel Garner |
503 | + * |
504 | + * This file is part of Xibo. |
505 | + * |
506 | + * Xibo is free software: you can redistribute it and/or modify |
507 | + * it under the terms of the GNU Affero General Public License as published by |
508 | + * the Free Software Foundation, either version 3 of the License, or |
509 | + * any later version. |
510 | + * |
511 | + * Xibo is distributed in the hope that it will be useful, |
512 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
513 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
514 | + * GNU Affero General Public License for more details. |
515 | + * |
516 | + * You should have received a copy of the GNU Affero General Public License |
517 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
518 | + */ |
519 | \ No newline at end of file |
520 | |
521 | === modified file 'server/lib/modules/module.class.php' |
522 | --- server/lib/modules/module.class.php 2009-12-31 11:48:37 +0000 |
523 | +++ server/lib/modules/module.class.php 2010-02-02 19:48:16 +0000 |
524 | @@ -561,5 +561,15 @@ |
525 | |
526 | return $this->name; |
527 | } |
528 | + |
529 | + /** |
530 | + * Preview code for a module |
531 | + * @param <type> $width |
532 | + * @param <type> $height |
533 | + */ |
534 | + public function Preview($width, $height) |
535 | + { |
536 | + return '<div style="text-align:center;"><img alt="' . $this->type . ' thumbnail" src="img/forms/' . $this->type . '.png" /></div>'; |
537 | + } |
538 | } |
539 | ?> |
540 | \ No newline at end of file |
541 | |
542 | === modified file 'server/lib/pages/content.class.php' |
543 | --- server/lib/pages/content.class.php 2009-12-03 21:27:56 +0000 |
544 | +++ server/lib/pages/content.class.php 2010-02-02 19:48:16 +0000 |
545 | @@ -403,6 +403,9 @@ |
546 | $user =& $this->user; |
547 | $response = new ResponseManager(); |
548 | $formMgr = new FormManager($db, $user); |
549 | + |
550 | + $mediatype = ''; |
551 | + $name = ''; |
552 | |
553 | if (isset($_SESSION['content']['mediatype'])) $mediatype = $_SESSION['content']['mediatype']; |
554 | if (isset($_SESSION['content']['name'])) $name = $_SESSION['content']['name']; |
555 | @@ -519,7 +522,7 @@ |
556 | <tr> |
557 | <th>Name</th> |
558 | <th>Type</th> |
559 | - <th>Duration</th> |
560 | + <th>Duration (s)</th> |
561 | <th>Shared</th> |
562 | <th>Select</th> |
563 | </tr> |
564 | |
565 | === modified file 'server/lib/pages/layout.class.php' |
566 | --- server/lib/pages/layout.class.php 2009-11-29 18:51:30 +0000 |
567 | +++ server/lib/pages/layout.class.php 2010-02-02 19:48:16 +0000 |
568 | @@ -294,7 +294,7 @@ |
569 | } |
570 | |
571 | // Create an array out of the tags |
572 | - $tagsArray = split(' ', $tags); |
573 | + $tagsArray = explode(' ', $tags); |
574 | |
575 | // Add the tags XML to the layout |
576 | $layoutObject = new Layout($db); |
577 | @@ -821,37 +821,44 @@ |
578 | */ |
579 | function BackgroundForm() |
580 | { |
581 | - $db =& $this->db; |
582 | - $user =& $this->user; |
583 | + $db =& $this->db; |
584 | + $user =& $this->user; |
585 | |
586 | $helpManager = new HelpManager($db, $user); |
587 | - $response = new ResponseManager(); |
588 | + $response = new ResponseManager(); |
589 | |
590 | |
591 | //load the XML into a SimpleXML OBJECT |
592 | - $xml = simplexml_load_string($this->xml); |
593 | + $xml = simplexml_load_string($this->xml); |
594 | |
595 | - $backgroundImage = (string) $xml['background']; |
596 | - $backgroundColor = (string) $xml['bgcolor']; |
597 | - $width = (string) $xml['width']; |
598 | - $height = (string) $xml['height']; |
599 | - |
600 | - //File upload directory.. get this from the settings object |
601 | - $databaseDir = Config::GetSetting($db, "LIBRARY_LOCATION"); |
602 | - |
603 | - //Manipulate the images slightly |
604 | + $backgroundImage = (string) $xml['background']; |
605 | + $backgroundColor = (string) $xml['bgcolor']; |
606 | + $width = (string) $xml['width']; |
607 | + $height = (string) $xml['height']; |
608 | + $bgImageId = 0; |
609 | + |
610 | + // Do we need to override the background with one passed in? |
611 | + $bgOveride = Kit::GetParam('backgroundOveride', _GET, _STRING); |
612 | + |
613 | + if ($bgOveride != '') |
614 | + $backgroundImage = $bgOveride; |
615 | + |
616 | + // Manipulate the images slightly |
617 | if ($backgroundImage != "") |
618 | { |
619 | - $backgroundImage = str_replace("bg_".$width."x".$height."_", "", $backgroundImage); |
620 | - $thumbBgImage = "index.php?p=module&q=GetImage&file=tn_".$backgroundImage; |
621 | + // Get the ID for the background image |
622 | + $bgImageInfo = explode('.', $backgroundImage); |
623 | + $bgImageId = $bgImageInfo[0]; |
624 | + |
625 | + $thumbBgImage = "index.php?p=module&q=GetImage&id=$bgImageId&width=80&height=80&dynamic"; |
626 | } |
627 | else |
628 | { |
629 | - $thumbBgImage = "img/forms/filenotfound.png"; |
630 | + $thumbBgImage = "img/forms/filenotfound.png"; |
631 | } |
632 | |
633 | //A list of available backgrounds |
634 | - $backgroundList = dropdownlist("SELECT '', 'None', 3, 1 AS name, 0 As sort_order UNION SELECT storedAs, name, permissionID, userID, 1 AS sort_order FROM media WHERE type = 'image' AND IsEdited = 0 AND retired = 0 AND storedAs IS NOT NULL ORDER BY sort_order, 1","bg_image", $backgroundImage, "onchange=\"background_button_callback()\"", false, true); |
635 | + $backgroundList = dropdownlist("SELECT '0', 'None', 3, 1 AS name, 0 As sort_order UNION SELECT mediaID, name, permissionID, userID, 1 AS sort_order FROM media WHERE type = 'image' AND IsEdited = 0 AND retired = 0 AND storedAs IS NOT NULL ORDER BY sort_order, 1","bg_image", $bgImageId, "onchange=\"background_button_callback()\"", false, true); |
636 | |
637 | //A list of web safe colors |
638 | //Strip the # from the currently set color |
639 | @@ -868,7 +875,7 @@ |
640 | trigger_error("Unable to get the Resolution information", E_USER_ERROR); |
641 | } |
642 | |
643 | - $row = $db->get_row($results) ; |
644 | + $row = $db->get_row($results) ; |
645 | $resolutionid = Kit::ValidateParam($row[0], _INT); |
646 | |
647 | //Make up the list |
648 | @@ -886,7 +893,6 @@ |
649 | // |
650 | $form = <<<FORM |
651 | <form class="XiboForm" method="post" action="index.php?p=layout&q=EditBackground"> |
652 | - <input type="hidden" id="libraryloc" value="$databaseDir"> |
653 | <input type="hidden" id="layoutid" name="layoutid" value="$this->layoutid"> |
654 | <table> |
655 | <tr> |
656 | @@ -910,6 +916,7 @@ |
657 | <td> |
658 | <input type="submit" value="Save" /> |
659 | <input id="btnCancel" type="button" title="No / Cancel" onclick="$('#div_dialog').dialog('close');return false; " value="Cancel" /> |
660 | + <input class="XiboFormButton" type="button" href="index.php?p=module&q=Exec&mod=image&method=AddForm&backgroundImage=true&layoutid=$this->layoutid" title="Add Image" value="Add Image" /> |
661 | $helpButton |
662 | </td> |
663 | </tr> |
664 | @@ -927,20 +934,22 @@ |
665 | */ |
666 | function EditBackground() |
667 | { |
668 | - $db =& $this->db; |
669 | - $user =& $this->user; |
670 | - $response = new ResponseManager(); |
671 | + $db =& $this->db; |
672 | + $user =& $this->user; |
673 | + $response = new ResponseManager(); |
674 | |
675 | - $layoutid = Kit::GetParam('layoutid', _POST, _INT); |
676 | - $bg_color = '#'.Kit::GetParam('bg_color', _POST, _STRING); |
677 | - $bg_image = Kit::GetParam('bg_image', _POST, _STRING); |
678 | - $bg_image_original = Kit::GetParam('bg_image', _POST, _STRING); |
679 | + $layoutid = Kit::GetParam('layoutid', _POST, _INT); |
680 | + $bg_color = '#'.Kit::GetParam('bg_color', _POST, _STRING); |
681 | + $mediaID = Kit::GetParam('bg_image', _POST, _INT); |
682 | $resolutionid = Kit::GetParam('resolutionid', _POST, _INT); |
683 | - |
684 | - //File upload directory.. get this from the settings object |
685 | - $libraryLocation = Config::GetSetting($db, "LIBRARY_LOCATION"); |
686 | - |
687 | - //Look up the width and the height |
688 | + |
689 | + // Get the file URI |
690 | + $SQL = sprintf("SELECT StoredAs FROM media WHERE MediaID = %d", $mediaID); |
691 | + |
692 | + if (!$bg_image = $db->GetSingleValue($SQL, 'StoredAs', _STRING)) |
693 | + trigger_error('No media found for that media ID', E_USER_ERROR); |
694 | + |
695 | + // Look up the width and the height |
696 | $SQL = sprintf("SELECT width, height FROM resolution WHERE resolutionID = %d ", $resolutionid); |
697 | |
698 | if (!$results = $db->query($SQL)) |
699 | @@ -953,25 +962,12 @@ |
700 | $row = $db->get_row($results) ; |
701 | $width = Kit::ValidateParam($row[0], _INT); |
702 | $height = Kit::ValidateParam($row[1], _INT); |
703 | - |
704 | - //If we have a background image we need to create one of the appropriate size |
705 | - if ($bg_image != "") |
706 | - { |
707 | - //Create the appropriate file name |
708 | - $bg_image = "bg_" . $width . "x" . $height . "_" . $bg_image; |
709 | - |
710 | - //Make sure we have an appropriately sized image |
711 | - if (!file_exists($libraryLocation . $bg_image)) |
712 | - { |
713 | - ResizeImage($libraryLocation.$bg_image_original, $libraryLocation . $bg_image, $width, $height); |
714 | - } |
715 | - } |
716 | - |
717 | + |
718 | + |
719 | include_once("lib/pages/region.class.php"); |
720 | - |
721 | $region = new region($db, $user); |
722 | |
723 | - if (!$region->EditBackground($layoutid, $bg_color, $bg_image_original, $width, $height)) |
724 | + if (!$region->EditBackground($layoutid, $bg_color, $bg_image, $width, $height)) |
725 | { |
726 | //there was an ERROR |
727 | $response->SetError($region->errorMsg); |
728 | @@ -979,7 +975,7 @@ |
729 | } |
730 | |
731 | // Update the layout record with the new background |
732 | - $SQL = sprintf("UPDATE layout SET background = '%s' WHERE layoutid = %d ", $bg_image_original, $layoutid); |
733 | + $SQL = sprintf("UPDATE layout SET background = '%s' WHERE layoutid = %d ", $bg_image, $layoutid); |
734 | |
735 | if (!$db->query($SQL)) |
736 | { |
737 | @@ -1058,6 +1054,95 @@ |
738 | $response->SetFormSubmitResponse('Region Deleted.', true, sprintf("index.php?p=layout&layoutid=%d&modify=true", $this->layoutid)); |
739 | $response->Respond(); |
740 | } |
741 | + |
742 | + /* |
743 | + * Form called by the layout which shows a manual positioning/sizing form. |
744 | + */ |
745 | + function ManualRegionPositionForm() |
746 | + { |
747 | + $db =& $this->db; |
748 | + $user =& $this->user; |
749 | + $response = new ResponseManager(); |
750 | + |
751 | + $regionid = Kit::GetParam('regionid', _GET, _STRING); |
752 | + $layoutid = Kit::GetParam('layoutid', _GET, _INT); |
753 | + $top = Kit::GetParam('top', _GET, _INT); |
754 | + $left = Kit::GetParam('left', _GET, _INT); |
755 | + $width = Kit::GetParam('width', _GET, _INT); |
756 | + $height = Kit::GetParam('height', _GET, _INT); |
757 | + $layoutWidth = Kit::GetParam('layoutWidth', _GET, _INT); |
758 | + $layoutHeight = Kit::GetParam('layoutHeight', _GET, _INT); |
759 | + |
760 | + $form = <<<END |
761 | + <form class="XiboForm" method="post" action="index.php?p=layout&q=ManualRegionPosition"> |
762 | + <input type="hidden" name="layoutid" value="$layoutid"> |
763 | + <input type="hidden" name="regionid" value="$regionid"> |
764 | + <input id="layoutWidth" type="hidden" name="layoutWidth" value="$layoutWidth"> |
765 | + <input id="layoutHeight" type="hidden" name="layoutHeight" value="$layoutHeight"> |
766 | + <table> |
767 | + <tr> |
768 | + <td><label for="top" title="Offset from the Top Corner">Top Offset</label></td> |
769 | + <td><input name="top" type="text" id="top" value="$top" tabindex="1" /></td> |
770 | + </tr> |
771 | + <tr> |
772 | + <td><label for="left" title="Offset from the Left Corner">Left Offset</label></td> |
773 | + <td><input name="left" type="text" id="left" value="$left" tabindex="2" /></td> |
774 | + </tr> |
775 | + <tr> |
776 | + <td><label for="width" title="Width of the Region">Width</label></td> |
777 | + <td><input name="width" type="text" id="width" value="$width" tabindex="3" /></td> |
778 | + </tr> |
779 | + <tr> |
780 | + <td><label for="height" title="Height of the Region">Height</label></td> |
781 | + <td><input name="height" type="text" id="height" value="$height" tabindex="4" /></td> |
782 | + </tr> |
783 | + <tr> |
784 | + <td></td> |
785 | + <td> |
786 | + <input type='submit' value="Save" / > |
787 | + <input id="btnCancel" type="button" title="No / Cancel" onclick="$('#div_dialog').dialog('close');return false; " value="Cancel" /> |
788 | + <input id="btnFullScreen" type='button' value="Full Screen" / > |
789 | + </td> |
790 | + </tr> |
791 | + </table> |
792 | + </form> |
793 | +END; |
794 | + |
795 | + $response->SetFormRequestResponse($form, 'Manual Region Positioning', '350px', '275px', 'manualPositionCallback'); |
796 | + $response->Respond(); |
797 | + } |
798 | + |
799 | + function ManualRegionPosition() |
800 | + { |
801 | + $db =& $this->db; |
802 | + $user =& $this->user; |
803 | + $response = new ResponseManager(); |
804 | + |
805 | + $layoutid = Kit::GetParam('layoutid', _POST, _INT); |
806 | + $regionid = Kit::GetParam('regionid', _POST, _STRING); |
807 | + $top = Kit::GetParam('top', _POST, _INT); |
808 | + $left = Kit::GetParam('left', _POST, _INT); |
809 | + $width = Kit::GetParam('width', _POST, _INT); |
810 | + $height = Kit::GetParam('height', _POST, _INT); |
811 | + |
812 | + Debug::LogEntry($db, 'audit', sprintf('Layoutid [%d] Regionid [%s]', $layoutid, $regionid), 'layout', 'ManualRegionPosition'); |
813 | + |
814 | + // Remove the "px" from them |
815 | + $width = str_replace('px', '', $width); |
816 | + $height = str_replace('px', '', $height); |
817 | + $top = str_replace('px', '', $top); |
818 | + $left = str_replace('px', '', $left); |
819 | + |
820 | + include_once("lib/pages/region.class.php"); |
821 | + |
822 | + $region = new region($db, $user); |
823 | + |
824 | + if (!$region->EditRegion($layoutid, $regionid, $width, $height, $top, $left)) |
825 | + trigger_error($region->errorMsg, E_USER_ERROR); |
826 | + |
827 | + $response->SetFormSubmitResponse('Region Resized', true, "index.php?p=layout&modify=true&layoutid=$layoutid"); |
828 | + $response->Respond(); |
829 | + } |
830 | |
831 | /** |
832 | * Edits the region information |
833 | @@ -1073,12 +1158,12 @@ |
834 | |
835 | //Vars |
836 | $regionid = Kit::GetParam('regionid', _REQUEST, _STRING); |
837 | - $width = $_POST['width']; |
838 | - $height = $_POST['height']; |
839 | - $top = $_POST['top']; |
840 | - $left = $_POST['left']; |
841 | + $top = Kit::GetParam('top', _POST, _INT); |
842 | + $left = Kit::GetParam('left', _POST, _INT); |
843 | + $width = Kit::GetParam('width', _POST, _INT); |
844 | + $height = Kit::GetParam('height', _POST, _INT); |
845 | |
846 | - //Remove the "px" from them |
847 | + // Remove the "px" from them |
848 | $width = str_replace("px", '', $width); |
849 | $height = str_replace("px", '', $height); |
850 | $top = str_replace("px", '', $top); |
851 | @@ -1114,8 +1199,9 @@ |
852 | //Vars |
853 | $regionid = Kit::GetParam('regionid', _POST, _STRING); |
854 | $mediaid = Kit::GetParam('mediaid', _POST, _STRING); |
855 | + $lkid = Kit::GetParam('lkid', _POST, _STRING, ''); |
856 | $sequence = Kit::GetParam('sequence', _POST, _INT); |
857 | - $callingPage = Kit::GetParam('callingpage', _POST, _STRING); |
858 | + $callingPage = Kit::GetParam('callingpage', _POST, _STRING); |
859 | |
860 | $sequence--; //zero based |
861 | |
862 | @@ -1123,7 +1209,7 @@ |
863 | |
864 | $region = new region($db, $user); |
865 | |
866 | - if (!$region->ReorderMedia($this->layoutid, $regionid, $mediaid, $sequence)) |
867 | + if (!$region->ReorderMedia($this->layoutid, $regionid, $mediaid, $sequence, $lkid)) |
868 | { |
869 | //there was an ERROR |
870 | trigger_error($region->errorMsg, E_USER_ERROR); |
871 | @@ -1192,12 +1278,15 @@ |
872 | //Fix up the background css |
873 | if ($bgImage == "") |
874 | { |
875 | - $background_css = "$bgColor"; |
876 | + $background_css = "$bgColor"; |
877 | } |
878 | else |
879 | { |
880 | - $bgImage = "bg_" . $width . "x" . $height . "_" . $bgImage; |
881 | - $background_css = "url('index.php?p=module&q=GetImage&file=$bgImage') top center no-repeat; background-color:$bgColor"; |
882 | + // Get the ID for the background image |
883 | + $bgImageInfo = explode('.', $bgImage); |
884 | + $bgImageId = $bgImageInfo[0]; |
885 | + |
886 | + $background_css = "url('index.php?p=module&q=GetImage&id=$bgImageId&width=$width&height=$height&dynamic&proportional=0') top center no-repeat; background-color:$bgColor"; |
887 | } |
888 | |
889 | $width = $width . "px"; |
890 | @@ -1210,38 +1299,49 @@ |
891 | //get the regions |
892 | foreach ($regionNodeList as $region) |
893 | { |
894 | - //get dimensions |
895 | + // get dimensions |
896 | + $tipWidth = $region->getAttribute('width'); |
897 | + $tipHeight = $region->getAttribute('height'); |
898 | + $tipTop = $region->getAttribute('top'); |
899 | + $tipLeft = $region->getAttribute('left'); |
900 | + |
901 | $regionWidth = $region->getAttribute('width') . "px"; |
902 | $regionHeight = $region->getAttribute('height') . "px"; |
903 | - $regionLeft = $region->getAttribute('left') . "px"; |
904 | - $regionTop = $region->getAttribute('top') . "px"; |
905 | - $regionid = $region->getAttribute('id'); |
906 | + $regionLeft = $region->getAttribute('left') . "px"; |
907 | + $regionTop = $region->getAttribute('top') . "px"; |
908 | + $regionid = $region->getAttribute('id'); |
909 | |
910 | - $previewStyle = "position:absolute; top:0px; left:0px; width: 100%; height: 100%;"; |
911 | - $paddingTop = $regionHeight / 2 - 16; |
912 | - $paddingTop = $paddingTop . "px"; |
913 | + $paddingTop = $regionHeight / 2 - 16; |
914 | + $paddingTop = $paddingTop . "px"; |
915 | |
916 | $regionTransparency = '<div class="regionTransparency" style="width:100%; height:100%;">'; |
917 | $regionTransparency .= '</div>'; |
918 | |
919 | $doubleClickLink = "XiboFormRender($(this).attr('href'))"; |
920 | $regionHtml .= "<div id='region_$regionid' regionid='$regionid' layoutid='$this->layoutid' href='index.php?p=layout&layoutid=$this->layoutid®ionid=$regionid&q=RegionOptions' ondblclick=\"$doubleClickLink\"' class='region' style=\"position:absolute; width:$regionWidth; height:$regionHeight; top: $regionTop; left: $regionLeft;\"> |
921 | - $regionTransparency |
922 | - <div class='preview' style='$previewStyle'> |
923 | + $regionTransparency |
924 | + <div class='regionInfo'> |
925 | + $tipWidth x $tipHeight ($tipLeft,$tipTop) |
926 | + </div> |
927 | + <div class='preview'> |
928 | <div class='previewContent'></div> |
929 | - <div class='previewNav' style='display:none;'></div> |
930 | + <div class='previewNav'></div> |
931 | </div> |
932 | </div>"; |
933 | } |
934 | |
935 | //render the view pane |
936 | $surface = <<<HTML |
937 | + <!--<div id="aspectRatioOption"> |
938 | + <input id="lockAspectRatio" type="checkbox" /><label for="lockAspectRatio">Lock Aspect Ratio?</label> |
939 | + </div>--> |
940 | <div id="layout" layoutid="$this->layoutid" style="position:relative; width:$width; height:$height; border: 1px solid #000; background:$background_css;"> |
941 | $regionHtml |
942 | </div> |
943 | <div class="contextMenu" id="regionMenu"> |
944 | <ul> |
945 | - <li id="options">Options</li> |
946 | + <li id="btnTimeline">Timeline</li> |
947 | + <li id="options">Options</li> |
948 | <li id="deleteRegion">Delete</li> |
949 | <li id="setAsHomepage">Set as Homepage</li> |
950 | </ul> |
951 | @@ -1415,7 +1515,7 @@ |
952 | $rightClass = "timebar_".$mediaType."_right"; |
953 | |
954 | $mediaHtml .= <<<BUTTON |
955 | - <div class="timebar_ctl" style="position:absolute; top:$top; left:$leftVal; width:$thumbWidthVal;" mediaid="$mediaid"> |
956 | + <div class="timebar_ctl" style="position:absolute; top:$top; left:$leftVal; width:$thumbWidthVal;" mediaid="$mediaid" lkid="$lkid"> |
957 | <div class="timebar"> |
958 | <div class="$rightClass"> |
959 | <div class="$leftClass"></div> |
960 | @@ -1641,7 +1741,7 @@ |
961 | |
962 | if (!$xmlString = $region->GetLayoutXml($layoutid)) |
963 | { |
964 | - trigger_error($region->errorMsg, E_USER_ERROR); |
965 | + trigger_error($region->errorMsg, E_USER_ERROR); |
966 | } |
967 | |
968 | $xml->loadXML($xmlString); |
969 | @@ -1651,9 +1751,9 @@ |
970 | $nodeList = $xpath->query("//region[@id='$regionid']/media"); |
971 | |
972 | $return = "<input type='hidden' id='maxSeq' value='{$nodeList->length}' />"; |
973 | - $return .= "<div class='seqInfo' style='position:absolute; right:15px; top:1px; color:#FFF; background-color:#000; z-index:50; padding: 5px;'> |
974 | - <span>$seqGiven / {$nodeList->length}</span> |
975 | - </div>"; |
976 | + $return .= "<div class='seqInfo' style='position:absolute; right:15px; top:31px; color:#FFF; background-color:#000; z-index:50; padding: 5px;'> |
977 | + <span style='font-family: Verdana;'>$seqGiven / {$nodeList->length}</span> |
978 | + </div>"; |
979 | |
980 | if ($nodeList->length == 0) |
981 | { |
982 | @@ -1667,111 +1767,27 @@ |
983 | $node = $nodeList->item($seq); |
984 | |
985 | // We have our node. |
986 | - $type = (string) $node->getAttribute("type"); |
987 | + $type = (string) $node->getAttribute("type"); |
988 | $mediaDurationText = (string) $node->getAttribute("duration"); |
989 | - |
990 | - $return .= "<div class='info regionTransparency' style='display:none; position:absolute; top: 15px; left: 150px; background-color:#FFF; z-index: 50;'> |
991 | - <h5>Media Information</h5> |
992 | - <ul> |
993 | - <li>Type: $type</li> |
994 | - <li>Duration: $mediaDurationText</li> |
995 | - </ul> |
996 | - </div>"; |
997 | - |
998 | - if ($type == "text") |
999 | - { |
1000 | - $direction = (string) $node->getAttribute("direction"); |
1001 | - |
1002 | - $textNode = $node->getElementsByTagName("text"); |
1003 | - $textNode = $textNode->item(0); |
1004 | - |
1005 | - $textId = $regionid."_text"; |
1006 | - $innerId = $regionid."_innerText"; |
1007 | - $timerId = $regionid."_timer"; |
1008 | - $widthPx = $width."px"; |
1009 | - $heightPx = $height."px"; |
1010 | - |
1011 | - $textWrap = ""; |
1012 | - if ($direction == "left" || $direction == "right") $textWrap = "white-space:nowrap;"; |
1013 | - |
1014 | - //Show the contents of text accordingly |
1015 | - $return .= <<<END |
1016 | - <div id="$textId" style="position:relative;overflow:hidden;width:$widthPx; height:$heightPx;"> |
1017 | - <div id="$innerId" style="position:absolute; left: 0px; top: 0px; $textWrap"> |
1018 | - <div class="article"> |
1019 | - $textNode->textContent |
1020 | - </div> |
1021 | - </div> |
1022 | - </div> |
1023 | - <script type="text/javascript"> |
1024 | - var tr = new TextRender("$textId", "$innerId", "$direction"); |
1025 | - |
1026 | - clearInterval(timer); |
1027 | - |
1028 | - var timer = 0; |
1029 | - timer = setInterval("tr.TimerTick()", 30); |
1030 | - </script> |
1031 | -END; |
1032 | - } |
1033 | - elseif ($type == "ticker") |
1034 | - { |
1035 | - $direction = (string) $node->getAttribute("direction"); |
1036 | - |
1037 | - //Show the contents of template accordingly |
1038 | - $templateNode = $node->getElementsByTagName("template"); |
1039 | - $templateNode = $templateNode->item(0); |
1040 | - |
1041 | - $textId = $regionid."_text"; |
1042 | - $innerId = $regionid."_innerText"; |
1043 | - $timerId = $regionid."_timer"; |
1044 | - $widthPx = $width."px"; |
1045 | - $heightPx = $height."px"; |
1046 | - |
1047 | - $textWrap = ""; |
1048 | - if ($direction == "left" || $direction == "right") $textWrap = "white-space:nowrap;"; |
1049 | - |
1050 | - //Show the contents of text accordingly |
1051 | - $return .= <<<END |
1052 | - <div id="$textId" style="position:relative;overflow:hidden;width:$widthPx; height:$heightPx;"> |
1053 | - <div id="$innerId" style="position:absolute; left: 0px; top: 0px; $textWrap"> |
1054 | - <div class="article"> |
1055 | - $templateNode->textContent |
1056 | - </div> |
1057 | - </div> |
1058 | - </div> |
1059 | - <script type="text/javascript"> |
1060 | - var tr = new TextRender("$textId", "$innerId", "$direction"); |
1061 | - |
1062 | - clearInterval(timer); |
1063 | - |
1064 | - var timer = 0; |
1065 | - timer = setInterval("tr.TimerTick()", 30); |
1066 | - </script> |
1067 | -END; |
1068 | - } |
1069 | - elseif ($type == "image") |
1070 | - { |
1071 | - // Call the ratio width / height |
1072 | - $ratioWidth = $width; |
1073 | - $ratioHeight = $height; |
1074 | - |
1075 | - // We need to get the URI from <options> |
1076 | - $optionsNode = $node->getElementsByTagName("uri"); |
1077 | - $uri = $optionsNode->item(0)->textContent; |
1078 | - |
1079 | - Debug::LogEntry($db, 'audit', 'The Uri is:' . $uri); |
1080 | - |
1081 | - // Show the image - scaled to the aspect ratio of this region (get from GET) |
1082 | - $return .= "<div style='text-align:center;'><img alt='$type thumbnail' src='index.php?p=module&q=GetImage&file=$uri&width=$ratioWidth&height=$ratioHeight&dynamic' /></div>"; |
1083 | - } |
1084 | - else |
1085 | - { |
1086 | - // Show a thumbnail (centered) - will need the width/height of the region from get again |
1087 | - $centerHeight = $height / 2 - 40; |
1088 | - $centerHeight = $centerHeight . "px"; |
1089 | - |
1090 | - $return .= "<div style='text-align:center;'><img alt='$type thumbnail' src='img/forms/$type.png' /></div>"; |
1091 | - } |
1092 | + $mediaid = (string) $node->getAttribute("id"); |
1093 | + |
1094 | + $return .= " |
1095 | + <div class='previewInfo' style='position:absolute; right:15px; top:61px; color:#FFF; background-color:#000; z-index:50; padding: 5px; font-family: Verdana;'> |
1096 | + <span style='font-family: Verdana;'>Type: $type <br /> |
1097 | + Duration: $mediaDurationText (s)</span> |
1098 | + </div>"; |
1099 | + |
1100 | + // Create a module to deal with this |
1101 | + if (!file_exists('modules/' . $type . '.module.php')) |
1102 | + { |
1103 | + $return .= 'Unknow module type'; |
1104 | + } |
1105 | + |
1106 | + require_once("modules/$type.module.php"); |
1107 | + |
1108 | + $moduleObject = new $type($db, $user, $mediaid, $layoutid, $regionid); |
1109 | + |
1110 | + $return .= $moduleObject->Preview($width, $height); |
1111 | |
1112 | $response->html = $return; |
1113 | $response->Respond(); |
1114 | |
1115 | === modified file 'server/lib/pages/module.class.php' |
1116 | --- server/lib/pages/module.class.php 2009-11-29 19:36:42 +0000 |
1117 | +++ server/lib/pages/module.class.php 2010-02-02 19:48:16 +0000 |
1118 | @@ -113,48 +113,59 @@ |
1119 | */ |
1120 | function GetImage() |
1121 | { |
1122 | - $db =& $this->db; |
1123 | - |
1124 | - $file = Kit::GetParam('file', _REQUEST, _STRING); |
1125 | - $dynamic = isset($_REQUEST['dynamic']); |
1126 | - |
1127 | - //File upload directory.. get this from the settings object |
1128 | - $library = Config::GetSetting($db, "LIBRARY_LOCATION"); |
1129 | - |
1130 | - $fileName = $library . $file; |
1131 | - $uid = $fileName; |
1132 | - |
1133 | - // Get the info for this new temporary file |
1134 | - $info = getimagesize($uid); |
1135 | - |
1136 | - if ($dynamic && $info[2]) |
1137 | - { |
1138 | - $width = Kit::GetParam('width', _GET, _INT); |
1139 | - $height = Kit::GetParam('height', _GET, _INT); |
1140 | - |
1141 | - // dynamically create an image of the correct size - used for previews |
1142 | - ResizeImage($uid, "", $width, $height, true, 'browser'); |
1143 | - |
1144 | - exit; |
1145 | - } |
1146 | - |
1147 | - if (!$image = file_get_contents($uid)) |
1148 | - { |
1149 | - //not sure |
1150 | - Debug::LogEntry($db, "audit", "Cant find: $uid", "module", "GetImage"); |
1151 | - |
1152 | - $uid = "img/forms/filenotfound.png"; |
1153 | - $image = file_get_contents($uid); |
1154 | - } |
1155 | - |
1156 | - $size = getimagesize($uid); |
1157 | - |
1158 | - //Output the image header |
1159 | - header("Content-type: {$size['mime']}"); |
1160 | - |
1161 | - echo $image; |
1162 | - |
1163 | - exit; |
1164 | + $db =& $this->db; |
1165 | + |
1166 | + $mediaID = Kit::GetParam('id', _GET, _INT, 0); |
1167 | + $proportional = Kit::GetParam('proportional', _GET, _BOOL, true); |
1168 | + $dynamic = isset($_REQUEST['dynamic']); |
1169 | + |
1170 | + if ($mediaID == 0) |
1171 | + die ('No media ID provided'); |
1172 | + |
1173 | + // Get the file URI |
1174 | + $SQL = sprintf("SELECT StoredAs FROM media WHERE MediaID = %d", $mediaID); |
1175 | + |
1176 | + if (!$file = $db->GetSingleValue($SQL, 'StoredAs', _STRING)) |
1177 | + die ('No media found for that media ID'); |
1178 | + |
1179 | + //File upload directory.. get this from the settings object |
1180 | + $library = Config::GetSetting($db, "LIBRARY_LOCATION"); |
1181 | + $fileName = $library . $file; |
1182 | + |
1183 | + // Get the info for this new temporary file |
1184 | + if (!$info = getimagesize($fileName)) |
1185 | + { |
1186 | + echo $fileName . ' is not an image'; |
1187 | + exit; |
1188 | + } |
1189 | + |
1190 | + if ($dynamic && $info[2]) |
1191 | + { |
1192 | + $width = Kit::GetParam('width', _GET, _INT); |
1193 | + $height = Kit::GetParam('height', _GET, _INT); |
1194 | + |
1195 | + // dynamically create an image of the correct size - used for previews |
1196 | + ResizeImage($fileName, '', $width, $height, $proportional, 'browser'); |
1197 | + |
1198 | + exit; |
1199 | + } |
1200 | + |
1201 | + if (!$image = file_get_contents($fileName)) |
1202 | + { |
1203 | + //not sure |
1204 | + Debug::LogEntry($db, 'audit', "Cant find: $uid", 'module', 'GetImage'); |
1205 | + |
1206 | + $fileName = 'img/forms/filenotfound.png'; |
1207 | + $image = file_get_contents($fileName); |
1208 | + } |
1209 | + |
1210 | + $size = getimagesize($fileName); |
1211 | + |
1212 | + //Output the image header |
1213 | + header("Content-type: {$size['mime']}"); |
1214 | + |
1215 | + echo $image; |
1216 | + exit; |
1217 | } |
1218 | } |
1219 | ?> |
1220 | \ No newline at end of file |
1221 | |
1222 | === modified file 'server/lib/pages/region.class.php' |
1223 | --- server/lib/pages/region.class.php 2009-12-31 11:48:37 +0000 |
1224 | +++ server/lib/pages/region.class.php 2010-02-02 19:48:16 +0000 |
1225 | @@ -326,9 +326,11 @@ |
1226 | * @param $mediaid Object |
1227 | * @param $sequence Object |
1228 | */ |
1229 | - public function ReorderMedia($layoutid, $regionid, $mediaid, $sequence) |
1230 | + public function ReorderMedia($layoutid, $regionid, $mediaid, $sequence, $lkid = '') |
1231 | { |
1232 | $db =& $this->db; |
1233 | + |
1234 | + Debug::LogEntry($db, 'audit', 'LkID = ' . $lkid, 'region', 'ReorderMedia'); |
1235 | |
1236 | //Load the XML for this layout |
1237 | $xml = new DOMDocument("1.0"); |
1238 | @@ -336,7 +338,12 @@ |
1239 | |
1240 | //Get the Media Node in question in a DOMNode using Xpath |
1241 | $xpath = new DOMXPath($xml); |
1242 | - $mediaNodeList = $xpath->query("//region[@id='$regionid']/media[@id='$mediaid']"); |
1243 | + |
1244 | + if ($lkid == '') |
1245 | + $mediaNodeList = $xpath->query("//region[@id='$regionid']/media[@id='$mediaid']"); |
1246 | + else |
1247 | + $mediaNodeList = $xpath->query("//region[@id='$regionid']/media[@lkid='$lkid']"); |
1248 | + |
1249 | $mediaNode = $mediaNodeList->item(0); |
1250 | |
1251 | //Remove this node from its parent |
1252 | |
1253 | === added file 'server/lib/pages/resolution.class.php' |
1254 | --- server/lib/pages/resolution.class.php 1970-01-01 00:00:00 +0000 |
1255 | +++ server/lib/pages/resolution.class.php 2010-02-02 19:48:16 +0000 |
1256 | @@ -0,0 +1,326 @@ |
1257 | +<?php |
1258 | +/* |
1259 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
1260 | + * Copyright (C) 2009 Daniel Garner |
1261 | + * |
1262 | + * This file is part of Xibo. |
1263 | + * |
1264 | + * Xibo is free software: you can redistribute it and/or modify |
1265 | + * it under the terms of the GNU Affero General Public License as published by |
1266 | + * the Free Software Foundation, either version 3 of the License, or |
1267 | + * any later version. |
1268 | + * |
1269 | + * Xibo is distributed in the hope that it will be useful, |
1270 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1271 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1272 | + * GNU Affero General Public License for more details. |
1273 | + * |
1274 | + * You should have received a copy of the GNU Affero General Public License |
1275 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
1276 | + */ |
1277 | +defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser."); |
1278 | + |
1279 | +class resolutionDAO |
1280 | +{ |
1281 | + private $db; |
1282 | + private $user; |
1283 | + |
1284 | + function __construct(database $db, user $user) |
1285 | + { |
1286 | + $this->db =& $db; |
1287 | + $this->user =& $user; |
1288 | + |
1289 | + include_once('lib/data/resolution.data.class.php'); |
1290 | + } |
1291 | + |
1292 | + function displayPage() |
1293 | + { |
1294 | + $db =& $this->db; |
1295 | + |
1296 | + require("template/pages/resolution_view.php"); |
1297 | + } |
1298 | + |
1299 | + function ResolutionFilter() |
1300 | + { |
1301 | + $db =& $this->db; |
1302 | + $user =& $this->user; |
1303 | + $response = new ResponseManager(); |
1304 | + |
1305 | + $filterForm = <<<END |
1306 | + <div class="FilterDiv" id="ResolutionFilter"> |
1307 | + <form onsubmit="return false"> |
1308 | + <input type="hidden" name="p" value="resolution"> |
1309 | + <input type="hidden" name="q" value="ResolutionGrid"> |
1310 | + </form> |
1311 | + </div> |
1312 | +END; |
1313 | + |
1314 | + $id = uniqid(); |
1315 | + |
1316 | + $xiboGrid = <<<HTML |
1317 | + <div class="XiboGrid" id="$id"> |
1318 | + <div class="XiboFilter"> |
1319 | + $filterForm |
1320 | + </div> |
1321 | + <div class="XiboData"> |
1322 | + |
1323 | + </div> |
1324 | + </div> |
1325 | +HTML; |
1326 | + echo $xiboGrid; |
1327 | + } |
1328 | + |
1329 | + function ResolutionGrid() |
1330 | + { |
1331 | + $db =& $this->db; |
1332 | + $user =& $this->user; |
1333 | + $response = new ResponseManager(); |
1334 | + |
1335 | + $SQL = "SELECT * FROM resolution ORDER BY resolution"; |
1336 | + |
1337 | + if (!$results = $db->query($SQL)) |
1338 | + { |
1339 | + trigger_error($db->error()); |
1340 | + trigger_error('Unable to Query for resolutions.'); |
1341 | + } |
1342 | + |
1343 | + $output = <<<END |
1344 | + <div class="info_table"> |
1345 | + <table style="width:100%"> |
1346 | + <thead> |
1347 | + <tr> |
1348 | + <th>Resolution</th> |
1349 | + <th>Designer Width</th> |
1350 | + <th>Designer Height</th> |
1351 | + <th>Action</th> |
1352 | + </tr> |
1353 | + </thead> |
1354 | + <tbody> |
1355 | +END; |
1356 | + |
1357 | + while($row = $db->get_assoc_row($results)) |
1358 | + { |
1359 | + $resolutionID = Kit::ValidateParam($row['resolutionID'], _INT); |
1360 | + $resolution = Kit::ValidateParam($row['resolution'], _STRING); |
1361 | + $width = Kit::ValidateParam($row['width'], _INT); |
1362 | + $height = Kit::ValidateParam($row['height'], _INT); |
1363 | + |
1364 | + $output .= '<tr>'; |
1365 | + $output .= '<td>' . $resolution . '</td>'; |
1366 | + $output .= '<td>' . $width . '</td>'; |
1367 | + $output .= '<td>' . $height . '</td>'; |
1368 | + $output .= '<td>'; |
1369 | + $output .= ' <button class="XiboFormButton" href="index.php?p=resolution&q=EditForm&resolutionid=' . $resolutionID . '"><span>Edit</span></button>'; |
1370 | + $output .= ' <button class="XiboFormButton" href="index.php?p=resolution&q=DeleteForm&resolutionid=' . $resolutionID . '"><span>Delete</span></button>'; |
1371 | + $output .= '</td>'; |
1372 | + $output .= '</tr>'; |
1373 | + } |
1374 | + |
1375 | + $output .= '</tbody></table></div>'; |
1376 | + |
1377 | + $response->SetGridResponse($output); |
1378 | + $response->Respond(); |
1379 | + } |
1380 | + |
1381 | + function AddForm() |
1382 | + { |
1383 | + $db =& $this->db; |
1384 | + $user =& $this->user; |
1385 | + $response = new ResponseManager(); |
1386 | + |
1387 | + $form = <<<END |
1388 | + <form class="XiboForm" method="post" action="index.php?p=resolution&q=Add"> |
1389 | + <table> |
1390 | + <tr> |
1391 | + <td><label for="resolution" title="A name for this resolution">Resolution<span class="required">*</span></label></td> |
1392 | + <td><input name="resolution" type="text" id="resolution" tabindex="1" /></td> |
1393 | + </tr> |
1394 | + <tr> |
1395 | + <td><label for="width" title="Width">Width<span class="required">*</span></label></td> |
1396 | + <td><input name="width" type="text" id="width" tabindex="2" /></td> |
1397 | + </tr> |
1398 | + <tr> |
1399 | + <td><label for="height" title="Height">Height<span class="required">*</span></label></td> |
1400 | + <td><input name="height" type="text" id="height" tabindex="3" /></td> |
1401 | + </tr> |
1402 | + <tr> |
1403 | + <td></td> |
1404 | + <td> |
1405 | + <input type="submit" value="Save" tabindex="4" /> |
1406 | + <input id="btnCancel" type="button" title="No / Cancel" onclick="$('#div_dialog').dialog('close');return false; " value="Cancel" /> |
1407 | + </td> |
1408 | + </tr> |
1409 | + </table> |
1410 | + </form> |
1411 | +END; |
1412 | + |
1413 | + $response->SetFormRequestResponse($form, 'Add new resolution', '350px', '250px'); |
1414 | + $response->Respond(); |
1415 | + } |
1416 | + |
1417 | + function EditForm() |
1418 | + { |
1419 | + $db =& $this->db; |
1420 | + $user =& $this->user; |
1421 | + $response = new ResponseManager(); |
1422 | + |
1423 | + $resolutionID = Kit::GetParam('resolutionid', _GET, _INT); |
1424 | + |
1425 | + $SQL = sprintf("SELECT resolution, width, height FROM resolution WHERE resolutionID = %d", $resolutionID); |
1426 | + |
1427 | + if (!$result = $db->query($SQL)) |
1428 | + { |
1429 | + trigger_error($db->error()); |
1430 | + trigger_error('Unable to edit this resolution', E_USER_ERROR); |
1431 | + } |
1432 | + |
1433 | + if ($db->num_rows($result) == 0) |
1434 | + trigger_error('Incorrect resolution id', E_USER_ERROR); |
1435 | + |
1436 | + $row = $db->get_assoc_row($result); |
1437 | + |
1438 | + $resolution = Kit::ValidateParam($row['resolution'], _STRING); |
1439 | + $width = Kit::ValidateParam($row['width'], _INT); |
1440 | + $height = Kit::ValidateParam($row['height'], _INT); |
1441 | + |
1442 | + $form = <<<END |
1443 | + <form class="XiboForm" method="post" action="index.php?p=resolution&q=Edit"> |
1444 | + <input type="hidden" name="resolutionid" value="$resolutionID" /> |
1445 | + <table> |
1446 | + <tr> |
1447 | + <td><label for="resolution" title="A name for this resolution">Resolution<span class="required">*</span></label></td> |
1448 | + <td><input name="resolution" type="text" id="resolution" value="$resolution" tabindex="1" /></td> |
1449 | + </tr> |
1450 | + <tr> |
1451 | + <td><label for="width" title="Width">Width<span class="required">*</span></label></td> |
1452 | + <td><input name="width" type="text" id="width" tabindex="2" value="$width" /></td> |
1453 | + </tr> |
1454 | + <tr> |
1455 | + <td><label for="height" title="Height">Height<span class="required">*</span></label></td> |
1456 | + <td><input name="height" type="text" id="height" tabindex="3" value="$height" /></td> |
1457 | + </tr> |
1458 | + <tr> |
1459 | + <td></td> |
1460 | + <td> |
1461 | + <input type="submit" value="Save" tabindex="4" /> |
1462 | + <input id="btnCancel" type="button" title="No / Cancel" onclick="$('#div_dialog').dialog('close');return false; " value="Cancel" /> |
1463 | + </td> |
1464 | + </tr> |
1465 | + </table> |
1466 | + </form> |
1467 | +END; |
1468 | + |
1469 | + $response->SetFormRequestResponse($form, 'Edit Resolution', '350px', '250px'); |
1470 | + $response->Respond(); |
1471 | + } |
1472 | + |
1473 | + function DeleteForm() |
1474 | + { |
1475 | + $db =& $this->db; |
1476 | + $user =& $this->user; |
1477 | + $response = new ResponseManager(); |
1478 | + |
1479 | + $resolutionID = Kit::GetParam('resolutionid', _GET, _INT); |
1480 | + |
1481 | + // Output the delete form |
1482 | + $form = <<<END |
1483 | + <form class="XiboForm" method="post" action="index.php?p=resolution&q=Delete"> |
1484 | + <input type="hidden" name="resolutionid" value="$resolutionid"> |
1485 | + <p>Are you sure you want to delete this resolution?</p> |
1486 | + <input type="submit" value="Yes" tabindex="1"> |
1487 | + <input type="submit" value="No" onclick="$('#div_dialog').dialog('close');return false; "> |
1488 | + </form> |
1489 | +END; |
1490 | + } |
1491 | + |
1492 | + function Add() |
1493 | + { |
1494 | + $db =& $this->db; |
1495 | + $user =& $this->user; |
1496 | + $response = new ResponseManager(); |
1497 | + |
1498 | + $resolution = Kit::GetParam('resolution', _POST, _STRING); |
1499 | + $width_old = Kit::GetParam('width', _POST, _INT); |
1500 | + $height_old = Kit::GetParam('height', _POST, _INT); |
1501 | + |
1502 | + if ($resolution == '' || $width_old == '' || $height_old == '') |
1503 | + { |
1504 | + trigger_error('All fields must be filled in', E_USER_ERROR); |
1505 | + } |
1506 | + |
1507 | + // Alter the width / height to fit with 800 px |
1508 | + $width = 800; |
1509 | + $height = 800; |
1510 | + $factor = min ( $width / $width_old, $height / $height_old); |
1511 | + |
1512 | + $final_width = round ($width_old * $factor); |
1513 | + $final_height = round ($height_old * $factor); |
1514 | + |
1515 | + // Add the resolution |
1516 | + $resObject = new Resolution($db); |
1517 | + |
1518 | + if (!$resObject->Add($resolution, $final_width, $final_height)) |
1519 | + { |
1520 | + trigger_error($resObject->GetErrorMessage(), E_USER_ERROR); |
1521 | + } |
1522 | + |
1523 | + $response->SetFormSubmitResponse('New resolution added'); |
1524 | + $response->Respond(); |
1525 | + } |
1526 | + |
1527 | + function Edit() |
1528 | + { |
1529 | + $db =& $this->db; |
1530 | + $user =& $this->user; |
1531 | + $response = new ResponseManager(); |
1532 | + |
1533 | + $resolutionID = Kit::GetParam('resolutionid', _POST, _INT); |
1534 | + $resolution = Kit::GetParam('resolution', _POST, _STRING); |
1535 | + $width_old = Kit::GetParam('width', _POST, _INT); |
1536 | + $height_old = Kit::GetParam('height', _POST, _INT); |
1537 | + |
1538 | + if ($resolutionID == '' || $resolution == '' || $height_old == '' || $height_old == '') |
1539 | + { |
1540 | + trigger_error('All fields must be filled in', E_USER_ERROR); |
1541 | + } |
1542 | + |
1543 | + // Alter the width / height to fit with 800 px |
1544 | + $width = 800; |
1545 | + $height = 800; |
1546 | + $factor = min ( $width / $width_old, $height / $height_old); |
1547 | + |
1548 | + $final_width = round ($width_old * $factor); |
1549 | + $final_height = round ($height_old * $factor); |
1550 | + |
1551 | + // Edit the resolution |
1552 | + $resObject = new Resolution($db); |
1553 | + |
1554 | + if (!$resObject->Edit($resolutionID, $resolution, $final_width, $final_height)) |
1555 | + { |
1556 | + trigger_error($resObject->GetErrorMessage(), E_USER_ERROR); |
1557 | + } |
1558 | + |
1559 | + $response->SetFormSubmitResponse('Resolution edited'); |
1560 | + $response->Respond(); |
1561 | + } |
1562 | + |
1563 | + function Delete() |
1564 | + { |
1565 | + $db =& $this->db; |
1566 | + $user =& $this->user; |
1567 | + $response = new ResponseManager(); |
1568 | + |
1569 | + $resolutionID = Kit::GetParam('resolutionid', _POST, _INT); |
1570 | + |
1571 | + // Remove the resolution |
1572 | + $resObject = new Resolution($db); |
1573 | + |
1574 | + if (!$resObject->Delete($resolutionID)) |
1575 | + { |
1576 | + trigger_error($resObject->GetErrorMessage(), E_USER_ERROR); |
1577 | + } |
1578 | + |
1579 | + $response->SetFormSubmitResponse('Resolution deleted'); |
1580 | + $response->Respond(); |
1581 | + } |
1582 | +} |
1583 | \ No newline at end of file |
1584 | |
1585 | === modified file 'server/lib/xmds.inc.php' |
1586 | --- server/lib/xmds.inc.php 2009-12-31 11:48:37 +0000 |
1587 | +++ server/lib/xmds.inc.php 2010-02-02 19:48:16 +0000 |
1588 | @@ -20,7 +20,7 @@ |
1589 | */ |
1590 | defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser."); |
1591 | |
1592 | -error_reporting(E_ALL); |
1593 | +error_reporting(0); |
1594 | ini_set('display_errors', 0); //we never want to display errors on the screen |
1595 | |
1596 | // Required Library Files |
1597 | @@ -29,7 +29,8 @@ |
1598 | require_once("lib/app/kit.class.php"); |
1599 | require_once("lib/data/data.class.php"); |
1600 | require_once("config/db_config.php"); |
1601 | -require_once("config/config.class.php"); |
1602 | include_once('lib/data/stat.data.class.php'); |
1603 | +require_once("config/config.class.php"); |
1604 | +include_once('lib/data/stat.data.class.php'); |
1605 | |
1606 | // Sort out magic quotes |
1607 | if (get_magic_quotes_gpc()) |
1608 | |
1609 | === modified file 'server/modules/embedded.module.php' |
1610 | --- server/modules/embedded.module.php 2009-12-31 11:48:37 +0000 |
1611 | +++ server/modules/embedded.module.php 2010-02-02 19:48:16 +0000 |
1612 | @@ -51,7 +51,7 @@ |
1613 | <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
1614 | <table> |
1615 | <tr> |
1616 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
1617 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
1618 | <td><input id="duration" name="duration" type="text"></td> |
1619 | </tr> |
1620 | <tr> |
1621 | @@ -132,7 +132,7 @@ |
1622 | <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
1623 | <table> |
1624 | <tr> |
1625 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1626 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1627 | <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
1628 | </tr> |
1629 | <tr> |
1630 | |
1631 | === modified file 'server/modules/flash.module.php' |
1632 | --- server/modules/flash.module.php 2009-12-31 11:48:37 +0000 |
1633 | +++ server/modules/flash.module.php 2010-02-02 19:48:16 +0000 |
1634 | @@ -167,7 +167,7 @@ |
1635 | <td><input id="name" name="name" type="text"></td> |
1636 | </tr> |
1637 | <tr> |
1638 | - <td><label for="duration" title="The duration in seconds this flash should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1639 | + <td><label for="duration" title="The duration in seconds this flash should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1640 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1641 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1642 | <td> |
1643 | @@ -314,7 +314,7 @@ |
1644 | <td><input id="name" name="name" type="text" value="$name"></td> |
1645 | </tr> |
1646 | <tr> |
1647 | - <td><label for="duration" title="The duration in seconds this flash should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1648 | + <td><label for="duration" title="The duration in seconds this flash should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1649 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1650 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1651 | <td> |
1652 | |
1653 | === modified file 'server/modules/image.module.php' |
1654 | --- server/modules/image.module.php 2009-12-31 11:48:37 +0000 |
1655 | +++ server/modules/image.module.php 2010-02-02 19:48:16 +0000 |
1656 | @@ -102,6 +102,8 @@ |
1657 | $sessionId = session_id(); |
1658 | $securityToken = CreateFormToken(); |
1659 | |
1660 | + $backgroundImage = Kit::GetParam('backgroundImage', _GET, _BOOL, false); |
1661 | + |
1662 | $session->setSecurityToken($securityToken); |
1663 | |
1664 | //Get the default value for the shared list |
1665 | @@ -128,6 +130,14 @@ |
1666 | <input class="XiboFormButton" type="button" href="index.php?p=content&q=LibraryAssignForm&layoutid=$layoutid®ionid=$regionid" title="Library" value="Library" /> |
1667 | END; |
1668 | } |
1669 | + elseif ($backgroundImage) |
1670 | + { |
1671 | + // Show the save button, and make cancel go back to the background form |
1672 | + $save_button = <<<END |
1673 | + <input id="btnSave" type="submit" value="Save" disabled /> |
1674 | + <input class="XiboFormButton" id="btnCancel" type="button" title="Close" href="index.php?p=layout&q=BackgroundForm&modify=true&layoutid=$layoutid" value="Cancel" /> |
1675 | +END; |
1676 | + } |
1677 | else |
1678 | { |
1679 | $save_button = <<<END |
1680 | @@ -159,6 +169,7 @@ |
1681 | <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=AddMedia"> |
1682 | <input type="hidden" name="layoutid" value="$layoutid"> |
1683 | <input type="hidden" name="regionid" value="$regionid"> |
1684 | + <input type="hidden" name="backgroundImage" value="$backgroundImage" /> |
1685 | <input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /> |
1686 | <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
1687 | <table width="100%"> |
1688 | @@ -167,7 +178,7 @@ |
1689 | <td><input id="name" name="name" type="text"></td> |
1690 | </tr> |
1691 | <tr> |
1692 | - <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1693 | + <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1694 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1695 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1696 | <td> |
1697 | @@ -314,7 +325,7 @@ |
1698 | <td><input id="name" name="name" type="text" value="$name"></td> |
1699 | </tr> |
1700 | <tr> |
1701 | - <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1702 | + <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1703 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1704 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1705 | <td> |
1706 | @@ -495,6 +506,7 @@ |
1707 | $regionid = $this->regionid; |
1708 | $mediaid = $this->mediaid; |
1709 | $userid = Kit::GetParam('userid', _SESSION, _INT); |
1710 | + $backgroundImage = Kit::GetParam('backgroundImage', _POST, _BOOL, false); |
1711 | |
1712 | // File data |
1713 | $tmpName = Kit::GetParam('hidFileID', _POST, _STRING); |
1714 | @@ -607,9 +619,6 @@ |
1715 | return true; |
1716 | } |
1717 | |
1718 | - // Create the thumb nail |
1719 | - ResizeImage($databaseDir.$storedAs, $databaseDir."tn_".$storedAs, 80, 80); |
1720 | - |
1721 | // Required Attributes |
1722 | $this->mediaid = $mediaid; |
1723 | $this->duration = $duration; |
1724 | @@ -632,6 +641,12 @@ |
1725 | // We want to load a new form |
1726 | $this->response->loadForm = true; |
1727 | |
1728 | + // If we just added a background we should load the background form |
1729 | + if ($backgroundImage) |
1730 | + { |
1731 | + $this->response->loadFormUri = "index.php?p=layout&q=BackgroundForm&modify=true&layoutid=$layoutid&backgroundOveride=$storedAs"; |
1732 | + } |
1733 | + |
1734 | return $this->response; |
1735 | } |
1736 | |
1737 | @@ -940,6 +955,11 @@ |
1738 | |
1739 | return true; |
1740 | } |
1741 | + |
1742 | + public function Preview($width, $height) |
1743 | + { |
1744 | + // Show the image - scaled to the aspect ratio of this region (get from GET) |
1745 | + return sprintf('<div style="text-align:center;"><img src="index.php?p=module&q=GetImage&id=%d&width=%d&height=%d&dynamic" /></div>', $this->mediaid, $width, $height); |
1746 | + } |
1747 | } |
1748 | - |
1749 | ?> |
1750 | \ No newline at end of file |
1751 | |
1752 | === modified file 'server/modules/module_db_mysql.php' |
1753 | --- server/modules/module_db_mysql.php 2009-12-31 11:48:37 +0000 |
1754 | +++ server/modules/module_db_mysql.php 2010-02-02 19:48:16 +0000 |
1755 | @@ -57,6 +57,11 @@ |
1756 | { |
1757 | //if (!$nolog) Debug::LogEntry($this, 'audit', 'Running SQL: [' . $SQL . ']', '', 'query'); |
1758 | // creates a loop! |
1759 | + if ($SQL == '') |
1760 | + { |
1761 | + $this->error_text = 'No SQL provided'; |
1762 | + return false; |
1763 | + } |
1764 | |
1765 | if(!$result = mysql_query($SQL)) |
1766 | { |
1767 | @@ -112,6 +117,54 @@ |
1768 | return mysql_real_escape_string($string); |
1769 | } |
1770 | |
1771 | + /** |
1772 | + * Gets a Single row using the provided SQL |
1773 | + * Returns false if SQL error or no records found |
1774 | + * @param <string> $SQL |
1775 | + * @param <bool> $assoc |
1776 | + */ |
1777 | + public function GetSingleRow($SQL, $assoc = true) |
1778 | + { |
1779 | + if (!$result = $this->query($SQL)) |
1780 | + return false; |
1781 | + |
1782 | + if ($this->num_rows($result) == 0) |
1783 | + { |
1784 | + $this->error_text = 'No results returned'; |
1785 | + return false; |
1786 | + } |
1787 | + |
1788 | + if ($assoc) |
1789 | + { |
1790 | + return $this->get_assoc_row($result); |
1791 | + } |
1792 | + else |
1793 | + { |
1794 | + return $this->get_row($result); |
1795 | + } |
1796 | + } |
1797 | + |
1798 | + /** |
1799 | + * Gets a single value from the provided SQL |
1800 | + * @param <string> $SQL |
1801 | + * @param <string> $columnName |
1802 | + * @param <int> $dataType |
1803 | + * @return <type> |
1804 | + */ |
1805 | + public function GetSingleValue($SQL, $columnName, $dataType) |
1806 | + { |
1807 | + if (!$row = $this->GetSingleRow($SQL)) |
1808 | + return false; |
1809 | + |
1810 | + if (!isset($row[$columnName])) |
1811 | + { |
1812 | + $this->error_text = 'No such column'; |
1813 | + return false; |
1814 | + } |
1815 | + |
1816 | + return Kit::ValidateParam($row[$columnName], $dataType); |
1817 | + } |
1818 | + |
1819 | //returns the error text to display |
1820 | function error() |
1821 | { |
1822 | |
1823 | === modified file 'server/modules/module_user_general.php' |
1824 | --- server/modules/module_user_general.php 2009-12-31 11:48:37 +0000 |
1825 | +++ server/modules/module_user_general.php 2010-02-02 19:48:16 +0000 |
1826 | @@ -105,13 +105,13 @@ |
1827 | $results = $db->get_row($result); |
1828 | |
1829 | // there is a result so we store the userID in the session variable |
1830 | - $_SESSION['userid'] = Kit::ValidateParam($results[0], _INT); |
1831 | + $_SESSION['userid'] = Kit::ValidateParam($results[0], _INT); |
1832 | $_SESSION['username'] = Kit::ValidateParam($results[1], _USERNAME); |
1833 | $_SESSION['usertype'] = Kit::ValidateParam($results[3], _INT); |
1834 | $_SESSION['groupid'] = Kit::ValidateParam($results[4], _INT); |
1835 | |
1836 | - $this->usertypeid = $_SESSION['usertype']; |
1837 | - $this->userid = $_SESSION['userid']; |
1838 | + $this->usertypeid = $_SESSION['usertype']; |
1839 | + $this->userid = $_SESSION['userid']; |
1840 | |
1841 | // update the db |
1842 | // write out to the db that the logged in user has accessed the page |
1843 | |
1844 | === modified file 'server/modules/powerpoint.module.php' |
1845 | --- server/modules/powerpoint.module.php 2009-12-31 11:48:37 +0000 |
1846 | +++ server/modules/powerpoint.module.php 2010-02-02 19:48:16 +0000 |
1847 | @@ -145,7 +145,7 @@ |
1848 | <input type="hidden" name="MAX_FILE_SIZE" value="$this->maxFileSizeBytes" /> |
1849 | <table> |
1850 | <tr> |
1851 | - <td><label for="file">Powerpoint File<span class="required">*</span></label></td> |
1852 | + <td><label for="file">PowerPoint File<span class="required">*</span></label></td> |
1853 | <td colspan="3"> |
1854 | <input type="file" name="media_file" onchange="fileFormSubmit();this.form.submit();" /> |
1855 | </td> |
1856 | @@ -163,11 +163,11 @@ |
1857 | <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
1858 | <table width="100%"> |
1859 | <tr> |
1860 | - <td><label for="name" title="The name of the powerpoint. Leave this blank to use the file name">Name</label></td> |
1861 | + <td><label for="name" title="The name of the PowerPoint. Leave this blank to use the file name">Name</label></td> |
1862 | <td><input id="name" name="name" type="text"></td> |
1863 | </tr> |
1864 | <tr> |
1865 | - <td><label for="duration" title="The duration in seconds this powerpoint should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1866 | + <td><label for="duration" title="The duration in seconds this PowerPoint should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1867 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1868 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1869 | <td> |
1870 | @@ -187,7 +187,7 @@ |
1871 | FORM; |
1872 | |
1873 | $this->response->html = $form; |
1874 | - $this->response->dialogTitle = 'Add New Powerpoint'; |
1875 | + $this->response->dialogTitle = 'Add New PowerPoint'; |
1876 | $this->response->dialogSize = true; |
1877 | $this->response->dialogWidth = '450px'; |
1878 | $this->response->dialogHeight = '280px'; |
1879 | @@ -288,7 +288,7 @@ |
1880 | <input type="hidden" name="MAX_FILE_SIZE" value="$this->maxFileSizeBytes" /> |
1881 | <table> |
1882 | <tr> |
1883 | - <td><label for="file">New Powerpoint File<span class="required">*</span></label></td> |
1884 | + <td><label for="file">New PowerPoint File<span class="required">*</span></label></td> |
1885 | <td colspan="3"> |
1886 | <input type="file" name="media_file" onchange="fileFormSubmit();this.form.submit();" /> |
1887 | </td> |
1888 | @@ -310,11 +310,11 @@ |
1889 | <input type="hidden" id="SecurityToken" value="$securityToken" /> |
1890 | <table> |
1891 | <tr> |
1892 | - <td><label for="name" title="The name of the Powerpoint. Leave this blank to use the file name">Name</label></td> |
1893 | + <td><label for="name" title="The name of the PowerPoint. Leave this blank to use the file name">Name</label></td> |
1894 | <td><input id="name" name="name" type="text" value="$name"></td> |
1895 | </tr> |
1896 | <tr> |
1897 | - <td><label for="duration" title="The duration in seconds this powerpoint should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
1898 | + <td><label for="duration" title="The duration in seconds this PowerPoint should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
1899 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
1900 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
1901 | <td> |
1902 | @@ -338,7 +338,7 @@ |
1903 | FORM; |
1904 | |
1905 | $this->response->html = $form; |
1906 | - $this->response->dialogTitle = 'Edit Powerpoint'; |
1907 | + $this->response->dialogTitle = 'Edit PowerPoint'; |
1908 | $this->response->dialogSize = true; |
1909 | $this->response->dialogWidth = '450px'; |
1910 | $this->response->dialogHeight = '280px'; |
1911 | @@ -476,7 +476,7 @@ |
1912 | END; |
1913 | |
1914 | $this->response->html = $form; |
1915 | - $this->response->dialogTitle = 'Delete Powerpoint'; |
1916 | + $this->response->dialogTitle = 'Delete PowerPoint'; |
1917 | $this->response->dialogSize = true; |
1918 | $this->response->dialogWidth = '450px'; |
1919 | $this->response->dialogHeight = '280px'; |
1920 | @@ -501,7 +501,7 @@ |
1921 | |
1922 | if ($tmpName == '') |
1923 | { |
1924 | - $this->response->SetError('Cannot save Powerpoint details. <br/> You must have picked a file.'); |
1925 | + $this->response->SetError('Cannot save PowerPoint details. <br/> You must have picked a file.'); |
1926 | $this->response->keepOpen = true; |
1927 | return $this->response; |
1928 | } |
1929 | @@ -829,7 +829,7 @@ |
1930 | else |
1931 | { |
1932 | $this->response->loadFormUri = "index.php?p=content&q=displayForms&sp=add"; |
1933 | - $this->response->message = 'Edited the Powerpoint.'; |
1934 | + $this->response->message = 'Edited the PowerPoint.'; |
1935 | |
1936 | } |
1937 | |
1938 | |
1939 | === modified file 'server/modules/text.module.php' |
1940 | --- server/modules/text.module.php 2009-12-31 11:48:37 +0000 |
1941 | +++ server/modules/text.module.php 2010-02-02 19:48:16 +0000 |
1942 | @@ -58,7 +58,7 @@ |
1943 | <tr> |
1944 | <td><label for="direction" title="The Direction this text should move, if any">Direction<span class="required">*</span></label></td> |
1945 | <td>$direction_list</td> |
1946 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
1947 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
1948 | <td><input id="duration" name="duration" type="text"></td> |
1949 | </tr> |
1950 | <tr> |
1951 | @@ -129,7 +129,7 @@ |
1952 | <tr> |
1953 | <td><label for="direction" title="The Direction this text should move, if any">Direction<span class="required">*</span></label></td> |
1954 | <td>$direction_list</td> |
1955 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
1956 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
1957 | <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
1958 | </tr> |
1959 | <tr> |
1960 | @@ -276,6 +276,42 @@ |
1961 | |
1962 | return $this->response; |
1963 | } |
1964 | + |
1965 | + public function Preview($width, $height) |
1966 | + { |
1967 | + $regionid = $this->regionid; |
1968 | + $direction = $this->GetOption('direction'); |
1969 | + |
1970 | + // Get the text out of RAW |
1971 | + $rawXml = new DOMDocument(); |
1972 | + $rawXml->loadXML($this->GetRaw()); |
1973 | + |
1974 | + // Get the Text Node out of this |
1975 | + $textNodes = $rawXml->getElementsByTagName('text'); |
1976 | + $textNode = $textNodes->item(0); |
1977 | + $text = $textNode->nodeValue; |
1978 | + |
1979 | + $textId = $regionid.'_text'; |
1980 | + $innerId = $regionid.'_innerText'; |
1981 | + $timerId = $regionid.'_timer'; |
1982 | + $widthPx = $width.'px'; |
1983 | + $heightPx = $height.'px'; |
1984 | + |
1985 | + $textWrap = ''; |
1986 | + if ($direction == "left" || $direction == "right") $textWrap = "white-space:nowrap;"; |
1987 | + |
1988 | + //Show the contents of text accordingly |
1989 | + $return = <<<END |
1990 | + <div id="$textId" style="position:relative; overflow:hidden ;width:$widthPx; height:$heightPx; font-size: 1em;"> |
1991 | + <div id="$innerId" style="position:absolute; left: 0px; top: 0px; $textWrap"> |
1992 | + <div class="article"> |
1993 | + $text |
1994 | + </div> |
1995 | + </div> |
1996 | + </div> |
1997 | +END; |
1998 | + return $return; |
1999 | + } |
2000 | } |
2001 | |
2002 | ?> |
2003 | \ No newline at end of file |
2004 | |
2005 | === modified file 'server/modules/ticker.module.php' |
2006 | --- server/modules/ticker.module.php 2009-12-31 11:48:37 +0000 |
2007 | +++ server/modules/ticker.module.php 2010-02-02 19:48:16 +0000 |
2008 | @@ -64,7 +64,7 @@ |
2009 | <tr> |
2010 | <td><label for="direction" title="The Direction this text should move, if any">Direction<span class="required">*</span></label></td> |
2011 | <td>$direction_list</td> |
2012 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
2013 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
2014 | <td><input id="duration" name="duration" type="text"></td> |
2015 | </tr> |
2016 | <tr> |
2017 | @@ -145,7 +145,7 @@ |
2018 | <tr> |
2019 | <td><label for="direction" title="The Direction this text should move, if any">Direction<span class="required">*</span></label></td> |
2020 | <td>$direction_list</td> |
2021 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
2022 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
2023 | <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
2024 | </tr> |
2025 | <tr> |
2026 | @@ -321,6 +321,42 @@ |
2027 | |
2028 | return $this->response; |
2029 | } |
2030 | + |
2031 | + public function Preview($width, $height) |
2032 | + { |
2033 | + $regionid = $this->regionid; |
2034 | + $direction = $this->GetOption('direction'); |
2035 | + |
2036 | + // Get the text out of RAW |
2037 | + $rawXml = new DOMDocument(); |
2038 | + $rawXml->loadXML($this->GetRaw()); |
2039 | + |
2040 | + // Get the Text Node out of this |
2041 | + $textNodes = $rawXml->getElementsByTagName('template'); |
2042 | + $textNode = $textNodes->item(0); |
2043 | + $text = $textNode->nodeValue; |
2044 | + |
2045 | + $textId = $regionid.'_text'; |
2046 | + $innerId = $regionid.'_innerText'; |
2047 | + $timerId = $regionid.'_timer'; |
2048 | + $widthPx = $width.'px'; |
2049 | + $heightPx = $height.'px'; |
2050 | + |
2051 | + $textWrap = ''; |
2052 | + if ($direction == "left" || $direction == "right") $textWrap = "white-space:nowrap;"; |
2053 | + |
2054 | + //Show the contents of text accordingly |
2055 | + $return = <<<END |
2056 | + <div id="$textId" style="position:relative; overflow:hidden ;width:$widthPx; height:$heightPx; font-size: 1em;"> |
2057 | + <div id="$innerId" style="position:absolute; left: 0px; top: 0px; $textWrap"> |
2058 | + <div class="article"> |
2059 | + $text |
2060 | + </div> |
2061 | + </div> |
2062 | + </div> |
2063 | +END; |
2064 | + return $return; |
2065 | + } |
2066 | } |
2067 | |
2068 | ?> |
2069 | \ No newline at end of file |
2070 | |
2071 | === modified file 'server/modules/video.module.php' |
2072 | --- server/modules/video.module.php 2009-12-31 11:48:37 +0000 |
2073 | +++ server/modules/video.module.php 2010-02-02 19:48:16 +0000 |
2074 | @@ -167,7 +167,7 @@ |
2075 | <td><input id="name" name="name" type="text"></td> |
2076 | </tr> |
2077 | <tr> |
2078 | - <td><label for="duration" title="The duration in seconds this video should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
2079 | + <td><label for="duration" title="The duration in seconds this video should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
2080 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
2081 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
2082 | <td> |
2083 | @@ -314,7 +314,7 @@ |
2084 | <td><input id="name" name="name" type="text" value="$name"></td> |
2085 | </tr> |
2086 | <tr> |
2087 | - <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
2088 | + <td><label for="duration" title="The duration in seconds this image should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
2089 | <td><input id="duration" name="duration" type="text" value="$this->duration"></td> |
2090 | <td><label for="permissionid">Sharing<span class="required">*</span></label></td> |
2091 | <td> |
2092 | |
2093 | === modified file 'server/modules/webpage.module.php' |
2094 | --- server/modules/webpage.module.php 2009-12-31 11:48:37 +0000 |
2095 | +++ server/modules/webpage.module.php 2010-02-02 19:48:16 +0000 |
2096 | @@ -59,7 +59,7 @@ |
2097 | <td><input id="uri" name="uri" type="text"></td> |
2098 | </tr> |
2099 | <tr> |
2100 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
2101 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration (s)<span class="required">*</span></label></td> |
2102 | <td><input id="duration" name="duration" type="text"></td> |
2103 | </tr> |
2104 | <tr> |
2105 | @@ -112,7 +112,7 @@ |
2106 | <td><input id="uri" name="uri" value="$uri" type="text"></td> |
2107 | </tr> |
2108 | <tr> |
2109 | - <td><label for="duration" title="The duration in seconds this webpage should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
2110 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed (may be overridden on each layout)">Duration (s)<span class="required">*</span></label></td> |
2111 | <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
2112 | </tr> |
2113 | <tr> |
2114 | |
2115 | === added file 'server/template/css/ie8.css' |
2116 | --- server/template/css/ie8.css 1970-01-01 00:00:00 +0000 |
2117 | +++ server/template/css/ie8.css 2010-02-02 19:48:16 +0000 |
2118 | @@ -0,0 +1,23 @@ |
2119 | +/* |
2120 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
2121 | + * Copyright (C) 2009 Daniel Garner |
2122 | + * |
2123 | + * This file is part of Xibo. |
2124 | + * |
2125 | + * Xibo is free software: you can redistribute it and/or modify |
2126 | + * it under the terms of the GNU Affero General Public License as published by |
2127 | + * the Free Software Foundation, either version 3 of the License, or |
2128 | + * any later version. |
2129 | + * |
2130 | + * Xibo is distributed in the hope that it will be useful, |
2131 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2132 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2133 | + * GNU Affero General Public License for more details. |
2134 | + * |
2135 | + * You should have received a copy of the GNU Affero General Public License |
2136 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
2137 | + */ |
2138 | + |
2139 | +#navigation ul li { |
2140 | + padding-bottom: 4px; /* Added for IE8 menu */ |
2141 | +} |
2142 | |
2143 | === modified file 'server/template/css/xibo.css' |
2144 | --- server/template/css/xibo.css 2009-12-31 11:48:37 +0000 |
2145 | +++ server/template/css/xibo.css 2010-02-02 19:48:16 +0000 |
2146 | @@ -62,3 +62,40 @@ |
2147 | opacity: .75; |
2148 | filter: alpha(opacity=75); |
2149 | } |
2150 | + |
2151 | +#aspectRatioOption { |
2152 | + padding-bottom: 2px; |
2153 | +} |
2154 | + |
2155 | +.regionInfo { |
2156 | + color:#FFF; |
2157 | + background-color:#000; |
2158 | + z-index:50; |
2159 | + padding: 5px; |
2160 | + position:absolute; |
2161 | + right:15px; |
2162 | + top:1px; |
2163 | + font-family: Verdana; |
2164 | +} |
2165 | + |
2166 | +.seqInfo, .previewInfo { |
2167 | + font-family: Verdana; |
2168 | +} |
2169 | + |
2170 | +.seqInfo span, .previewInfo span { |
2171 | + font-family: Verdana; |
2172 | +} |
2173 | + |
2174 | +.preview { |
2175 | + position:absolute; |
2176 | + top:0px; |
2177 | + left:0px; |
2178 | + width: 100%; |
2179 | + height: 100%; |
2180 | +} |
2181 | + |
2182 | +.preview div, .preview span, .preview object,.preview h1,.preview h2, .preview h3, .preview h4, .preview h5, .preview h6, .preview p, .preview blockquote, .preview pre, .preview a, .preview abbr, .preview acronym, .preview address, .preview big, .preview cite, .preview code, .preview del, .preview dfn, .preview em, .preview img, .preview ins, .preview kbd, .preview q, .preview samp, .preview small, .preview strong, .preview sub, .preview sup, .preview tt, .preview var, .preview dl, .preview dt, .preview dd, .preview ol, .preview ul, .preview li, .preview fieldset, .preview form, .preview label, .preview legend, .preview table, .preview caption, .preview tbody, .preview tfoot,.preview thead, .preview tr, .preview th,.preview td{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;background:transparent;border:none;text-decoration:none} |
2183 | +.preview b, .preview i, .preview hr, .preview u, .preview center, .preview menu, .preview layer, .preview s, .preview strike, .preview font, .preview xmp{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;font-weight:normal;font-style:normal;background:transparent;border:none;text-decoration:none} |
2184 | +.preview font{color:#333} |
2185 | +.preview center{text-align:left} |
2186 | +.preview p, .preview span {font-family: "Times New Roman"} |
2187 | \ No newline at end of file |
2188 | |
2189 | === modified file 'server/template/header.php' |
2190 | --- server/template/header.php 2009-12-31 11:48:37 +0000 |
2191 | +++ server/template/header.php 2010-02-02 19:48:16 +0000 |
2192 | @@ -58,6 +58,11 @@ |
2193 | |
2194 | <!-- Our own --> |
2195 | <link rel="stylesheet" type="text/css" href="template/css/presentation.css" /> |
2196 | + |
2197 | + <!--[if gte IE 8]> |
2198 | + <link rel="stylesheet" type="text/css" href="template/css/ie8.css" /> |
2199 | + <![endif]--> |
2200 | + |
2201 | <script type="text/javascript" src="lib/js/functions.js"></script> |
2202 | <script type="text/javascript" src="lib/js/core.js"></script> |
2203 | <?php |
2204 | |
2205 | === added file 'server/template/pages/resolution_view.php' |
2206 | --- server/template/pages/resolution_view.php 1970-01-01 00:00:00 +0000 |
2207 | +++ server/template/pages/resolution_view.php 2010-02-02 19:48:16 +0000 |
2208 | @@ -0,0 +1,45 @@ |
2209 | +<?php |
2210 | +/* |
2211 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
2212 | + * Copyright (C) 2009 Daniel Garner |
2213 | + * |
2214 | + * This file is part of Xibo. |
2215 | + * |
2216 | + * Xibo is free software: you can redistribute it and/or modify |
2217 | + * it under the terms of the GNU Affero General Public License as published by |
2218 | + * the Free Software Foundation, either version 3 of the License, or |
2219 | + * any later version. |
2220 | + * |
2221 | + * Xibo is distributed in the hope that it will be useful, |
2222 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2223 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2224 | + * GNU Affero General Public License for more details. |
2225 | + * |
2226 | + * You should have received a copy of the GNU Affero General Public License |
2227 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
2228 | + */ |
2229 | +?> |
2230 | +<div id="form_container"> |
2231 | + <div id="form_header"> |
2232 | + <div id="form_header_left"></div> |
2233 | + <div id="form_header_right"></div> |
2234 | + </div> |
2235 | + |
2236 | + <div id="form_body"> |
2237 | + <div class="SecondNav"> |
2238 | + <!-- Maybe at a later date we could have these buttons generated from the DB - and therefore passed through the security system ? --> |
2239 | + <ul> |
2240 | + <li><a title="Add a new Layout" class="XiboFormButton" href="index.php?p=resolution&q=AddForm" ><span>Add Resolution</span></a></li> |
2241 | + </ul> |
2242 | + </div> |
2243 | + <?php $this->ResolutionFilter(); ?> |
2244 | + </div> |
2245 | + |
2246 | + <div id="form_footer"> |
2247 | + <div id="form_footer_left"> |
2248 | + </div> |
2249 | + <div id="form_footer_right"> |
2250 | + </div> |
2251 | + </div> |
2252 | +</div> |
2253 | + |
2254 | \ No newline at end of file |