Merge lp:~dangarner/xibo/server-140rc1 into lp:~xibo-maintainers/xibo/brorsen
- server-140rc1
- Merge into brorsen
Proposed by
Dan Garner
Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 251 | ||||||||||||||||||||
Proposed branch: | lp:~dangarner/xibo/server-140rc1 | ||||||||||||||||||||
Merge into: | lp:~xibo-maintainers/xibo/brorsen | ||||||||||||||||||||
Diff against target: |
1682 lines (+784/-688) 6 files modified
server/install/database/46.php (+31/-28) server/lib/data/layout.data.class.php (+17/-1) server/lib/pages/content.class.php (+33/-24) server/lib/pages/display.class.php (+693/-625) server/modules/module_user_general.php (+9/-9) server/services.php (+1/-1) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~dangarner/xibo/server-140rc1 | ||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xibo Maintainters | Pending | ||
Review via email: mp+124573@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/46.php' |
2 | --- server/install/database/46.php 2012-06-27 19:33:03 +0000 |
3 | +++ server/install/database/46.php 2012-09-16 15:01:24 +0000 |
4 | @@ -39,7 +39,7 @@ |
5 | |
6 | // Also run a script to tidy up orphaned media in the library |
7 | $library = Config::GetSetting($db, 'LIBRARY_LOCATION'); |
8 | - $library = rtrim($library, '/') . '/'; |
9 | + $library = rtrim($library, '/') . '/'; |
10 | |
11 | // Dump the files in the temp folder |
12 | foreach (scandir($library . 'temp') as $item) |
13 | @@ -50,34 +50,37 @@ |
14 | unlink($library . 'temp' . DIRECTORY_SEPARATOR . $item); |
15 | } |
16 | |
17 | + // Have commented this block out, as am not 100% convinced that it doesn't |
18 | + // delete things it shouldn't |
19 | + // |
20 | // Get a list of all media files |
21 | - foreach(scandir($library) as $file) |
22 | - { |
23 | - if ($file == '.' || $file == '..') |
24 | - continue; |
25 | - |
26 | - if (is_dir($library . $file)) |
27 | - continue; |
28 | - |
29 | - $rowCount = $db->GetCountOfRows("SELECT * FROM media WHERE storedAs = '" . $file . "'"); |
30 | - |
31 | - // For each media file, check to see if the file still exists in the library |
32 | - if ($rowCount == 0) |
33 | - { |
34 | - // If not, delete it |
35 | - unlink($library . $file); |
36 | - |
37 | - if (file_exists($library . 'tn_' . $file)) |
38 | - { |
39 | - unlink($library . 'tn_' . $file); |
40 | - } |
41 | - |
42 | - if (file_exists($library . 'bg_' . $file)) |
43 | - { |
44 | - unlink($library . 'bg_' . $file); |
45 | - } |
46 | - } |
47 | - } |
48 | +// foreach(scandir($library) as $file) |
49 | +// { |
50 | +// if ($file == '.' || $file == '..') |
51 | +// continue; |
52 | +// |
53 | +// if (is_dir($library . $file)) |
54 | +// continue; |
55 | +// |
56 | +// $rowCount = $db->GetCountOfRows("SELECT * FROM media WHERE storedAs = '" . $file . "'"); |
57 | +// |
58 | +// // For each media file, check to see if the file still exists in the library |
59 | +// if ($rowCount == 0) |
60 | +// { |
61 | +// // If not, delete it |
62 | +// unlink($library . $file); |
63 | +// |
64 | +// if (file_exists($library . 'tn_' . $file)) |
65 | +// { |
66 | +// unlink($library . 'tn_' . $file); |
67 | +// } |
68 | +// |
69 | +// if (file_exists($library . 'bg_' . $file)) |
70 | +// { |
71 | +// unlink($library . 'bg_' . $file); |
72 | +// } |
73 | +// } |
74 | +// } |
75 | |
76 | return true; |
77 | } |
78 | |
79 | === modified file 'server/lib/data/layout.data.class.php' |
80 | --- server/lib/data/layout.data.class.php 2012-06-16 11:38:29 +0000 |
81 | +++ server/lib/data/layout.data.class.php 2012-09-16 15:01:24 +0000 |
82 | @@ -494,6 +494,23 @@ |
83 | |
84 | // Update the permissions for the new media record |
85 | $mediaSecurity->Copy($oldMediaId, $mediaId); |
86 | + |
87 | + // Copied the media node, so set the ID |
88 | + $mediaNode->setAttribute('id', $mediaId); |
89 | + |
90 | + // Also need to set the options node |
91 | + // Get the stored as value of the new node |
92 | + if (!$fileName = $this->db->GetSingleValue(sprintf("SELECT StoredAs FROM media WHERE MediaID = %d", $mediaId), 'StoredAs', _STRING)) |
93 | + return $this->SetError(25000, __('Unable to stored value of newly copied media')); |
94 | + |
95 | + $newNode = $this->DomXml->createElement('uri', $fileName); |
96 | + |
97 | + // Find the old node |
98 | + $uriNodes = $mediaNode->getElementsByTagName('uri'); |
99 | + $uriNode = $uriNodes->item(0); |
100 | + |
101 | + // Replace it |
102 | + $uriNode->parentNode->replaceChild($newNode, $uriNode); |
103 | } |
104 | |
105 | // Add the database link for this media record |
106 | @@ -509,7 +526,6 @@ |
107 | |
108 | // Set this LKID on the media node |
109 | $mediaNode->setAttribute('lkid', $lkId); |
110 | - $mediaNode->setAttribute('id', $mediaId); |
111 | } |
112 | |
113 | Debug::LogEntry($this->db, 'audit', 'Finished looping through media nodes', 'layout', 'Copy'); |
114 | |
115 | === modified file 'server/lib/pages/content.class.php' |
116 | --- server/lib/pages/content.class.php 2012-06-16 13:53:17 +0000 |
117 | +++ server/lib/pages/content.class.php 2012-09-16 15:01:24 +0000 |
118 | @@ -94,7 +94,7 @@ |
119 | $msgType = __('Type'); |
120 | $msgRetired = __('Retired'); |
121 | $msgOwner = __('Owner'); |
122 | - $msgShared = __('Shared'); |
123 | + $msgShowOriginal = __('Show the original file name for each media item?'); |
124 | |
125 | $filterForm = <<<END |
126 | <div class="FilterDiv" id="LibraryFilter"> |
127 | @@ -115,8 +115,7 @@ |
128 | <tr> |
129 | <td>$msgOwner</td> |
130 | <td>$user_list</td> |
131 | - <td></td> |
132 | - <td></td> |
133 | + <td colspan="4"><input type="checkbox" name="filter_showOriginal" id="filter_showOriginal" /><label for="filter_showOriginal">$msgShowOriginal</label></td> |
134 | </tr> |
135 | </table> |
136 | </form> |
137 | @@ -154,6 +153,7 @@ |
138 | $shared = Kit::GetParam('shared', _REQUEST, _STRING); |
139 | $filter_userid = Kit::GetParam('filter_userid', _REQUEST, _STRING, 'all'); |
140 | $filter_retired = Kit::GetParam('filter_retired', _REQUEST, _STRING, 'all'); |
141 | + $filterShowOriginal = Kit::GetParam('filter_showOriginal', _REQUEST, _CHECKBOX, 'off'); |
142 | |
143 | setSession('content', 'mediatype', $mediatype); |
144 | setSession('content', 'name', $name); |
145 | @@ -169,7 +169,8 @@ |
146 | $SQL .= " media.duration, "; |
147 | $SQL .= " media.userID, "; |
148 | $SQL .= " media.FileSize, "; |
149 | - $SQL .= " IFNULL((SELECT parentmedia.mediaid FROM media parentmedia WHERE parentmedia.editedmediaid = media.mediaid),0) AS ParentID "; |
150 | + $SQL .= " IFNULL((SELECT parentmedia.mediaid FROM media parentmedia WHERE parentmedia.editedmediaid = media.mediaid),0) AS ParentID, "; |
151 | + $SQL .= " media.originalFileName "; |
152 | $SQL .= "FROM media "; |
153 | $SQL .= " LEFT OUTER JOIN media parentmedia "; |
154 | $SQL .= " ON parentmedia.MediaID = media.MediaID "; |
155 | @@ -208,30 +209,33 @@ |
156 | // Messages |
157 | $msgName = __('Name'); |
158 | $msgType = __('Type'); |
159 | - $msgRetired = __('Retired'); |
160 | $msgOwner = __('Owner'); |
161 | $msgFileSize = __('Size'); |
162 | $msgRevisions = __('Revised'); |
163 | + $msgOriginal = __('Original Filename'); |
164 | $msgShared = __('Permissions'); |
165 | $msgAction = __('Action'); |
166 | |
167 | - $output = <<<END |
168 | - <div class="info_table"> |
169 | - <table style="width:100%"> |
170 | - <thead> |
171 | - <tr> |
172 | - <th>$msgName</th> |
173 | - <th>$msgType</th> |
174 | - <th>h:mi:ss</th> |
175 | - <th>$msgFileSize</th> |
176 | - <th>$msgOwner</th> |
177 | - <th>$msgShared</th> |
178 | - <th>$msgRevisions</th> |
179 | - <th>$msgAction</th> |
180 | - </tr> |
181 | - </thead> |
182 | - <tbody> |
183 | -END; |
184 | + $output = ''; |
185 | + $output.= '<div class="info_table">'; |
186 | + $output.= ' <table style="width:100%">'; |
187 | + $output.= ' <thead>'; |
188 | + $output.= ' <tr>'; |
189 | + $output.= ' <th>' . $msgName . '</th>'; |
190 | + $output.= ' <th>' . $msgType . '</th>'; |
191 | + $output.= ' <th>h:mi:ss</th>'; |
192 | + $output.= ' <th>' . $msgFileSize . '</th>'; |
193 | + $output.= ' <th>' . $msgOwner . '</th>'; |
194 | + $output.= ' <th>' . $msgShared . '</th>'; |
195 | + $output.= ' <th>' . $msgRevisions . '</th>'; |
196 | + |
197 | + if ($filterShowOriginal == 1) |
198 | + $output.= ' <th>' . $msgOriginal . '</th>'; |
199 | + |
200 | + $output.= ' <th>' . $msgAction . '</th>'; |
201 | + $output.= ' </tr>'; |
202 | + $output.= ' </thead>'; |
203 | + $output.= ' <tbody>'; |
204 | |
205 | while ($aRow = $db->get_row($results)) |
206 | { |
207 | @@ -242,7 +246,8 @@ |
208 | $ownerid = Kit::ValidateParam($aRow[4], _INT); |
209 | $fileSize = Kit::ValidateParam($aRow[5], _INT); |
210 | $revisions = (Kit::ValidateParam($aRow[6], _INT) != 0) ? '<img src="img/act.gif" />' : ''; |
211 | - |
212 | + $originalFileName = Kit::ValidateParam($aRow[7], _STRING); |
213 | + |
214 | // Size in MB |
215 | $sz = 'BKMGTP'; |
216 | $factor = floor((strlen($fileSize) - 1) / 3); |
217 | @@ -277,6 +282,9 @@ |
218 | $output .= "<td>$username</td>"; |
219 | $output .= "<td>$group</td>"; |
220 | $output .= '<td>' . $revisions . '</td>'; |
221 | + |
222 | + if ($filterShowOriginal == 1) |
223 | + $output .= '<td>' . $originalFileName . '</td>'; |
224 | |
225 | // ACTION buttons |
226 | if ($auth->edit) |
227 | @@ -329,7 +337,8 @@ |
228 | $response = new ResponseManager(); |
229 | |
230 | // Get a list of the enabled modules and then create buttons for them |
231 | - if (!$enabledModules = new ModuleManager($db, $user, 0)) trigger_error($enabledModules->message, E_USER_ERROR); |
232 | + if (!$enabledModules = new ModuleManager($db, $user, 0)) |
233 | + trigger_error($enabledModules->message, E_USER_ERROR); |
234 | |
235 | $buttons = ''; |
236 | |
237 | |
238 | === modified file 'server/lib/pages/display.class.php' |
239 | --- server/lib/pages/display.class.php 2012-07-03 19:55:43 +0000 |
240 | +++ server/lib/pages/display.class.php 2012-09-16 15:01:24 +0000 |
241 | @@ -22,264 +22,324 @@ |
242 | |
243 | class displayDAO |
244 | { |
245 | - private $db; |
246 | - private $user; |
247 | - private $has_permissions = true; |
248 | + private $db; |
249 | + private $user; |
250 | + private $has_permissions = true; |
251 | |
252 | - //display table fields |
253 | - private $displayid; |
254 | - private $display; |
255 | - private $layoutid; |
256 | - private $license; |
257 | - private $licensed; |
258 | - private $inc_schedule; |
259 | - private $auditing; |
260 | + //display table fields |
261 | + private $displayid; |
262 | + private $display; |
263 | + private $layoutid; |
264 | + private $license; |
265 | + private $licensed; |
266 | + private $inc_schedule; |
267 | + private $auditing; |
268 | private $email_alert; |
269 | private $alert_timeout; |
270 | - private $ajax; |
271 | - private $mediaInventoryStatus; |
272 | - private $mediaInventoryXml; |
273 | - |
274 | - function __construct(database $db, user $user) |
275 | - { |
276 | - $this->db =& $db; |
277 | - $this->user =& $user; |
278 | - |
279 | - include_once('lib/data/display.data.class.php'); |
280 | - |
281 | - $this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view'); |
282 | - $this->ajax = Kit::GetParam('ajax', _REQUEST, _WORD, 'false'); |
283 | - $displayid = Kit::GetParam('displayid', _REQUEST, _INT, 0); |
284 | - |
285 | - // validate displays so we get a realistic view of the table |
286 | - $this->validateDisplays(); |
287 | - |
288 | - if(isset($_GET['modify']) || $displayid != 0) |
289 | - { |
290 | - $this->sub_page = 'edit'; |
291 | - |
292 | - if (!$this->has_permissions && $this->ajax == 'true') |
293 | - { |
294 | - trigger_error(__("You do not have permissions to edit this display"), E_USER_ERROR); |
295 | - } |
296 | - |
297 | - $SQL = <<<SQL |
298 | - SELECT display.displayid, |
299 | - display.display, |
300 | - display.defaultlayoutid, |
301 | - display.license, |
302 | - display.licensed, |
303 | - display.inc_schedule, |
304 | - display.isAuditing, |
305 | - display.email_alert, |
306 | - display.alert_timeout, |
307 | - display.MediaInventoryStatus, |
308 | - display.MediaInventoryXml |
309 | - FROM display |
310 | - WHERE display.displayid = %d |
311 | + private $ajax; |
312 | + private $mediaInventoryStatus; |
313 | + private $mediaInventoryXml; |
314 | + private $macAddress; |
315 | + private $wakeOnLan; |
316 | + private $wakeOnLanTime; |
317 | + private $broadCastAddress; |
318 | + private $secureOn; |
319 | + private $cidr; |
320 | + private $clientIpAddress; |
321 | + |
322 | + function __construct(database $db, user $user) |
323 | + { |
324 | + $this->db =& $db; |
325 | + $this->user =& $user; |
326 | + |
327 | + include_once('lib/data/display.data.class.php'); |
328 | + |
329 | + $this->sub_page = Kit::GetParam('sp', _GET, _WORD, 'view'); |
330 | + $this->ajax = Kit::GetParam('ajax', _REQUEST, _WORD, 'false'); |
331 | + $displayid = Kit::GetParam('displayid', _REQUEST, _INT, 0); |
332 | + |
333 | + // validate displays so we get a realistic view of the table |
334 | + $this->validateDisplays(); |
335 | + |
336 | + if(isset($_GET['modify']) || $displayid != 0) |
337 | + { |
338 | + $this->sub_page = 'edit'; |
339 | + |
340 | + if (!$this->has_permissions && $this->ajax == 'true') |
341 | + trigger_error(__("You do not have permissions to edit this display"), E_USER_ERROR); |
342 | + |
343 | + $SQL = <<<SQL |
344 | + SELECT display.displayid, |
345 | + display.display, |
346 | + display.defaultlayoutid, |
347 | + display.license, |
348 | + display.licensed, |
349 | + display.inc_schedule, |
350 | + display.isAuditing, |
351 | + display.email_alert, |
352 | + display.alert_timeout, |
353 | + display.MediaInventoryStatus, |
354 | + display.MediaInventoryXml, |
355 | + display.MacAddress, |
356 | + display.WakeOnLan, |
357 | + display.WakeOnLanTime, |
358 | + display.BroadCastAddress, |
359 | + display.SecureOn, |
360 | + display.Cidr, |
361 | + display.ClientAddress |
362 | + FROM display |
363 | + WHERE display.displayid = %d |
364 | SQL; |
365 | |
366 | - $SQL = sprintf($SQL, $displayid); |
367 | - |
368 | - Debug::LogEntry($db, 'audit', $SQL); |
369 | - |
370 | - if(!$results = $db->query($SQL)) |
371 | - { |
372 | - trigger_error($db->error()); |
373 | - trigger_error(__("Can not get the display information for display") . '[$this->displayid]', E_USER_ERROR); |
374 | - } |
375 | - |
376 | - while($row = $db->get_row($results)) |
377 | - { |
378 | - $this->displayid = Kit::ValidateParam($row[0], _INT); |
379 | - $this->display = Kit::ValidateParam($row[1], _STRING); |
380 | - $this->layoutid = Kit::ValidateParam($row[2], _INT); |
381 | - $this->license = Kit::ValidateParam($row[3], _STRING); |
382 | - $this->licensed = Kit::ValidateParam($row[4], _INT); |
383 | - $this->inc_schedule = Kit::ValidateParam($row[5], _INT); |
384 | - $this->auditing = Kit::ValidateParam($row[6], _INT); |
385 | - $this->email_alert = Kit::ValidateParam($row[7], _INT); |
386 | - $this->alert_timeout = Kit::ValidateParam($row[8], _INT); |
387 | - $this->mediaInventoryStatus = Kit::ValidateParam($row[9], _INT); |
388 | - $this->mediaInventoryXml = Kit::ValidateParam($row[10], _HTMLSTRING); |
389 | - } |
390 | - } |
391 | - |
392 | - return true; |
393 | - } |
394 | - |
395 | - function on_page_load() |
396 | - { |
397 | - return ""; |
398 | - } |
399 | - |
400 | - function echo_page_heading() |
401 | - { |
402 | - echo __("Display Administration"); |
403 | - return true; |
404 | - } |
405 | - |
406 | - /** |
407 | - * Modifies the selected display record |
408 | - * @return |
409 | - */ |
410 | - function modify() |
411 | - { |
412 | - $db =& $this->db; |
413 | - $response = new ResponseManager(); |
414 | - |
415 | - $displayid = Kit::GetParam('displayid', _POST, _INT); |
416 | - |
417 | - $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
418 | - if (!$auth->edit) |
419 | - trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
420 | - |
421 | - $display = Kit::GetParam('display', _POST, _STRING); |
422 | - $layoutid = Kit::GetParam('defaultlayoutid', _POST, _INT); |
423 | - $inc_schedule = Kit::GetParam('inc_schedule', _POST, _INT); |
424 | - $auditing = Kit::GetParam('auditing', _POST, _INT); |
425 | + $SQL = sprintf($SQL, $displayid); |
426 | + |
427 | + Debug::LogEntry($db, 'audit', $SQL); |
428 | + |
429 | + if(!$results = $db->query($SQL)) |
430 | + { |
431 | + trigger_error($db->error()); |
432 | + trigger_error(__("Can not get the display information for display") . '[$this->displayid]', E_USER_ERROR); |
433 | + } |
434 | + |
435 | + while($row = $db->get_row($results)) |
436 | + { |
437 | + $this->displayid = Kit::ValidateParam($row[0], _INT); |
438 | + $this->display = Kit::ValidateParam($row[1], _STRING); |
439 | + $this->layoutid = Kit::ValidateParam($row[2], _INT); |
440 | + $this->license = Kit::ValidateParam($row[3], _STRING); |
441 | + $this->licensed = Kit::ValidateParam($row[4], _INT); |
442 | + $this->inc_schedule = Kit::ValidateParam($row[5], _INT); |
443 | + $this->auditing = Kit::ValidateParam($row[6], _INT); |
444 | + $this->email_alert = Kit::ValidateParam($row[7], _INT); |
445 | + $this->alert_timeout = Kit::ValidateParam($row[8], _INT); |
446 | + $this->mediaInventoryStatus = Kit::ValidateParam($row[9], _INT); |
447 | + $this->mediaInventoryXml = Kit::ValidateParam($row[10], _HTMLSTRING); |
448 | + $this->macAddress = Kit::ValidateParam($row[11], _STRING); |
449 | + $this->wakeOnLan = Kit::ValidateParam($row[12], _INT); |
450 | + $this->wakeOnLanTime = Kit::ValidateParam($row[13], _STRING); |
451 | + $this->broadCastAddress = Kit::ValidateParam($row[14], _STRING); |
452 | + $this->secureOn = Kit::ValidateParam($row[15], _STRING); |
453 | + $this->cidr = Kit::ValidateParam($row[16], _INT); |
454 | + $this->clientIpAddress = Kit::ValidateParam($row[17], _STRING); |
455 | + |
456 | + // Make cidr null if its a 0 |
457 | + $this->cidr = ($this->cidr == 0) ? '' : $this->cidr; |
458 | + } |
459 | + } |
460 | + |
461 | + return true; |
462 | + } |
463 | + |
464 | + function on_page_load() |
465 | + { |
466 | + return ""; |
467 | + } |
468 | + |
469 | + function echo_page_heading() |
470 | + { |
471 | + echo __("Display Administration"); |
472 | + return true; |
473 | + } |
474 | + |
475 | + /** |
476 | + * Modifies the selected display record |
477 | + * @return |
478 | + */ |
479 | + function modify() |
480 | + { |
481 | + $db =& $this->db; |
482 | + $response = new ResponseManager(); |
483 | + |
484 | + $displayid = Kit::GetParam('displayid', _POST, _INT); |
485 | + |
486 | + $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
487 | + if (!$auth->edit) |
488 | + trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
489 | + |
490 | + $display = Kit::GetParam('display', _POST, _STRING); |
491 | + $layoutid = Kit::GetParam('defaultlayoutid', _POST, _INT); |
492 | + $inc_schedule = Kit::GetParam('inc_schedule', _POST, _INT); |
493 | + $auditing = Kit::GetParam('auditing', _POST, _INT); |
494 | $email_alert = Kit::GetParam('email_alert', _POST, _INT); |
495 | $alert_timeout = Kit::GetParam('alert_timeout', _POST, _INT); |
496 | - |
497 | - // Do we take, or revoke a license |
498 | - if (isset($_POST['takeLicense'])) |
499 | - { |
500 | - $licensed = Kit::GetParam('takeLicense', _POST, _INT); |
501 | - } |
502 | - if (isset($_POST['revokeLicense'])) |
503 | - { |
504 | - $licensed = Kit::GetParam('revokeLicense', _POST, _INT); |
505 | - } |
506 | - |
507 | - //Validation |
508 | - if ($display == "") |
509 | - { |
510 | - trigger_error(__("Can not have a display without a name"), E_USER_ERROR); |
511 | - } |
512 | - |
513 | - $displayObject = new Display($db); |
514 | - |
515 | - if (!$displayObject->Edit($displayid, $display, $auditing, $layoutid, $licensed, $inc_schedule, $email_alert, $alert_timeout)) |
516 | - { |
517 | - trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR); |
518 | - } |
519 | - |
520 | - $response->SetFormSubmitResponse(__('Display Saved.')); |
521 | - $response->Respond(); |
522 | - } |
523 | - |
524 | - /** |
525 | - * Modify Display form |
526 | - * @return |
527 | - */ |
528 | - function displayForm() |
529 | - { |
530 | - $db =& $this->db; |
531 | - $user =& $this->user; |
532 | - $response = new ResponseManager(); |
533 | - |
534 | - $helpManager = new HelpManager($db, $user); |
535 | - |
536 | - //get some vars |
537 | - $displayid = $this->displayid; |
538 | - |
539 | - $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
540 | - if (!$auth->edit) |
541 | - trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
542 | - |
543 | - $display = $this->display; |
544 | - $layoutid = $this->layoutid; |
545 | - $license = $this->license; |
546 | - $licensed = $this->licensed; |
547 | - $inc_schedule = $this->inc_schedule; |
548 | - $auditing = $this->auditing; |
549 | + $wakeOnLanEnabled = Kit::GetParam('wakeOnLanEnabled', _POST, _CHECKBOX); |
550 | + $wakeOnLanTime = Kit::GetParam('wakeOnLanTime', _POST, _STRING); |
551 | + $broadCastAddress = Kit::GetParam('broadCastAddress', _POST, _STRING); |
552 | + $secureOn = Kit::GetParam('secureOn', _POST, _STRING); |
553 | + $cidr = Kit::GetParam('cidr', _POST, _INT); |
554 | + |
555 | + // Do we take, or revoke a license |
556 | + if (isset($_POST['takeLicense'])) |
557 | + { |
558 | + $licensed = Kit::GetParam('takeLicense', _POST, _INT); |
559 | + } |
560 | + if (isset($_POST['revokeLicense'])) |
561 | + { |
562 | + $licensed = Kit::GetParam('revokeLicense', _POST, _INT); |
563 | + } |
564 | + |
565 | + //Validation |
566 | + if ($display == '') |
567 | + trigger_error(__("Can not have a display without a name"), E_USER_ERROR); |
568 | + |
569 | + if ($wakeOnLanEnabled == 1 && $wakeOnLanTime == '') |
570 | + trigger_error(__('Wake on Lan is enabled, but you have not specified a time to wake the display'), E_USER_ERROR); |
571 | + |
572 | + $displayObject = new Display($db); |
573 | + |
574 | + if (!$displayObject->Edit($displayid, $display, $auditing, $layoutid, $licensed, $inc_schedule, $email_alert, $alert_timeout, $wakeOnLanEnabled, $wakeOnLanTime, $broadCastAddress, $secureOn, $cidr)) |
575 | + { |
576 | + trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR); |
577 | + } |
578 | + |
579 | + $response->SetFormSubmitResponse(__('Display Saved.')); |
580 | + $response->Respond(); |
581 | + } |
582 | + |
583 | + /** |
584 | + * Modify Display form |
585 | + * @return |
586 | + */ |
587 | + function displayForm() |
588 | + { |
589 | + $db =& $this->db; |
590 | + $user =& $this->user; |
591 | + $response = new ResponseManager(); |
592 | + |
593 | + $helpManager = new HelpManager($db, $user); |
594 | + |
595 | + //get some vars |
596 | + $displayid = $this->displayid; |
597 | + |
598 | + $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
599 | + if (!$auth->edit) |
600 | + trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
601 | + |
602 | + $display = $this->display; |
603 | + $layoutid = $this->layoutid; |
604 | + $license = $this->license; |
605 | + $licensed = $this->licensed; |
606 | + $inc_schedule = $this->inc_schedule; |
607 | + $auditing = $this->auditing; |
608 | $email_alert = $this->email_alert; |
609 | $alert_timeout = $this->alert_timeout; |
610 | |
611 | - // Help UI |
612 | - $nameHelp = $helpManager->HelpIcon(__("The Name of the Display - (1 - 50 characters)."), true); |
613 | - $defaultHelp = $helpManager->HelpIcon(__("The Default Layout to Display where there is no other content."), true); |
614 | - $interleveHelp = $helpManager->HelpIcon(__("Whether to always put the default into the cycle."), true); |
615 | - $licenseHelp = $helpManager->HelpIcon(__("Control the licensing on this display."), true); |
616 | - $auditHelp = $helpManager->HelpIcon(__("Collect auditing from this client. Should only be used if there is a problem with the display."), true); |
617 | + // Help UI |
618 | + $nameHelp = $helpManager->HelpIcon(__("The Name of the Display - (1 - 50 characters)."), true); |
619 | + $defaultHelp = $helpManager->HelpIcon(__("The Default Layout to Display where there is no other content."), true); |
620 | + $interleveHelp = $helpManager->HelpIcon(__("Whether to always put the default into the cycle."), true); |
621 | + $licenseHelp = $helpManager->HelpIcon(__("Control the licensing on this display."), true); |
622 | + $auditHelp = $helpManager->HelpIcon(__("Collect auditing from this client. Should only be used if there is a problem with the display."), true); |
623 | $emailHelp = $helpManager->HelpIcon(__("Do you want to be notified by email if there is a problem with this display?"), true); |
624 | $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); |
625 | - |
626 | - |
627 | - $layoutList = Kit::SelectList('defaultlayoutid', $this->user->LayoutList(), 'layoutid', 'layout', $layoutid); |
628 | - |
629 | - $inc_schedule_list = listcontent("1|Yes,0|No","inc_schedule",$inc_schedule); |
630 | - $auditing_list = listcontent("1|Yes,0|No","auditing",$auditing); |
631 | + $wolHelp = $helpManager->HelpIcon(__('Wake on Lan requires the correct network configuration to route the magic packet to the display PC'), true); |
632 | + $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); |
633 | + |
634 | + // List of layouts |
635 | + $layoutList = Kit::SelectList('defaultlayoutid', $this->user->LayoutList(), 'layoutid', 'layout', $layoutid); |
636 | + |
637 | + $inc_schedule_list = listcontent("1|Yes,0|No","inc_schedule",$inc_schedule); |
638 | + $auditing_list = listcontent("1|Yes,0|No","auditing",$auditing); |
639 | $email_alert_list = listcontent("1|Yes,0|No","email_alert",$email_alert); |
640 | |
641 | - $license_list = ""; |
642 | - |
643 | - //Are we licensed |
644 | - if ($licensed == 0) |
645 | - { |
646 | - //There are licenses to take, shall we take them? |
647 | - $license_list = '<td><label for="takeLicense" title="' . __('Will use one of the available licenses for this display') . '">' . __('License Display') . '</label></td>'; |
648 | - $license_list .= "<td>" . listcontent("1|Yes,0|No", "takeLicense", "1") . "</td>"; |
649 | - } |
650 | - else |
651 | - { |
652 | - // Give an option to revoke |
653 | - $license_list = '<td><label for="revokeLicense" title="' . __('Revoke License') . '. ' . __('Make the license available for another display.') . '">' . __('Revoke License') . '</label></td>'; |
654 | - $license_list .= "<td>" . listcontent("0|Yes,1|No", "revokeLicense", "1") . "</td>"; |
655 | - } |
656 | - |
657 | - // Messages |
658 | - $msgDisplay = __('Display'); |
659 | - $msgDefault = __('Default Layout'); |
660 | - $msgInterL = __('Interleave Default'); |
661 | - $msgAudit = __('Auditing'); |
662 | - $msgLicense = __('License'); |
663 | + // Is the wake on lan field checked? |
664 | + $wakeOnLanChecked = ($this->wakeOnLan == 1) ? ' checked' : ''; |
665 | + $license_list = ""; |
666 | + |
667 | + //Are we licensed |
668 | + if ($licensed == 0) |
669 | + { |
670 | + //There are licenses to take, shall we take them? |
671 | + $license_list = '<td><label for="takeLicense" title="' . __('Will use one of the available licenses for this display') . '">' . __('License Display') . '</label></td>'; |
672 | + $license_list .= "<td>" . listcontent("1|Yes,0|No", "takeLicense", "1") . "</td>"; |
673 | + } |
674 | + else |
675 | + { |
676 | + // Give an option to revoke |
677 | + $license_list = '<td><label for="revokeLicense" title="' . __('Revoke License') . '. ' . __('Make the license available for another display.') . '">' . __('Revoke License') . '</label></td>'; |
678 | + $license_list .= "<td>" . listcontent("0|Yes,1|No", "revokeLicense", "1") . "</td>"; |
679 | + } |
680 | + |
681 | + // Messages |
682 | + $msgDisplay = __('Display'); |
683 | + $msgDefault = __('Default Layout'); |
684 | + $msgInterL = __('Interleave Default'); |
685 | + $msgAudit = __('Auditing'); |
686 | + $msgLicense = __('License'); |
687 | $msgAlert = __('Email Alerts'); |
688 | $msgTimeout = __('Alert Timeout'); |
689 | - |
690 | - $form = <<<END |
691 | - <form id="DisplayEditForm" class="XiboForm" method="post" action="index.php?p=display&q=modify&id=$displayid"> |
692 | - <input type="hidden" name="displayid" value="$displayid"> |
693 | - <table> |
694 | - <tr> |
695 | - <td>$msgDisplay<span class="required">*</span></td> |
696 | - <td>$nameHelp <input name="display" type="text" value="$display"></td> |
697 | - <td>$msgDefault<span class="required">*</span></td> |
698 | - <td>$defaultHelp $layoutList</td> |
699 | - </tr> |
700 | - <tr> |
701 | - <td>$msgInterL<span class="required">*</span></td> |
702 | - <td>$interleveHelp $inc_schedule_list</td> |
703 | - </tr> |
704 | - <tr> |
705 | - <td>$msgAudit?<span class="required">*</span></td> |
706 | - <td>$auditHelp $auditing_list</td> |
707 | - </tr> |
708 | - <tr> |
709 | - <td>$msgAlert<span class="required">*</span></td> |
710 | - <td>$emailHelp $email_alert_list</td> |
711 | - <td>$msgTimeout<span class="required">*</span></td> |
712 | - <td>$alertHelp <input name="alert_timeout" type="text" value="$alert_timeout"></td> |
713 | - </tr> |
714 | - <tr> |
715 | - <td>$msgLicense</td> |
716 | - <td>$licenseHelp <input type="text" readonly value="$license"></td> |
717 | - $license_list |
718 | - </tr> |
719 | - </table> |
720 | - </form> |
721 | + $msgWakeOnLan = __('Enable Wake On LAN'); |
722 | + $msgWakeOnLanTime = __('Wake On LAN Time'); |
723 | + $msgBroadCastAddress = __('BroadCast Address'); |
724 | + $msgSecureOn = __('Wake On LAN Secure On'); |
725 | + $msgCidr = __('Wake On LAN CIDR'); |
726 | + |
727 | + $helpBroadCastAddress = $helpManager->HelpIcon(__('The IP address of the remote host\'s broadcast address (or gateway)'), true); |
728 | + $helpSecureOn = $helpManager->HelpIcon(__('Enter a hexidecimal password of a SecureOn enabled Network Interface Card (NIC) of the remote host. Enter a value in this pattern: \'xx-xx-xx-xx-xx-xx\'. Leave the following field empty, if SecureOn is not used (for example, because the NIC of the remote host does not support SecureOn).'), true); |
729 | + $helpCidr = $helpManager->HelpIcon(__('Enter a number within the range of 0 to 32 in the following field. Leave the following field empty, if no subnet mask should be used (CIDR = 0). If the remote host\'s broadcast address is unkown: Enter the host name or IP address of the remote host in Broad Cast Address and enter the CIDR subnet mask of the remote host in this field.'), true); |
730 | + |
731 | + // If the broadcast address has not been set, then default to the client ip address |
732 | + $broadCastAddress = ($this->broadCastAddress == '') ? $this->clientIpAddress : $this->broadCastAddress; |
733 | + |
734 | + |
735 | + $form = <<<END |
736 | + <form id="DisplayEditForm" class="XiboForm" method="post" action="index.php?p=display&q=modify&id=$displayid"> |
737 | + <input type="hidden" name="displayid" value="$displayid"> |
738 | + <table> |
739 | + <tr> |
740 | + <td>$msgDisplay<span class="required">*</span></td> |
741 | + <td>$nameHelp <input name="display" type="text" value="$display"></td> |
742 | + <td>$msgDefault<span class="required">*</span></td> |
743 | + <td>$defaultHelp $layoutList</td> |
744 | + </tr> |
745 | + <tr> |
746 | + <td>$msgInterL<span class="required">*</span></td> |
747 | + <td>$interleveHelp $inc_schedule_list</td> |
748 | + </tr> |
749 | + <tr> |
750 | + <td>$msgAudit?<span class="required">*</span></td> |
751 | + <td>$auditHelp $auditing_list</td> |
752 | + </tr> |
753 | + <tr> |
754 | + <td>$msgAlert<span class="required">*</span></td> |
755 | + <td>$emailHelp $email_alert_list</td> |
756 | + <td>$msgTimeout<span class="required">*</span></td> |
757 | + <td>$alertHelp <input name="alert_timeout" type="text" value="$alert_timeout"></td> |
758 | + </tr> |
759 | + <tr> |
760 | + <td colspan="2"><label for="wakeOnLanEnabled">$msgWakeOnLan</label>$wolHelp<input type="checkbox" id="wakeOnLanEnabled" name="wakeOnLanEnabled" $wakeOnLanChecked></td> |
761 | + <td>$msgWakeOnLanTime</td> |
762 | + <td>$wolTimeHelp<input name="wakeOnLanTime" type="text" value="$this->wakeOnLanTime"></td> |
763 | + </tr> |
764 | + <tr> |
765 | + <td><label for="broadCastAddress">$msgBroadCastAddress</label></td> |
766 | + <td>$helpBroadCastAddress<input type="text" id="broadCastAddress" name="broadCastAddress" value="$broadCastAddress"></td> |
767 | + </tr> |
768 | + <tr> |
769 | + <td><label for="secureOn">$msgSecureOn</label></td> |
770 | + <td>$helpSecureOn<input id="secureOn" name="secureOn" type="text" value="$this->secureOn"></td> |
771 | + <td><label for="cidr">$msgCidr</label></td> |
772 | + <td>$helpCidr<input id="cidr" name="cidr" type="text" value="$this->cidr" class="number"></td> |
773 | + </tr> |
774 | + <tr> |
775 | + <td>$msgLicense</td> |
776 | + <td>$licenseHelp <input type="text" readonly value="$license"></td> |
777 | + $license_list |
778 | + </tr> |
779 | + </table> |
780 | + </form> |
781 | END; |
782 | |
783 | - $response->SetFormRequestResponse($form, __('Edit a Display'), '650px', '300px'); |
784 | - $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Display', 'Edit') . '")'); |
785 | - $response->AddButton(__('Cancel'), 'XiboDialogClose()'); |
786 | - $response->AddButton(__('Save'), '$("#DisplayEditForm").submit()'); |
787 | - $response->Respond(); |
788 | - } |
789 | + $response->SetFormRequestResponse($form, __('Edit a Display'), '650px', '300px'); |
790 | + $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Display', 'Edit') . '")'); |
791 | + $response->AddButton(__('Cancel'), 'XiboDialogClose()'); |
792 | + $response->AddButton(__('Save'), '$("#DisplayEditForm").submit()'); |
793 | + $response->Respond(); |
794 | + } |
795 | |
796 | - public function DisplayFilter() |
797 | - { |
798 | - $filterForm = <<<END |
799 | + public function DisplayFilter() |
800 | + { |
801 | + $filterForm = <<<END |
802 | <div class="FilterDiv" id="LayoutFilter"> |
803 | <form onsubmit="return false"> |
804 | <input type="hidden" name="p" value="display"> |
805 | @@ -288,86 +348,87 @@ |
806 | </div> |
807 | END; |
808 | |
809 | - $id = uniqid(); |
810 | - |
811 | - $xiboGrid = <<<HTML |
812 | - <div class="XiboGrid" id="$id"> |
813 | - <div class="XiboFilter"> |
814 | - $filterForm |
815 | - </div> |
816 | - <div class="XiboData"> |
817 | - |
818 | - </div> |
819 | - </div> |
820 | + $id = uniqid(); |
821 | + |
822 | + $xiboGrid = <<<HTML |
823 | + <div class="XiboGrid" id="$id"> |
824 | + <div class="XiboFilter"> |
825 | + $filterForm |
826 | + </div> |
827 | + <div class="XiboData"> |
828 | + |
829 | + </div> |
830 | + </div> |
831 | HTML; |
832 | - echo $xiboGrid; |
833 | - } |
834 | - |
835 | - /** |
836 | - * Grid of Displays |
837 | - * @return |
838 | - */ |
839 | - function DisplayGrid() |
840 | - { |
841 | - $db =& $this->db; |
842 | - $user =& $this->user; |
843 | - $response = new ResponseManager(); |
844 | - |
845 | - //display the display table |
846 | - $SQL = <<<SQL |
847 | - SELECT display.displayid, |
848 | - display.display, |
849 | - layout.layout, |
850 | - CASE WHEN display.loggedin = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS loggedin, |
851 | - display.lastaccessed, |
852 | - CASE WHEN display.inc_schedule = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS inc_schedule, |
853 | - CASE WHEN display.licensed = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS licensed, |
854 | - CASE WHEN display.email_alert = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS email_alert, |
855 | - displaygroup.DisplayGroupID, |
856 | - display.ClientAddress, |
857 | - CASE WHEN display.MediaInventoryStatus = 1 THEN '<img src="img/act.gif">' |
858 | - WHEN display.MediaInventoryStatus = 2 THEN '<img src="img/warn.gif">' |
859 | - ELSE '<img src="img/disact.gif">' |
860 | - END AS MediaInventoryStatus, |
861 | - display.MediaInventoryXml |
862 | - FROM display |
863 | - INNER JOIN lkdisplaydg ON lkdisplaydg.DisplayID = display.DisplayID |
864 | - INNER JOIN displaygroup ON displaygroup.DisplayGroupID = lkdisplaydg.DisplayGroupID |
865 | - LEFT OUTER JOIN layout ON layout.layoutid = display.defaultlayoutid |
866 | - WHERE displaygroup.IsDisplaySpecific = 1 |
867 | - ORDER BY display.displayid |
868 | + echo $xiboGrid; |
869 | + } |
870 | + |
871 | + /** |
872 | + * Grid of Displays |
873 | + * @return |
874 | + */ |
875 | + function DisplayGrid() |
876 | + { |
877 | + $db =& $this->db; |
878 | + $user =& $this->user; |
879 | + $response = new ResponseManager(); |
880 | + |
881 | + //display the display table |
882 | + $SQL = <<<SQL |
883 | + SELECT display.displayid, |
884 | + display.display, |
885 | + layout.layout, |
886 | + CASE WHEN display.loggedin = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS loggedin, |
887 | + display.lastaccessed, |
888 | + CASE WHEN display.inc_schedule = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS inc_schedule, |
889 | + CASE WHEN display.licensed = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS licensed, |
890 | + CASE WHEN display.email_alert = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS email_alert, |
891 | + displaygroup.DisplayGroupID, |
892 | + display.ClientAddress, |
893 | + CASE WHEN display.MediaInventoryStatus = 1 THEN '<img src="img/act.gif">' |
894 | + WHEN display.MediaInventoryStatus = 2 THEN '<img src="img/warn.gif">' |
895 | + ELSE '<img src="img/disact.gif">' |
896 | + END AS MediaInventoryStatus, |
897 | + display.MediaInventoryXml, |
898 | + display.MacAddress |
899 | + FROM display |
900 | + INNER JOIN lkdisplaydg ON lkdisplaydg.DisplayID = display.DisplayID |
901 | + INNER JOIN displaygroup ON displaygroup.DisplayGroupID = lkdisplaydg.DisplayGroupID |
902 | + LEFT OUTER JOIN layout ON layout.layoutid = display.defaultlayoutid |
903 | + WHERE displaygroup.IsDisplaySpecific = 1 |
904 | + ORDER BY display.displayid |
905 | SQL; |
906 | |
907 | - if(!($results = $db->query($SQL))) |
908 | - { |
909 | - trigger_error($db->error()); |
910 | - trigger_error(__("Can not list displays"), E_USER_ERROR); |
911 | - } |
912 | - |
913 | - // Messages |
914 | - $msgDisplay = __('Display'); |
915 | - $msgDefault = __('Default Layout'); |
916 | - $msgInterL = __('Interleave Default'); |
917 | - $msgAudit = __('Auditing'); |
918 | - $msgLicense = __('License'); |
919 | - $msgAlert = __('Email Alert'); |
920 | - $msgSave = __('Save'); |
921 | - $msgCancel = __('Cancel'); |
922 | - $msgAction = __('Action'); |
923 | - $msgLastA = __('Last Accessed'); |
924 | - $msgLogIn = __('Logged In'); |
925 | - $msgEdit = __('Edit'); |
926 | - $msgDelete = __('Delete'); |
927 | - $msgPermissions = __('Permissions'); |
928 | - $msgClientAddress = __('IP Address'); |
929 | - $msgDefault = __('Default Layout'); |
930 | - $msgStatus = __('Status'); |
931 | - $msgMediaInventory = __('Media Inventory'); |
932 | - $msgWakeOnLan = __('Wake on LAN'); |
933 | - |
934 | - $output = <<<END |
935 | - <div class="info_table"> |
936 | - <table style="width:100%"> |
937 | + if(!($results = $db->query($SQL))) |
938 | + { |
939 | + trigger_error($db->error()); |
940 | + trigger_error(__("Can not list displays"), E_USER_ERROR); |
941 | + } |
942 | + |
943 | + // Messages |
944 | + $msgDisplay = __('Display'); |
945 | + $msgDefault = __('Default Layout'); |
946 | + $msgInterL = __('Interleave Default'); |
947 | + $msgAudit = __('Auditing'); |
948 | + $msgLicense = __('License'); |
949 | + $msgAlert = __('Email Alert'); |
950 | + $msgSave = __('Save'); |
951 | + $msgCancel = __('Cancel'); |
952 | + $msgAction = __('Action'); |
953 | + $msgLastA = __('Last Accessed'); |
954 | + $msgLogIn = __('Logged In'); |
955 | + $msgEdit = __('Edit'); |
956 | + $msgDelete = __('Delete'); |
957 | + $msgClientAddress = __('IP Address'); |
958 | + $msgDefault = __('Default Layout'); |
959 | + $msgStatus = __('Status'); |
960 | + $msgMediaInventory = __('Media Inventory'); |
961 | + $msgMacAddress = __('Mac Address'); |
962 | + $msgWakeOnLan = __('Wake on LAN'); |
963 | + |
964 | + $output = <<<END |
965 | + <div class="info_table"> |
966 | + <table style="width:100%"> |
967 | <thead> |
968 | <tr> |
969 | <th>$msgDisplay ID</th> |
970 | @@ -379,6 +440,7 @@ |
971 | <th>$msgLogIn</th> |
972 | <th>$msgLastA</th> |
973 | <th>$msgClientAddress</th> |
974 | + <th>$msgMacAddress</th> |
975 | <th>$msgStatus</th> |
976 | <th>$msgAction</th> |
977 | </tr> |
978 | @@ -386,331 +448,337 @@ |
979 | <tbody> |
980 | END; |
981 | |
982 | - while($aRow = $db->get_row($results)) |
983 | - { |
984 | - // Check that we have permission to access this display record |
985 | - $displayGroupID = Kit::ValidateParam($aRow[8], _INT); |
986 | - |
987 | - // Auth |
988 | - $auth = $this->user->DisplayGroupAuth($displayGroupID, true); |
989 | - |
990 | - if (!$auth->view) |
991 | - continue; |
992 | - |
993 | - |
994 | - $displayid = $aRow[0]; |
995 | - $display = $aRow[1]; |
996 | - $defaultlayoutid = $aRow[2]; |
997 | - $loggedin = $aRow[3]; |
998 | - $lastaccessed = date('Y-m-d H:i:s', $aRow[4]); |
999 | - $inc_schedule = $aRow[5]; |
1000 | - $licensed = $aRow[6]; |
1001 | + while($aRow = $db->get_row($results)) |
1002 | + { |
1003 | + // Check that we have permission to access this display record |
1004 | + $displayGroupID = Kit::ValidateParam($aRow[8], _INT); |
1005 | + |
1006 | + // Auth |
1007 | + $auth = $this->user->DisplayGroupAuth($displayGroupID, true); |
1008 | + |
1009 | + if (!$auth->view) |
1010 | + continue; |
1011 | + |
1012 | + $displayid = $aRow[0]; |
1013 | + $display = $aRow[1]; |
1014 | + $defaultlayoutid = $aRow[2]; |
1015 | + $loggedin = $aRow[3]; |
1016 | + $lastaccessed = date('Y-m-d H:i:s', $aRow[4]); |
1017 | + $inc_schedule = $aRow[5]; |
1018 | + $licensed = $aRow[6]; |
1019 | $email_alert = $aRow[7]; |
1020 | |
1021 | - $clientAddress = Kit::ValidateParam($aRow[9], _STRING); |
1022 | - $displayName = $display; |
1023 | - |
1024 | - // Do we want to make a VNC link out of the display name? |
1025 | - $vncTemplate = Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNCLINK'); |
1026 | - $linkTarget = Kit::ValidateParam(Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNC_TGT'), _STRING); |
1027 | - $mediaInventoryStatusLight = Kit::ValidateParam($aRow[10], _STRING); |
1028 | - |
1029 | - if ($vncTemplate != '' && $clientAddress != '') |
1030 | - { |
1031 | - if ($linkTarget == '') |
1032 | - { |
1033 | - $linkTarget = '_top'; |
1034 | - } |
1035 | - |
1036 | - $display = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $display . '" target="' . $linkTarget . '">' . $display . '</a>', $clientAddress); |
1037 | - } |
1038 | - |
1039 | - $buttons = ''; |
1040 | - |
1041 | - // We always get some buttons |
1042 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=schedule&q=ScheduleNowForm&displayGroupId=' . $displayGroupID . '"><span>' . __('Schedule Now') . '</span></button>'; |
1043 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=MediaInventory&DisplayId=' . $displayid . '"><span>' . $msgMediaInventory . '</span></button>'; |
1044 | - |
1045 | - // Decide what buttons we get based on permissions |
1046 | - if ($auth->edit) |
1047 | - { |
1048 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $displayid . '"><span>' . $msgDefault . '</span></button>'; |
1049 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=displayForm&displayid=' . $displayid . '"><span>' . $msgEdit . '</span></button>'; |
1050 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=WakeOnLanForm&DisplayId=' . $displayid . '"><span>' . $msgWakeOnLan . '</span></button>'; |
1051 | - } |
1052 | - |
1053 | - if ($auth->del) |
1054 | - { |
1055 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=DeleteForm&displayid=' . $displayid . '"><span>' . $msgDelete . '</span></button>'; |
1056 | - |
1057 | - } |
1058 | - |
1059 | - if ($auth->modifyPermissions) |
1060 | - { |
1061 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=MemberOfForm&DisplayID=' . $displayid . '"><span>' . __('Display Groups') . '</span></button>'; |
1062 | - $buttons .= '<button class="XiboFormButton" href="index.php?p=displaygroup&q=PermissionsForm&DisplayGroupID=' . $displayGroupID . '"><span>' . $msgPermissions . '</span></button>'; |
1063 | - |
1064 | - } |
1065 | - |
1066 | - $output .= <<<END |
1067 | - |
1068 | - <tr> |
1069 | - <td>$displayid</td> |
1070 | - <td>$licensed</td> |
1071 | - <td>$display</td> |
1072 | - <td>$defaultlayoutid</td> |
1073 | - <td>$inc_schedule</td> |
1074 | - <td>$email_alert</td> |
1075 | - <td>$loggedin</td> |
1076 | - <td>$lastaccessed</td> |
1077 | - <td>$clientAddress</td> |
1078 | - <td>$mediaInventoryStatusLight</td> |
1079 | - <td>$buttons</td> |
1080 | + $clientAddress = Kit::ValidateParam($aRow[9], _STRING); |
1081 | + $displayName = $display; |
1082 | + |
1083 | + // Do we want to make a VNC link out of the display name? |
1084 | + $vncTemplate = Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNCLINK'); |
1085 | + $linkTarget = Kit::ValidateParam(Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNC_TGT'), _STRING); |
1086 | + $mediaInventoryStatusLight = Kit::ValidateParam($aRow[10], _STRING); |
1087 | + $macAddress = Kit::ValidateParam($aRow[12], _STRING); |
1088 | + |
1089 | + if ($vncTemplate != '' && $clientAddress != '') |
1090 | + { |
1091 | + if ($linkTarget == '') |
1092 | + { |
1093 | + $linkTarget = '_top'; |
1094 | + } |
1095 | + |
1096 | + $display = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $display . '" target="' . $linkTarget . '">' . $display . '</a>', $clientAddress); |
1097 | + } |
1098 | + |
1099 | + $buttons = ''; |
1100 | + |
1101 | + // We always get some buttons |
1102 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=schedule&q=ScheduleNowForm&displayGroupId=' . $displayGroupID . '"><span>' . __('Schedule Now') . '</span></button>'; |
1103 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=MediaInventory&DisplayId=' . $displayid . '"><span>' . $msgMediaInventory . '</span></button>'; |
1104 | + |
1105 | + // Decide what buttons we get based on permissions |
1106 | + if ($auth->edit) |
1107 | + { |
1108 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $displayid . '"><span>' . $msgDefault . '</span></button>'; |
1109 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=displayForm&displayid=' . $displayid . '"><span>' . $msgEdit . '</span></button>'; |
1110 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=WakeOnLanForm&DisplayId=' . $displayid . '"><span>' . $msgWakeOnLan . '</span></button>'; |
1111 | + } |
1112 | + |
1113 | + if ($auth->del) |
1114 | + { |
1115 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=DeleteForm&displayid=' . $displayid . '"><span>' . $msgDelete . '</span></button>'; |
1116 | + } |
1117 | + |
1118 | + if ($auth->modifyPermissions) |
1119 | + { |
1120 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=display&q=MemberOfForm&DisplayID=' . $displayid . '"><span>' . __('Display Groups') . '</span></button>'; |
1121 | + $buttons .= '<button class="XiboFormButton" href="index.php?p=displaygroup&q=PermissionsForm&DisplayGroupID=' . $displayGroupID . '"><span>' . __('Permissions') . '</span></button>'; |
1122 | + |
1123 | + } |
1124 | + $output .= <<<END |
1125 | + |
1126 | + <tr> |
1127 | + <td>$displayid</td> |
1128 | + <td>$licensed</td> |
1129 | + <td>$display</td> |
1130 | + <td>$defaultlayoutid</td> |
1131 | + <td>$inc_schedule</td> |
1132 | + <td>$email_alert</td> |
1133 | + <td>$loggedin</td> |
1134 | + <td>$lastaccessed</td> |
1135 | + <td>$clientAddress</td> |
1136 | + <td>$macAddress</td> |
1137 | + <td>$mediaInventoryStatusLight</td> |
1138 | + <td>$buttons</td> |
1139 | END; |
1140 | - } |
1141 | - $output .= "</tbody></table></div>"; |
1142 | - |
1143 | - $response->SetGridResponse($output); |
1144 | - $response->Respond(); |
1145 | - } |
1146 | - |
1147 | - /** |
1148 | - * Include display page template page based on sub page selected |
1149 | - * @return |
1150 | - */ |
1151 | - function displayPage() |
1152 | - { |
1153 | - $db =& $this->db; |
1154 | - |
1155 | - if (!$this->has_permissions) |
1156 | - { |
1157 | - trigger_error(__("You do not have permissions to access this page"), E_USER_ERROR); |
1158 | - return false; |
1159 | - } |
1160 | - |
1161 | - switch ($this->sub_page) |
1162 | - { |
1163 | - |
1164 | - case 'view': |
1165 | - require("template/pages/display_view.php"); |
1166 | - break; |
1167 | - |
1168 | - default: |
1169 | - break; |
1170 | - } |
1171 | - |
1172 | - return false; |
1173 | - } |
1174 | - |
1175 | - /** |
1176 | - * Output some display tabs based on displays that are licensed |
1177 | - * @return |
1178 | - * @param $defaulted_displayid Object |
1179 | - * @param $link Object |
1180 | - * @param $currently_playing Object[optional] |
1181 | - */ |
1182 | - function display_tabs($defaulted_displayid, $link, $currently_playing = true) |
1183 | - { |
1184 | - $db =& $this->db; |
1185 | - $output = ""; |
1186 | - |
1187 | - |
1188 | - //get the number of displays allowed in the license |
1189 | - $SQL = "SELECT display.displayid, "; |
1190 | - $SQL .= " display.display "; |
1191 | - $SQL .= " FROM display "; |
1192 | - $SQL .= " WHERE display.licensed = 1 "; |
1193 | - |
1194 | - if(!$results = $db->query($SQL)) |
1195 | - { |
1196 | - trigger_error($db->error()); |
1197 | - trigger_error(__("Can not list displays"), E_USER_ERROR); |
1198 | - } |
1199 | - |
1200 | - $output .= "<div class='buttons'>"; |
1201 | - |
1202 | - while ($row = $db->get_row($results)) |
1203 | - { |
1204 | - $displayid = $row[0]; |
1205 | - $display = substr($row[1], 0, 8); |
1206 | - |
1207 | - if ($displayid == $defaulted_displayid) |
1208 | - { |
1209 | - $output .= "<a class='defaulted_tab' href='$link&displayid=$displayid'><div class='button_text'>$display</div></a>"; |
1210 | - } |
1211 | - else |
1212 | - { |
1213 | - $output .= "<a class='normal_tab' href='$link&displayid=$displayid'><div class='button_text'>$display</div></a>"; |
1214 | - } |
1215 | - } |
1216 | - |
1217 | - $output .= "</div>"; |
1218 | - |
1219 | - return $output; |
1220 | - } |
1221 | - |
1222 | - /** |
1223 | - * Display what is currently playing on this display |
1224 | - * @return |
1225 | - * @param $displayid Object |
1226 | - */ |
1227 | - function currently_playing($displayid) |
1228 | - { |
1229 | - $db =& $this->db; |
1230 | - $currentdate = date("Y-m-d H:i:s"); |
1231 | - $return = "<div class='display_info'>" . __('Currently Playing'); //return string |
1232 | - /* |
1233 | - * Generates the currently playing list, defaulted to the display ID given |
1234 | - */ |
1235 | - #now i know what display i am find out what i am ment to be playing |
1236 | - $SQL = ""; |
1237 | - $SQL .= "SELECT layoutdisplay.layoutDisplayID, "; |
1238 | - $SQL .= " layout.Name, "; |
1239 | - $SQL .= " layout.layoutID, "; |
1240 | - $SQL .= " layoutdisplay.starttime "; |
1241 | - $SQL .= "FROM display, "; |
1242 | - $SQL .= " layoutdisplay, "; |
1243 | - $SQL .= " layout "; |
1244 | - $SQL .= "WHERE display.displayid = layoutdisplay.displayid "; |
1245 | - $SQL .= " AND layoutdisplay.layoutID = layout.layoutID "; |
1246 | - $SQL .= " AND display.displayid = " . $displayid; |
1247 | - $SQL .= " AND layoutdisplay.starttime < '" . $currentdate . "'"; |
1248 | - $SQL .= " AND layoutdisplay.endtime > '" . $currentdate . "'"; |
1249 | - |
1250 | - if(!$results = $db->query($SQL)) trigger_error($db->error(), E_USER_ERROR); |
1251 | - |
1252 | - if($db->num_rows($results)==0) |
1253 | - { |
1254 | - //check to see if there is a default layout assigned instead |
1255 | - $SQL = ""; |
1256 | - $SQL .= "SELECT 1, layout.Name, "; |
1257 | - $SQL .= " layout.layoutID, 1 "; |
1258 | - $SQL .= "FROM display, "; |
1259 | - $SQL .= " layout "; |
1260 | - $SQL .= "WHERE layout.layoutID = display.defaultlayoutid "; |
1261 | - $SQL .= " AND display.displayid = " . $displayid; |
1262 | - |
1263 | - if(!$results = $db->query($SQL)) trigger_error($db->error(), E_USER_ERROR); |
1264 | - |
1265 | - if($db->num_rows($results)==0) |
1266 | - { |
1267 | - $return .= __('Nothing') . "</div>"; |
1268 | - return $return; |
1269 | - } |
1270 | - } |
1271 | - |
1272 | - $count = 1; |
1273 | - |
1274 | - while ($row = $db->get_row($results)) |
1275 | - { |
1276 | - $name = $row[1]; |
1277 | - |
1278 | - $return .= "$count. $name. "; |
1279 | - $count++; |
1280 | - } |
1281 | - $return .= "</div>"; |
1282 | - |
1283 | - return $return; |
1284 | - } |
1285 | - |
1286 | - /** |
1287 | - * Assess each Display to correctly set the logged in flag based on last accessed time |
1288 | - * @return |
1289 | - */ |
1290 | + } |
1291 | + |
1292 | + $output .= "</tbody></table></div>"; |
1293 | + |
1294 | + $response->SetGridResponse($output); |
1295 | + $response->Respond(); |
1296 | + } |
1297 | + |
1298 | + /** |
1299 | + * Include display page template page based on sub page selected |
1300 | + * @return |
1301 | + */ |
1302 | + function displayPage() |
1303 | + { |
1304 | + $db =& $this->db; |
1305 | + |
1306 | + if (!$this->has_permissions) |
1307 | + { |
1308 | + trigger_error(__("You do not have permissions to access this page"), E_USER_ERROR); |
1309 | + return false; |
1310 | + } |
1311 | + |
1312 | + switch ($this->sub_page) |
1313 | + { |
1314 | + case 'view': |
1315 | + require("template/pages/display_view.php"); |
1316 | + break; |
1317 | + |
1318 | + default: |
1319 | + break; |
1320 | + } |
1321 | + |
1322 | + return false; |
1323 | + } |
1324 | + |
1325 | + /** |
1326 | + * Output some display tabs based on displays that are licensed |
1327 | + * @return |
1328 | + * @param $defaulted_displayid Object |
1329 | + * @param $link Object |
1330 | + * @param $currently_playing Object[optional] |
1331 | + */ |
1332 | + function display_tabs($defaulted_displayid, $link, $currently_playing = true) |
1333 | + { |
1334 | + $db =& $this->db; |
1335 | + $output = ""; |
1336 | + |
1337 | + //get the number of displays allowed in the license |
1338 | + $SQL = "SELECT display.displayid, "; |
1339 | + $SQL .= " display.display "; |
1340 | + $SQL .= " FROM display "; |
1341 | + $SQL .= " WHERE display.licensed = 1 "; |
1342 | + |
1343 | + if(!$results = $db->query($SQL)) |
1344 | + { |
1345 | + trigger_error($db->error()); |
1346 | + trigger_error(__("Can not list displays"), E_USER_ERROR); |
1347 | + } |
1348 | + |
1349 | + $output .= "<div class='buttons'>"; |
1350 | + |
1351 | + while ($row = $db->get_row($results)) |
1352 | + { |
1353 | + $displayid = $row[0]; |
1354 | + $display = substr($row[1], 0, 8); |
1355 | + |
1356 | + if ($displayid == $defaulted_displayid) |
1357 | + { |
1358 | + $output .= "<a class='defaulted_tab' href='$link&displayid=$displayid'><div class='button_text'>$display</div></a>"; |
1359 | + } |
1360 | + else |
1361 | + { |
1362 | + $output .= "<a class='normal_tab' href='$link&displayid=$displayid'><div class='button_text'>$display</div></a>"; |
1363 | + } |
1364 | + } |
1365 | + |
1366 | + $output .= "</div>"; |
1367 | + |
1368 | + return $output; |
1369 | + } |
1370 | + |
1371 | + /** |
1372 | + * Display what is currently playing on this display |
1373 | + * @return |
1374 | + * @param $displayid Object |
1375 | + */ |
1376 | + function currently_playing($displayid) |
1377 | + { |
1378 | + $db =& $this->db; |
1379 | + $currentdate = date("Y-m-d H:i:s"); |
1380 | + $return = "<div class='display_info'>" . __('Currently Playing'); //return string |
1381 | + /* |
1382 | + * Generates the currently playing list, defaulted to the display ID given |
1383 | + */ |
1384 | + #now i know what display i am find out what i am ment to be playing |
1385 | + $SQL = ""; |
1386 | + $SQL .= "SELECT layoutdisplay.layoutDisplayID, "; |
1387 | + $SQL .= " layout.Name, "; |
1388 | + $SQL .= " layout.layoutID, "; |
1389 | + $SQL .= " layoutdisplay.starttime "; |
1390 | + $SQL .= "FROM display, "; |
1391 | + $SQL .= " layoutdisplay, "; |
1392 | + $SQL .= " layout "; |
1393 | + $SQL .= "WHERE display.displayid = layoutdisplay.displayid "; |
1394 | + $SQL .= " AND layoutdisplay.layoutID = layout.layoutID "; |
1395 | + $SQL .= " AND display.displayid = " . $displayid; |
1396 | + $SQL .= " AND layoutdisplay.starttime < '" . $currentdate . "'"; |
1397 | + $SQL .= " AND layoutdisplay.endtime > '" . $currentdate . "'"; |
1398 | + |
1399 | + if(!$results = $db->query($SQL)) trigger_error($db->error(), E_USER_ERROR); |
1400 | + |
1401 | + if($db->num_rows($results)==0) |
1402 | + { |
1403 | + //check to see if there is a default layout assigned instead |
1404 | + $SQL = ""; |
1405 | + $SQL .= "SELECT 1, layout.Name, "; |
1406 | + $SQL .= " layout.layoutID, 1 "; |
1407 | + $SQL .= "FROM display, "; |
1408 | + $SQL .= " layout "; |
1409 | + $SQL .= "WHERE layout.layoutID = display.defaultlayoutid "; |
1410 | + $SQL .= " AND display.displayid = " . $displayid; |
1411 | + |
1412 | + if(!$results = $db->query($SQL)) trigger_error($db->error(), E_USER_ERROR); |
1413 | + |
1414 | + if($db->num_rows($results)==0) |
1415 | + { |
1416 | + $return .= __('Nothing') . "</div>"; |
1417 | + return $return; |
1418 | + } |
1419 | + } |
1420 | + |
1421 | + $count = 1; |
1422 | + |
1423 | + while ($row = $db->get_row($results)) |
1424 | + { |
1425 | + $name = $row[1]; |
1426 | + |
1427 | + $return .= "$count. $name. "; |
1428 | + $count++; |
1429 | + } |
1430 | + $return .= "</div>"; |
1431 | + |
1432 | + return $return; |
1433 | + } |
1434 | + |
1435 | + /** |
1436 | + * Assess each Display to correctly set the logged in flag based on last accessed time |
1437 | + * @return |
1438 | + */ |
1439 | function validateDisplays() |
1440 | - { |
1441 | - $db =& $this->db; |
1442 | - |
1443 | - // timeout after 10 minutes |
1444 | - $timeout = time() - (60*10); |
1445 | - |
1446 | + { |
1447 | + $db =& $this->db; |
1448 | + |
1449 | + // Get the global timeout (overrides the alert timeout on the display if 0 |
1450 | + $globalTimeout = Config::GetSetting($db, 'MAINTENANCE_ALERT_TOUT'); |
1451 | + |
1452 | + // Get a list of all displays and there last accessed / alert timeout value |
1453 | $SQL = ""; |
1454 | - $SQL .= "SELECT displayid, lastaccessed FROM display "; |
1455 | - $SQL .= sprintf("WHERE lastaccessed < %d ", $timeout); |
1456 | + $SQL .= "SELECT displayid, lastaccessed, alert_timeout FROM display "; |
1457 | |
1458 | if (!$result =$db->query($SQL)) |
1459 | { |
1460 | - trigger_error($db->error()); |
1461 | - trigger_error(__('Unable to access displays'), E_USER_ERROR); |
1462 | + trigger_error($db->error()); |
1463 | + trigger_error(__('Unable to access displays'), E_USER_ERROR); |
1464 | } |
1465 | |
1466 | - while($row = $db->get_row($result)) |
1467 | + // Look through each display |
1468 | + while($row = $db->get_assoc_row($result)) |
1469 | { |
1470 | - $displayid = $row[0]; |
1471 | - $lastAccessed = $row[1]; |
1472 | - |
1473 | - Debug::LogEntry($db, 'audit', sprintf('LastAccessed = %d, Timeout = %d for displayId %d', $lastAccessed, $timeout, $displayid)); |
1474 | - |
1475 | - $SQL = "UPDATE display SET loggedin = 0 WHERE displayid = " . $displayid; |
1476 | - |
1477 | - if ((!$db->query($SQL))) |
1478 | - { |
1479 | - trigger_error($db->error()); |
1480 | - } |
1481 | + $displayid = Kit::ValidateParam($row['displayid'], _INT); |
1482 | + $lastAccessed = Kit::ValidateParam($row['lastaccessed'], _INT); |
1483 | + $alertTimeout = Kit::ValidateParam($row['alert_timeout'], _INT); |
1484 | + |
1485 | + // Do we need to update the logged in light? |
1486 | + $timeoutToTestAgainst = ($alertTimeout == 0) ? $globalTimeout : $alertTimeout; |
1487 | + |
1488 | + // If the last time we accessed is less than now minus the timeout |
1489 | + if ($lastAccessed < time() - ($timeoutToTestAgainst * 60)) |
1490 | + { |
1491 | + // Update the display and set it as logged out |
1492 | + $SQL = "UPDATE display SET loggedin = 0 WHERE displayid = " . $displayid; |
1493 | + |
1494 | + if ((!$db->query($SQL))) |
1495 | + trigger_error($db->error()); |
1496 | + |
1497 | + Debug::LogEntry($db, 'audit', sprintf('LastAccessed = %d, Timeout = %d for displayId %d', $lastAccessed, $timeoutToTestAgainst, $displayid)); |
1498 | + } |
1499 | } |
1500 | } |
1501 | |
1502 | - function DeleteForm() |
1503 | - { |
1504 | - $db =& $this->db; |
1505 | - $user =& $this->user; |
1506 | - |
1507 | - $response = new ResponseManager(); |
1508 | - $displayid = Kit::GetParam('displayid', _REQUEST, _INT); |
1509 | - $helpManager = new HelpManager($db, $user); |
1510 | - |
1511 | - // Auth |
1512 | - $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
1513 | - if (!$auth->del) |
1514 | - trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
1515 | - |
1516 | - // Output the delete form |
1517 | - $msgInfo = __('Deleting a display cannot be undone.'); |
1518 | - $msgWarn = __('Are you sure you want to delete this display?'); |
1519 | - $msgYes = __('Yes'); |
1520 | - $msgNo = __('No'); |
1521 | - |
1522 | - $form = <<<END |
1523 | - <form id="DisplayDeleteForm" class="XiboForm" method="post" action="index.php?p=display&q=Delete"> |
1524 | - <input type="hidden" name="displayid" value="$displayid"> |
1525 | - <p>$msgInfo<br /> |
1526 | - <p>$msgWarn</p> |
1527 | - </form> |
1528 | + function DeleteForm() |
1529 | + { |
1530 | + $db =& $this->db; |
1531 | + $user =& $this->user; |
1532 | + |
1533 | + $response = new ResponseManager(); |
1534 | + $displayid = Kit::GetParam('displayid', _REQUEST, _INT); |
1535 | + $helpManager = new HelpManager($db, $user); |
1536 | + |
1537 | + // Auth |
1538 | + $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
1539 | + if (!$auth->del) |
1540 | + trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
1541 | + |
1542 | + // Output the delete form |
1543 | + $msgInfo = __('Deleting a display cannot be undone.'); |
1544 | + $msgWarn = __('Are you sure you want to delete this display?'); |
1545 | + $msgYes = __('Yes'); |
1546 | + $msgNo = __('No'); |
1547 | + |
1548 | + $form = <<<END |
1549 | + <form id="DisplayDeleteForm" class="XiboForm" method="post" action="index.php?p=display&q=Delete"> |
1550 | + <input type="hidden" name="displayid" value="$displayid"> |
1551 | + <p>$msgInfo<br /> |
1552 | + <p>$msgWarn</p> |
1553 | + </form> |
1554 | END; |
1555 | |
1556 | - $response->SetFormRequestResponse($form, __('Delete this Display?'), '350px', '210'); |
1557 | - $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Display', 'Delete') . '")'); |
1558 | - $response->AddButton(__('No'), 'XiboDialogClose()'); |
1559 | - $response->AddButton(__('Yes'), '$("#DisplayDeleteForm").submit()'); |
1560 | - $response->Respond(); |
1561 | - } |
1562 | - |
1563 | - function Delete() |
1564 | - { |
1565 | - $db =& $this->db; |
1566 | - $response = new ResponseManager(); |
1567 | - $displayid = Kit::GetParam('displayid', _POST, _INT, 0); |
1568 | - |
1569 | - $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
1570 | - if (!$auth->del) |
1571 | - trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
1572 | - |
1573 | - if ($displayid == 0) |
1574 | - { |
1575 | - $response->SetError(__("No Display selected for Deletion.")); |
1576 | - $response->Respond(); |
1577 | - } |
1578 | - |
1579 | - $displayObject = new Display($db); |
1580 | - |
1581 | - if (!$displayObject->Delete($displayid)) |
1582 | - { |
1583 | - trigger_error(__("Cannot delete this display. You may unlicense it to hide it from view."), E_USER_ERROR); |
1584 | - } |
1585 | - |
1586 | - $response->SetFormSubmitResponse(__("The Display has been Deleted")); |
1587 | - $response->Respond(); |
1588 | - } |
1589 | + $response->SetFormRequestResponse($form, __('Delete this Display?'), '350px', '210'); |
1590 | + $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Display', 'Delete') . '")'); |
1591 | + $response->AddButton(__('No'), 'XiboDialogClose()'); |
1592 | + $response->AddButton(__('Yes'), '$("#DisplayDeleteForm").submit()'); |
1593 | + $response->Respond(); |
1594 | + } |
1595 | + |
1596 | + function Delete() |
1597 | + { |
1598 | + $db =& $this->db; |
1599 | + $response = new ResponseManager(); |
1600 | + $displayid = Kit::GetParam('displayid', _POST, _INT, 0); |
1601 | + |
1602 | + $auth = $this->user->DisplayGroupAuth($this->GetDisplayGroupId($displayid), true); |
1603 | + if (!$auth->del) |
1604 | + trigger_error(__('You do not have permission to edit this display'), E_USER_ERROR); |
1605 | + |
1606 | + if ($displayid == 0) |
1607 | + { |
1608 | + $response->SetError(__("No Display selected for Deletion.")); |
1609 | + $response->Respond(); |
1610 | + } |
1611 | + |
1612 | + $displayObject = new Display($db); |
1613 | + |
1614 | + if (!$displayObject->Delete($displayid)) |
1615 | + { |
1616 | + trigger_error(__("Cannot delete this display. You may unlicense it to hide it from view."), E_USER_ERROR); |
1617 | + } |
1618 | + |
1619 | + $response->SetFormSubmitResponse(__("The Display has been Deleted")); |
1620 | + $response->Respond(); |
1621 | + } |
1622 | |
1623 | /** |
1624 | * Form for editing the default layout of a display |
1625 | |
1626 | === modified file 'server/modules/module_user_general.php' |
1627 | --- server/modules/module_user_general.php 2012-07-07 10:40:43 +0000 |
1628 | +++ server/modules/module_user_general.php 2012-09-16 15:01:24 +0000 |
1629 | @@ -571,15 +571,15 @@ |
1630 | $userid =& $this->userid; |
1631 | |
1632 | // Check that the module is enabled |
1633 | - $SQL = "SELECT * FROM module WHERE Enabled = 1 ORDER BY Name "; |
1634 | + $SQL = "SELECT * FROM module WHERE Enabled = 1 "; |
1635 | + |
1636 | if ($regionSpecific != -1) |
1637 | - { |
1638 | - $SQL .= sprintf(" AND RegionSpecific = %d ", $regionSpecific); |
1639 | - } |
1640 | + $SQL .= sprintf(" AND RegionSpecific = %d ", $regionSpecific); |
1641 | + |
1642 | if ($module != '') |
1643 | - { |
1644 | - $SQL .= sprintf(" AND Module = '%s' ", $db->escape_string($module)); |
1645 | - } |
1646 | + $SQL .= sprintf(" AND Module = '%s' ", $db->escape_string($module)); |
1647 | + |
1648 | + $SQL .= " ORDER BY Name "; |
1649 | |
1650 | Debug::LogEntry($db, 'audit', $SQL); |
1651 | |
1652 | @@ -1236,7 +1236,7 @@ |
1653 | |
1654 | /** |
1655 | * Authorises a user against a campaign |
1656 | - * @param <type> $layoutId |
1657 | + * @param <type> $campaignId |
1658 | * @return <type> |
1659 | */ |
1660 | public function CampaignAuth($campaignId, $fullObject = false) |
1661 | @@ -1270,7 +1270,7 @@ |
1662 | $SQL .= ' AND (`group`.IsEveryone = 1 OR `group`.GroupID IN (%s)) '; |
1663 | $SQL .= 'GROUP BY campaign.UserID '; |
1664 | |
1665 | - $SQL = sprintf($SQL, $layoutId, implode(',', $this->GetUserGroups($this->userid, true))); |
1666 | + $SQL = sprintf($SQL, $campaignId, implode(',', $this->GetUserGroups($this->userid, true))); |
1667 | //Debug::LogEntry($this->db, 'audit', $SQL); |
1668 | |
1669 | if (!$row = $this->db->GetSingleRow($SQL)) |
1670 | |
1671 | === modified file 'server/services.php' |
1672 | --- server/services.php 2011-02-28 15:37:03 +0000 |
1673 | +++ server/services.php 2012-09-16 15:01:24 +0000 |
1674 | @@ -27,7 +27,7 @@ |
1675 | $serviceResponse = new XiboServiceResponse(); |
1676 | |
1677 | // Is the WSDL being requested. |
1678 | -if (isset($_GET['wsdl'])) |
1679 | +if (isset($_GET['wsdl']) || isset($_GET['WSDL'])) |
1680 | $serviceResponse->WSDL(); |
1681 | |
1682 | // Is the XRDS being requested |