1.0rc8
authorivanl
Thu, 11 Jun 2009 12:40:18 +0100
changeset 4 cb6368112727
parent 3 9cbe91927e89
child 5 3a3bac500145
1.0rc8 - Fixed HTML cleaning function which inherited a bug from example code. The bug prevents rendering of feed entries that contain greater than and less than signs.
Symbian.org/FeedUpdateBroker.js
Symbian.org/Forums.js
Symbian.org/Main.js
Symbian.org/wrt_preview_frame.html
--- a/Symbian.org/FeedUpdateBroker.js	Tue Jun 09 13:59:04 2009 +0100
+++ b/Symbian.org/FeedUpdateBroker.js	Thu Jun 11 12:40:18 2009 +0100
@@ -166,7 +166,7 @@
             if (buf != "") {
                 buf += " ";
             }
-            buf += child.nodeValue;
+            buf += escapeLtGt(child.nodeValue);
         }
         child = child.nextSibling;
     }
@@ -175,7 +175,8 @@
     var strippedBuf = "";
     var textStartPos = -1;
     var tagBalance = 0;
-    
+	
+    var pos;
     // iterate through the text and append all text to the stripped buffer
     // that is at a tag balance of 0
     for (pos = 0; pos < buf.length; pos++) {
@@ -210,3 +211,9 @@
 	this.cancelled = true;
 	this.httpReq.abort();
 }
+
+function escapeLtGt(text){
+	var lt = "&lt;";
+	var gt = "&gt;";
+	return text.replace(/</g, lt).replace(/>/g, gt);
+}
--- a/Symbian.org/Forums.js	Tue Jun 09 13:59:04 2009 +0100
+++ b/Symbian.org/Forums.js	Thu Jun 11 12:40:18 2009 +0100
@@ -332,7 +332,7 @@
 
 	// initialize feed item control
 	var title = item.title;
