Merge lp:~dangarner/xibo/embedded-html-module-102 into lp:xibo/1.0
- embedded-html-module-102
- Merge into halley
Proposed by
Dan Garner
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~dangarner/xibo/embedded-html-module-102 | ||||
Merge into: | lp:xibo/1.0 | ||||
Diff against target: | None lines | ||||
To merge this branch: | bzr merge lp:~dangarner/xibo/embedded-html-module-102 | ||||
Related bugs: |
|
||||
Related blueprints: |
Embed raw HTML
(Low)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dan Garner | Approve | ||
Review via email: mp+7708@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Dan Garner (dangarner) : | # |
review:
Approve
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/Region.cs' |
11 | --- client/dotNET/Region.cs 2009-06-17 21:57:35 +0000 |
12 | +++ client/dotNET/Region.cs 2009-06-20 10:05:53 +0000 |
13 | @@ -124,6 +124,10 @@ |
14 | media = new Rss(options); |
15 | break; |
16 | |
17 | + case "embedded": |
18 | + media = new Text(options); |
19 | + break; |
20 | + |
21 | default: |
22 | //do nothing |
23 | SetNextMediaNode(); |
24 | @@ -200,6 +204,7 @@ |
25 | options.scrollSpeed = 1; |
26 | options.updateInterval = 6; |
27 | options.uri = ""; |
28 | + options.direction = "none"; |
29 | |
30 | // Get a media node |
31 | bool validNode = false; |
32 | @@ -305,6 +310,10 @@ |
33 | { |
34 | options.documentTemplate = raw.InnerText; |
35 | } |
36 | + else if (raw.Name == "embedHtml") |
37 | + { |
38 | + options.text = raw.InnerText; |
39 | + } |
40 | } |
41 | |
42 | // That should cover all the new options |
43 | |
44 | === modified file 'client/dotNET/Rss.cs' |
45 | --- client/dotNET/Rss.cs 2009-06-18 18:36:21 +0000 |
46 | +++ client/dotNET/Rss.cs 2009-06-20 10:39:40 +0000 |
47 | @@ -83,7 +83,7 @@ |
48 | |
49 | try |
50 | { |
51 | - 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()); |
52 | + 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()); |
53 | } |
54 | catch (Exception e) |
55 | { |
56 | @@ -133,7 +133,7 @@ |
57 | |
58 | try |
59 | { |
60 | - System.IO.StreamReader sr = new System.IO.StreamReader(data, true); |
61 | + System.IO.StreamReader sr = new System.IO.StreamReader(data, Encoding.UTF8); |
62 | rssContents = sr.ReadToEnd(); |
63 | |
64 | StreamWriter sw = new StreamWriter(File.Open(rssFilePath, FileMode.Create, FileAccess.Write, FileShare.Read)); |
65 | |
66 | === modified file 'client/dotNET/Text.cs' |
67 | --- client/dotNET/Text.cs 2008-12-19 23:34:13 +0000 |
68 | +++ client/dotNET/Text.cs 2009-06-20 10:39:40 +0000 |
69 | @@ -55,11 +55,12 @@ |
70 | |
71 | try |
72 | { |
73 | - 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()); |
74 | + 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()); |
75 | } |
76 | catch (Exception e) |
77 | { |
78 | - MessageBox.Show(e.Message); |
79 | + System.Diagnostics.Trace.WriteLine(e.Message); |
80 | + return; |
81 | } |
82 | |
83 | webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted); |
84 | |
85 | === modified file 'client/dotNET/bin/Release/XiboClient.XmlSerializers.dll' |
86 | Binary files client/dotNET/bin/Release/XiboClient.XmlSerializers.dll 2009-06-18 18:36:21 +0000 and client/dotNET/bin/Release/XiboClient.XmlSerializers.dll 2009-06-20 10:39:40 +0000 differ |
87 | === modified file 'client/dotNET/bin/Release/XiboClient.exe' |
88 | Binary files client/dotNET/bin/Release/XiboClient.exe 2009-06-18 18:36:21 +0000 and client/dotNET/bin/Release/XiboClient.exe 2009-06-20 10:39:40 +0000 differ |
89 | === modified file 'client/dotNET/bin/Release/XiboClient.pdb' |
90 | Binary files client/dotNET/bin/Release/XiboClient.pdb 2009-06-18 18:36:21 +0000 and client/dotNET/bin/Release/XiboClient.pdb 2009-06-20 10:39:40 +0000 differ |
91 | === added file 'server/install/database/6.sql' |
92 | --- server/install/database/6.sql 1970-01-01 00:00:00 +0000 |
93 | +++ server/install/database/6.sql 2009-06-20 09:34:43 +0000 |
94 | @@ -0,0 +1,16 @@ |
95 | +INSERT INTO `module` ( |
96 | +`ModuleID` , |
97 | +`Module` , |
98 | +`Enabled` , |
99 | +`RegionSpecific` , |
100 | +`Description` , |
101 | +`ImageUri` , |
102 | +`SchemaVersion` |
103 | +) |
104 | +VALUES ( |
105 | +NULL , 'Embedded', '1', '1', 'Embedded HTML', 'img/forms/webpage.gif', '1' |
106 | +); |
107 | + |
108 | +UPDATE `version` SET `app_ver` = '1.0.2'; |
109 | +UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE'; |
110 | +UPDATE `version` SET `DBVersion` = '6'; |
111 | \ No newline at end of file |
112 | |
113 | === modified file 'server/lib/pages/layout.class.php' |
114 | --- server/lib/pages/layout.class.php 2009-04-27 19:28:08 +0000 |
115 | +++ server/lib/pages/layout.class.php 2009-06-20 09:34:43 +0000 |
116 | @@ -1435,7 +1435,7 @@ |
117 | while ($modulesItem = $enabledModules->GetNextModule()) |
118 | { |
119 | $mod = Kit::ValidateParam($modulesItem['Module'], _STRING); |
120 | - $caption = 'Add ' . $mod; |
121 | + $caption = '+ ' . $mod; |
122 | $mod = strtolower($mod); |
123 | $title = Kit::ValidateParam($modulesItem['Description'], _STRING); |
124 | $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING); |
125 | @@ -1445,7 +1445,7 @@ |
126 | $buttons .= <<<HTML |
127 | <div class="regionicons"> |
128 | <a class="XiboFormButton" title="$title" href="$uri"> |
129 | - <img class="dash_button" src="$img" /> |
130 | + <img class="dash_button moduleButtonImage" src="$img" /> |
131 | <span class="dash_text">$caption</span></a> |
132 | </div> |
133 | HTML; |
134 | @@ -1456,7 +1456,7 @@ |
135 | <div id="buttons"> |
136 | <div class="regionicons"> |
137 | <a class="XiboFormButton" href="index.php?p=content&q=LibraryAssignForm&layoutid=$this->layoutid®ionid=$regionid" title="Library"> |
138 | - <img class="region_button" src="img/forms/library.gif"/> |
139 | + <img class="region_button moduleButtonImage" src="img/forms/library.gif"/> |
140 | <span class="region_text">Library</span></a> |
141 | </div> |
142 | $buttons |
143 | |
144 | === added file 'server/modules/embedded.module.php' |
145 | --- server/modules/embedded.module.php 1970-01-01 00:00:00 +0000 |
146 | +++ server/modules/embedded.module.php 2009-06-20 10:05:53 +0000 |
147 | @@ -0,0 +1,251 @@ |
148 | +<?php |
149 | +/* |
150 | + * Xibo - Digitial Signage - http://www.xibo.org.uk |
151 | + * Copyright (C) 2009 Daniel Garner |
152 | + * |
153 | + * This file is part of Xibo. |
154 | + * |
155 | + * Xibo is free software: you can redistribute it and/or modify |
156 | + * it under the terms of the GNU Affero General Public License as published by |
157 | + * the Free Software Foundation, either version 3 of the License, or |
158 | + * any later version. |
159 | + * |
160 | + * Xibo is distributed in the hope that it will be useful, |
161 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
162 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
163 | + * GNU Affero General Public License for more details. |
164 | + * |
165 | + * You should have received a copy of the GNU Affero General Public License |
166 | + * along with Xibo. If not, see <http://www.gnu.org/licenses/>. |
167 | + */ |
168 | +class embedded extends Module |
169 | +{ |
170 | + |
171 | + public function __construct(database $db, user $user, $mediaid = '', $layoutid = '', $regionid = '') |
172 | + { |
173 | + // Must set the type of the class |
174 | + $this->type = 'embedded'; |
175 | + |
176 | + // Must call the parent class |
177 | + parent::__construct($db, $user, $mediaid, $layoutid, $regionid); |
178 | + } |
179 | + |
180 | + /** |
181 | + * Return the Add Form as HTML |
182 | + * @return |
183 | + */ |
184 | + public function AddForm() |
185 | + { |
186 | + $db =& $this->db; |
187 | + $user =& $this->user; |
188 | + |
189 | + // Would like to get the regions width / height |
190 | + $layoutid = $this->layoutid; |
191 | + $regionid = $this->regionid; |
192 | + $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING); |
193 | + $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING); |
194 | + |
195 | + $form = <<<FORM |
196 | + <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=AddMedia"> |
197 | + <input type="hidden" name="layoutid" value="$layoutid"> |
198 | + <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
199 | + <table> |
200 | + <tr> |
201 | + <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td> |
202 | + <td><input id="duration" name="duration" type="text"></td> |
203 | + </tr> |
204 | + <tr> |
205 | + <td colspan="2"> |
206 | + <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br /> |
207 | + <textarea id="embedHtml" name="embedHtml"></textarea> |
208 | + </td> |
209 | + </tr> |
210 | + <tr> |
211 | + <td></td> |
212 | + <td> |
213 | + <input id="btnSave" type="submit" value="Save" /> |
214 | + <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" /> |
215 | + </td> |
216 | + </tr> |
217 | + </table> |
218 | + </form> |
219 | +FORM; |
220 | + |
221 | + $this->response->html = $form; |
222 | + $this->response->dialogTitle = 'Add Embedded HTML'; |
223 | + $this->response->dialogSize = true; |
224 | + $this->response->dialogWidth = '650px'; |
225 | + $this->response->dialogHeight = '450px'; |
226 | + |
227 | + return $this->response; |
228 | + } |
229 | + |
230 | + /** |
231 | + * Return the Edit Form as HTML |
232 | + * @return |
233 | + */ |
234 | + public function EditForm() |
235 | + { |
236 | + $db =& $this->db; |
237 | + |
238 | + $layoutid = $this->layoutid; |
239 | + $regionid = $this->regionid; |
240 | + $mediaid = $this->mediaid; |
241 | + |
242 | + // Get the embedded HTML out of RAW |
243 | + $rawXml = new DOMDocument(); |
244 | + $rawXml->loadXML($this->GetRaw()); |
245 | + |
246 | + Debug::LogEntry($db, 'audit', 'Raw XML returned: ' . $this->GetRaw()); |
247 | + |
248 | + // Get the HTML Node out of this |
249 | + $textNodes = $rawXml->getElementsByTagName('embedHtml'); |
250 | + $textNode = $textNodes->item(0); |
251 | + $embedHtml = $textNode->nodeValue; |
252 | + |
253 | + //Output the form |
254 | + $form = <<<FORM |
255 | + <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia"> |
256 | + <input type="hidden" name="layoutid" value="$layoutid"> |
257 | + <input type="hidden" name="mediaid" value="$mediaid"> |
258 | + <input type="hidden" id="iRegionId" name="regionid" value="$regionid"> |
259 | + <table> |
260 | + <tr> |
261 | + <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> |
262 | + <td><input id="duration" name="duration" value="$this->duration" type="text"></td> |
263 | + </tr> |
264 | + <tr> |
265 | + <td colspan="2"> |
266 | + <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br /> |
267 | + <textarea id="embedHtml" name="embedHtml">$embedHtml</textarea> |
268 | + </td> |
269 | + </tr> |
270 | + <tr> |
271 | + <td></td> |
272 | + <td> |
273 | + <input id="btnSave" type="submit" value="Save" /> |
274 | + <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" /> |
275 | + </td> |
276 | + </tr> |
277 | + </table> |
278 | + </form> |
279 | +FORM; |
280 | + |
281 | + $this->response->html = $form; |
282 | + $this->response->dialogTitle = 'Edit Embedded HTML'; |
283 | + $this->response->dialogSize = true; |
284 | + $this->response->dialogWidth = '650px'; |
285 | + $this->response->dialogHeight = '450px'; |
286 | + |
287 | + return $this->response; |
288 | + } |
289 | + |
290 | + /** |
291 | + * Add Media to the Database |
292 | + * @return |
293 | + */ |
294 | + public function AddMedia() |
295 | + { |
296 | + $db =& $this->db; |
297 | + |
298 | + $layoutid = $this->layoutid; |
299 | + $regionid = $this->regionid; |
300 | + $mediaid = $this->mediaid; |
301 | + |
302 | + //Other properties |
303 | + $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING); |
304 | + $duration = Kit::GetParam('duration', _POST, _INT, 0); |
305 | + |
306 | + $url = "index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions"; |
307 | + |
308 | + //Validate the URL? |
309 | + if ($embedHtml == "") |
310 | + { |
311 | + $this->response->SetError('Please enter some HTML to embed.'); |
312 | + $this->response->keepOpen = true; |
313 | + return $this->response; |
314 | + } |
315 | + |
316 | + if ($duration == 0) |
317 | + { |
318 | + $this->response->SetError('You must enter a duration.'); |
319 | + $this->response->keepOpen = true; |
320 | + return $this->response; |
321 | + } |
322 | + |
323 | + // Required Attributes |
324 | + $this->mediaid = md5(uniqid()); |
325 | + $this->duration = $duration; |
326 | + |
327 | + // Any Options |
328 | + $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>'); |
329 | + |
330 | + // Should have built the media object entirely by this time |
331 | + // This saves the Media Object to the Region |
332 | + $this->UpdateRegion(); |
333 | + |
334 | + //Set this as the session information |
335 | + setSession('content', 'type', $this->type); |
336 | + |
337 | + // We want to load a new form |
338 | + $this->response->loadForm = true; |
339 | + $this->response->loadFormUri= $url; |
340 | + |
341 | + return $this->response; |
342 | + } |
343 | + |
344 | + /** |
345 | + * Edit Media in the Database |
346 | + * @return |
347 | + */ |
348 | + public function EditMedia() |
349 | + { |
350 | + $db =& $this->db; |
351 | + |
352 | + $layoutid = $this->layoutid; |
353 | + $regionid = $this->regionid; |
354 | + $mediaid = $this->mediaid; |
355 | + |
356 | + //Other properties |
357 | + $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING); |
358 | + $duration = Kit::GetParam('duration', _POST, _INT, 0); |
359 | + |
360 | + $url = "index.php?p=layout&layoutid=$layoutid®ionid=$regionid&q=RegionOptions"; |
361 | + |
362 | + //Validate the URL? |
363 | + if ($embedHtml == "") |
364 | + { |
365 | + $this->response->SetError('Please enter some HTML to embed.'); |
366 | + $this->response->keepOpen = true; |
367 | + return $this->response; |
368 | + } |
369 | + |
370 | + if ($duration == 0) |
371 | + { |
372 | + $this->response->SetError('You must enter a duration.'); |
373 | + $this->response->keepOpen = true; |
374 | + return $this->response; |
375 | + } |
376 | + |
377 | + // Required Attributes |
378 | + $this->duration = $duration; |
379 | + |
380 | + // Any Options |
381 | + $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>'); |
382 | + |
383 | + // Should have built the media object entirely by this time |
384 | + // This saves the Media Object to the Region |
385 | + $this->UpdateRegion(); |
386 | + |
387 | + //Set this as the session information |
388 | + setSession('content', 'type', $this->type); |
389 | + |
390 | + // We want to load a new form |
391 | + $this->response->loadForm = true; |
392 | + $this->response->loadFormUri= $url; |
393 | + |
394 | + return $this->response; |
395 | + } |
396 | +} |
397 | + |
398 | +?> |
399 | \ No newline at end of file |
400 | |
401 | === modified file 'server/template/css/presentation.css' |
402 | --- server/template/css/presentation.css 2009-01-04 12:59:11 +0000 |
403 | +++ server/template/css/presentation.css 2009-06-20 09:34:43 +0000 |
404 | @@ -1153,6 +1153,21 @@ |
405 | margin-left:9px; |
406 | } |
407 | |
408 | +.timebar_embedded_left{ |
409 | + background:url(../../img/forms/green_bar.gif) no-repeat; |
410 | + background-position:top left; |
411 | + height:59px; |
412 | + width:9px; |
413 | + float:left; |
414 | +} |
415 | + |
416 | +.timebar_embedded_right{ |
417 | + background:url(../../img/forms/green_bar.gif) no-repeat; |
418 | + background-position:top right; |
419 | + height:59px; |
420 | + margin-left:9px; |
421 | +} |
422 | + |
423 | .timebar_text_left{ |
424 | background:url(../../img/forms/yellow_bar.gif) no-repeat; |
425 | background-position:top left; |
426 | |
427 | === modified file 'server/template/css/xibo.css' |
428 | --- server/template/css/xibo.css 2009-03-22 17:58:21 +0000 |
429 | +++ server/template/css/xibo.css 2009-06-20 09:34:43 +0000 |
430 | @@ -41,3 +41,12 @@ |
431 | .ReportFault ol li { |
432 | display: list-item; |
433 | } |
434 | + |
435 | +.moduleButtonImage { |
436 | + width: 65px; |
437 | +} |
438 | + |
439 | +#embedHtml { |
440 | + width: 500px; |
441 | + height: 310px; |
442 | +} |