Merge lp:~dangarner/xibo/xmds-logging-103 into lp:~xibo-maintainers/xibo/encke
- xmds-logging-103
- Merge into encke
Proposed by
Dan Garner
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||||||||||
Proposed branch: | lp:~dangarner/xibo/xmds-logging-103 | ||||||||||||||||
Merge into: | lp:~xibo-maintainers/xibo/encke | ||||||||||||||||
Diff against target: | None lines | ||||||||||||||||
To merge this branch: | bzr merge lp:~dangarner/xibo/xmds-logging-103 | ||||||||||||||||
Related bugs: |
|
||||||||||||||||
Related blueprints: |
Display statistics
(Low)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xibo Maintainters | Pending | ||
Review via email: mp+9551@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 '.bzrignore' |
2 | --- .bzrignore 2009-03-07 23:21:15 +0000 |
3 | +++ .bzrignore 2009-06-20 10:05:53 +0000 |
4 | @@ -1,3 +1,4 @@ |
5 | server/settings.php |
6 | .project |
7 | server/.project |
8 | +Thumbs.db |
9 | |
10 | === modified file 'client/dotNET/FileCollector.cs' |
11 | --- client/dotNET/FileCollector.cs 2009-03-13 09:21:56 +0000 |
12 | +++ client/dotNET/FileCollector.cs 2009-07-26 11:40:59 +0000 |
13 | @@ -236,6 +236,9 @@ |
14 | } |
15 | else |
16 | { |
17 | + // Set the flag to indicate we have a connection to XMDS |
18 | + Properties.Settings.Default.XmdsLastConnection = DateTime.Now; |
19 | + |
20 | // What file type were we getting |
21 | if (currentFileList.type == "layout") |
22 | { |
23 | |
24 | === modified file 'client/dotNET/HardwareKey.cs' |
25 | --- client/dotNET/HardwareKey.cs 2009-03-02 23:21:22 +0000 |
26 | +++ client/dotNET/HardwareKey.cs 2009-07-26 11:40:59 +0000 |
27 | @@ -31,7 +31,18 @@ |
28 | { |
29 | System.Diagnostics.Debug.WriteLine("[IN]", "HardwareKey"); |
30 | |
31 | - hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C")); |
32 | + // Get the key from the Settings |
33 | + hardwareKey = Properties.Settings.Default.hardwareKey; |
34 | + |
35 | + // Is the key empty? |
36 | + if (hardwareKey == "") |
37 | + { |
38 | + // Calculate the Hardware key from the CPUID and Volume Serial |
39 | + hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C")); |
40 | + |
41 | + // Store the key |
42 | + Properties.Settings.Default.hardwareKey = hardwareKey; |
43 | + } |
44 | |
45 | System.Diagnostics.Debug.WriteLine("[OUT]", "HardwareKey"); |
46 | } |
47 | @@ -48,6 +59,19 @@ |
48 | } |
49 | |
50 | /// <summary> |
51 | + /// Regenerates the hardware key |
52 | + /// </summary> |
53 | + public void Regenerate() |
54 | + { |
55 | + // Calculate the Hardware key from the CPUID and Volume Serial |
56 | + hardwareKey = Hashes.MD5(GetCPUId() + GetVolumeSerial("C")); |
57 | + |
58 | + // Store the key |
59 | + Properties.Settings.Default.hardwareKey = hardwareKey; |
60 | + Properties.Settings.Default.Save(); |
61 | + } |
62 | + |
63 | + /// <summary> |
64 | /// return Volume Serial Number from hard drive |
65 | /// </summary> |
66 | /// <param name="strDriveLetter">[optional] Drive letter</param> |
67 | |
68 | === modified file 'client/dotNET/Image.cs' |
69 | --- client/dotNET/Image.cs 2009-02-25 22:57:05 +0000 |
70 | +++ client/dotNET/Image.cs 2009-07-30 23:01:31 +0000 |
71 | @@ -27,30 +27,37 @@ |
72 | { |
73 | class ImagePosition : Media |
74 | { |
75 | + private string _filePath; |
76 | + PictureBox _pictureBox; |
77 | + |
78 | public ImagePosition(RegionOptions options) |
79 | : base(options.width, options.height, options.top, options.left) |
80 | { |
81 | - this.filePath = options.uri; |
82 | + _filePath = options.uri; |
83 | |
84 | - if (!System.IO.File.Exists(this.filePath)) |
85 | + if (!System.IO.File.Exists(_filePath)) |
86 | { |
87 | // Exit |
88 | - this.loaded = false; |
89 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", "Cannot Create image object. Invalid Filepath."), LogType.Error.ToString()); |
90 | return; |
91 | } |
92 | |
93 | - Bitmap img = new Bitmap(this.filePath); |
94 | - |
95 | - this.pictureBox = new PictureBox(); |
96 | - this.pictureBox.SizeMode = PictureBoxSizeMode.Zoom; |
97 | - this.pictureBox.Image = img; |
98 | - this.pictureBox.Size = new Size(width, height); |
99 | - this.pictureBox.Location = new Point(0, 0); |
100 | - this.pictureBox.BorderStyle = BorderStyle.None; |
101 | - this.pictureBox.BackColor = Color.Transparent; |
102 | - this.loaded = true; |
103 | - |
104 | - this.Controls.Add(this.pictureBox); |
105 | + try |
106 | + { |
107 | + _pictureBox = new PictureBox(); |
108 | + _pictureBox.SizeMode = PictureBoxSizeMode.Zoom; |
109 | + _pictureBox.Image = new Bitmap(_filePath); |
110 | + _pictureBox.Size = new Size(width, height); |
111 | + _pictureBox.Location = new Point(0, 0); |
112 | + _pictureBox.BorderStyle = BorderStyle.None; |
113 | + _pictureBox.BackColor = Color.Transparent; |
114 | + |
115 | + this.Controls.Add(this._pictureBox); |
116 | + } |
117 | + catch (Exception ex) |
118 | + { |
119 | + System.Diagnostics.Trace.WriteLine(new LogMessage("ImagePosition", String.Format("Cannot create Image Object with exception: {0}", ex.Message)), LogType.Error.ToString()); |
120 | + } |
121 | } |
122 | |
123 | public override void RenderMedia() |
124 | @@ -60,16 +67,21 @@ |
125 | |
126 | protected override void Dispose(bool disposing) |
127 | { |
128 | - if (disposing && loaded) |
129 | + if (disposing) |
130 | { |
131 | - this.pictureBox.Dispose(); |
132 | + try |
133 | + { |
134 | + Controls.Remove(_pictureBox); |
135 | + |
136 | + this._pictureBox.Dispose(); |
137 | + } |
138 | + catch (Exception ex) |
139 | + { |
140 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Image - Dispose", String.Format("Cannot dispose Image Object with exception: {0}", ex.Message)), LogType.Error.ToString()); |
141 | + } |
142 | } |
143 | |
144 | base.Dispose(disposing); |
145 | } |
146 | - |
147 | - private string filePath; |
148 | - private bool loaded; |
149 | - PictureBox pictureBox; |
150 | } |
151 | } |
152 | |
153 | === added file 'client/dotNET/LogMessage.cs' |
154 | --- client/dotNET/LogMessage.cs 1970-01-01 00:00:00 +0000 |
155 | +++ client/dotNET/LogMessage.cs 2009-07-26 11:40:59 +0000 |
156 | @@ -0,0 +1,75 @@ |
157 | +/* |
158 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
159 | + * Copyright (C) 2009 Daniel Garner |
160 | + * |
161 | + * This file is part of Xibo. |
162 | + * |
163 | + * Xibo is free software: you can redistribute it and/or modify |
164 | + * it under the terms of the GNU Affero General Public License as published by |
165 | + * the Free Software Foundation, either version 3 of the License, or |
166 | + * any later version. |
167 | + * |
168 | + * Xibo is distributed in the hope that it will be useful, |
169 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
170 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
171 | + * GNU Affero General Public License for more details. |
172 | + * |
173 | + * You should have received a copy of the GNU Affero General Public License |
174 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
175 | + */ |
176 | +using System; |
177 | +using System.Collections.Generic; |
178 | +using System.Text; |
179 | + |
180 | +namespace XiboClient |
181 | +{ |
182 | + class LogMessage |
183 | + { |
184 | + String _method; |
185 | + String _message; |
186 | + int _scheduleId; |
187 | + int _layoutId; |
188 | + int _mediaId; |
189 | + |
190 | + public LogMessage(String method, String message) |
191 | + { |
192 | + _method = method; |
193 | + _message = message; |
194 | + } |
195 | + |
196 | + public LogMessage(String method, String message, int scheduleId, int layoutId) |
197 | + { |
198 | + _method = method; |
199 | + _message = message; |
200 | + _scheduleId = scheduleId; |
201 | + _layoutId = layoutId; |
202 | + } |
203 | + |
204 | + public LogMessage(String method, String message, int scheduleId, int layoutId, int mediaId) |
205 | + { |
206 | + _method = method; |
207 | + _message = message; |
208 | + _scheduleId = scheduleId; |
209 | + _layoutId = layoutId; |
210 | + _mediaId = mediaId; |
211 | + } |
212 | + |
213 | + public override string ToString() |
214 | + { |
215 | + // Format the message into the expected XML sub nodes. |
216 | + // Just do this with a string builder rather than an XML builder. |
217 | + String theMessage; |
218 | + |
219 | + theMessage = String.Format("<message>{0}</message>", _message); |
220 | + theMessage += String.Format("<method>{0}</method>", _method); |
221 | + |
222 | + if (_scheduleId != 0) theMessage += String.Format("<scheduleid>{0}</scheduleid>", _scheduleId.ToString()); |
223 | + if (_layoutId != 0) theMessage += String.Format("<layoutid>{0}</layoutid>", _scheduleId.ToString()); |
224 | + if (_mediaId != 0) theMessage += String.Format("<mediaid>{0}</mediaid>", _scheduleId.ToString()); |
225 | + |
226 | + return theMessage; |
227 | + } |
228 | + } |
229 | + |
230 | + public enum LogType { Info, Audit, Error } |
231 | +} |
232 | |
233 | === modified file 'client/dotNET/MainForm.cs' |
234 | --- client/dotNET/MainForm.cs 2009-03-08 11:40:17 +0000 |
235 | +++ client/dotNET/MainForm.cs 2009-07-30 23:01:31 +0000 |
236 | @@ -34,9 +34,24 @@ |
237 | { |
238 | public partial class MainForm : Form |
239 | { |
240 | + private Schedule schedule; |
241 | + private Collection<Region> regions; |
242 | + private bool isExpired = false; |
243 | + private int scheduleId; |
244 | + private int layoutId; |
245 | + |
246 | + double layoutWidth; |
247 | + double layoutHeight; |
248 | + double scaleFactor; |
249 | + |
250 | + private StatLog _statLog; |
251 | + private Stat _stat; |
252 | + |
253 | public MainForm() |
254 | { |
255 | InitializeComponent(); |
256 | + |
257 | + _statLog = new StatLog(); |
258 | } |
259 | |
260 | private void MainForm_Load(object sender, EventArgs e) |
261 | @@ -50,7 +65,7 @@ |
262 | Directory.CreateDirectory(Properties.Settings.Default.LibraryPath + @"\backgrounds"); |
263 | } |
264 | catch (Exception ex) |
265 | - { System.Diagnostics.Debug.WriteLine(ex.Message); } |
266 | + { System.Diagnostics.Trace.WriteLine(ex.Message); } |
267 | } |
268 | |
269 | // Hide the cursor |
270 | @@ -71,7 +86,7 @@ |
271 | } |
272 | catch (Exception ex) |
273 | { |
274 | - System.Diagnostics.Debug.WriteLine(ex.Message); |
275 | + System.Diagnostics.Debug.WriteLine(ex.Message, LogType.Error.ToString()); |
276 | MessageBox.Show("Fatal Error initialising the application", "Fatal Error"); |
277 | this.Close(); |
278 | this.Dispose(); |
279 | @@ -89,6 +104,15 @@ |
280 | this.scheduleId = scheduleId; |
281 | this.layoutId = layoutId; |
282 | |
283 | + if (_stat != null) |
284 | + { |
285 | + // Log the end of the currently running layout. |
286 | + _stat.toDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
287 | + |
288 | + // Record this stat event in the statLog object |
289 | + _statLog.RecordStat(_stat); |
290 | + } |
291 | + |
292 | try |
293 | { |
294 | this.DestroyLayout(); |
295 | @@ -102,9 +126,6 @@ |
296 | System.Diagnostics.Debug.WriteLine(ex.Message); |
297 | isExpired = true; |
298 | } |
299 | - |
300 | - // Flush the TraceListener |
301 | - System.Diagnostics.Trace.Flush(); |
302 | } |
303 | |
304 | |
305 | @@ -113,7 +134,12 @@ |
306 | /// </summary> |
307 | private void PrepareLayout(string layoutPath) |
308 | { |
309 | - XmlLog.AppendStat("Layout Started", StatType.LayoutStart, scheduleId, layoutId, "0"); |
310 | + // Create a start record for this layout |
311 | + _stat = new Stat(); |
312 | + _stat.type = StatType.Layout; |
313 | + _stat.scheduleID = scheduleId; |
314 | + _stat.layoutID = layoutId; |
315 | + _stat.fromDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
316 | |
317 | // Get this layouts XML |
318 | XmlDocument layoutXml = new XmlDocument(); |
319 | @@ -213,20 +239,6 @@ |
320 | leftOverY = 0; |
321 | } |
322 | |
323 | - // Are we licensed? |
324 | - if (Properties.Settings.Default.licensed == 0) |
325 | - { |
326 | - // Show a label indicating this fact |
327 | - notLic = new Label(); |
328 | - notLic.Location = new Point(0, 0); |
329 | - notLic.Size = new System.Drawing.Size(500, 200); |
330 | - notLic.Text = "This Display is not Licensed."; |
331 | - notLic.BackColor = Color.WhiteSmoke; |
332 | - this.Controls.Add(notLic); |
333 | - notLic.BringToFront(); |
334 | - notLic.Show(); |
335 | - } |
336 | - |
337 | // New region and region options objects |
338 | regions = new Collection<Region>(); |
339 | RegionOptions options = new RegionOptions(); |
340 | @@ -305,7 +317,7 @@ |
341 | // All the media nodes for this region / layout combination |
342 | options.mediaNodes = region.ChildNodes; |
343 | |
344 | - Region temp = new Region(); |
345 | + Region temp = new Region(ref _statLog); |
346 | temp.DurationElapsedEvent += new Region.DurationElapsedDelegate(temp_DurationElapsedEvent); |
347 | |
348 | System.Diagnostics.Debug.WriteLine("Created new region", "MainForm - Prepare Layout"); |
349 | @@ -368,6 +380,8 @@ |
350 | |
351 | foreach (Region region in regions) |
352 | { |
353 | + region.Clear(); |
354 | + |
355 | this.Controls.Remove(region); |
356 | |
357 | try |
358 | @@ -384,27 +398,21 @@ |
359 | |
360 | regions.Clear(); |
361 | regions = null; |
362 | - |
363 | - this.Controls.Remove(notLic); |
364 | - |
365 | - // Want a check for powerpoint instances left open by this user |
366 | - /*foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcessesByName("POWERPNT")) |
367 | - { |
368 | - System.Diagnostics.Debug.WriteLine("Killing leftover Powerpoint process.", "MainForm - DestoryLayout"); |
369 | - // Close them (End Process) |
370 | - proc.Kill(); |
371 | - }*/ |
372 | - } |
373 | - |
374 | - private Schedule schedule; |
375 | - private Collection<Region> regions; |
376 | - private bool isExpired = false; |
377 | - private Label notLic; |
378 | - private int scheduleId; |
379 | - private int layoutId; |
380 | - |
381 | - double layoutWidth; |
382 | - double layoutHeight; |
383 | - double scaleFactor; |
384 | + } |
385 | + |
386 | + /// <summary> |
387 | + /// Force a flush of the stats log |
388 | + /// </summary> |
389 | + public void FlushStats() |
390 | + { |
391 | + try |
392 | + { |
393 | + _statLog.Flush(); |
394 | + } |
395 | + catch |
396 | + { |
397 | + System.Diagnostics.Trace.WriteLine(new LogMessage("MainForm - FlushStats", "Unable to Flush Stats"), LogType.Error.ToString()); |
398 | + } |
399 | + } |
400 | } |
401 | } |
402 | \ No newline at end of file |
403 | |
404 | === modified file 'client/dotNET/OptionForm.cs' |
405 | --- client/dotNET/OptionForm.cs 2009-03-08 11:40:17 +0000 |
406 | +++ client/dotNET/OptionForm.cs 2009-07-26 11:40:59 +0000 |
407 | @@ -58,6 +58,9 @@ |
408 | System.Diagnostics.Debug.WriteLine("Getting the Hardware Key", "OptionForm"); |
409 | hardwareKey = new HardwareKey(); |
410 | |
411 | + // Regenerate the key |
412 | + hardwareKey.Regenerate(); |
413 | + |
414 | System.Diagnostics.Debug.WriteLine("Getting the Library Path", "OptionForm"); |
415 | if (Properties.Settings.Default.LibraryPath == "DEFAULT") |
416 | { |
417 | @@ -114,6 +117,8 @@ |
418 | { |
419 | textBoxResults.Text = "Sending Request"; |
420 | |
421 | + this.xmds1.Url = Properties.Settings.Default.XiboClient_xmds_xmds; |
422 | + |
423 | Properties.Settings.Default.displayName = textBoxDisplayName.Text; |
424 | Properties.Settings.Default.Save(); |
425 | |
426 | |
427 | === modified file 'client/dotNET/Program.cs' |
428 | --- client/dotNET/Program.cs 2009-03-08 12:51:18 +0000 |
429 | +++ client/dotNET/Program.cs 2009-07-26 11:40:59 +0000 |
430 | @@ -35,25 +35,25 @@ |
431 | Application.SetCompatibleTextRenderingDefault(false); |
432 | |
433 | System.Diagnostics.Trace.Listeners.Add(new XiboTraceListener()); |
434 | - System.Diagnostics.Trace.AutoFlush = true; |
435 | + System.Diagnostics.Trace.AutoFlush = false; |
436 | |
437 | Form formMain; |
438 | |
439 | if (arg.GetLength(0) > 0) |
440 | { |
441 | - System.Diagnostics.Trace.WriteLine("Options Started", "Main"); |
442 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Main", "Options Started"), LogType.Info.ToString()); |
443 | formMain = new OptionForm(); |
444 | } |
445 | else |
446 | { |
447 | - System.Diagnostics.Trace.WriteLine("Client Started", "Main"); |
448 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Main", "Client Started"), LogType.Info.ToString()); |
449 | formMain = new MainForm(); |
450 | } |
451 | |
452 | Application.Run(formMain); |
453 | |
454 | // Always flush at the end |
455 | - System.Diagnostics.Trace.WriteLine("Application Finished", "Main"); |
456 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Main", "Application Finished"), LogType.Info.ToString()); |
457 | System.Diagnostics.Trace.Flush(); |
458 | } |
459 | } |
460 | |
461 | === modified file 'client/dotNET/Properties/Settings.Designer.cs' |
462 | --- client/dotNET/Properties/Settings.Designer.cs 2009-03-08 11:40:17 +0000 |
463 | +++ client/dotNET/Properties/Settings.Designer.cs 2009-07-30 23:01:31 +0000 |
464 | @@ -47,7 +47,7 @@ |
465 | [global::System.Configuration.UserScopedSettingAttribute()] |
466 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
467 | [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] |
468 | - [global::System.Configuration.DefaultSettingValueAttribute("http://localhost/Xibo/server/xmds.php")] |
469 | + [global::System.Configuration.DefaultSettingValueAttribute("http://localhost/1.0.0/server/xmds.php")] |
470 | public string XiboClient_xmds_xmds { |
471 | get { |
472 | return ((string)(this["XiboClient_xmds_xmds"])); |
473 | @@ -93,18 +93,6 @@ |
474 | } |
475 | } |
476 | |
477 | - [global::System.Configuration.UserScopedSettingAttribute()] |
478 | - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
479 | - [global::System.Configuration.DefaultSettingValueAttribute("900")] |
480 | - public decimal collectInterval { |
481 | - get { |
482 | - return ((decimal)(this["collectInterval"])); |
483 | - } |
484 | - set { |
485 | - this["collectInterval"] = value; |
486 | - } |
487 | - } |
488 | - |
489 | [global::System.Configuration.ApplicationScopedSettingAttribute()] |
490 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
491 | [global::System.Configuration.DefaultSettingValueAttribute("log.xml")] |
492 | @@ -215,5 +203,61 @@ |
493 | return ((string)(this["Version"])); |
494 | } |
495 | } |
496 | + |
497 | + [global::System.Configuration.UserScopedSettingAttribute()] |
498 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
499 | + [global::System.Configuration.DefaultSettingValueAttribute("")] |
500 | + public string hardwareKey { |
501 | + get { |
502 | + return ((string)(this["hardwareKey"])); |
503 | + } |
504 | + set { |
505 | + this["hardwareKey"] = value; |
506 | + } |
507 | + } |
508 | + |
509 | + [global::System.Configuration.UserScopedSettingAttribute()] |
510 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
511 | + [global::System.Configuration.DefaultSettingValueAttribute("50")] |
512 | + public int StatsFlushCount { |
513 | + get { |
514 | + return ((int)(this["StatsFlushCount"])); |
515 | + } |
516 | + set { |
517 | + this["StatsFlushCount"] = value; |
518 | + } |
519 | + } |
520 | + |
521 | + [global::System.Configuration.ApplicationScopedSettingAttribute()] |
522 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
523 | + [global::System.Configuration.DefaultSettingValueAttribute("stats.xml")] |
524 | + public string StatsLogFile { |
525 | + get { |
526 | + return ((string)(this["StatsLogFile"])); |
527 | + } |
528 | + } |
529 | + |
530 | + [global::System.Configuration.UserScopedSettingAttribute()] |
531 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
532 | + public global::System.DateTime XmdsLastConnection { |
533 | + get { |
534 | + return ((global::System.DateTime)(this["XmdsLastConnection"])); |
535 | + } |
536 | + set { |
537 | + this["XmdsLastConnection"] = value; |
538 | + } |
539 | + } |
540 | + |
541 | + [global::System.Configuration.UserScopedSettingAttribute()] |
542 | + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
543 | + [global::System.Configuration.DefaultSettingValueAttribute("900")] |
544 | + public decimal collectInterval { |
545 | + get { |
546 | + return ((decimal)(this["collectInterval"])); |
547 | + } |
548 | + set { |
549 | + this["collectInterval"] = value; |
550 | + } |
551 | + } |
552 | } |
553 | } |
554 | |
555 | === modified file 'client/dotNET/Properties/Settings.settings' |
556 | --- client/dotNET/Properties/Settings.settings 2009-03-08 11:40:17 +0000 |
557 | +++ client/dotNET/Properties/Settings.settings 2009-07-30 23:01:31 +0000 |
558 | @@ -9,7 +9,7 @@ |
559 | <Value Profile="(Default)">schedule.xml</Value> |
560 | </Setting> |
561 | <Setting Name="XiboClient_xmds_xmds" Type="(Web Service URL)" Scope="User"> |
562 | - <Value Profile="(Default)">http://localhost/Xibo/server/xmds.php</Value> |
563 | + <Value Profile="(Default)">http://localhost/1.0.0/server/xmds.php</Value> |
564 | </Setting> |
565 | <Setting Name="ServerKey" Type="System.String" Scope="User"> |
566 | <Value Profile="(Default)">changetocustomerkey</Value> |
567 | @@ -20,9 +20,6 @@ |
568 | <Setting Name="licensed" Type="System.Int32" Scope="User"> |
569 | <Value Profile="(Default)">0</Value> |
570 | </Setting> |
571 | - <Setting Name="collectInterval" Type="System.Decimal" Scope="User"> |
572 | - <Value Profile="(Default)">900</Value> |
573 | - </Setting> |
574 | <Setting Name="logLocation" Type="System.String" Scope="Application"> |
575 | <Value Profile="(Default)">log.xml</Value> |
576 | </Setting> |
577 | @@ -53,5 +50,20 @@ |
578 | <Setting Name="Version" Type="System.String" Scope="Application"> |
579 | <Value Profile="(Default)">1</Value> |
580 | </Setting> |
581 | + <Setting Name="hardwareKey" Type="System.String" Scope="User"> |
582 | + <Value Profile="(Default)" /> |
583 | + </Setting> |
584 | + <Setting Name="StatsFlushCount" Type="System.Int32" Scope="User"> |
585 | + <Value Profile="(Default)">50</Value> |
586 | + </Setting> |
587 | + <Setting Name="StatsLogFile" Type="System.String" Scope="Application"> |
588 | + <Value Profile="(Default)">stats.xml</Value> |
589 | + </Setting> |
590 | + <Setting Name="XmdsLastConnection" Type="System.DateTime" Scope="User"> |
591 | + <Value Profile="(Default)" /> |
592 | + </Setting> |
593 | + <Setting Name="collectInterval" Type="System.Decimal" Scope="User"> |
594 | + <Value Profile="(Default)">900</Value> |
595 | + </Setting> |
596 | </Settings> |
597 | </SettingsFile> |
598 | \ No newline at end of file |
599 | |
600 | === modified file 'client/dotNET/Region.cs' |
601 | --- client/dotNET/Region.cs 2009-03-08 11:40:17 +0000 |
602 | +++ client/dotNET/Region.cs 2009-07-30 23:01:31 +0000 |
603 | @@ -31,9 +31,24 @@ |
604 | class Region : Panel |
605 | { |
606 | private BlackList blackList; |
607 | - |
608 | - public Region() |
609 | + public delegate void DurationElapsedDelegate(); |
610 | + public event DurationElapsedDelegate DurationElapsedEvent; |
611 | + |
612 | + private Media media; |
613 | + private RegionOptions options; |
614 | + public bool hasExpired = false; |
615 | + public bool layoutExpired = false; |
616 | + private int currentSequence = -1; |
617 | + |
618 | + // Stat objects |
619 | + private StatLog _statLog; |
620 | + private Stat _stat; |
621 | + |
622 | + public Region(ref StatLog statLog) |
623 | { |
624 | + // Store the statLog |
625 | + _statLog = statLog; |
626 | + |
627 | //default options |
628 | options.width = 1024; |
629 | options.height = 768; |
630 | @@ -124,6 +139,10 @@ |
631 | media = new Rss(options); |
632 | break; |
633 | |
634 | + case "embedded": |
635 | + media = new Text(options); |
636 | + break; |
637 | + |
638 | default: |
639 | //do nothing |
640 | SetNextMediaNode(); |
641 | @@ -140,14 +159,16 @@ |
642 | media.RenderMedia(); |
643 | |
644 | // This media has started and is being replaced |
645 | - XmlLog.AppendStat("Media Start", StatType.MediaStart, options.scheduleId, options.layoutId, options.mediaid); |
646 | - |
647 | - //media.Opacity = 0F; // Completely Opaque |
648 | + _stat = new Stat(); |
649 | + _stat.type = StatType.Media; |
650 | + _stat.fromDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
651 | + _stat.scheduleID = options.scheduleId; |
652 | + _stat.layoutID = options.layoutId; |
653 | + _stat.mediaID = options.mediaid; |
654 | |
655 | this.Controls.Add(media); |
656 | |
657 | System.Diagnostics.Debug.WriteLine("Showing new media", "Region - Eval Options"); |
658 | - |
659 | } |
660 | |
661 | /// <summary> |
662 | @@ -176,7 +197,7 @@ |
663 | return; |
664 | } |
665 | |
666 | - |
667 | + // Move the sequence on |
668 | currentSequence++; |
669 | |
670 | if (currentSequence >= options.mediaNodes.Count) |
671 | @@ -197,7 +218,10 @@ |
672 | options.text = ""; |
673 | options.documentTemplate = ""; |
674 | options.copyrightNotice = ""; |
675 | + options.scrollSpeed = 1; |
676 | + options.updateInterval = 6; |
677 | options.uri = ""; |
678 | + options.direction = "none"; |
679 | |
680 | // Get a media node |
681 | bool validNode = false; |
682 | @@ -266,6 +290,28 @@ |
683 | { |
684 | options.copyrightNotice = option.InnerText; |
685 | } |
686 | + else if (option.Name == "scrollSpeed") |
687 | + { |
688 | + try |
689 | + { |
690 | + options.scrollSpeed = int.Parse(option.InnerText); |
691 | + } |
692 | + catch |
693 | + { |
694 | + System.Diagnostics.Trace.WriteLine("Non integer scrollSpeed in XLF", "Region - SetNextMediaNode"); |
695 | + } |
696 | + } |
697 | + else if (option.Name == "updateInverval") |
698 | + { |
699 | + try |
700 | + { |
701 | + options.updateInterval = int.Parse(option.InnerText); |
702 | + } |
703 | + catch |
704 | + { |
705 | + System.Diagnostics.Trace.WriteLine("Non integer updateInterval in XLF", "Region - SetNextMediaNode"); |
706 | + } |
707 | + } |
708 | } |
709 | |
710 | // And some stuff on Raw nodes |
711 | @@ -281,6 +327,10 @@ |
712 | { |
713 | options.documentTemplate = raw.InnerText; |
714 | } |
715 | + else if (raw.Name == "embedHtml") |
716 | + { |
717 | + options.text = raw.InnerText; |
718 | + } |
719 | } |
720 | |
721 | // That should cover all the new options |
722 | @@ -317,8 +367,18 @@ |
723 | System.Diagnostics.Debug.WriteLine(ex.Message); |
724 | } |
725 | |
726 | - // This media has expired and is being replaced |
727 | - XmlLog.AppendStat("Media Expired", StatType.MediaEnd, options.scheduleId, options.layoutId, options.mediaid); |
728 | + try |
729 | + { |
730 | + // Here we say that this media is expired |
731 | + _stat.toDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
732 | + |
733 | + // Record this stat event in the statLog object |
734 | + _statLog.RecordStat(_stat); |
735 | + } |
736 | + catch |
737 | + { |
738 | + System.Diagnostics.Trace.WriteLine("No Stat record when one was expected", LogType.Error.ToString()); |
739 | + } |
740 | } |
741 | } |
742 | |
743 | @@ -334,6 +394,29 @@ |
744 | } |
745 | |
746 | /// <summary> |
747 | + /// Clears the Region of anything that it shouldnt still have... |
748 | + /// </summary> |
749 | + public void Clear() |
750 | + { |
751 | + try |
752 | + { |
753 | + // What happens if we are disposing this region but we have not yet completed the stat event? |
754 | + if (String.IsNullOrEmpty(_stat.toDate)) |
755 | + { |
756 | + // Say that this media has ended |
757 | + _stat.toDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
758 | + |
759 | + // Record this stat event in the statLog object |
760 | + _statLog.RecordStat(_stat); |
761 | + } |
762 | + } |
763 | + catch |
764 | + { |
765 | + System.Diagnostics.Trace.WriteLine(new LogMessage("Region - Clear", "Error closing off stat record"), LogType.Error.ToString()); |
766 | + } |
767 | + } |
768 | + |
769 | + /// <summary> |
770 | /// Performs the disposal. |
771 | /// </summary> |
772 | protected override void Dispose(bool disposing) |
773 | @@ -360,16 +443,6 @@ |
774 | |
775 | base.Dispose(disposing); |
776 | } |
777 | - |
778 | - public delegate void DurationElapsedDelegate(); |
779 | - public event DurationElapsedDelegate DurationElapsedEvent; |
780 | - |
781 | - private Media media; |
782 | - private RegionOptions options; |
783 | - public bool hasExpired = false; |
784 | - public bool layoutExpired = false; |
785 | - private int currentSequence = -1; |
786 | - |
787 | } |
788 | |
789 | /// <summary> |
790 | @@ -398,6 +471,8 @@ |
791 | public string text; |
792 | public string documentTemplate; |
793 | public string copyrightNotice; |
794 | + public int updateInterval; |
795 | + public int scrollSpeed; |
796 | |
797 | //The identification for this region |
798 | public string mediaid; |
799 | |
800 | === removed file 'client/dotNET/Resources/Thumbs.db' |
801 | Binary files client/dotNET/Resources/Thumbs.db 2008-12-19 23:34:13 +0000 and client/dotNET/Resources/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
802 | === modified file 'client/dotNET/Rss.cs' |
803 | --- client/dotNET/Rss.cs 2009-03-13 09:21:56 +0000 |
804 | +++ client/dotNET/Rss.cs 2009-06-20 10:39:40 +0000 |
805 | @@ -64,6 +64,12 @@ |
806 | scheduleId = options.scheduleId; |
807 | layoutId = options.layoutId; |
808 | |
809 | + // Update interval and scrolling speed |
810 | + _updateInterval = options.updateInterval; |
811 | + _scrollSpeed = options.scrollSpeed; |
812 | + |
813 | + System.Diagnostics.Trace.WriteLine(String.Format("Scrolling Speed: {0}, Update Interval: {1})", _scrollSpeed.ToString(), _updateInterval.ToString()), "Rss - Constructor"); |
814 | + |
815 | // Set up the backgrounds |
816 | backgroundTop = options.backgroundTop + "px"; |
817 | backgroundLeft = options.backgroundLeft + "px"; |
818 | @@ -77,7 +83,7 @@ |
819 | |
820 | try |
821 | { |
822 | - webBrowser.DocumentText = String.Format("<html><head><script type='text/javascript'>{0}</script><style type='text/css'>p, h1, h2, h3, h4, h5 {{ margin:2px; font-size:{1}em; }}</style></head><body></body></html>", Properties.Resources.textRender, options.scaleFactor.ToString()); |
823 | + webBrowser.DocumentText = String.Format("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><script type='text/javascript'>{0}</script><style type='text/css'>p, h1, h2, h3, h4, h5 {{ margin:2px; font-size:{1}em; }}</style></head><body></body></html>", Properties.Resources.textRender, options.scaleFactor.ToString()); |
824 | } |
825 | catch (Exception e) |
826 | { |
827 | @@ -96,6 +102,9 @@ |
828 | try |
829 | { |
830 | wc = new System.Net.WebClient(); |
831 | + wc.Encoding = System.Text.Encoding.UTF8; |
832 | + |
833 | + System.Diagnostics.Debug.WriteLine("Created at WebClient and set the Encoding to UTF8", "RSS - Refresh local RSS"); |
834 | |
835 | wc.OpenReadCompleted += new System.Net.OpenReadCompletedEventHandler(wc_OpenReadCompleted); |
836 | |
837 | @@ -109,6 +118,8 @@ |
838 | |
839 | void wc_OpenReadCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) |
840 | { |
841 | + String rssContents; |
842 | + |
843 | if (e.Error != null) |
844 | { |
845 | System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", e.Error, scheduleId, layoutId, mediaid)); |
846 | @@ -122,11 +133,14 @@ |
847 | |
848 | try |
849 | { |
850 | - System.IO.StreamReader sr = new System.IO.StreamReader(data); |
851 | + System.IO.StreamReader sr = new System.IO.StreamReader(data, Encoding.UTF8); |
852 | + rssContents = sr.ReadToEnd(); |
853 | |
854 | StreamWriter sw = new StreamWriter(File.Open(rssFilePath, FileMode.Create, FileAccess.Write, FileShare.Read)); |
855 | |
856 | - sw.Write(sr.ReadToEnd()); |
857 | + System.Diagnostics.Debug.WriteLine("Retrieved RSS - about to write it", "RSS - wc_OpenReadCompleted"); |
858 | + |
859 | + sw.Write(rssContents); |
860 | |
861 | sr.Close(); |
862 | sw.Close(); |
863 | @@ -172,16 +186,23 @@ |
864 | } |
865 | else |
866 | { |
867 | - // It exists - therefore we want to get the last time it was updated |
868 | - DateTime lastWriteDate = System.IO.File.GetLastWriteTime(rssFilePath); |
869 | - |
870 | - if (DateTime.Now.CompareTo(lastWriteDate.AddHours(6.0)) > 0) |
871 | + if (_updateInterval == 0) |
872 | { |
873 | refreshLocalRss(); |
874 | } |
875 | else |
876 | { |
877 | - rssReady = true; |
878 | + // It exists - therefore we want to get the last time it was updated |
879 | + DateTime lastWriteDate = System.IO.File.GetLastWriteTime(rssFilePath); |
880 | + |
881 | + if (DateTime.Now.CompareTo(lastWriteDate.AddHours(_updateInterval * 1.0 / 60.0)) > 0) |
882 | + { |
883 | + refreshLocalRss(); |
884 | + } |
885 | + else |
886 | + { |
887 | + rssReady = true; |
888 | + } |
889 | } |
890 | } |
891 | |
892 | @@ -330,7 +351,7 @@ |
893 | // Call the JavaScript on the page |
894 | Object[] objArray = new Object[2]; |
895 | objArray[0] = direction; |
896 | - objArray[1] = 30; |
897 | + objArray[1] = _scrollSpeed; |
898 | |
899 | htmlDoc.InvokeScript("init", objArray); |
900 | } |
901 | @@ -451,6 +472,8 @@ |
902 | private WebBrowser webBrowser; |
903 | private string copyrightNotice; |
904 | private string mediaid; |
905 | + private int _updateInterval; |
906 | + private int _scrollSpeed; |
907 | |
908 | private string rssFilePath; |
909 | |
910 | |
911 | === modified file 'client/dotNET/Schedule.cs' |
912 | --- client/dotNET/Schedule.cs 2009-03-08 11:40:17 +0000 |
913 | +++ client/dotNET/Schedule.cs 2009-08-02 15:54:18 +0000 |
914 | @@ -69,6 +69,7 @@ |
915 | xmds2.RequiredFilesCompleted += new XiboClient.xmds.RequiredFilesCompletedEventHandler(xmds2_RequiredFilesCompleted); |
916 | xmds2.ScheduleCompleted += new XiboClient.xmds.ScheduleCompletedEventHandler(xmds2_ScheduleCompleted); |
917 | |
918 | + System.Diagnostics.Trace.WriteLine(String.Format("Collection Interval: {0}", Properties.Settings.Default.collectInterval), "Schedule - InitializeComponents"); |
919 | // |
920 | // The Timer for the Service call |
921 | // |
922 | @@ -94,24 +95,25 @@ |
923 | if (e.Error != null) |
924 | { |
925 | //There was an error - what do we do? |
926 | - System.Diagnostics.Debug.WriteLine(e.Error.Message); |
927 | + System.Diagnostics.Trace.WriteLine(e.Error.Message); |
928 | |
929 | // Is it a "not licensed" error |
930 | if (e.Error.Message == "This display client is not licensed") |
931 | { |
932 | Properties.Settings.Default.licensed = 0; |
933 | - Properties.Settings.Default.Save(); |
934 | } |
935 | |
936 | xmdsProcessing = false; |
937 | } |
938 | else |
939 | { |
940 | + // Set the flag to indicate we have a connection to XMDS |
941 | + Properties.Settings.Default.XmdsLastConnection = DateTime.Now; |
942 | + |
943 | // Firstly we know we are licensed if we get this far |
944 | if (Properties.Settings.Default.licensed == 0) |
945 | { |
946 | Properties.Settings.Default.licensed = 1; |
947 | - Properties.Settings.Default.Save(); |
948 | } |
949 | |
950 | try |
951 | @@ -155,11 +157,6 @@ |
952 | { |
953 | System.Diagnostics.Debug.WriteLine("Schedule Retrival Complete."); |
954 | |
955 | - // Send the XML log here if necessary |
956 | - XmlLog log = new XmlLog(); |
957 | - |
958 | - log.PrepareAndSend(); |
959 | - |
960 | // Set XMDS to no longer be processing |
961 | xmdsProcessing = false; |
962 | |
963 | @@ -167,13 +164,16 @@ |
964 | if (e.Error != null) |
965 | { |
966 | //There was an error - what do we do? |
967 | - System.Diagnostics.Debug.WriteLine(e.Error.Message); |
968 | + System.Diagnostics.Trace.WriteLine(e.Error.Message); |
969 | } |
970 | else |
971 | { |
972 | // Only update the schedule if its changed. |
973 | String md5CurrentSchedule = ""; |
974 | |
975 | + // Set the flag to indicate we have a connection to XMDS |
976 | + Properties.Settings.Default.XmdsLastConnection = DateTime.Now; |
977 | + |
978 | try |
979 | { |
980 | StreamReader sr = new StreamReader(File.Open(this.scheduleLocation, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)); |
981 | @@ -234,7 +234,7 @@ |
982 | } |
983 | else |
984 | { |
985 | - Application.DoEvents(); // Make sure everything that is cued to render does |
986 | + Application.DoEvents(); // Make sure everything that is queued to render does |
987 | |
988 | xmdsProcessing = true; |
989 | |
990 | @@ -243,6 +243,9 @@ |
991 | // Fire off a get required files event - async |
992 | xmds2.RequiredFilesAsync(Properties.Settings.Default.ServerKey, hardwareKey.Key, Properties.Settings.Default.Version); |
993 | } |
994 | + |
995 | + // Flush the log |
996 | + System.Diagnostics.Trace.Flush(); |
997 | } |
998 | |
999 | /// <summary> |
1000 | @@ -269,8 +272,6 @@ |
1001 | |
1002 | System.Diagnostics.Debug.WriteLine(String.Format("Next layout: {0}", layoutSchedule[currentLayout].layoutFile), "Schedule - Next Layout"); |
1003 | |
1004 | - XmlLog.AppendStat("Layout Finished", StatType.LayoutEnd, layoutSchedule[previousLayout].scheduleid, layoutSchedule[previousLayout].id, "0"); |
1005 | - |
1006 | forceChange = false; |
1007 | |
1008 | //Raise the event |
1009 | |
1010 | === added file 'client/dotNET/StatLog.cs' |
1011 | --- client/dotNET/StatLog.cs 1970-01-01 00:00:00 +0000 |
1012 | +++ client/dotNET/StatLog.cs 2009-08-02 15:54:18 +0000 |
1013 | @@ -0,0 +1,330 @@ |
1014 | +/* |
1015 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
1016 | + * Copyright (C) 2009 Daniel Garner |
1017 | + * |
1018 | + * This file is part of Xibo. |
1019 | + * |
1020 | + * Xibo is free software: you can redistribute it and/or modify |
1021 | + * it under the terms of the GNU Affero General Public License as published by |
1022 | + * the Free Software Foundation, either version 3 of the License, or |
1023 | + * any later version. |
1024 | + * |
1025 | + * Xibo is distributed in the hope that it will be useful, |
1026 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1027 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1028 | + * GNU Affero General Public License for more details. |
1029 | + * |
1030 | + * You should have received a copy of the GNU Affero General Public License |
1031 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
1032 | + */ |
1033 | +using System; |
1034 | +using System.Collections.Generic; |
1035 | +using System.Collections.ObjectModel; |
1036 | +using System.Text; |
1037 | +using System.IO; |
1038 | +using System.Windows.Forms; |
1039 | +using System.Xml; |
1040 | + |
1041 | +namespace XiboClient |
1042 | +{ |
1043 | + class StatLog |
1044 | + { |
1045 | + private Collection<Stat> _stats; |
1046 | + private xmds.xmds _xmds; |
1047 | + private String _lastSubmit; |
1048 | + private HardwareKey _hardwareKey; |
1049 | + private Boolean _xmdsProcessing; |
1050 | + |
1051 | + public StatLog() |
1052 | + { |
1053 | + _stats = new Collection<Stat>(); |
1054 | + _xmds = new xmds.xmds(); |
1055 | + |
1056 | + // Register a listener for the XMDS stats |
1057 | + _xmds.SubmitStatsCompleted += new XiboClient.xmds.SubmitStatsCompletedEventHandler(_xmds_SubmitStatsCompleted); |
1058 | + |
1059 | + // Get the key for this display |
1060 | + _hardwareKey = new HardwareKey(); |
1061 | + |
1062 | + _xmdsProcessing = false; |
1063 | + } |
1064 | + |
1065 | + /// <summary> |
1066 | + /// Record a complete Layout Event |
1067 | + /// </summary> |
1068 | + /// <param name="fromDT"></param> |
1069 | + /// <param name="toDT"></param> |
1070 | + /// <param name="scheduleID"></param> |
1071 | + /// <param name="layoutID"></param> |
1072 | + public void RecordLayout(String fromDT, String toDT, int scheduleID, int layoutID) |
1073 | + { |
1074 | + if (!Properties.Settings.Default.statsEnabled) return; |
1075 | + |
1076 | + Stat stat = new Stat(); |
1077 | + |
1078 | + stat.type = StatType.Layout; |
1079 | + stat.fromDate = fromDT; |
1080 | + stat.toDate = toDT; |
1081 | + stat.scheduleID = scheduleID; |
1082 | + stat.layoutID = layoutID; |
1083 | + |
1084 | + _stats.Add(stat); |
1085 | + |
1086 | + return; |
1087 | + } |
1088 | + |
1089 | + /// <summary> |
1090 | + /// Record a complete Media Event |
1091 | + /// </summary> |
1092 | + /// <param name="fromDT"></param> |
1093 | + /// <param name="toDT"></param> |
1094 | + /// <param name="layoutID"></param> |
1095 | + /// <param name="mediaID"></param> |
1096 | + public void RecordMedia(String fromDT, String toDT, int layoutID, String mediaID) |
1097 | + { |
1098 | + if (!Properties.Settings.Default.statsEnabled) return; |
1099 | + |
1100 | + Stat stat = new Stat(); |
1101 | + |
1102 | + stat.type = StatType.Media; |
1103 | + stat.fromDate = fromDT; |
1104 | + stat.toDate = toDT; |
1105 | + stat.layoutID = layoutID; |
1106 | + stat.mediaID = mediaID; |
1107 | + |
1108 | + _stats.Add(stat); |
1109 | + |
1110 | + return; |
1111 | + } |
1112 | + |
1113 | + /// <summary> |
1114 | + /// Record a complete Event |
1115 | + /// </summary> |
1116 | + /// <param name="fromDT"></param> |
1117 | + /// <param name="toDT"></param> |
1118 | + /// <param name="tag"></param> |
1119 | + public void RecordEvent(String fromDT, String toDT, String tag) |
1120 | + { |
1121 | + if (!Properties.Settings.Default.statsEnabled) return; |
1122 | + |
1123 | + Stat stat = new Stat(); |
1124 | + |
1125 | + stat.type = StatType.Event; |
1126 | + stat.fromDate = fromDT; |
1127 | + stat.toDate = toDT; |
1128 | + stat.tag = tag; |
1129 | + |
1130 | + _stats.Add(stat); |
1131 | + |
1132 | + return; |
1133 | + } |
1134 | + |
1135 | + /// <summary> |
1136 | + /// RecordStat |
1137 | + /// </summary> |
1138 | + /// <param name="stat"></param> |
1139 | + public void RecordStat(Stat stat) |
1140 | + { |
1141 | + System.Diagnostics.Debug.WriteLine(String.Format("Recording a Stat Record. Current Count = {0}", _stats.Count.ToString()), LogType.Audit.ToString()); |
1142 | + |
1143 | + _stats.Add(stat); |
1144 | + |
1145 | + // At some point we will need to flush the stats |
1146 | + if (_stats.Count >= Properties.Settings.Default.StatsFlushCount) |
1147 | + { |
1148 | + Flush(); |
1149 | + } |
1150 | + |
1151 | + return; |
1152 | + } |
1153 | + |
1154 | + /// <summary> |
1155 | + /// Flush the stats |
1156 | + /// </summary> |
1157 | + public void Flush() |
1158 | + { |
1159 | + System.Diagnostics.Debug.WriteLine(new LogMessage("Flush", String.Format("IN")), LogType.Audit.ToString()); |
1160 | + |
1161 | + // Determine if there is anything to flush |
1162 | + if (_stats.Count < 1 || _xmdsProcessing) return; |
1163 | + |
1164 | + int threshold = ((int)Properties.Settings.Default.collectInterval * 5); |
1165 | + |
1166 | + // Determine where we want to log. |
1167 | + if (Properties.Settings.Default.XmdsLastConnection.AddSeconds(threshold) < DateTime.Now) |
1168 | + { |
1169 | + FlushToFile(); |
1170 | + } |
1171 | + else |
1172 | + { |
1173 | + FlushToXmds(); |
1174 | + } |
1175 | + |
1176 | + System.Diagnostics.Debug.WriteLine(new LogMessage("Flush", String.Format("OUT")), LogType.Audit.ToString()); |
1177 | + } |
1178 | + |
1179 | + /// <summary> |
1180 | + /// Send the Stat to a File |
1181 | + /// </summary> |
1182 | + private void FlushToFile() |
1183 | + { |
1184 | + System.Diagnostics.Debug.WriteLine(new LogMessage("FlushToFile", String.Format("IN")), LogType.Audit.ToString()); |
1185 | + |
1186 | + // There is something to flush - we want to parse the collection adding to the TextWriter each time. |
1187 | + try |
1188 | + { |
1189 | + // Open the Text Writer |
1190 | + StreamWriter tw = new StreamWriter(File.Open(Application.UserAppDataPath + "//" + Properties.Settings.Default.StatsLogFile, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
1191 | + |
1192 | + try |
1193 | + { |
1194 | + foreach (Stat stat in _stats) |
1195 | + { |
1196 | + tw.WriteLine(stat.ToString()); |
1197 | + } |
1198 | + } |
1199 | + catch (Exception ex) |
1200 | + { |
1201 | + System.Diagnostics.Trace.WriteLine(new LogMessage("FlushToFile", String.Format("Error writing stats line to file with exception {0}", ex.Message)), LogType.Error.ToString()); |
1202 | + } |
1203 | + finally |
1204 | + { |
1205 | + // Close the tw. |
1206 | + tw.Close(); |
1207 | + tw.Dispose(); |
1208 | + } |
1209 | + } |
1210 | + catch (Exception ex) |
1211 | + { |
1212 | + // Log this exception |
1213 | + System.Diagnostics.Trace.WriteLine(new LogMessage("FlushToFile", String.Format("Error writing stats to file with exception {0}", ex.Message)), LogType.Error.ToString()); |
1214 | + } |
1215 | + finally |
1216 | + { |
1217 | + // Always clear the stats. If the file open failed for some reason then we dont want to try again |
1218 | + _stats.Clear(); |
1219 | + } |
1220 | + |
1221 | + System.Diagnostics.Debug.WriteLine(new LogMessage("FlushToFile", String.Format("OUT")), LogType.Audit.ToString()); |
1222 | + } |
1223 | + |
1224 | + /// <summary> |
1225 | + /// Send the Stats to XMDS |
1226 | + /// </summary> |
1227 | + private void FlushToXmds() |
1228 | + { |
1229 | + System.Diagnostics.Debug.WriteLine(new LogMessage("FlushToXmds", String.Format("IN")), LogType.Audit.ToString()); |
1230 | + |
1231 | + String stats; |
1232 | + |
1233 | + stats = "<log>"; |
1234 | + |
1235 | + // Load the Stats collection into a string |
1236 | + try |
1237 | + { |
1238 | + foreach (Stat stat in _stats) |
1239 | + { |
1240 | + stats += stat.ToString(); |
1241 | + } |
1242 | + } |
1243 | + catch (Exception ex) |
1244 | + { |
1245 | + System.Diagnostics.Trace.WriteLine(new LogMessage("FlushToXmds", String.Format("Error converting stat to a string {0}", ex.Message)), LogType.Error.ToString()); |
1246 | + } |
1247 | + |
1248 | + stats += "</log>"; |
1249 | + |
1250 | + // Store the stats as the last sent (so we have a record if it fails) |
1251 | + _lastSubmit = stats; |
1252 | + |
1253 | + // Clear the stats collection |
1254 | + _stats.Clear(); |
1255 | + |
1256 | + // Submit the string to XMDS |
1257 | + _xmdsProcessing = true; |
1258 | + |
1259 | + _xmds.SubmitStatsAsync(Properties.Settings.Default.Version, Properties.Settings.Default.ServerKey, _hardwareKey.Key, stats); |
1260 | + |
1261 | + // Log out |
1262 | + System.Diagnostics.Debug.WriteLine(new LogMessage("FlushToXmds", String.Format("OUT")), LogType.Audit.ToString()); |
1263 | + } |
1264 | + |
1265 | + /// <summary> |
1266 | + /// Capture the XMDS call and see if it went well |
1267 | + /// </summary> |
1268 | + /// <param name="sender"></param> |
1269 | + /// <param name="e"></param> |
1270 | + void _xmds_SubmitStatsCompleted(object sender, XiboClient.xmds.SubmitStatsCompletedEventArgs e) |
1271 | + { |
1272 | + System.Diagnostics.Debug.WriteLine(new LogMessage("_xmds_SubmitStatsCompleted", String.Format("IN")), LogType.Audit.ToString()); |
1273 | + |
1274 | + _xmdsProcessing = false; |
1275 | + |
1276 | + // Test if we succeeded or not |
1277 | + if (e.Error != null) |
1278 | + { |
1279 | + // We had an error, log it. |
1280 | + System.Diagnostics.Trace.WriteLine(new LogMessage("_xmds_SubmitStatsCompleted", String.Format("Error during Submit to XMDS {0}", e.Error.Message)), LogType.Error.ToString()); |
1281 | + |
1282 | + // Dump the stats to a file instead |
1283 | + if (_lastSubmit != "") |
1284 | + { |
1285 | + try |
1286 | + { |
1287 | + // Open the Text Writer |
1288 | + StreamWriter tw = new StreamWriter(File.Open(Application.UserAppDataPath + "//" + Properties.Settings.Default.StatsLogFile, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
1289 | + |
1290 | + try |
1291 | + { |
1292 | + tw.Write(_lastSubmit); |
1293 | + } |
1294 | + catch (Exception ex) |
1295 | + { |
1296 | + // Log this exception |
1297 | + System.Diagnostics.Trace.WriteLine(new LogMessage("_xmds_SubmitStatsCompleted", String.Format("Error writing stats to file with exception {0}", ex.Message)), LogType.Error.ToString()); |
1298 | + } |
1299 | + finally |
1300 | + { |
1301 | + tw.Close(); |
1302 | + tw.Dispose(); |
1303 | + } |
1304 | + } |
1305 | + catch (Exception ex) |
1306 | + { |
1307 | + // Log this exception |
1308 | + System.Diagnostics.Trace.WriteLine(new LogMessage("_xmds_SubmitStatsCompleted", String.Format("Could not open the file with exception {0}", ex.Message)), LogType.Error.ToString()); |
1309 | + } |
1310 | + } |
1311 | + } |
1312 | + |
1313 | + // Clear the last sumbit |
1314 | + _lastSubmit = ""; |
1315 | + |
1316 | + System.Diagnostics.Debug.WriteLine(new LogMessage("_xmds_SubmitStatsCompleted", String.Format("OUT")), LogType.Audit.ToString()); |
1317 | + } |
1318 | + } |
1319 | + |
1320 | + class Stat |
1321 | + { |
1322 | + public StatType type; |
1323 | + public String fromDate; |
1324 | + public String toDate; |
1325 | + public int layoutID; |
1326 | + public int scheduleID; |
1327 | + public String mediaID; |
1328 | + public String tag; |
1329 | + |
1330 | + public override string ToString() |
1331 | + { |
1332 | + // Format the message into the expected XML sub nodes. |
1333 | + // Just do this with a string builder rather than an XML builder. |
1334 | + String theMessage; |
1335 | + |
1336 | + theMessage = String.Format("<stat type=\"{0}\" fromdt=\"{1}\" todt=\"{2}\" layoutid=\"{3}\" scheduleid=\"{4}\" mediaid=\"{5}\"></stat>", type, fromDate, toDate, layoutID.ToString(), scheduleID.ToString(), mediaID); |
1337 | + |
1338 | + return theMessage; |
1339 | + } |
1340 | + } |
1341 | + |
1342 | + public enum StatType { Layout, Media, Event }; |
1343 | +} |
1344 | |
1345 | === modified file 'client/dotNET/Text.cs' |
1346 | --- client/dotNET/Text.cs 2008-12-19 23:34:13 +0000 |
1347 | +++ client/dotNET/Text.cs 2009-06-20 10:39:40 +0000 |
1348 | @@ -55,11 +55,12 @@ |
1349 | |
1350 | try |
1351 | { |
1352 | - webBrowser.DocumentText = String.Format("<html><head><script type='text/javascript'>{0}</script><style type='text/css'>p, h1, h2, h3, h4, h5 {{ margin:2px; font-size:{1}em; }}</style></head><body></body></html>", Properties.Resources.textRender, options.scaleFactor.ToString()); |
1353 | + webBrowser.DocumentText = String.Format("<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><script type='text/javascript'>{0}</script><style type='text/css'>p, h1, h2, h3, h4, h5 {{ margin:2px; font-size:{1}em; }}</style></head><body></body></html>", Properties.Resources.textRender, options.scaleFactor.ToString()); |
1354 | } |
1355 | catch (Exception e) |
1356 | { |
1357 | - MessageBox.Show(e.Message); |
1358 | + System.Diagnostics.Trace.WriteLine(e.Message); |
1359 | + return; |
1360 | } |
1361 | |
1362 | webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); |
1363 | |
1364 | === modified file 'client/dotNET/VideoPlayer.resx' |
1365 | --- client/dotNET/VideoPlayer.resx 2008-12-19 23:34:13 +0000 |
1366 | +++ client/dotNET/VideoPlayer.resx 2009-05-24 10:19:36 +0000 |
1367 | @@ -123,8 +123,8 @@ |
1368 | LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 |
1369 | ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAuQAAAAIB |
1370 | AAAAAQAAAAAAAAAAAAAAAKQAAAAAAwAACAACAAAAAAAFAAAAAAAAAPA/AwAAAAAABQAAAAAAAAAAAAgA |
1371 | - AgAAAAAAAwABAAAACwD//wMAAAAAAAsA//8IAAIAAAAAAAMAMgAAAAsAAAAIAAoAAABuAG8AbgBlAAAA |
1372 | - CwD//wsA//8LAAAACwAAAAsAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAAIAAIAAAAAAAsAAAATHgAA |
1373 | + AgAAAAAAAwABAAAACwD//wMAAAAAAAsAAAAIAAIAAAAAAAMAMgAAAAsAAAAIAAoAAABuAG8AbgBlAAAA |
1374 | + CwD//wsAAAALAAAACwAAAAsAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAAIAAIAAAAAAAsAAAATHgAA |
1375 | zRsAAAs= |
1376 | </value> |
1377 | </data> |
1378 | |
1379 | === modified file 'client/dotNET/Web References/xmds/Reference.cs' |
1380 | --- client/dotNET/Web References/xmds/Reference.cs 2008-12-19 23:34:13 +0000 |
1381 | +++ client/dotNET/Web References/xmds/Reference.cs 2009-07-26 11:40:59 +0000 |
1382 | @@ -41,6 +41,10 @@ |
1383 | |
1384 | private System.Threading.SendOrPostCallback BlackListOperationCompleted; |
1385 | |
1386 | + private System.Threading.SendOrPostCallback SubmitLogOperationCompleted; |
1387 | + |
1388 | + private System.Threading.SendOrPostCallback SubmitStatsOperationCompleted; |
1389 | + |
1390 | private bool useDefaultCredentialsSetExplicitly; |
1391 | |
1392 | /// <remarks/> |
1393 | @@ -98,6 +102,12 @@ |
1394 | public event BlackListCompletedEventHandler BlackListCompleted; |
1395 | |
1396 | /// <remarks/> |
1397 | + public event SubmitLogCompletedEventHandler SubmitLogCompleted; |
1398 | + |
1399 | + /// <remarks/> |
1400 | + public event SubmitStatsCompletedEventHandler SubmitStatsCompleted; |
1401 | + |
1402 | + /// <remarks/> |
1403 | [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:xmds#RegisterDisplay", RequestNamespace="urn:xmds", ResponseNamespace="urn:xmds")] |
1404 | [return: System.Xml.Serialization.SoapElementAttribute("ActivationMessage")] |
1405 | public string RegisterDisplay(string serverKey, string hardwareKey, string displayName, string version) { |
1406 | @@ -320,6 +330,78 @@ |
1407 | } |
1408 | |
1409 | /// <remarks/> |
1410 | + [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:xmds#SubmitLog", RequestNamespace="urn:xmds", ResponseNamespace="urn:xmds")] |
1411 | + [return: System.Xml.Serialization.SoapElementAttribute("success")] |
1412 | + public bool SubmitLog(string version, string serverKey, string hardwareKey, string logXml) { |
1413 | + object[] results = this.Invoke("SubmitLog", new object[] { |
1414 | + version, |
1415 | + serverKey, |
1416 | + hardwareKey, |
1417 | + logXml}); |
1418 | + return ((bool)(results[0])); |
1419 | + } |
1420 | + |
1421 | + /// <remarks/> |
1422 | + public void SubmitLogAsync(string version, string serverKey, string hardwareKey, string logXml) { |
1423 | + this.SubmitLogAsync(version, serverKey, hardwareKey, logXml, null); |
1424 | + } |
1425 | + |
1426 | + /// <remarks/> |
1427 | + public void SubmitLogAsync(string version, string serverKey, string hardwareKey, string logXml, object userState) { |
1428 | + if ((this.SubmitLogOperationCompleted == null)) { |
1429 | + this.SubmitLogOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubmitLogOperationCompleted); |
1430 | + } |
1431 | + this.InvokeAsync("SubmitLog", new object[] { |
1432 | + version, |
1433 | + serverKey, |
1434 | + hardwareKey, |
1435 | + logXml}, this.SubmitLogOperationCompleted, userState); |
1436 | + } |
1437 | + |
1438 | + private void OnSubmitLogOperationCompleted(object arg) { |
1439 | + if ((this.SubmitLogCompleted != null)) { |
1440 | + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); |
1441 | + this.SubmitLogCompleted(this, new SubmitLogCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); |
1442 | + } |
1443 | + } |
1444 | + |
1445 | + /// <remarks/> |
1446 | + [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:xmds#SubmitLog", RequestNamespace="urn:xmds", ResponseNamespace="urn:xmds")] |
1447 | + [return: System.Xml.Serialization.SoapElementAttribute("success")] |
1448 | + public bool SubmitStats(string version, string serverKey, string hardwareKey, string statXml) { |
1449 | + object[] results = this.Invoke("SubmitStats", new object[] { |
1450 | + version, |
1451 | + serverKey, |
1452 | + hardwareKey, |
1453 | + statXml}); |
1454 | + return ((bool)(results[0])); |
1455 | + } |
1456 | + |
1457 | + /// <remarks/> |
1458 | + public void SubmitStatsAsync(string version, string serverKey, string hardwareKey, string statXml) { |
1459 | + this.SubmitStatsAsync(version, serverKey, hardwareKey, statXml, null); |
1460 | + } |
1461 | + |
1462 | + /// <remarks/> |
1463 | + public void SubmitStatsAsync(string version, string serverKey, string hardwareKey, string statXml, object userState) { |
1464 | + if ((this.SubmitStatsOperationCompleted == null)) { |
1465 | + this.SubmitStatsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSubmitStatsOperationCompleted); |
1466 | + } |
1467 | + this.InvokeAsync("SubmitStats", new object[] { |
1468 | + version, |
1469 | + serverKey, |
1470 | + hardwareKey, |
1471 | + statXml}, this.SubmitStatsOperationCompleted, userState); |
1472 | + } |
1473 | + |
1474 | + private void OnSubmitStatsOperationCompleted(object arg) { |
1475 | + if ((this.SubmitStatsCompleted != null)) { |
1476 | + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); |
1477 | + this.SubmitStatsCompleted(this, new SubmitStatsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); |
1478 | + } |
1479 | + } |
1480 | + |
1481 | + /// <remarks/> |
1482 | public new void CancelAsync(object userState) { |
1483 | base.CancelAsync(userState); |
1484 | } |
1485 | @@ -493,6 +575,58 @@ |
1486 | } |
1487 | } |
1488 | } |
1489 | + |
1490 | + /// <remarks/> |
1491 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")] |
1492 | + public delegate void SubmitLogCompletedEventHandler(object sender, SubmitLogCompletedEventArgs e); |
1493 | + |
1494 | + /// <remarks/> |
1495 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")] |
1496 | + [System.Diagnostics.DebuggerStepThroughAttribute()] |
1497 | + [System.ComponentModel.DesignerCategoryAttribute("code")] |
1498 | + public partial class SubmitLogCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { |
1499 | + |
1500 | + private object[] results; |
1501 | + |
1502 | + internal SubmitLogCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : |
1503 | + base(exception, cancelled, userState) { |
1504 | + this.results = results; |
1505 | + } |
1506 | + |
1507 | + /// <remarks/> |
1508 | + public bool Result { |
1509 | + get { |
1510 | + this.RaiseExceptionIfNecessary(); |
1511 | + return ((bool)(this.results[0])); |
1512 | + } |
1513 | + } |
1514 | + } |
1515 | + |
1516 | + /// <remarks/> |
1517 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")] |
1518 | + public delegate void SubmitStatsCompletedEventHandler(object sender, SubmitStatsCompletedEventArgs e); |
1519 | + |
1520 | + /// <remarks/> |
1521 | + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")] |
1522 | + [System.Diagnostics.DebuggerStepThroughAttribute()] |
1523 | + [System.ComponentModel.DesignerCategoryAttribute("code")] |
1524 | + public partial class SubmitStatsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { |
1525 | + |
1526 | + private object[] results; |
1527 | + |
1528 | + internal SubmitStatsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : |
1529 | + base(exception, cancelled, userState) { |
1530 | + this.results = results; |
1531 | + } |
1532 | + |
1533 | + /// <remarks/> |
1534 | + public bool Result { |
1535 | + get { |
1536 | + this.RaiseExceptionIfNecessary(); |
1537 | + return ((bool)(this.results[0])); |
1538 | + } |
1539 | + } |
1540 | + } |
1541 | } |
1542 | |
1543 | #pragma warning restore 1591 |
1544 | \ No newline at end of file |
1545 | |
1546 | === modified file 'client/dotNET/Web References/xmds/Reference.map' |
1547 | --- client/dotNET/Web References/xmds/Reference.map 2009-01-23 20:51:50 +0000 |
1548 | +++ client/dotNET/Web References/xmds/Reference.map 2009-07-26 11:40:59 +0000 |
1549 | @@ -1,6 +1,6 @@ |
1550 | <?xml version="1.0" encoding="utf-8"?> |
1551 | <DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
1552 | <Results> |
1553 | - <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost/Xibo/server/xmds.php?wsdl" filename="xmds.wsdl" /> |
1554 | + <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost/1.0.0/server/xmds.php?wsdl" filename="xmds.wsdl" /> |
1555 | </Results> |
1556 | </DiscoveryClientResultsFile> |
1557 | \ No newline at end of file |
1558 | |
1559 | === modified file 'client/dotNET/Web References/xmds/xmds.wsdl' |
1560 | --- client/dotNET/Web References/xmds/xmds.wsdl 2009-01-23 20:51:50 +0000 |
1561 | +++ client/dotNET/Web References/xmds/xmds.wsdl 2009-07-26 11:40:59 +0000 |
1562 | @@ -63,6 +63,24 @@ |
1563 | <wsdl:message name="BlackListResponse"> |
1564 | <wsdl:part name="success" type="xsd:boolean" /> |
1565 | </wsdl:message> |
1566 | + <wsdl:message name="SubmitLogRequest"> |
1567 | + <wsdl:part name="version" type="xsd:string" /> |
1568 | + <wsdl:part name="serverKey" type="xsd:string" /> |
1569 | + <wsdl:part name="hardwareKey" type="xsd:string" /> |
1570 | + <wsdl:part name="logXml" type="xsd:string" /> |
1571 | + </wsdl:message> |
1572 | + <wsdl:message name="SubmitLogResponse"> |
1573 | + <wsdl:part name="success" type="xsd:boolean" /> |
1574 | + </wsdl:message> |
1575 | + <wsdl:message name="SubmitStatsRequest"> |
1576 | + <wsdl:part name="version" type="xsd:string" /> |
1577 | + <wsdl:part name="serverKey" type="xsd:string" /> |
1578 | + <wsdl:part name="hardwareKey" type="xsd:string" /> |
1579 | + <wsdl:part name="statXml" type="xsd:string" /> |
1580 | + </wsdl:message> |
1581 | + <wsdl:message name="SubmitStatsResponse"> |
1582 | + <wsdl:part name="success" type="xsd:boolean" /> |
1583 | + </wsdl:message> |
1584 | <wsdl:portType name="xmdsPortType"> |
1585 | <wsdl:operation name="RegisterDisplay"> |
1586 | <documentation>Registered the Display on the Xibo Network</documentation> |
1587 | @@ -94,6 +112,16 @@ |
1588 | <wsdl:input message="tns:BlackListRequest" /> |
1589 | <wsdl:output message="tns:BlackListResponse" /> |
1590 | </wsdl:operation> |
1591 | + <wsdl:operation name="SubmitLog"> |
1592 | + <documentation>Submit Logging from the Client</documentation> |
1593 | + <wsdl:input message="tns:SubmitLogRequest" /> |
1594 | + <wsdl:output message="tns:SubmitLogResponse" /> |
1595 | + </wsdl:operation> |
1596 | + <wsdl:operation name="SubmitStats"> |
1597 | + <documentation>Submit Display statistics from the Client</documentation> |
1598 | + <wsdl:input message="tns:SubmitStatsRequest" /> |
1599 | + <wsdl:output message="tns:SubmitStatsResponse" /> |
1600 | + </wsdl:operation> |
1601 | </wsdl:portType> |
1602 | <wsdl:binding name="xmdsBinding" type="tns:xmdsPortType"> |
1603 | <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" /> |
1604 | @@ -151,10 +179,28 @@ |
1605 | <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
1606 | </wsdl:output> |
1607 | </wsdl:operation> |
1608 | + <wsdl:operation name="SubmitLog"> |
1609 | + <soap:operation soapAction="urn:xmds#SubmitLog" style="rpc" /> |
1610 | + <wsdl:input> |
1611 | + <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
1612 | + </wsdl:input> |
1613 | + <wsdl:output> |
1614 | + <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
1615 | + </wsdl:output> |
1616 | + </wsdl:operation> |
1617 | + <wsdl:operation name="SubmitStats"> |
1618 | + <soap:operation soapAction="urn:xmds#SubmitLog" style="rpc" /> |
1619 | + <wsdl:input> |
1620 | + <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
1621 | + </wsdl:input> |
1622 | + <wsdl:output> |
1623 | + <soap:body use="encoded" namespace="urn:xmds" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
1624 | + </wsdl:output> |
1625 | + </wsdl:operation> |
1626 | </wsdl:binding> |
1627 | <wsdl:service name="xmds"> |
1628 | <wsdl:port name="xmdsPort" binding="tns:xmdsBinding"> |
1629 | - <soap:address location="http://localhost/Xibo/server/xmds.php" /> |
1630 | + <soap:address location="http://localhost/1.0.0/server/xmds.php" /> |
1631 | </wsdl:port> |
1632 | </wsdl:service> |
1633 | </wsdl:definitions> |
1634 | \ No newline at end of file |
1635 | |
1636 | === modified file 'client/dotNET/XiboClient.csproj' |
1637 | --- client/dotNET/XiboClient.csproj 2009-03-28 19:13:50 +0000 |
1638 | +++ client/dotNET/XiboClient.csproj 2009-07-26 11:40:59 +0000 |
1639 | @@ -141,9 +141,11 @@ |
1640 | <Compile Include="RssReader.cs" /> |
1641 | <Compile Include="Schedule.cs" /> |
1642 | <Compile Include="Settings.cs" /> |
1643 | + <Compile Include="StatLog.cs" /> |
1644 | <Compile Include="Text.cs"> |
1645 | <SubType>Form</SubType> |
1646 | </Compile> |
1647 | + <Compile Include="LogMessage.cs" /> |
1648 | <Compile Include="Video.cs"> |
1649 | <SubType>Form</SubType> |
1650 | </Compile> |
1651 | @@ -163,7 +165,6 @@ |
1652 | </Compile> |
1653 | <Compile Include="WindowAnimator.cs" /> |
1654 | <Compile Include="XiboTraceListener.cs" /> |
1655 | - <Compile Include="XmlLog.cs" /> |
1656 | </ItemGroup> |
1657 | <ItemGroup> |
1658 | <COMReference Include="AxShockwaveFlashObjects"> |
1659 | @@ -226,10 +227,10 @@ |
1660 | <WebReferences Include="Web References\" /> |
1661 | </ItemGroup> |
1662 | <ItemGroup> |
1663 | - <WebReferenceUrl Include="http://localhost/Xibo/server/xmds.php%3fwsdl"> |
1664 | + <WebReferenceUrl Include="http://localhost/1.0.0/server/xmds.php%3fwsdl"> |
1665 | <UrlBehavior>Dynamic</UrlBehavior> |
1666 | <RelPath>Web References\xmds\</RelPath> |
1667 | - <UpdateFromURL>http://localhost/Xibo/server/xmds.php%3fwsdl</UpdateFromURL> |
1668 | + <UpdateFromURL>http://localhost/1.0.0/server/xmds.php%3fwsdl</UpdateFromURL> |
1669 | <ServiceLocationURL> |
1670 | </ServiceLocationURL> |
1671 | <CachedDynamicPropName> |
1672 | |
1673 | === modified file 'client/dotNET/XiboTraceListener.cs' |
1674 | --- client/dotNET/XiboTraceListener.cs 2009-03-08 12:41:17 +0000 |
1675 | +++ client/dotNET/XiboTraceListener.cs 2009-08-02 15:54:18 +0000 |
1676 | @@ -30,6 +30,13 @@ |
1677 | { |
1678 | class XiboTraceListener : TraceListener |
1679 | { |
1680 | + private Collection<TraceMessage> _traceMessages; |
1681 | + private String _logPath; |
1682 | + private Boolean _xmdsProcessing; |
1683 | + private xmds.xmds _xmds; |
1684 | + private String _lastSubmit; |
1685 | + private HardwareKey _hardwareKey; |
1686 | + |
1687 | public XiboTraceListener() |
1688 | { |
1689 | InitializeListener(); |
1690 | @@ -44,8 +51,17 @@ |
1691 | private void InitializeListener() |
1692 | { |
1693 | // Make a new collection of TraceMessages |
1694 | - traceMessages = new Collection<TraceMessage>(); |
1695 | - logPath = Application.UserAppDataPath + @"/" + Properties.Settings.Default.logLocation; |
1696 | + _traceMessages = new Collection<TraceMessage>(); |
1697 | + _logPath = Application.UserAppDataPath + @"/" + Properties.Settings.Default.logLocation; |
1698 | + |
1699 | + _xmdsProcessing = false; |
1700 | + _xmds = new xmds.xmds(); |
1701 | + |
1702 | + // Register a listener for the XMDS stats |
1703 | + _xmds.SubmitLogCompleted += new XiboClient.xmds.SubmitLogCompletedEventHandler(_xmds_SubmitLogCompleted); |
1704 | + |
1705 | + // Get the key for this display |
1706 | + _hardwareKey = new HardwareKey(); |
1707 | } |
1708 | |
1709 | private void AddToCollection(string message, string category) |
1710 | @@ -56,62 +72,133 @@ |
1711 | traceMessage.dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
1712 | traceMessage.message = message; |
1713 | |
1714 | - traceMessages.Add(traceMessage); |
1715 | + _traceMessages.Add(traceMessage); |
1716 | } |
1717 | |
1718 | private void FlushToFile() |
1719 | { |
1720 | + if (_traceMessages.Count < 1) return; |
1721 | + |
1722 | try |
1723 | { |
1724 | - XmlTextWriter xw = new XmlTextWriter(File.Open(logPath, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
1725 | - |
1726 | - foreach (TraceMessage message in traceMessages) |
1727 | + // Open the Text Writer |
1728 | + StreamWriter tw = new StreamWriter(File.Open(_logPath, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
1729 | + |
1730 | + String theMessage; |
1731 | + |
1732 | + foreach (TraceMessage message in _traceMessages) |
1733 | { |
1734 | - xw.WriteStartElement("trace"); |
1735 | - xw.WriteElementString("category", message.category); |
1736 | - xw.WriteElementString("date", message.dateTime); |
1737 | - xw.WriteElementString("message", message.message); |
1738 | - xw.WriteEndElement(); |
1739 | + String traceMsg = message.message.ToString(); |
1740 | + |
1741 | + theMessage = String.Format("<trace date=\"{0}\" category=\"{1}\">{2}</trace>", message.dateTime, message.category, traceMsg); |
1742 | + tw.WriteLine(theMessage); |
1743 | } |
1744 | |
1745 | - xw.Close(); |
1746 | + // Close the tw. |
1747 | + tw.Close(); |
1748 | + tw.Dispose(); |
1749 | |
1750 | // Remove the messages we have just added |
1751 | - traceMessages.Clear(); |
1752 | + _traceMessages.Clear(); |
1753 | } |
1754 | - catch (Exception e) |
1755 | + catch |
1756 | { |
1757 | // What can we do? |
1758 | } |
1759 | - |
1760 | - // Test the size of the XML file |
1761 | - FileInfo fileInfo = new FileInfo(logPath); |
1762 | - |
1763 | - // If its greater than a certain size - send it to the WebService |
1764 | - if (fileInfo.Length > 6000) |
1765 | - { |
1766 | - // Move the current log file to a ready file |
1767 | - try |
1768 | - { |
1769 | - String logPathTemp = Application.UserAppDataPath + @"/" + String.Format("{0}.ready", DateTime.Now.ToFileTime().ToString()); |
1770 | - |
1771 | - File.Move(logPath, logPathTemp); |
1772 | - } |
1773 | - catch (Exception ex) |
1774 | - { |
1775 | - |
1776 | - } |
1777 | - } |
1778 | + finally |
1779 | + { |
1780 | + _traceMessages.Clear(); |
1781 | + } |
1782 | + } |
1783 | + |
1784 | + /// <summary> |
1785 | + /// Flush the log to XMDS |
1786 | + /// </summary> |
1787 | + private void FlushToXmds() |
1788 | + { |
1789 | + String log; |
1790 | + |
1791 | + log = "<log>"; |
1792 | + |
1793 | + // Load the Stats collection into a string |
1794 | + try |
1795 | + { |
1796 | + foreach (TraceMessage traceMessage in _traceMessages) |
1797 | + { |
1798 | + String traceMsg = traceMessage.message.ToString(); |
1799 | + |
1800 | + log += String.Format("<trace date=\"{0}\" category=\"{1}\">{2}</trace>", traceMessage.dateTime, traceMessage.category, traceMsg); |
1801 | + } |
1802 | + } |
1803 | + catch (Exception ex) |
1804 | + { |
1805 | + System.Diagnostics.Trace.WriteLine(new LogMessage("FlushToXmds", String.Format("Error converting stat to a string {0}", ex.Message)), LogType.Error.ToString()); |
1806 | + } |
1807 | + |
1808 | + log += "</log>"; |
1809 | + |
1810 | + // Store the stats as the last sent (so we have a record if it fails) |
1811 | + _lastSubmit = log; |
1812 | + |
1813 | + // Clear the stats collection |
1814 | + _traceMessages.Clear(); |
1815 | + |
1816 | + // Submit the string to XMDS |
1817 | + _xmdsProcessing = true; |
1818 | + |
1819 | + _xmds.SubmitLogAsync(Properties.Settings.Default.Version, Properties.Settings.Default.ServerKey, _hardwareKey.Key, log); |
1820 | + } |
1821 | + |
1822 | + /// <summary> |
1823 | + /// Capture the XMDS call and see if it went well |
1824 | + /// </summary> |
1825 | + /// <param name="sender"></param> |
1826 | + /// <param name="e"></param> |
1827 | + void _xmds_SubmitLogCompleted(object sender, XiboClient.xmds.SubmitLogCompletedEventArgs e) |
1828 | + { |
1829 | + _xmdsProcessing = false; |
1830 | + |
1831 | + // Test if we succeeded or not |
1832 | + if (e.Error != null) |
1833 | + { |
1834 | + // We had an error, log it. |
1835 | + System.Diagnostics.Trace.WriteLine(new LogMessage("_xmds_SubmitLogCompleted", String.Format("Error during Submit to XMDS {0}", e.Error.Message)), LogType.Error.ToString()); |
1836 | + |
1837 | + // Dump the stats to a file instead |
1838 | + if (_lastSubmit != "") |
1839 | + { |
1840 | + try |
1841 | + { |
1842 | + // Open the Text Writer |
1843 | + StreamWriter tw = new StreamWriter(File.Open(_logPath, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
1844 | + |
1845 | + try |
1846 | + { |
1847 | + tw.Write(_lastSubmit); |
1848 | + } |
1849 | + catch {} |
1850 | + finally |
1851 | + { |
1852 | + tw.Close(); |
1853 | + tw.Dispose(); |
1854 | + } |
1855 | + } |
1856 | + catch {} |
1857 | + } |
1858 | + } |
1859 | + |
1860 | + // Clear the last sumbit |
1861 | + _lastSubmit = ""; |
1862 | } |
1863 | |
1864 | public override void Write(string message) |
1865 | { |
1866 | - AddToCollection(message, ""); |
1867 | + AddToCollection(message, "Audit"); |
1868 | } |
1869 | |
1870 | public override void Write(object o) |
1871 | { |
1872 | - AddToCollection(o.ToString(), ""); |
1873 | + AddToCollection(o.ToString(), "Audit"); |
1874 | } |
1875 | |
1876 | public override void Write(string message, string category) |
1877 | @@ -162,16 +249,47 @@ |
1878 | |
1879 | public override void Close() |
1880 | { |
1881 | - FlushToFile(); |
1882 | + // Determine if there is anything to flush |
1883 | + if (_traceMessages.Count < 1) return; |
1884 | + |
1885 | + // As we are closing if XMDS is already busy just log to file. |
1886 | + if (_xmdsProcessing) |
1887 | + { |
1888 | + FlushToFile(); |
1889 | + } |
1890 | + else |
1891 | + { |
1892 | + int threshold = ((int)Properties.Settings.Default.collectInterval * 5); |
1893 | + |
1894 | + // Determine where we want to log. |
1895 | + if (Properties.Settings.Default.XmdsLastConnection.AddSeconds(threshold) < DateTime.Now) |
1896 | + { |
1897 | + FlushToFile(); |
1898 | + } |
1899 | + else |
1900 | + { |
1901 | + FlushToXmds(); |
1902 | + } |
1903 | + } |
1904 | } |
1905 | |
1906 | public override void Flush() |
1907 | { |
1908 | - FlushToFile(); |
1909 | + // Determine if there is anything to flush |
1910 | + if (_traceMessages.Count < 1 || _xmdsProcessing) return; |
1911 | + |
1912 | + int threshold = ((int)Properties.Settings.Default.collectInterval * 5); |
1913 | + |
1914 | + // Determine where we want to log. |
1915 | + if (Properties.Settings.Default.XmdsLastConnection.AddSeconds(threshold) < DateTime.Now) |
1916 | + { |
1917 | + FlushToFile(); |
1918 | + } |
1919 | + else |
1920 | + { |
1921 | + FlushToXmds(); |
1922 | + } |
1923 | } |
1924 | - |
1925 | - private Collection<TraceMessage> traceMessages; |
1926 | - private String logPath; |
1927 | } |
1928 | |
1929 | [Serializable] |
1930 | |
1931 | === removed file 'client/dotNET/XmlLog.cs' |
1932 | --- client/dotNET/XmlLog.cs 2009-03-08 12:51:18 +0000 |
1933 | +++ client/dotNET/XmlLog.cs 1970-01-01 00:00:00 +0000 |
1934 | @@ -1,172 +0,0 @@ |
1935 | -/* |
1936 | - * Xibo - Digitial Signage - http://www.xibo.org.uk |
1937 | - * Copyright (C) 2006,2007,2008 Daniel Garner and James Packer |
1938 | - * |
1939 | - * This file is part of Xibo. |
1940 | - * |
1941 | - * Xibo is free software: you can redistribute it and/or modify |
1942 | - * it under the terms of the GNU Affero General Public License as published by |
1943 | - * the Free Software Foundation, either version 3 of the License, or |
1944 | - * any later version. |
1945 | - * |
1946 | - * Xibo is distributed in the hope that it will be useful, |
1947 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1948 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1949 | - * GNU Affero General Public License for more details. |
1950 | - * |
1951 | - * You should have received a copy of the GNU Affero General Public License |
1952 | - * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
1953 | - */ |
1954 | -using System; |
1955 | -using System.Collections.Generic; |
1956 | -using System.IO; |
1957 | -using System.Text; |
1958 | -using System.Windows.Forms; |
1959 | -using System.Xml; |
1960 | - |
1961 | -namespace XiboClient |
1962 | -{ |
1963 | - class XmlLog |
1964 | - { |
1965 | - /// <summary> |
1966 | - /// Creates a new XmlLog Class used for sending the log |
1967 | - /// </summary> |
1968 | - /// <param name="logPath"></param> |
1969 | - public XmlLog() |
1970 | - { |
1971 | - logPath = Application.UserAppDataPath + @"/" + Properties.Settings.Default.logLocation; |
1972 | - |
1973 | - // Get the key for this display |
1974 | - hardwareKey = new HardwareKey(); |
1975 | - |
1976 | - // Setup the WebService call |
1977 | - xmds1 = new XiboClient.xmds.xmds(); |
1978 | - xmds1.RecieveXmlLogCompleted += new XiboClient.xmds.RecieveXmlLogCompletedEventHandler(xmds1_RecieveXmlLogCompleted); |
1979 | - |
1980 | - return; |
1981 | - } |
1982 | - |
1983 | - /// <summary> |
1984 | - /// Prepares the log for sending |
1985 | - /// </summary> |
1986 | - public void PrepareAndSend() |
1987 | - { |
1988 | - currentFile = 0; |
1989 | - |
1990 | - // Get a list of all the log files avaiable to process |
1991 | - DirectoryInfo di = new DirectoryInfo(Application.UserAppDataPath); |
1992 | - |
1993 | - files = di.GetFiles("*.ready"); |
1994 | - |
1995 | - // There thought never be no files |
1996 | - if (files.Length == 0) return; |
1997 | - |
1998 | - // Send them (one by one) |
1999 | - SendLog(files[currentFile].FullName); |
2000 | - |
2001 | - return; |
2002 | - } |
2003 | - |
2004 | - /// <summary> |
2005 | - /// Sends and XmlLog files that are ready to send |
2006 | - /// Binds a xmds1.RecieveXmlLogCompleted event |
2007 | - /// </summary> |
2008 | - public void SendLog(string filePath) |
2009 | - { |
2010 | - // Read the Xml |
2011 | - try |
2012 | - { |
2013 | - StreamReader tr = new StreamReader(File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); |
2014 | - xmds1.RecieveXmlLogAsync(Properties.Settings.Default.ServerKey, hardwareKey.Key, tr.ReadToEnd(), Properties.Settings.Default.Version); |
2015 | - tr.Close(); |
2016 | - } |
2017 | - catch (Exception ex) |
2018 | - { |
2019 | - System.Diagnostics.Debug.WriteLine(ex.Message); |
2020 | - } |
2021 | - } |
2022 | - |
2023 | - /// <summary> |
2024 | - /// Completed sending the XML Log |
2025 | - /// </summary> |
2026 | - /// <param name="sender"></param> |
2027 | - /// <param name="e"></param> |
2028 | - void xmds1_RecieveXmlLogCompleted(object sender, XiboClient.xmds.RecieveXmlLogCompletedEventArgs e) |
2029 | - { |
2030 | - // Delete the Log File if success |
2031 | - if (e.Error != null) |
2032 | - { |
2033 | - System.Diagnostics.Debug.WriteLine(e.Error.Message); |
2034 | - } |
2035 | - else |
2036 | - { |
2037 | - if (e.Result) |
2038 | - { |
2039 | - try |
2040 | - { |
2041 | - // Do the delete |
2042 | - File.Delete(files[currentFile].FullName); |
2043 | - } |
2044 | - catch (Exception ex) |
2045 | - { |
2046 | - System.Diagnostics.Debug.WriteLine(ex.Message); |
2047 | - } |
2048 | - } |
2049 | - } |
2050 | - |
2051 | - // Process the next file in the que |
2052 | - currentFile++; |
2053 | - |
2054 | - if (currentFile < files.Length) |
2055 | - { |
2056 | - SendLog(files[currentFile].FullName); |
2057 | - } |
2058 | - |
2059 | - return; |
2060 | - } |
2061 | - |
2062 | - /// <summary> |
2063 | - /// Appends a Stats XML message to the current Log |
2064 | - /// </summary> |
2065 | - /// <param name="message"></param> |
2066 | - /// <param name="cat"></param> |
2067 | - /// <param name="type"></param> |
2068 | - /// <param name="scheduleID"></param> |
2069 | - /// <param name="layoutID"></param> |
2070 | - /// <param name="mediaID"></param> |
2071 | - public static void AppendStat(String message, StatType type, int scheduleID, int layoutID, string mediaID) |
2072 | - { |
2073 | - if (!Properties.Settings.Default.statsEnabled) return; |
2074 | - |
2075 | - try |
2076 | - { |
2077 | - XmlTextWriter xw = new XmlTextWriter(File.Open(Application.UserAppDataPath + "//" + Properties.Settings.Default.logLocation, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF8); |
2078 | - |
2079 | - xw.WriteStartElement("stat"); |
2080 | - |
2081 | - xw.WriteElementString("date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); |
2082 | - xw.WriteElementString("message", message); |
2083 | - xw.WriteElementString("type", type.ToString()); |
2084 | - xw.WriteElementString("scheduleID", scheduleID.ToString()); |
2085 | - xw.WriteElementString("layoutID", layoutID.ToString()); |
2086 | - if (mediaID != "0") xw.WriteElementString("mediaID", mediaID.ToString()); |
2087 | - |
2088 | - xw.WriteEndElement(); |
2089 | - |
2090 | - xw.Close(); |
2091 | - } |
2092 | - catch (Exception ex) |
2093 | - { |
2094 | - } |
2095 | - } |
2096 | - |
2097 | - private XiboClient.xmds.xmds xmds1; |
2098 | - private HardwareKey hardwareKey; |
2099 | - string logPath; |
2100 | - |
2101 | - FileInfo[] files; |
2102 | - int currentFile; |
2103 | - } |
2104 | - |
2105 | - public enum StatType { LayoutStart, LayoutEnd, MediaStart, MediaEnd }; |
2106 | -} |
2107 | |
2108 | === modified file 'client/dotNET/app.config' |
2109 | --- client/dotNET/app.config 2009-03-08 11:40:17 +0000 |
2110 | +++ client/dotNET/app.config 2009-07-30 23:01:31 +0000 |
2111 | @@ -14,7 +14,7 @@ |
2112 | <value>DEFAULT</value> |
2113 | </setting> |
2114 | <setting name="XiboClient_xmds_xmds" serializeAs="String"> |
2115 | - <value>http://localhost/Xibo/server/xmds.php</value> |
2116 | + <value>http://localhost/1.0.0/server/xmds.php</value> |
2117 | </setting> |
2118 | <setting name="ServerKey" serializeAs="String"> |
2119 | <value>changetocustomerkey</value> |
2120 | @@ -25,9 +25,6 @@ |
2121 | <setting name="licensed" serializeAs="String"> |
2122 | <value>0</value> |
2123 | </setting> |
2124 | - <setting name="collectInterval" serializeAs="String"> |
2125 | - <value>900</value> |
2126 | - </setting> |
2127 | <setting name="powerpointEnabled" serializeAs="String"> |
2128 | <value>False</value> |
2129 | </setting> |
2130 | @@ -49,6 +46,18 @@ |
2131 | <setting name="ProxyPort" serializeAs="String"> |
2132 | <value /> |
2133 | </setting> |
2134 | + <setting name="hardwareKey" serializeAs="String"> |
2135 | + <value /> |
2136 | + </setting> |
2137 | + <setting name="StatsFlushCount" serializeAs="String"> |
2138 | + <value>50</value> |
2139 | + </setting> |
2140 | + <setting name="XmdsLastConnection" serializeAs="String"> |
2141 | + <value /> |
2142 | + </setting> |
2143 | + <setting name="collectInterval" serializeAs="String"> |
2144 | + <value>900</value> |
2145 | + </setting> |
2146 | </XiboClient.Properties.Settings> |
2147 | </userSettings> |
2148 | <applicationSettings> |
2149 | @@ -65,6 +74,9 @@ |
2150 | <setting name="Version" serializeAs="String"> |
2151 | <value>1</value> |
2152 | </setting> |
2153 | + <setting name="StatsLogFile" serializeAs="String"> |
2154 | + <value>stats.xml</value> |
2155 | + </setting> |
2156 | </XiboClient.Properties.Settings> |
2157 | </applicationSettings> |
2158 | </configuration> |
2159 | \ No newline at end of file |
2160 | |
2161 | === modified file 'client/dotNET/bin/Release/XiboClient.XmlSerializers.dll' |
2162 | Binary files client/dotNET/bin/Release/XiboClient.XmlSerializers.dll 2009-03-28 19:13:50 +0000 and client/dotNET/bin/Release/XiboClient.XmlSerializers.dll 2009-08-02 17:13:17 +0000 differ |
2163 | === modified file 'client/dotNET/bin/Release/XiboClient.exe' |
2164 | Binary files client/dotNET/bin/Release/XiboClient.exe 2009-03-28 19:13:50 +0000 and client/dotNET/bin/Release/XiboClient.exe 2009-08-02 17:13:17 +0000 differ |
2165 | === modified file 'client/dotNET/bin/Release/XiboClient.exe.config' |
2166 | --- client/dotNET/bin/Release/XiboClient.exe.config 2009-03-08 12:41:17 +0000 |
2167 | +++ client/dotNET/bin/Release/XiboClient.exe.config 2009-07-30 23:01:31 +0000 |
2168 | @@ -14,7 +14,7 @@ |
2169 | <value>DEFAULT</value> |
2170 | </setting> |
2171 | <setting name="XiboClient_xmds_xmds" serializeAs="String"> |
2172 | - <value>http://localhost/Xibo/server/xmds.php</value> |
2173 | + <value>http://localhost/1.0.0/server/xmds.php</value> |
2174 | </setting> |
2175 | <setting name="ServerKey" serializeAs="String"> |
2176 | <value>changetocustomerkey</value> |
2177 | @@ -25,9 +25,6 @@ |
2178 | <setting name="licensed" serializeAs="String"> |
2179 | <value>0</value> |
2180 | </setting> |
2181 | - <setting name="collectInterval" serializeAs="String"> |
2182 | - <value>900</value> |
2183 | - </setting> |
2184 | <setting name="powerpointEnabled" serializeAs="String"> |
2185 | <value>False</value> |
2186 | </setting> |
2187 | @@ -49,6 +46,18 @@ |
2188 | <setting name="ProxyPort" serializeAs="String"> |
2189 | <value /> |
2190 | </setting> |
2191 | + <setting name="hardwareKey" serializeAs="String"> |
2192 | + <value /> |
2193 | + </setting> |
2194 | + <setting name="StatsFlushCount" serializeAs="String"> |
2195 | + <value>50</value> |
2196 | + </setting> |
2197 | + <setting name="XmdsLastConnection" serializeAs="String"> |
2198 | + <value /> |
2199 | + </setting> |
2200 | + <setting name="collectInterval" serializeAs="String"> |
2201 | + <value>900</value> |
2202 | + </setting> |
2203 | </XiboClient.Properties.Settings> |
2204 | </userSettings> |
2205 | <applicationSettings> |
2206 | @@ -65,6 +74,9 @@ |
2207 | <setting name="Version" serializeAs="String"> |
2208 | <value>1</value> |
2209 | </setting> |
2210 | + <setting name="StatsLogFile" serializeAs="String"> |
2211 | + <value>stats.xml</value> |
2212 | + </setting> |
2213 | </XiboClient.Properties.Settings> |
2214 | </applicationSettings> |
2215 | </configuration> |
2216 | \ No newline at end of file |
2217 | |
2218 | === modified file 'client/dotNET/bin/Release/XiboClient.pdb' |
2219 | Binary files client/dotNET/bin/Release/XiboClient.pdb 2009-03-28 19:13:50 +0000 and client/dotNET/bin/Release/XiboClient.pdb 2009-08-02 17:13:17 +0000 differ |
2220 | === modified file 'client/dotNET/bin/Release/XiboClient.vshost.exe.config' |
2221 | --- client/dotNET/bin/Release/XiboClient.vshost.exe.config 2009-03-08 12:41:17 +0000 |
2222 | +++ client/dotNET/bin/Release/XiboClient.vshost.exe.config 2009-07-30 23:01:31 +0000 |
2223 | @@ -14,7 +14,7 @@ |
2224 | <value>DEFAULT</value> |
2225 | </setting> |
2226 | <setting name="XiboClient_xmds_xmds" serializeAs="String"> |
2227 | - <value>http://localhost/Xibo/server/xmds.php</value> |
2228 | + <value>http://localhost/1.0.0/server/xmds.php</value> |
2229 | </setting> |
2230 | <setting name="ServerKey" serializeAs="String"> |
2231 | <value>changetocustomerkey</value> |
2232 | @@ -25,9 +25,6 @@ |
2233 | <setting name="licensed" serializeAs="String"> |
2234 | <value>0</value> |
2235 | </setting> |
2236 | - <setting name="collectInterval" serializeAs="String"> |
2237 | - <value>900</value> |
2238 | - </setting> |
2239 | <setting name="powerpointEnabled" serializeAs="String"> |
2240 | <value>False</value> |
2241 | </setting> |
2242 | @@ -49,6 +46,18 @@ |
2243 | <setting name="ProxyPort" serializeAs="String"> |
2244 | <value /> |
2245 | </setting> |
2246 | + <setting name="hardwareKey" serializeAs="String"> |
2247 | + <value /> |
2248 | + </setting> |
2249 | + <setting name="StatsFlushCount" serializeAs="String"> |
2250 | + <value>50</value> |
2251 | + </setting> |
2252 | + <setting name="XmdsLastConnection" serializeAs="String"> |
2253 | + <value /> |
2254 | + </setting> |
2255 | + <setting name="collectInterval" serializeAs="String"> |
2256 | + <value>900</value> |
2257 | + </setting> |
2258 | </XiboClient.Properties.Settings> |
2259 | </userSettings> |
2260 | <applicationSettings> |
2261 | @@ -65,6 +74,9 @@ |
2262 | <setting name="Version" serializeAs="String"> |
2263 | <value>1</value> |
2264 | </setting> |
2265 | + <setting name="StatsLogFile" serializeAs="String"> |
2266 | + <value>stats.xml</value> |
2267 | + </setting> |
2268 | </XiboClient.Properties.Settings> |
2269 | </applicationSettings> |
2270 | </configuration> |
2271 | \ No newline at end of file |
2272 | |
2273 | === modified file 'server/config/config.class.php' |
2274 | --- server/config/config.class.php 2009-05-02 10:10:54 +0000 |
2275 | +++ server/config/config.class.php 2009-06-20 10:59:41 +0000 |
2276 | @@ -192,7 +192,7 @@ |
2277 | $output .= $imgBad.$message.'<br />'; |
2278 | $output .= <<<END |
2279 | <div class="check_explain"> |
2280 | - <p>Xibo requires a MySQL database.</p> |
2281 | + <p>Xibo requires the PHP MySQL Extension to function.</p> |
2282 | </div> |
2283 | END; |
2284 | } |
2285 | |
2286 | === removed file 'server/img/Thumbs.db' |
2287 | Binary files server/img/Thumbs.db 2008-12-14 14:42:52 +0000 and server/img/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2288 | === removed file 'server/img/bodys/Thumbs.db' |
2289 | Binary files server/img/bodys/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/bodys/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2290 | === removed file 'server/img/dashboard/Thumbs.db' |
2291 | Binary files server/img/dashboard/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/dashboard/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2292 | === removed file 'server/img/dialogs/Thumbs.db' |
2293 | Binary files server/img/dialogs/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/dialogs/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2294 | === removed file 'server/img/fades/Thumbs.db' |
2295 | Binary files server/img/fades/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/fades/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2296 | === removed file 'server/img/filterform/Thumbs.db' |
2297 | Binary files server/img/filterform/Thumbs.db 2008-12-14 14:42:52 +0000 and server/img/filterform/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2298 | === removed file 'server/img/forms/Thumbs.db' |
2299 | Binary files server/img/forms/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/forms/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2300 | === added file 'server/img/forms/embedded.png' |
2301 | Binary files server/img/forms/embedded.png 1970-01-01 00:00:00 +0000 and server/img/forms/embedded.png 2009-06-20 12:00:21 +0000 differ |
2302 | === removed file 'server/img/login/Thumbs.db' |
2303 | Binary files server/img/login/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/login/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2304 | === removed file 'server/img/logos/Thumbs.db' |
2305 | Binary files server/img/logos/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/logos/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2306 | === removed file 'server/img/tables/Thumbs.db' |
2307 | Binary files server/img/tables/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/tables/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2308 | === removed file 'server/img/tabs/Thumbs.db' |
2309 | Binary files server/img/tabs/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/tabs/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2310 | === removed file 'server/img/titles/Thumbs.db' |
2311 | Binary files server/img/titles/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/titles/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2312 | === removed file 'server/img/weather_rss/Thumbs.db' |
2313 | Binary files server/img/weather_rss/Thumbs.db 2008-12-10 23:48:58 +0000 and server/img/weather_rss/Thumbs.db 1970-01-01 00:00:00 +0000 differ |
2314 | === modified file 'server/install.php' |
2315 | --- server/install.php 2009-04-30 17:49:26 +0000 |
2316 | +++ server/install.php 2009-06-15 08:16:19 +0000 |
2317 | @@ -266,6 +266,7 @@ |
2318 | // NB this is broken for 0 padded files |
2319 | // eg 01.sql would be incorrectly sorted in the above example. |
2320 | |
2321 | + $sqlStatementCount = 0; |
2322 | natcasesort($sql_files); |
2323 | |
2324 | foreach ($sql_files as $filename) { |
2325 | @@ -280,10 +281,11 @@ |
2326 | $sql_file = split_sql_file($sql_file, $delimiter); |
2327 | |
2328 | foreach ($sql_file as $sql) { |
2329 | - print "."; |
2330 | + print "."; |
2331 | + $sqlStatementCount++; |
2332 | flush(); |
2333 | if (! @mysql_query($sql,$db)) { |
2334 | - reportError("4", "An error occured populating the database.<br /><br />MySQL Error:<br />" . mysql_error()); |
2335 | + reportError("4", "An error occured populating the database.<br /><br />MySQL Error:<br />" . mysql_error() . "<br /><br />SQL executed:<br />" . $sql . "<br /><br />Statement number: " . $sqlStatementCount); |
2336 | } |
2337 | } |
2338 | print "</p>"; |
2339 | |
2340 | === added file 'server/install/database/6.sql' |
2341 | --- server/install/database/6.sql 1970-01-01 00:00:00 +0000 |
2342 | +++ server/install/database/6.sql 2009-06-20 09:34:43 +0000 |
2343 | @@ -0,0 +1,16 @@ |
2344 | +INSERT INTO `module` ( |
2345 | +`ModuleID` , |
2346 | +`Module` , |
2347 | +`Enabled` , |
2348 | +`RegionSpecific` , |
2349 | +`Description` , |
2350 | +`ImageUri` , |
2351 | +`SchemaVersion` |
2352 | +) |
2353 | +VALUES ( |
2354 | +NULL , 'Embedded', '1', '1', 'Embedded HTML', 'img/forms/webpage.gif', '1' |
2355 | +); |
2356 | + |
2357 | +UPDATE `version` SET `app_ver` = '1.0.2'; |
2358 | +UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE'; |
2359 | +UPDATE `version` SET `DBVersion` = '6'; |
2360 | \ No newline at end of file |
2361 | |
2362 | === modified file 'server/lib/app/app_functions.php' |
2363 | --- server/lib/app/app_functions.php 2009-02-21 17:52:52 +0000 |
2364 | +++ server/lib/app/app_functions.php 2009-07-28 21:08:19 +0000 |
2365 | @@ -325,105 +325,6 @@ |
2366 | return $hms; |
2367 | } |
2368 | |
2369 | -define('STAT_LAYOUT_START', 'LayoutStart'); |
2370 | -define('STAT_LAYOUT_END', 'LayoutEnd'); |
2371 | -define('STAT_MEDIA_START', 'MediaStart'); |
2372 | -define('STAT_MEDIA_END', 'MediaEnd'); |
2373 | - |
2374 | -/** |
2375 | - * Records a Stat Record |
2376 | - * @return |
2377 | - * @param $statType Object |
2378 | - * @param $statDate Object |
2379 | - * @param $scheduleID Object |
2380 | - * @param $displayID Object |
2381 | - * @param $layoutID Object |
2382 | - * @param $mediaID Object |
2383 | - * @param $start Object |
2384 | - * @param $end Object |
2385 | - */ |
2386 | -function StatRecord($statType, $statDate, $scheduleID, $displayID, $layoutID, $mediaID, $start, $end) |
2387 | -{ |
2388 | - global $db; |
2389 | - |
2390 | - $infinityDate = "2050-12-31 00:00:00"; |
2391 | - |
2392 | - // Look up the stat type |
2393 | - switch ($statType) |
2394 | - { |
2395 | - case STAT_LAYOUT_START: |
2396 | - // If its a layout start |
2397 | - // Check for an open Layout which has this schedule & close it |
2398 | - $SQL = ""; |
2399 | - $SQL .= " UPDATE stat SET end = '$end' WHERE scheduleID = '$scheduleID' AND layoutID = '$layoutID' AND end = '$infinityDate' "; |
2400 | - |
2401 | - if (!$db->query($SQL)) |
2402 | - { |
2403 | - trigger_error($db->error()); |
2404 | - return false; |
2405 | - } |
2406 | - |
2407 | - // Insert a new stat record for this layout |
2408 | - $SQL = ""; |
2409 | - $SQL .= " INSERT INTO stat (statDate, scheduleID, displayID, layoutID, start, end)"; |
2410 | - $SQL .= " VALUES ('$statDate', '$scheduleID', '$displayID', '$layoutID', '$start', '$infinityDate')"; |
2411 | - |
2412 | - if (!$db->query($SQL)) |
2413 | - { |
2414 | - trigger_error($db->error()); |
2415 | - return false; |
2416 | - } |
2417 | - |
2418 | - break; |
2419 | - |
2420 | - case STAT_LAYOUT_END: |
2421 | - // If its a layout end |
2422 | - // Close the layout stat record for this schedule (by updating the end time) |
2423 | - // Also close any open media records (they should all be shut anyway) |
2424 | - $SQL = ""; |
2425 | - $SQL .= " UPDATE stat SET end = '$end' WHERE scheduleID = '$scheduleID' AND layoutID = '$layoutID' AND end = '$infinityDate' "; |
2426 | - |
2427 | - if (!$db->query($SQL)) |
2428 | - { |
2429 | - trigger_error($db->error()); |
2430 | - return false; |
2431 | - } |
2432 | - break; |
2433 | - |
2434 | - case STAT_MEDIA_START: |
2435 | - // If its a media start |
2436 | - // Create a new media stat record for this layout |
2437 | - $SQL = ""; |
2438 | - $SQL .= " INSERT INTO stat (statDate, scheduleID, displayID, layoutID, mediaID, start, end)"; |
2439 | - $SQL .= " VALUES ('$statDate', '$scheduleID', '$displayID', '$layoutID', '$mediaID', '$start', '$infinityDate')"; |
2440 | - |
2441 | - if (!$db->query($SQL)) |
2442 | - { |
2443 | - trigger_error($db->error()); |
2444 | - return false; |
2445 | - } |
2446 | - break; |
2447 | - |
2448 | - case STAT_MEDIA_END: |
2449 | - // If its a media end |
2450 | - // Close the stat record |
2451 | - $SQL = ""; |
2452 | - $SQL .= " UPDATE stat SET end = '$end' WHERE scheduleID = '$scheduleID' AND layoutID = '$layoutID' AND mediaID = '$mediaID' AND end = '$infinityDate' "; |
2453 | - |
2454 | - if (!$db->query($SQL)) |
2455 | - { |
2456 | - trigger_error($db->error()); |
2457 | - return false; |
2458 | - } |
2459 | - break; |
2460 | - |
2461 | - default: |
2462 | - return false; |
2463 | - } |
2464 | - |
2465 | - return true; |
2466 | -} |
2467 | - |
2468 | /** |
2469 | * Gets web safe colors |
2470 | * @return |
2471 | |
2472 | === added file 'server/lib/data/layout.data.class.php' |
2473 | --- server/lib/data/layout.data.class.php 1970-01-01 00:00:00 +0000 |
2474 | +++ server/lib/data/layout.data.class.php 2009-07-30 23:01:31 +0000 |
2475 | @@ -0,0 +1,185 @@ |
2476 | +<?php |
2477 | +/* |
2478 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
2479 | + * Copyright (C) 2009 Daniel Garner |
2480 | + * |
2481 | + * This file is part of Xibo. |
2482 | + * |
2483 | + * Xibo is free software: you can redistribute it and/or modify |
2484 | + * it under the terms of the GNU Affero General Public License as published by |
2485 | + * the Free Software Foundation, either version 3 of the License, or |
2486 | + * any later version. |
2487 | + * |
2488 | + * Xibo is distributed in the hope that it will be useful, |
2489 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2490 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2491 | + * GNU Affero General Public License for more details. |
2492 | + * |
2493 | + * You should have received a copy of the GNU Affero General Public License |
2494 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
2495 | + */ |
2496 | +defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser."); |
2497 | + |
2498 | +class Layout extends Data |
2499 | +{ |
2500 | + private $xml; |
2501 | + |
2502 | + public function EditTags($layoutID, $tags) |
2503 | + { |
2504 | + $db =& $this->db; |
2505 | + |
2506 | + Debug::LogEntry($db, 'audit', 'IN', 'Layout', 'EditTags'); |
2507 | + |
2508 | + // Make sure we get an array |
2509 | + if(!is_array($tags)) |
2510 | + { |
2511 | + $this->SetError(25000, 'Must pass EditTags an array'); |
2512 | + return false; |
2513 | + } |
2514 | + |
2515 | + // Set the XML |
2516 | + if (!$this->SetXml($layoutID)) |
2517 | + { |
2518 | + Debug::LogEntry($db, 'audit', 'Failed to Set the layout Xml.', 'Layout', 'EditTags'); |
2519 | + return false; |
2520 | + } |
2521 | + |
2522 | + Debug::LogEntry($db, 'audit', 'Got the XML from the DB. Now creating the tags.', 'Layout', 'EditTags'); |
2523 | + |
2524 | + // Create the tags XML |
2525 | + $tagsXml = '<tags>'; |
2526 | + |
2527 | + foreach($tags as $tag) |
2528 | + { |
2529 | + $tagsXml .= sprintf('<tag>%s</tag>', $tag); |
2530 | + } |
2531 | + |
2532 | + $tagsXml .= '</tags>'; |
2533 | + |
2534 | + Debug::LogEntry($db, 'audit', 'Tags XML is:' . $tagsXml, 'Layout', 'EditTags'); |
2535 | + |
2536 | + // Load the tags XML into a document |
2537 | + $tagsXmlDoc = new DOMDocument('1.0'); |
2538 | + $tagsXmlDoc->loadXML($tagsXml); |
2539 | + |
2540 | + |
2541 | + // Load the XML for this layout |
2542 | + $xml = new DOMDocument("1.0"); |
2543 | + $xml->loadXML($this->xml); |
2544 | + |
2545 | + // Import the new node into this document |
2546 | + $newTagsNode = $xml->importNode($tagsXmlDoc->documentElement, true); |
2547 | + |
2548 | + // Xpath for an existing tags node |
2549 | + $xpath = new DOMXPath($xml); |
2550 | + $tagsNode = $xpath->query("//tags"); |
2551 | + |
2552 | + // Does the tags node exist? |
2553 | + if ($tagsNode->length < 1) |
2554 | + { |
2555 | + // We need to append our new node to the layout node |
2556 | + $layoutXpath = new DOMXPath($xml); |
2557 | + $layoutNode = $xpath->query("//layout"); |
2558 | + $layoutNode = $layoutNode->item(0); |
2559 | + |
2560 | + $layoutNode->appendChild($newTagsNode); |
2561 | + } |
2562 | + else |
2563 | + { |
2564 | + // We need to swap our new node with the existing one |
2565 | + $tagsNode = $tagsNode->item(0); |
2566 | + |
2567 | + // Replace the node |
2568 | + $tagsNode->parentNode->replaceChild($newTagsNode, $tagsNode); |
2569 | + } |
2570 | + |
2571 | + // Format the output a bit nicer for Alex |
2572 | + $xml->formatOutput = true; |
2573 | + |
2574 | + // Convert back to XML |
2575 | + $xml = $xml->saveXML(); |
2576 | + |
2577 | + Debug::LogEntry($db, 'audit', $xml, 'layout', 'EditTags'); |
2578 | + |
2579 | + // Save it |
2580 | + if (!$this->SetLayoutXml($layoutID, $xml)) return false; |
2581 | + |
2582 | + Debug::LogEntry($db, 'audit', 'OUT', 'Layout', 'EditTags'); |
2583 | + |
2584 | + return true; |
2585 | + } |
2586 | + |
2587 | + /** |
2588 | + * Sets the Layout XML for this layoutid |
2589 | + * @return |
2590 | + * @param $layoutID Object |
2591 | + */ |
2592 | + private function SetXml($layoutID) |
2593 | + { |
2594 | + if(!$this->xml = $this->GetLayoutXml($layoutID)) |
2595 | + { |
2596 | + return false; |
2597 | + } |
2598 | + |
2599 | + return true; |
2600 | + } |
2601 | + |
2602 | + /** |
2603 | + * Gets the Xml for the specified layout |
2604 | + * @return |
2605 | + * @param $layoutid Object |
2606 | + */ |
2607 | + private function GetLayoutXml($layoutid) |
2608 | + { |
2609 | + $db =& $this->db; |
2610 | + |
2611 | + Debug::LogEntry($db, 'audit', 'IN', 'Layout', 'GetLayoutXml'); |
2612 | + |
2613 | + //Get the Xml for this Layout from the DB |
2614 | + $SQL = sprintf("SELECT xml FROM layout WHERE layoutID = %d ", $layoutid); |
2615 | + |
2616 | + if (!$results = $db->query($SQL)) |
2617 | + { |
2618 | + trigger_error($db->error()); |
2619 | + $this->SetError(25000, 'Layout does not exist.'); |
2620 | + return false; |
2621 | + } |
2622 | + |
2623 | + $row = $db->get_row($results) ; |
2624 | + |
2625 | + Debug::LogEntry($db, 'audit', 'OUT', 'Layout', 'GetLayoutXml'); |
2626 | + |
2627 | + return $row[0]; |
2628 | + } |
2629 | + |
2630 | + /** |
2631 | + * Sets the Layout Xml and writes it back to the database |
2632 | + * @return |
2633 | + * @param $layoutid Object |
2634 | + * @param $xml Object |
2635 | + */ |
2636 | + private function SetLayoutXml($layoutid, $xml) |
2637 | + { |
2638 | + $db =& $this->db; |
2639 | + |
2640 | + Debug::LogEntry($db, 'audit', 'IN', 'Layout', 'SetLayoutXml'); |
2641 | + |
2642 | + $xml = addslashes($xml); |
2643 | + |
2644 | + // Write it back to the database |
2645 | + $SQL = sprintf("UPDATE layout SET xml = '%s' WHERE layoutID = %d ", $xml, $layoutid); |
2646 | + |
2647 | + |
2648 | + if (!$db->query($SQL)) |
2649 | + { |
2650 | + trigger_error($db->error()); |
2651 | + $this->SetError(25000, 'Unable to Update Layout.'); |
2652 | + return false; |
2653 | + } |
2654 | + |
2655 | + Debug::LogEntry($db, 'audit', 'OUT', 'Layout', 'SetLayoutXml'); |
2656 | + |
2657 | + return true; |
2658 | + } |
2659 | +} |
2660 | +?> |
2661 | \ No newline at end of file |
2662 | |
2663 | === added file 'server/lib/data/stat.data.class.php' |
2664 | --- server/lib/data/stat.data.class.php 1970-01-01 00:00:00 +0000 |
2665 | +++ server/lib/data/stat.data.class.php 2009-07-30 23:01:31 +0000 |
2666 | @@ -0,0 +1,44 @@ |
2667 | +<?php |
2668 | +/* |
2669 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
2670 | + * Copyright (C) 2009 Daniel Garner |
2671 | + * |
2672 | + * This file is part of Xibo. |
2673 | + * |
2674 | + * Xibo is free software: you can redistribute it and/or modify |
2675 | + * it under the terms of the GNU Affero General Public License as published by |
2676 | + * the Free Software Foundation, either version 3 of the License, or |
2677 | + * any later version. |
2678 | + * |
2679 | + * Xibo is distributed in the hope that it will be useful, |
2680 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2681 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2682 | + * GNU Affero General Public License for more details. |
2683 | + * |
2684 | + * You should have received a copy of the GNU Affero General Public License |
2685 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
2686 | + */ |
2687 | +defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser."); |
2688 | + |
2689 | +class Stat extends data |
2690 | +{ |
2691 | + public function Add($type, $fromDT, $toDT, $scheduleID, $displayID, $layoutID, $mediaID) |
2692 | + { |
2693 | + $db =& $this->db; |
2694 | + $statDate = date("Y-m-d H:i:s"); |
2695 | + |
2696 | + $SQL = ""; |
2697 | + $SQL .= " INSERT INTO stat (statDate, scheduleID, displayID, layoutID, mediaID, start, end)"; |
2698 | + $SQL .= sprintf(" VALUES ('%s', %d, %d, %d, '%s', '%s', '%s')", $statDate, $scheduleID, $displayID, $layoutID, $db->escape_string($mediaID), $fromDT, $toDT); |
2699 | + |
2700 | + if (!$db->query($SQL)) |
2701 | + { |
2702 | + trigger_error($db->error()); |
2703 | + $this->SetError(25000, 'Stat Insert Failed.'); |
2704 | + return false; |
2705 | + } |
2706 | + |
2707 | + return true; |
2708 | + } |
2709 | +} |
2710 | +?> |
2711 | \ No newline at end of file |
2712 | |
2713 | === modified file 'server/lib/pages/layout.class.php' |
2714 | --- server/lib/pages/layout.class.php 2009-04-27 19:28:08 +0000 |
2715 | +++ server/lib/pages/layout.class.php 2009-07-30 23:01:31 +0000 |
2716 | @@ -57,6 +57,9 @@ |
2717 | $ajax = Kit::GetParam('ajax', _GET, _WORD, 'false'); |
2718 | |
2719 | $this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT); |
2720 | + |
2721 | + // Include the layout data class |
2722 | + include_once("lib/data/layout.data.class.php"); |
2723 | |
2724 | //set the information that we know |
2725 | if ($usertype == 1) $this->isadmin = true; |
2726 | @@ -289,6 +292,18 @@ |
2727 | $response->SetError("Unknown error adding layout."); |
2728 | $response->Respond(); |
2729 | } |
2730 | + |
2731 | + // Create an array out of the tags |
2732 | + $tagsArray = split(' ', $tags); |
2733 | + |
2734 | + // Add the tags XML to the layout |
2735 | + $layoutObject = new Layout($db); |
2736 | + |
2737 | + if (!$layoutObject->EditTags($id, $tagsArray)) |
2738 | + { |
2739 | + //there was an ERROR |
2740 | + trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR); |
2741 | + } |
2742 | |
2743 | $response->SetFormSubmitResponse('Layout Details Changed.', true, sprintf("index.php?p=layout&layoutid=%d&modify=true", $id)); |
2744 | $response->Respond(); |
2745 | @@ -399,6 +414,18 @@ |
2746 | $response->SetError(sprintf("Unknown error editing %s", $layout)); |
2747 | $response->Respond(); |
2748 | } |
2749 | + |
2750 | + // Create an array out of the tags |
2751 | + $tagsArray = split(' ', $tags); |
2752 | + |
2753 | + // Add the tags XML to the layout |
2754 | + $layoutObject = new Layout($db); |
2755 | + |
2756 | + if (!$layoutObject->EditTags($this->layoutid, $tagsArray)) |
2757 | + { |
2758 | + //there was an ERROR |
2759 | + trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR); |
2760 | + } |
2761 | |
2762 | $response->SetFormSubmitResponse('Layout Details Changed.'); |
2763 | $response->Respond(); |
2764 | @@ -1194,8 +1221,12 @@ |
2765 | $paddingTop = $regionHeight / 2 - 16; |
2766 | $paddingTop = $paddingTop . "px"; |
2767 | |
2768 | + $regionTransparency = '<div class="regionTransparency" style="width:100%; height:100%;">'; |
2769 | + $regionTransparency .= '</div>'; |
2770 | + |
2771 | $doubleClickLink = "XiboFormRender($(this).attr('href'))"; |
2772 | - $regionHtml .= "<div id='region_$regionid' regionid='$regionid' layoutid='$this->layoutid' href='index.php?p=layout&layoutid=$this->layoutid®ionid=$regionid&q=RegionOptions' ondblclick=\"$doubleClickLink\"' class='region' style=\"position:absolute; width:$regionWidth; height:$regionHeight; top: $regionTop; left: $regionLeft; background-color: #FFF; opacity: .75; filter: alpha(opacity=75); border: 1px dashed #000\"> |
2773 | + $regionHtml .= "<div id='region_$regionid' regionid='$regionid' layoutid='$this->layoutid' href='index.php?p=layout&layoutid=$this->layoutid®ionid=$regionid&q=RegionOptions' ondblclick=\"$doubleClickLink\"' class='region' style=\"position:absolute; width:$regionWidth; height:$regionHeight; top: $regionTop; left: $regionLeft; border: 1px dashed #000\"> |
2774 | + $regionTransparency |
2775 | <div class='preview' style='$previewStyle'> |
2776 | <div class='previewContent'></div> |
2777 | <div class='previewNav' style='display:none;'></div> |
2778 | @@ -1435,7 +1466,7 @@ |
2779 | while ($modulesItem = $enabledModules->GetNextModule()) |
2780 | { |
2781 | $mod = Kit::ValidateParam($modulesItem['Module'], _STRING); |
2782 | - $caption = 'Add ' . $mod; |
2783 | + $caption = '+ ' . $mod; |
2784 | $mod = strtolower($mod); |
2785 | $title = Kit::ValidateParam($modulesItem['Description'], _STRING); |
2786 | $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING); |
2787 | @@ -1445,7 +1476,7 @@ |
2788 | $buttons .= <<<HTML |
2789 | <div class="regionicons"> |
2790 | <a class="XiboFormButton" title="$title" href="$uri"> |
2791 | - <img class="dash_button" src="$img" /> |
2792 | + <img class="dash_button moduleButtonImage" src="$img" /> |
2793 | <span class="dash_text">$caption</span></a> |
2794 | </div> |
2795 | HTML; |
2796 | @@ -1456,7 +1487,7 @@ |
2797 | <div id="buttons"> |
2798 | <div class="regionicons"> |
2799 | <a class="XiboFormButton" href="index.php?p=content&q=LibraryAssignForm&layoutid=$this->layoutid®ionid=$regionid" title="Library"> |
2800 | - <img class="region_button" src="img/forms/library.gif"/> |
2801 | + <img class="region_button moduleButtonImage" src="img/forms/library.gif"/> |
2802 | <span class="region_text">Library</span></a> |
2803 | </div> |
2804 | $buttons |
2805 | @@ -1635,7 +1666,7 @@ |
2806 | $type = (string) $node->getAttribute("type"); |
2807 | $mediaDurationText = (string) $node->getAttribute("duration"); |
2808 | |
2809 | - $return .= "<div class='info' style='display:none; position:absolute; top: 15px; left: 150px; background-color:#FFF; z-index: 50;'> |
2810 | + $return .= "<div class='info regionTransparency' style='display:none; position:absolute; top: 15px; left: 150px; background-color:#FFF; z-index: 50;'> |
2811 | <h5>Media Information</h5> |
2812 | <ul> |
2813 | <li>Type: $type</li> |
2814 | |
2815 | === modified file 'server/lib/pages/region.class.php' |
2816 | --- server/lib/pages/region.class.php 2009-01-23 19:29:48 +0000 |
2817 | +++ server/lib/pages/region.class.php 2009-07-30 23:01:31 +0000 |
2818 | @@ -404,7 +404,7 @@ |
2819 | $mediaNodeList = $xpath->query("//region[@id='$regionid']/media[@lkid='$lkid']"); |
2820 | } |
2821 | |
2822 | - //Get the old media node (the one we are to replace) |
2823 | + // Get the old media node (the one we are to replace) |
2824 | $oldMediaNode = $mediaNodeList->item(0); |
2825 | |
2826 | //Get the LkId of the current record... if its not blank we want to update this link with the new id |
2827 | |
2828 | === modified file 'server/lib/xmds.inc.php' |
2829 | --- server/lib/xmds.inc.php 2009-03-22 12:06:30 +0000 |
2830 | +++ server/lib/xmds.inc.php 2009-07-28 21:08:19 +0000 |
2831 | @@ -27,9 +27,9 @@ |
2832 | require_once("lib/app/app_functions.php"); |
2833 | require_once("lib/app/debug.class.php"); |
2834 | require_once("lib/app/kit.class.php"); |
2835 | - |
2836 | +require_once("lib/data/data.class.php"); |
2837 | require_once("config/db_config.php"); |
2838 | -require_once("config/config.class.php"); |
2839 | |
2840 | +require_once("config/config.class.php"); |
2841 | include_once('lib/data/stat.data.class.php'); |
2842 | |
2843 | // Sort out magic quotes |
2844 | if (get_magic_quotes_gpc()) |
2845 | |
2846 | === added file 'server/modules/embedded.module.php' |
2847 | --- server/modules/embedded.module.php 1970-01-01 00:00:00 +0000 |
2848 | +++ server/modules/embedded.module.php 2009-06-20 10:05:53 +0000 |
2849 | @@ -0,0 +1,251 @@ |
2850 | +<?php |
2851 | +/* |
2852 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
2853 | + * Copyright (C) 2009 Daniel Garner |
2854 | + * |
2855 | + * This file is part of Xibo. |
2856 | + * |
2857 | + * Xibo is free software: you can redistribute it and/or modify |
2858 | + * it under the terms of the GNU Affero General Public License as published by |
2859 | + * the Free Software Foundation, either version 3 of the License, or |
2860 | + * any later version. |
2861 | + * |
2862 | + * Xibo is distributed in the hope that it will be useful, |
2863 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2864 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2865 | + * GNU Affero General Public License for more details. |
2866 | + * |
2867 | + * You should have received a copy of the GNU Affero General Public License |
2868 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
2869 | + */ |
2870 | +class embedded extends Module |
2871 | +{ |
2872 | + |
2873 | + public function __construct(database $db, user $user, $mediaid = '', $layoutid = '', $regionid = '') |
2874 | + { |
2875 | + // Must set the type of the class |
2876 | + $this->type = 'embedded'; |
2877 | + |
2878 | + // Must call the parent class |
2879 | + parent::__construct($db, $user, $mediaid, $layoutid, $regionid); |
2880 | + } |
2881 | + |
2882 | + /** |
2883 | + * Return the Add Form as HTML |
2884 | + * @return |
2885 | + */ |
2886 | + public function AddForm() |
2887 | + { |
2888 | + $db =& $this->db; |
2889 | + $user =& $this->user; |
2890 | + |
2891 | + // Would like to get the regions width / height |
2892 | + $layoutid = $this->layoutid; |
2893 | + $regionid = $this->regionid; |
2894 | + $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING); |
2895 | + $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING); |
2896 | + |
2897 | + $form = <<<FORM |
2898 | + <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=AddMedia"> |
2899 | + <input type="hidden" name="layoutid" value="$layoutid"> |
2900 | + <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
2901 | + <table> |
2902 | + <tr> |
2903 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
2904 | + <td><input id="duration" name="duration" type="text"></td> |
2905 | + </tr> |
2906 | + <tr> |
2907 | + <td colspan="2"> |
2908 | + <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br /> |
2909 | + <textarea id="embedHtml" name="embedHtml"></textarea> |
2910 | + </td> |
2911 | + </tr> |
2912 | + <tr> |
2913 | + <td></td> |
2914 | + <td> |
2915 | + <input id="btnSave" type="submit" value="Save" /> |
2916 | + <input class="XiboFormButton" id="btnCancel" type="button" title="Return to the Region Options" href="index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions" value="Cancel" /> |
2917 | + </td> |
2918 | + </tr> |
2919 | + </table> |
2920 | + </form> |
2921 | +FORM; |
2922 | + |
2923 | + $this->response->html = $form; |
2924 | + $this->response->dialogTitle = 'Add Embedded HTML'; |
2925 | + $this->response->dialogSize = true; |
2926 | + $this->response->dialogWidth = '650px'; |
2927 | + $this->response->dialogHeight = '450px'; |
2928 | + |
2929 | + return $this->response; |
2930 | + } |
2931 | + |
2932 | + /** |
2933 | + * Return the Edit Form as HTML |
2934 | + * @return |
2935 | + */ |
2936 | + public function EditForm() |
2937 | + { |
2938 | + $db =& $this->db; |
2939 | + |
2940 | + $layoutid = $this->layoutid; |
2941 | + $regionid = $this->regionid; |
2942 | + $mediaid = $this->mediaid; |
2943 | + |
2944 | + // Get the embedded HTML out of RAW |
2945 | + $rawXml = new DOMDocument(); |
2946 | + $rawXml->loadXML($this->GetRaw()); |
2947 | + |
2948 | + Debug::LogEntry($db, 'audit', 'Raw XML returned: ' . $this->GetRaw()); |
2949 | + |
2950 | + // Get the HTML Node out of this |
2951 | + $textNodes = $rawXml->getElementsByTagName('embedHtml'); |
2952 | + $textNode = $textNodes->item(0); |
2953 | + $embedHtml = $textNode->nodeValue; |
2954 | + |
2955 | + //Output the form |
2956 | + $form = <<<FORM |
2957 | + <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
2958 | + <input type="hidden" name="layoutid" value="$layoutid"> |
2959 | + <input type="hidden" name="mediaid" value="$mediaid"> |
2960 | + <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
2961 | + <table> |
2962 | + <tr> |
2963 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed (may be overridden on each layout)">Duration<span class="required">*</span></label></td> |
2964 | + <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
2965 | + </tr> |
2966 | + <tr> |
2967 | + <td colspan="2"> |
2968 | + <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br /> |
2969 | + <textarea id="embedHtml" name="embedHtml">$embedHtml</textarea> |
2970 | + </td> |
2971 | + </tr> |
2972 | + <tr> |
2973 | + <td></td> |
2974 | + <td> |
2975 | + <input id="btnSave" type="submit" value="Save" /> |
2976 | + <input class="XiboFormButton" id="btnCancel" type="button" title="Return to the Region Options" href="index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions" value="Cancel" /> |
2977 | + </td> |
2978 | + </tr> |
2979 | + </table> |
2980 | + </form> |
2981 | +FORM; |
2982 | + |
2983 | + $this->response->html = $form; |
2984 | + $this->response->dialogTitle = 'Edit Embedded HTML'; |
2985 | + $this->response->dialogSize = true; |
2986 | + $this->response->dialogWidth = '650px'; |
2987 | + $this->response->dialogHeight = '450px'; |
2988 | + |
2989 | + return $this->response; |
2990 | + } |
2991 | + |
2992 | + /** |
2993 | + * Add Media to the Database |
2994 | + * @return |
2995 | + */ |
2996 | + public function AddMedia() |
2997 | + { |
2998 | + $db =& $this->db; |
2999 | + |
3000 | + $layoutid = $this->layoutid; |
3001 | + $regionid = $this->regionid; |
3002 | + $mediaid = $this->mediaid; |
3003 | + |
3004 | + //Other properties |
3005 | + $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING); |
3006 | + $duration = Kit::GetParam('duration', _POST, _INT, 0); |
3007 | + |
3008 | + $url = "index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions"; |
3009 | + |
3010 | + //Validate the URL? |
3011 | + if ($embedHtml == "") |
3012 | + { |
3013 | + $this->response->SetError('Please enter some HTML to embed.'); |
3014 | + $this->response->keepOpen = true; |
3015 | + return $this->response; |
3016 | + } |
3017 | + |
3018 | + if ($duration == 0) |
3019 | + { |
3020 | + $this->response->SetError('You must enter a duration.'); |
3021 | + $this->response->keepOpen = true; |
3022 | + return $this->response; |
3023 | + } |
3024 | + |
3025 | + // Required Attributes |
3026 | + $this->mediaid = md5(uniqid()); |
3027 | + $this->duration = $duration; |
3028 | + |
3029 | + // Any Options |
3030 | + $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>'); |
3031 | + |
3032 | + // Should have built the media object entirely by this time |
3033 | + // This saves the Media Object to the Region |
3034 | + $this->UpdateRegion(); |
3035 | + |
3036 | + //Set this as the session information |
3037 | + setSession('content', 'type', $this->type); |
3038 | + |
3039 | + // We want to load a new form |
3040 | + $this->response->loadForm = true; |
3041 | + $this->response->loadFormUri= $url; |
3042 | + |
3043 | + return $this->response; |
3044 | + } |
3045 | + |
3046 | + /** |
3047 | + * Edit Media in the Database |
3048 | + * @return |
3049 | + */ |
3050 | + public function EditMedia() |
3051 | + { |
3052 | + $db =& $this->db; |
3053 | + |
3054 | + $layoutid = $this->layoutid; |
3055 | + $regionid = $this->regionid; |
3056 | + $mediaid = $this->mediaid; |
3057 | + |
3058 | + //Other properties |
3059 | + $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING); |
3060 | + $duration = Kit::GetParam('duration', _POST, _INT, 0); |
3061 | + |
3062 | + $url = "index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions"; |
3063 | + |
3064 | + //Validate the URL? |
3065 | + if ($embedHtml == "") |
3066 | + { |
3067 | + $this->response->SetError('Please enter some HTML to embed.'); |
3068 | + $this->response->keepOpen = true; |
3069 | + return $this->response; |
3070 | + } |
3071 | + |
3072 | + if ($duration == 0) |
3073 | + { |
3074 | + $this->response->SetError('You must enter a duration.'); |
3075 | + $this->response->keepOpen = true; |
3076 | + return $this->response; |
3077 | + } |
3078 | + |
3079 | + // Required Attributes |
3080 | + $this->duration = $duration; |
3081 | + |
3082 | + // Any Options |
3083 | + $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>'); |
3084 | + |
3085 | + // Should have built the media object entirely by this time |
3086 | + // This saves the Media Object to the Region |
3087 | + $this->UpdateRegion(); |
3088 | + |
3089 | + //Set this as the session information |
3090 | + setSession('content', 'type', $this->type); |
3091 | + |
3092 | + // We want to load a new form |
3093 | + $this->response->loadForm = true; |
3094 | + $this->response->loadFormUri= $url; |
3095 | + |
3096 | + return $this->response; |
3097 | + } |
3098 | +} |
3099 | + |
3100 | +?> |
3101 | \ No newline at end of file |
3102 | |
3103 | === modified file 'server/modules/flash.module.php' |
3104 | --- server/modules/flash.module.php 2009-03-10 19:29:40 +0000 |
3105 | +++ server/modules/flash.module.php 2009-05-24 09:59:49 +0000 |
3106 | @@ -300,7 +300,8 @@ |
3107 | <img src="img/loading.gif"><span style="padding-left:10px">You may fill in the form while your file is uploading.</span> |
3108 | </div> |
3109 | <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
3110 | - <input type="hidden" name="MAX_FILE_SIZE" value="1048576000"> |
3111 | + <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
3112 | + <input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /> |
3113 | <input type="hidden" name="layoutid" value="$layoutid"> |
3114 | <input type="hidden" name="regionid" value="$regionid"> |
3115 | <input type="hidden" name="mediaid" value="$mediaid"> |
3116 | @@ -727,8 +728,17 @@ |
3117 | |
3118 | $SQL = sprintf($SQL, $db->escape_string($name), $this->type, $db->escape_string($duration), $db->escape_string($fileName), $permissionid, $userid); |
3119 | |
3120 | + if (!$new_mediaid = $db->insert_query($SQL)) |
3121 | + { |
3122 | + trigger_error($db->error()); |
3123 | + trigger_error('Error inserting replacement media record.', E_USER_ERROR); |
3124 | + } |
3125 | + |
3126 | //What are we going to store this media as... |
3127 | $storedAs = $new_mediaid.".".$ext; |
3128 | + |
3129 | + // File upload directory.. get this from the settings object |
3130 | + $databaseDir = Config::GetSetting($db, "LIBRARY_LOCATION"); |
3131 | |
3132 | //Now we need to move the file |
3133 | if (!$result = rename($databaseDir."/temp/".$tmpName, $databaseDir.$storedAs)) |
3134 | @@ -754,9 +764,11 @@ |
3135 | return $this->response; |
3136 | } |
3137 | |
3138 | - //Update the existing record with the new record's id |
3139 | - $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $mediaid "; |
3140 | - $SQL .= " WHERE editedMediaID = $mediaid and mediaID <> $new_mediaid "; |
3141 | + // Update the existing record with the new record's id |
3142 | + $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $new_mediaid "; |
3143 | + $SQL .= " WHERE IFNULL(editedMediaID,0) <> $new_mediaid AND mediaID = $mediaid "; |
3144 | + |
3145 | + Debug::LogEntry($db, 'audit', $SQL); |
3146 | |
3147 | if (!$db->query($SQL)) |
3148 | { |
3149 | |
3150 | === modified file 'server/modules/image.module.php' |
3151 | --- server/modules/image.module.php 2009-03-08 00:23:29 +0000 |
3152 | +++ server/modules/image.module.php 2009-05-24 09:59:49 +0000 |
3153 | @@ -300,7 +300,8 @@ |
3154 | <img src="img/loading.gif"><span style="padding-left:10px">You may fill in the form while your file is uploading.</span> |
3155 | </div> |
3156 | <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
3157 | - <input type="hidden" name="MAX_FILE_SIZE" value="1048576000"> |
3158 | + <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
3159 | + <input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /> |
3160 | <input type="hidden" name="layoutid" value="$layoutid"> |
3161 | <input type="hidden" name="regionid" value="$regionid"> |
3162 | <input type="hidden" name="mediaid" value="$mediaid"> |
3163 | @@ -729,9 +730,18 @@ |
3164 | $SQL .= "VALUES ('%s', 'image', '%s', '%s', %d, %d, 0) "; |
3165 | |
3166 | $SQL = sprintf($SQL, $db->escape_string($name), $db->escape_string($duration), $db->escape_string($fileName), $permissionid, $userid); |
3167 | + |
3168 | + if (!$new_mediaid = $db->insert_query($SQL)) |
3169 | + { |
3170 | + trigger_error($db->error()); |
3171 | + trigger_error('Error inserting replacement media record.', E_USER_ERROR); |
3172 | + } |
3173 | |
3174 | //What are we going to store this media as... |
3175 | $storedAs = $new_mediaid.".".$ext; |
3176 | + |
3177 | + // File upload directory.. get this from the settings object |
3178 | + $databaseDir = Config::GetSetting($db, "LIBRARY_LOCATION"); |
3179 | |
3180 | //Now we need to move the file |
3181 | if (!$result = rename($databaseDir."/temp/".$tmpName, $databaseDir.$storedAs)) |
3182 | @@ -764,9 +774,11 @@ |
3183 | ResizeImage($databaseDir.$storedAs, $databaseDir."tn_".$storedAs, 80, 80); |
3184 | } |
3185 | |
3186 | - //Update the existing record with the new record's id |
3187 | - $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $mediaid "; |
3188 | - $SQL .= " WHERE editedMediaID = $mediaid and mediaID <> $new_mediaid "; |
3189 | + // Update the existing record with the new record's id |
3190 | + $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $new_mediaid "; |
3191 | + $SQL .= " WHERE IFNULL(editedMediaID,0) <> $new_mediaid AND mediaID = $mediaid "; |
3192 | + |
3193 | + Debug::LogEntry($db, 'audit', $SQL); |
3194 | |
3195 | if (!$db->query($SQL)) |
3196 | { |
3197 | |
3198 | === modified file 'server/modules/powerpoint.module.php' |
3199 | --- server/modules/powerpoint.module.php 2009-03-10 19:29:40 +0000 |
3200 | +++ server/modules/powerpoint.module.php 2009-05-24 09:59:49 +0000 |
3201 | @@ -300,7 +300,8 @@ |
3202 | <img src="img/loading.gif"><span style="padding-left:10px">You may fill in the form while your file is uploading.</span> |
3203 | </div> |
3204 | <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
3205 | - <input type="hidden" name="MAX_FILE_SIZE" value="1048576000"> |
3206 | + <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
3207 | + <input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /> |
3208 | <input type="hidden" name="layoutid" value="$layoutid"> |
3209 | <input type="hidden" name="regionid" value="$regionid"> |
3210 | <input type="hidden" name="mediaid" value="$mediaid"> |
3211 | @@ -726,9 +727,18 @@ |
3212 | $SQL .= "VALUES ('%s', '%s', '%s', '%s', %d, %d, 0) "; |
3213 | |
3214 | $SQL = sprintf($SQL, $db->escape_string($name), $this->type, $db->escape_string($duration), $db->escape_string($fileName), $permissionid, $userid); |
3215 | + |
3216 | + if (!$new_mediaid = $db->insert_query($SQL)) |
3217 | + { |
3218 | + trigger_error($db->error()); |
3219 | + trigger_error('Error inserting replacement media record.', E_USER_ERROR); |
3220 | + } |
3221 | |
3222 | //What are we going to store this media as... |
3223 | $storedAs = $new_mediaid.".".$ext; |
3224 | + |
3225 | + // File upload directory.. get this from the settings object |
3226 | + $databaseDir = Config::GetSetting($db, "LIBRARY_LOCATION"); |
3227 | |
3228 | //Now we need to move the file |
3229 | if (!$result = rename($databaseDir."/temp/".$tmpName, $databaseDir.$storedAs)) |
3230 | @@ -754,9 +764,11 @@ |
3231 | return $this->response; |
3232 | } |
3233 | |
3234 | - //Update the existing record with the new record's id |
3235 | - $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $mediaid "; |
3236 | - $SQL .= " WHERE editedMediaID = $mediaid and mediaID <> $new_mediaid "; |
3237 | + // Update the existing record with the new record's id |
3238 | + $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $new_mediaid "; |
3239 | + $SQL .= " WHERE IFNULL(editedMediaID,0) <> $new_mediaid AND mediaID = $mediaid "; |
3240 | + |
3241 | + Debug::LogEntry($db, 'audit', $SQL); |
3242 | |
3243 | if (!$db->query($SQL)) |
3244 | { |
3245 | |
3246 | === modified file 'server/modules/ticker.module.php' |
3247 | --- server/modules/ticker.module.php 2009-03-13 09:30:23 +0000 |
3248 | +++ server/modules/ticker.module.php 2009-06-18 18:36:21 +0000 |
3249 | @@ -48,7 +48,7 @@ |
3250 | $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING); |
3251 | $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING); |
3252 | |
3253 | - $direction_list = listcontent("none|None,left|Left,right|Right,up|Up,down|Down", "direction"); |
3254 | + $direction_list = listcontent("none|None,left|Left,right|Right,up|Up,down|Down,single|Single", "direction"); |
3255 | |
3256 | $form = <<<FORM |
3257 | <form class="XiboTextForm" method="post" action="index.php?p=module&mod=ticker&q=Exec&method=AddMedia"> |
3258 | @@ -68,6 +68,12 @@ |
3259 | <td><input id="duration" name="duration" type="text"></td> |
3260 | </tr> |
3261 | <tr> |
3262 | + <td><label for="scrollSpeed" title="The scroll speed of the ticker.">Scroll Speed<span class="required">*</span> (lower is faster)</label></td> |
3263 | + <td><input id="scrollSpeed" name="scrollSpeed" type="text" value="30"></td> |
3264 | + <td><label for="updateInterval" title="The Interval at which the client should cache the feed.">Update Interval (mins)<span class="required">*</span></label></td> |
3265 | + <td><input id="updateInterval" name="updateInterval" type="text" value="360"></td> |
3266 | + </tr> |
3267 | + <tr> |
3268 | <td colspan="4"> |
3269 | <textarea id="ta_text" name="ta_text"> |
3270 | [Title] - [Date] - [Description] |
3271 | @@ -104,9 +110,11 @@ |
3272 | $regionid = $this->regionid; |
3273 | $mediaid = $this->mediaid; |
3274 | |
3275 | - $direction = $this->GetOption('direction'); |
3276 | - $copyright = $this->GetOption('copyright'); |
3277 | - $uri = urldecode($this->GetOption('uri')); |
3278 | + $direction = $this->GetOption('direction'); |
3279 | + $copyright = $this->GetOption('copyright'); |
3280 | + $scrollSpeed = $this->GetOption('scrollSpeed'); |
3281 | + $updateInterval = $this->GetOption('updateInterval'); |
3282 | + $uri = urldecode($this->GetOption('uri')); |
3283 | |
3284 | // Get the text out of RAW |
3285 | $rawXml = new DOMDocument(); |
3286 | @@ -119,7 +127,7 @@ |
3287 | $textNode = $textNodes->item(0); |
3288 | $text = $textNode->nodeValue; |
3289 | |
3290 | - $direction_list = listcontent("none|None,left|Left,right|Right,up|Up,down|Down", "direction", $direction); |
3291 | + $direction_list = listcontent("none|None,left|Left,right|Right,up|Up,down|Down,single|Single", "direction", $direction); |
3292 | |
3293 | //Output the form |
3294 | $form = <<<FORM |
3295 | @@ -141,6 +149,12 @@ |
3296 | <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
3297 | </tr> |
3298 | <tr> |
3299 | + <td><label for="scrollSpeed" title="The scroll speed of the ticker.">Scroll Speed<span class="required">*</span> (lower is faster)</label></td> |
3300 | + <td><input id="scrollSpeed" name="scrollSpeed" type="text" value="$scrollSpeed"></td> |
3301 | + <td><label for="updateInterval" title="The Interval at which the client should cache the feed.">Update Interval (mins)<span class="required">*</span></label></td> |
3302 | + <td><input id="updateInterval" name="updateInterval" type="text" value="$updateInterval"></td> |
3303 | + </tr> |
3304 | + <tr> |
3305 | <td colspan="4"> |
3306 | <textarea id="ta_text" name="ta_text">$text</textarea> |
3307 | </td> |
3308 | @@ -179,6 +193,8 @@ |
3309 | $uri = Kit::GetParam('uri', _POST, _URI); |
3310 | $direction = Kit::GetParam('direction', _POST, _WORD, 'none'); |
3311 | $duration = Kit::GetParam('duration', _POST, _INT, 0); |
3312 | + $scrollSpeed = Kit::GetParam('scrollSpeed', _POST, _INT, 30); |
3313 | + $updateInterval = Kit::GetParam('updateInterval', _POST, _INT, 360); |
3314 | $text = Kit::GetParam('ta_text', _POST, _HTMLSTRING); |
3315 | $copyright = Kit::GetParam('copyright', _POST, _STRING); |
3316 | |
3317 | @@ -214,6 +230,8 @@ |
3318 | // Any Options |
3319 | $this->SetOption('direction', $direction); |
3320 | $this->SetOption('copyright', $copyright); |
3321 | + $this->SetOption('scrollSpeed', $scrollSpeed); |
3322 | + $this->SetOption('updateInterval', $updateInterval); |
3323 | $this->SetOption('uri', $uri); |
3324 | |
3325 | $this->SetRaw('<template><![CDATA[' . $text . ']]></template>'); |
3326 | @@ -249,6 +267,8 @@ |
3327 | $direction = Kit::GetParam('direction', _POST, _WORD, 'none'); |
3328 | $duration = Kit::GetParam('duration', _POST, _INT, 0); |
3329 | $text = Kit::GetParam('ta_text', _POST, _HTMLSTRING); |
3330 | + $scrollSpeed = Kit::GetParam('scrollSpeed', _POST, _INT, 30); |
3331 | + $updateInterval = Kit::GetParam('updateInterval', _POST, _INT, 360); |
3332 | $copyright = Kit::GetParam('copyright', _POST, _STRING); |
3333 | |
3334 | $url = "index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions"; |
3335 | @@ -282,6 +302,8 @@ |
3336 | // Any Options |
3337 | $this->SetOption('direction', $direction); |
3338 | $this->SetOption('copyright', $copyright); |
3339 | + $this->SetOption('scrollSpeed', $scrollSpeed); |
3340 | + $this->SetOption('updateInterval', $updateInterval); |
3341 | $this->SetOption('uri', $uri); |
3342 | |
3343 | $this->SetRaw('<template><![CDATA[' . $text . ']]></template>'); |
3344 | |
3345 | === modified file 'server/modules/video.module.php' |
3346 | --- server/modules/video.module.php 2009-04-01 18:31:33 +0000 |
3347 | +++ server/modules/video.module.php 2009-05-24 09:59:49 +0000 |
3348 | @@ -300,11 +300,12 @@ |
3349 | <img src="img/loading.gif"><span style="padding-left:10px">You may fill in the form while your file is uploading.</span> |
3350 | </div> |
3351 | <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
3352 | - <input type="hidden" name="MAX_FILE_SIZE" value="1048576000"> |
3353 | <input type="hidden" name="layoutid" value="$layoutid"> |
3354 | <input type="hidden" name="regionid" value="$regionid"> |
3355 | <input type="hidden" name="mediaid" value="$mediaid"> |
3356 | <input type="hidden" name="lkid" value="$lkid"> |
3357 | + <input type="hidden" name="hidFileID" id="hidFileID" value="" /> |
3358 | + <input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /> |
3359 | <input type="hidden" id="PHPSESSID" value="$sessionId" /> |
3360 | <input type="hidden" id="SecurityToken" value="$securityToken" /> |
3361 | <table> |
3362 | @@ -713,9 +714,18 @@ |
3363 | $SQL .= "VALUES ('%s', '%s', '%s', '%s', %d, %d, 0) "; |
3364 | |
3365 | $SQL = sprintf($SQL, $db->escape_string($name), $this->type, $db->escape_string($duration), $db->escape_string($fileName), $permissionid, $userid); |
3366 | + |
3367 | + if (!$new_mediaid = $db->insert_query($SQL)) |
3368 | + { |
3369 | + trigger_error($db->error()); |
3370 | + trigger_error('Error inserting replacement media record.', E_USER_ERROR); |
3371 | + } |
3372 | |
3373 | //What are we going to store this media as... |
3374 | $storedAs = $new_mediaid.".".$ext; |
3375 | + |
3376 | + // File upload directory.. get this from the settings object |
3377 | + $databaseDir = Config::GetSetting($db, "LIBRARY_LOCATION"); |
3378 | |
3379 | //Now we need to move the file |
3380 | if (!$result = rename($databaseDir."/temp/".$tmpName, $databaseDir.$storedAs)) |
3381 | @@ -731,7 +741,7 @@ |
3382 | } |
3383 | } |
3384 | |
3385 | - //Update the media record to include this information |
3386 | + // Update the media record to include this information |
3387 | $SQL = "UPDATE media SET storedAs = '$storedAs' WHERE mediaid = $new_mediaid"; |
3388 | if (!$db->query($SQL)) |
3389 | { |
3390 | @@ -741,9 +751,11 @@ |
3391 | return $this->response; |
3392 | } |
3393 | |
3394 | - //Update the existing record with the new record's id |
3395 | - $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $mediaid "; |
3396 | - $SQL .= " WHERE editedMediaID = $mediaid and mediaID <> $new_mediaid "; |
3397 | + // Update the existing record with the new record's id |
3398 | + $SQL = "UPDATE media SET isEdited = 1, editedMediaID = $new_mediaid "; |
3399 | + $SQL .= " WHERE IFNULL(editedMediaID,0) <> $new_mediaid AND mediaID = $mediaid "; |
3400 | + |
3401 | + Debug::LogEntry($db, 'audit', $SQL); |
3402 | |
3403 | if (!$db->query($SQL)) |
3404 | { |
3405 | |
3406 | === modified file 'server/template/css/presentation.css' |
3407 | --- server/template/css/presentation.css 2009-01-04 12:59:11 +0000 |
3408 | +++ server/template/css/presentation.css 2009-06-20 09:34:43 +0000 |
3409 | @@ -1153,6 +1153,21 @@ |
3410 | margin-left:9px; |
3411 | } |
3412 | |
3413 | +.timebar_embedded_left{ |
3414 | + background:url(../../img/forms/green_bar.gif) no-repeat; |
3415 | + background-position:top left; |
3416 | + height:59px; |
3417 | + width:9px; |
3418 | + float:left; |
3419 | +} |
3420 | + |
3421 | +.timebar_embedded_right{ |
3422 | + background:url(../../img/forms/green_bar.gif) no-repeat; |
3423 | + background-position:top right; |
3424 | + height:59px; |
3425 | + margin-left:9px; |
3426 | +} |
3427 | + |
3428 | .timebar_text_left{ |
3429 | background:url(../../img/forms/yellow_bar.gif) no-repeat; |
3430 | background-position:top left; |
3431 | |
3432 | === modified file 'server/template/css/xibo.css' |
3433 | --- server/template/css/xibo.css 2009-03-22 17:58:21 +0000 |
3434 | +++ server/template/css/xibo.css 2009-06-20 12:00:21 +0000 |
3435 | @@ -41,3 +41,19 @@ |
3436 | .ReportFault ol li { |
3437 | display: list-item; |
3438 | } |
3439 | + |
3440 | +.moduleButtonImage { |
3441 | + width: 65px; |
3442 | +} |
3443 | + |
3444 | +#embedHtml { |
3445 | + width: 500px; |
3446 | + height: 310px; |
3447 | +} |
3448 | + |
3449 | +.regionTransparency { |
3450 | + position: absolute; |
3451 | + background-color: #FFF; |
3452 | + opacity: .75; |
3453 | + filter: alpha(opacity=75); |
3454 | +} |
3455 | |
3456 | === modified file 'server/upgrade.php' |
3457 | --- server/upgrade.php 2009-05-02 10:12:58 +0000 |
3458 | +++ server/upgrade.php 2009-06-15 08:16:19 +0000 |
3459 | @@ -249,6 +249,7 @@ |
3460 | backup_tables($db, '*'); |
3461 | echo '</p>'; |
3462 | |
3463 | + $sqlStatementCount = 0; |
3464 | // Now loop over the entire upgrade. Run the SQLs and PHP interleaved. |
3465 | for ($i=$_SESSION['upgradeFrom'] + 1; (($i <= $_SESSION['upgradeTo']) && ($fault==false)) ; $i++) { |
3466 | if (file_exists('install/database/' . $i . '.sql')) { |
3467 | @@ -260,11 +261,12 @@ |
3468 | $sql_file = split_sql_file($sql_file, $delimiter); |
3469 | |
3470 | foreach ($sql_file as $sql) { |
3471 | - print "."; |
3472 | + print "."; |
3473 | + $sqlStatementCount++; |
3474 | flush(); |
3475 | if (! $db->query($sql)) { |
3476 | - $fault = true; |
3477 | - reportError("0", "An error occured populating the database.<br /><br />MySQL Error:<br />" . $db->error()); |
3478 | + $fault = true; |
3479 | + reportError("0", "An error occured populating the database.<br /><br />MySQL Error:<br />" . $db->error() . "<br /><br />SQL executed:<br />" . $sql . "<br /><br />Statement number: " . $sqlStatementCount); |
3480 | } |
3481 | } |
3482 | echo '</p>'; |
3483 | |
3484 | === modified file 'server/xmds.php' |
3485 | --- server/xmds.php 2009-03-30 18:34:54 +0000 |
3486 | +++ server/xmds.php 2009-08-02 17:10:45 +0000 |
3487 | @@ -30,8 +30,6 @@ |
3488 | { |
3489 | global $db; |
3490 | |
3491 | - if (eregi('[^A-Za-z0-9]', $hardwareKey)) return false; |
3492 | - |
3493 | //check in the database for this hardwareKey |
3494 | $SQL = "SELECT licensed, inc_schedule, isAuditing, displayID FROM display WHERE license = '$hardwareKey'"; |
3495 | if (!$result = $db->query($SQL)) |
3496 | @@ -374,7 +372,12 @@ |
3497 | if (Config::GetSetting($db,'PHONE_HOME') == 'On') { |
3498 | // Find out when we last PHONED_HOME :D |
3499 | // If it's been > 28 days since last PHONE_HOME then |
3500 | - if (Config::GetSetting($db,'PHONE_HOME_DATE') < (time() - (60 * 60 * 24 * 28))) { |
3501 | + if (Config::GetSetting($db,'PHONE_HOME_DATE') < (time() - (60 * 60 * 24 * 28))) { |
3502 | + |
3503 | + if ($displayInfo['isAuditing'] == 1) |
3504 | + { |
3505 | + Debug::LogEntry($db, "audit", "PHONE_HOME [IN]", "xmds", "RequiredFiles"); |
3506 | + } |
3507 | |
3508 | // Retrieve number of displays |
3509 | $SQL = "SELECT COUNT(*) |
3510 | @@ -397,9 +400,7 @@ |
3511 | if ($displayInfo['isAuditing'] == 1) |
3512 | { |
3513 | Debug::LogEntry($db, "audit", "PHONE_HOME_URL " . $PHONE_HOME_URL , "xmds", "RequiredFiles"); |
3514 | - } |
3515 | - |
3516 | - @file_get_contents($PHONE_HOME_URL); |
3517 | + } |
3518 | |
3519 | // Set PHONE_HOME_TIME to NOW. |
3520 | $SQL = "UPDATE `setting` |
3521 | @@ -410,6 +411,13 @@ |
3522 | { |
3523 | trigger_error($db->error()); |
3524 | } |
3525 | + |
3526 | + @file_get_contents($PHONE_HOME_URL); |
3527 | + |
3528 | + if ($displayInfo['isAuditing'] == 1) |
3529 | + { |
3530 | + Debug::LogEntry($db, "audit", "PHONE_HOME [OUT]", "xmds", "RequiredFiles"); |
3531 | + } |
3532 | //endif |
3533 | } |
3534 | } |
3535 | @@ -544,6 +552,7 @@ |
3536 | $SQL .= " INNER JOIN schedule_detail ON schedule_detail.layoutID = layout.layoutID "; |
3537 | $SQL .= " INNER JOIN display ON schedule_detail.displayID = display.displayID "; |
3538 | $SQL .= " WHERE display.license = '$hardwareKey' "; |
3539 | + $SQL .= " AND layout.retired = 0 "; |
3540 | |
3541 | // Store the Base SQL for this display |
3542 | $SQLBase = $SQL; |
3543 | @@ -638,105 +647,7 @@ |
3544 | { |
3545 | global $db; |
3546 | |
3547 | - // Sanitize |
3548 | - $serverKey = Kit::ValidateParam($serverKey, _STRING); |
3549 | - $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING); |
3550 | - $version = Kit::ValidateParam($version, _STRING); |
3551 | - |
3552 | - // Make sure we are talking the same language |
3553 | - if (!CheckVersion($version)) |
3554 | - { |
3555 | - return new soap_fault("SOAP-ENV:Client", "", "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk", $serverKey); |
3556 | - } |
3557 | - |
3558 | - //auth this request... |
3559 | - if (!$displayInfo = Auth($hardwareKey)) |
3560 | - { |
3561 | - return new soap_fault("SOAP-ENV:Client", "", "This display client is not licensed", $hardwareKey); |
3562 | - } |
3563 | - |
3564 | - if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "[IN]", "xmds", "RecieveXmlLog", "", $displayInfo['displayid']); |
3565 | - if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "$xml", "xmds", "RecieveXmlLog", "", $displayInfo['displayid']); |
3566 | - |
3567 | - $document = new DOMDocument("1.0"); |
3568 | - $document->loadXML("<log>".$xml."</log>"); |
3569 | - |
3570 | - foreach ($document->documentElement->childNodes as $node) |
3571 | - { |
3572 | - //Zero out the common vars |
3573 | - $date = ""; |
3574 | - $message = ""; |
3575 | - $scheduleID = ""; |
3576 | - $layoutID = ""; |
3577 | - $mediaID = ""; |
3578 | - $type = ""; |
3579 | - $cat = ''; |
3580 | - |
3581 | - // Get the date and the message (all log types have these) |
3582 | - foreach ($node->childNodes as $nodeElements) |
3583 | - { |
3584 | - if ($nodeElements->nodeName == "date") |
3585 | - { |
3586 | - $date = $nodeElements->textContent; |
3587 | - } |
3588 | - else if ($nodeElements->nodeName == "message") |
3589 | - { |
3590 | - $message = $nodeElements->textContent; |
3591 | - } |
3592 | - else if ($nodeElements->nodeName == "scheduleID") |
3593 | - { |
3594 | - $scheduleID = $nodeElements->textContent; |
3595 | - } |
3596 | - else if ($nodeElements->nodeName == "layoutID") |
3597 | - { |
3598 | - $layoutID = $nodeElements->textContent; |
3599 | - } |
3600 | - else if ($nodeElements->nodeName == "mediaID") |
3601 | - { |
3602 | - $mediaID = $nodeElements->textContent; |
3603 | - } |
3604 | - else if ($nodeElements->nodeName == "type") |
3605 | - { |
3606 | - $type = $nodeElements->textContent; |
3607 | - } |
3608 | - else if ($nodeElements->nodeName == "category") |
3609 | - { |
3610 | - $cat = $nodeElements->textContent; |
3611 | - } |
3612 | - } |
3613 | - |
3614 | - switch ($node->nodeName) |
3615 | - { |
3616 | - case "stat": |
3617 | - if ($mediaID == '') $mediaID = 0; |
3618 | - |
3619 | - StatRecord($type, $date, $scheduleID, $displayInfo['displayid'], $layoutID, $mediaID, $date, $date); |
3620 | - break; |
3621 | - |
3622 | - case "trace": |
3623 | - |
3624 | - // We have a trace message |
3625 | - // Either Audit or Error (if *) |
3626 | - if (substr($message, 0, 3) == '[*]') |
3627 | - { |
3628 | - Debug::LogEntry($db, "error", $message, ".NET Client", $cat, $date, $displayInfo['displayid'], $scheduleID, $layoutID, $mediaID); |
3629 | - } |
3630 | - else |
3631 | - { |
3632 | - Debug::LogEntry($db, "audit", $message, ".NET Client", $cat, $date, $displayInfo['displayid'], $scheduleID, $layoutID, $mediaID); |
3633 | - } |
3634 | - |
3635 | - break; |
3636 | - |
3637 | - default: |
3638 | - Debug::LogEntry($db, "audit", "Unknown entry in client log " . $node->nodeName, "xmds", "RecieveXmlLog", $date, $displayInfo['displayid'], $scheduleID, $layoutID, $mediaID); |
3639 | - break; |
3640 | - } |
3641 | - } |
3642 | - |
3643 | - if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "[OUT]", "xmds", "RecieveXmlLog", "", $displayInfo['displayid']); |
3644 | - |
3645 | - return true; |
3646 | + return new soap_fault("SOAP-ENV:Client", "", "This is a depricated service call. You should instead call either SubmitLog or SubmitStats", $serverKey); |
3647 | } |
3648 | |
3649 | define('BLACKLIST_ALL', "All"); |
3650 | @@ -825,6 +736,198 @@ |
3651 | return true; |
3652 | } |
3653 | |
3654 | +/** |
3655 | + * Submit client logging |
3656 | + * @return |
3657 | + * @param $version Object |
3658 | + * @param $serverKey Object |
3659 | + * @param $hardwareKey Object |
3660 | + * @param $logXml Object |
3661 | + */ |
3662 | +function SubmitLog($version, $serverKey, $hardwareKey, $logXml) |
3663 | +{ |
3664 | + global $db; |
3665 | + |
3666 | + // Sanitize |
3667 | + $serverKey = Kit::ValidateParam($serverKey, _STRING); |
3668 | + $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING); |
3669 | + $version = Kit::ValidateParam($version, _STRING); |
3670 | + $logXml = Kit::ValidateParam($logXml, _HTMLSTRING); |
3671 | + |
3672 | + // Make sure we are talking the same language |
3673 | + if (!CheckVersion($version)) |
3674 | + { |
3675 | + return new soap_fault("SOAP-ENV:Client", "", "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk", $serverKey); |
3676 | + } |
3677 | + |
3678 | + // Auth this request... |
3679 | + if (!$displayInfo = Auth($hardwareKey)) |
3680 | + { |
3681 | + return new soap_fault("SOAP-ENV:Client", "", "This display client is not licensed", $hardwareKey); |
3682 | + } |
3683 | + |
3684 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "IN", "xmds", "SubmitLog", "", $displayInfo['displayid']); |
3685 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", 'XML [' . $logXml . ']', "xmds", "SubmitLog", "", $displayInfo['displayid']); |
3686 | + |
3687 | + // Load the XML into a DOMDocument |
3688 | + $document = new DOMDocument("1.0"); |
3689 | + |
3690 | + if (!$document->loadXML($logXml)) |
3691 | + { |
3692 | + return new soap_fault("SOAP-ENV:Client", "", "XML Cannot be loaded into DOM Document.", $hardwareKey); |
3693 | + } |
3694 | + |
3695 | + foreach ($document->documentElement->childNodes as $node) |
3696 | + { |
3697 | + //Zero out the common vars |
3698 | + $date = ""; |
3699 | + $message = ""; |
3700 | + $scheduleID = ""; |
3701 | + $layoutID = ""; |
3702 | + $mediaID = ""; |
3703 | + $cat = ''; |
3704 | + $method = ''; |
3705 | + |
3706 | + // This will be a bunch of trace nodes |
3707 | + $message = $node->textContent; |
3708 | + |
3709 | + // Each element should have a category and a date |
3710 | + $date = $node->getAttribute('date'); |
3711 | + $cat = $node->getAttribute('category'); |
3712 | + |
3713 | + if ($date == '' || $cat == '') |
3714 | + { |
3715 | + trigger_error('Log submitted without a date or category attribute'); |
3716 | + continue; |
3717 | + } |
3718 | + |
3719 | + // Get the date and the message (all log types have these) |
3720 | + foreach ($node->childNodes as $nodeElements) |
3721 | + { |
3722 | + if ($nodeElements->nodeName == "scheduleID") |
3723 | + { |
3724 | + $scheduleID = $nodeElements->textContent; |
3725 | + } |
3726 | + else if ($nodeElements->nodeName == "layoutID") |
3727 | + { |
3728 | + $layoutID = $nodeElements->textContent; |
3729 | + } |
3730 | + else if ($nodeElements->nodeName == "mediaID") |
3731 | + { |
3732 | + $mediaID = $nodeElements->textContent; |
3733 | + } |
3734 | + else if ($nodeElements->nodeName == "type") |
3735 | + { |
3736 | + $type = $nodeElements->textContent; |
3737 | + } |
3738 | + else if ($nodeElements->nodeName == "method") |
3739 | + { |
3740 | + $method = $nodeElements->textContent; |
3741 | + } |
3742 | + } |
3743 | + |
3744 | + // We should have enough information to log this now. |
3745 | + if ($cat == 'error' || $cat == 'Error') |
3746 | + { |
3747 | + Debug::LogEntry($db, $cat, $message, 'Client', $method, $date, $displayInfo['displayid'], $scheduleID, $layoutID, $mediaID); |
3748 | + } |
3749 | + else |
3750 | + { |
3751 | + Debug::LogEntry($db, 'audit', $message, 'Client', $method, $date, $displayInfo['displayid'], $scheduleID, $layoutID, $mediaID); |
3752 | + } |
3753 | + } |
3754 | + |
3755 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "OUT", "xmds", "SubmitLog", "", $displayInfo['displayid']); |
3756 | + |
3757 | + return true; |
3758 | +} |
3759 | + |
3760 | +/** |
3761 | + * Submit display statistics to the server |
3762 | + * @return |
3763 | + * @param $version Object |
3764 | + * @param $serverKey Object |
3765 | + * @param $hardwareKey Object |
3766 | + * @param $statXml Object |
3767 | + */ |
3768 | +function SubmitStats($version, $serverKey, $hardwareKey, $statXml) |
3769 | +{ |
3770 | + global $db; |
3771 | + |
3772 | + // Sanitize |
3773 | + $serverKey = Kit::ValidateParam($serverKey, _STRING); |
3774 | + $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING); |
3775 | + $version = Kit::ValidateParam($version, _STRING); |
3776 | + $statXml = Kit::ValidateParam($statXml, _HTMLSTRING); |
3777 | + |
3778 | + // Make sure we are talking the same language |
3779 | + if (!CheckVersion($version)) |
3780 | + { |
3781 | + return new soap_fault("SOAP-ENV:Client", "", "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk", $serverKey); |
3782 | + } |
3783 | + |
3784 | + // Auth this request... |
3785 | + if (!$displayInfo = Auth($hardwareKey)) |
3786 | + { |
3787 | + return new soap_fault("SOAP-ENV:Client", "", "This display client is not licensed", $hardwareKey); |
3788 | + } |
3789 | + |
3790 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "IN", "xmds", "SubmitStats", "", $displayInfo['displayid']); |
3791 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "StatXml: [" . $statXml . "]", "xmds", "SubmitStats", "", $displayInfo['displayid']); |
3792 | + |
3793 | + if ($statXml == "") |
3794 | + { |
3795 | + return new soap_fault("SOAP-ENV:Client", "", "Stat XML is empty.", $hardwareKey); |
3796 | + } |
3797 | + |
3798 | + // Log |
3799 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "About to create Stat Object.", "xmds", "SubmitStats", "", $displayInfo['displayid']); |
3800 | + |
3801 | + $statObject = new Stat($db); |
3802 | + |
3803 | + // Log |
3804 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "About to Create DOMDocument.", "xmds", "SubmitStats", "", $displayInfo['displayid']); |
3805 | + |
3806 | + // Load the XML into a DOMDocument |
3807 | + $document = new DOMDocument("1.0"); |
3808 | + $document->loadXML($statXml); |
3809 | + |
3810 | + foreach ($document->documentElement->childNodes as $node) |
3811 | + { |
3812 | + //Zero out the common vars |
3813 | + $fromdt = ''; |
3814 | + $todt = ''; |
3815 | + $type = ''; |
3816 | + |
3817 | + $scheduleID = ""; |
3818 | + $layoutID = ""; |
3819 | + $mediaID = ""; |
3820 | + |
3821 | + // Each element should have these attributes |
3822 | + $fromdt = $node->getAttribute('fromdt'); |
3823 | + $todt = $node->getAttribute('todt'); |
3824 | + $type = $node->getAttribute('type'); |
3825 | + |
3826 | + if ($fromdt == '' || $todt == '' || $type == '') |
3827 | + { |
3828 | + trigger_error('Stat submitted without the fromdt, todt or type attributes.'); |
3829 | + continue; |
3830 | + } |
3831 | + |
3832 | + $scheduleID = $node->getAttribute('scheduleid'); |
3833 | + $layoutID = $node->getAttribute('layoutid'); |
3834 | + $mediaID = $node->getAttribute('mediaid'); |
3835 | + $tag = $node->getAttribute('tag'); |
3836 | + |
3837 | + // Write the stat record with the information we have available to us. |
3838 | + $statObject->Add($type, $fromdt, $todt, $scheduleID, $displayInfo['displayid'], $layoutID, $mediaID); |
3839 | + } |
3840 | + |
3841 | + if ($displayInfo['isAuditing'] == 1) Debug::LogEntry ($db, "audit", "OUT", "xmds", "SubmitStats", "", $displayInfo['displayid']); |
3842 | + |
3843 | + return true; |
3844 | +} |
3845 | + |
3846 | //$debug = 1; |
3847 | $service = new soap_server(); |
3848 | |
3849 | @@ -889,10 +992,32 @@ |
3850 | 'encoded', |
3851 | 'Set media to be blacklisted' |
3852 | ); |
3853 | + |
3854 | +$service->register("SubmitLog", |
3855 | + array('version' => 'xsd:string', 'serverKey' => 'xsd:string', 'hardwareKey' => 'xsd:string', 'logXml' => 'xsd:string'), |
3856 | + array('success' => 'xsd:boolean'), |
3857 | + 'urn:xmds', |
3858 | + 'urn:xmds#SubmitLog', |
3859 | + 'rpc', |
3860 | + 'encoded', |
3861 | + 'Submit Logging from the Client' |
3862 | + ); |
3863 | + |
3864 | +$service->register("SubmitStats", |
3865 | + array('version' => 'xsd:string', 'serverKey' => 'xsd:string', 'hardwareKey' => 'xsd:string', 'statXml' => 'xsd:string'), |
3866 | + array('success' => 'xsd:boolean'), |
3867 | + 'urn:xmds', |
3868 | + 'urn:xmds#SubmitLog', |
3869 | + 'rpc', |
3870 | + 'encoded', |
3871 | + 'Submit Display statistics from the Client' |
3872 | + ); |
3873 | + |
3874 | + |
3875 | |
3876 | $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; |
3877 | $service->service($HTTP_RAW_POST_DATA); |
3878 | |
3879 | -Debug::LogEntry($db, 'audit',$service->debug_str); |
3880 | +Debug::LogEntry($db, 'audit', $service->debug_str, "xmds", "NuSOAP"); |
3881 | |
3882 | ?> |
3883 | \ No newline at end of file |