Author: damoxc

Revision: 5151

Log:
        add a config resource that outputs the uis current configuration
update this in Deluge.js

Diff:
Modified: trunk/deluge/ui/web/js/Deluge.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.js    2009-04-24 18:09:58 UTC (rev 5150)
+++ trunk/deluge/ui/web/js/Deluge.js    2009-04-24 18:14:59 UTC (rev 5151)
@@ -23,11 +23,6 @@
 
 Ext.namespace('Ext.deluge');
 
-var Deluge = {
-       author: 'Damien Churchill <[email protected]>',
-       version: '1.2-dev'
-};
-
 (function() {
        /* Add some helper functions to Ext */
        Ext.apply(Function.prototype, {

Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py       2009-04-24 18:09:58 UTC (rev 5150)
+++ trunk/deluge/ui/web/server.py       2009-04-24 18:14:59 UTC (rev 5151)
@@ -85,6 +85,19 @@
     """
     return os.path.join(current_dir, path)
 
+class Config(resource.Resource):
+    """
+    Writes out a javascript file that contains the WebUI configuration
+    available as Deluge.Config.
+    """
+    
+    def render(self, request):
+        return """Deluge = {
+    author: 'Damien Churchill <[email protected]>',
+    version: '1.2-dev',
+    config: %s
+}""" % common.json.dumps(component.get("DelugeWeb").config.config)
+
 class GetText(resource.Resource):
     def render(self, request):
         request.setHeader("content-type", "text/javascript; encoding=utf-8")
@@ -227,6 +240,7 @@
         "/js/ext-base.js",
         "/js/ext-all.js",
         "/js/ext-extensions.js",
+        "/config.js",
         "/gettext.js",
         "/js/deluge-yc.js"
     ]
@@ -235,6 +249,7 @@
         "/js/ext-base.js",
         "/js/ext-all-debug.js",
         "/js/ext-extensions-debug.js",
+        "/config.js",
         "/gettext.js",
         "/js/Deluge.js",
         "/js/Deluge.Formatters.js",
@@ -270,6 +285,7 @@
     
     def __init__(self):
         resource.Resource.__init__(self)
+        self.putChild("config.js", Config())
         self.putChild("css", LookupResource("Css", rpath("css")))
         self.putChild("gettext.js", GetText())
         self.putChild("flag", Flag())



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to