Author: croberts
Date: 2011-06-13 18:55:39 +0000 (Mon, 13 Jun 2011)
New Revision: 4809
Modified:
trunk/cumin/python/cumin/grid/limit.py
trunk/cumin/python/cumin/grid/limit.strings
Log:
Addressing BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=712968 by correctly setting the
initial state of the limits input box and checkbox for the case where the initial value of
the limit is unlimited. Also tweaking how we handle the disabled input display of the
limit name. It will no longer look like an input box that is just not working. Instead,
we display the plain text and maintain the input value with a hidden input.
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-06-13 14:32:57 UTC (rev 4808)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-06-13 18:55:39 UTC (rev 4809)
@@ -204,8 +204,20 @@
return self.input.get(session)
def render_field_name(self,session):
- return self.input.param.path
+ return self.input.param.path
+ def render_is_readonly(self, session):
+ retval = ""
+ if self.input.get(session) == "Unlimited":
+ retval = "readonly='readonly'"
+ return retval
+
+ def render_is_checked(self, session):
+ retval = ""
+ if self.input.get(session) == "Unlimited":
+ retval = "checked='checked'"
+ return retval
+
def render_checkbox_name(self,session):
return self.checkbox.param.path
Modified: trunk/cumin/python/cumin/grid/limit.strings
===================================================================
--- trunk/cumin/python/cumin/grid/limit.strings 2011-06-13 14:32:57 UTC (rev 4808)
+++ trunk/cumin/python/cumin/grid/limit.strings 2011-06-13 18:55:39 UTC (rev 4809)
@@ -13,24 +13,10 @@
}
[DisabledInput.html]
-<input class="disabled" type="text" name="{name}"
id="{name}" value="{value}" tabindex="{tab_index}"
size="{size}"/>
-<script type="text/javascript">
-//<![CDATA[
-// Using input attribute disabled="disabled' has the unfortunate side effect of
not sending the input value
-// when the form is submitted. So we just leave it enabled and filter out keyboard input
with javascript.
-window.addEvent("domready",
- function () {
- $("{name}").addEvent("keypress",
- function (e) {
- if (!(e.key in {tab:1, left:1, right:1}))
- if (! (e.key == 'c' && e.control) )
- new Event(e).stop();
- } )
- }
-);
-//]]>
-</script>
+{value}
+<input type="hidden" name="{name}" id="{name}"
value="{value}" tabindex="{tab_index}" size="{size}"/>
+
[StringFieldWithCheckbox.input_with_checkbox_html]
<tr id="{id}">
<th>
@@ -38,12 +24,15 @@
<div class="help"></div>
</th>
<td>
- <input type="text" name="{field_name}"
id="{field_name}" value="{field_value}" tabindex="100"
size="30" />
- <input type="checkbox" name="{checkbox_name}"
id="{checkbox_name}" {onclick_attr}/><label
for="{checkbox_name}">Unlimited</label>
+ <input type="text" name="{field_name}"
id="{field_name}" value="{field_value}" tabindex="100"
size="30" {is_readonly}/>
+ <input type="checkbox" name="{checkbox_name}"
id="{checkbox_name}" {onclick_attr} {is_checked}/><label
for="{checkbox_name}">Unlimited</label>
</td>
</tr>
<script type="text/javascript">
//<![CDATA[
+window.addEvent('domready', function(){
+ myFunction();
+});
function toggleLimitInput(form, checkbox, textinput) {
if($(checkbox).checked) {
$(textinput).value = "Unlimited";