Merge lp:~dangarner/xibo/server-141 into lp:~xibo-maintainers/xibo/brorsen

Proposed by Dan Garner
Status: Merged
Merged at revision: 266
Proposed branch: lp:~dangarner/xibo/server-141
Merge into: lp:~xibo-maintainers/xibo/brorsen
Diff against target: 372 lines (+94/-30)
14 files modified
server/install/database/50.php (+26/-0)
server/install/database/51.sql (+6/-0)
server/lib/include.php (+2/-2)
server/lib/js/layout.js (+15/-15)
server/lib/modules/module.class.php (+3/-1)
server/lib/pages/display.class.php (+1/-1)
server/lib/pages/module.class.php (+20/-9)
server/modules/counter.module.php (+3/-0)
server/modules/datasetview.module.php (+3/-2)
server/modules/image.module.php (+3/-0)
server/modules/shellcommand.module.php (+3/-0)
server/modules/text.module.php (+3/-0)
server/modules/ticker.module.php (+3/-0)
server/modules/webpage.module.php (+3/-0)
To merge this branch: bzr merge lp:~dangarner/xibo/server-141
Reviewer Review Type Date Requested Status
Xibo Maintainters Pending
Review via email: mp+137430@code.launchpad.net
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=== added file 'server/install/database/50.php'
2--- server/install/database/50.php 1970-01-01 00:00:00 +0000
3+++ server/install/database/50.php 2012-12-02 17:37:36 +0000
4@@ -0,0 +1,26 @@
5+<?php
6+
7+class Step50 extends UpgradeStep
8+{
9+
10+ public function Boot()
11+ {
12+ global $db;
13+
14+ // Get a list of all pagegroups assigned to groups
15+ if (!$results = $db->GetArray("SELECT DISTINCT groupid, pages.pagegroupid FROM `lkpagegroup` INNER JOIN pages ON lkpagegroup.pageid = pages.pageid"))
16+ return true;
17+
18+ foreach($results as $page)
19+ {
20+ // Delete it
21+ $db->query("DELETE FROM lkpagegroup WHERE groupid = " . $page['groupid'] . " AND pageID IN (SELECT pageid FROM pages WHERE pagegroupid = " . $page['pagegroupid'] . ")");
22+
23+ // Re-add it
24+ $db->query("INSERT INTO lkpagegroup (groupID, pageID) SELECT " . $page['groupid'] . ", pageid FROM pages WHERE pagegroupid = " . $page['pagegroupid']);
25+ }
26+
27+ return true;
28+ }
29+}
30+?>
31
32=== added file 'server/install/database/51.sql'
33--- server/install/database/51.sql 1970-01-01 00:00:00 +0000
34+++ server/install/database/51.sql 2012-12-02 17:37:36 +0000
35@@ -0,0 +1,6 @@
36+
37+ALTER TABLE `module` ADD `PreviewEnabled` TINYINT NOT NULL DEFAULT '1';
38+
39+UPDATE `version` SET `app_ver` = '1.4.1', `XmdsVersion` = 3;
40+UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
41+UPDATE `version` SET `DBVersion` = '51';
42\ No newline at end of file
43
44=== modified file 'server/lib/include.php'
45--- server/lib/include.php 2012-10-18 13:58:07 +0000
46+++ server/lib/include.php 2012-12-02 17:37:36 +0000
47@@ -108,8 +108,8 @@
48 Config::Version($db);
49
50 // Does the version in the DB match the version of the code?
51-if (DBVERSION != '50')
52- die(sprintf('Incompatible database version detected. Please ensure your database and website versions match. You have %d and the website for %d', DBVERSION, 50));
53+if (DBVERSION != '51')
54+ die(sprintf('Incompatible database version detected. Please ensure your database and website versions match. You have %d and the website for %d', DBVERSION, 51));
55
56 // What is the production mode of the server?
57 if(Config::GetSetting($db, 'SERVER_MODE') == 'Test') ini_set('display_errors', 1);
58
59=== modified file 'server/lib/js/layout.js'
60--- server/lib/js/layout.js 2012-06-02 10:23:52 +0000
61+++ server/lib/js/layout.js 2012-12-02 17:37:36 +0000
62@@ -45,8 +45,6 @@
63
64 var XiboTimelineSaveOrder = function(mediaListId, layoutId, regionId) {
65
66- //console.log(mediaListId);
67-
68 // Load the media id's into an array
69 var mediaList = "";
70
71@@ -54,8 +52,6 @@
72 mediaList = mediaList + $(this).attr("mediaid") + "&" + $(this).attr("lkid") + "|";
73 });
74
75- //console.log("Media List: " + mediaList);
76-
77 // Call the server to do the reorder
78 $.ajax({
79 type:"post",
80@@ -87,22 +83,28 @@
81 });
82
83 $(this).sortable('cancel');
84- },
85- revert: true
86+ }
87 }).disableSelection();
88
89 $("#LibraryAssignSortable").sortable({
90- dropOnEmpty: true
91+ connectWith: '.connectedSortable',
92+ dropOnEmpty: true,
93+ remove: function(event, ui) {
94+ ui.item.remove();
95+ }
96 }).disableSelection();
97
98+ $(".li-sortable", "#LibraryAssignSortable").dblclick(function(e){
99+ $(this).remove();
100+ });
101+
102 $(".li-sortable", "#LibraryAvailableSortable").dblclick(function(e){
103 var otherList = $($(e.currentTarget).parent().sortable("option","connectWith")).not($(e.currentTarget).parent());
104-
105- otherList.append($(e.currentTarget).clone());
106- });
107-
108- $(".li-sortable", "#LibraryAssignSortable").dblclick(function(e){
109- $(this).remove();
110+ var clone = $(e.currentTarget).clone().dblclick(function(e){
111+ $(this).remove();
112+ });
113+
114+ otherList.append(clone);
115 });
116 }
117
118@@ -113,8 +115,6 @@
119
120 mediaList = mediaList + "&regionid=" + regionId;
121
122- console.log(mediaList);
123-
124 $.ajax({
125 type: "post",
126 url: "index.php?p=layout&q=AddFromLibrary&layoutid="+layoutId+"&ajax=true",
127
128=== modified file 'server/lib/modules/module.class.php'
129--- server/lib/modules/module.class.php 2012-06-16 13:53:17 +0000
130+++ server/lib/modules/module.class.php 2012-12-02 17:37:36 +0000
131@@ -42,7 +42,8 @@
132 protected $lkid;
133 protected $validExtensions;
134 protected $validExtensionsText;
135-
136+ protected $previewEnabled;
137+
138 protected $xml;
139
140 protected $existingMedia;
141@@ -128,6 +129,7 @@
142 $this->validExtensionsText = Kit::ValidateParam($row['ValidExtensions'], _STRING);
143 $this->validExtensions = explode(',', $this->validExtensionsText);
144 $this->validExtensionsText = str_replace(',', ', ', $this->validExtensionsText);
145+ $this->previewEnabled = Kit::ValidateParam($row['PreviewEnabled'], _INT);
146
147 return true;
148 }
149
150=== modified file 'server/lib/pages/display.class.php'
151--- server/lib/pages/display.class.php 2012-09-16 14:50:02 +0000
152+++ server/lib/pages/display.class.php 2012-12-02 17:37:36 +0000
153@@ -233,7 +233,7 @@
154 $emailHelp = $helpManager->HelpIcon(__("Do you want to be notified by email if there is a problem with this display?"), true);
155 $alertHelp = $helpManager->HelpIcon(__("How long in minutes after the display last connected to the webservice should we send an alert. Set this value higher than the collection interval on the client. Set to 0 to use global default."), true);
156 $wolHelp = $helpManager->HelpIcon(__('Wake on Lan requires the correct network configuration to route the magic packet to the display PC'), true);
157- $wolTimeHelp = $helpManager->HelpIcon(_('The time this display should receive the WOL command, using the 24hr clock - e.g. 19:00. Maintenance must be enabled.'), true);
158+ $wolTimeHelp = $helpManager->HelpIcon(__('The time this display should receive the WOL command, using the 24hr clock - e.g. 19:00. Maintenance must be enabled.'), true);
159
160 // List of layouts
161 $layoutList = Kit::SelectList('defaultlayoutid', $this->user->LayoutList(), 'layoutid', 'layout', $layoutid);
162
163=== modified file 'server/lib/pages/module.class.php'
164--- server/lib/pages/module.class.php 2012-06-04 14:03:36 +0000
165+++ server/lib/pages/module.class.php 2012-12-02 17:37:36 +0000
166@@ -124,7 +124,8 @@
167 $SQL .= ' Description, ';
168 $SQL .= ' RegionSpecific, ';
169 $SQL .= ' ValidExtensions, ';
170- $SQL .= ' ImageUri ';
171+ $SQL .= ' ImageUri, ';
172+ $SQL .= ' PreviewEnabled ';
173 $SQL .= ' FROM `module` ';
174 $SQL .= ' ORDER BY Name ';
175
176@@ -142,6 +143,7 @@
177 $output .= ' <th>' . __('Library Media') .'</th>';
178 $output .= ' <th>' . __('Valid Extensions') .'</th>';
179 $output .= ' <th>' . __('Image Uri') .'</th>';
180+ $output .= ' <th>' . __('Preview Enabled') .'</th>';
181 $output .= ' <th>' . __('Enabled') .'</th>';
182 $output .= ' <th>' . __('Actions') .'</th>';
183 $output .= ' </tr>';
184@@ -156,6 +158,7 @@
185 $isRegionSpecific = Kit::ValidateParam($module['RegionSpecific'], _INT);
186 $validExtensions = Kit::ValidateParam($module['ValidExtensions'], _STRING);
187 $imageUri = Kit::ValidateParam($module['ImageUri'], _STRING);
188+ $previewEnabled = Kit::ValidateParam($module['PreviewEnabled'], _INT);
189 $enabled = Kit::ValidateParam($module['Enabled'], _INT);
190
191 $output .= '<tr>';
192@@ -164,6 +167,7 @@
193 $output .= '<td>' . (($isRegionSpecific == 0) ? '<img src="img/act.gif" />' : '') . '</td>';
194 $output .= '<td>' . $validExtensions . '</td>';
195 $output .= '<td>' . $imageUri . '</td>';
196+ $output .= '<td>' . (($previewEnabled == 1) ? '<img src="img/act.gif" />' : '<img src="img/disact.gif" />') . '</td>';
197 $output .= '<td>' . (($enabled == 1) ? '<img src="img/act.gif" />' : '<img src="img/disact.gif" />') . '</td>';
198 $output .= '<td>' . ((Config::GetSetting($db, 'MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') ? __('Modufle Config Locked') : '<button class="XiboFormButton" href="index.php?p=module&q=EditForm&ModuleID=' . $moduleId . '"><span>' . __('Edit') . '</span></button>') . '</td>';
199 $output .= '</tr>';
200@@ -196,7 +200,8 @@
201 $SQL .= ' Description, ';
202 $SQL .= ' RegionSpecific, ';
203 $SQL .= ' ValidExtensions, ';
204- $SQL .= ' ImageUri ';
205+ $SQL .= ' ImageUri, ';
206+ $SQL .= ' PreviewEnabled ';
207 $SQL .= ' FROM `module` ';
208 $SQL .= ' WHERE ModuleID = %d ';
209
210@@ -213,27 +218,28 @@
211 $isRegionSpecific = Kit::ValidateParam($row['RegionSpecific'], _INT);
212 $enabled = Kit::ValidateParam($row['Enabled'], _INT);
213 $enabledChecked = ($enabled) ? 'checked' : '';
214+ $previewEnabled = Kit::ValidateParam($row['PreviewEnabled'], _INT);
215+ $previewEnabledChecked = ($previewEnabled) ? 'checked' : '';
216
217 // Help UI
218 $iconModuleExtensions = $helpManager->HelpIcon(__('The Extensions allowed on files uploaded using this module. Comma Seperated.'), true);
219 $iconModuleImage = $helpManager->HelpIcon(__('The Image to display for this module'), true);
220 $iconModuleEnabled = $helpManager->HelpIcon(__('When Enabled users will be able to add media using this module'), true);
221+ $iconModulePreviewEnabled = $helpManager->HelpIcon(__('When Enabled users will be able to see a preview in the layout designer'), true);
222
223 $msgSave = __('Save');
224 $msgCancel = __('Cancel');
225- $msgAction = __('Action');
226- $msgEdit = __('Edit');
227- $msgDelete = __('Delete');
228-
229+
230 $msgModuleExtensions = __('Valid Extensions');
231 $msgModuleImage = __('Image');
232+ $msgModulePreviewEnabled = __('Preview Enabled');
233 $msgModuleEnabled = __('Enabled');
234
235 // The valid extensions field is only for library media
236 $validExtensionsField = <<<END
237 <tr>
238 <td>$msgModuleExtensions</td>
239- <td>$iconModuleExtensions <input class="required" type="text" name="ValidExtensions" value="$validExtensions" maxlength="254"></td>
240+ <td>$iconModuleExtensions <input type="text" name="ValidExtensions" value="$validExtensions" maxlength="254"></td>
241 </tr>
242 END;
243
244@@ -249,6 +255,10 @@
245 <td>$iconModuleImage <input class="required" type="text" name="ImageUri" value="$imageUri" maxlength="254"></td>
246 </tr>
247 <tr>
248+ <td>$msgModulePreviewEnabled</span></td>
249+ <td>$iconModulePreviewEnabled <input type="checkbox" name="PreviewEnabled" $previewEnabledChecked></td>
250+ </tr>
251+ <tr>
252 <td>$msgModuleEnabled</span></td>
253 <td>$iconModuleEnabled <input type="checkbox" name="Enabled" $enabledChecked></td>
254 </tr>
255@@ -275,6 +285,7 @@
256 $moduleId = Kit::GetParam('ModuleID', _POST, _INT);
257 $validExtensions = Kit::GetParam('ValidExtensions', _POST, _STRING, '');
258 $imageUri = Kit::GetParam('ImageUri', _POST, _STRING);
259+ $previewEnabled = Kit::GetParam('PreviewEnabled', _POST, _CHECKBOX);
260 $enabled = Kit::GetParam('Enabled', _POST, _CHECKBOX);
261
262 // Validation
263@@ -285,8 +296,8 @@
264 trigger_error(__('Image Uri is a required field.'), E_USER_ERROR);
265
266 // Deal with the Edit
267- $SQL = "UPDATE `module` SET ImageUri = '%s', ValidExtensions = '%s', Enabled = %d WHERE ModuleID = %d";
268- $SQL = sprintf($SQL, $db->escape_string($imageUri), $db->escape_string($validExtensions), $enabled, $moduleId);
269+ $SQL = "UPDATE `module` SET ImageUri = '%s', ValidExtensions = '%s', PreviewEnabled = %d, Enabled = %d WHERE ModuleID = %d";
270+ $SQL = sprintf($SQL, $db->escape_string($imageUri), $db->escape_string($validExtensions), $previewEnabled, $enabled, $moduleId);
271
272 if (!$db->query($SQL))
273 {
274
275=== modified file 'server/modules/counter.module.php'
276--- server/modules/counter.module.php 2011-08-09 20:48:36 +0000
277+++ server/modules/counter.module.php 2012-12-02 17:37:36 +0000
278@@ -307,6 +307,9 @@
279
280 public function Preview($width, $height)
281 {
282+ if ($this->previewEnabled == 0)
283+ return parent::Preview ($width, $height);
284+
285 $regionid = $this->regionid;
286
287 // Get the text out of RAW
288
289=== modified file 'server/modules/datasetview.module.php'
290--- server/modules/datasetview.module.php 2012-06-09 18:25:50 +0000
291+++ server/modules/datasetview.module.php 2012-12-02 17:37:36 +0000
292@@ -398,8 +398,9 @@
293
294 public function Preview($width, $height)
295 {
296- $db =& $this->db;
297-
298+ if ($this->previewEnabled == 0)
299+ return parent::Preview ($width, $height);
300+
301 // Show a preview of the data set table output.
302 return $this->DataSetTableHtml();
303 }
304
305=== modified file 'server/modules/image.module.php'
306--- server/modules/image.module.php 2012-04-14 13:28:20 +0000
307+++ server/modules/image.module.php 2012-12-02 17:37:36 +0000
308@@ -111,6 +111,9 @@
309
310 public function Preview($width, $height)
311 {
312+ if ($this->previewEnabled == 0)
313+ return parent::Preview ($width, $height);
314+
315 // Show the image - scaled to the aspect ratio of this region (get from GET)
316 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);
317 }
318
319=== modified file 'server/modules/shellcommand.module.php'
320--- server/modules/shellcommand.module.php 2012-06-02 10:23:52 +0000
321+++ server/modules/shellcommand.module.php 2012-12-02 17:37:36 +0000
322@@ -245,6 +245,9 @@
323
324 public function Preview($width, $height)
325 {
326+ if ($this->previewEnabled == 0)
327+ return parent::Preview ($width, $height);
328+
329 $msgWindows = __('Windows Command');
330 $msgLinux = __('Linux Command');
331
332
333=== modified file 'server/modules/text.module.php'
334--- server/modules/text.module.php 2012-07-06 07:15:39 +0000
335+++ server/modules/text.module.php 2012-12-02 17:37:36 +0000
336@@ -325,6 +325,9 @@
337 */
338 public function Preview($width, $height)
339 {
340+ if ($this->previewEnabled == 0)
341+ return parent::Preview ($width, $height);
342+
343 $layoutId = $this->layoutid;
344 $regionId = $this->regionid;
345
346
347=== modified file 'server/modules/ticker.module.php'
348--- server/modules/ticker.module.php 2012-07-06 07:15:39 +0000
349+++ server/modules/ticker.module.php 2012-12-02 17:37:36 +0000
350@@ -468,6 +468,9 @@
351 */
352 public function Preview($width, $height)
353 {
354+ if ($this->previewEnabled == 0)
355+ return parent::Preview ($width, $height);
356+
357 $layoutId = $this->layoutid;
358 $regionId = $this->regionid;
359
360
361=== modified file 'server/modules/webpage.module.php'
362--- server/modules/webpage.module.php 2012-07-07 10:40:43 +0000
363+++ server/modules/webpage.module.php 2012-12-02 17:37:36 +0000
364@@ -337,6 +337,9 @@
365 */
366 public function Preview($width, $height)
367 {
368+ if ($this->previewEnabled == 0)
369+ return parent::Preview ($width, $height);
370+
371 $layoutId = $this->layoutid;
372 $regionId = $this->regionid;
373

Subscribers

People subscribed via source and target branches

to all changes: