Author: justi9
Date: 2009-04-28 14:34:44 -0400 (Tue, 28 Apr 2009)
New Revision: 3340
Modified:
mgmt/trunk/wooly/python/wooly/forms.py
mgmt/trunk/wooly/python/wooly/forms.strings
Log:
New form inputs and fields
Modified: mgmt/trunk/wooly/python/wooly/forms.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.py 2009-04-28 13:49:37 UTC (rev 3339)
+++ mgmt/trunk/wooly/python/wooly/forms.py 2009-04-28 18:34:44 UTC (rev 3340)
@@ -181,6 +181,19 @@
self.size = 30
+class MultilineStringInput(StringInput):
+ def __init__(self, app, name):
+ super(MultilineStringInput, self).__init__(app, name)
+
+ self.rows = 4
+ self.columns = 32
+
+ def render_rows(self, session, *args):
+ return self.rows
+
+ def render_columns(self, session, *args):
+ return self.columns
+
class PasswordInput(StringInput):
pass
@@ -332,6 +345,13 @@
self.input = StringInput(app, "input")
self.add_child(self.input)
+class MultilineStringField(ScalarField):
+ def __init__(self, app, name):
+ super(MultilineStringField, self).__init__(app, name, None)
+
+ self.input = MultilineStringInput(app, "input")
+ self.add_child(self.input)
+
class PasswordField(ScalarField):
def __init__(self, app, name):
super(PasswordField, self).__init__(app, name, None)
@@ -399,6 +419,29 @@
class RadioFieldOption(RadioInput):
pass
+class CheckboxField(FormField):
+ def __init__(self, app, name):
+ super(CheckboxField, self).__init__(app, name)
+
+ self.options = list()
+
+ def add_option(self, option):
+ assert isinstance(option, CheckboxFieldOption)
+
+ self.options.append(option)
+ self.add_child(option)
+
+ def render_inputs(self, session, *args):
+ writer = Writer()
+
+ for option in self.options:
+ writer.write(option.render(session))
+
+ return writer.to_string()
+
+class CheckboxFieldOption(CheckboxInput):
+ pass
+
class ButtonForm(Form):
def __init__(self, app, name):
super(ButtonForm. self).__init__(app, name)
Modified: mgmt/trunk/wooly/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.strings 2009-04-28 13:49:37 UTC (rev 3339)
+++ mgmt/trunk/wooly/python/wooly/forms.strings 2009-04-28 18:34:44 UTC (rev 3340)
@@ -31,6 +31,9 @@
[ScalarInput.html]
<input type="text" name="{name}" value="{value}"
tabindex="{tab_index}" {disabled_attr} size="{size}"/>
+[MultilineStringInput.html]
+<textarea name="{name}" tabindex="{tab_index}" {disabled_attr}
rows="{rows}" cols="{columns}">{value}</textarea>
+
[PasswordInput.html]
<input type="password" name="{name}" value="{value}"
tabindex="{tab_index}" {disabled_attr} size="{size}"/>
@@ -128,3 +131,10 @@
tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
<label for="{id}">{title}</label>
</div>
+
+[CheckboxFieldOption.html]
+<div>
+ <input type="checkbox" name="{name}" id="{id}"
value="{value}"
+ tabindex="{tab_index}" {checked_attr} {disabled_attr}/>
+ <label for="{id}">{title}</label>
+</div>
Show replies by date