[Cluster-devel] conga/luci site/luci/Extensions/StorageReport. ...
kupcevic at sourceware.org
kupcevic at sourceware.org
Mon Oct 9 19:11:59 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-10-09 19:11:59
Modified files:
luci/site/luci/Extensions: StorageReport.py
luci/storage : form-macros
Log message:
luci storage: hide submit/reset buttons if nothing to modify
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- conga/luci/site/luci/Extensions/StorageReport.py 2006/10/09 17:03:17 1.12
+++ conga/luci/site/luci/Extensions/StorageReport.py 2006/10/09 19:11:59 1.13
@@ -481,6 +481,8 @@
if type == MAPPER_VG_TYPE:
link_snapshots(mapper_ret)
+ mapper_ret['need_apply_button'] = mutable_props(mapper_ret['props'])
+
return mapper_ret
@@ -643,6 +645,8 @@
mapper_ret['actions'] = []
+ mapper_ret['need_apply_button'] = True
+
return mapper_ret
@@ -1523,6 +1527,16 @@
actions.append(action)
data['actions'] = actions
+ need_apply_butt = mutable_props(data['props'])
+ if need_apply_butt == False:
+ if len(data['contents']) > 1:
+ need_apply_butt = True
+ elif len(data['contents']) == 1:
+ need_apply_butt = mutable_props(data['contents'][0]['props'])
+ else:
+ need_apply_butt = False
+ data['need_apply_button'] = need_apply_butt
+
return data
@@ -1621,6 +1635,14 @@
+def mutable_props(props):
+ for name in props:
+ type = props[name]['type']
+ if type == 'int' or type == 'text' or type == 'select':
+ return True
+ return False
+
+
def get_content_data_internal(session, bd_xml):
c_xml = None
--- conga/luci/storage/form-macros 2006/10/09 17:03:17 1.10
+++ conga/luci/storage/form-macros 2006/10/09 19:11:59 1.11
@@ -1580,27 +1580,34 @@
</td>
<td align="right"
tal:define="validate_url context/validate_html/absolute_url">
- <input tal:attributes="type string:button;
- name string:action_type;
- value string:Reset;
- onclick python:'return reset_bd_form(this.form, \'' + select_content_id + '\', \'' + content_span_id + '\')'"
- class="form_button"/>
- <input tal:condition="bd_data/new"
- tal:define="prompt_msg python:'Do you really want to create ' + bd_data['pretty_type'] + '?'"
- tal:attributes="id apply_button_id;
- type string:button;
- name string:action_type;
- value string:Create;
- onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
- class="form_button"/>
- <input tal:condition="not: bd_data/new"
- tal:define="prompt_msg python:'Do you really want to apply changes to ' + bd_data['pretty_type'] + ' \\\'' + bd_data['pretty_name'] + '\\\'?'"
- tal:attributes="id apply_button_id;
- type string:button;
- name string:action_type;
- value string:Apply;
- onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
- class="form_button"/>
+ <span tal:omit-tag=""
+ tal:condition="not: bd_data/need_apply_button">
+
+ </span>
+ <span tal:omit-tag=""
+ tal:condition="bd_data/need_apply_button">
+ <input tal:attributes="type string:button;
+ name string:action_type;
+ value string:Reset;
+ onclick python:'return reset_bd_form(this.form, \'' + select_content_id + '\', \'' + content_span_id + '\')'"
+ class="form_button"/>
+ <input tal:condition="bd_data/new"
+ tal:define="prompt_msg python:'Do you really want to create ' + bd_data['pretty_type'] + '?'"
+ tal:attributes="id apply_button_id;
+ type string:button;
+ name string:action_type;
+ value string:Create;
+ onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+ class="form_button"/>
+ <input tal:condition="not: bd_data/new"
+ tal:define="prompt_msg python:'Do you really want to apply changes to ' + bd_data['pretty_type'] + ' \\\'' + bd_data['pretty_name'] + '\\\'?'"
+ tal:attributes="id apply_button_id;
+ type string:button;
+ name string:action_type;
+ value string:Apply;
+ onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+ class="form_button"/>
+ </span>
</td>
</tr>
</table>
@@ -1712,19 +1719,26 @@
</span>
</td>
<td align="right">
- <input type="button"
- name="action_type"
- value="Reset"
- onclick="return reset_form(this.form)"
- class="form_button"/>
- <input tal:define="prompt_msg python:'Do you really want to apply changes to ' + mapper['pretty_type'] + ' \\\'' + mapper['pretty_name'] + '\\\'?';
- validate_url context/validate_html/absolute_url"
- tal:attributes="id apply_button_id;
- type string:button;
- name string:action_type;
- value string:Apply;
- onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + mapper_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
- class="form_button"/>
+ <span tal:omit-tag=""
+ tal:condition="not: mapper/need_apply_button">
+
+ </span>
+ <span tal:omit-tag=""
+ tal:condition="mapper/need_apply_button">
+ <input type="button"
+ name="action_type"
+ value="Reset"
+ onclick="return reset_form(this.form)"
+ class="form_button"/>
+ <input tal:define="prompt_msg python:'Do you really want to apply changes to ' + mapper['pretty_type'] + ' \\\'' + mapper['pretty_name'] + '\\\'?';
+ validate_url context/validate_html/absolute_url"
+ tal:attributes="id apply_button_id;
+ type string:button;
+ name string:action_type;
+ value string:Apply;
+ onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + mapper_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+ class="form_button"/>
+ </span>
</td>
</tr>
</table>
More information about the Cluster-devel
mailing list