Merge lp:~dangarner/xibo/embedded-html-module-102 into lp:xibo/1.0

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
Reviewer Review Type Date Requested Status
Dan Garner Approve
Review via email: mp+7708@code.launchpad.net
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
=== modified file '.bzrignore'
--- .bzrignore 2009-03-07 23:21:15 +0000
+++ .bzrignore 2009-06-20 10:05:53 +0000
@@ -1,3 +1,4 @@
1server/settings.php1server/settings.php
2.project2.project
3server/.project3server/.project
4Thumbs.db
45
=== modified file 'client/dotNET/Region.cs'
--- client/dotNET/Region.cs 2009-06-17 21:57:35 +0000
+++ client/dotNET/Region.cs 2009-06-20 10:05:53 +0000
@@ -124,6 +124,10 @@
124 media = new Rss(options);124 media = new Rss(options);
125 break;125 break;
126126
127 case "embedded":
128 media = new Text(options);
129 break;
130
127 default:131 default:
128 //do nothing132 //do nothing
129 SetNextMediaNode();133 SetNextMediaNode();
@@ -200,6 +204,7 @@
200 options.scrollSpeed = 1;204 options.scrollSpeed = 1;
201 options.updateInterval = 6;205 options.updateInterval = 6;
202 options.uri = "";206 options.uri = "";
207 options.direction = "none";
203208
204 // Get a media node209 // Get a media node
205 bool validNode = false;210 bool validNode = false;
@@ -305,6 +310,10 @@
305 {310 {
306 options.documentTemplate = raw.InnerText;311 options.documentTemplate = raw.InnerText;
307 }312 }
313 else if (raw.Name == "embedHtml")
314 {
315 options.text = raw.InnerText;
316 }
308 }317 }
309318
310 // That should cover all the new options319 // That should cover all the new options
311320
=== modified file 'client/dotNET/Rss.cs'
--- client/dotNET/Rss.cs 2009-06-18 18:36:21 +0000
+++ client/dotNET/Rss.cs 2009-06-20 10:39:40 +0000
@@ -83,7 +83,7 @@
8383
84 try84 try
85 {85 {
86 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()); 86 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());
87 }87 }
88 catch (Exception e)88 catch (Exception e)
89 {89 {
@@ -133,7 +133,7 @@
133133
134 try134 try
135 {135 {
136 System.IO.StreamReader sr = new System.IO.StreamReader(data, true);136 System.IO.StreamReader sr = new System.IO.StreamReader(data, Encoding.UTF8);
137 rssContents = sr.ReadToEnd();137 rssContents = sr.ReadToEnd();
138138
139 StreamWriter sw = new StreamWriter(File.Open(rssFilePath, FileMode.Create, FileAccess.Write, FileShare.Read));139 StreamWriter sw = new StreamWriter(File.Open(rssFilePath, FileMode.Create, FileAccess.Write, FileShare.Read));
140140
=== modified file 'client/dotNET/Text.cs'
--- client/dotNET/Text.cs 2008-12-19 23:34:13 +0000
+++ client/dotNET/Text.cs 2009-06-20 10:39:40 +0000
@@ -55,11 +55,12 @@
5555
56 try56 try
57 {57 {
58 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());58 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());
59 }59 }
60 catch (Exception e)60 catch (Exception e)
61 {61 {
62 MessageBox.Show(e.Message);62 System.Diagnostics.Trace.WriteLine(e.Message);
63 return;
63 }64 }
6465
65 webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);66 webBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
6667
=== modified file 'client/dotNET/bin/Release/XiboClient.XmlSerializers.dll'
67Binary 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 differ68Binary 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
=== modified file 'client/dotNET/bin/Release/XiboClient.exe'
68Binary 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 differ69Binary 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
=== modified file 'client/dotNET/bin/Release/XiboClient.pdb'
69Binary 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 differ70Binary 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
=== added file 'server/install/database/6.sql'
--- server/install/database/6.sql 1970-01-01 00:00:00 +0000
+++ server/install/database/6.sql 2009-06-20 09:34:43 +0000
@@ -0,0 +1,16 @@
1INSERT INTO `module` (
2`ModuleID` ,
3`Module` ,
4`Enabled` ,
5`RegionSpecific` ,
6`Description` ,
7`ImageUri` ,
8`SchemaVersion`
9)
10VALUES (
11NULL , 'Embedded', '1', '1', 'Embedded HTML', 'img/forms/webpage.gif', '1'
12);
13
14UPDATE `version` SET `app_ver` = '1.0.2';
15UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
16UPDATE `version` SET `DBVersion` = '6';
0\ No newline at end of file17\ No newline at end of file
118
=== modified file 'server/lib/pages/layout.class.php'
--- server/lib/pages/layout.class.php 2009-04-27 19:28:08 +0000
+++ server/lib/pages/layout.class.php 2009-06-20 09:34:43 +0000
@@ -1435,7 +1435,7 @@
1435 while ($modulesItem = $enabledModules->GetNextModule())1435 while ($modulesItem = $enabledModules->GetNextModule())
1436 {1436 {
1437 $mod = Kit::ValidateParam($modulesItem['Module'], _STRING);1437 $mod = Kit::ValidateParam($modulesItem['Module'], _STRING);
1438 $caption = 'Add ' . $mod;1438 $caption = '+ ' . $mod;
1439 $mod = strtolower($mod);1439 $mod = strtolower($mod);
1440 $title = Kit::ValidateParam($modulesItem['Description'], _STRING);1440 $title = Kit::ValidateParam($modulesItem['Description'], _STRING);
1441 $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING);1441 $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING);
@@ -1445,7 +1445,7 @@
1445 $buttons .= <<<HTML1445 $buttons .= <<<HTML
1446 <div class="regionicons">1446 <div class="regionicons">
1447 <a class="XiboFormButton" title="$title" href="$uri">1447 <a class="XiboFormButton" title="$title" href="$uri">
1448 <img class="dash_button" src="$img" />1448 <img class="dash_button moduleButtonImage" src="$img" />
1449 <span class="dash_text">$caption</span></a>1449 <span class="dash_text">$caption</span></a>
1450 </div>1450 </div>
1451HTML;1451HTML;
@@ -1456,7 +1456,7 @@
1456 <div id="buttons">1456 <div id="buttons">
1457 <div class="regionicons">1457 <div class="regionicons">
1458 <a class="XiboFormButton" href="index.php?p=content&q=LibraryAssignForm&layoutid=$this->layoutid&regionid=$regionid" title="Library">1458 <a class="XiboFormButton" href="index.php?p=content&q=LibraryAssignForm&layoutid=$this->layoutid&regionid=$regionid" title="Library">
1459 <img class="region_button" src="img/forms/library.gif"/>1459 <img class="region_button moduleButtonImage" src="img/forms/library.gif"/>
1460 <span class="region_text">Library</span></a>1460 <span class="region_text">Library</span></a>
1461 </div>1461 </div>
1462 $buttons1462 $buttons
14631463
=== added file 'server/modules/embedded.module.php'
--- server/modules/embedded.module.php 1970-01-01 00:00:00 +0000
+++ server/modules/embedded.module.php 2009-06-20 10:05:53 +0000
@@ -0,0 +1,251 @@
1<?php
2/*
3 * Xibo - Digitial Signage - http://www.xibo.org.uk
4 * Copyright (C) 2009 Daniel Garner
5 *
6 * This file is part of Xibo.
7 *
8 * Xibo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * Xibo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
20 */
21class embedded extends Module
22{
23
24 public function __construct(database $db, user $user, $mediaid = '', $layoutid = '', $regionid = '')
25 {
26 // Must set the type of the class
27 $this->type = 'embedded';
28
29 // Must call the parent class
30 parent::__construct($db, $user, $mediaid, $layoutid, $regionid);
31 }
32
33 /**
34 * Return the Add Form as HTML
35 * @return
36 */
37 public function AddForm()
38 {
39 $db =& $this->db;
40 $user =& $this->user;
41
42 // Would like to get the regions width / height
43 $layoutid = $this->layoutid;
44 $regionid = $this->regionid;
45 $rWidth = Kit::GetParam('rWidth', _REQUEST, _STRING);
46 $rHeight = Kit::GetParam('rHeight', _REQUEST, _STRING);
47
48 $form = <<<FORM
49 <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=AddMedia">
50 <input type="hidden" name="layoutid" value="$layoutid">
51 <input type="hidden" id="iRegionId" name="regionid" value="$regionid">
52 <table>
53 <tr>
54 <td><label for="duration" title="The duration in seconds this webpage should be displayed">Duration<span class="required">*</span></label></td>
55 <td><input id="duration" name="duration" type="text"></td>
56 </tr>
57 <tr>
58 <td colspan="2">
59 <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br />
60 <textarea id="embedHtml" name="embedHtml"></textarea>
61 </td>
62 </tr>
63 <tr>
64 <td></td>
65 <td>
66 <input id="btnSave" type="submit" value="Save" />
67 <input class="XiboFormButton" id="btnCancel" type="button" title="Return to the Region Options" href="index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions" value="Cancel" />
68 </td>
69 </tr>
70 </table>
71 </form>
72FORM;
73
74 $this->response->html = $form;
75 $this->response->dialogTitle = 'Add Embedded HTML';
76 $this->response->dialogSize = true;
77 $this->response->dialogWidth = '650px';
78 $this->response->dialogHeight = '450px';
79
80 return $this->response;
81 }
82
83 /**
84 * Return the Edit Form as HTML
85 * @return
86 */
87 public function EditForm()
88 {
89 $db =& $this->db;
90
91 $layoutid = $this->layoutid;
92 $regionid = $this->regionid;
93 $mediaid = $this->mediaid;
94
95 // Get the embedded HTML out of RAW
96 $rawXml = new DOMDocument();
97 $rawXml->loadXML($this->GetRaw());
98
99 Debug::LogEntry($db, 'audit', 'Raw XML returned: ' . $this->GetRaw());
100
101 // Get the HTML Node out of this
102 $textNodes = $rawXml->getElementsByTagName('embedHtml');
103 $textNode = $textNodes->item(0);
104 $embedHtml = $textNode->nodeValue;
105
106 //Output the form
107 $form = <<<FORM
108 <form class="XiboForm" method="post" action="index.php?p=module&mod=$this->type&q=Exec&method=EditMedia">
109 <input type="hidden" name="layoutid" value="$layoutid">
110 <input type="hidden" name="mediaid" value="$mediaid">
111 <input type="hidden" id="iRegionId" name="regionid" value="$regionid">
112 <table>
113 <tr>
114 <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>
115 <td><input id="duration" name="duration" value="$this->duration" type="text"></td>
116 </tr>
117 <tr>
118 <td colspan="2">
119 <label for="embedHtml" title="The HTML you want to Embed in this Layout.">Embed HTML<span class="required">*</span></label><br />
120 <textarea id="embedHtml" name="embedHtml">$embedHtml</textarea>
121 </td>
122 </tr>
123 <tr>
124 <td></td>
125 <td>
126 <input id="btnSave" type="submit" value="Save" />
127 <input class="XiboFormButton" id="btnCancel" type="button" title="Return to the Region Options" href="index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions" value="Cancel" />
128 </td>
129 </tr>
130 </table>
131 </form>
132FORM;
133
134 $this->response->html = $form;
135 $this->response->dialogTitle = 'Edit Embedded HTML';
136 $this->response->dialogSize = true;
137 $this->response->dialogWidth = '650px';
138 $this->response->dialogHeight = '450px';
139
140 return $this->response;
141 }
142
143 /**
144 * Add Media to the Database
145 * @return
146 */
147 public function AddMedia()
148 {
149 $db =& $this->db;
150
151 $layoutid = $this->layoutid;
152 $regionid = $this->regionid;
153 $mediaid = $this->mediaid;
154
155 //Other properties
156 $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING);
157 $duration = Kit::GetParam('duration', _POST, _INT, 0);
158
159 $url = "index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions";
160
161 //Validate the URL?
162 if ($embedHtml == "")
163 {
164 $this->response->SetError('Please enter some HTML to embed.');
165 $this->response->keepOpen = true;
166 return $this->response;
167 }
168
169 if ($duration == 0)
170 {
171 $this->response->SetError('You must enter a duration.');
172 $this->response->keepOpen = true;
173 return $this->response;
174 }
175
176 // Required Attributes
177 $this->mediaid = md5(uniqid());
178 $this->duration = $duration;
179
180 // Any Options
181 $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>');
182
183 // Should have built the media object entirely by this time
184 // This saves the Media Object to the Region
185 $this->UpdateRegion();
186
187 //Set this as the session information
188 setSession('content', 'type', $this->type);
189
190 // We want to load a new form
191 $this->response->loadForm = true;
192 $this->response->loadFormUri= $url;
193
194 return $this->response;
195 }
196
197 /**
198 * Edit Media in the Database
199 * @return
200 */
201 public function EditMedia()
202 {
203 $db =& $this->db;
204
205 $layoutid = $this->layoutid;
206 $regionid = $this->regionid;
207 $mediaid = $this->mediaid;
208
209 //Other properties
210 $embedHtml = Kit::GetParam('embedHtml', _POST, _HTMLSTRING);
211 $duration = Kit::GetParam('duration', _POST, _INT, 0);
212
213 $url = "index.php?p=layout&layoutid=$layoutid&regionid=$regionid&q=RegionOptions";
214
215 //Validate the URL?
216 if ($embedHtml == "")
217 {
218 $this->response->SetError('Please enter some HTML to embed.');
219 $this->response->keepOpen = true;
220 return $this->response;
221 }
222
223 if ($duration == 0)
224 {
225 $this->response->SetError('You must enter a duration.');
226 $this->response->keepOpen = true;
227 return $this->response;
228 }
229
230 // Required Attributes
231 $this->duration = $duration;
232
233 // Any Options
234 $this->SetRaw('<embedHtml><![CDATA[' . $embedHtml . ']]></embedHtml>');
235
236 // Should have built the media object entirely by this time
237 // This saves the Media Object to the Region
238 $this->UpdateRegion();
239
240 //Set this as the session information
241 setSession('content', 'type', $this->type);
242
243 // We want to load a new form
244 $this->response->loadForm = true;
245 $this->response->loadFormUri= $url;
246
247 return $this->response;
248 }
249}
250
251?>
0\ No newline at end of file252\ No newline at end of file
1253
=== modified file 'server/template/css/presentation.css'
--- server/template/css/presentation.css 2009-01-04 12:59:11 +0000
+++ server/template/css/presentation.css 2009-06-20 09:34:43 +0000
@@ -1153,6 +1153,21 @@
1153 margin-left:9px;1153 margin-left:9px;
1154}1154}
11551155
1156.timebar_embedded_left{
1157 background:url(../../img/forms/green_bar.gif) no-repeat;
1158 background-position:top left;
1159 height:59px;
1160 width:9px;
1161 float:left;
1162}
1163
1164.timebar_embedded_right{
1165 background:url(../../img/forms/green_bar.gif) no-repeat;
1166 background-position:top right;
1167 height:59px;
1168 margin-left:9px;
1169}
1170
1156.timebar_text_left{1171.timebar_text_left{
1157 background:url(../../img/forms/yellow_bar.gif) no-repeat;1172 background:url(../../img/forms/yellow_bar.gif) no-repeat;
1158 background-position:top left;1173 background-position:top left;
11591174
=== modified file 'server/template/css/xibo.css'
--- server/template/css/xibo.css 2009-03-22 17:58:21 +0000
+++ server/template/css/xibo.css 2009-06-20 09:34:43 +0000
@@ -41,3 +41,12 @@
41.ReportFault ol li {41.ReportFault ol li {
42 display: list-item;42 display: list-item;
43}43}
44
45.moduleButtonImage {
46 width: 65px;
47}
48
49#embedHtml {
50 width: 500px;
51 height: 310px;
52}

Subscribers

People subscribed via source and target branches