Merge lp:~alexharrington/xibo/733119 into lp:xibo/1.3

Proposed by Alex Harrington
Status: Merged
Merged at revision: 214
Proposed branch: lp:~alexharrington/xibo/733119
Merge into: lp:xibo/1.3
Diff against target: 1974 lines (+1089/-176) (has conflicts)
28 files modified
client/dotNET/CacheManager.cs (+75/-1)
client/dotNET/FileCollector.cs (+60/-27)
client/dotNET/MainForm.cs (+45/-22)
client/dotNET/Properties/Settings.Designer.cs (+13/-1)
client/dotNET/Properties/Settings.settings (+4/-1)
client/dotNET/Region.cs (+11/-1)
client/dotNET/RequiredFiles.cs (+206/-0)
client/dotNET/Schedule.cs (+1/-1)
client/dotNET/ScheduleManager.cs (+16/-1)
client/dotNET/Web References/xmds/Reference.cs (+67/-0)
client/dotNET/Web References/xmds/xmds.wsdl (+23/-0)
client/dotNET/XiboClient.csproj (+1/-0)
client/dotNET/app.config (+4/-1)
client/dotNET/bin/Release/XiboClient.exe.config (+24/-3)
client/dotNET/bin/Release/XiboClient.vshost.exe.config (+24/-3)
client/python/XiboClient.py (+14/-0)
server/install/database/27.sql (+9/-0)
server/install/database/28.sql (+8/-0)
server/lib/app/kit.class.php (+3/-0)
server/lib/data/display.data.class.php (+134/-29)
server/lib/data/schedule.data.class.php (+5/-0)
server/lib/include.php (+3/-3)
server/lib/pages/display.class.php (+244/-81)
server/lib/pages/layout.class.php (+6/-0)
server/lib/pages/region.class.php (+5/-0)
server/lib/service/service.wsdl (+23/-0)
server/lib/service/xmdssoap.class.php (+60/-0)
server/modules/module_db_mysql.php (+1/-1)
Text conflict in client/dotNET/FileCollector.cs
Text conflict in client/dotNET/Region.cs
Text conflict in client/python/XiboClient.py
Text conflict in server/lib/app/kit.class.php
Text conflict in server/lib/data/display.data.class.php
Text conflict in server/lib/pages/display.class.php
To merge this branch: bzr merge lp:~alexharrington/xibo/733119
Reviewer Review Type Date Requested Status
Xibo Maintainters Pending
Review via email: mp+52982@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=== modified file 'client/dotNET/CacheManager.cs'
2--- client/dotNET/CacheManager.cs 2010-04-19 21:45:10 +0000
3+++ client/dotNET/CacheManager.cs 2011-03-11 08:44:59 +0000
4@@ -25,6 +25,7 @@
5 using System.Windows.Forms;
6 using System.Xml.Serialization;
7 using System.Diagnostics;
8+using System.Xml;
9
10 namespace XiboClient
11 {
12@@ -173,7 +174,7 @@
13 /// </summary>
14 /// <param name="path"></param>
15 /// <returns>True is it is and false if it isnt</returns>
16- public bool IsValid(String path)
17+ public bool IsValidPath(String path)
18 {
19 // TODO: what makes a path valid?
20 // Currently a path is valid if it is in the cache
21@@ -185,6 +186,10 @@
22 {
23 if (file.path == path)
24 {
25+ // If we cached it over 2 minutes ago, then check the GetLastWriteTime
26+ if (file.cacheDate > DateTime.Now.AddMinutes(-2))
27+ return true;
28+
29 try
30 {
31 // Check to see if this file has been modified since the MD5 cache
32@@ -209,6 +214,75 @@
33 // Reached the end of the cache and havent found the file.
34 return false;
35 }
36+
37+ /// <summary>
38+ /// Is the provided layout file a valid layout (has all media)
39+ /// </summary>
40+ /// <param name="layoutFile"></param>
41+ /// <returns></returns>
42+ public bool IsValidLayout(string layoutFile)
43+ {
44+ Debug.WriteLine("Checking Layout " + layoutFile + " is valid");
45+
46+ if (!IsValidPath(layoutFile))
47+ return false;
48+
49+ // Load the XLF, get all media ID's
50+ XmlDocument layoutXml = new XmlDocument();
51+ layoutXml.Load(Properties.Settings.Default.LibraryPath + @"\" + layoutFile);
52+
53+ XmlNodeList mediaNodes = layoutXml.SelectNodes("//media");
54+
55+ foreach (XmlNode media in mediaNodes)
56+ {
57+ // Is this a stored media type?
58+ switch (media.Attributes["type"].Value)
59+ {
60+ case "video":
61+ case "image":
62+ case "flash":
63+ case "ppt":
64+
65+ // Get the path and see if its valid
66+ if (!IsValidPath(media.InnerText))
67+ return false;
68+
69+ break;
70+
71+ default:
72+ continue;
73+ }
74+ }
75+
76+ return true;
77+ }
78+
79+ /// <summary>
80+ /// Regenerate from Required Files
81+ /// </summary>
82+ public void Regenerate()
83+ {
84+ if (!File.Exists(Application.UserAppDataPath + "\\" + Properties.Settings.Default.RequiredFilesFile))
85+ return;
86+
87+ // Open the XML file and check each required file that isnt already there
88+ XmlDocument xml = new XmlDocument();
89+ xml.Load(Application.UserAppDataPath + "\\" + Properties.Settings.Default.RequiredFilesFile);
90+
91+ XmlNodeList fileNodes = xml.SelectNodes("//RequiredFile/Path");
92+
93+ foreach (XmlNode file in fileNodes)
94+ {
95+ string path = file.InnerText;
96+
97+ // Does the file exist?
98+ if (!File.Exists(Properties.Settings.Default.LibraryPath + @"\" + path))
99+ continue;
100+
101+ // Add this file to the cache manager
102+ Add(path, GetMD5(path));
103+ }
104+ }
105 }
106
107 public struct Md5Resource
108
109=== modified file 'client/dotNET/FileCollector.cs'
110--- client/dotNET/FileCollector.cs 2011-01-30 18:13:32 +0000
111+++ client/dotNET/FileCollector.cs 2011-03-11 08:44:59 +0000
112@@ -31,28 +31,26 @@
113 class FileCollector
114 {
115 private CacheManager _cacheManager;
116+ private RequiredFiles _requiredFiles;
117+ private XmlDocument _xml;
118
119 public FileCollector(CacheManager cacheManager, string xmlString)
120 {
121 _cacheManager = cacheManager;
122
123- xml = new XmlDocument();
124+ // Load the XML file RF call
125+ _xml = new XmlDocument();
126+ _xml.LoadXml(xmlString);
127
128- try
129- {
130- xml.LoadXml(xmlString);
131- }
132- catch (Exception e)
133- {
134- //Log this error
135- System.Diagnostics.Debug.WriteLine(e.Message);
136- }
137+ // Create a required files object
138+ _requiredFiles = new RequiredFiles();
139+ _requiredFiles.RequiredFilesXml = _xml;
140
141 // Get the key for later use
142 hardwareKey = new HardwareKey();
143
144 // Make a new filelist collection
145- files = new Collection<FileList>();
146+ _files = new Collection<RequiredFile>();
147
148 // Create a webservice call
149 xmdsFile = new XiboClient.xmds.xmds();
150@@ -73,13 +71,13 @@
151 /// </summary>
152 public void CompareAndCollect()
153 {
154- XmlNodeList fileNodes = xml.SelectNodes("/files/file");
155+ XmlNodeList fileNodes = _xml.SelectNodes("/files/file");
156
157 //Inspect each file we have here
158 foreach (XmlNode file in fileNodes)
159 {
160 XmlAttributeCollection attributes = file.Attributes;
161- FileList fileList = new FileList();
162+ RequiredFile fileList = new RequiredFile();
163
164 if (attributes["type"].Value == "layout")
165 {
166@@ -120,13 +118,15 @@
167 fileList.md5 = attributes["md5"].Value;
168 fileList.retrys = 0;
169
170- files.Add(fileList);
171+ _files.Add(fileList);
172 }
173 else
174 {
175 // The MD5 of the current file and the MD5 in RequiredFiles are the same.
176 // Therefore make sure this MD5 is in the CacheManager
177 _cacheManager.Add(path + ".xlf", md5);
178+
179+ _requiredFiles.MarkComplete(int.Parse(path), md5);
180 }
181 }
182 else
183@@ -141,7 +141,7 @@
184 fileList.md5 = attributes["md5"].Value;
185 fileList.retrys = 0;
186
187- files.Add(fileList);
188+ _files.Add(fileList);
189 }
190 }
191 else if (attributes["type"].Value == "media")
192@@ -183,13 +183,16 @@
193 fileList.md5 = attributes["md5"].Value;
194 fileList.retrys = 0;
195
196- files.Add(fileList);
197+ _files.Add(fileList);
198 }
199 else
200 {
201 // The MD5 of the current file and the MD5 in RequiredFiles are the same.
202 // Therefore make sure this MD5 is in the CacheManager
203 _cacheManager.Add(path, md5);
204+
205+ string[] filePart = path.Split('.');
206+ _requiredFiles.MarkComplete(int.Parse(filePart[0]), md5);
207 }
208 }
209 else
210@@ -205,7 +208,7 @@
211 fileList.md5 = attributes["md5"].Value;
212 fileList.retrys = 0;
213
214- files.Add(fileList);
215+ _files.Add(fileList);
216 }
217 }
218 else if (attributes["type"].Value == "blacklist")
219@@ -234,6 +237,7 @@
220 }
221 }
222
223+<<<<<<< TREE
224 Debug.WriteLine(String.Format("There are {0} files to get", files.Count.ToString()));
225
226 // Output a list of the files we need to get
227@@ -243,9 +247,26 @@
228 debugMessage += string.Format("File: {0}, Type: {1}, MD5: {2}. ", fileToGet.path, fileToGet.type, fileToGet.md5);
229
230 Debug.WriteLine(debugMessage);
231+=======
232+ Debug.WriteLine(String.Format("There are {0} files to get", _files.Count.ToString()));
233+
234+ // Output a list of the files we need to get
235+ string debugMessage = "";
236+
237+ foreach (RequiredFile fileToGet in _files)
238+ debugMessage += string.Format("File: {0}, Type: {1}, MD5: {2}. ", fileToGet.path, fileToGet.type, fileToGet.md5);
239+
240+ Debug.WriteLine(debugMessage);
241+
242+ // Report the files files back to XMDS
243+ _requiredFiles.ReportInventory();
244+
245+ // Write Required Files
246+ _requiredFiles.WriteRequiredFiles();
247+>>>>>>> MERGE-SOURCE
248
249 // Is there anything to get?
250- if (files.Count == 0)
251+ if (_files.Count == 0)
252 {
253 CollectionComplete();
254 return;
255@@ -255,7 +276,7 @@
256 _currentFile = 0;
257
258 // Preload the first filelist
259- _currentFileList = files[_currentFile];
260+ _currentFileList = _files[_currentFile];
261
262 // Get the first file
263 GetFile();
264@@ -375,6 +396,10 @@
265 {
266 // Add to the CacheManager
267 _cacheManager.Add(_currentFileList.path + ".xlf", md5sum);
268+
269+ // Report this completion back to XMDS
270+ _requiredFiles.MarkComplete(int.Parse(_currentFileList.path), md5sum);
271+ _requiredFiles.ReportInventory();
272 }
273
274 // Fire a layout complete event
275@@ -445,6 +470,11 @@
276
277 System.Diagnostics.Debug.WriteLine(string.Format("File downloaded: {0}", _currentFileList.path));
278
279+ // Report this completion back to XMDS
280+ string[] filePart = _currentFileList.path.Split('.');
281+ _requiredFiles.MarkComplete(int.Parse(filePart[0]), md5sum);
282+ _requiredFiles.ReportInventory();
283+
284 // All the file has been recieved. Move on to the next file.
285 _currentFile++;
286 }
287@@ -475,13 +505,16 @@
288 /// </summary>
289 public void GetFile()
290 {
291- if (_currentFile > (files.Count - 1))
292+ if (_currentFile > (_files.Count - 1))
293 {
294- System.Diagnostics.Debug.WriteLine(String.Format("Finished Recieving {0} files", files.Count));
295+ System.Diagnostics.Debug.WriteLine(String.Format("Finished Receiving {0} files", _files.Count));
296
297 // Clean up
298- files.Clear();
299- xmdsFile.Dispose();
300+ _files.Clear();
301+ xmdsFile.Dispose();
302+
303+ // Write Required Files
304+ _requiredFiles.WriteRequiredFiles();
305
306 // Finished getting this file list
307 CollectionComplete();
308@@ -491,7 +524,7 @@
309 // Get the current file into the currentfilelist if the current one is finished
310 if (_currentFileList.complete)
311 {
312- _currentFileList = files[_currentFile];
313+ _currentFileList = _files[_currentFile];
314 }
315
316 System.Diagnostics.Debug.WriteLine(String.Format("Getting the file : {0} chunk : {1}", _currentFileList.path, _currentFileList.chunkOffset.ToString()));
317@@ -504,7 +537,7 @@
318 }
319
320 [Serializable]
321- private struct FileList
322+ private struct RequiredFile
323 {
324 public string path;
325 public string type;
326@@ -519,9 +552,9 @@
327
328 private XmlDocument xml;
329 private HardwareKey hardwareKey;
330- private Collection<FileList> files;
331+ private Collection<RequiredFile> _files;
332 private int _currentFile;
333- private FileList _currentFileList;
334+ private RequiredFile _currentFileList;
335 private xmds.xmds xmdsFile;
336
337 public event LayoutFileChangedDelegate LayoutFileChanged;
338
339=== modified file 'client/dotNET/MainForm.cs'
340--- client/dotNET/MainForm.cs 2011-01-30 18:13:32 +0000
341+++ client/dotNET/MainForm.cs 2011-03-11 08:44:59 +0000
342@@ -72,14 +72,45 @@
343
344 _statLog = new StatLog();
345
346+ this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing);
347+ this.Shown += new EventHandler(MainForm_Shown);
348+ }
349+
350+ /// <summary>
351+ /// Called after the form has been shown
352+ /// </summary>
353+ /// <param name="sender"></param>
354+ /// <param name="e"></param>
355+ void MainForm_Shown(object sender, EventArgs e)
356+ {
357+ // Process any stuff that has happened during the loading process
358+ Application.DoEvents();
359+
360 // Create a cachemanager
361 SetCacheManager();
362
363- this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing);
364+ try
365+ {
366+ // Create the Schedule
367+ _schedule = new Schedule(Application.UserAppDataPath + "\\" + Properties.Settings.Default.ScheduleFile, ref _cacheManager);
368+
369+ // Bind to the schedule change event - notifys of changes to the schedule
370+ _schedule.ScheduleChangeEvent += new Schedule.ScheduleChangeDelegate(schedule_ScheduleChangeEvent);
371+
372+ // Initialize the other schedule components
373+ _schedule.InitializeComponents();
374+ }
375+ catch (Exception ex)
376+ {
377+ Debug.WriteLine(ex.Message, LogType.Error.ToString());
378+ MessageBox.Show("Fatal Error initialising the application", "Fatal Error");
379+ Close();
380+ Dispose();
381+ }
382 }
383
384 /// <summary>
385- /// Called when the form has finished loading
386+ /// Called before the form has loaded for the first time
387 /// </summary>
388 /// <param name="sender"></param>
389 /// <param name="e"></param>
390@@ -96,30 +127,13 @@
391 Cursor.Position = new Point(_clientSize.Width, _clientSize.Height);
392 Cursor.Hide();
393
394+ ShowSplashScreen();
395+
396 // Change the default Proxy class
397 OptionForm.SetGlobalProxy();
398
399 // UserApp data
400 Debug.WriteLine(new LogMessage("MainForm_Load", "User AppData Path: " + Application.UserAppDataPath), LogType.Info.ToString());
401-
402- try
403- {
404- // Create the Schedule
405- _schedule = new Schedule(Application.UserAppDataPath + "\\" + Properties.Settings.Default.ScheduleFile, ref _cacheManager);
406-
407- // Bind to the schedule change event - notifys of changes to the schedule
408- _schedule.ScheduleChangeEvent += new Schedule.ScheduleChangeDelegate(schedule_ScheduleChangeEvent);
409-
410- // Initialize the other schedule components
411- _schedule.InitializeComponents();
412- }
413- catch (Exception ex)
414- {
415- Debug.WriteLine(ex.Message, LogType.Error.ToString());
416- MessageBox.Show("Fatal Error initialising the application", "Fatal Error");
417- Close();
418- Dispose();
419- }
420 }
421
422 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
423@@ -152,11 +166,20 @@
424 }
425 catch (Exception ex)
426 {
427- Trace.WriteLine(new LogMessage("Schedule", "Unable to reuse the Cache Manager because: " + ex.Message));
428+ Trace.WriteLine(new LogMessage("MainForm - SetCacheManager", "Unable to reuse the Cache Manager because: " + ex.Message));
429
430 // Create a new cache manager
431 _cacheManager = new CacheManager();
432 }
433+
434+ try
435+ {
436+ _cacheManager.Regenerate();
437+ }
438+ catch (Exception ex)
439+ {
440+ Trace.WriteLine(new LogMessage("MainForm - SetCacheManager", "Regenerate failed because: " + ex.Message));
441+ }
442 }
443
444 /// <summary>
445
446=== modified file 'client/dotNET/Properties/Settings.Designer.cs'
447--- client/dotNET/Properties/Settings.Designer.cs 2010-11-09 21:23:31 +0000
448+++ client/dotNET/Properties/Settings.Designer.cs 2011-03-11 08:44:59 +0000
449@@ -271,7 +271,7 @@
450
451 [global::System.Configuration.ApplicationScopedSettingAttribute()]
452 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
453- [global::System.Configuration.DefaultSettingValueAttribute("1.2.0")]
454+ [global::System.Configuration.DefaultSettingValueAttribute("1.2.2")]
455 public string ClientVersion {
456 get {
457 return ((string)(this["ClientVersion"]));
458@@ -370,5 +370,17 @@
459 this["emptyLayoutDuration"] = value;
460 }
461 }
462+
463+ [global::System.Configuration.UserScopedSettingAttribute()]
464+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
465+ [global::System.Configuration.DefaultSettingValueAttribute("requiredFiles.xml")]
466+ public string RequiredFilesFile {
467+ get {
468+ return ((string)(this["RequiredFilesFile"]));
469+ }
470+ set {
471+ this["RequiredFilesFile"] = value;
472+ }
473+ }
474 }
475 }
476
477=== modified file 'client/dotNET/Properties/Settings.settings'
478--- client/dotNET/Properties/Settings.settings 2010-11-09 21:23:31 +0000
479+++ client/dotNET/Properties/Settings.settings 2011-03-11 08:44:59 +0000
480@@ -69,7 +69,7 @@
481 <Value Profile="(Default)">cacheManager.xml</Value>
482 </Setting>
483 <Setting Name="ClientVersion" Type="System.String" Scope="Application">
484- <Value Profile="(Default)">1.2.0</Value>
485+ <Value Profile="(Default)">1.2.2</Value>
486 </Setting>
487 <Setting Name="scrollStepAmount" Type="System.Decimal" Scope="User">
488 <Value Profile="(Default)">1</Value>
489@@ -95,5 +95,8 @@
490 <Setting Name="emptyLayoutDuration" Type="System.Decimal" Scope="User">
491 <Value Profile="(Default)">10</Value>
492 </Setting>
493+ <Setting Name="RequiredFilesFile" Type="System.String" Scope="User">
494+ <Value Profile="(Default)">requiredFiles.xml</Value>
495+ </Setting>
496 </Settings>
497 </SettingsFile>
498\ No newline at end of file
499
500=== modified file 'client/dotNET/Region.cs'
501--- client/dotNET/Region.cs 2010-11-09 21:23:31 +0000
502+++ client/dotNET/Region.cs 2011-03-11 08:44:59 +0000
503@@ -309,6 +309,7 @@
504 System.Diagnostics.Trace.WriteLine("Duration is Empty, using a default of 60.", "Region - SetNextMediaNode");
505 }
506
507+<<<<<<< TREE
508 // We cannot have a 0 duration here... not sure why we would... but
509 if (options.duration == 0)
510 options.duration = int.Parse(Properties.Settings.Default.emptyLayoutDuration.ToString());
511@@ -317,6 +318,15 @@
512 if (options.duration == 0)
513 options.duration = 10;
514
515+=======
516+ // We cannot have a 0 duration here... not sure why we would... but
517+ if (options.duration == 0 && options.type != "video")
518+ {
519+ int emptyLayoutDuration = int.Parse(Properties.Settings.Default.emptyLayoutDuration.ToString());
520+ options.duration = (emptyLayoutDuration == 0) ? 10 : emptyLayoutDuration;
521+ }
522+
523+>>>>>>> MERGE-SOURCE
524 // There will be some stuff on option nodes
525 XmlNode optionNode = mediaNode.FirstChild;
526
527@@ -386,7 +396,7 @@
528 if (options.type == "video" || options.type == "flash" || options.type == "image" || options.type == "powerpoint")
529 {
530 // Use the cache manager to determine if the file is valid
531- validNode = _cacheManager.IsValid(options.uri);
532+ validNode = _cacheManager.IsValidPath(options.uri);
533 }
534 }
535
536
537=== added file 'client/dotNET/RequiredFiles.cs'
538--- client/dotNET/RequiredFiles.cs 1970-01-01 00:00:00 +0000
539+++ client/dotNET/RequiredFiles.cs 2011-03-11 08:44:59 +0000
540@@ -0,0 +1,206 @@
541+/*
542+ * Xibo - Digitial Signage - http://www.xibo.org.uk
543+ * Copyright (C) 2011 Daniel Garner
544+ *
545+ * This file is part of Xibo.
546+ *
547+ * Xibo is free software: you can redistribute it and/or modify
548+ * it under the terms of the GNU Affero General Public License as published by
549+ * the Free Software Foundation, either version 3 of the License, or
550+ * any later version.
551+ *
552+ * Xibo is distributed in the hope that it will be useful,
553+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
554+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
555+ * GNU Affero General Public License for more details.
556+ *
557+ * You should have received a copy of the GNU Affero General Public License
558+ * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
559+ */
560+using System;
561+using System.Collections.Generic;
562+using System.Collections.ObjectModel;
563+using System.Text;
564+using System.IO;
565+using System.Security.Cryptography;
566+using System.Xml;
567+using System.Diagnostics;
568+using System.Windows.Forms;
569+using System.Xml.Serialization;
570+
571+namespace XiboClient
572+{
573+ public class RequiredFiles
574+ {
575+ private XmlDocument _requiredFilesXml;
576+ public Collection<RequiredFile> _requiredFiles;
577+ private xmds.xmds _report;
578+
579+ public RequiredFiles()
580+ {
581+ _requiredFiles = new Collection<RequiredFile>();
582+
583+ // Create a webservice call
584+ _report = new XiboClient.xmds.xmds();
585+
586+ // Start up the Xmds Service Object
587+ _report.Credentials = null;
588+ _report.Url = Properties.Settings.Default.XiboClient_xmds_xmds;
589+ _report.UseDefaultCredentials = false;
590+ }
591+
592+ /// <summary>
593+ /// Set required files from the XML document
594+ /// </summary>
595+ private void SetRequiredFiles()
596+ {
597+ // Itterate through the RF XML and populate the RF collection
598+ XmlNodeList fileNodes = _requiredFilesXml.SelectNodes("/files/file");
599+
600+ foreach (XmlNode file in fileNodes)
601+ {
602+ RequiredFile rf = new RequiredFile();
603+
604+ XmlAttributeCollection attributes = file.Attributes;
605+
606+ rf.FileType = attributes["type"].Value;
607+ rf.Complete = 0;
608+ rf.Md5 = "";
609+ rf.LastChecked = DateTime.Now;
610+
611+ if (rf.FileType == "media")
612+ {
613+ string[] filePart = attributes["path"].Value.Split('.');
614+ rf.Id = int.Parse(filePart[0]);
615+ rf.Path = attributes["path"].Value;
616+ }
617+ else if (rf.FileType == "layout")
618+ {
619+ rf.Id = int.Parse(attributes["path"].Value);
620+ rf.Path = attributes["path"].Value + ".xlf";
621+ }
622+ else
623+ {
624+ continue;
625+ }
626+
627+ _requiredFiles.Add(rf);
628+ }
629+ }
630+
631+ /// <summary>
632+ /// Required Files XML
633+ /// </summary>
634+ public XmlDocument RequiredFilesXml
635+ {
636+ set
637+ {
638+ _requiredFilesXml = value;
639+ SetRequiredFiles();
640+ }
641+ }
642+
643+ /// <summary>
644+ /// Mark a RequiredFile as complete
645+ /// </summary>
646+ /// <param name="id"></param>
647+ /// <param name="md5"></param>
648+ public void MarkComplete(int id, string md5)
649+ {
650+ foreach (RequiredFile rf in _requiredFiles)
651+ {
652+ if (rf.Id == id)
653+ {
654+ RequiredFile newRf = rf;
655+
656+ newRf.Complete = 1;
657+ newRf.Md5 = md5;
658+
659+
660+ _requiredFiles.Add(newRf);
661+ _requiredFiles.Remove(rf);
662+
663+ return;
664+ }
665+ }
666+ }
667+
668+ /// <summary>
669+ /// Mark a RequiredFile as incomplete
670+ /// </summary>
671+ /// <param name="id"></param>
672+ /// <param name="md5"></param>
673+ public void MarkIncomplete(int id, string md5)
674+ {
675+ foreach (RequiredFile rf in _requiredFiles)
676+ {
677+ if (rf.Id == id)
678+ {
679+ RequiredFile newRf = rf;
680+
681+ newRf.Complete = 0;
682+ newRf.Md5 = md5;
683+
684+ _requiredFiles.Add(newRf);
685+ _requiredFiles.Remove(rf);
686+
687+ return;
688+ }
689+ }
690+ }
691+
692+ /// <summary>
693+ /// Writes Required Files to disk
694+ /// </summary>
695+ public void WriteRequiredFiles()
696+ {
697+ Debug.WriteLine(new LogMessage("RequiredFiles - WriteRequiredFiles", "About to Write RequiredFiles"), LogType.Info.ToString());
698+
699+ try
700+ {
701+ using (StreamWriter streamWriter = new StreamWriter(Application.UserAppDataPath + "\\" + Properties.Settings.Default.RequiredFilesFile))
702+ {
703+ XmlSerializer xmlSerializer = new XmlSerializer(typeof(RequiredFiles));
704+
705+ xmlSerializer.Serialize(streamWriter, this);
706+ }
707+ }
708+ catch (Exception ex)
709+ {
710+ System.Diagnostics.Trace.WriteLine(new LogMessage("RequiredFiles - WriteRequiredFiles", "Unable to write RequiredFiles to disk because: " + ex.Message));
711+ }
712+ }
713+
714+ /// <summary>
715+ /// Report Required Files to XMDS
716+ /// </summary>
717+ public void ReportInventory()
718+ {
719+ HardwareKey hardwareKey = new HardwareKey();
720+
721+ // Build the XML required by media file
722+ string xml = "";
723+
724+ foreach (RequiredFile rf in _requiredFiles)
725+ {
726+ xml += string.Format("<file type=\"{0}\" id=\"{1}\" complete=\"{2}\" lastChecked=\"{3}\" md5=\"{4}\" />",
727+ rf.FileType, rf.Id.ToString(), rf.Complete.ToString(), rf.LastChecked.ToString(), rf.Md5);
728+ }
729+
730+ xml = string.Format("<files>{0}</files>", xml);
731+
732+ _report.MediaInventoryAsync(Properties.Settings.Default.Version, Properties.Settings.Default.ServerKey,
733+ hardwareKey.Key, xml);
734+ }
735+ }
736+
737+ public struct RequiredFile
738+ {
739+ public string FileType;
740+ public int Id;
741+ public int Complete;
742+ public DateTime LastChecked;
743+ public string Md5;
744+ public string Path;
745+ }
746+}
747
748=== modified file 'client/dotNET/Schedule.cs'
749--- client/dotNET/Schedule.cs 2010-08-22 16:49:09 +0000
750+++ client/dotNET/Schedule.cs 2011-03-11 08:44:59 +0000
751@@ -74,7 +74,7 @@
752 _cacheManager = cacheManager;
753
754 // Create a schedule manager
755- _scheduleManager = new ScheduleManager(scheduleLocation);
756+ _scheduleManager = new ScheduleManager(_cacheManager, scheduleLocation);
757
758 // Create a new Xmds service object
759 _xmds2 = new XiboClient.xmds.xmds();
760
761=== modified file 'client/dotNET/ScheduleManager.cs'
762--- client/dotNET/ScheduleManager.cs 2010-08-25 21:39:53 +0000
763+++ client/dotNET/ScheduleManager.cs 2011-03-11 08:44:59 +0000
764@@ -42,13 +42,15 @@
765 private Collection<LayoutSchedule> _layoutSchedule;
766 private Collection<LayoutSchedule> _currentSchedule;
767 private bool _refreshSchedule;
768+ private CacheManager _cacheManager;
769
770 /// <summary>
771 /// Creates a new schedule Manager
772 /// </summary>
773 /// <param name="scheduleLocation"></param>
774- public ScheduleManager(string scheduleLocation)
775+ public ScheduleManager(CacheManager cacheManager, string scheduleLocation)
776 {
777+ _cacheManager = cacheManager;
778 _location = scheduleLocation;
779
780 // Create an empty layout schedule
781@@ -178,6 +180,19 @@
782 // For each layout in the schedule determine if it is currently inside the _currentSchedule, and whether it should be
783 foreach (LayoutSchedule layout in _layoutSchedule)
784 {
785+ // Is the layout valid in the cachemanager?
786+ try
787+ {
788+ if (!_cacheManager.IsValidLayout(layout.id + ".xlf"))
789+ continue;
790+ }
791+ catch
792+ {
793+ // TODO: Ignore this layout.. raise an error?
794+ Trace.WriteLine("Unable to determine if layout is valid or not");
795+ continue;
796+ }
797+
798 // If this is the default, skip it
799 if (layout.NodeName == "default")
800 {
801
802=== modified file 'client/dotNET/Web References/xmds/Reference.cs'
803--- client/dotNET/Web References/xmds/Reference.cs 2010-11-09 21:23:31 +0000
804+++ client/dotNET/Web References/xmds/Reference.cs 2011-03-11 08:44:59 +0000
805@@ -45,6 +45,8 @@
806
807 private System.Threading.SendOrPostCallback SubmitStatsOperationCompleted;
808
809+ private System.Threading.SendOrPostCallback MediaInventoryOperationCompleted;
810+
811 private bool useDefaultCredentialsSetExplicitly;
812
813 /// <remarks/>
814@@ -108,6 +110,9 @@
815 public event SubmitStatsCompletedEventHandler SubmitStatsCompleted;
816
817 /// <remarks/>
818+ public event MediaInventoryCompletedEventHandler MediaInventoryCompleted;
819+
820+ /// <remarks/>
821 [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:xmds#RegisterDisplay", RequestNamespace="urn:xmds", ResponseNamespace="urn:xmds")]
822 [return: System.Xml.Serialization.SoapElementAttribute("ActivationMessage")]
823 public string RegisterDisplay(string serverKey, string hardwareKey, string displayName, string version) {
824@@ -402,6 +407,42 @@
825 }
826
827 /// <remarks/>
828+ [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:xmds#MediaInventory", RequestNamespace="urn:xmds", ResponseNamespace="urn:xmds")]
829+ [return: System.Xml.Serialization.SoapElementAttribute("success")]
830+ public bool MediaInventory(string version, string serverKey, string hardwareKey, [System.Xml.Serialization.SoapElementAttribute("mediaInventory")] string mediaInventory1) {
831+ object[] results = this.Invoke("MediaInventory", new object[] {
832+ version,
833+ serverKey,
834+ hardwareKey,
835+ mediaInventory1});
836+ return ((bool)(results[0]));
837+ }
838+
839+ /// <remarks/>
840+ public void MediaInventoryAsync(string version, string serverKey, string hardwareKey, string mediaInventory1) {
841+ this.MediaInventoryAsync(version, serverKey, hardwareKey, mediaInventory1, null);
842+ }
843+
844+ /// <remarks/>
845+ public void MediaInventoryAsync(string version, string serverKey, string hardwareKey, string mediaInventory1, object userState) {
846+ if ((this.MediaInventoryOperationCompleted == null)) {
847+ this.MediaInventoryOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMediaInventoryOperationCompleted);
848+ }
849+ this.InvokeAsync("MediaInventory", new object[] {
850+ version,
851+ serverKey,
852+ hardwareKey,
853+ mediaInventory1}, this.MediaInventoryOperationCompleted, userState);
854+ }
855+
856+ private void OnMediaInventoryOperationCompleted(object arg) {
857+ if ((this.MediaInventoryCompleted != null)) {
858+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
859+ this.MediaInventoryCompleted(this, new MediaInventoryCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
860+ }
861+ }
862+
863+ /// <remarks/>
864 public new void CancelAsync(object userState) {
865 base.CancelAsync(userState);
866 }
867@@ -627,6 +668,32 @@
868 }
869 }
870 }
871+
872+ /// <remarks/>
873+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
874+ public delegate void MediaInventoryCompletedEventHandler(object sender, MediaInventoryCompletedEventArgs e);
875+
876+ /// <remarks/>
877+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.4927")]
878+ [System.Diagnostics.DebuggerStepThroughAttribute()]
879+ [System.ComponentModel.DesignerCategoryAttribute("code")]
880+ public partial class MediaInventoryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
881+
882+ private object[] results;
883+
884+ internal MediaInventoryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
885+ base(exception, cancelled, userState) {
886+ this.results = results;
887+ }
888+
889+ /// <remarks/>
890+ public bool Result {
891+ get {
892+ this.RaiseExceptionIfNecessary();
893+ return ((bool)(this.results[0]));
894+ }
895+ }
896+ }
897 }
898
899 #pragma warning restore 1591
900\ No newline at end of file
901
902=== modified file 'client/dotNET/Web References/xmds/xmds.wsdl'
903--- client/dotNET/Web References/xmds/xmds.wsdl 2010-11-09 21:23:31 +0000
904+++ client/dotNET/Web References/xmds/xmds.wsdl 2011-03-11 08:44:59 +0000
905@@ -81,6 +81,15 @@
906 <wsdl:message name="SubmitStatsResponse">
907 <wsdl:part name="success" type="xsd:boolean" />
908 </wsdl:message>
909+ <wsdl:message name="MediaInventoryRequest">
910+ <wsdl:part name="version" type="xsd:string" />
911+ <wsdl:part name="serverKey" type="xsd:string" />
912+ <wsdl:part name="hardwareKey" type="xsd:string" />
913+ <wsdl:part name="mediaInventory" type="xsd:string" />
914+ </wsdl:message>
915+ <wsdl:message name="MediaInventoryResponse">
916+ <wsdl:part name="success" type="xsd:boolean" />
917+ </wsdl:message>
918 <wsdl:portType name="xmdsPortType">
919 <wsdl:operation name="RegisterDisplay">
920 <documentation>Registered the Display on the Xibo Network</documentation>
921@@ -122,6 +131,11 @@
922 <wsdl:input message="tns:SubmitStatsRequest" />
923 <wsdl:output message="tns:SubmitStatsResponse" />
924 </wsdl:operation>
925+ <wsdl:operation name="MediaInventory">
926+ <documentation>Report back the clients MediaInventory</documentation>
927+ <wsdl:input message="tns:MediaInventoryRequest" />
928+ <wsdl:output message="tns:MediaInventoryResponse" />
929+ </wsdl:operation>
930 </wsdl:portType>
931 <wsdl:binding name="xmdsBinding" type="tns:xmdsPortType">
932 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
933@@ -197,6 +211,15 @@
934 <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
935 </wsdl:output>
936 </wsdl:operation>
937+ <wsdl:operation name="MediaInventory">
938+ <soap:operation soapAction="urn:xmds#MediaInventory" style="rpc" />
939+ <wsdl:input>
940+ <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
941+ </wsdl:input>
942+ <wsdl:output>
943+ <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
944+ </wsdl:output>
945+ </wsdl:operation>
946 </wsdl:binding>
947 <wsdl:service name="xmds">
948 <wsdl:port name="xmdsPort" binding="tns:xmdsBinding">
949
950=== modified file 'client/dotNET/XiboClient.csproj'
951--- client/dotNET/XiboClient.csproj 2011-02-09 17:15:43 +0000
952+++ client/dotNET/XiboClient.csproj 2011-03-11 08:44:59 +0000
953@@ -161,6 +161,7 @@
954 <Compile Include="Region.cs">
955 <SubType>Component</SubType>
956 </Compile>
957+ <Compile Include="RequiredFiles.cs" />
958 <Compile Include="Rss.cs">
959 <SubType>Form</SubType>
960 </Compile>
961
962=== modified file 'client/dotNET/app.config'
963--- client/dotNET/app.config 2010-11-09 21:23:31 +0000
964+++ client/dotNET/app.config 2011-03-11 08:44:59 +0000
965@@ -79,6 +79,9 @@
966 <setting name="emptyLayoutDuration" serializeAs="String">
967 <value>10</value>
968 </setting>
969+ <setting name="RequiredFilesFile" serializeAs="String">
970+ <value>requiredFiles.xml</value>
971+ </setting>
972 </XiboClient.Properties.Settings>
973 </userSettings>
974 <applicationSettings>
975@@ -102,7 +105,7 @@
976 <value>cacheManager.xml</value>
977 </setting>
978 <setting name="ClientVersion" serializeAs="String">
979- <value>1.2.0</value>
980+ <value>1.2.2</value>
981 </setting>
982 <setting name="xmdsResetTimeout" serializeAs="String">
983 <value>900</value>
984
985=== modified file 'client/dotNET/bin/Release/AxInterop.ShockwaveFlashObjects.dll'
986Binary files client/dotNET/bin/Release/AxInterop.ShockwaveFlashObjects.dll 2010-04-19 21:45:10 +0000 and client/dotNET/bin/Release/AxInterop.ShockwaveFlashObjects.dll 2011-03-11 08:44:59 +0000 differ
987=== modified file 'client/dotNET/bin/Release/AxInterop.WMPLib.dll'
988Binary files client/dotNET/bin/Release/AxInterop.WMPLib.dll 2010-04-19 21:45:10 +0000 and client/dotNET/bin/Release/AxInterop.WMPLib.dll 2011-03-11 08:44:59 +0000 differ
989=== modified file 'client/dotNET/bin/Release/Interop.ShockwaveFlashObjects.dll'
990Binary files client/dotNET/bin/Release/Interop.ShockwaveFlashObjects.dll 2010-04-19 21:45:10 +0000 and client/dotNET/bin/Release/Interop.ShockwaveFlashObjects.dll 2011-03-11 08:44:59 +0000 differ
991=== modified file 'client/dotNET/bin/Release/Interop.WMPLib.dll'
992Binary files client/dotNET/bin/Release/Interop.WMPLib.dll 2010-04-19 21:45:10 +0000 and client/dotNET/bin/Release/Interop.WMPLib.dll 2011-03-11 08:44:59 +0000 differ
993=== modified file 'client/dotNET/bin/Release/XiboClient.exe.config'
994--- client/dotNET/bin/Release/XiboClient.exe.config 2010-04-19 21:45:10 +0000
995+++ client/dotNET/bin/Release/XiboClient.exe.config 2011-03-11 08:44:59 +0000
996@@ -14,7 +14,7 @@
997 <value>DEFAULT</value>
998 </setting>
999 <setting name="XiboClient_xmds_xmds" serializeAs="String">
1000- <value>http://localhost/xibo/xmds.php</value>
1001+ <value>http://localhost/Series%201.2/server-121-soap-wsdl/server/xmds.php</value>
1002 </setting>
1003 <setting name="ServerKey" serializeAs="String">
1004 <value>yourserverkey</value>
1005@@ -61,6 +61,27 @@
1006 <setting name="scrollStepAmount" serializeAs="String">
1007 <value>1</value>
1008 </setting>
1009+ <setting name="sizeX" serializeAs="String">
1010+ <value>0</value>
1011+ </setting>
1012+ <setting name="sizeY" serializeAs="String">
1013+ <value>0</value>
1014+ </setting>
1015+ <setting name="offsetX" serializeAs="String">
1016+ <value>0</value>
1017+ </setting>
1018+ <setting name="offsetY" serializeAs="String">
1019+ <value>0</value>
1020+ </setting>
1021+ <setting name="expireModifiedLayouts" serializeAs="String">
1022+ <value>True</value>
1023+ </setting>
1024+ <setting name="emptyLayoutDuration" serializeAs="String">
1025+ <value>10</value>
1026+ </setting>
1027+ <setting name="RequiredFilesFile" serializeAs="String">
1028+ <value>requiredFiles.xml</value>
1029+ </setting>
1030 </XiboClient.Properties.Settings>
1031 </userSettings>
1032 <applicationSettings>
1033@@ -75,7 +96,7 @@
1034 <value>blacklist.xml</value>
1035 </setting>
1036 <setting name="Version" serializeAs="String">
1037- <value>1</value>
1038+ <value>2</value>
1039 </setting>
1040 <setting name="StatsLogFile" serializeAs="String">
1041 <value>stats.xml</value>
1042@@ -84,7 +105,7 @@
1043 <value>cacheManager.xml</value>
1044 </setting>
1045 <setting name="ClientVersion" serializeAs="String">
1046- <value>1.0.7</value>
1047+ <value>1.2.2</value>
1048 </setting>
1049 <setting name="xmdsResetTimeout" serializeAs="String">
1050 <value>900</value>
1051
1052=== modified file 'client/dotNET/bin/Release/XiboClient.vshost.exe.config'
1053--- client/dotNET/bin/Release/XiboClient.vshost.exe.config 2010-04-19 21:45:10 +0000
1054+++ client/dotNET/bin/Release/XiboClient.vshost.exe.config 2011-03-11 08:44:59 +0000
1055@@ -14,7 +14,7 @@
1056 <value>DEFAULT</value>
1057 </setting>
1058 <setting name="XiboClient_xmds_xmds" serializeAs="String">
1059- <value>http://localhost/xibo/xmds.php</value>
1060+ <value>http://localhost/Series%201.2/server-121-soap-wsdl/server/xmds.php</value>
1061 </setting>
1062 <setting name="ServerKey" serializeAs="String">
1063 <value>yourserverkey</value>
1064@@ -61,6 +61,27 @@
1065 <setting name="scrollStepAmount" serializeAs="String">
1066 <value>1</value>
1067 </setting>
1068+ <setting name="sizeX" serializeAs="String">
1069+ <value>0</value>
1070+ </setting>
1071+ <setting name="sizeY" serializeAs="String">
1072+ <value>0</value>
1073+ </setting>
1074+ <setting name="offsetX" serializeAs="String">
1075+ <value>0</value>
1076+ </setting>
1077+ <setting name="offsetY" serializeAs="String">
1078+ <value>0</value>
1079+ </setting>
1080+ <setting name="expireModifiedLayouts" serializeAs="String">
1081+ <value>True</value>
1082+ </setting>
1083+ <setting name="emptyLayoutDuration" serializeAs="String">
1084+ <value>10</value>
1085+ </setting>
1086+ <setting name="RequiredFilesFile" serializeAs="String">
1087+ <value>requiredFiles.xml</value>
1088+ </setting>
1089 </XiboClient.Properties.Settings>
1090 </userSettings>
1091 <applicationSettings>
1092@@ -75,7 +96,7 @@
1093 <value>blacklist.xml</value>
1094 </setting>
1095 <setting name="Version" serializeAs="String">
1096- <value>1</value>
1097+ <value>2</value>
1098 </setting>
1099 <setting name="StatsLogFile" serializeAs="String">
1100 <value>stats.xml</value>
1101@@ -84,7 +105,7 @@
1102 <value>cacheManager.xml</value>
1103 </setting>
1104 <setting name="ClientVersion" serializeAs="String">
1105- <value>1.0.7</value>
1106+ <value>1.2.2</value>
1107 </setting>
1108 <setting name="xmdsResetTimeout" serializeAs="String">
1109 <value>900</value>
1110
1111=== modified file 'client/python/XiboClient.py'
1112--- client/python/XiboClient.py 2011-02-10 22:25:35 +0000
1113+++ client/python/XiboClient.py 2011-03-11 08:44:59 +0000
1114@@ -48,7 +48,11 @@
1115 import PIL.Image
1116 import math
1117
1118+<<<<<<< TREE
1119 version = "1.3.0a1"
1120+=======
1121+version = "1.2.2a1"
1122+>>>>>>> MERGE-SOURCE
1123
1124 # What layout schema version is supported
1125 schemaVersion = 1
1126@@ -908,8 +912,18 @@
1127 tmpSize = long(f.attributes['size'].value)
1128 tmpHash = str(f.attributes['md5'].value)
1129 tmpType = str(f.attributes['type'].value)
1130+<<<<<<< TREE
1131 tmpId = int(f.attributes['id'].value)
1132
1133+=======
1134+ try:
1135+ tmpId = int(f.attributes['id'].value)
1136+ except:
1137+ # Layout background images don't come down with IDs
1138+ # Blame Dan :D
1139+ tmpId = 0
1140+
1141+>>>>>>> MERGE-SOURCE
1142 if os.path.isfile(tmpPath) and os.path.getsize(tmpPath) == tmpSize:
1143 # File exists and is the right size
1144 # See if we checksummed it recently
1145
1146=== added file 'server/install/database/27.sql'
1147--- server/install/database/27.sql 1970-01-01 00:00:00 +0000
1148+++ server/install/database/27.sql 2011-03-11 08:44:59 +0000
1149@@ -0,0 +1,9 @@
1150+
1151+ALTER TABLE `display` ADD `MediaInventoryStatus` TINYINT NOT NULL DEFAULT '0' ,
1152+ADD `MediaInventoryXml` LONGTEXT NULL;
1153+
1154+/* VERSION UPDATE */
1155+/* Set the version table, etc */
1156+UPDATE `version` SET `app_ver` = '1.2.2', `XmdsVersion` = 2;
1157+UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
1158+UPDATE `version` SET `DBVersion` = '27';
1159
1160=== added file 'server/install/database/28.sql'
1161--- server/install/database/28.sql 1970-01-01 00:00:00 +0000
1162+++ server/install/database/28.sql 2011-03-11 08:44:59 +0000
1163@@ -0,0 +1,8 @@
1164+
1165+ALTER TABLE `display` ALTER `MediaInventoryStatus` SET DEFAULT '0';
1166+
1167+/* VERSION UPDATE */
1168+/* Set the version table, etc */
1169+UPDATE `version` SET `app_ver` = '1.2.3', `XmdsVersion` = 2;
1170+UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
1171+UPDATE `version` SET `DBVersion` = '28';
1172
1173=== modified file 'server/lib/app/kit.class.php'
1174--- server/lib/app/kit.class.php 2011-02-28 15:37:03 +0000
1175+++ server/lib/app/kit.class.php 2011-03-11 08:44:59 +0000
1176@@ -405,8 +405,11 @@
1177 {
1178 include_once('lib/service/' . $class . '.class.php');
1179 }
1180+<<<<<<< TREE
1181
1182 return;
1183+=======
1184+>>>>>>> MERGE-SOURCE
1185 }
1186
1187 /**
1188
1189=== modified file 'server/lib/data/display.data.class.php'
1190--- server/lib/data/display.data.class.php 2011-02-10 20:42:24 +0000
1191+++ server/lib/data/display.data.class.php 2011-03-11 08:44:59 +0000
1192@@ -251,7 +251,7 @@
1193 * @return
1194 * @param $license Object
1195 */
1196- public function Touch($license, $clientAddress = '')
1197+ public function Touch($license, $clientAddress = '', $mediaInventoryComplete = 0, $mediaInventoryXml = '')
1198 {
1199 $db =& $this->db;
1200 $time = time();
1201@@ -266,6 +266,13 @@
1202 if ($clientAddress != '')
1203 $SQL .= sprintf(" , ClientAddress = '%s' ", $db->escape_string($clientAddress));
1204
1205+ // Media Inventory Settings (if appropriate)
1206+ if ($mediaInventoryComplete != 0)
1207+ $SQL .= sprintf(" , MediaInventoryStatus = %d ", $mediaInventoryComplete);
1208+
1209+ if ($mediaInventoryXml != '')
1210+ $SQL .= sprintf(" , MediaInventoryXml = '%s' ", $mediaInventoryXml);
1211+
1212 // Restrict to the display license
1213 $SQL .= " WHERE license = '%s'";
1214 $SQL = sprintf($SQL, $time, $license);
1215@@ -282,33 +289,131 @@
1216
1217 return true;
1218 }
1219-
1220- /**
1221- * Edits the default layout for a display
1222- * @param <type> $displayId
1223- * @param <type> $defaultLayoutId
1224- * @return <type>
1225- */
1226- public function EditDefaultLayout($displayId, $defaultLayoutId)
1227- {
1228- $db =& $this->db;
1229-
1230- Debug::LogEntry($db, 'audit', 'IN', 'Display', 'EditDefaultLayout');
1231-
1232- $SQL = sprintf('UPDATE display SET defaultLayoutId = %d WHERE displayID = %d ', $defaultLayoutId, $displayId);
1233-
1234- if (!$db->query($SQL))
1235- {
1236- trigger_error($db->error());
1237- $this->SetError(25012, __('Error updating this displays default layout.'));
1238-
1239- return false;
1240- }
1241-
1242-
1243- Debug::LogEntry($db, 'audit', 'OUT', 'Display', 'EditDefaultLayout');
1244-
1245- return true;
1246- }
1247+<<<<<<< TREE
1248+
1249+ /**
1250+ * Edits the default layout for a display
1251+ * @param <type> $displayId
1252+ * @param <type> $defaultLayoutId
1253+ * @return <type>
1254+ */
1255+ public function EditDefaultLayout($displayId, $defaultLayoutId)
1256+ {
1257+ $db =& $this->db;
1258+
1259+ Debug::LogEntry($db, 'audit', 'IN', 'Display', 'EditDefaultLayout');
1260+
1261+ $SQL = sprintf('UPDATE display SET defaultLayoutId = %d WHERE displayID = %d ', $defaultLayoutId, $displayId);
1262+
1263+ if (!$db->query($SQL))
1264+ {
1265+ trigger_error($db->error());
1266+ $this->SetError(25012, __('Error updating this displays default layout.'));
1267+
1268+ return false;
1269+ }
1270+
1271+
1272+ Debug::LogEntry($db, 'audit', 'OUT', 'Display', 'EditDefaultLayout');
1273+
1274+ return true;
1275+ }
1276+=======
1277+
1278+ /**
1279+ * Flags a display as being incomplete
1280+ * @param <type> $displayId
1281+ */
1282+ private function FlagIncomplete($displayId)
1283+ {
1284+ $db =& $this->db;
1285+
1286+ Debug::LogEntry($db, 'audit', sprintf('Flag DisplayID %d incomplete.', $displayId), 'display', 'NotifyDisplays');
1287+
1288+ $SQL = sprintf("UPDATE display SET MediaInventoryStatus = 3 WHERE displayID = %d", $displayId);
1289+
1290+ if (!$db->query($SQL))
1291+ {
1292+ trigger_error($db->error());
1293+ return $this->SetError(25004, 'Unable to Flag Display as incomplete');
1294+ }
1295+
1296+ return true;
1297+ }
1298+
1299+ /**
1300+ * Notify displays of this layout change
1301+ * @param <type> $layoutId
1302+ */
1303+ public function NotifyDisplays($layoutId)
1304+ {
1305+ $db =& $this->db;
1306+ $currentdate = time();
1307+ $rfLookahead = Kit::ValidateParam(Config::GetSetting($db,'REQUIRED_FILES_LOOKAHEAD'), _INT);
1308+
1309+ $rfLookahead = $currentdate + $rfLookahead;
1310+
1311+ Debug::LogEntry($db, 'audit', sprintf('Checking for Displays to refresh on Layout %d', $layoutId), 'display', 'NotifyDisplays');
1312+
1313+ // Which displays does a change to this layout effect?
1314+ $SQL = " SELECT DISTINCT display.DisplayID ";
1315+ $SQL .= " FROM schedule_detail ";
1316+ $SQL .= " INNER JOIN lkdisplaydg ";
1317+ $SQL .= " ON lkdisplaydg.DisplayGroupID = schedule_detail.DisplayGroupID ";
1318+ $SQL .= " INNER JOIN display ";
1319+ $SQL .= " ON lkdisplaydg.DisplayID = display.displayID ";
1320+ $SQL .= " WHERE schedule_detail.layoutID = %d ";
1321+ $SQL .= " AND schedule_detail.FromDT < %d AND schedule_detail.ToDT > %d ";
1322+ $SQL .= " UNION ";
1323+ $SQL .= " SELECT DisplayID FROM display WHERE DefaultLayoutID = %d";
1324+
1325+ $SQL = sprintf($SQL, $layoutId, $rfLookahead, $currentdate - 3600, $layoutId);
1326+
1327+ Debug::LogEntry($db, 'audit', $SQL, 'display', 'NotifyDisplays');
1328+
1329+ if (!$result = $db->query($SQL))
1330+ {
1331+ trigger_error($db->error());
1332+ return $this->SetError(25037, __('Unable to get layouts for Notify'));
1333+ }
1334+
1335+ while ($row = $db->get_assoc_row($result))
1336+ {
1337+ // Notify each display in turn
1338+ $displayId = Kit::ValidateParam($row['DisplayID'], _INT);
1339+ $this->FlagIncomplete($displayId);
1340+ }
1341+ }
1342+
1343+ /**
1344+ * Edits the default layout for a display
1345+ * @param <type> $displayId
1346+ * @param <type> $defaultLayoutId
1347+ * @return <type>
1348+ */
1349+ public function EditDefaultLayout($displayId, $defaultLayoutId)
1350+ {
1351+ $db =& $this->db;
1352+
1353+ Debug::LogEntry($db, 'audit', 'IN', 'Display', 'EditDefaultLayout');
1354+
1355+ $SQL = sprintf('UPDATE display SET defaultLayoutId = %d WHERE displayID = %d ', $defaultLayoutId, $displayId);
1356+
1357+ if (!$db->query($SQL))
1358+ {
1359+ trigger_error($db->error());
1360+ $this->SetError(25012, __('Error updating this displays default layout.'));
1361+
1362+ return false;
1363+ }
1364+
1365+ // Flag this display as not having all the content
1366+ $this->FlagIncomplete($displayId);
1367+
1368+ Debug::LogEntry($db, 'audit', 'OUT', 'Display', 'EditDefaultLayout');
1369+
1370+ return true;
1371+ }
1372+>>>>>>> MERGE-SOURCE
1373 }
1374 ?>
1375
1376=== modified file 'server/lib/data/schedule.data.class.php'
1377--- server/lib/data/schedule.data.class.php 2011-02-10 19:46:44 +0000
1378+++ server/lib/data/schedule.data.class.php 2011-03-11 08:44:59 +0000
1379@@ -164,6 +164,11 @@
1380 }
1381 }
1382 }
1383+
1384+ // Notify (dont error)
1385+ Kit::ClassLoader('Display');
1386+ $displayObject = new Display($db);
1387+ $displayObject->NotifyDisplays($layoutID);
1388
1389 Debug::LogEntry($db, 'audit', 'OUT', 'Schedule', 'Add');
1390
1391
1392=== modified file 'server/lib/include.php'
1393--- server/lib/include.php 2011-02-28 15:37:03 +0000
1394+++ server/lib/include.php 2011-03-11 08:44:59 +0000
1395@@ -107,8 +107,8 @@
1396 Config::Version($db);
1397
1398 // Does the version in the DB match the version of the code?
1399-if (DBVERSION != '26')
1400- die(sprintf('Incompatible database version detected. Please ensure your database and website versions match. You have %d and the website for %d', DBVERSION, 25));
1401+if (DBVERSION != '27')
1402+ die(sprintf('Incompatible database version detected. Please ensure your database and website versions match. You have %d and the website for %d', DBVERSION, 27));
1403
1404 // What is the production mode of the server?
1405 if(Config::GetSetting($db, "SERVER_MODE")=="Test") ini_set('display_errors', 1);
1406@@ -143,4 +143,4 @@
1407 $pageManager->Render();
1408
1409 die();
1410-?>
1411\ No newline at end of file
1412+?>
1413
1414=== modified file 'server/lib/pages/display.class.php'
1415--- server/lib/pages/display.class.php 2011-02-13 17:16:01 +0000
1416+++ server/lib/pages/display.class.php 2011-03-11 08:44:59 +0000
1417@@ -37,6 +37,8 @@
1418 private $email_alert;
1419 private $alert_timeout;
1420 private $ajax;
1421+ private $mediaInventoryStatus;
1422+ private $mediaInventoryXml;
1423
1424 function __construct(database $db, user $user)
1425 {
1426@@ -71,7 +73,9 @@
1427 display.isAuditing,
1428 display.email_alert,
1429 display.alert_timeout,
1430- display.ClientAddress
1431+ display.ClientAddress,
1432+ display.MediaInventoryStatus,
1433+ display.MediaInventoryXml
1434 FROM display
1435 WHERE display.displayid = %d
1436 SQL;
1437@@ -95,8 +99,10 @@
1438 $this->licensed = Kit::ValidateParam($row[4], _INT);
1439 $this->inc_schedule = Kit::ValidateParam($row[5], _INT);
1440 $this->auditing = Kit::ValidateParam($row[6], _INT);
1441- $this->email_alert = Kit::ValidateParam($row[7], _INT);
1442- $this->alert_timeout = Kit::ValidateParam($row[8], _INT);
1443+ $this->email_alert = Kit::ValidateParam($row[7], _INT);
1444+ $this->alert_timeout = Kit::ValidateParam($row[8], _INT);
1445+ $this->mediaInventoryStatus = Kit::ValidateParam($row[9], _INT);
1446+ $this->mediaInventoryXml = Kit::ValidateParam($row[10], _HTMLSTRING);
1447 }
1448 }
1449
1450@@ -309,7 +315,12 @@
1451 CASE WHEN display.licensed = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS licensed,
1452 CASE WHEN display.email_alert = 1 THEN '<img src="img/act.gif">' ELSE '<img src="img/disact.gif">' END AS email_alert,
1453 displaygroup.DisplayGroupID,
1454- display.ClientAddress
1455+ display.ClientAddress,
1456+ CASE WHEN display.MediaInventoryStatus = 1 THEN '<img src="img/act.gif">'
1457+ WHEN display.MediaInventoryStatus = 2 THEN '<img src="img/warn.gif">'
1458+ ELSE '<img src="img/disact.gif">'
1459+ END AS MediaInventoryStatus,
1460+ display.MediaInventoryXml
1461 FROM display
1462 INNER JOIN lkdisplaydg ON lkdisplaydg.DisplayID = display.DisplayID
1463 INNER JOIN displaygroup ON displaygroup.DisplayGroupID = lkdisplaydg.DisplayGroupID
1464@@ -340,7 +351,13 @@
1465 $msgDelete = __('Delete');
1466 $msgGroupSecurity = __('Group Security');
1467 $msgClientAddress = __('IP Address');
1468- $msgDefault = __('Default Layout');
1469+<<<<<<< TREE
1470+ $msgDefault = __('Default Layout');
1471+=======
1472+ $msgDefault = __('Default Layout');
1473+ $msgStatus = __('Status');
1474+ $msgMediaInventory = __('Media Inventory');
1475+>>>>>>> MERGE-SOURCE
1476
1477 $output = <<<END
1478 <div class="info_table">
1479@@ -356,6 +373,7 @@
1480 <th>$msgLogIn</th>
1481 <th>$msgLastA</th>
1482 <th>$msgClientAddress</th>
1483+ <th>$msgStatus</th>
1484 <th>$msgAction</th>
1485 </tr>
1486 </thead>
1487@@ -385,6 +403,7 @@
1488 // Do we want to make a VNC link out of the display name?
1489 $vncTemplate = Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNCLINK');
1490 $linkTarget = Kit::ValidateParam(Config::GetSetting($db, 'SHOW_DISPLAY_AS_VNC_TGT'), _STRING);
1491+ $mediaInventoryStatusLight = Kit::ValidateParam($aRow[10], _STRING);
1492
1493 if ($vncTemplate != '' && $clientAddress != '')
1494 {
1495@@ -396,22 +415,42 @@
1496 $display = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $display . '" target="' . $linkTarget . '">' . $display . '</a>', $clientAddress);
1497 }
1498
1499- $buttons = '';
1500-
1501- if ($user->usertypeid == 1)
1502- {
1503- $buttons = <<<END
1504- <button class='XiboFormButton' href='index.php?p=display&q=displayForm&displayid=$displayid'><span>$msgEdit</span></button>
1505- <button class='XiboFormButton' href='index.php?p=display&q=DeleteForm&displayid=$displayid'><span>$msgDelete</span></button>
1506- <button class="XiboFormButton" href="index.php?p=displaygroup&q=GroupSecurityForm&DisplayGroupID=$displayGroupID&DisplayGroup=$displayName"><span>$msgGroupSecurity</span></button>
1507- <button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=$displayid"><span>$msgDefault</span></button>
1508-END;
1509- }
1510- else
1511- {
1512- $buttons = '<button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $displayid . '"><span>' . $msgDefault . '</span></button>';
1513- }
1514-
1515+<<<<<<< TREE
1516+ $buttons = '';
1517+
1518+ if ($user->usertypeid == 1)
1519+ {
1520+ $buttons = <<<END
1521+ <button class='XiboFormButton' href='index.php?p=display&q=displayForm&displayid=$displayid'><span>$msgEdit</span></button>
1522+ <button class='XiboFormButton' href='index.php?p=display&q=DeleteForm&displayid=$displayid'><span>$msgDelete</span></button>
1523+ <button class="XiboFormButton" href="index.php?p=displaygroup&q=GroupSecurityForm&DisplayGroupID=$displayGroupID&DisplayGroup=$displayName"><span>$msgGroupSecurity</span></button>
1524+ <button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=$displayid"><span>$msgDefault</span></button>
1525+END;
1526+ }
1527+ else
1528+ {
1529+ $buttons = '<button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $displayid . '"><span>' . $msgDefault . '</span></button>';
1530+ }
1531+
1532+=======
1533+ $buttons = '';
1534+
1535+ if ($user->usertypeid == 1)
1536+ {
1537+ $buttons = <<<END
1538+ <button class='XiboFormButton' href='index.php?p=display&q=displayForm&displayid=$displayid'><span>$msgEdit</span></button>
1539+ <button class='XiboFormButton' href='index.php?p=display&q=DeleteForm&displayid=$displayid'><span>$msgDelete</span></button>
1540+ <button class="XiboFormButton" href="index.php?p=displaygroup&q=GroupSecurityForm&DisplayGroupID=$displayGroupID&DisplayGroup=$displayName"><span>$msgGroupSecurity</span></button>
1541+ <button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=$displayid"><span>$msgDefault</span></button>
1542+ <button class="XiboFormButton" href="index.php?p=display&q=MediaInventory&DisplayId=$displayid"><span>$msgMediaInventory</span></button>
1543+END;
1544+ }
1545+ else
1546+ {
1547+ $buttons = '<button class="XiboFormButton" href="index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $displayid . '"><span>' . $msgDefault . '</span></button>';
1548+ }
1549+
1550+>>>>>>> MERGE-SOURCE
1551 $output .= <<<END
1552
1553 <tr>
1554@@ -424,7 +463,12 @@
1555 <td>$loggedin</td>
1556 <td>$lastaccessed</td>
1557 <td>$clientAddress</td>
1558- <td>$buttons</td>
1559+<<<<<<< TREE
1560+ <td>$buttons</td>
1561+=======
1562+ <td>$mediaInventoryStatusLight</td>
1563+ <td>$buttons</td>
1564+>>>>>>> MERGE-SOURCE
1565 END;
1566 }
1567 $output .= "</tbody></table></div>";
1568@@ -661,64 +705,183 @@
1569 $response->SetFormSubmitResponse(__("The Display has been Deleted"));
1570 $response->Respond();
1571 }
1572-
1573- /**
1574- * Form for editing the default layout of a display
1575- */
1576- public function DefaultLayoutForm()
1577- {
1578- $db =& $this->db;
1579- $response = new ResponseManager();
1580-
1581- $displayId = Kit::GetParam('DisplayId', _GET, _INT);
1582-
1583- if (!$defaultLayoutId = $this->db->GetSingleValue(sprintf("SELECT defaultlayoutid FROM display WHERE displayid = %d", $displayId),
1584- 'defaultlayoutid', _INT))
1585- {
1586- trigger_error($db->error());
1587- trigger_error(__('Unable to get the default layout'), E_USER_ERROR);
1588- }
1589-
1590- $msgDefault = __('Default Layout');
1591- $layoutList = dropdownlist('SELECT layoutid, layout FROM layout WHERE retired = 0 ORDER by layout', 'defaultlayoutid', $defaultLayoutId);
1592-
1593- $form = <<<END
1594- <form id="DefaultLayoutForm" class="XiboForm" method="post" action="index.php?p=display&q=DefaultLayout&DisplayId=$displayId">
1595- <input type="hidden" name="DisplayId" value="$displayId">
1596- <table>
1597- <tr>
1598- <td>$msgDefault<span class="required">*</span></td>
1599- <td>$layoutList</td>
1600- </tr>
1601- </table>
1602- </form>
1603-END;
1604-
1605- $response->SetFormRequestResponse($form, __('Edit Default Layout'), '300px', '150px');
1606- $response->AddButton(__('Cancel'), 'XiboDialogClose()');
1607- $response->AddButton(__('Save'), '$("#DefaultLayoutForm").submit()');
1608- $response->Respond();
1609- }
1610-
1611- /**
1612- * Edit the default layout for a display
1613- */
1614- public function DefaultLayout()
1615- {
1616- $db =& $this->db;
1617- $response = new ResponseManager();
1618- $displayObject = new Display($db);
1619-
1620- $displayId = Kit::GetParam('DisplayId', _POST, _INT);
1621- $defaultLayoutId = Kit::GetParam('defaultlayoutid', _POST, _INT);
1622-
1623- if (!$displayObject->EditDefaultLayout($displayId, $defaultLayoutId))
1624- {
1625- trigger_error(__('Cannot Edit this Display'), E_USER_ERROR);
1626- }
1627-
1628- $response->SetFormSubmitResponse(__('Display Saved.'));
1629- $response->Respond();
1630- }
1631+<<<<<<< TREE
1632+
1633+ /**
1634+ * Form for editing the default layout of a display
1635+ */
1636+ public function DefaultLayoutForm()
1637+ {
1638+ $db =& $this->db;
1639+ $response = new ResponseManager();
1640+
1641+ $displayId = Kit::GetParam('DisplayId', _GET, _INT);
1642+
1643+ if (!$defaultLayoutId = $this->db->GetSingleValue(sprintf("SELECT defaultlayoutid FROM display WHERE displayid = %d", $displayId),
1644+ 'defaultlayoutid', _INT))
1645+ {
1646+ trigger_error($db->error());
1647+ trigger_error(__('Unable to get the default layout'), E_USER_ERROR);
1648+ }
1649+
1650+ $msgDefault = __('Default Layout');
1651+ $layoutList = dropdownlist('SELECT layoutid, layout FROM layout WHERE retired = 0 ORDER by layout', 'defaultlayoutid', $defaultLayoutId);
1652+
1653+ $form = <<<END
1654+ <form id="DefaultLayoutForm" class="XiboForm" method="post" action="index.php?p=display&q=DefaultLayout&DisplayId=$displayId">
1655+ <input type="hidden" name="DisplayId" value="$displayId">
1656+ <table>
1657+ <tr>
1658+ <td>$msgDefault<span class="required">*</span></td>
1659+ <td>$layoutList</td>
1660+ </tr>
1661+ </table>
1662+ </form>
1663+END;
1664+
1665+ $response->SetFormRequestResponse($form, __('Edit Default Layout'), '300px', '150px');
1666+ $response->AddButton(__('Cancel'), 'XiboDialogClose()');
1667+ $response->AddButton(__('Save'), '$("#DefaultLayoutForm").submit()');
1668+ $response->Respond();
1669+ }
1670+
1671+ /**
1672+ * Edit the default layout for a display
1673+ */
1674+ public function DefaultLayout()
1675+ {
1676+ $db =& $this->db;
1677+ $response = new ResponseManager();
1678+ $displayObject = new Display($db);
1679+
1680+ $displayId = Kit::GetParam('DisplayId', _POST, _INT);
1681+ $defaultLayoutId = Kit::GetParam('defaultlayoutid', _POST, _INT);
1682+
1683+ if (!$displayObject->EditDefaultLayout($displayId, $defaultLayoutId))
1684+ {
1685+ trigger_error(__('Cannot Edit this Display'), E_USER_ERROR);
1686+ }
1687+
1688+ $response->SetFormSubmitResponse(__('Display Saved.'));
1689+ $response->Respond();
1690+ }
1691+=======
1692+
1693+ /**
1694+ * Form for editing the default layout of a display
1695+ */
1696+ public function DefaultLayoutForm()
1697+ {
1698+ $db =& $this->db;
1699+ $response = new ResponseManager();
1700+
1701+ $displayId = Kit::GetParam('DisplayId', _GET, _INT);
1702+
1703+ if (!$defaultLayoutId = $this->db->GetSingleValue(sprintf("SELECT defaultlayoutid FROM display WHERE displayid = %d", $displayId),
1704+ 'defaultlayoutid', _INT))
1705+ {
1706+ trigger_error($db->error());
1707+ trigger_error(__('Unable to get the default layout'), E_USER_ERROR);
1708+ }
1709+
1710+ $msgDefault = __('Default Layout');
1711+ $layoutList = dropdownlist('SELECT layoutid, layout FROM layout WHERE retired = 0 ORDER by layout', 'defaultlayoutid', $defaultLayoutId);
1712+
1713+ $form = <<<END
1714+ <form id="DefaultLayoutForm" class="XiboForm" method="post" action="index.php?p=display&q=DefaultLayout&DisplayId=$displayId">
1715+ <input type="hidden" name="DisplayId" value="$displayId">
1716+ <table>
1717+ <tr>
1718+ <td>$msgDefault<span class="required">*</span></td>
1719+ <td>$layoutList</td>
1720+ </tr>
1721+ </table>
1722+ </form>
1723+END;
1724+
1725+ $response->SetFormRequestResponse($form, __('Edit Default Layout'), '300px', '150px');
1726+ $response->AddButton(__('Cancel'), 'XiboDialogClose()');
1727+ $response->AddButton(__('Save'), '$("#DefaultLayoutForm").submit()');
1728+ $response->Respond();
1729+ }
1730+
1731+ /**
1732+ * Edit the default layout for a display
1733+ */
1734+ public function DefaultLayout()
1735+ {
1736+ $db =& $this->db;
1737+ $response = new ResponseManager();
1738+ $displayObject = new Display($db);
1739+
1740+ $displayId = Kit::GetParam('DisplayId', _POST, _INT);
1741+ $defaultLayoutId = Kit::GetParam('defaultlayoutid', _POST, _INT);
1742+
1743+ if (!$displayObject->EditDefaultLayout($displayId, $defaultLayoutId))
1744+ {
1745+ trigger_error(__('Cannot Edit this Display'), E_USER_ERROR);
1746+ }
1747+
1748+ $response->SetFormSubmitResponse(__('Display Saved.'));
1749+ $response->Respond();
1750+ }
1751+
1752+ /**
1753+ * Shows the inventory XML for the display
1754+ */
1755+ public function MediaInventory()
1756+ {
1757+ $db =& $this->db;
1758+ $response = new ResponseManager();
1759+ $displayId = Kit::GetParam('DisplayId', _GET, _INT);
1760+
1761+ if ($displayId == 0)
1762+ trigger_error(__('No DisplayId Given'));
1763+
1764+ // Get the media inventory xml for this display
1765+ $SQL = "SELECT MediaInventoryXml FROM display WHERE DisplayId = %d";
1766+ $SQL = sprintf($SQL, $displayId);
1767+
1768+ if (!$mediaInventoryXml = $db->GetSingleValue($SQL, 'MediaInventoryXml', _HTMLSTRING))
1769+ {
1770+ trigger_error($db->error());
1771+ trigger_error(__('Unable to get the Inventory for this Display'), E_USER_ERROR);
1772+ }
1773+
1774+ // Load the XML into a DOMDocument
1775+ $document = new DOMDocument("1.0");
1776+
1777+ if (!$document->loadXML($mediaInventoryXml))
1778+ trigger_error(__('Invalid Media Inventory'), E_USER_ERROR);
1779+
1780+ // Output a table
1781+ $table = '<table><tr><th>Type</th><th>Id</th><th>Complete</th><th>Last Checked</th><th>MD5</th></tr>';
1782+
1783+ $xpath = new DOMXPath($document);
1784+ $fileNodes = $xpath->query("//file");
1785+
1786+ foreach ($fileNodes as $node)
1787+ {
1788+ $type = $node->getAttribute('type');
1789+ $id = $node->getAttribute('id');
1790+ $complete = $node->getAttribute('complete');
1791+ $lastChecked = $node->getAttribute('lastChecked');
1792+ $md5 = $node->getAttribute('md5');
1793+
1794+ if ($complete == 0)
1795+ $complete = __('No');
1796+ else
1797+ $complete = __('Yes');
1798+
1799+ $table .= sprintf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>', $type, $id, $complete, $lastChecked, $md5);
1800+ }
1801+
1802+ $table .= '</table>';
1803+
1804+ $response->SetFormRequestResponse($table, __('Media Inventory'), '550px', '350px');
1805+ $response->AddButton(__('Close'), 'XiboDialogClose()');
1806+ $response->Respond();
1807+ }
1808+>>>>>>> MERGE-SOURCE
1809 }
1810 ?>
1811
1812=== modified file 'server/lib/pages/layout.class.php'
1813--- server/lib/pages/layout.class.php 2011-02-28 15:58:42 +0000
1814+++ server/lib/pages/layout.class.php 2011-03-11 08:44:59 +0000
1815@@ -325,6 +325,12 @@
1816 trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
1817 }
1818
1819+ // Notify (dont error)
1820+ Kit::ClassLoader('display');
1821+ $displayObject = new Display($db);
1822+ $displayObject->NotifyDisplays($this->layoutid);
1823+
1824+
1825 $response->SetFormSubmitResponse(__('Layout Details Changed.'));
1826 $response->Respond();
1827 }
1828
1829=== modified file 'server/lib/pages/region.class.php'
1830--- server/lib/pages/region.class.php 2010-05-29 11:16:24 +0000
1831+++ server/lib/pages/region.class.php 2011-03-11 08:44:59 +0000
1832@@ -76,6 +76,11 @@
1833 $this->errMsg = __("Unable to Update that layouts XML with a new Media Node");
1834 return false;
1835 }
1836+
1837+ // Notify (dont error)
1838+ Kit::ClassLoader('display');
1839+ $displayObject = new Display($db);
1840+ $displayObject->NotifyDisplays($layoutid);
1841
1842 return true;
1843 }
1844
1845=== modified file 'server/lib/service/service.wsdl'
1846--- server/lib/service/service.wsdl 2010-01-31 00:38:32 +0000
1847+++ server/lib/service/service.wsdl 2011-03-11 08:44:59 +0000
1848@@ -80,6 +80,15 @@
1849 <message name="SubmitStatsResponse">
1850 <part name="success" type="xsd:boolean" />
1851 </message>
1852+ <message name="MediaInventoryRequest">
1853+ <part name="version" type="xsd:string" />
1854+ <part name="serverKey" type="xsd:string" />
1855+ <part name="hardwareKey" type="xsd:string" />
1856+ <part name="mediaInventory" type="xsd:string" />
1857+ </message>
1858+ <message name="MediaInventoryResponse">
1859+ <part name="success" type="xsd:boolean" />
1860+ </message>
1861 <portType name="xmdsPortType">
1862 <operation name="RegisterDisplay">
1863 <documentation>Registered the Display on the Xibo Network</documentation>
1864@@ -121,6 +130,11 @@
1865 <input message="tns:SubmitStatsRequest"/>
1866 <output message="tns:SubmitStatsResponse"/>
1867 </operation>
1868+ <operation name="MediaInventory">
1869+ <documentation>Report back the clients MediaInventory</documentation>
1870+ <input message="tns:MediaInventoryRequest" />
1871+ <output message="tns:MediaInventoryResponse" />
1872+ </operation>
1873 </portType>
1874 <binding name="xmdsBinding" type="tns:xmdsPortType">
1875 <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
1876@@ -196,6 +210,15 @@
1877 <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
1878 </output>
1879 </operation>
1880+ <operation name="MediaInventory">
1881+ <soap:operation soapAction="urn:xmds#MediaInventory" style="rpc"/>
1882+ <input>
1883+ <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
1884+ </input>
1885+ <output>
1886+ <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
1887+ </output>
1888+ </operation>
1889 </binding>
1890 <service name="xmds">
1891 <port name="xmdsPort" binding="tns:xmdsBinding">
1892
1893=== modified file 'server/lib/service/xmdssoap.class.php'
1894--- server/lib/service/xmdssoap.class.php 2011-02-28 15:58:42 +0000
1895+++ server/lib/service/xmdssoap.class.php 2011-03-11 08:44:59 +0000
1896@@ -848,6 +848,66 @@
1897 }
1898
1899 /**
1900+ * Store the media inventory for a client
1901+ * @param <type> $hardwareKey
1902+ * @param <type> $inventory
1903+ */
1904+ public function MediaInventory($version, $serverKey, $hardwareKey, $inventory)
1905+ {
1906+ $db =& $this->db;
1907+
1908+ // Sanitize
1909+ $serverKey = Kit::ValidateParam($serverKey, _STRING);
1910+ $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
1911+ $version = Kit::ValidateParam($version, _STRING);
1912+ $inventory = Kit::ValidateParam($inventory, _HTMLSTRING);
1913+
1914+ // Make sure we are talking the same language
1915+ if (!$this->CheckVersion($version))
1916+ throw new SoapFault('Receiver', "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk");
1917+
1918+ // Auth this request...
1919+ if (!$this->AuthDisplay($hardwareKey))
1920+ throw new SoapFault('Receiver', 'This display client is not licensed');
1921+
1922+ if ($this->isAuditing == 1) Debug::LogEntry ($db, 'audit', $inventory, 'xmds', 'MediaInventory', '', $this->displayId);
1923+
1924+ // Check that the $inventory contains something
1925+ if ($inventory == '')
1926+ throw new SoapFault('Receiver', 'Inventory Cannot be Empty');
1927+
1928+ // Load the XML into a DOMDocument
1929+ $document = new DOMDocument("1.0");
1930+ $document->loadXML($inventory);
1931+
1932+ // Assume we are complete (but we are getting some)
1933+ $mediaInventoryComplete = 1;
1934+
1935+ $xpath = new DOMXPath($document);
1936+ $fileNodes = $xpath->query("//file");
1937+
1938+ foreach ($fileNodes as $node)
1939+ {
1940+ $mediaId = $node->getAttribute('id');
1941+ $complete = $node->getAttribute('complete');
1942+ $md5 = $node->getAttribute('md5');
1943+ $lastChecked = $node->getAttribute('lastChecked');
1944+
1945+ // TODO: Check the MD5?
1946+
1947+ // If this item is a 0 then set not complete
1948+ if ($complete == 0)
1949+ $mediaInventoryComplete = 2;
1950+ }
1951+
1952+ // Touch the display record
1953+ $displayObject = new Display($db);
1954+ $displayObject->Touch($hardwareKey, '', $mediaInventoryComplete, $inventory);
1955+
1956+ return true;
1957+ }
1958+
1959+ /**
1960 * Authenticates the display
1961 * @param <type> $hardwareKey
1962 * @return <type>
1963
1964=== modified file 'server/modules/module_db_mysql.php'
1965--- server/modules/module_db_mysql.php 2010-09-22 20:11:36 +0000
1966+++ server/modules/module_db_mysql.php 2011-03-11 08:44:59 +0000
1967@@ -156,7 +156,7 @@
1968
1969 if (!isset($row[$columnName]))
1970 {
1971- $this->error_text = 'No such column';
1972+ $this->error_text = 'No such column or column is null';
1973 return false;
1974 }
1975

Subscribers

People subscribed via source and target branches

to status/vote changes: