Module: nagvis
Branch: master
Commit: e9561b7bdc0106922ec6c7db9976c63d8cdb72ff
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=e9561b7bdc0106922ec6c7db9976c63d8cdb72ff

Author: LaMi <[email protected]>
Date:   Fri Feb 19 20:35:30 2010 +0100

Fixed error reporting when submitting forms via POST; role management also uses 
the automatic reload of the form after submission

---

 share/frontend/nagvis-js/js/frontend.js            |    8 ++++--
 share/frontend/nagvis-js/js/popupWindow.js         |   26 +++++++++----------
 share/userfiles/templates/default.manageRoles.html |    8 +++---
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 5e60c98..cd5548b 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -48,10 +48,10 @@ function submitFrontendForm(sUrl, sFormId, 
bReloadOnSuccess) {
        
        var oResult = postSyncRequest(sUrl, getFormParams(sFormId));
        
-       if(oResult && oResult.type && oResult.type === 'note') {
-               if(bReloadOnSuccess) {
+       if(oResult && oResult.type) {
+               if(oResult.type === 'note' && bReloadOnSuccess) {
                        if(typeof popupWindowRefresh == 'function') {
-                                popupWindowRefresh();
+                               popupWindowRefresh();
                        }
                } else {
                        // Show message and close the window
@@ -63,6 +63,8 @@ function submitFrontendForm(sUrl, sFormId, bReloadOnSuccess) {
                        }
                }
        }
+
+       oResult = null;
 }
 
 /**
diff --git a/share/frontend/nagvis-js/js/popupWindow.js 
b/share/frontend/nagvis-js/js/popupWindow.js
index 4962f6e..2c2d6c0 100644
--- a/share/frontend/nagvis-js/js/popupWindow.js
+++ b/share/frontend/nagvis-js/js/popupWindow.js
@@ -108,20 +108,18 @@ function popupWindowPutContent(oContent) {
 
                // Need to fix javascript execution in innerHTML
                // Works in firefox so don't do it for firefox
-               if(!isFirefox()) {
-                       var aScripts = oCell.getElementsByTagName('script');
-                       for(var i = 0, len = aScripts.length; i < len; i++) {
-                               if(aScripts[i].src && aScripts[i].src !== '') {
-                                       var oScr = 
document.createElement('script');  
-                                       oScr.src = aScripts[i].src;  
-                                       document.body.appendChild(oScr);
-                                       oScr = null;
-                               } else {
-                                       try {
-                                               eval(aScripts[i].text);
-                                       } catch(e) {
-                                               alert(oDump(e)+": 
"+aScripts[i].text);
-                                       }
+               var aScripts = oCell.getElementsByTagName('script');
+               for(var i in aScripts) {
+                       if(aScripts[i].src && aScripts[i].src !== '') {
+                               var oScr = document.createElement('script');  
+                               oScr.src = aScripts[i].src;  
+                               document.body.appendChild(oScr);
+                               oScr = null;
+                       } else {
+                               try {
+                                       eval(aScripts[i].text);
+                               } catch(e) {
+                                       alert(oDump(e)+": "+aScripts[i].text);
                                }
                        }
                }
diff --git a/share/userfiles/templates/default.manageRoles.html 
b/share/userfiles/templates/default.manageRoles.html
index 0125fdf..43a897e 100644
--- a/share/userfiles/templates/default.manageRoles.html
+++ b/share/userfiles/templates/default.manageRoles.html
@@ -38,7 +38,7 @@ selectRolePerms = function (id) \{
 <div id="manageRoles">
 <fieldset class="form">
        <legend>{$langRoleAdd}</legend>
-       <form name="roleAdd" id="roleAddForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetAdd}', 'roleAddForm');return false" 
method="post">
+       <form name="roleAdd" id="roleAddForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetAdd}', 'roleAddForm', true);return 
false" method="post">
                <table>
                        <tr>
                                <td><label 
for="name">{$langRoleName}:</label></td>
@@ -53,7 +53,7 @@ selectRolePerms = function (id) \{
 <div id="manageRoles">
 <fieldset class="form">
        <legend>{$langRoleModify}</legend>
-       <form name="roleEdit" id="roleEditForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetEdit}', 'roleEditForm');return false" 
method="post">
+       <form name="roleEdit" id="roleEditForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetEdit}', 'roleEditForm', true);return 
false" method="post">
                <p>
                        <label>{$langSelectRole}<br />
                        <select type="text" name="roleId" id="roleId" 
class="select" tabindex="10" 
onchange="selectRolePerms(this.options[this.selectedIndex].value);" />
@@ -92,7 +92,7 @@ selectRolePerms = function (id) \{
 <div id="deleteRoles">
 <fieldset class="form">
        <legend>{$langRoleDelete}</legend>
-       <form name="roleDelete" id="roleDeleteForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetDelete}', 'roleDeleteForm');return 
false" method="post">
+       <form name="roleDelete" id="roleDeleteForm" action="#" 
onsubmit="submitFrontendForm('{$formTargetDelete}', 'roleDeleteForm', 
true);return false" method="post">
                <table>
                        <tr>
                                <td><label 
for="roleId">{$langRoleName}:</label></td>
@@ -107,4 +107,4 @@ selectRolePerms = function (id) \{
                </table>
        </form>
 </fieldset>
-</div>
\ No newline at end of file
+</div>


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to