Author: remi
Date: 2009-03-29 12:47:58 +0200 (Sun, 29 Mar 2009)
New Revision: 4250

Added:
   
software_suite_v2/tuxware/tuxdroidserver/trunk/data/xsl/gadgets_all_of_frames.xsl
Modified:
   
software_suite_v2/tuxware/tuxdroidserver/trunk/resources/01_robot_system/resourceGadgetFramework.py
Log:
* added a service to show all gadgets in the browser
  - http://127.0.0.1:270/gadget_framework/all_of_frames?

Added: 
software_suite_v2/tuxware/tuxdroidserver/trunk/data/xsl/gadgets_all_of_frames.xsl
===================================================================
--- 
software_suite_v2/tuxware/tuxdroidserver/trunk/data/xsl/gadgets_all_of_frames.xsl
                           (rev 0)
+++ 
software_suite_v2/tuxware/tuxdroidserver/trunk/data/xsl/gadgets_all_of_frames.xsl
   2009-03-29 10:47:58 UTC (rev 4250)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns="http://www.w3.org/1999/xhtml";>
+    <body style="font-family:Arial;font-size:12pt;background-color:#FFFFFF">
+        <xsl:for-each select="root/data">
+            <xsl:element name="iframe">
+                <xsl:attribute name="src">
+                    <xsl:value-of select="description/web_gadget_url"/>
+                </xsl:attribute>
+                <xsl:attribute name="width">410</xsl:attribute>
+                <xsl:attribute name="height">220</xsl:attribute>
+                <xsl:attribute name="frameborder">1</xsl:attribute>
+                <xsl:attribute name="scrolling">yes</xsl:attribute>
+            </xsl:element>
+        </xsl:for-each>
+    </body>
+</html>
\ No newline at end of file


Property changes on: 
software_suite_v2/tuxware/tuxdroidserver/trunk/data/xsl/gadgets_all_of_frames.xsl
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: 
software_suite_v2/tuxware/tuxdroidserver/trunk/resources/01_robot_system/resourceGadgetFramework.py
===================================================================
--- 
software_suite_v2/tuxware/tuxdroidserver/trunk/resources/01_robot_system/resourceGadgetFramework.py
 2009-03-29 10:04:44 UTC (rev 4249)
+++ 
software_suite_v2/tuxware/tuxdroidserver/trunk/resources/01_robot_system/resourceGadgetFramework.py
 2009-03-29 10:47:58 UTC (rev 4250)
@@ -470,6 +470,44 @@
 resourceGadgetFramework.addService(TDSServiceGadgetFrameworkGadgetsInfos)
 
 # 
------------------------------------------------------------------------------
+# Declaration of the service "all_of_frames".
+# 
------------------------------------------------------------------------------
+class TDSServiceGadgetFrameworkAllOfFrames(TDSService):
+
+    def configure(self):
+        self.parametersDict = {}
+        self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+        self.exclusiveExecution = False
+        self.name = "all_of_frames"
+        self.comment = "Show all web gadgets."
+        self.haveXsl = True
+        self.xslPath = "/data/xsl/gadgets_all_of_frames.xsl"
+
+    def execute(self, id, parameters):
+        headersStruct = self.getDefaultHeadersStruct()
+        contentStruct = self.getDefaultContentStruct()
+        contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+        gadgets = resourceGadgetFramework.getGadgetsContainer().getGadgets()
+        for i, gadget in enumerate(gadgets):
+            d_name = "data|%d" % i
+            structure = WebGadgetTools.generateWebGadgetStructure(gadget,
+                '/gadget_framework/web_gadget?',
+                gadget.getCommands()[0].getName(), {})
+            #del structure['command']
+            structure['commands'] = {}
+            for j, command in enumerate(gadget.getCommands()):
+                c_name = "command_%.3d" % j
+                structure['commands'][c_name] = {}
+                structure['commands'][c_name]['name'] = command.getName()
+                structure['commands'][c_name]['translated_name'] = 
command.getTranslatedName()
+                structure['commands'][c_name]['description'] = 
command.getDescription()
+            contentStruct['root'][d_name] = structure
+        return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceGadgetFramework.addService(TDSServiceGadgetFrameworkAllOfFrames)
+
+# 
------------------------------------------------------------------------------
 # Declaration of the service "web_gadget".
 # 
------------------------------------------------------------------------------
 class TDSServiceGadgetFrameworkWebGadget(TDSService):


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

Reply via email to