[rhmessaging-commits] rhmessaging commits: r1089 - in mgmt/cumin/python: wooly and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Oct 16 12:28:14 EDT 2007


Author: justi9
Date: 2007-10-16 12:28:14 -0400 (Tue, 16 Oct 2007)
New Revision: 1089

Modified:
   mgmt/cumin/python/cumin/server.py
   mgmt/cumin/python/wooly/forms.py
   mgmt/cumin/python/wooly/forms.strings
Log:
Adds the ability to disable form inputs.  Uses this to disable the
server and profile value inputs in the server property form.



Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py	2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/cumin/server.py	2007-10-16 16:28:14 UTC (rev 1089)
@@ -122,6 +122,7 @@
         self.add_child(self.profile)
 
         self.pvalue = TextInput(app, "profile_value", self)
+        self.pvalue.set_disabled(True)
         self.add_child(self.pvalue)
 
         self.server = RadioInput(app, "server", self)
@@ -130,6 +131,7 @@
         self.add_child(self.server)
 
         self.svalue = TextInput(app, "server_value", self)
+        self.svalue.set_disabled(True)
         self.add_child(self.svalue)
 
         self.local = RadioInput(app, "local", self)
@@ -148,20 +150,23 @@
 
     def process_cancel(self, session, prop):
         branch = session.branch()
-        frame = self.page().show_server(branch, prop.get_server())
-        frame.show_view(branch)
+        self.page().show_server(branch, prop.get_server()).show_view(branch)
         session.set_redirect(branch.marshal())
 
     def process_submit(self, session, prop):
-        if self.source.get(session) == "profile":
-            prop.value = self.pvalue.get(session)
-        elif self.source.get(session) == "server":
-            prop.value = self.svalue.get(session)
-        elif self.source.get(session) == "local":
+        source = self.source.get(session)
+        
+        if source == "profile":
+            prop.value = get_profile_value(prop)
+        elif source == "server":
+            prop.value = prop.server_value
+        elif source == "local":
             prop.value = self.lvalue.get(session)
         else:
             raise Exception()
 
+        print "yoyo", source, prop.value
+
         self.process_cancel(session, prop)
 
     def process_display(self, session, prop):

Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py	2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/wooly/forms.py	2007-10-16 16:28:14 UTC (rev 1089)
@@ -39,6 +39,7 @@
         self.param = None
 
         self.tab_index = 100
+        self.disabled = False
 
     def set_parameter(self, param):
         if self.param:
@@ -71,6 +72,9 @@
     def set_tab_index(self, tab_index):
         self.tab_index = tab_index
 
+    def set_disabled(self, disabled):
+        self.disabled = disabled
+
     def render_name(self, session, object):
         return self.param.path()
 
@@ -89,6 +93,9 @@
     def render_tabindex(self, session, object):
         return self.tab_index
 
+    def render_disabled_attr(self, session, object):
+        return self.disabled and "disabled=\"disabled\"" or None
+
 class TextInput(FormInput):
     def __init__(self, app, name, form):
         super(TextInput, self).__init__(app, name, form)

Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings	2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/wooly/forms.strings	2007-10-16 16:28:14 UTC (rev 1089)
@@ -1,26 +1,26 @@
 [FormButton.html]
-<button type="submit" name="{name}" value="{value}" tabindex="{tabindex}">{content}</button>
+<button type="submit" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr}>{content}</button>
 
 [TextInput.html]
 {errors}
-<input type="text" name="{name}" value="{value}" tabindex="{tabindex}" size="{size}"/>
+<input type="text" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr} size="{size}"/>
 
 [CheckboxInput.html]
-<input type="checkbox" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr}/>
+<input type="checkbox" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr} {disabled_attr}/>
 
 [RadioInput.html]
-<input type="radio" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr}/>
+<input type="radio" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr} {disabled_attr}/>
 
 [CheckboxInputSet.html]
 {errors}{items}
 
 [CheckboxInputSet.item_html]
-<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr} {disabled_attr}/>
 {item_content}
 
 [RadioInputSet.html]
 {errors}{items}
 
 [RadioInputSet.item_html]
-<input type="radio" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+<input type="radio" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr} {disabled_attr}/>
 {item_content}




More information about the rhmessaging-commits mailing list