conga/luci/cluster form-macros resource-form-m ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-22 21:59:03
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
Log message:
more javascript ugliness
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.10&r2=1.11
luci/cluster/form-macros +5 -2
@@ -1182,7 +1182,7 @@ <tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> </div> - <h2 onclick="forms_to_xml()">Service Composition</h2> + <h2>Service Composition</h2> <div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
@@ -1235,10 +1235,13 @@ tal:condition="python: 'indent_ctr' in res and 'max_depth' in res" tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" /> </div> - </div> <form name="master"> + <input type="button" class="hbSubmit" + value="Save changes" + onClick="forms_to_xml()" /> <input type="hidden" name="form_xml" /> </form> + </div> <div class="invisible" id="global_resources_block"> <tal:block tal:repeat="gr global_resources">
luci/cluster/resource-form-macros +24 -0
@@ -320,6 +320,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -403,6 +406,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -554,6 +560,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -673,6 +682,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -805,6 +817,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -886,6 +901,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -948,6 +966,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
@@ -1021,6 +1042,9 @@ <input name="pagetype" type="hidden" value="35" /> + <input name="global" type="hidden" + tal:attributes="value resourceIsRef | nothing" /> + <input name="parent_uuid" type="hidden" tal:attributes="value res/parent_uuid | nothing" />
luci/cluster/resource_form_handlers.js +27 -3
@@ -8,7 +8,6 @@ if (!res || !replace) return (-1); var new_uuid = update_resource_form_uuid(res, form.parent_uuid.value, form.tree_level.value, form.uuid.value); - res.id = new_uuid; var sopt = document.getElementById('gres_chooser'); if (sopt)
@@ -193,19 +192,44 @@ } function delete_resource(form) { - /* XXX - remove names from used list, replace global resources */ if (!confirm('Are you sure you want to delete this resource?')) return (-1); var div = document.getElementById(form.uuid.value); if (!div) return (-1); var pdiv = document.getElementById(form.parent_uuid.value); - div.parentNode.removeChild(div); var pelem = pdiv.getElementsByTagName('p'); for (var i = 0 ; i < pelem.length ; i++) { if (pelem[i].className.match(/expander/)) pelem[i].className += ' invisible'; } + div.parentNode.removeChild(div); + + var globalres = document.getElementById('global_resources_block'); + if (!globalres) + return (0); + + var replace = new Object(); + var f = div.getElementsByTagName('FORM'); + for (var i = 0 ; i < f.length ; i++) { + if (!f[i].global || !f[i].global.value) + continue; + replace[f[i].parentNode.id] = f[i].parentNode; + if (f[i].parentNode.parentNode) + f[i].parentNode.parentNode.removeChild(f[i].parentNode); + } + + var sopt = document.getElementById('gres_chooser'); + if (!sopt) + return (-1); + sopt = sopt.options; + for (var i = 0 ; i < sopt.length ; i++) { + if (replace[sopt[i].value]) { + globalres.appendChild(replace[sopt[i].value]); + sopt[i].className = null; + } + } + return (0); } function update_resource_form_uuid(node, parent_uuid, indent_level, uuid) {