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

Author: LaMi <[email protected]>
Date:   Sat Jan 16 17:32:29 2010 +0100

WUI addmodify dialogs can now trigger a page refresh after backend communication

---

 share/server/core/classes/CoreModMap.php           |   19 +++++++++++--------
 .../templates/default.wuiMapAddModify.html         |    4 ++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/share/server/core/classes/CoreModMap.php 
b/share/server/core/classes/CoreModMap.php
index 73a2507..377ea96 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -174,14 +174,15 @@ class CoreModMap extends CoreModule {
                                        if($aReturn !== false) {
                                                // Try to create the map
                                                
if($this->doModifyObject($aReturn)) {
-                                                       // FIXME: Would be nice 
to have the object adding without reload of the page
-                                                       //new 
GlobalMessage('NOTE', $this->CORE->getLang()->getText('The object has been 
modified.'),
-                                                       //                  
null,
-                                                       //                  
null,
-                                                       //                  1);
-                                                       // FIXME: Recode to 
GlobalMessage. But the particular callers like
-                                                       //        suppress the 
success messages
-                                                       $sReturn = 
json_encode(Array('status' => 'OK', 'message' => ''));
+                                                       
if(isset($aReturn['refresh']) && $aReturn['refresh'] == 1) {
+                                                               new 
GlobalMessage('NOTE', $this->CORE->getLang()->getText('The object has been 
modified.'),
+                                                                         null,
+                                                                         null,
+                                                                         1);
+                                                         $sReturn = '';
+                                                       } else {
+                                                               $sReturn = 
json_encode(Array('status' => 'OK', 'message' => ''));
+                                                       }
                                                } else {
                                                        new 
GlobalMessage('ERROR', $this->CORE->getLang()->getText('The object could not be 
modified.'));
                                                        $sReturn = '';
@@ -352,6 +353,7 @@ class CoreModMap extends CoreModule {
                unset($aOpts['mod']);
                unset($aOpts['map']);
                unset($aOpts['type']);
+               unset($aOpts['ref']);
                unset($aOpts['id']);
                unset($aOpts['timestamp']);
                
@@ -368,6 +370,7 @@ class CoreModMap extends CoreModule {
                        return Array('map' => $FHANDLER->get('map'),
                                     'type' => $FHANDLER->get('type'),
                                     'id' => $FHANDLER->get('id'),
+                                    'refresh' => $FHANDLER->get('ref'),
                                     'opts' => $aOpts);
                } else {
                        return false;
diff --git a/share/userfiles/templates/default.wuiMapAddModify.html 
b/share/userfiles/templates/default.wuiMapAddModify.html
index 20aefd4..2e8fd32 100644
--- a/share/userfiles/templates/default.wuiMapAddModify.html
+++ b/share/userfiles/templates/default.wuiMapAddModify.html
@@ -1,5 +1,5 @@
 <script type="text/javascript" 
src="{$htmlBase}/frontend/wui/js/addmodify.js"></script>
-<form name="addmodify" id="addmodify"  
action="javascript:submitFrontendForm('{$htmlBase}/server/core/ajax_handler.php?mod=Map&amp;act={$action}',
 'addmodify');" onsubmit="return validateMapCfgForm()" enctype="" >
+<form name="addmodify" id="addmodify"  
action="javascript:submitFrontendForm('{$htmlBase}/server/core/ajax_handler.php?mod=Map&amp;act={$action}&amp;ref=1',
 'addmodify');" onsubmit="return validateMapCfgForm()" enctype="" >
 <table name="mytable" class="mytable" id="table_addmodify">
        <input type="hidden" id="type" name="type" value="{$type}" />
        <input type="hidden" id="id" name="id" value="{$id}" />
@@ -7,4 +7,4 @@
 {$formContents}
        <tr><td class="tdlabel" colspan="2" align="center"><input 
class="submit" type="submit" name="submit" id="commit" value="Save" /></td></tr>
 </table>
-</form>
\ No newline at end of file
+</form>


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to