tux-droid-svn Mailing List for Tux Droid CE (Page 55)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
| 2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
| 2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: remi <c2m...@c2...> - 2009-05-26 16:43:54
|
Author: remi
Date: 2009-05-26 18:43:41 +0200 (Tue, 26 May 2009)
New Revision: 4680
Modified:
software_suite_v3/smart-core/smart-server/trunk/installer.nsi
software_suite_v3/smart-core/smart-server/trunk/version.py
Log:
* updated installer nsi script
* bumped to 0.4.0
Modified: software_suite_v3/smart-core/smart-server/trunk/installer.nsi
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/installer.nsi 2009-05-26 16:31:04 UTC (rev 4679)
+++ software_suite_v3/smart-core/smart-server/trunk/installer.nsi 2009-05-26 16:43:41 UTC (rev 4680)
@@ -1,10 +1,10 @@
; installer.nsi
-; This installer which install the Tuxroid HTTP server
+; This installer which install the Smart-server
; -----------------------------------------------------------------------------
; HM NIS Edit Wizard helper defines
-!define PRODUCT_NAME "Tuxdroid HTTP server"
-!define PRODUCT_VERSION "0.3.0"
+!define PRODUCT_NAME "Smart Server"
+!define PRODUCT_VERSION "0.4.0"
; Output names
!define FINAL_INSTALLER_EXE "tuxHTTPServerInstaller_${PRODUCT_VERSION}.exe"
@@ -56,6 +56,7 @@
SetOutPath "$TUXDROID_PATH\softwares\tuxhttpserver\data"
File /r data\*
+ RMDir /r "$TUXDROID_PATH\softwares\tuxhttpserver\resources"
CreateDirectory "$TUXDROID_PATH\softwares\tuxhttpserver\resources"
SetOutPath "$TUXDROID_PATH\softwares\tuxhttpserver\resources"
File /r resources\*
@@ -64,6 +65,10 @@
SetOutPath "$TUXDROID_PATH\softwares\tuxhttpserver\util"
File /r util\*
+ CreateDirectory "$TUXDROID_PATH\softwares\tuxhttpserver\content"
+ SetOutPath "$TUXDROID_PATH\softwares\tuxhttpserver\content"
+ File /r content\*
+
SetOutPath "$TUXDROID_PATH\bin"
File delphi_launchers\tuxhttpserver_start.exe
File delphi_launchers\tuxhttpserver_stop.exe
@@ -119,6 +124,7 @@
RMDir /r "$TUXDROID_PATH\softwares\tuxhttpserver\data"
RMDir /r "$TUXDROID_PATH\softwares\tuxhttpserver\util"
+ RMDir /r "$TUXDROID_PATH\softwares\tuxhttpserver\resources"
Delete "$UNINSTALLERS_SUB_PATH\${UNINSTALLER_EXE}"
; Remove shortcuts
Modified: software_suite_v3/smart-core/smart-server/trunk/version.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/version.py 2009-05-26 16:31:04 UTC (rev 4679)
+++ software_suite_v3/smart-core/smart-server/trunk/version.py 2009-05-26 16:43:41 UTC (rev 4680)
@@ -7,7 +7,7 @@
# Distributed under the terms of the GNU General Public License
# http://www.gnu.org/copyleft/gpl.html
-version = '0.3.0'
+version = '0.4.0'
author = "Remi Jocaille (rem...@c2...)"
licence = "GPL"
date = "2009"
|
|
From: remi <c2m...@c2...> - 2009-05-26 16:31:10
|
Author: remi Date: 2009-05-26 18:31:04 +0200 (Tue, 26 May 2009) New Revision: 4679 Added: software_suite_v3/smart-core/smart-server/trunk/content/tools/ Log: * added "tools" directory |
|
From: remi <c2m...@c2...> - 2009-05-26 16:28:56
|
Author: remi
Date: 2009-05-26 18:28:45 +0200 (Tue, 26 May 2009)
New Revision: 4678
Added:
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/10_resourceScheduler.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/00_resourceTuxDriver.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/00_resourceAttitune.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/01_resourceEyes.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/02_resourceFlippers.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/03_resourceLeds.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/04_resourceMacro.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/05_resourceMouth.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/06_resourceSoundFlash.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/07_resourceSpinning.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/08_resourceTTS.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/09_resourceWav.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/00_resourceAttituneManager.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/01_resourcePluginsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/02_resourceGagdetsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/03_resourceUgcServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/04_user_configurations/
software_suite_v3/smart-core/smart-server/trunk/resources/05_updates/
software_suite_v3/smart-core/smart-server/trunk/resources/06_web_interfaces/
software_suite_v3/smart-core/smart-server/trunk/resources/06_web_interfaces/00_resourceWIDevel.py
Removed:
software_suite_v3/smart-core/smart-server/trunk/resources/00_server_base/
software_suite_v3/smart-core/smart-server/trunk/resources/01_robot_system/
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot_api/
software_suite_v3/smart-core/smart-server/trunk/resources/03_advanced_api/
software_suite_v3/smart-core/smart-server/trunk/resources/04_web_interface/
Log:
* reorganized server resources
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,82 @@
+# ==============================================================================
+# Server resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "server".
+# ------------------------------------------------------------------------------
+class TDSResourceServer(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "server"
+ self.comment = "Resource to manage the server."
+ self.fileName = RESOURCE_FILENAME
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def stopServer(self):
+ """Stop the server.
+ """
+ httpServer.stop()
+
+ def getVersion(self):
+ """Get the server version.
+ @return: The server version.
+ """
+ return serverVersion
+
+# Create an instance of the resource
+resourceServer = TDSResourceServer("resourceServer")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceServer)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "stop".
+# ------------------------------------------------------------------------------
+class TDSServiceServerStop(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "stop"
+ self.comment = "Stop the server."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceServer.stopServer()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerStop)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "version".
+# ------------------------------------------------------------------------------
+class TDSServiceServerVersion(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "version"
+ self.comment = "Get the server version."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ data = {'version' : resourceServer.getVersion()}
+ contentStruct['root']['data'] = data
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerVersion)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,283 @@
+# ==============================================================================
+# Status resource.
+# ==============================================================================
+
+SW_NAME_EXTERNAL_STATUS = "external_status"
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "status".
+# ------------------------------------------------------------------------------
+class TDSResourceStatus(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "status"
+ self.comment = "Resource to manage the statuses and events."
+ self.fileName = RESOURCE_FILENAME
+
+ # Registering the "external" status in the events handler
+ eventsHandler.insert(SW_NAME_EXTERNAL_STATUS)
+ # Registering the "external" status in the default excluded events list
+ clientsManager.addDefaultExcludedEvent(SW_NAME_EXTERNAL_STATUS)
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def getEvents(self, idClient):
+ """Get the last events from a client stack.
+ - This function only affect the HTTP/REST clients.
+ @param idClient: Id client.
+ @return: The events from the client stack as list.
+ """
+ client = clientsManager.getClient(idClient)
+ if client == None:
+ return []
+ return client.popEvents()
+
+ def requestOne(self, statusName):
+ """Request the current state of a status.
+ @param statusName: Name of the status.
+ @return: The current state of the status as dictionary.
+ """
+ eventHandler = eventsHandler.getEventHandler(statusName)
+ if eventHandler == None:
+ return None
+ else:
+ stateStruct = eventHandler.getLastState()
+ if stateStruct != None:
+ state = {
+ 'name' : statusName,
+ 'value' : stateStruct[0],
+ 'delay' : stateStruct[1],
+ }
+ else:
+ state = {
+ 'name' : statusName,
+ 'value' : '',
+ 'delay' : 0.0,
+ }
+ return state
+
+ def requestAll(self):
+ """Request the current state of all statuses.
+ @return: The current state of all statuses as dictionary.
+ """
+ eventsNameList = eventsHandler.getEventsNameList()
+ states = []
+ for eventName in eventsNameList:
+ state = self.requestOne(eventName)
+ if state != None:
+ states.append(state)
+ return states
+
+ def sendStatus(self, name, value):
+ """Send a free status.
+ - This function inject a status in the events handler. This kind of
+ statuses are handled in the special event handler named
+ "SW_NAME_EXTERNAL_STATUS" because their names are not knowed by the
+ server.
+ @param name: Status name.
+ @param value: Status value.
+ """
+ statusStruct = {}
+ statusStruct['name'] = SW_NAME_EXTERNAL_STATUS
+ statusStruct['value'] = "%s|%s" % (name, value)
+ statusStruct['delay'] = 0.0
+ statusStruct['type'] = "string"
+ def async():
+ eventsHandler.emit(statusStruct['name'], (statusStruct['value'],
+ float(statusStruct['delay'])))
+ clientsManager.pushEvents([statusStruct,])
+ t = threading.Thread(target = async)
+ t.start()
+
+ def addExcludedEvent(self, idClient, eventName):
+ """Add an event in the excluded events list of a client.
+ - The effect is that the event/status will be anymore sent to this
+ client.
+ @idClient: Client id.
+ @eventName: Status/event name.
+ """
+ def async():
+ client = clientsManager.getClient(idClient)
+ if client != None:
+ client.addExcludedEvent(eventName)
+ t = threading.Thread(target = async)
+ t.start()
+
+ def removeExcludedEvent(self, idClient, eventName):
+ """Remove an event from the excluded events list of a client.
+ @idClient: Client id.
+ @eventName: Status/event name.
+ """
+ def async():
+ client = clientsManager.getClient(idClient)
+ if client != None:
+ client.removeExcludedEvent(eventName)
+ t = threading.Thread(target = async)
+ t.start()
+
+# Create an instance of the resource
+resourceStatus = TDSResourceStatus("resourceStatus")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceStatus)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "events".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusEvents(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "events"
+ self.comment = "Get the last events from a client stack."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ events = resourceStatus.getEvents(id)
+ if len(events) > 0:
+ i = 0
+ for event in events:
+ data_name = "data|%d" % i
+ i += 1
+ contentStruct['root'][data_name] = event
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusEvents)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "request_one".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRequestOne(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'status_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "request_one"
+ self.comment = "Request the current state of a status."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ state = resourceStatus.requestOne(parameters['status_name'])
+ if state == None:
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ else:
+ contentStruct['root']['data'] = state
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRequestOne)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "request_all".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRequestAll(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "request_all"
+ self.comment = "Request the current state of all statuses."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ states = resourceStatus.requestAll()
+ i = 0
+ for state in states:
+ dataName = "data|%d" % i
+ i += 1
+ contentStruct['root'][dataName] = state
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRequestAll)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "send".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusSend(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'name' : 'string',
+ 'value' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = True
+ self.name = "send"
+ self.comment = "Send a free status."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.sendStatus(parameters['name'], parameters['value'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusSend)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "register_event".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRegisterEvent(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'event_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "register_event"
+ self.comment = "Add an event inthe registered events list of the client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.removeExcludedEvent(id, parameters['event_name'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRegisterEvent)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "unregister_event".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusUnregisterEvent(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'event_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "unregister_event"
+ self.comment = "Remove an event from the registered events list of the client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.addExcludedEvent(id, parameters['event_name'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusUnregisterEvent)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,225 @@
+# ==============================================================================
+# Access resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "access".
+# ------------------------------------------------------------------------------
+class TDSResourceAccess(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "access"
+ self.comment = "Resource to manage the access to the robot resources."
+ self.fileName = RESOURCE_FILENAME
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def acquireAccess(self, idClient, priorityLevel):
+ """Acquire the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ @param idClient: Id client.
+ @param priorityLevel: Priority level.
+ 0 : LOW
+ 1 : NORMAL
+ 2 : HIGH
+ 3 : CRITICAL
+ @return: True or False
+ """
+ client = clientsManager.getClient(idClient)
+ if client == None:
+ return False
+ return client.acquireAccess(priorityLevel)
+
+ def releaseAccess(self, idClient):
+ """Release the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ @param idClient: Id client.
+ """
+ accessManager.releaseAccess(idClient)
+
+ def forcingReleaseAccess(self):
+ """Forcing to release the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.releaseAccess()
+
+ def forcingAcquireAccess(self, idClient, priorityLevel):
+ """Forcing to acquire the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ @param idClient: Id client.
+ @param priorityLevel: Priority level.
+ 0 : LOW
+ 1 : NORMAL
+ 2 : HIGH
+ 3 : CRITICAL
+ @return: True or False
+ """
+ accessManager.releaseAccess()
+ return accessManager.acquireAccess(idClient, priorityLevel)
+
+ def lockAccess(self):
+ """Lock the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.setLocked(True)
+
+ def unlockAccess(self):
+ """Lock the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.setLocked(False)
+
+# Create an instance of the resource
+resourceAccess = TDSResourceAccess("resourceAccess")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceAccess)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "acquire".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessAcquire(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'priority_level' : 'int',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_RESTRICTED
+ self.exclusiveExecution = False
+ self.name = "acquire"
+ self.comment = "Acquire the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ if not resourceAccess.acquireAccess(id, parameters['priority_level']):
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessAcquire)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "release".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessRelease(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_RESTRICTED
+ self.exclusiveExecution = False
+ self.name = "release"
+ self.comment = "Release the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.releaseAccess(id)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessRelease)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "forcing_release".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessForcingRelease(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "forcing_release"
+ self.comment = "Forcing to release the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.forcingReleaseAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessForcingRelease)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "forcing_acquire".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessForcingAcquire(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'id_client' : 'string',
+ 'priority_level' : 'int',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "forcing_acquire"
+ self.comment = "Forcing to acquire the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ if not resourceAccess.forcingAcquireAccess(parameters['id_client'],
+ parameters['priority_level']):
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessForcingAcquire)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "lock".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessLock(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "lock"
+ self.comment = "Lock the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.lockAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessLock)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "unlock".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessUnlock(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "unlock"
+ self.comment = "Lock the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.unlockAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessUnlock)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,134 @@
+# ==============================================================================
+# Client resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "client".
+# ------------------------------------------------------------------------------
+class TDSResourceClient(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "client"
+ self.comment = "Resource to manage the clients."
+ self.fileName = RESOURCE_FILENAME
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def createClient(self, clientName, clientLevel):
+ """Create a new client.
+ @clientName: Client name.
+ @clientLevel: Client level.
+ -1 : ANONYMOUS
+ 0 : FREE
+ 1 : RESTRICTED
+ 2 : ROOT
+ @return: The id of the new client or -1 if fail.
+ """
+ if clientLevel == TDS_CLIENT_LEVEL_ANONYMOUS:
+ return -1
+ idClient = clientsManager.addRESTClient(clientName, clientLevel)
+ return idClient
+
+ def destroyClient(self, idClient):
+ """Destroy a client.
+ - This function only affect the HTTP/REST clients.
+ @idClient: Client id.
+ """
+ clientsManager.removeRESTClient(idClient)
+
+ def listing(self):
+ """Get the clients listing with their informations.
+ @return: A dictionary.
+ """
+ clientsInfo = clientsManager.getClientsInfo()
+ result = {}
+ for i, clientInfo in enumerate(clientsInfo):
+ nodeName = "data|%d" % i
+ result[nodeName] = clientInfo
+ return result
+
+# Create an instance of the resource
+resourceClient = TDSResourceClient("resourceClient")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceClient)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "create".
+# ------------------------------------------------------------------------------
+class TDSServiceClientCreate(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'name' : 'string',
+ 'level' : 'uint8',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "create"
+ self.comment = "Create a client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ idClient = resourceClient.createClient(parameters['name'],
+ parameters['level'])
+ if idClient == None:
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ else:
+ contentStruct['root']['data'] = {}
+ contentStruct['root']['data']['client_id'] = idClient
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceClient.addService(TDSServiceClientCreate)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "destroy".
+# ------------------------------------------------------------------------------
+class TDSServiceClientDestroy(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "destroy"
+ self.comment = "Destroy a client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceClient.destroyClient(id)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceClient.addService(TDSServiceClientDestroy)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "listing".
+# ------------------------------------------------------------------------------
+class TDSServiceClientListing(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "listing"
+ self.comment = "Get the clients listing with their informations."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ contentStruct['root']['data'] = resourceClient.listing()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceClient.addService(TDSServiceClientListing)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,229 @@
+# ==============================================================================
+# Menu resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "menu".
+# ------------------------------------------------------------------------------
+class TDSResourceMenu(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "menu"
+ self.comment = "Menu resource."
+ self.fileName = RESOURCE_FILENAME
+
+# Create an instance of the resource
+resourceMenu = TDSResourceMenu("resourceMenu")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceMenu)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "index".
+# ------------------------------------------------------------------------------
+class TDSServiceMenuIndex(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "index"
+ self.comment = "Main menu of the server."
+ self.haveXsl = True
+ self.xslPath = "/data/xsl/menu.xsl"
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = {'root' : self.__createXmlIndex()}
+ return headersStruct, contentStruct
+
+ def __createXmlIndex(self):
+ contentStruct = {
+ 'title' : 'Tux Droid Server V %s' % serverVersion,
+ 'section' : 'Index',
+ 'items' : {
+ 'Resources' : 'menu/resources?resource_name=index',
+ 'Logs' : 'menu/logs?log_name=index',
+ 'Clients' : 'menu/clients?',
+ }
+ }
+ return contentStruct
+
+# Register the service into the resource
+resourceMenu.addService(TDSServiceMenuIndex)
+# Bind the root url to this service
+resourcesManager.addBinding("ROOT", "menu", "index")
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "resources".
+# ------------------------------------------------------------------------------
+class TDSServiceMenuResources(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'resource_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "resources"
+ self.comment = "Resources menu."
+ self.haveXsl = True
+ self.xslPath = "/data/xsl/menu.xsl"
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ if parameters['resource_name'] == 'index':
+ contentStruct = {'root' : self.__createXmlIndex()}
+ else:
+ contentStruct = {
+ 'root' : self.__createXmlResource(parameters['resource_name'])
+ }
+ return headersStruct, contentStruct
+
+ def __createXmlIndex(self):
+ self.xslPath = "/data/xsl/menu_resources.xsl"
+ contentStruct = {
+ 'title' : 'Tux Droid Server V %s' % serverVersion,
+ 'section' : 'Resources',
+ 'items' : {}
+ }
+ resourcesList = resourcesManager.getResourcesList()
+ resourcePathsList = resourcesManager.getResourcePathsList()
+ for path in resourcePathsList:
+ path = os.path.basename(path)
+ contentStruct['items']["Layer_%s" % path] = {}
+ for resourceName in resourcesList:
+ resource = resourcesManager.getResource(resourceName)
+ resourcePath = os.path.basename(os.path.split(
+ resource.fileName)[-2])
+ if resourcePath == path:
+ url = '?resource_name=%s' % resourceName
+ contentStruct['items']["Layer_%s" % path][resourceName] = url
+ return contentStruct
+
+ def __createXmlResource(self, resourceName):
+ self.xslPath = "/data/xsl/resource.xsl"
+ resource = resourcesManager.getResource(resourceName)
+ if resource == None:
+ result = {}
+ else:
+ result = resource.getXmlStructure()
+ result['title'] = 'Tux Droid Server V %s' % serverVersion
+ result['section'] = 'Resource : %s' % resourceName
+ # complete the url
+ for service in result['services'].keys():
+ address = TDS_CONF_HOST_ADDRESS
+ if address == "":
+ address = '127.0.0.1'
+ cmdProt = 'http://%s:%d/<id_client>/%s/%s?%s' % (address,
+ TDS_HTTP_PORT, resourceName, service,
+ result['services'][service]['parameters'])
+ result['services'][service]['commandPrototype'] = cmdProt
+ return result
+
+# Register the service into the resource
+resourceMenu.addService(TDSServiceMenuResources)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "logs".
+# ------------------------------------------------------------------------------
+class TDSServiceMenuLogs(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'log_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "logs"
+ self.comment = "Logs menu."
+ self.haveXsl = True
+ self.xslPath = "/data/xsl/menu.xsl"
+ if os.name == 'nt':
+ self.__logPath = os.path.expanduser("~")
+ else:
+ self.__logPath = "/var/log/tuxdroid"
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ if parameters['log_name'] == 'index':
+ contentStruct = {'root' : self.__createXmlIndex()}
+ else:
+ contentStruct = {'root' : self.__createXmlLog(parameters['log_name'])}
+ return headersStruct, contentStruct
+
+ def __createXmlIndex(self):
+ self.xslPath = "/data/xsl/menu.xsl"
+ contentStruct = {
+ 'title' : 'Tux Droid Server V %s' % serverVersion,
+ 'section' : 'Logs',
+ 'items' : {
+ 'Global_Server' : 'logs?log_name=%s' % TDS_FILENAME_TUXDROIDSERVER_LOG,
+ 'HTTP.REST_Server' : 'logs?log_name=%s' % TDS_FILENAME_HTTPSERVER_LOG,
+ 'Resources_manager' : 'logs?log_name=%s' % TDS_FILENAME_RESOURCES_LOG,
+ 'Clients_manager_TCP.IP_Server' : 'logs?log_name=%s' % TDS_FILENAME_CLIENTS_LOG,
+ 'Tux_driver' : 'logs?log_name=libtuxdriver_wrapper',
+ 'Tux_OSL' : 'logs?log_name=libtuxosl_wrapper',
+ }
+ }
+ return contentStruct
+
+ def __createXmlLog(self, logName):
+ self.xslPath = "/data/xsl/log.xsl"
+ filePath = os.path.join(self.__logPath, "%s.log" % logName)
+ if not os.path.isfile(filePath):
+ return {}
+ logText = open(filePath, 'r').read()
+ logDict = {}
+ for i, log in enumerate(logText.split('\n')):
+ if log != '':
+ logDict['log_%.5d' % i] = log
+ contentStruct = {
+ 'data' : {
+ 'log_file_path' : filePath,
+ 'log_text' : logDict,
+ }
+ }
+ return contentStruct
+
+# Register the service into the resource
+resourceMenu.addService(TDSServiceMenuLogs)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "clients".
+# ------------------------------------------------------------------------------
+class TDSServiceMenuClients(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "clients"
+ self.comment = "Clients index."
+ self.haveXsl = True
+ self.xslPath = "/data/xsl/clients.xsl"
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = {'root' : self.__createXmlIndex()}
+ return headersStruct, contentStruct
+
+ def __createXmlIndex(self):
+ clientsInfo = clientsManager.getClientsInfo()
+ clients = {}
+ for i, clientInfo in enumerate(clientsInfo):
+ clientInfo['name'] = clientInfo['name'].replace(' ', '')
+ clientInfo['name'] = "client%.2d_%s" % (i, clientInfo['name'])
+ clients[clientInfo['name']] = clientInfo
+ contentStruct = {
+ 'title' : 'Tux Droid Server V %s' % serverVersion,
+ 'section' : 'Clients',
+ 'clients' : clients,
+ }
+ return contentStruct
+
+# Register the service into the resource
+resourceMenu.addService(TDSServiceMenuClients)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/10_resourceScheduler.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/10_resourceScheduler.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/10_resourceScheduler.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,389 @@
+# ==============================================================================
+# Scheduler resource.
+# ==============================================================================
+
+# This resource depends of the following resources :
+
+import datetime
+
+from util.scheduler.Scheduler import Scheduler
+from util.scheduler.Task import *
+
+# Scheduler manager events/statuses
+ST_NAME_SCM_RUN = "scheduler_manager_run"
+ST_NAME_SCM_TASK_ADDED = "scheduler_manager_task_added"
+ST_NAME_SCM_TASK_REMOVED = "scheduler_manager_task_removed"
+ST_NAME_SCM_TASKS_LOADED = "scheduler_manager_tasks_loaded"
+ST_NAME_SCM_TASKS_UNLOADED = "scheduler_manager_tasks_unloaded"
+
+# Attitune manager events/statuses list
+SW_NAME_SCHEDULER_MANAGER = [
+ ST_NAME_SCM_RUN,
+ ST_NAME_SCM_TASK_ADDED,
+ ST_NAME_SCM_TASK_REMOVED,
+ ST_NAME_SCM_TASKS_LOADED,
+ ST_NAME_SCM_TASKS_UNLOADED,
+]
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "scheduler".
+# ------------------------------------------------------------------------------
+class TDSResourceScheduler(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "scheduler"
+ self.comment = "Resource to manage the scheduler."
+ self.fileName = RESOURCE_FILENAME
+ # Create the scheduler.
+ self.__scheduler = Scheduler(globals())
+ self.__scheduler.setOnTaskAddedCallback(self.__onTaskAdded)
+ self.__scheduler.setOnTaskRemovedCallback(self.__onTaskRemoved)
+ self.__scheduler.setOnTasksLoadedCallback(self.__onTasksLoaded)
+ self.__scheduler.setOnTasksUnloadedCallback(self.__onTasksUnloaded)
+ # Registering the scheduler manager statuses.
+ for statusName in SW_NAME_SCHEDULER_MANAGER:
+ eventsHandler.insert(statusName)
+ self.__scheduler.start()
+ self.__publishEvents(True, ST_NAME_SCM_RUN, ["True",])
+
+ def stop(self):
+ self.__scheduler.stop()
+ self.__publishEvents(True, ST_NAME_SCM_RUN, ["False",])
+
+ # --------------------------------------------------------------------------
+ # Private methods
+ # --------------------------------------------------------------------------
+
+ def __publishEvents(self, sendToClients, eventName, eventValues = []):
+ def async():
+ values = ""
+ for value in eventValues:
+ values += value + ":"
+ if len(values) > 0:
+ values = values[:-1]
+ eventStruct = {
+ 'name' : eventName,
+ 'value' : values,
+ 'delay' : "0.0",
+ 'type' : "string"
+ }
+ if sendToClients:
+ clientsManager.pushEvents([eventStruct,])
+ eventsHandler.emit(eventName, (values, 0.0))
+ t = threading.Thread(target = async)
+ t.start()
+
+ def __onTaskAdded(self, task):
+ print "Task added :", task.getDescription().getName(), task.getDescription().toString()
+ self.__publishEvents(False, ST_NAME_SCM_TASK_ADDED,
+ [task.getDescription().getId(), task.getDescription().getName()])
+
+ def __onTaskRemoved(self, task):
+ print "Task removed :", task.getDescription().toString()
+ self.__publishEvents(False, ST_NAME_SCM_TASK_REMOVED,
+ [task.getDescription().getId(), task.getDescription().getName()])
+
+ def __onTasksLoaded(self):
+ print "Tasks loaded"
+ self.__publishEvents(True, ST_NAME_SCM_TASKS_LOADED, ["True",])
+
+ def __onTasksUnloaded(self):
+ print "Tasks unloaded"
+ self.__publishEvents(True, ST_NAME_SCM_TASKS_UNLOADED, ["True",])
+
+ def weekMaskStringToList(self, weekMaskString):
+ result = [True, True, True, True, True, True, True]
+ try:
+ splitedStr = weekMaskString.split(",")
+ if len(splitedStr) == 7:
+ for i, value in enumerate(splitedStr):
+ if value == "true":
+ result[i] = True
+ else:
+ result[i] = False
+ except:
+ pass
+ return result
+
+ def dateStringToList(self, dateString):
+ result = [0, 0, 0]
+ try:
+ splitedStr = dateString.split("/")
+ if len(splitedStr) == 3:
+ for i, value in enumerate(splitedStr):
+ result[i] = int(value)
+ except:
+ pass
+ return result
+
+ def timeStringToList(self, timeString):
+ result = [0, 0, 0]
+ try:
+ splitedStr = timeString.split(":")
+ if len(splitedStr) == 3:
+ for i, value in enumerate(splitedStr):
+ result[i] = int(value)
+ except:
+ pass
+ return result
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def publishEvents(self, sendToClients, eventName, eventValues = []):
+ self.__publishEvents(sendToClients, eventName, eventValues)
+
+ def getScheduler(self):
+ """Get the scheduler.
+ @return: A Scheduler object.
+ """
+ return self.__scheduler
+
+ def createTask_RunEveryX(self, name, weekMask, hoursBegin, hoursEnd, delay,
+ command, arguments, data):
+ """Create a task which start every x delay.
+ - hour, minute, second define the time delay between 2 executions.
+ - Typically for a pooling task.
+ @param name: Task name.
+ @param weekMask: Week mask. [True, True, True, True, True, True, True]
+ @param hoursBegin: Hours begin. [Hour, Minute, Second]
+ @param hoursEnd: Hours end. [Hour, Minute, Second]
+ @param delay: Delay. [Hour, Minute, Second]
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ task = Task(SCH_LOOP_REL, weekMask, [0, 0, 0], hoursBegin, hoursEnd,
+ delay, command, arguments, data)
+ return self.__scheduler.insertTask(task, name)
+
+ def createTask_RunEveryXFromFullHour(self, name, weekMask, hoursBegin,
+ hoursEnd, delay, command, arguments, data):
+ """Create a task which start every x delay synchronized with hh:00:00.
+ - Typically for an alarm task. (Clock gadget start at hour:00, 15, 30, 45)
+ - The first execution will be at hour begin + delay time.
+ @param name: Task name.
+ @param weekMask: Week mask. [True, True, True, True, True, True, True]
+ @param hoursBegin: Hours begin. [Hour, Minute, Second]
+ @param hoursEnd: Hours end. [Hour, Minute, Second]
+ @param delay: Delay. [Hour, Minute, Second]
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ task = Task(SCH_LOOP_ABS, weekMask, [0, 0, 0], hoursBegin, hoursEnd,
+ delay, command, arguments, data)
+ return self.__scheduler.insertTask(task, name)
+
+ def createTask_RunDailyAtTime(self, name, weekMask, hoursBegin, command,
+ arguments, data):
+ """Create a daily task which run at fixed time.
+ @param name: Task name.
+ @param weekMask: Week mask. [True, True, True, True, True, True, True]
+ @param hoursBegin: Hours begin. [Hour, Minute, Second]
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ task = Task(SCH_ONCE_ABS, weekMask, [0, 0, 0], hoursBegin, [0, 0, 0],
+ [0, 0, 0], command, arguments, data)
+ return self.__scheduler.insertTask(task, name)
+
+ def createTask_RunOnceAtDateTime(self, name, date, hoursBegin, command,
+ arguments, data):
+ """Create a task which run once time at a specific date time.
+ @param name: Task name.
+ @param date: Date. [Year, Month, Day]
+ @param hoursBegin: Hours begin. [Hour, Minute, Second]
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ task = Task(SCH_ONCE_ABS, [True, True, True, True, True, True, True],
+ date, hoursBegin, [0, 0, 0], [0, 0, 0], command, arguments, data)
+ return self.__scheduler.insertTask(task, name)
+
+ def createTask_RunOnceDelayed(self, name, delay, command, arguments, data):
+ """Create a task which run once time after a delay.
+ @param name: Task name.
+ @param delay: Delay. [Hour, Minute, Second]
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ task = Task(SCH_ONCE_REL, [True, True, True, True, True, True, True],
+ [0, 0, 0], [0, 0, 0], [0, 0, 0], delay, command, arguments, data)
+ return self.__scheduler.insertTask(task, name)
+
+ def createTask(self, command, arguments, taskType, taskName, weekMask, date,
+ hoursBegin, hoursEnd, delay, data):
+ """Create a task to start a gadget.
+ @param command: Command to execute.
+ @param arguments: Arguments of the command.
+ @param taskType: <EVERY X|EVERY X FROM FULL HOUR|DAILY AT|ONCE AT|
+ ONCE DELAYED>
+ @param taskName: Task name.
+ @param weekMask: Week mask. [True, True, True, True, True, True, True]
+ @param date: Date. [Year, Month, Day]
+ @param hoursBegin: Hours begin. [Hour, Minute, Second]
+ @param hoursEnd: Hours end. [Hour, Minute, Second]
+ @param delay: Delay. [Hour, Minute, Second]
+ @param data: User data.
+ @return: The task id and the task name or None None.
+ """
+ if taskType == "EVERY X":
+ return self.createTask_RunEveryX(taskName, weekMask, hoursBegin,
+ hoursEnd, delay, command, arguments, data)
+ if taskType == "EVERY X FROM FULL HOUR":
+ return self.createTask_RunEveryXFromFullHour(taskName, weekMask,
+ hoursBegin, hoursEnd, delay, command, arguments, data)
+ if taskType == "DAILY AT":
+ return self.createTask_RunDailyAtTime(taskName, weekMask,
+ hoursBegin, command, arguments, data)
+ if taskType == "ONCE AT":
+ return self.createTask_RunOnceAtDateTime(taskName, date, hoursBegin,
+ command, arguments, data)
+ if taskType == "ONCE DELAYED":
+ return self.createTask_RunOnceDelayed(taskName, delay,
+ command, arguments, data)
+ return None, None
+
+ def executeTask(self, taskId):
+ """Execute the action of a scheduled task.
+ @param taskId: Task id.
+ @return: A boolean.
+ """
+ tasks = self.__scheduler.getTasks()
+ for task in tasks:
+ if task.getDescription().getId() == taskId:
+ task.execute(globals())
+ return True
+ return False
+
+ def removeTask(self, taskId):
+ """Remove a task from the scheduler.
+ @param taskId: Task id.
+ """
+ self.__scheduler.removeTask(taskId)
+
+ def clear(self):
+ """Clear the scheduler.
+ """
+ self.__scheduler.clear()
+
+# Create an instance of the resource
+resourceScheduler = TDSResourceScheduler("resourceScheduler")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceScheduler)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "tasks_infos".
+# ------------------------------------------------------------------------------
+class TDSServiceSchedulerTasksInfos(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "tasks_infos"
+ self.comment = "Get the informations about the tasks."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ tasks = resourceScheduler.getScheduler().getTasks()
+ tasksNameList = []
+ for task in tasks:
+ tasksNameList.append(task.getDescription().getName())
+ tasksNameList.sort()
+ for i, taskName in enumerate(tasksNameList):
+ task = resourceScheduler.getScheduler().getTaskByName(taskName)
+ d_name = "data|%.3d" % i
+ struct = task.getDictionary()
+ contentStruct['root'][d_name] = struct
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceScheduler.addService(TDSServiceSchedulerTasksInfos)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "clear".
+# ------------------------------------------------------------------------------
+class TDSServiceSchedulerClear(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "clear"
+ self.comment = "Clear the scheduler."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceScheduler.clear()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceScheduler.addService(TDSServiceSchedulerClear)
+
+# ---------------------------------------------------------...
[truncated message content] |
|
From: remi <c2m...@c2...> - 2009-05-26 15:56:35
|
Author: remi
Date: 2009-05-26 17:56:20 +0200 (Tue, 26 May 2009)
New Revision: 4677
Modified:
software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
Log:
* don't serve removed directories
Modified: software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py 2009-05-26 15:50:16 UTC (rev 4676)
+++ software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py 2009-05-26 15:56:20 UTC (rev 4677)
@@ -59,18 +59,10 @@
# Load and start the resources manager
resourcesManager.load(TDS_RESOURCES_PATH)
resourcesManager.addDirectoryToServe("/data/xsl/")
- resourcesManager.addDirectoryToServe("/data/js/")
- resourcesManager.addDirectoryToServe("/data/html/")
- resourcesManager.addDirectoryToServe("/data/css/")
- resourcesManager.addDirectoryToServe("/data/gif/")
resourcesManager.addFileToServe(os.path.join(TDS_APPLICATION_PATH,
"data", "favicon", "favicon.ico"), "/favicon.ico")
# Load wiky scripts
resourcesManager.addDirectoryToServe("/data/web_interface/common/wiky/")
- # Load skins
- resourcesManager.addDirectoryToServe("/data/web_interface/01/xsl/")
- resourcesManager.addDirectoryToServe("/data/web_interface/01/css/")
- resourcesManager.addDirectoryToServe("/data/web_interface/01/gif/")
# Devel web interface
resourcesManager.addDirectoryToServe("/data/web_interface/devel/xsl/")
resourcesManager.addDirectoryToServe("/data/web_interface/devel/css/")
|
Author: remi
Date: 2009-05-26 17:50:16 +0200 (Tue, 26 May 2009)
New Revision: 4676
Added:
software_suite_v3/smart-core/smart-server/trunk/content/
software_suite_v3/smart-core/smart-server/trunk/content/gadgets/
software_suite_v3/smart-core/smart-server/trunk/content/plugins/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/alerts.css
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/common.css
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/main.css
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/pg_infos.css
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/gi_top_left_logo.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_activated.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-bottom.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-top.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-bottom.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-middle.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-top.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-alerts.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-commands.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-help.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-parameters.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-bg.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-enabled.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-over.png
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/common.js
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/gadget.js
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/plugin.js
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/ugc.js
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/alert.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/gadget_edit.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/gadget_infos.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/gadget_preview.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/index.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/parameter.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_gadget_common.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_infos.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/plugin_to_gadget.xsl
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/xsl/ugc_infos.xsl
software_suite_v3/smart-core/smart-server/trunk/resources/01_robot_system/resourceGagdetsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_advanced_api/resourceUgcServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/04_web_interface/resourceWIDevel.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/Gadget.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/GadgetDescription.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/GadgetGenerator.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/GadgetsContainer.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/__init__.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/UgcContainer.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/UgcDescription.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/UgcParameter.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/UgcTask.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/__init__.py
Removed:
software_suite_v3/smart-core/smart-server/trunk/data/attitunes/
software_suite_v3/smart-core/smart-server/trunk/data/css/
software_suite_v3/smart-core/smart-server/trunk/data/gadgets/
software_suite_v3/smart-core/smart-server/trunk/data/gif/
software_suite_v3/smart-core/smart-server/trunk/data/plugins/
software_suite_v3/smart-core/smart-server/trunk/data/web_interface/01/
software_suite_v3/smart-core/smart-server/trunk/data/xsl/gadgets.xsl
software_suite_v3/smart-core/smart-server/trunk/data/xsl/gadgets_all_of_frames.xsl
software_suite_v3/smart-core/smart-server/trunk/data/xsl/web_gadget.xsl
software_suite_v3/smart-core/smart-server/trunk/resources/03_advanced_api/resourceTestGadgetMessage.py
software_suite_v3/smart-core/smart-server/trunk/resources/04_web_interface/resourceWIPlugin.py
Modified:
software_suite_v3/smart-core/smart-server/trunk/TDSConfiguration.py
software_suite_v3/smart-core/smart-server/trunk/TDSHTTPServer.py
software_suite_v3/smart-core/smart-server/trunk/TDSResourcesManager.py
software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_robot_system/resourcePluginsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_robot_system/resourceScheduler.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginParameter.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginTask.py
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py
software_suite_v3/smart-core/smart-server/trunk/util/filesystem/AutoDeployer.py
software_suite_v3/smart-core/smart-server/trunk/util/filesystem/DirectoryContentObserver.py
Log:
* added scp/scg/ugc format support
* started web interface for gadget development/debug
Modified: software_suite_v3/smart-core/smart-server/trunk/TDSConfiguration.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TDSConfiguration.py 2009-05-26 12:37:40 UTC (rev 4675)
+++ software_suite_v3/smart-core/smart-server/trunk/TDSConfiguration.py 2009-05-26 15:50:16 UTC (rev 4676)
@@ -40,7 +40,7 @@
# HTTP server Port
TDS_HTTP_PORT = 270
# Use 50msec delay in request (CPU optimisation)
-TDS_50MSEC_OPTIMISATION = True
+TDS_50MSEC_OPTIMISATION = False
# Use asynchronous requests treatment
TDS_HTTP_ASYNCHRONOUS_REQUESTS = True
# Use asynchronous requests reception
Modified: software_suite_v3/smart-core/smart-server/trunk/TDSHTTPServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TDSHTTPServer.py 2009-05-26 12:37:40 UTC (rev 4675)
+++ software_suite_v3/smart-core/smart-server/trunk/TDSHTTPServer.py 2009-05-26 15:50:16 UTC (rev 4676)
@@ -20,6 +20,7 @@
import os
import time
import urllib
+import cgi
from util.logger import *
from TDSConfiguration import *
@@ -295,6 +296,55 @@
serverLogger.logError(self.__formatException())
# --------------------------------------------------------------------------
+ # Handling a "POST" request.
+ # --------------------------------------------------------------------------
+ def do_POST(self):
+ """Handling a "POST" request.
+ """
+ # Parse the form data posted
+ form = cgi.FieldStorage(
+ fp = self.rfile,
+ headers = self.headers,
+ environ = {
+ 'REQUEST_METHOD':'POST',
+ 'CONTENT_TYPE':self.headers['Content-Type'],
+ })
+ # Reformat request as GET command
+ self.path += "?"
+ for field in form.keys():
+ field_item = form[field]
+ self.path += "%s=%s&" % (field, form[field].value)
+ if self.path[-1] == "&":
+ self.path = self.path[:-1]
+ serverLogger.logDebug("Request : (%s)" % self.path)
+ if TDS_50MSEC_OPTIMISATION:
+ time.sleep(0.05)
+ code, headers, content = resourcesManager.executeUrl(self.path)
+ #headers.append(["Location", self.path])
+ if code == 404:
+ try:
+ serverLogger.logWarning("Invalid request : (%s)" % self.path)
+ self.send_error(404, 'Service Not Found')
+ except:
+ serverLogger.logError("(do_GET) Error while sending 404 error")
+ serverLogger.logError(self.__formatException())
+ else:
+ try:
+ self.send_response(code)
+ except:
+ serverLogger.logError("(do_HEADER) Error while sending response code")
+ serverLogger.logError(self.__formatException())
+ if not self.__sendHeaders(headers, content):
+ return
+ if content != None:
+ try:
+ self.wfile.write(content)
+ self.wfile.flush()
+ except:
+ serverLogger.logError("(do_GET) Error while sending content")
+ serverLogger.logError(self.__formatException())
+
+ # --------------------------------------------------------------------------
# Handle one request.
# --------------------------------------------------------------------------
def handle_one_request(self):
Modified: software_suite_v3/smart-core/smart-server/trunk/TDSResourcesManager.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TDSResourcesManager.py 2009-05-26 12:37:40 UTC (rev 4675)
+++ software_suite_v3/smart-core/smart-server/trunk/TDSResourcesManager.py 2009-05-26 15:50:16 UTC (rev 4676)
@@ -255,8 +255,8 @@
# --------------------------------------------------------------------------
#
# --------------------------------------------------------------------------
- def addBinding(self, url, resourceName, serviceName):
- self.__bindingList[url] = [resourceName, serviceName]
+ def addBinding(self, url, resourceName, serviceName, parameters = ""):
+ self.__bindingList[url] = [resourceName, serviceName, parameters]
self.__logger.logInfo("A binding has been added [%s] -> [%s]" % (url,
"%s/%s" % (resourceName, serviceName)))
@@ -271,6 +271,8 @@
url = url[sepIdx:]
else:
url = ""
+ if len(url) < 2:
+ url = "?" + self.__bindingList[bind][2]
return url, self.__bindingList[bind][0], self.__bindingList[bind][1]
return None, None, None
@@ -294,6 +296,12 @@
headers = [['Content-type', 'image/gif; charset="utf-8"'],]
elif fileName.lower().rfind(".ico") != -1:
headers = [['Content-type', 'image/x-icon; charset="utf-8"'],]
+ elif fileName.lower().rfind(".scp") != -1:
+ headers = [['Content-type', 'application/x-scp; charset="utf-8"'],]
+ elif fileName.lower().rfind(".scg") != -1:
+ headers = [['Content-type', 'application/x-scg; charset="utf-8"'],]
+ elif fileName.lower().rfind(".ugc") != -1:
+ headers = [['Content-type', 'application/x-bin; charset="utf-8"'],]
else:
return
try:
@@ -324,12 +332,14 @@
headers = [['Content-type', 'js; charset="utf-8"'],]
elif destUrl.lower().rfind(".xml") != -1:
headers = [['Content-type', 'text/xml; charset="utf-8"'],]
- elif fileName.lower().rfind(".css") != -1:
+ elif destUrl.lower().rfind(".css") != -1:
headers = [['Content-type', 'text/css; charset="utf-8"'],]
- elif fileName.lower().rfind(".gif") != -1:
+ elif destUrl.lower().rfind(".gif") != -1:
headers = [['Content-type', 'image/gif; charset="utf-8"'],]
- elif fileName.lower().rfind(".ico") != -1:
+ elif destUrl.lower().rfind(".ico") != -1:
headers = [['Content-type', 'image/x-icon; charset="utf-8"'],]
+ elif destUrl.lower().rfind(".ugc") != -1:
+ headers = [['Content-type', 'image/x-bin; charset="utf-8"'],]
else:
return
headers.append(['Content-Length', str(len(content))])
@@ -357,6 +367,21 @@
# --------------------------------------------------------------------------
#
# --------------------------------------------------------------------------
+ def getServedFileContent(self, destUrl):
+ self.__dynamicFilesMutex.acquire()
+ if not self.__servedDynamicFilesStruct.has_key(destUrl):
+ self.__dynamicFilesMutex.release()
+ return None
+ try:
+ result = self.__servedDynamicFilesStruct[destUrl]['content']
+ except:
+ result = None
+ self.__dynamicFilesMutex.release()
+ return result
+
+ # --------------------------------------------------------------------------
+ #
+ # --------------------------------------------------------------------------
def addDirectoryToServe(self, path):
filesList = {}
diskPath = os.path.join(TDS_APPLICATION_PATH, path[1:-1])
Modified: software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py 2009-05-26 12:37:40 UTC (rev 4675)
+++ software_suite_v3/smart-core/smart-server/trunk/TuxDroidServer.py 2009-05-26 15:50:16 UTC (rev 4676)
@@ -71,6 +71,11 @@
resourcesManager.addDirectoryToServe("/data/web_interface/01/xsl/")
resourcesManager.addDirectoryToServe("/data/web_interface/01/css/")
resourcesManager.addDirectoryToServe("/data/web_interface/01/gif/")
+ # Devel web interface
+ resourcesManager.addDirectoryToServe("/data/web_interface/devel/xsl/")
+ resourcesManager.addDirectoryToServe("/data/web_interface/devel/css/")
+ resourcesManager.addDirectoryToServe("/data/web_interface/devel/img/")
+ resourcesManager.addDirectoryToServe("/data/web_interface/devel/js/")
resourcesManager.start()
# Start the clients manager
clientsManager.start()
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/alerts.css
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/alerts.css (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/alerts.css 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,19 @@
+select.selectTime{
+ font-family:Verdana, Bitstream Vera Sans;
+ font-size:8pt;
+ background-color:#A9B5BD;
+ border-color:#3F3F3F;
+ border-style:solid;
+ border-width:1px;
+ width:40px;
+}
+
+select.selectYear{
+ font-family:Verdana, Bitstream Vera Sans;
+ font-size:8pt;
+ background-color:#A9B5BD;
+ border-color:#3F3F3F;
+ border-style:solid;
+ border-width:1px;
+ width:55px;
+}
\ No newline at end of file
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/alerts.css
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/common.css
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/common.css (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/common.css 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,89 @@
+input.text{
+ font-family:Verdana, Bitstream Vera Sans;
+ font-size:8pt;
+ background-color:#A9B5BD;
+ border-color:#3F3F3F;
+ border-style:solid;
+ border-width:1px;
+ width:180px;
+ vertical-align:bottom;
+}
+
+select.select{
+ font-family:Verdana, Bitstream Vera Sans;
+ font-size:8pt;
+ background-color:#A9B5BD;
+ border-color:#3F3F3F;
+ border-style:solid;
+ border-width:1px;
+ display:block;
+ width:180px;
+}
+
+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;
+}
\ No newline at end of file
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/common.css
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/main.css
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/main.css (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/main.css 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,147 @@
+div.thumbnailsBg{
+ height:100px;
+ width:500px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-thumbnails-bg.png);
+}
+
+.mainThumbIcon{
+ position:absolute;
+ top:15px;
+ left:227px;
+ display:table;
+}
+
+.m2ThumbIcon{
+ position:absolute;
+ top:26px;
+ left:55px;
+ display:table;
+}
+
+.m1ThumbIcon{
+ position:absolute;
+ top:26px;
+ left:120px;
+ display:table;
+}
+
+.p1ThumbIcon{
+ position:absolute;
+ top:26px;
+ left:332px;
+ display:table;
+}
+
+.p2ThumbIcon{
+ position:absolute;
+ top:26px;
+ left:397px;
+ display:table;
+}
+
+.mainThumbName{
+ position:absolute;
+ top:65px;
+ margin-left:200px;
+ width:100px;
+ font-size:10px;
+ font-weight:bold;
+ color:#EC6500;
+ text-align:center;
+}
+
+div.tbElementContent{
+ width:400px;
+ height:25px;
+ display:table;
+ margin-top:10px;
+ margin-left:50px;
+ margin-right:50px;
+ background-color:#090909;
+ color:#090909;
+}
+
+iframe.tbElementView{
+}
+
+.tbButtonPreview{
+ position:absolute;
+ top:36px;
+ left:5px;
+ width:28px;
+ height:28px;
+ display:table;
+ line-height:28px;
+ background-image:url(/data/web_interface/devel/img/pg-thumbnails-preview-enabled.png);
+}
+
+.tbButtonPreview:hover{
+ background-image:url(/data/web_interface/devel/img/pg-thumbnails-preview-over.png);
+}
+
+.tbButtonNext{
+ position:absolute;
+ top:36px;
+ left:467px;
+ width:28px;
+ height:28px;
+ display:table;
+ line-height:28px;
+ background-image:url(/data/web_interface/devel/img/pg-thumbnails-next-enabled.png);
+}
+
+.tbButtonNext:hover{
+ background-image:url(/data/web_interface/devel/img/pg-thumbnails-next-over.png);
+}
+
+/* For global gui temp ... */
+div.topLeftLogo{
+ float:left;
+ background-image:url(/data/web_interface/devel/img/gi_top_left_logo.png);
+ width:200px;
+ height:70px;
+ display:table;
+}
+
+a.topButton{
+ float:left;
+ margin-top:7px;
+ width:100px;
+ height:55px;
+ display:table;
+ line-height:55px;
+ text-decoration:none;
+ background-image:url(/data/web_interface/devel/img/menu_top_bt_enabled.png);
+ font-size:14px;
+ font-family:Verdana, Bitstream Vera Sans;
+ color:white;
+ font-weight:bold;
+ text-align:center;
+}
+
+a.topButton:hover{
+ background-image:url(/data/web_interface/devel/img/menu_top_bt_over.png);
+ color:#EC6500;
+}
+
+a.topButton:active{
+ color:white;
+ background-image:url(/data/web_interface/devel/img/menu_top_bt_activated.png);
+}
+
+a.topButtonActive{
+ float:left;
+ margin-top:7px;
+ width:100px;
+ height:55px;
+ display:table;
+ line-height:55px;
+ text-decoration:none;
+ background-image:url(/data/web_interface/devel/img/menu_top_bt_activated.png);
+ font-size:14px;
+ font-family:Verdana, Bitstream Vera Sans;
+ color:white;
+ font-weight:bold;
+ text-align:center;
+}
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/main.css
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/pg_infos.css
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/pg_infos.css (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/pg_infos.css 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,315 @@
+div.descriptionTop{
+ height:100px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-desc-bg-top.png);
+}
+
+div.descriptionBottom{
+ height:10px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-desc-bg-bottom.png);
+}
+
+.descriptionIcon{
+ position:relative;
+ top:10px;
+ left:10px;
+ display:table;
+}
+
+.decriptionName{
+ position:relative;
+ top:5px;
+ left:10px;
+ width:100%;
+ font-size:19px;
+ font-weight:bold;
+ color:#EC6500;
+ display:table;
+}
+
+.descriptionBox{
+ position:relative;
+ top:0px;
+ left:70px;
+ width:270px;
+ margin-right:60px;
+ margin-top:-35px;
+ text-align:center;
+ vertical-align:middle;
+ float:left;
+ display:table;
+}
+
+.descriptionDescription{
+ font-size:14px;
+ color:white;
+}
+
+.descriptionAuthor{
+ font-size:9px;
+ color:#EC6500;
+}
+
+div.sectionSepParameters{
+ height:20px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-sep-parameters.png);
+}
+
+div.sectionSepAlerts{
+ height:20px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-sep-alerts.png);
+}
+
+div.sectionSepHelp{
+ height:20px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-sep-help.png);
+}
+
+div.sectionSepCommands{
+ height:20px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-sep-commands.png);
+}
+
+.sectionSepTitle{
+ font-size:11px;
+ font-weight:bold;
+ color:#EC6500;
+ margin-left:25px;
+ vertical-align:middle;
+}
+
+div.sectionContentTop{
+ margin-top:5px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-content-bg-top.png);
+ background-repeat:no-repeat;
+ height:10px;
+ width:400px;
+ overflow: hidden;
+}
+
+div.sectionContentTop2{
+ height:10px;
+ width:400px;
+ display:table;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-content-bg-middle.png);
+ background-repeat:repeat;
+}
+
+div.sectionContentBottom{
+ height:10px;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-content-bg-bottom.png);
+ background-repeat:no-repeat;
+ background-color:#090909;
+ overflow: hidden;
+}
+
+div.sectionContentRowBox{
+ height:25px;
+ display:table;
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-image:url(/data/web_interface/devel/img/pg-sec-content-bg-middle.png);
+ background-repeat:repeat;
+}
+
+div.sectionContentCol12{
+ float:left;
+ width:197px;
+ font-family:Verdana, Bitstream Vera Sans;
+ vertical-align:middle;
+ text-align:right;
+}
+
+div.sectionContentCol22{
+ float:right;
+ width:197px;
+ font-family:Verdana, Bitstream Vera Sans;
+ vertical-align:middle;
+ text-align:left;
+}
+
+div.sectionContentCol13{
+ float:left;
+ width:40px;
+ font-family:Verdana, Bitstream Vera Sans;
+ vertical-align:middle;
+ text-align:center;
+}
+
+div.sectionContentCol23{
+ float:left;
+ width:157px;
+ font-family:Verdana, Bitstream Vera Sans;
+ vertical-align:middle;
+ text-align:right;
+}
+
+div.sectionContentCol33{
+ float:right;
+ width:197px;
+ font-family:Verdana, Bitstream Vera Sans;
+ vertical-align:middle;
+ text-align:left;
+}
+
+.sectionContentPName{
+ font-size:11px;
+}
+
+div.sectionElementDescBox{
+ width:400px;
+ font-family:Verdana, Bitstream Vera Sans;
+ background-color:#090909;
+ margin-top:5px;
+}
+
+.sectionElementDescName{
+ left:10px;
+ color:white;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:underline;
+ margin-left:15px;
+}
+
+.sectionElementDescNameCheck{
+ left:0px;
+ color:white;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:underline;
+ margin-left:0px;
+}
+
+.sectionElementDescDescription{
+ left:10px;
+ color:white;
+ font-size:11px;
+ font-style:italic;
+ margin-left:15px;
+}
+
+div.descriptionHelpBox{
+ position:relative;
+ height:200px;
+ width:372px;
+ border-color:black;
+ border-style:solid;
+ border-width:1px;
+ background-color:#A9B5BD;
+ overflow: auto;
+ font-size:8pt;
+ font-family:Verdana, Bitstream Vera Sans;
+ color: black;
+ margin-left:13px;
+ margin-top:5px;
+}
+
+.sectionElementColName{
+ color:black;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:underline;
+}
+
+.sectionElementColDescription{
+ color:black;
+ font-size:11px;
+ font-style:italic;
+}
+
+.sectionElementColSingle{
+ margin-top:12px;
+ color:black;
+ font-size:11px;
+ font-weight:bold;
+ vertical-align:middle;
+ float:left;
+ display:table;
+ width:197px;
+ text-align:right;
+}
+
+.buttonStart{
+ margin-top:10px;
+ margin-left:12px;
+ width:73px;
+ height:23px;
+ float:left;
+ display:table;
+ vertical-align:middle;
+ color:white;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:none;
+ font-family:Verdana, Bitstream Vera Sans, Arial, Helvetica, sans-serif;
+ text-align:center;
+ line-height:23px;
+ background-image:url(/data/web_interface/devel/img/pg-bt-start-enabled.png);
+}
+
+a.buttonStart:hover{
+ color:#EC6500;
+ background-image:url(/data/web_interface/devel/img/pg-bt-start-over.png);
+}
+
+.buttonStop{
+ margin-top:10px;
+ margin-right:22px;
+ width:73px;
+ height:23px;
+ float:right;
+ display:table;
+ vertical-align:middle;
+ color:white;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:none;
+ font-family:Verdana, Bitstream Vera Sans, Arial, Helvetica, sans-serif;
+ text-align:center;
+ line-height:23px;
+ background-image:url(/data/web_interface/devel/img/pg-bt-stop-enabled.png);
+}
+
+a.buttonStop:hover{
+ color:#EC6500;
+ background-image:url(/data/web_interface/devel/img/pg-bt-stop-over.png);
+}
+
+.button170{
+ margin-top:10px;
+ margin-left:0px;
+ width:170px;
+ height:23px;
+ float:left;
+ display:table;
+ vertical-align:middle;
+ color:white;
+ font-size:11px;
+ font-weight:bold;
+ text-decoration:none;
+ font-family:Verdana, Bitstream Vera Sans, Arial, Helvetica, sans-serif;
+ text-align:center;
+ line-height:23px;
+ background-image:url(/data/web_interface/devel/img/pg-bt-170-enabled.png);
+}
+
+a.button170:hover{
+ color:#EC6500;
+ background-image:url(/data/web_interface/devel/img/pg-bt-170-over.png);
+}
\ No newline at end of file
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/css/pg_infos.css
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/gi_top_left_logo.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/gi_top_left_logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_activated.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_activated.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/menu_top_bt_over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-170-over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-start-over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-bt-stop-over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-bottom.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-bottom.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-top.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-desc-bg-top.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-bottom.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-bottom.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-middle.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-middle.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-top.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-content-bg-top.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-alerts.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-alerts.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-commands.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-commands.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-help.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-help.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-parameters.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-sec-sep-parameters.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-bg.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-bg.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-next-over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-enabled.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-enabled.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-over.png
===================================================================
(Binary files differ)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/img/pg-thumbnails-preview-over.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/common.js
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/common.js (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/common.js 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,278 @@
+/**
+ *
+ */
+function fillHelpBox()
+{
+ document.getElementById("helpBox").innerHTML = Wiky.toHtml(document.getElementById("req_helpContent").value);
+}
+
+/**
+ *
+ */
+function setpng(img)
+{
+ if (document.all && (IEver=parseFloat(navigator.appVersion.split("MSIE")[1])) && (IEver>=5.5) && (IEver<7) && document.body.filters && img)
+ {
+ var imgName = img.src.toUpperCase();
+ if (imgName.substring(imgName.length-3,imgName.length) == "PNG")
+ {
+ img.outerHTML= "<span "+(img.id?"id='"+img.id+"' ":"")+(img.className?"class='"+img.className+"' ":"")+(img.title?"title=\""+img.title+"\" ":"")
+ +"style=\"width:"+img.width+"px;height:"+img.height+"px;"+(img.align=="left"?"float:left;":(img.align=="right"?"float:right;":""))
+ +(img.parentElement.href?"cursor:hand;":"")+"display:inline-block;"+img.style.cssText+";"
+ +"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"',sizingMethod='scale');\"></span>";
+ }
+ }
+}
+
+/**
+ *
+ */
+function formatValue(value)
+{
+ value = value.replace(/(\r?\n)/g, '[RETURN]');
+ value = value.replace('/\&/g', '&&');
+ value = value.replace(/\|/g, '[PIPE]');
+ value = value.replace(/\=/g, '[EQUAL]');
+ value = value.replace(/\&/g, '[AMP]');
+ return value;
+}
+
+/**
+ *
+ */
+function computeParameters()
+{
+ var result = '';
+ var elements = document.getElementsByTagName('input');
+ for (var i = 0; i < elements.length; i++)
+ {
+ var element = elements[i];
+ if (element.id.indexOf('req_', 0) == 0)
+ {
+ if (element.type == 'checkbox')
+ {
+ result += element.id + '=' + element.checked + '|';
+ }
+ else if (element.type == 'radio')
+ {
+ if (element.checked)
+ {
+ result += element.id + '=' + formatValue(element.value) + '|';
+ }
+ }
+ else
+ {
+ result += element.id + '=' + formatValue(element.value) + '|';
+ }
+ }
+ }
+ var elements = document.getElementsByTagName('select');
+ for (var i = 0; i < elements.length; i++)
+ {
+ var element = elements[i];
+ if (element.id.indexOf('req_', 0) == 0)
+ {
+ result += element.id + '=' + formatValue(element.value) + '|';
+ }
+ }
+ var helptext = "";
+ if (document.getElementById("req_helpContent") != null)
+ {
+ helptext = document.getElementById("req_helpContent").value;
+ }
+ result += 'req_helpContent=' + formatValue(helptext) + '|';
+ return result;
+}
+
+/**
+ *
+ */
+function postRequest(url, values)
+{
+ var httpRequest = false;
+ var isIe = false;
+ var result = new Array(false, "");
+ if (window.XMLHttpRequest)
+ { // Mozilla, Safari,...
+ httpRequest = new XMLHttpRequest();
+ if (httpRequest.overrideMimeType)
+ {
+ httpRequest.overrideMimeType('text/xml');
+ }
+ }
+ else
+ {
+ isIe = true;
+ if (window.ActiveXObject)
+ { // IE
+ try
+ {
+ httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e){}
+ }
+ }
+ }
+ if (!httpRequest)
+ {
+ alert('Cannot create XMLHTTP instance');
+ return result;
+ }
+ var data = "";
+ for (var property in values)
+ {
+ if (values.hasOwnProperty(property))
+ {
+ if (data.length > 0)
+ {
+ data += "&";
+ }
+ data += property + "=" + values[property];
+ }
+ }
+ httpRequest.open('POST', url, false);
+ var stateChangeFunction = function() {
+ if(httpRequest.readyState == 4)
+ {
+ if (httpRequest.status == 200)
+ {
+ result[0] = true;
+ result[1] = httpRequest.responseText;
+ }
+ }
+ }
+ if (isIe)
+ {
+ httpRequest.onreadystatechange = stateChangeFunction;
+ }
+ else
+ {
+ httpRequest.onload = stateChangeFunction;
+ }
+
+ try
+ {
+ httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ httpRequest.send(data);
+ }
+ catch (e)
+ {
+ return result;
+ }
+ return result;
+}
+
+/**
+ *
+ */
+function getRequest(url, values)
+{
+ var httpRequest = false;
+ var isIe = false;
+ var result = false;
+ if (window.XMLHttpRequest)
+ { // Mozilla, Safari,...
+ httpRequest = new XMLHttpRequest();
+ if (httpRequest.overrideMimeType)
+ {
+ httpRequest.overrideMimeType('text/xml');
+ }
+ }
+ else
+ {
+ isIe = true;
+ if (window.ActiveXObject)
+ { // IE
+ try
+ {
+ httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e){}
+ }
+ }
+ }
+ if (!httpRequest)
+ {
+ alert('Cannot create XMLHTTP instance');
+ return result;
+ }
+ url += "?rndTag=" + Math.random() ;
+ for (var property in values)
+ {
+ if (values.hasOwnProperty(property))
+ {
+ url += "&" + property + "=" + values[property];
+ }
+ }
+ httpRequest.open('GET', url, false);
+ var stateChangeFunction = function() {
+ if(httpRequest.readyState == 4)
+ {
+ if (httpRequest.status == 200)
+ {
+ result = true;
+ }
+ }
+ }
+ if (isIe)
+ {
+ httpRequest.onreadystatechange = stateChangeFunction;
+ }
+ else
+ {
+ httpRequest.onload = stateChangeFunction;
+ }
+ try
+ {
+ httpRequest.send(null);
+ }
+ catch (e)
+ {
+ return result;
+ }
+ return result;
+}
+
+/**
+ *
+ */
+function gotoLocation(url, values)
+{
+ url += "?";
+ for (var property in values)
+ {
+ if (values.hasOwnProperty(property))
+ {
+ url += property + "=" + values[property] + "&";
+ }
+ }
+ window.location = url;
+}
+
+/**
+ *
+ */
+function showPopup(url, values)
+{
+ url += "?";
+ for (var property in values)
+ {
+ if (values.hasOwnProperty(property))
+ {
+ url += property + "=" + values[property] + "&";
+ }
+ }
+ window.open(url);
+}
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/common.js
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/gadget.js
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/gadget.js (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/gadget.js 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,207 @@
+/**
+ *
+ */
+function showPreview()
+{
+ var uuid = document.getElementById("uuid").value;
+ var skin = '"' + document.getElementById("skin").value + '"';
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "language" : language,
+ "parameters" : computeParameters()
+ }
+ res = postRequest("/wi_devel/post_preview_gadget", args);
+ args = {
+ "language" : language,
+ "skin" : skin,
+ "rndTag" : Math.random()
+ }
+ if (res[0])
+ {
+ showPopup("/wi_devel/show_preview_gadget", args);
+ }
+}
+
+/**
+ *
+ */
+function startGadget(command)
+{
+ var parametersString = "";
+ var uuid = document.getElementById("uuid").value;
+
+ var parameters = document.getElementsByTagName("input");
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if (param.id == 'unvisible')
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if ((param.type != 'button') && (param.id != 'unvisible') && (param.name != ''))
+ {
+ if (param.type == 'checkbox')
+ {
+ parametersString += param.name + '=' + param.checked + '|';
+ }
+ else if (param.type == 'radio')
+ {
+ if (param.checked)
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+ else
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+ }
+
+ parameters = document.getElementsByTagName("select");
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ var args = {
+ "command" : command,
+ "uuid" : uuid,
+ "parameters" : parametersString
+ }
+ getRequest("/gadgets_server/start_gadget", args);
+}
+
+/**
+ *
+ */
+function stopGadget()
+{
+ var uuid = document.getElementById("uuid").value;
+ var args = {
+ "uuid" : uuid
+ }
+ getRequest("/gadgets_server/stop_gadget", args);
+}
+
+/**
+ *
+ */
+function editGadget()
+{
+ var uuid = document.getElementById("uuid").value;
+ var skin = document.getElementById("skin").value;
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "skin" : skin,
+ "language" : language
+ }
+ gotoLocation("/wi_devel/gadget_edit", args);
+}
+
+/**
+ *
+ */
+function deleteGadget()
+{
+ var answer = confirm("This operation will deleting this gadget. Continue?");
+ if (answer)
+ {
+ var uuid = document.getElementById("uuid").value;
+ var args = {
+ "uuid" : uuid
+ }
+ getRequest("/gadgets_server/remove_gadget", args);
+ var skin = document.getElementById("skin").value;
+ var language = document.getElementById("language").value;
+ var url2 = "/devel/index?menu=gadgets&firstUuid=NULL";
+ url2 += '&skin="' + skin + '"';
+ url2 += "&language=" + language;
+ window.top.location = url2;
+ }
+}
+
+/**
+ *
+ */
+function generateGadget()
+{
+ var answer = confirm("This will generate a new gadget in the system. Continue?");
+ if (answer)
+ {
+ var uuid = document.getElementById("uuid").value;
+ var skin = '"' + document.getElementById("skin").value + '"';
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "o_uuid" : "NULL",
+ "language" : language,
+ "parameters" : computeParameters()
+ }
+ res = postRequest("/wi_devel/generate_gadget", args);
+ var url = "/devel/index?menu=gadgets";
+ url += "&firstUuid=NULL";
+ url += '&skin="' + skin + '"';
+ url += "&language=" + language;
+ window.top.location = url;
+ }
+}
+
+/**
+ *
+ */
+function applyGadget()
+{
+ var answer = confirm("This will update the gadget in the system. Continue?");
+ if (answer)
+ {
+ var uuid = document.getElementById("uuid").value;
+ var o_uuid = document.getElementById("o_uuid").value;
+ var skin = '"' + document.getElementById("skin").value + '"';
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "o_uuid" : o_uuid,
+ "language" : language,
+ "parameters" : computeParameters()
+ }
+ res = postRequest("/wi_devel/generate_gadget", args);
+ var url = "/devel/index?menu=gadgets";
+ url += "&firstUuid=" + o_uuid;
+ url += '&skin="' + skin + '"';
+ url += "&language=" + language;
+ window.top.location = url;
+ }
+}
+
+/**
+ *
+ */
+function duplicateGadget()
+{
+ var answer = confirm("This operation will duplicate the gadget in the system. Continue?");
+ if (answer)
+ {
+ var uuid = document.getElementById("uuid").value;
+ var skin = document.getElementById("skin").value;
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "language" : language
+ }
+ getRequest("/wi_devel/gadget_duplicate", args);
+ var url2 = "/devel/index?menu=gadgets";
+ url2 += "&firstUuid=NULL";
+ url2 += '&skin="' + skin + '"';
+ url2 += "&language=" + language;
+ window.top.location = url2;
+ }
+}
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/gadget.js
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/plugin.js
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/plugin.js (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/plugin.js 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,83 @@
+/**
+ *
+ */
+function startPlugin(command)
+{
+ var parametersString = "";
+ var uuid = document.getElementById("uuid").value;
+
+ var parameters = document.getElementsByTagName("input");
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if (param.id == 'unvisible')
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if ((param.type != 'button') && (param.id != 'unvisible') && (param.name != ''))
+ {
+ if (param.type == 'checkbox')
+ {
+ parametersString += param.name + '=' + param.checked + '|';
+ }
+ else if (param.type == 'radio')
+ {
+ if (param.checked)
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+ else
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+ }
+
+ parameters = document.getElementsByTagName("select");
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ var args = {
+ "command" : command,
+ "uuid" : uuid,
+ "parameters" : parametersString
+ }
+ getRequest("/plugins_server/start_plugin", args);
+}
+
+/**
+ *
+ */
+function stopPlugin()
+{
+ var uuid = document.getElementById("uuid").value;
+ var args = {
+ "uuid" : uuid
+ }
+ getRequest("/plugins_server/stop_plugin", args);
+}
+
+/**
+ *
+ */
+function makeNewGadget()
+{
+ var uuid = document.getElementById("uuid").value;
+ var skin = document.getElementById("skin").value;
+ var language = document.getElementById("language").value;
+ var args = {
+ "uuid" : uuid,
+ "skin" : skin,
+ "language" : language
+ }
+ gotoLocation("/wi_devel/plugin_to_gadget", args);
+}
Property changes on: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/plugin.js
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/ugc.js
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/ugc.js (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/data/web_interface/devel/js/ugc.js 2009-05-26 15:50:16 UTC (rev 4676)
@@ -0,0 +1,139 @@
+/**
+ *
+ */
+function startUgc(command)
+{
+ var parametersString = "";
+ var uuid = document.getElementById("uuid").value;
+
+ var parameters = document.getElementsByTagName("input");
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if (param.id == 'unvisible')
+ {
+ parametersString += param.name + '=' + param.value.replace('&', '&&') + '|';
+ }
+ }
+
+ for (var i = 0; i < parameters.length; i++)
+ {
+ var param = parameters[i];
+ if ((param.type != 'button') && (param.id != 'unvisible') && (param.name != ''))
+ {
+ if (param.type == 'checkbox')
+ {
+ parametersString += param.name + '=' + param.checked + '|';
+ }
+ else if (param.type == 'radio')
+ {
+ ...
[truncated message content] |
|
From: jerome <c2m...@c2...> - 2009-05-26 13:13:25
|
Author: jerome Date: 2009-05-26 14:17:47 +0200 (Tue, 26 May 2009) New Revision: 4673 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml Log: *Added gadget description. Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml 2009-05-26 12:17:47 UTC (rev 4673) @@ -0,0 +1,53 @@ + +<gadget> + <interpreter + kind="java"> + <executable> FacebookGadget</executable> + </interpreter> + <description> + <name>Facebook Gadget</name> + <description>This gadget connects to your facebook account to get base informations</description> + <author>Jerome Conan</author> + <version>0.1</version> + <iconFile>resources/gadget.png</iconFile> + <executionMode>command</executionMode> + <uuid>1f0f6400-49ee-11de-8a39-0800200c9a66</uuid> + </description> + <parameters> + <parameter + category="Gadget parameters" + name="notifyEmail" + description="Give messages count" + type="boolean" + defaultValue="true" /> + <parameter + category="Gadget parameters" + name="showFriendRequests" + description="Give friend requests" + type="boolean" + defaultValue="true" /> + <parameter + category="Gadget parameters" + name="showGroupsInvites" + description="Give group invites" + type="boolean" + defaultValue="true" /> + <parameter + category="Gadget parameters" + name="showEventsInvites" + description="Give event invites" + type="boolean" + defaultValue="true" /> + <parameter + category="Gadget parameters" + name="showPokes" + description="Give pokes count" + type="boolean" + defaultValue="true" /> + </parameters> + <commands> + <command + name="run" + description="Check the feed" /> + </commands> +</gadget> |
|
From: jerome <c2m...@c2...> - 2009-05-26 12:56:48
|
Author: jerome
Date: 2009-05-26 14:37:40 +0200 (Tue, 26 May 2009)
New Revision: 4675
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml
Log:
* Resource folder is now complete.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot 2009-05-26 12:34:16 UTC (rev 4674)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot 2009-05-26 12:37:40 UTC (rev 4675)
@@ -1,3 +1,27 @@
+msgid "Facebook Gadget"
+msgstr ""
+
+msgid "This gadget connects to your facebook account to get base informations"
+msgstr ""
+
+msgid "Give messages count"
+msgstr ""
+
+msgid "Give friend requests"
+msgstr ""
+
+msgid "Give group invites"
+msgstr ""
+
+msgid "Give event invites"
+msgstr ""
+
+msgid "Give pokes count"
+msgstr ""
+
+msgid "Check your facebook account"
+msgstr ""
+
msgid "You have {0} new messages"
msgstr ""
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml 2009-05-26 12:34:16 UTC (rev 4674)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.xml 2009-05-26 12:37:40 UTC (rev 4675)
@@ -48,6 +48,6 @@
<commands>
<command
name="run"
- description="Check the feed" />
+ description="Check your facebook account" />
</commands>
</gadget>
|
|
From: jerome <c2m...@c2...> - 2009-05-26 12:56:43
|
Author: jerome
Date: 2009-05-26 14:34:16 +0200 (Tue, 26 May 2009)
New Revision: 4674
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
Log:
* Updated po template to add connection information messages.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot 2009-05-26 12:17:47 UTC (rev 4673)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot 2009-05-26 12:34:16 UTC (rev 4674)
@@ -18,3 +18,15 @@
msgid "You have {0} pokes"
msgstr ""
+
+msgid "I must be connected to access your facebook account."
+msgstr ""
+
+msgid "I cannot get connected to your facebook account."
+msgstr ""
+
+msgid "I'm retrieving your account informations"
+msgstr ""
+
+msgid "Connect to your account and push my left wing"
+msgstr ""
|
|
From: jerome <c2m...@c2...> - 2009-05-26 12:06:22
|
Author: jerome Date: 2009-05-26 14:06:14 +0200 (Tue, 26 May 2009) New Revision: 4672 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.png Log: *Added gadget icon. Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
|
From: jerome <c2m...@c2...> - 2009-05-26 11:52:23
|
Author: jerome
Date: 2009-05-26 13:51:23 +0200 (Tue, 26 May 2009)
New Revision: 4671
Added:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
Log:
* Added gadget translation template.
Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot (rev 0)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/gadget.pot 2009-05-26 11:51:23 UTC (rev 4671)
@@ -0,0 +1,20 @@
+msgid "You have {0} new messages"
+msgstr ""
+
+msgid "You have {0} friend requests"
+msgstr ""
+
+msgid "From {0}"
+msgstr ""
+
+msgid "You have {0} group invites"
+msgstr ""
+
+msgid "to {0}"
+msgstr ""
+
+msgid "You have {0} event invites"
+msgstr ""
+
+msgid "You have {0} pokes"
+msgstr ""
|
|
From: jerome <c2m...@c2...> - 2009-05-26 11:49:53
|
Author: jerome Date: 2009-05-26 13:47:10 +0200 (Tue, 26 May 2009) New Revision: 4670 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/resources/ Log: * Added resources directory. |
|
From: jerome <c2m...@c2...> - 2009-05-26 11:44:13
|
Author: jerome
Date: 2009-05-26 13:44:03 +0200 (Tue, 26 May 2009)
New Revision: 4669
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
Log:
* Getting all base informations from facebook.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath 2009-05-26 11:34:05 UTC (rev 4668)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath 2009-05-26 11:44:03 UTC (rev 4669)
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/tuxdroid-gadget-java-kit"/>
- <classpathentry kind="lib" path="libraries"/>
<classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/activation-1.1.jar"/>
<classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/facebook-java-api-1.8.1.jar"/>
<classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/jaxb-api-2.1.jar"/>
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-26 11:34:05 UTC (rev 4668)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-26 11:44:03 UTC (rev 4669)
@@ -29,18 +29,19 @@
public class FacebookConnection {
public static String api_key = "a9eb7b7e52df160fb1dfc437b0b487c8";
+ public static String f_key = "0314c8569f89d0411e5a4823372ae27a";
private FacebookRestClient client;
private Long userId;
/**
* Class constructor.
*/
- public FacebookConnection(String secretKey, FacebookGadget gdg, TuxAPI tux)
+ public FacebookConnection(FacebookGadget gdg, TuxAPI tux)
{
try
{
//Create the client instance
- client = new FacebookRestClient(FacebookConnection.api_key, secretKey);
+ client = new FacebookRestClient(FacebookConnection.api_key, FacebookConnection.f_key);
//Is this a desktop app
client.setIsDesktop(true);
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-26 11:34:05 UTC (rev 4668)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-26 11:44:03 UTC (rev 4669)
@@ -400,7 +400,7 @@
{
if(this.notifications.containsKey("friend_requests"))
{
- return Integer.valueOf(this.notifications.get("friend_requests").get(0));
+ return Integer.valueOf(this.notifications.get("friend_requests").size());
}
else
{
@@ -420,7 +420,6 @@
if(this.notifications.containsKey("friend_requests"))
{
Vector<String> dat = this.notifications.get("friend_requests");
- dat.remove(0);
friends = dat;
}
return friends;
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-26 11:34:05 UTC (rev 4668)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-26 11:44:03 UTC (rev 4669)
@@ -32,7 +32,6 @@
*/
public class FacebookGadget extends SimpleGadget<FacebookGadget.Configuration>{
- public native String getKey();
private TuxAPI tux = null;
/**
@@ -142,24 +141,86 @@
this.showFriendRequests = aShowFriendRequests;
}
}
-
+
+
/**
* Gadget start method.
*/
@Override
protected void start() throws Throwable
{
- //First of all, loading our library.
- try
+ this.connectTuxApi();
+
+ if(tux.radio.getConnected())
{
- System.loadLibrary("./libraries/utils");
+ FacebookConnection facebook = new FacebookConnection(this, tux);
+ FacebookFunctions functions = new FacebookFunctions(facebook);
+
+ //Get email informations.
+ if(this.configuration().notifyEmail)
+ {
+ if(functions.getEmailNotifications().intValue() > 0)
+ {
+ throwMessage("You have {0} new messages", functions.getEmailNotifications().intValue());
+ }
+ }
+
+ //Get friend requests notification.
+ if(this.configuration().showFriendRequests)
+ {
+ if(functions.getFriendRequestsCount().intValue() > 0)
+ {
+ throwMessage("You have {0} friend requests", functions.getFriendRequestsCount());
+
+ for(String friendName : functions.getFriendRequestNames())
+ {
+ throwMessage("From {0}", friendName);
+ }
+ }
+ }
+
+ //Get group invites notifications.
+ if(this.configuration().showGroupsInvites)
+ {
+ if(functions.getGroupsInvitesCount().intValue() > 0)
+ {
+ throwMessage("You have {0} group invites", functions.getGroupsInvitesCount().intValue());
+
+ for(String group : functions.getGroupInvitesNames())
+ {
+ throwMessage("to {0}", group);
+ }
+ }
+ }
+
+ //Get pokes notification.
+ if(this.configuration().showEventsInvites)
+ {
+ if(functions.getEventsInvitesCount().intValue() > 0)
+ {
+ throwMessage("You have {0} event invites", functions.getEventsInvitesCount().intValue());
+
+ for(String event : functions.getEventInvitesNames())
+ {
+ throwMessage("to {0}", event);
+ }
+ }
+ }
+
+ if(this.configuration().showPokes)
+ {
+ if(functions.getPokesCount().intValue() > 0)
+ {
+ throwMessage("You have {0} pokes", functions.getPokesCount().intValue());
+ }
+ }
}
- catch(Exception libraryLoadError)
+ else
{
- throwMessage("Error while loading needed library");
+ throwMessage("I must be connected to access your facebook account.");
}
- this.connectTuxApi();
+ this.quitGadget();
}
@@ -175,6 +236,15 @@
/**
+ * Called when user stop the gadget.
+ */
+ private void quitGadget()
+ {
+ tux.destroy();
+ }
+
+
+ /**
* Main entry point.
* @param args
*/
|
|
From: jerome <c2m...@c2...> - 2009-05-26 11:34:10
|
Author: jerome Date: 2009-05-26 13:34:05 +0200 (Tue, 26 May 2009) New Revision: 4668 Removed: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/libraries/ Log: * Removed unused directory and binary. |
|
From: ks156 <c2m...@c2...> - 2009-05-26 11:31:03
|
Author: ks156
Date: 2009-05-26 13:29:57 +0200 (Tue, 26 May 2009)
New Revision: 4667
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java
Log:
* Removed the explicit option '--path='.
The path of the attitune is specified as a direct argument of the command :
- java -jar attitune_studio.jar -> starts att_studio with the default
template
- java -jar attitune_studio.jar PATH_TO_AN_ATTITUNE -> starts att_studio with
the specified attitune file
* Added a protection to be sure the specified path is valid.
Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java 2009-05-26 08:26:34 UTC (rev 4666)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java 2009-05-26 11:29:57 UTC (rev 4667)
@@ -66,10 +66,10 @@
{
/* Parse each options and try to find '--path' */
String arg = args[i];
-
- if(arg.contains("--path"))
+ java.io.File file = new java.io.File(arg);
+ if (file.isFile())
{
- path = arg.substring(arg.indexOf("=") + 1);
+ path = arg;
}
}
}
|
|
From: ks156 <c2m...@c2...> - 2009-05-26 08:27:09
|
Author: ks156
Date: 2009-05-26 10:26:34 +0200 (Tue, 26 May 2009)
New Revision: 4666
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java
Log:
* Added a new option '--path=' to be able to launch attitunes studio with a
defined attitune.
Attitunes_studio can now be started with the command :
'java -jar attitunes_studio.jar --path=PATH_TO_ATTITUNE'
Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2009-05-25 13:14:14 UTC (rev 4665)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2009-05-26 08:26:34 UTC (rev 4666)
@@ -94,7 +94,7 @@
/**
* MainFrame constructor
*/
- public MainFrame()
+ public MainFrame(String path)
{
super();
this.setVisible(false);
@@ -106,10 +106,18 @@
this.setResizable(false);
//this.pack();
TuxAPIMisc.sleep(0.15);
- this.setVisible(true);
+ this.setVisible(true);
- attBlockViewer.loadAttitune(ATTConfig.ATT_TEMPLATE_PATH); //$NON-NLS-1$
- attBlockViewer.setAttituneIsTemplate(true);
+ if (path == null)
+ {
+ attBlockViewer.loadAttitune(ATTConfig.ATT_TEMPLATE_PATH); //$NON-NLS-1$
+ attBlockViewer.setAttituneIsTemplate(true);
+ }
+ else
+ {
+ attBlockViewer.loadAttitune(path); //$NON-NLS-1$
+ attBlockViewer.setAttituneIsTemplate(false);
+ }
}
/*
Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java 2009-05-25 13:14:14 UTC (rev 4665)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java 2009-05-26 08:26:34 UTC (rev 4666)
@@ -54,7 +54,26 @@
public static void main(String[] args)
{
String fontName;
+
+ /* Create a new 'path' variable */
+ String path = null;
+ /* Compute the options */
+ if (args.length >= 1)
+ {
+ /* At least one option has been found */
+ for (int i = 0; i < args.length; i++)
+ {
+ /* Parse each options and try to find '--path' */
+ String arg = args[i];
+
+ if(arg.contains("--path"))
+ {
+ path = arg.substring(arg.indexOf("=") + 1);
+ }
+ }
+ }
+
// On windows
if (System.getProperty("os.name").contains("Windows"))
{
@@ -117,7 +136,7 @@
Font.BOLD,
11));
- MainFrame mainFrame = new MainFrame();
+ MainFrame mainFrame = new MainFrame(path);
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true);
}
|
|
From: jerome <c2m...@c2...> - 2009-05-25 13:14:27
|
Author: jerome
Date: 2009-05-25 15:14:14 +0200 (Mon, 25 May 2009)
New Revision: 4665
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
Log:
* Added functions to split notifications.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-25 12:56:57 UTC (rev 4664)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-25 13:14:14 UTC (rev 4665)
@@ -357,4 +357,140 @@
return notifications;
}
+
+
+ /**
+ * Return email notifications.
+ */
+ public Integer getEmailNotifications()
+ {
+ if(this.notifications.containsKey("messages"))
+ {
+ return Integer.valueOf(this.notifications.get("messages").get(0));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ /**
+ * Return how many pokes user has.
+ * @return
+ */
+ public Integer getPokesCount()
+ {
+ if(this.notifications.containsKey("pokes"))
+ {
+ return Integer.valueOf(this.notifications.get("pokes").get(0));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ /**
+ * Return the number of friend requests.
+ * @return
+ */
+ public Integer getFriendRequestsCount()
+ {
+ if(this.notifications.containsKey("friend_requests"))
+ {
+ return Integer.valueOf(this.notifications.get("friend_requests").get(0));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ /**
+ * Return the name of people that ask to be a friend of user.
+ * @return
+ */
+ public Vector<String> getFriendRequestNames()
+ {
+ Vector<String> friends = new Vector<String>();
+
+ if(this.notifications.containsKey("friend_requests"))
+ {
+ Vector<String> dat = this.notifications.get("friend_requests");
+ dat.remove(0);
+ friends = dat;
+ }
+ return friends;
+ }
+
+
+ /**
+ * Return the number of availables groups invites.
+ * @return
+ */
+ public Integer getGroupsInvitesCount()
+ {
+ if(this.notifications.containsKey("group_invites"))
+ {
+ return Integer.valueOf(this.notifications.get("group_invites").get(0));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ /**
+ * Return the name of groups invites.
+ * @return
+ */
+ public Vector<String> getGroupInvitesNames()
+ {
+ Vector<String> groups = new Vector<String>();
+
+ if(this.notifications.containsKey("group_invites"))
+ {
+ Vector<String> dat = this.notifications.get("group_invites");
+ dat.remove(0);
+ groups = dat;
+ }
+ return groups;
+ }
+
+ /**
+ * Return the number of events invites.
+ * @return
+ */
+ public Integer getEventsInvitesCount()
+ {
+ if(this.notifications.containsKey("event_invites"))
+ {
+ return Integer.valueOf(this.notifications.get("event_invites").get(0));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /**
+ * Return the name of events invites.
+ * @return
+ */
+ public Vector<String> getEventInvitesNames()
+ {
+ Vector<String> events = new Vector<String>();
+
+ if(this.notifications.containsKey("event_invites"))
+ {
+ Vector<String> dat = this.notifications.get("event_invites");
+ dat.remove(0);
+ events = dat;
+ }
+ return events;
+ }
}
|
|
From: jerome <c2m...@c2...> - 2009-05-25 13:03:23
|
Author: jerome
Date: 2009-05-25 14:45:53 +0200 (Mon, 25 May 2009)
New Revision: 4663
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
Log:
* Retrieving user notifications.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-25 12:00:06 UTC (rev 4662)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-25 12:45:53 UTC (rev 4663)
@@ -1,10 +1,13 @@
import java.io.IOException;
import java.util.EnumSet;
+import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
import com.facebook.api.FacebookException;
import com.facebook.api.ProfileField;
+import com.facebook.api.schema.Event;
+import com.facebook.api.schema.EventsGetResponse;
import com.facebook.api.schema.FriendsGetResponse;
import com.facebook.api.schema.User;
import com.facebook.api.schema.UsersGetInfoResponse;
@@ -34,6 +37,7 @@
public class FacebookFunctions {
private FacebookConnection connection;
+ private Hashtable<String, Vector<String>> notifications = new Hashtable<String, Vector<String>>();
/**
* Class constructor.
@@ -42,6 +46,7 @@
public FacebookFunctions(FacebookConnection connection)
{
this.connection = connection;
+ this.notifications = this.getUserNotification();
}
@@ -49,7 +54,7 @@
* Return the user friend list as Vector<String>.
* @return
*/
- private Vector<String> getFriends()
+ public Vector<String> getFriends()
{
Vector<String> friendsList = new Vector<String>();
@@ -83,4 +88,273 @@
return friendsList;
}
+
+
+ /**
+ * Gets all notifications.
+ */
+ private Hashtable<String, Vector<String>> getUserNotification()
+ {
+ //Will contain all availables notifications.
+ //availables notifications : messages, pokes, shares, friends_requests, group_invites, event_invites
+ Hashtable<String, Vector<String>> notifications = new Hashtable<String, Vector<String>>();
+
+ try
+ {
+ connection.getClient().notifications_get();
+ String notifs = connection.getClient().getRawResponse();
+
+ /**
+ * Getting messages notifications.
+ */
+ if(notifs.contains("<messages"))
+ {
+ String messagesString = notifs.substring(
+ notifs.indexOf("<messages"),
+ notifs.indexOf("</messages>"));
+
+ Vector<String> msDatas = new Vector<String>();
+
+ String unreaded = messagesString.substring(
+ messagesString.indexOf("<unread>") + "<unread>".length(),
+ messagesString.indexOf("</unread>"));
+
+ msDatas.add(unreaded);
+
+
+ if(Integer.valueOf(unreaded).intValue() > 0)
+ {
+ notifications.put("messages", msDatas);
+ }
+ }
+
+ /**
+ * Getting pokes notifications.
+ */
+ if(notifs.contains("<pokes"))
+ {
+ String pokesString;
+
+ try
+ {
+ pokesString = notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("</pokes>"));
+ }
+ catch(IndexOutOfBoundsException indexError)
+ {
+ pokesString = notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("/>"));
+ }
+
+ Vector<String> pkDatas = new Vector<String>();
+
+ String unreaded = pokesString.substring(
+ pokesString.indexOf("<unread>") + "<unread>".length(),
+ pokesString.indexOf("</unread>"));
+
+ pkDatas.add(unreaded);
+
+ if(Integer.valueOf(unreaded).intValue() > 0 )
+ {
+ notifications.put("pokes", pkDatas);
+ }
+ }
+
+ /**
+ * Getting shares notifications.
+ */
+ if(notifs.contains("<shares"))
+ {
+ String sharesString;
+
+ try
+ {
+ sharesString = notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("</shares>"));
+ }
+ catch(IndexOutOfBoundsException indexError)
+ {
+ sharesString = notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("/>"));
+ }
+
+ Vector<String> shDatas = new Vector<String>();
+
+ String unreaded = sharesString.substring(
+ sharesString.indexOf("<unread>") + "<unread>".length(),
+ sharesString.indexOf("</unread>"));
+
+ shDatas.add(unreaded);
+
+ if(Integer.valueOf(unreaded).intValue() > 0)
+ {
+ notifications.put("shares", shDatas);
+ }
+ }
+
+ /**
+ * Get the friend_requests notifications.
+ */
+ if(notifs.contains("<friend_requests"))
+ {
+ String friendsString = notifs.substring(notifs.indexOf("<friend_requests"), notifs.indexOf("</friend_requests>"));
+ Vector<String> friendsDatas = new Vector<String>();
+ Vector<Long> friendsDatasAsLong = new Vector<Long>();
+
+ //Getting friends uid that ask for friends.
+ if(friendsString.contains("<uid>"))
+ {
+ while(friendsString.contains("<uid>"))
+ {
+ String friend = friendsString.substring(
+ friendsString.indexOf("<uid>") + "<uid>".length(),
+ friendsString.indexOf("</uid>"));
+
+ friendsString = friendsString.replace("<uid>" + friend + "</uid>", "");
+
+ friendsDatasAsLong.add(Long.valueOf(friend).longValue());
+ }
+
+
+ // Go fetch the information for the user list of user ids
+ connection.getClient().users_getInfo(friendsDatasAsLong, EnumSet.of(ProfileField.NAME));
+
+ UsersGetInfoResponse userResponse = (UsersGetInfoResponse) connection.getClient().getResponsePOJO();
+
+ // Print out the user information
+ List<User> users = userResponse.getUser();
+ for (User user : users)
+ {
+ friendsDatas.add(user.getName());
+ }
+
+ notifications.put("friend_requests", friendsDatas);
+ }
+ }
+
+ /**
+ * Getting new groups invitations.
+ */
+ if(notifs.contains("<group_invites"))
+ {
+ String groupString;
+
+ try
+ {
+ groupString = notifs.substring(notifs.indexOf("<group_invites"), notifs.indexOf("</group_invites>"));
+ }
+ catch(IndexOutOfBoundsException indexError)
+ {
+ groupString = notifs.substring(notifs.indexOf("<group_invites"), notifs.indexOf("/>", notifs.indexOf("<group_invites")));
+ }
+
+ Vector<Long> groupsDatasAsLong = new Vector<Long>();
+ Vector<String> groupsDatas = new Vector<String>();
+
+ //Getting friends uid that ask for friends.
+ if(groupString.contains("<gid>"))
+ {
+ while(groupString.contains("<gid>"))
+ {
+ String friend = groupString.substring(
+ groupString.indexOf("<gid>") + "<gid>".length(),
+ groupString.indexOf("</gid>"));
+
+ groupString = groupString.replace("<gid>" + friend + "</gid>", "");
+
+ groupsDatasAsLong.add(Long.valueOf(friend).longValue());
+ }
+
+ groupsDatas.add(String.valueOf(groupsDatasAsLong.size()));
+
+ for(Long gid : groupsDatasAsLong)
+ {
+ try
+ {
+ connection.getClient().fql_query("Select name from group WHERE gid=" + gid.longValue());
+ String response = connection.getClient().getRawResponse();
+ if(response.contains("<group>") && response.contains("<name>"))
+ {
+ String groupName = response.substring(
+ response.indexOf("<name>") + "<name>".length(),
+ response.indexOf("</name>", response.indexOf("<name>")));
+ groupsDatas.add(groupName);
+ }
+ }
+ catch(Exception fqlError)
+ {
+ groupsDatas.add("Unknown group");
+ }
+ }
+
+ //Only if they have some group invites.
+ if(groupsDatasAsLong.size() > 0)
+ {
+ notifications.put("group_invites", groupsDatas);
+ }
+ }
+ }
+
+ /**
+ * Getting new events invitations.
+ */
+ if(notifs.contains("<event_invites"))
+ {
+ String eventString = "";
+ try
+ {
+ eventString = notifs.substring(notifs.indexOf("<event_invites"), notifs.indexOf("/>", notifs.indexOf("<event_invites")));
+ }
+ catch(IndexOutOfBoundsException indexError)
+ {
+ eventString = notifs.substring(notifs.indexOf("<event_invites"), notifs.indexOf("</event_invites>"));
+ }
+
+ Vector<Long> eventsDatasAsLong = new Vector<Long>();
+ Vector<String> eventsDatas = new Vector<String>();
+
+ //Getting friends uid that ask for friends.
+ if(eventString.contains("<eid>"))
+ {
+ while(eventString.contains("<eid>"))
+ {
+ String friend = eventString.substring(
+ eventString.indexOf("<eid>") + "<eid>".length(),
+ eventString.indexOf("</eid>"));
+
+ eventString = eventString.replace("<eid>" + friend + "</eid>", "");
+
+ eventsDatasAsLong.add(Long.valueOf(friend).longValue());
+ }
+
+ //Getting events names.
+ connection.getClient().events_get(connection.getFacebookUserId(), eventsDatasAsLong, Long.valueOf(0), Long.valueOf(0));
+ EventsGetResponse response = (EventsGetResponse) connection.getClient().getResponsePOJO();
+ List<Event> events = response.getEvent();
+
+ //Adding the number of event invites.
+ eventsDatas.add(String.valueOf(eventsDatasAsLong.size()));
+
+ for(Event event : events)
+ {
+ if(eventsDatasAsLong.contains(event.getEid()))
+ {
+ eventsDatas.add(event.getName());
+ }
+ }
+
+ if(eventsDatasAsLong.size() > 0)
+ {
+ notifications.put("event_invites", eventsDatas);
+ }
+ }
+ }
+ }
+ catch (FacebookException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ return notifications;
+ }
}
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 12:00:06 UTC (rev 4662)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 12:45:53 UTC (rev 4663)
@@ -41,6 +41,11 @@
*/
public static class Configuration extends SimpleGadgetConfiguration{
+ private boolean showFriendRequests = true;
+ private boolean showGroupsInvites = true;
+ private boolean showEventsInvites = true;
+ private boolean showPokes = true;
+ private boolean notifyEmail = true;
}
/**
|
|
From: jerome <c2m...@c2...> - 2009-05-25 12:57:08
|
Author: jerome
Date: 2009-05-25 14:56:57 +0200 (Mon, 25 May 2009)
New Revision: 4664
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
Log:
* Added some parameters.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 12:45:53 UTC (rev 4663)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 12:56:57 UTC (rev 4664)
@@ -46,6 +46,101 @@
private boolean showEventsInvites = true;
private boolean showPokes = true;
private boolean notifyEmail = true;
+
+
+ /**
+ * Return true if user want to hear his email notifications.
+ * @return
+ */
+ public boolean getNotifyEmail()
+ {
+ return this.notifyEmail;
+ }
+
+
+ /**
+ * Set the notify email parameter value.
+ * @param aNotifyEmail
+ */
+ public void setNotifyEmail(boolean aNotifyEmail)
+ {
+ this.notifyEmail = aNotifyEmail;
+ }
+
+ /**
+ * Return true if user want to hear his pokes notifications.
+ * @return
+ */
+ public boolean getShowPokes()
+ {
+ return this.showPokes;
+ }
+
+
+ /**
+ * Set the show pokes parameter value.
+ * @param aShowPokes
+ */
+ public void setShowPokes(boolean aShowPokes)
+ {
+ this.showPokes = aShowPokes;
+ }
+
+ /**
+ * Return true if user want to hear his events invites.
+ * @return
+ */
+ public boolean getShowEventsInvites()
+ {
+ return this.showEventsInvites;
+ }
+
+
+ /**
+ * Set the show events invites parameter value.
+ * @param aEventsInvites
+ */
+ public void setShowEventsInvites(boolean aEventsInvites)
+ {
+ this.showEventsInvites = aEventsInvites;
+ }
+
+ /**
+ * Return true if user want to hear his group invites.
+ * @return
+ */
+ public boolean getShowGroupsInvites()
+ {
+ return this.showGroupsInvites;
+ }
+
+
+ /**
+ * Sets the show group invites parameter value.
+ * @param aShowGroupsInvites
+ */
+ public void setShowGroupsInvites(boolean aShowGroupsInvites)
+ {
+ this.showGroupsInvites = aShowGroupsInvites;
+ }
+
+ /**
+ * Return true if user want to hear his friend requests.
+ * @return
+ */
+ public boolean getShowFriendRequests()
+ {
+ return this.showFriendRequests;
+ }
+
+ /**
+ * Set the friend request value.
+ * @param aShowFriendRequests
+ */
+ public void setShowFriendRequests(boolean aShowFriendRequests)
+ {
+ this.showFriendRequests = aShowFriendRequests;
+ }
}
/**
|
|
From: jerome <c2m...@c2...> - 2009-05-25 12:00:15
|
Author: jerome Date: 2009-05-25 14:00:06 +0200 (Mon, 25 May 2009) New Revision: 4662 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java Log: * Getting user friend list. Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookFunctions.java 2009-05-25 12:00:06 UTC (rev 4662) @@ -0,0 +1,86 @@ +import java.io.IOException; +import java.util.EnumSet; +import java.util.List; +import java.util.Vector; + +import com.facebook.api.FacebookException; +import com.facebook.api.ProfileField; +import com.facebook.api.schema.FriendsGetResponse; +import com.facebook.api.schema.User; +import com.facebook.api.schema.UsersGetInfoResponse; + +/* This file is part of "TuxDroid Gadget Facebook". + * Copyright 2009, kysoh + * Author : Conan Jerome. + * eMail : jer...@ky... + * Site : http://www.kysoh.com/ + * + * "TuxDroid Gadget Facebook" is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * "TuxDroid Gadget Facebook" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with "TuxDroid Gadget Facebook"; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +public class FacebookFunctions { + + private FacebookConnection connection; + + /** + * Class constructor. + * @param connection + */ + public FacebookFunctions(FacebookConnection connection) + { + this.connection = connection; + } + + + /** + * Return the user friend list as Vector<String>. + * @return + */ + private Vector<String> getFriends() + { + Vector<String> friendsList = new Vector<String>(); + + try + { + // Get friends list + connection.getClient().friends_get(); + FriendsGetResponse response = (FriendsGetResponse) connection.getClient().getResponsePOJO(); + List<Long> friends = response.getUid(); + + // Go fetch the information for the user list of user ids + connection.getClient().users_getInfo(friends, EnumSet.of(ProfileField.NAME)); + + UsersGetInfoResponse userResponse = (UsersGetInfoResponse) connection.getClient().getResponsePOJO(); + + // Print out the user information + List<User> users = userResponse.getUser(); + for (User user : users) + { + friendsList.add(user.getName()); + } + } + catch (FacebookException e) + { + return null; + } + catch (IOException e) + { + return null; + } + + return friendsList; + } +} |
|
From: jerome <c2m...@c2...> - 2009-05-25 11:53:52
|
Author: jerome
Date: 2009-05-25 13:53:44 +0200 (Mon, 25 May 2009)
New Revision: 4661
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
Log:
* Added methods to retrieve user id and json client.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-25 11:51:15 UTC (rev 4660)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-25 11:53:44 UTC (rev 4661)
@@ -85,4 +85,24 @@
;
}
}
+
+
+ /**
+ * This function return the facebook user id.
+ * @return
+ */
+ public Long getFacebookUserId()
+ {
+ return this.userId;
+ }
+
+
+ /**
+ * Return the JSon object.
+ * @return
+ */
+ public FacebookRestClient getClient()
+ {
+ return this.client;
+ }
}
|
|
From: jerome <c2m...@c2...> - 2009-05-25 11:51:22
|
Author: jerome
Date: 2009-05-25 13:51:15 +0200 (Mon, 25 May 2009)
New Revision: 4660
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
Log:
* Updated string from french to english.
Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java
===================================================================
--- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-25 11:46:56 UTC (rev 4659)
+++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-25 11:51:15 UTC (rev 4660)
@@ -55,7 +55,7 @@
BareBonesBrowserLaunch.openURL(url);
// wait for user to log in and hit enter
- gdg.throwMessage("Connectez-vous otre compte et appuyer sur une de mes ailes");
+ gdg.throwMessage("Connect to your account and push my left wing");
tux.flippers.up();
tux.button.left.waitPressed(20.0);
@@ -66,11 +66,11 @@
if(session != null)
{
- gdg.throwMessage("Je suis connect votre compte facebook");
+ gdg.throwMessage("I'm connected to your facebook account.");
}
else
{
- gdg.throwMessage("Je ne peux pas me connecter otre compte");
+ gdg.throwMessage("I cannot get connected to your facebook account.");
}
// keep track of the logged in user id
@@ -78,7 +78,7 @@
}
catch(FacebookException connectionError)
{
- gdg.throwMessage("Je ne peux pas me connecter otre compte");
+ gdg.throwMessage("I cannot get connected to your facebook account.");
}
catch (IOException e)
{
|
|
From: jerome <c2m...@c2...> - 2009-05-25 11:47:09
|
Author: jerome Date: 2009-05-25 13:46:56 +0200 (Mon, 25 May 2009) New Revision: 4659 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/BareBonesBrowserLaunch.java software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java Log: * Added Facebook Connection functions. Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath 2009-05-25 08:32:28 UTC (rev 4658) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath 2009-05-25 11:46:56 UTC (rev 4659) @@ -3,5 +3,13 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/tuxdroid-gadget-java-kit"/> + <classpathentry kind="lib" path="libraries"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/activation-1.1.jar"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/facebook-java-api-1.8.1.jar"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/jaxb-api-2.1.jar"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/jaxb-impl-2.1.3.jar"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/json-20070829.jar"/> + <classpathentry kind="lib" path="C:/Users/nux/Desktop/facebook-java-api-1.8.1-bin/facebook-java-api-1.8.1/lib/stax-api-1.0-2.jar"/> + <classpathentry kind="lib" path="C:/Program Files/Kysoh/Tuxdroid/softwares/control_center/deps/tuxdroid-java-api-0.1.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/BareBonesBrowserLaunch.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/BareBonesBrowserLaunch.java (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/BareBonesBrowserLaunch.java 2009-05-25 11:46:56 UTC (rev 4659) @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////// +// Bare Bones Browser Launch // +// Version 1.5 // +// December 10, 2005 // +// Supports: Mac OS X, GNU/Linux, Unix, Windows XP // +// Example Usage: // +// String url = "http://www.centerkey.com/"; // +// BareBonesBrowserLaunch.openURL(url); // +// Public Domain Software -- Free to Use as You Like // +///////////////////////////////////////////////////////// + +import java.lang.reflect.Method; + +public class BareBonesBrowserLaunch +{ + + @SuppressWarnings("unchecked") + public static void openURL(String url) + { + String osName = System.getProperty("os.name"); + try + { + if (osName.startsWith("Mac OS")) + { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", + new Class[] {String.class}); + openURL.invoke(null, new Object[] {url}); + } + else if (osName.startsWith("Windows")) + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + else + { //assume Unix or Linux + String[] browsers = { + "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) + if (Runtime.getRuntime().exec( + new String[] {"which", browsers[count]}).waitFor() == 0) + browser = browsers[count]; + if (browser == null) + throw new Exception("Could not find web browser"); + else + Runtime.getRuntime().exec(new String[] {browser, url}); + } + } + catch (Exception e) + { + } + } +} + Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookConnection.java 2009-05-25 11:46:56 UTC (rev 4659) @@ -0,0 +1,88 @@ +/* This file is part of "TuxDroid Gadget Facebook". + * Copyright 2009, kysoh + * Author : Conan Jerome. + * eMail : jer...@ky... + * Site : http://www.kysoh.com/ + * + * "TuxDroid Gadget Facebook" is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * "TuxDroid Gadget Facebook" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with "TuxDroid Gadget Facebook"; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +import java.io.IOException; + +import com.facebook.api.FacebookException; +import com.facebook.api.FacebookRestClient; +import com.tuxisalive.api.TuxAPI; + +public class FacebookConnection { + + public static String api_key = "a9eb7b7e52df160fb1dfc437b0b487c8"; + private FacebookRestClient client; + private Long userId; + + /** + * Class constructor. + */ + public FacebookConnection(String secretKey, FacebookGadget gdg, TuxAPI tux) + { + try + { + //Create the client instance + client = new FacebookRestClient(FacebookConnection.api_key, secretKey); + + //Is this a desktop app + client.setIsDesktop(true); + + //Getting an auth-token to log in with + String token = client.auth_createToken(); + + // Build the authentication URL for the user to fill out + String url = "http://www.facebook.com/login.php?api_key=" + FacebookConnection.api_key + "&v=1.0" + "&auth_token=" + token; + + //Open browser for user to log in + BareBonesBrowserLaunch.openURL(url); + + // wait for user to log in and hit enter + gdg.throwMessage("Connectez-vous otre compte et appuyer sur une de mes ailes"); + + tux.flippers.up(); + tux.button.left.waitPressed(20.0); + tux.flippers.down(); + + // fetch session key + String session = client.auth_getSession(token); + + if(session != null) + { + gdg.throwMessage("Je suis connect votre compte facebook"); + } + else + { + gdg.throwMessage("Je ne peux pas me connecter otre compte"); + } + + // keep track of the logged in user id + userId = client.users_getLoggedInUser(); + } + catch(FacebookException connectionError) + { + gdg.throwMessage("Je ne peux pas me connecter otre compte"); + } + catch (IOException e) + { + ; + } + } +} Modified: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 08:32:28 UTC (rev 4658) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 11:46:56 UTC (rev 4659) @@ -22,6 +22,8 @@ import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadget; import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadgetConfiguration; +import com.tuxisalive.api.TuxAPI; +import com.tuxisalive.api.TuxAPIConst; /** * Facebook gadget class. @@ -30,6 +32,9 @@ */ public class FacebookGadget extends SimpleGadget<FacebookGadget.Configuration>{ + public native String getKey(); + private TuxAPI tux = null; + /** * Configuration Class. * @author nux @@ -44,10 +49,32 @@ @Override protected void start() throws Throwable { - + //First of all, loading our library. + try + { + System.loadLibrary("./libraries/utils"); + } + catch(Exception libraryLoadError) + { + throwMessage("Error while loading needed library"); + } + + this.connectTuxApi(); } + /** + * Create tux api object. + */ + private void connectTuxApi() + { + this.tux = new TuxAPI("127.0.0.1", 270); + this.tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_FREE, "tuxdroid-facebook-gadget", "tdfcgd"); + tux.server.waitConnected(3.0); + } + + + /** * Main entry point. * @param args */ |
|
From: jerome <c2m...@c2...> - 2009-05-25 08:32:34
|
Author: jerome Date: 2009-05-25 10:32:28 +0200 (Mon, 25 May 2009) New Revision: 4658 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/libraries/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/libraries/utils.dll Log: * Added dll utils. Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/libraries/utils.dll =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/libraries/utils.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
|
From: jerome <c2m...@c2...> - 2009-05-25 08:06:24
|
Author: jerome Date: 2009-05-25 10:06:12 +0200 (Mon, 25 May 2009) New Revision: 4657 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.project software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java Log: * Started Facebook prototype project. Property changes on: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook ___________________________________________________________________ Name: svn:ignore + bin Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.classpath 2009-05-25 08:06:12 UTC (rev 4657) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/tuxdroid-gadget-java-kit"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.project =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.project (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/.project 2009-05-25 08:06:12 UTC (rev 4657) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>tuxdroid-gadget-facebook</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/tuxdroid-gadget-facebook/src/FacebookGadget.java 2009-05-25 08:06:12 UTC (rev 4657) @@ -0,0 +1,58 @@ +/* This file is part of "TuxDroid Gadget Facebook". + * Copyright 2009, kysoh + * Author : Conan Jerome. + * eMail : jer...@ky... + * Site : http://www.kysoh.com/ + * + * "TuxDroid Gadget Facebook" is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * "TuxDroid Gadget Facebook" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with "TuxDroid Gadget Facebook"; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadget; +import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadgetConfiguration; + +/** + * Facebook gadget class. + * @author nux + * + */ +public class FacebookGadget extends SimpleGadget<FacebookGadget.Configuration>{ + + /** + * Configuration Class. + * @author nux + */ + public static class Configuration extends SimpleGadgetConfiguration{ + + } + + /** + * Gadget start method. + */ + @Override + protected void start() throws Throwable + { + + } + + /** + * Main entry point. + * @param args + */ + public static void main(String[] args) + { + new FacebookGadget().boot(args, new Configuration()); + } +} |
|
From: jerome <c2m...@c2...> - 2009-05-20 09:49:23
|
Author: jerome Date: 2009-05-20 11:49:16 +0200 (Wed, 20 May 2009) New Revision: 4656 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/branches/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/tags/ software_suite_v2/software/gadgets/tuxdroid-gadget-facebook/trunk/ Log: * Added tuxdroid-gadget-facebook project directories. |