conga/luci/storage form-macros
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-10-22 19:30:41
Modified files:
luci/storage : form-macros
Log message:
Fix browser issues (Firefox and IE Windows) with the redirection in the storage tab
luci/storage/form-macros +18 -35
@@ -114,14 +114,10 @@ <script language="javascript" type="text/javascript"> -function strip_left(txt) { - for (i=0; i<txt.length; i++) { - if (txt[i] == " " || txt[i] == "\n") - continue; - return txt.substr(i); - } - return txt; +function strip_left(res_txt) { + return(res_txt.replace(/^\s+/g, "")); } + function check_batch_callback() { if (xmlHttp_object.readyState == 4) { var err_url = (window.location + '').split("?")[1].split("&");
@@ -136,6 +132,7 @@ var msg = xmlHttp_object.responseText; msg = strip_left(msg); var res = msg.split('\n'); + res[0] = strip_left(res[0]); if (res[0] == "DONE") { window.location = res[1]; } else if (res[0] == "NOT_DONE") {
@@ -144,11 +141,11 @@ var m = ''; if (res[0] == "FAILURE") { err_url = res[1]; - m = res[2]; + m = strip_left(res[2]); } else { m = msg; } - alert('An error has occured while committing changes:\n\n' + m); + alert('An error has occurred while committing changes:\n\n' + m); window.location = err_url; } } else {
@@ -198,26 +195,22 @@ <div metal:define-macro="wait-probing-storage"> - <script> -function strip_left(txt) { - for (i=0; i<txt.length; i++) { - if (txt[i] == " " || txt[i] == "\n") - continue; - return txt.substr(i); - } - return txt; + +<script type="text/javascript"> +function strip_left(res_txt) { + return(res_txt.replace(/^\s+/g, "")); } + function cache_report_callback() { if (xmlHttp_object.readyState == 4) { var i = (window.location + '').indexOf('?'); var list_URL = (window.location + '').substr(0, i); if (xmlHttp_object.status == 200) { - res = xmlHttp_object.responseText; - res = strip_left(res); + var res = strip_left(xmlHttp_object.responseText); if (res.substr(0, 2) == "OK") { - window.location.reload(); + window.location = window.location; } else { - alert('An error has occured while probing storage:\n\n' + res); + alert('An error has occurred while probing storage:\n\n' + res); window.location = list_URL; } } else {
@@ -350,7 +343,7 @@ <div metal:define-macro="error-form"> <h2>Error Form</h2> - An error has occured, more details once implemented :) + An error has occurred. </div>
@@ -1489,20 +1482,10 @@ } - - - - -function strip_left(txt) { - for (i=0; i<txt.length; i++) { - if (txt[i] == " " || txt[i] == "\n") - continue; - return txt.substr(i); - } - return txt; +function strip_left(res_txt) { + return(res_txt.replace(/^\s+/g, "")); } - // Apply is button, other ones are submits var tmp_submit_URL = "";
@@ -1513,7 +1496,7 @@ function validate_and_submit_form_callback() { if (xmlHttp_object.readyState == 4) { if (xmlHttp_object.status == 200) { - res = xmlHttp_object.responseText; + var res = xmlHttp_object.responseText; res = strip_left(res); if (res.substr(0, 2) == "OK") { if (confirm(tmp_prompt_msg)) {