CVSROOT:        /cvs/cluster
Module name:    conga
Changes by:     [EMAIL PROTECTED]       2007-11-27 16:58:19

Modified files:
        luci/plone-custom: conga.js conga_ajax.js 
        luci/homebase  : homebase_common.js index_html 
        luci/cluster   : index_html resource_form_handlers.js 
Added files:
        luci/plone-custom: luci.css 
Removed files:
        luci/homebase  : luci_homebase.css 

Log message:
        - Shuffle some files around to allow better caching
        - Add some more javascript async helpers

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/luci.css.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga_ajax.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.46&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.40&r2=1.41

/cvs/cluster/conga/luci/plone-custom/luci.css,v  -->  standard output
revision 1.1
--- conga/luci/plone-custom/luci.css
+++ -   2007-11-27 16:58:19.542109000 +0000
@@ -0,0 +1,535 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
+input[type=text], input[type=password] {
+       padding: .2em ! important;
+       font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", monospace;
+       font-size: 12px;
+}
+
+input[type=button] {
+       font-size: 12px;
+}
+
+input[type=checkbox], input[type=radio] {
+       float: left ! important;
+       vertical-align: middle;
+       background: #dee7ec;
+       margin-right: +.3333em;
+}
+
+input.pad_left {
+       margin-left: +.3333em;
+}
+
+input.pad_right {
+       margin-right: +.3333em;
+}
+
+td.pad_right {
+       padding-right: +.6666em;
+}
+
+form.form_border {
+       border-bottom: 1px solid #8cacbb;
+}
+
+div.fence {
+       max-width: 700px;
+       padding: .5em;
+}
+
+*.fence {
+       background: #dee7ec;
+}
+
+table.fence {
+       padding: .618em;
+       width: 700px;
+}
+
+div.fence_level {
+       padding: .4045em;
+       border-bottom: 1px solid #cccccc;
+}
+
+div.fence_instance {
+       margin-left: 1em;
+       padding-left: .4045em;
+       border-left: 1px solid #cccccc;
+}
+
+div.fence,
+td.fence {
+       padding-top: .309em;
+       padding-bottom: .309em;
+}
+
+td.fence {
+       width: 50%;
+}
+
+ul.configTab {
+       color: #436976 !important;
+       margin: 20px 0px 0px 0px !important;
+       padding: 0px !important;
+       padding-left: 15px !important;
+       border-bottom: none !important;
+       z-index: 1 !important;
+}
+
+input.qdisk {
+       font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", monospace 
! important;
+       font-size: 12px ! important;
+       padding: .2em;
+}
+
+input.qdname {
+       padding: .2em;
+       width: 15em;
+}
+
+input.qdint {
+       padding: .2em;
+       width: 5em;
+}
+
+input.qdpath {
+       padding: .2em;
+       width: 20em;
+}
+
+input.qdscore {
+       padding: .2em;
+       width: 5em;
+}
+
+div.spacing {
+       margin-top: 16px;
+}
+
+ul.vanilla, li.vanilla {
+       list-style-type: none ! important;
+       list-style-image: none !important;
+       margin-left: 0 ! important;
+}
+
+ul.statusmsg, li.statusmsg {
+       color: black ! important;
+}
+
+ul.deploy {
+       margin-bottom: +.5em;
+}
+
+li.configTab {
+       display: inline ! important;
+       overflow: hidden ! important;
+       list-style-type: none ! important;
+       padding-left: 6px ! important;
+       padding-bottom: 0px ! important;
+       margin-bottom: 0px ! important;
+       border-bottom: none ! important;
+}
+
+#configTabContent {
+       background: #dee7ec !important;
+       margin-top: 0px !important;
+       padding: 20px !important;
+       border: 1px solid #8cacbb !important;
+       z-index: 2 !important;
+       max-width: 700px;
+}
+
+a.configTab, a.configTabActive {
+       color: #436976 !important;
+       background: #ffffff !important;
+       border: 1px solid #8cacbb !important;
+       border-bottom: 1px solid transparent !important;
+       padding: 2px 6px 0px 6px !important;
+       margin: 0 !important;
+       text-decoration: none !important;
+}
+
+a.configTabActive {
+       background: #dee7ec !important;
+       border-bottom: 2px solid #dee7ec !important;
+}
+
+a.configTab:hover {
+       color: #436976 !important;
+       background: #dee7ec !important;
+}
+
+*.errmsgs,*.retmsgs {
+       list-style-image: none !important;
+       list-style-type: none !important;
+}
+
+*.error, *.errmsgs {
+       color: red !important;
+}
+
+p.luciInst {
+       color: black;
+}
+
+h3.homebase {
+       color: #436976;
+       margin-top: 1em;
+       margin-bottom: .5em;
+       font-size: 12px;
+       font-weight: 800;
+}
+
+h2.homebase {
+       margin-bottom: +1em;
+}
+
+*.retmsgs {
+       color: green !important;
+}
+
+p.errmsgs, p.retmsgs {
+       font-weight: 800;
+}
+
+div.errmsgs {
+       padding: .5em;
+       border-style: dotted;
+       border-width: 2px;
+       border-color: red;
+       margin-top: 2em;
+       max-width: 600px ! important;
+}
+
+div.retmsgs {
+       padding: .5em;
+       margin-top: 2em;
+       border-style: dotted;
+       border-width: 2px;
+       border-color: green;
+       max-width: 600px ! important;
+}
+
+div.hbCSystems {
+       margin-left:1em;
+       padding-top:.5em;
+}
+
+div.hbSSysList {
+       margin-top: .25em;
+       margin-bottom: .25em;
+}
+
+div.hbSubmit,p.hbSubmit {
+       margin-top: .5em;
+       margin-bottom: .5em;
+       margin-right: .5em;
+}
+
+#hbSubmit {
+       margin-top: +1.5em;
+}
+
+div.systemsTableTop {
+       padding-top: +1em;
+       padding-bottom: +.5em;
+}
+
+div.systemsTableEnd {
+       padding-top: +.5em;
+       padding-bottom: +1em;
+}
+
+table.systemsTable {
+       padding-left: +.5em;
+       background: #dee7ec;
+       max-width: 700px;
+}
+
+td.systemsTable {
+       margin: 0em;
+       padding: 0em 1em .33em 0em;
+       padding-left: 0.5em;
+       background: #dee7ec;
+       text-align: left;
+}
+
+th.systemsTable {
+       text-align: left;
+       margin-bottom: .75em;
+       line-height: 115%;
+       background: #dee7ec;
+       padding: .5em;
+}
+
+tfoot.systemsTable {
+       margin-top: .75em;
+       padding: .5em;
+}
+
+td.hbAddUser {
+       margin-top:.5em;
+       padding: .1em;
+}
+
+div.hbcheckdiv {
+       margin-left: 0em;
+       padding-left: 0em;
+       padding-top: .55em;
+}
+
+*.formerror {
+       background: #f5f6be;
+}
+
+img.qdel_img {
+       background: #dee7ec;
+       border: none;
+}
+
+*.invisible,#invisible, #allSameDiv {
+       visibility: hidden;
+       display: none;
+}
+
+input.hbInputSys, input.hostname {
+       padding: .2em ! important;
+       width: 200px;
+}
+
+ul.cluster {
+       padding-top: +.2em;
+       padding-left: +.5em;
+}
+
+img.service_tree {
+       border: none;
+       margin-right: 1em;
+}
+
+div.service_tree {
+       margin-top: 1em;
+}
+
+span.tree {
+       font-size: 10px;
+}
+
+li.node_fdom {
+       list-style-image: url(small_fdom.png);
+}
+
+li.node_active {
+       list-style-image: url(small_node_active.png);
+}
+
+li.node_inactive {
+       list-style-image: url(small_node_inactive.png);
+}
+
+li.node_unknown {
+       list-style-image: url(small_node_unknown.png);
+}
+
+li.cluster_service {
+       list-style-image:url(small_svc.png);
+}
+
+strong.node,
+strong.cluster {
+       text-align: left;
+       font-size: 9pt;
+}
+
+*.reshdr {
+       text-align: left;
+       font-size: 10pt;
+       font-weight: 600;
+       padding-bottom: +1em;
+}
+
+strong.service_name,
+strong.node_name,
+strong.cluster_name {
+       font-size: 10pt;
+}
+
+td.service_name,
+td.node_name,
+td.cluster_name {
+       vertical-align: top;
+       text-align: left;
+       font-size: 11pt;
+       width: 50%;
+}
+
+td.node_log {
+       vertical-align: top;
+       padding-top: +.5em;
+       padding-bottom: +.5em;
+}
+
+td.node_status,
+td.cluster_quorum {
+       vertical-align: top;
+       line-height: 110%;
+       width: 100%;
+}
+
+td.node_status {
+       padding-top: +.33em;
+}
+
+td.node_services,
+td.cluster_nodes,
+td.fence_backup,
+td.fence_main,
+td.node_fdom,
+td.cluster_services {
+       vertical-align: top;
+       width: 50%;
+}
+
+td.node_services,
+td.node_fdom {
+       padding-top: +.33em;
+}
+
+#node_list,
+#cluster_list {
+       max-width: 700px;
+}
+
+tr.info_top,
+tr.info_middle,
+tr.info_bottom {
+       width: 100%;
+       vertical-align: top;
+       padding: .5em;
+}
+
+a.cluster_help:link,
+a.cluster_help:visited,
+a.cluster_help:visited {
+       color: #000000;
+       text-decoration: none ! important;
+}
+
+*.cluster_help:hover {
+       cursor: help;
+}
+
+a.cluster_help:hover {
+       text-decoration: none ! important;
+       cursor: help;
+       color: #000000;
+       border-bottom: 1px solid #cccccc;
+}
+
+a.cluster:link,
+a.cluster:visited {
+       border-bottom: 1px dashed #cccccc;
+       text-decoration: none ! important;
+}
+
+a.cluster:hover,
+a.cluster:active {
+       border-bottom: 1px solid #cccccc;
+       text-decoration: none ! important;
+}
+
+*.stopped,
+*.node_inactive {
+       color: red ! important;
+}
+
+*.fdom_link {
+       color: blue ! important;
+}
+
+img.deleteRow, img.closeBox {
+       cursor: pointer;
+}
+
+*.running,
+*.node_active {
+       color: green ! important;
+}
+
+*.node_unknown {
+       color: gray ! important;
+}
+
+input.hbInputPass {
+       padding: .2em ! important;
+       width: 160px;
+}
+
+*.hbclosebox {
+        text-align: right;
+}
+
+div.systemsList {
+       margin-top: .25em ! important;
+       margin-bottom: .25em ! important;
+}
+
+div.fence_add {
+       margin-top: .25em ! important;
+       margin-bottom: .25em ! important;
+}
+
+div.fence_container {
+       border: thin solid #c9c9c9;
+}
+
+div.fence_control {
+       margin-top: 2em;
+       margin-bottom: .75em;
+       margin-left: .33em;
+}
+
+div.service_comp_list {
+       background: #dee7ec;
+       max-width: 700px;
+       padding: 1em;
+       margin-top: 0;
+}
+
+div.reschoose {
+       background: #dee7ec;
+       padding: .5em;
+       max-width: 700px;
+}
+
+*.rescfg {
+       background: #dee7ec;
+}
+
+div.service_comp {
+       background: #dee7ec;
+       padding: .618em;
+       margin-top: .5em;
+       border-left: thin solid #c9c9c9;
+       border-bottom: thin solid #c9c9c9;
+       margin-bottom: 1em;
+}
+
+div.service_comp > div.service_comp {
+       margin-left: +20px;
+       margin-bottom: 0px;
+       border-bottom: none;
+}
+/*
+div.rc_indent0 {
+       border-left: none ! important;
+}
+*/
--- conga/luci/plone-custom/conga.js    2007/09/25 03:51:42     1.7
+++ conga/luci/plone-custom/conga.js    2007/11/27 16:58:18     1.8
@@ -35,3 +35,157 @@
        if (newwin)
                newwin.focus();
 }
+
+function set_form_err(ielem) {
+       if (ielem) {
+               ielem.className += ' formerror';
+       }
+}
+
+function clr_form_err(ielem) {
+       if (ielem) {
+               ielem.className = ielem.className.replace(/( )?formerror/, '');
+       }
+}
+
+function toggle_visible(img_obj, elem_id, label_id) {
+       var elem = document.getElementById(elem_id);
+       if (!elem) {
+               return (-1);
+       }
+
+       var old_state = !!!elem.className.match(/invisible/i);
+
+       if (label_id) {
+               var label_obj = document.getElementById(label_id);
+               if (!label_obj) {
+                       return (-1);
+               }
+
+               if (old_state) {
+                       label_obj.innerHTML = 'Show';
+               } else {
+                       label_obj.innerHTML = 'Hide';
+               }
+       }
+
+       if (old_state) {
+               img_obj.src = 'arrow_right.png';
+               img_obj.alt = '[-]';
+               elem.className += ' invisible';
+       } else {
+               img_obj.src = 'arrow_down.png';
+               img_obj.alt = '[+]';
+               elem.className = elem.className.replace(/invisible/i,'');
+       }
+       return (0);
+}
+
+function is_valid_int(str, min, max) {
+       if (str.match(/[^0-9 -]/)) {
+               return (0);
+       }
+       var val = parseInt(str, 10);
+       if (isNaN(val)) {
+               return (0);
+       }
+       if (min !== null && val < min) {
+               return (0);
+       }
+       if (max !== null && val > max) {
+               return (0);
+       }
+       return (1);
+}
+
+function error_dialog(errors) {
+       if (!errors || errors.length < 1) {
+               return (null);
+       }
+       alert('The following errors were found:\n\n' + errors.join('\n'));
+       return (-1);
+}
+
+function str_is_blank(str) {
+       return (!str || !str.replace(/\s/g, ''));
+}
+
+function str_is_valid(str, valid_regex_str) {
+       if (!str || !valid_regex_str) {
+               return (null);
+       }
+       var re = eval(valid_regex_str);
+       var invalid = str.replace(re, '');
+       if (!invalid) {
+               return (null);
+       }
+       return (invalid);
+}
+
+function checkAllBoxes(str, val) {
+       var i = 0;
+       var element;
+       while ((element = document.getElementById(str + i++))) {
+               element.checked = val;
+       }
+}
+
+function checkChildren(parent_cont, parent_input) {
+       if (!parent_cont || !parent_input) {
+               return;
+       }
+       var parent = document.getElementById(parent_cont);
+       var children = parent.getElementsByTagName('input');
+       for (var i = 0 ; i < children.length ; i++) {
+               if (children[i] === parent_input) {
+                       continue;
+               }
+               if (children[i].type === 'checkbox') {
+                       children[i].checked = parent_input.checked;
+               }
+       }
+}
+
+function isValidHost(str) {
+       var i = str.split('.');
+
+       if (i.length === 1) {
+               return ('Hostnames must be fully qualified.');
+       }
+
+       if (i.length === 4 && !isNaN(parseInt(i[3]))) {
+               var o1 = parseInt(i[0]);
+               var o2 = parseInt(i[1]);
+               var o3 = parseInt(i[2]);
+               var o4 = parseInt(i[3]);
+
+               if (isNaN(o1) || isNaN(o2) || isNaN(o3) ||
+                       ((o1 & 0xff) !== o1) ||
+                       ((o2 & 0xff) !== o2) ||
+                       ((o3 & 0xff) !== o3) ||
+                       ((o4 & 0xff) !== o4))
+               {
+                       return ('Invalid IP Address.');
+               }
+
+               return (null);
+       }
+
+       if (!isNaN(parseInt(i[i.length - 1]))) {
+               return ('Invalid IP Address.');
+       }
+
+       if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/)) {
+               return ('Hostnames can contain only alphanumeric characters and 
hyphens.');
+       }
+
+       return (null);
+}
+
+function delete_element_id(id_str) {
+       var elem = document.getElementById(id_str);
+       if (!elem || !elem.parentNode) {
+               return (-1);
+       }
+       elem.parentNode.removeChild(elem);
+}
--- conga/luci/plone-custom/conga_ajax.js       2007/11/12 17:10:43     1.4
+++ conga/luci/plone-custom/conga_ajax.js       2007/11/27 16:58:18     1.5
@@ -128,3 +128,23 @@
        }
        return get_ajax_msgs(obj, 'errors');
 }
+
+function show_validation_div() {
+       var vd = document.getElementById('validation_div');
+       if (!vd) {
+               return (-1);
+       }
+
+       try {
+               vd.className.replace(/invisible/gi, '');
+       } catch (...) {
+               /* ignore it */;
+       }
+}
+
+function hide_validation_wait() {
+       var vd = document.getElementById('validation_wait');
+       if (vd) {
+               vd.className += ' invisible';
+       }
+}
--- conga/luci/homebase/homebase_common.js      2007/09/25 03:51:21     1.21
+++ conga/luci/homebase/homebase_common.js      2007/11/27 16:58:18     1.22
@@ -7,152 +7,6 @@
 ** Free Software Foundation.
 */
 
-function set_form_err(ielem) {
-       if (ielem) {
-               ielem.className += ' formerror';
-       }
-}
-
-function clr_form_err(ielem) {
-       if (ielem) {
-               ielem.className = ielem.className.replace(/( )?formerror/, '');
-       }
-}
-
-function toggle_visible(img_obj, elem_id, label_id) {
-       var elem = document.getElementById(elem_id);
-       if (!elem) {
-               return (-1);
-       }
-
-       var old_state = !!!elem.className.match(/invisible/i);
-
-       if (label_id) {
-               var label_obj = document.getElementById(label_id);
-               if (!label_obj) {
-                       return (-1);
-               }
-
-               if (old_state) {
-                       label_obj.innerHTML = 'Show';
-               } else {
-                       label_obj.innerHTML = 'Hide';
-               }
-       }
-
-       if (old_state) {
-               img_obj.src = 'arrow_right.png';
-               img_obj.alt = '[-]';
-               elem.className += ' invisible';
-       } else {
-               img_obj.src = 'arrow_down.png';
-               img_obj.alt = '[+]';
-               elem.className = elem.className.replace(/invisible/i,'');
-       }
-       return (0);
-}
-
-function is_valid_int(str, min, max) {
-       if (str.match(/[^0-9 -]/)) {
-               return (0);
-       }
-       var val = parseInt(str, 10);
-       if (isNaN(val)) {
-               return (0);
-       }
-       if (min !== null && val < min) {
-               return (0);
-       }
-       if (max !== null && val > max) {
-               return (0);
-       }
-       return (1);
-}
-
-function error_dialog(errors) {
-       if (!errors || errors.length < 1) {
-               return (null);
-       }
-       alert('The following errors were found:\n\n' + errors.join('\n'));
-       return (-1);
-}
-
-function str_is_blank(str) {
-       return (!str || !str.replace(/\s/g, ''));
-}
-
-function str_is_valid(str, valid_regex_str) {
-       if (!str || !valid_regex_str) {
-               return (null);
-       }
-       var re = eval(valid_regex_str);
-       var invalid = str.replace(re, '');
-       if (!invalid) {
-               return (null);
-       }
-       return (invalid);
-}
-
-function checkAllBoxes(str, val) {
-       var i = 0;
-       var element;
-       while ((element = document.getElementById(str + i++))) {
-               element.checked = val;
-       }
-}
-
-function checkChildren(parent_cont, parent_input) {
-       if (!parent_cont || !parent_input) {
-               return;
-       }
-       var parent = document.getElementById(parent_cont);
-       var children = parent.getElementsByTagName('input');
-       for (var i = 0 ; i < children.length ; i++) {
-               if (children[i] === parent_input) {
-                       continue;
-               }
-               if (children[i].type === 'checkbox') {
-                       children[i].checked = parent_input.checked;
-               }
-       }
-}
-
-function isValidHost(str) {
-       var i = str.split('.');
-
-       if (i.length === 1) {
-               return ('Hostnames must be fully qualified.');
-       }
-
-       if (i.length === 4 && !isNaN(parseInt(i[3]))) {
-               var o1 = parseInt(i[0]);
-               var o2 = parseInt(i[1]);
-               var o3 = parseInt(i[2]);
-               var o4 = parseInt(i[3]);
-
-               if (isNaN(o1) || isNaN(o2) || isNaN(o3) ||
-                       ((o1 & 0xff) !== o1) ||
-                       ((o2 & 0xff) !== o2) ||
-                       ((o3 & 0xff) !== o3) ||
-                       ((o4 & 0xff) !== o4))
-               {
-                       return ('Invalid IP Address.');
-               }
-
-               return (null);
-       }
-
-       if (!isNaN(parseInt(i[i.length - 1]))) {
-               return ('Invalid IP Address.');
-       }
-
-       if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/)) {
-               return ('Hostnames can contain only alphanumeric characters and 
hyphens.');
-       }
-
-       return (null);
-}
-
 function view_certs_only(form, state) {
        var num_systems = form.numStorage.value;
        if (!form.numStorage) {
@@ -213,14 +67,6 @@
        }
 }
 
-function delete_element_id(id_str) {
-       var elem = document.getElementById(id_str);
-       if (!elem || !elem.parentNode) {
-               return (-1);
-       }
-       elem.parentNode.removeChild(elem);
-}
-
 function pwd0Change(form) {
        var element = document.getElementById('allSameCheckBox');
        if (element && element.checked) {
--- conga/luci/homebase/index_html      2007/09/25 04:00:23     1.24
+++ conga/luci/homebase/index_html      2007/11/27 16:58:18     1.25
@@ -39,7 +39,7 @@
                </style>
 
                <style type="text/css">
-                       <!-- @import url(/luci/homebase/luci_homebase.css); -->
+                       <!-- @import url(luci.css); -->
                </style>
                <tal:block
                        tal:define="global data 
python:here.homebaseControl(request)" />
--- conga/luci/cluster/index_html       2007/09/25 04:00:23     1.39
+++ conga/luci/cluster/index_html       2007/11/27 16:58:19     1.40
@@ -62,7 +62,7 @@
                        <!-- @import url(clusterportlet.css); -->
                </style>
                <style type="text/css">
-                       <!-- @import url(/luci/homebase/luci_homebase.css); -->
+                       <!-- @import url(luci.css); -->
                </style>
                <metal:cssslot define-slot="css_slot" />
     </metal:cssslot>
@@ -199,6 +199,21 @@
              <metal:main-form-content 
use-macro="here/form-chooser/macros/main-form">
              </metal:main-form-content>
 
+       <div class="validating invisible" id="validation_div">
+               <div class="hbclosebox">
+                       <img onclick="hide_element('validation_status')"
+                               src="x.png" class="closeBox" title="dismiss" />
+               </div>
+
+               <div class="validating" id="validation_wait">
+                       <img src="spinner.gif" alt="[please wait...]"/>
+                       <span class="validating">Validating submission...</span>
+               </div>
+
+               <div class="validating" id="validation_result_msgs">
+               </div>
+       </div>
+
        <tal:block tal:condition="python: request.SESSION.has_key('checkRet')">
                <tal:block tal:define="ret python: 
request.SESSION.get('checkRet')">
                <div class="retmsgs" id="retmsgsdiv" tal:condition="python:(ret 
and 'messages' in ret and len(ret['messages']))">
--- conga/luci/cluster/resource_form_handlers.js        2007/08/23 15:02:46     
1.40
+++ conga/luci/cluster/resource_form_handlers.js        2007/11/27 16:58:19     
1.41
@@ -456,7 +456,9 @@
        pdiv.appendChild(child_div);
 }
 
-function forms_to_xml(master_form) {
+var submit_btn = null;
+
+function forms_to_xml(submit_button, master_form) {
        var errors = new Array();
        var form_xml = '';
        var svc_name = null;
@@ -465,6 +467,9 @@
        var exclusive = 0;
        var recovery = null;
 
+       submit_btn = submit_button;
+       submit_button.disabled = true;
+
        var form = document.getElementsByTagName('form');
        for (var i = 0 ; i < form.length ; i++) {
                if (form[i].name == 'service_name_form') {
@@ -546,8 +551,10 @@
                errors.push('You entered an invalid recovery option. Valid 
options are "relocate" "restart" and "disable"');
        }
 
-       if (error_dialog(errors))
+       if (error_dialog(errors)) {
+               submit_button.disabled = false;
                return (-1);
+       }
 
        /* sort this out in the backend */
        if (form_xml) {
@@ -569,7 +576,52 @@
                confirm_msg = 'Create this service?';
        else
                confirm_msg = 'Save changes to this service?';
-       if (confirm(confirm_msg))
-               master_form.submit();
+       if (confirm(confirm_msg)) {
+               master_form.pagetype.value = '1001';
+               update_clusvc(master_form, 
'/luci/cluster/index_html?pagetype=1001');
+       }
+
        return (0);
 }
+
+function clusvc_callback_check(ret_status, obj) {
+       if (ret_status === null) {
+               /* Not ready */
+               return;
+       }
+
+       if (submit_btn) {
+               submit_btn.disabled = false;
+       }
+
+       if (ret_status !== true) {
+               /* A communication error occurred. */
+               alert(obj);
+               return;
+       }
+
+       var err = get_ricci_response_status(obj.responseXML);
+       if (err !== null) {
+               if (err.length > 0) {
+                       alert(err.join('\n'));
+                       return;
+               } else {
+                       alert('Errors occurred when validating this form.');
+                       return;
+               }
+       }
+
+       var svc_form = submit_btn.form;
+       if (svc_form) {
+               svc_form.pagetype.value = svc_form.orig_pagetype.value;
+               svc_form.submit();
+       }
+}
+
+function clusvc_callback() {
+       return check_ajax_xml(xmlHttp_object, clusvc_callback_check);
+}
+
+function update_clusvc(form, url) {
+       initiate_async_post(form, url, clusvc_callback);
+}

Reply via email to