-	if ( title.length == 0 ) { 
+	if ( !title || title.length == 0 ) { 
 		title = "Re:";
 		item.title = title;
 	}
@@ -410,12 +410,6 @@
 // Utilities
 
 
-// feeds contain bbcodes - this function should turn the bbcode markup
-// to HTML
-function bbcode2html(s) {
-	return sanitize(s);
-}
-
 // Forum posts can be be quite messy and include bbcodes, smilies etc.
 // This function does the minimum by stripping bbcodes and such
 function sanitize(text) {
@@ -441,3 +435,59 @@
 
 
 
+// feeds contain bbcodes - this function should turn the bbcode markup
+// to HTML
+function bbcode2html(s) {
+	var prevind = 0;
+	var buf = "";
+	var ind = s.indexOf("[");
+	if ( ind == -1 ) return s;
+	while ( ind != -1 ) {
+		buf += s.substring(prevind, ind);
+		var ind2 = s.indexOf("]", ind); // end of tag
+		var fulltag = s.substring(ind+1,ind2);
+		var tag = fulltag;
+		var ind3 = s.indexOf("=", ind); // end of tag name, eg. [URL=http...]
+		if ( ind3 != -1 && ind3 < ind2) {
+			tag = s.substring(ind+1,ind3);
+		} 
+		var ind4 = s.indexOf("[/"+tag+"]");
+		var tagContent = s.substring(ind2+1, ind4);
+		buf += convertTag(tag, fulltag, tagContent);
+		if ( ind4 != -1 ) {
+			prevind = s.indexOf(']',ind4) + 1;
+		} else {
+			break;
+		}
+		ind = s.indexOf("[", prevind);
+	}
+	buf += s.substring(prevind);
+	return buf;
+}
+
+function convertTag(tag, fulltag, tagContent) {
+	tag = tag.toLowerCase();
+	switch(tag) {
+		case 'b':case 'i':case 'u':case 's':case 'sup':case 'sub':case 'h1':case 'h2':case 'h3':case 'h4':case 'h5':case 'h6':case 'table':case 'tr':case 'th':case 'td':
+		{
+			return '<' + tag + '>' + tagContent + "</" + tag + ">";
+		}
+		case 'quote': return '<blockquote><i>' + tagContent + '</i></blockquote>';
+		case 'url': {
+			var eqsign = fulltag.indexOf("=");
+			if ( eqsign > -1 ) {
+				return '<div class="FeedItemLink"><a href="JavaScript:void(0)" onclick="openURL( ' 
+				+ fulltag.substring(eqsign+1)
+				+ '") ><i>'
+				+ tagContent
+				+ '</i></a></div>'; 
+			} else {
+				return '<div class="FeedItemLink"><a href="JavaScript:void(0)" onclick="openURL( ' 
+				+ tagContent
+				+ '") ><i>'
+				+ tagContent
+				+ '</i></a></div>'; 
+			}
+		}
+	}
+}
--- a/Symbian.org/Main.js	Tue Jun 09 13:59:04 2009 +0100
+++ b/Symbian.org/Main.js	Thu Jun 11 12:40:18 2009 +0100
@@ -46,7 +46,7 @@
 var wikiBaseUrl = symbianOrgBaseUrl+"/wiki/index.php";
 
 // Update variables
-var myversion = "1.0rc6";
+var myversion = "1.0rc8";
 var versionWikiPageUrl = wikiBaseUrl + "/Symbian.org_WRT_Widget";
 var versionWikiPageString = "Current widget version is [";
 var downloadUrl = symbianOrgBaseUrl + "/wiki/images/c/c5/Symbian.org.wgz";
--- a/Symbian.org/wrt_preview_frame.html	Tue Jun 09 13:59:04 2009 +0100
+++ b/Symbian.org/wrt_preview_frame.html	Thu Jun 11 12:40:18 2009 +0100
@@ -1,85 +1,216 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>Nokia WRT Preview</title>
-<link href="preview/css/style.css" rel="stylesheet" type="text/css" />
-<script language="JavaScript" src="preview/script/device.js"></script>
-<script language="JavaScript" src="preview/script/build.js"></script>
-<link href="preview/css/menu.css" rel="stylesheet" type="text/css" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>Nokia WRT Preview</title>
+	<!-- jQuery-ui Begins -->
+		<link type="text/css" rel="stylesheet"  href="preview/script/jquery-ui/css/ui-darkness/ui.all.css"/>	
+		<script type="text/javascript" src="preview/script/jquery-ui/js/jquery-1.2.6.min.js"></script>
+		<script type="text/javascript" src="preview/script/jquery-ui/js/jquery-ui-1.6.custom.min.js"></script>
+	<!-- jQuery-ui Ends -->	
+	<script type="text/javascript" language="JavaScript" src="preview/script/xml2json.js"></script>
+	<script type="text/javascript" language="JavaScript" src="preview/script/nokia.js"></script>
+	<script type="text/javascript" language="JavaScript" src="preview/script/resolution.js"></script>
+	<link type="text/css" rel="stylesheet"  href="preview/css/style.css"/>
 </head>
 <body>
-<div id="Toolbar">
-  <div id="DeviceSettings">
-    <table cellpadding="0" cellspacing="0">
-      <tr valign="middle">
-        <td width="230" align="left" valign="top"><img src="preview/images/select-device-text.png" alt="Select Device" width="110" height="18" hspace="15" /><br />
-        <select name="deviceResolution" size="5" id="deviceResolution">
-                          </select></td>
-      <td width="87" align="center"><img src="preview/images/device/5320_main.jpg" alt="Device" name="ModelImage" width="57" height="150" id="ModelImage" /></td>
-      </tr><tr>
-	  <td colspan="2">    <p>Model: <br />
-        <strong id="ModelName">Nokia 5320 XpressMusic</strong></p>
-    <p>Resolution: <br />
-      <strong id="ModelResolution">240 x 320 pixels</strong></p>    </td>
-      </tr><tr>
-	  <td colspan="2"><p>Developer Platform: <br />
-            <strong id="ModelPlatform">S60 3rd Edition, Feature Pack 2</strong></p>
-        <p>Display Orientation:<br />
-            <label>
-            <input name="DisplayOrientation" type="radio" id="DisplayOrientation_portrait" value="portrait" checked="checked"/>
-              Portrait</label>
-            <label>
-            <input type="radio" name="DisplayOrientation" value="landscape" id="DisplayOrientation_landscape" />
-              Landscape<br />
-            </label>
-        </p></td>
-    </tr>
-  </table>
+	<div id="preview-ui-top">
+		<div id="DeviceDisplayLayout" class="hide">
+			<div id="DisplaySFKWrapper">
+				<div id="DisplayArea">
+					<div id="IconArea"></div>
+					<div id="WidgetArea">
+						<div id="iframeMask" class="hide"></div>
+						<iframe src=""></iframe>
+					</div>
+					<div id="MenuItemsArea" class="scroll-pane">
+						<ul>
+							<li><a href="javascript:void(0);">Exit</a></li>
+						</ul>
+					</div>
+					<div id="SoftKeysArea">
+						<ul>
+							<li id="LskLabel"><a href="javascript:void(0);">Options</a></li>
+							<li id="RskLabel"><a href="javascript:void(0);">Exit</a></li>
+						</ul>
+					</div>
+				</div>
+				<div id="SoftKeys">
+					<a href="javascript:void(0);"><img src="preview/images/TransperantImage.png" name="LskArea" border="0" id="LskArea"/></a><a href="javascript:void(0);"><img src="preview/images/TransperantImage.png" name="RskArea" border="0" id="RskArea"/></a> </div>
+				</div>
+			</div>
+		<div id="Dialog" title="Notification window"></div>
+<div id="PreferencesTab" class="hide">
+	<div id="tabs">
+		<ul>
+			<li><a href="#tabs-1">Preferences</a></li>
+			<li><a href="#tabs-2">Event Triggers</a></li>
+		</ul>
+		<div id="tabs-1">
+			<div id="settings-view">
+		<table width="100%" cellpadding="0" cellspacing="0">
+			<tr>
+				<th>
+					Resolution
+				</th>
+				<td>
+					<select id="resOptions">
+						<option selected="true" value="http://www.forum.nokia.com/devices/matrix_240x320_1.html">240x320</option>
+						<option value="http://www.forum.nokia.com/devices/matrix_320x240_1.html">320x240</option>
+						<option value="http://www.forum.nokia.com/devices/matrix_360x640_1.html">360x640</option>
+						<option value="http://www.forum.nokia.com/devices/E90_Communicator">800x352</option>
+					</select>&nbsp; <a class="link" target="_blank" href="http://www.forum.nokia.com/devices/matrix_240x320_1.html" id="resSupportLink">Device matrix featuring this resolution</a>
+				</td>
+			</tr>
+			<tr>
+				<th>
+					Orientation					
+				</th>
+				<td>
+					<div id="Orientation_Controls" class="hide">
+						<label><input type="radio" name="input_orientation" id="input_portrait" value="portrait"/> Portrait</label>	
+						<label><input type="radio" name="input_orientation" id="input_landscape" value="landscape"/> Landscape</label>	
+					</div>
+					<div id="Orientation_Info" class="hide">
+					</div>
+				</td>
+			</tr>
+			<tr>
+				<th>
+					WRT Version
+				</th>
+				<td>
+					<label><input type="radio" name="wrt_version" id="wrt_version_1_0" value="WRT 1.0"/> WRT 1.0</label>	
+					<label><input type="radio" name="wrt_version" id="wrt_version_1_1" value="WRT 1.1"/> WRT 1.1</label>	
+				</td>
+			</tr>
+			<tr>
+				<th>
+					Home Screen view
+				</th>
+				<td>
+					<div id="HS_Control_Info">
+						Hello
+					</div>
+				</td>
+			</tr>
+		</table>
+		</div>
+		
+			<div id="mini-view-info" class="hide">
+				<div class="ui-panel">
+					<a class="ui-button" id="mini-view-back">Back</a>
+				</div>
+				<table cellpadding='0' cellspacing='0' width="100%">
+					<tr>
+						<th>To enable Mini view support for HomeScreen widget </th>
+					</tr>
+					<tr>
+						<td>
+							Add this line in Info.plist file
+							<code>&lt;key&gt;MiniViewEnabled&lt;/key&gt;<br/>&lt;true/&gt;</code>
+							and optionally add the following to the MainHTML file
+							<code>&lt;div id="miniView"&gt; &lt;--  Define your Home Screen view here  --&gt; &lt;/div&gt;</code><br/>
+							See Web Developer's Library for <a class="link" href="http://library.forum.nokia.com/index.jsp?topic=/Web_Developers_Library/GUID-63F4E17E-8895-4054-82AD-762B90610B30.html" target="_blank">more details</a>
+						</td>
+					</tr>
+				</table>
+			</div>
+		
+		
+		</div>
+		<div id="tabs-2">
+			
+			<div id="event-icons">
+				<div id="event-battery"></div>
+				<div id="event-messaging"></div>
+				<div id="event-memory"></div>
+			</div>
+
+			<div id="event-battery-info" class="hide">
+				<div class="ui-panel">
+					<a class="ui-button" id="event-battery-back">Back</a>
+				</div>
+				<table cellpadding='0' cellspacing='0' width="100%">
+					<tr>
+						<th colspan="2">Battery Triggers</th>
+					</tr>
+					<tr>
+						<td>Charging status</td>
+						<td>
+							<a class="ui-button-fixed" id="connect-charger">Connect charger</a>
+							<a class="ui-button-fixed" id="disconnect-charger">Disconnect charger</a>
+						</td>
+					</tr>
+					<tr>
+						<td>Battery Strength</td>
+						<td>
+							<div id="slider"></div>
+							<div id="slider-value-panel"><span>0</span></div>
+							<div><a class="ui-button-fixed" id="update-batter-strength">Update</a></div>
+						</td>
+					</tr>
+				</table>
+			</div>
+
+			<div id="event-messaging-info" class="hide">
+				<div class="ui-panel">
+					<a class="ui-button" id="event-messaging-back">Back</a>
+				</div>
+				<table cellpadding='0' cellspacing='0' width="100%">
+					<tr>
+						<th colspan="2">Message Triggers</th>
+					</tr>
+					<tr>
+						<td>New message</td>
+						<td>
+							<a class="ui-button-fixed" id="send-sms">Trigger new SMS</a>
+							<a class="ui-button-fixed" id="send-mms">Trigger new MMS</a>
+						</td>
+					</tr>
+				</table>
+			</div>
+
+			<div id="event-memory-info" class="hide">
+				<div class="ui-panel">
+					<a class="ui-button" id="event-memory-back">Back</a>
+				</div>
+				<table cellpadding='0' cellspacing='0' width="100%">
+					<tr>
+						<th colspan="2">Memory Triggers</th>
+					</tr>
+					<tr>
+						<td>Memory Card</td>
+						<td>
+							<a class="ui-button-fixed" id="connect-memory-card">Connect</a>
+							<a class="ui-button-fixed" id="disconnect-memory-card">Disconnect</a>
+						</td>
+					</tr>
+				</table>
+			</div>
+			
+		</div>
+	</div>
 </div>
-  <div class="down" id="pullDown"></div>
-  </div>
-<div id="WrapperDiv">
-<div id="device">
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td>
-     <div id="display">
-    	<div id="displayLeft">
-        	<div id="iframePreviewWindow">
-        		<iframe src="wrt_preview_main.html" frameborder="no" width="100%" id="widgetIframeWindow"></iframe>
-                <div id="menuPane">
-                	<div id="menuItemsPane">
-                    </div>
-                	<div id="softKeysPane">
-                    	<table width="100%" border="0" cellspacing="2" cellpadding="2">
-                          <tr>
-                            <td><span id="leftSoftKey">Options</span></td>
-                            <td align="right"><span id="rightSoftKey">Cancel</span></td>
-                          </tr>
-                      </table>
-                    </div>
-                </div>
-        	</div>
-        </div>
-  	</div>
-</td>
-  </tr>
-  <tr>
-    <td>
-    	<div id="softKeys">
-    	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td width="46"><a id="leftSoftKeyImg"><img src="preview/images/device-left-softkey.png" width="103" height="46" border="0" /></a></td>
-              <td background="preview/images/device-bottom.png">&nbsp;</td>
-              <td width="46"><a id="rightSoftKeyImg"><img src="preview/images/device-right-softkey.png" width="103" height="46" border="0" /></a></td>
-            </tr>
-          </table>
-    	</div>
-    </td>
-  </tr>
-</table>
-</div>
-</div>
+	</div>
+	<div id="preview-ui-bottom">
+		<div id="preview-ui-bottom-header">
+			<div>Console window</div>
+			<span class="open" id="Console-Toggle-Button"></span>
+			<span id="Console-Clear-Button"></span>
+		</div>
+		<div style="clear:left;"></div>
+		<div id="preview-ui-bottom-body">
+		</div>
+	</div>
+	<div id="PreferencesBtn" class="hide"></div>
+	<div id="orientationIcon"></div>
+	<div id="loaderDiv"></div>
+	<div id="NotificationDiv" class="hide">
+		<p>NOKIA WRT Simulation may not work properly on this browser, <br/>Firefox is recommended for widget preview and debugging.  <br/><br/><strong>Continue?</strong></p>
+	</div>
+	<div id="BrowserNotificationBar" class="hide">
+		<p><a></a>NOKIA WRT Simulation may not work properly on this browser, Firefox is recommended for widget preview and debugging</p>
+	</div>
 </body>
 </html>