Author: remi
Date: 2009-06-26 17:31:50 +0200 (Fri, 26 Jun 2009)
New Revision: 4914
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/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
Log:
* added actions on start/stop gadget in the "gadgets" page.
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-06-26 14:59:23 UTC (rev 4913)
+++
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/user_01/xsl/gadgets.xsl
2009-06-26 15:31:50 UTC (rev 4914)
@@ -121,7 +121,7 @@
htmlContent += '<div class="gadgetsVSpacer"
style="width:10px;"></div>';
if (ondemand == 'true')
{
- htmlContent += '<a class="gadgetsBtnTitle
gadgetsBtnStartEnable" id="startId_' + uuid + '" onclick="" href="#"
name="lbOn" rel="popupNotYetImplemented">' + translationStart + '</a>';
+ htmlContent += '<a class="gadgetsBtnTitle
gadgetsBtnStartEnable" id="startId_' + uuid + '"
onclick="javascript:startGadget(\''+uuid+'\');return false;" href="#">' +
translationStart + '</a>';
}
else
{
@@ -130,7 +130,7 @@
htmlContent += '<div class="gadgetsVSpacer"
style="width:8px;"></div>';
if (ondemand == 'true')
{
- htmlContent += '<a class="gadgetsBtnTitle
gadgetsBtnStopEnable" id="stopId_' + uuid + '" onclick="" href="#" name="lbOn"
rel="popupNotYetImplemented">' + translationStop + '</a>';
+ htmlContent += '<a class="gadgetsBtnTitle
gadgetsBtnStopEnable" id="stopId_' + uuid + '"
onclick="javascript:stopGadget();return false;" href="#">' + translationStop +
'</a>';
}
else
{
@@ -190,10 +190,12 @@
function startGadget(uuid)
{
+ getRequest("/robot_content_interactions/start_gadget_by_uuid",
{'uuid' : uuid});
}
- function stopGadget(uuid)
+ function stopGadget()
{
+ getRequest("/robot_content_interactions/stop_gadget", {});
}
function setUuidAction(uuid)
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
===================================================================
---
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
2009-06-26 14:59:23 UTC (rev 4913)
+++
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
2009-06-26 15:31:50 UTC (rev 4914)
@@ -434,6 +434,13 @@
resourceTuxDriver.playSound(11, 100.0)
self.__speakOnDemand()
+ def selectOnDemandByUuid(self, uuid):
+ """
+ """
+ for i, ugcObj in enumerate(self.__onDemandList):
+ if ugcObj.getDescription().getUuid() == uuid:
+ self.__onDemandIndex = i
+
def computeOnDemandDictForThumbnailBar(self):
"""
"""
@@ -1264,6 +1271,33 @@
resourceRobotContentInteractions.addService(TDSServiceRobotContentInteractionsStartGadget)
#
------------------------------------------------------------------------------
+# Declaration of the service "start_gadget_by_uuid".
+#
------------------------------------------------------------------------------
+class TDSServiceRobotContentInteractionsStartGadgetByUuid(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'uuid' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = True
+ self.name = "start_gadget_by_uuid"
+ self.comment = "Start a gadget by it uuid."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ uuid = parameters['uuid']
+
resourceRobotContentInteractions.getPguContextsManager().selectOnDemandByUuid(uuid)
+ t = threading.Thread(target =
resourceRobotContentInteractions.getPguContextsManager().startCurrentGadget)
+ t.start()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceRobotContentInteractions.addService(TDSServiceRobotContentInteractionsStartGadgetByUuid)
+
+#
------------------------------------------------------------------------------
# Declaration of the service "stop_gadget".
#
------------------------------------------------------------------------------
class TDSServiceRobotContentInteractionsStopGadget(TDSService):
------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn