Author: remi
Date: 2009-07-02 12:52:15 +0200 (Thu, 02 Jul 2009)
New Revision: 5014

Added:
   
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/css/gadget-help.css
   
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_help.xsl
Modified:
   
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/common/wiky/wiky.js
   
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadgets.xsl
   
software_suite_v3/smart-core/smart-server/trunk/resources/07_web_interfaces/01_resourceWIUser01.py
Log:
* Added gadget help page.
* Fixed battery state "nodongle"
* Links in help pages opened in new pages

Modified: 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/common/wiky/wiky.js
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/common/wiky/wiky.js
      2009-07-02 10:51:00 UTC (rev 5013)
+++ 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/common/wiky/wiky.js
      2009-07-02 10:52:15 UTC (rev 5014)
@@ -76,9 +76,9 @@
        { rex:/\(-(.+?)-\)/g, tmplt:"<del>$1</del>" },
        { rex:/\?([^ \t\f\v\xB6]+)\((.+)\)\?/g, tmplt:"<abbr 
title=\"$2\">$1</abbr>" },  // .. abbreviation ..
        { rex:/\[(?:\{([^}]*)\})?[Ii]ma?ge?\:([^ ,\]]*)(?:[, ]([^\]]*))?\]/g, 
tmplt:function($0,$1,$2,$3){return Wiky.store("<img"+Wiky.style($1)+" 
src=\""+$2+"\" alt=\""+($3?$3:$2)+"\" title=\""+($3?$3:$2)+"\"/>");} },  // 
wikimedia image style ..
-       { rex:/\[([^ ,]+)[, ]([^\]]*)\]/g, tmplt:function($0,$1,$2){return 
Wiky.store("<a href=\""+$1+"\">"+$2+"</a>");}},  // wiki block style uri's ..
+       { rex:/\[([^ ,]+)[, ]([^\]]*)\]/g, tmplt:function($0,$1,$2){return 
Wiky.store("<a href=\""+$1+"\" target=\"_blank\">"+$2+"</a>");}},  // wiki 
block style uri's ..
        { 
rex:/(((http(s?))\:\/\/)?[A-Za-z0-9\._\/~\-:]+\.(?:png|jpg|jpeg|gif|bmp))/g, 
tmplt:function($0,$1,$2){return Wiky.store("<img src=\""+$1+"\" 
alt=\""+$1+"\"/>");} },  // simple images .. 
-       { 
rex:/((mailto\:|javascript\:|(news|file|(ht|f)tp(s?))\:\/\/)[A-Za-z0-9\.:_\/~%\-+&#?!=()@\x80-\xB5\xB7\xFF]+)/g,
 tmplt:"<a href=\"$1\">$1</a>" }  // simple uri's .. 
+       { 
rex:/((mailto\:|javascript\:|(news|file|(ht|f)tp(s?))\:\/\/)[A-Za-z0-9\.:_\/~%\-+&#?!=()@\x80-\xB5\xB7\xFF]+)/g,
 tmplt:"<a href=\"$1\" target=\"_blank\">$1</a>" }  // simple uri's .. 
      ],
      escapes: [
        { rex:/\\([|*_~\^])/g, tmplt:function($0,$1){return Wiky.store($1);} },

Added: 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/css/gadget-help.css
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/css/gadget-help.css
                              (rev 0)
+++ 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/css/gadget-help.css
      2009-07-02 10:52:15 UTC (rev 5014)
@@ -0,0 +1,67 @@
+h1 {
+    font-weight:bold;
+    font-size:11pt;
+       color: black;
+       margin-left: 2%;
+       margin-right: 2%;
+    margin-bottom:0em;
+}
+
+h2 {
+    font-weight:bold;
+    font-size:9pt;
+       color: black;
+       margin-left: 2%;
+       margin-right: 2%;
+    margin-bottom:0em;
+}
+
+h3 {
+    font-weight:bold;
+    font-size:9pt;
+       margin-left: 2%;
+       margin-right: 2%;
+    border-collapse: collapse;
+}
+
+h4 {
+    font-weight:bold;
+    font-style:italic;
+    font-size:9pt;
+       margin-left: 2%;
+       margin-right: 2%;
+    border-collapse: collapse;
+}
+
+p {
+    margin-top:0em;
+
+    font-size:8pt;
+       margin-left:2%;
+       margin-right:2%;
+}
+
+dl {
+       margin-left:2%;
+       margin-right:2%;
+}
+
+li {
+    margin-top:0px;
+    font-size:8pt;
+}
+
+hr {
+    display:block; 
+    margin-left:2%;
+    margin-top:1px;
+    color:black;
+    background-color:black;
+    height:1px;
+}
+
+td {
+    font-size:8pt;
+    font-family:Verdana, Bitstream Vera Sans;
+       color:black;
+}

Added: 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_help.xsl
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_help.xsl
                              (rev 0)
+++ 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadget_help.xsl
      2009-07-02 10:52:15 UTC (rev 5014)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+    xmlns:fo="http://www.w3.org/1999/XSL/Format";>
+
+<xsl:template match="/">
+<html>
+    <head>
+        <LINK href="/data/web_interface/user_01/css/gadget-help.css" 
rel="stylesheet" type="text/css"/>
+        <script src="/data/web_interface/common/wiky/wiky.js" 
type="text/javascript"/>
+        <script src="/data/web_interface/user_01/js/common.js" 
type="text/javascript"/>
+        <script language="javascript">
+        <![CDATA[
+            function initialization()
+            {
+                fillHelpBox();
+            }
+        ]]>
+        </script>
+    </head>
+
+    <body bgcolor="#dcdadb" onLoad="initialization();">
+        <!-- SKIN STORAGE -->
+        <xsl:element name="input">
+            <xsl:attribute name="type">hidden</xsl:attribute>
+            <xsl:attribute name="id">skin</xsl:attribute>
+            <xsl:attribute name="value">
+                <xsl:value-of select="root/skin"/>
+            </xsl:attribute>
+        </xsl:element>
+        <!-- LANGUAGE STORAGE -->
+        <xsl:element name="input">
+            <xsl:attribute name="type">hidden</xsl:attribute>
+            <xsl:attribute name="id">language</xsl:attribute>
+            <xsl:attribute name="value">
+                <xsl:value-of select="root/language"/>
+            </xsl:attribute>
+        </xsl:element>
+        <!-- UUID STORAGE -->
+        <xsl:element name="input">
+            <xsl:attribute name="type">hidden</xsl:attribute>
+            <xsl:attribute name="id">uuid</xsl:attribute>
+            <xsl:attribute name="value">
+                <xsl:value-of select="root/data/description/uuid"/>
+            </xsl:attribute>
+        </xsl:element>
+        <!-- MAIN DIV FRAME -->
+        <div id="helpBox"
+             style="position:absolute;
+                    left:0px;
+                    top:0px;
+                    width:423px;
+                    height:238px;
+                    overflow-y:auto;
+                    overflow-x:hidden;
+                    font-family:Verdana, Bitstream Vera Sans;">
+            <textarea id="req_helpContent" rows="19" cols="43"  
style="visibility:hidden;">
+                <xsl:value-of select="root/data/description/helpFile"/>
+            </textarea>
+        </div>
+    </body>
+</html>
+</xsl:template>
+</xsl:stylesheet>

Modified: 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadgets.xsl
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadgets.xsl
  2009-07-02 10:51:00 UTC (rev 5013)
+++ 
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadgets.xsl
  2009-07-02 10:52:15 UTC (rev 5014)
@@ -390,7 +390,13 @@
                 document.getElementById("windowGadgetHelpIcon").src = 
lastGadgetIconInAction;
                 setpng(document.getElementById("windowGadgetHelpIcon"));
                 
document.getElementById("windowGadgetHelpTitle").firstChild.nodeValue = 
lastGadgetNameInAction;
-                document.getElementById("windowGadgetHelpContentIFrame").src = 
"http://www.google.fr";;
+                var skin = document.getElementById("skin").value;
+                var language = document.getElementById("language").value;
+                var src = "/wi_user_01/gadget_help?uuid=" + 
lastGadgetUuidInAction;
+                src += "&language=" + language;
+                src += "&skin=" + skin;
+                src += "&rndParam=" + Math.random();
+                document.getElementById("windowGadgetHelpContentIFrame").src = 
src;
             }
 
             function updateWindowGadgetConfigurationContent(uuid)
@@ -597,7 +603,7 @@
             <div class="popupFrame01Bottom"></div>
         </div>
         <!-- WINDOW GADGET HELP -->
-        <div id="windowGadgetHelp" class="window01Box" 
onfocus="updateWindowGadgetHelpContent(arguments[0]);">
+        <div id="windowGadgetHelp" class="window01Box" 
onfocus="updateWindowGadgetHelpContent(arguments[0]);" style="height:350px; 
margin-top:65px;">
             <div class="windowFrame01Top">
                 <div class="windowGadgetIcon">
                     <xsl:element name="img">
@@ -609,12 +615,13 @@
                 </div>
                 <span class="windowTitle" id="windowGadgetHelpTitle"> . </span>
             </div>
-            <div class="windowFrame01Middle">
+            <div class="windowFrame01Middle" style="height:290px;">
                 <iframe class="windowContentIFrame"
                     id="windowGadgetHelpContentIFrame"
                     name="windowGadgetHelpContentIFrame"
                     frameborder="0"
                     scrolling="no"
+                    style="height:240px"
                     src="">
                 </iframe>
                 <div 
style="display:table;float:left;height:34px;width:370px"></div>

Modified: 
software_suite_v3/smart-core/smart-server/trunk/resources/07_web_interfaces/01_resourceWIUser01.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/resources/07_web_interfaces/01_resourceWIUser01.py
  2009-07-02 10:51:00 UTC (rev 5013)
+++ 
software_suite_v3/smart-core/smart-server/trunk/resources/07_web_interfaces/01_resourceWIUser01.py
  2009-07-02 10:52:15 UTC (rev 5014)
@@ -40,23 +40,26 @@
                 radioState = "on"
             else:
                 radioState = "off"
-        state = 
eventsHandler.getEventHandler(ST_NAME_BATTERY_LEVEL).getLastState()
-        if state == None:
+        if (dongleState == "off") or (radioState == "off"):
             batteryState = "nodongle"
         else:
-            rndVal = int(state[0] / 333) * 333
-            if rndVal < 4995:
-                batteryState = "empty"
-            elif (rndVal >= 4995) and (rndVal <= 5328):
-                batteryState = "low"
-            elif (rndVal > 5328) and (rndVal <= 5661):
-                batteryState = "middle"
+            state = 
eventsHandler.getEventHandler(ST_NAME_BATTERY_LEVEL).getLastState()
+            if state == None:
+                batteryState = "nodongle"
             else:
-                batteryState = "high"
-        state = 
eventsHandler.getEventHandler(ST_NAME_CHARGER_STATE).getLastState()
-        if state != None:
-            if state[0] != "UNPLUGGED":
-                batteryState = "charge"
+                rndVal = int(state[0] / 333) * 333
+                if rndVal < 4995:
+                    batteryState = "empty"
+                elif (rndVal >= 4995) and (rndVal <= 5328):
+                    batteryState = "low"
+                elif (rndVal > 5328) and (rndVal <= 5661):
+                    batteryState = "middle"
+                else:
+                    batteryState = "high"
+            state = 
eventsHandler.getEventHandler(ST_NAME_CHARGER_STATE).getLastState()
+            if state != None:
+                if state[0] != "UNPLUGGED":
+                    batteryState = "charge"
         state = 
resourceRobotContentInteractions.getPguContextsManager().isStarted()
         if state:
             soundState = "on"
@@ -244,6 +247,44 @@
 resourceWIUser01.addService(TDSServiceWIUser01GadgetConfiguration)
 
 # 
------------------------------------------------------------------------------
+# Declaration of the service "gadget_help".
+# 
------------------------------------------------------------------------------
+class TDSServiceWIUser01GadgetHelp(TDSService):
+
+    def configure(self):
+        self.parametersDict = {
+            'uuid' : 'string',
+            'language' : 'string',
+            'skin' : 'string',
+        }
+        self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+        self.exclusiveExecution = False
+        self.name = "gadget_help"
+        self.comment = "Show the gadget help."
+
+    def execute(self, id, parameters):
+        headersStruct = self.getDefaultHeadersStruct()
+        contentStruct = self.getDefaultContentStruct()
+        contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+        uuid = parameters['uuid']
+        language = parameters['language']
+        skin = parameters['skin']
+        data = resourceUgcServer.getUgcData(uuid, language)
+        if data == None:
+            contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+        else:
+            contentStruct['root']['data'] = data
+            contentStruct['root']['skin'] = skin
+            contentStruct['root']['language'] = language
+            contentStruct['root']['translations'] = 
resourceWIUser01.translations.getTranslations(language)
+        self.haveXsl = True
+        self.xslPath = "/data/web_interface/%s/xsl/gadget_help.xsl" % skin
+        return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceWIUser01.addService(TDSServiceWIUser01GadgetHelp)
+
+# 
------------------------------------------------------------------------------
 # Declaration of the service "apply_gadget".
 # 
------------------------------------------------------------------------------
 class TDSServiceWIUser01ApplyGadget(TDSService):


------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to