Author:   Lars Michelsen <[email protected]>
Date:     Sun Sep  4 02:48:54 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Sep  4 02:48:54 2011 +0200

FIX: Maps can be created using the WUI again

---

 share/server/core/classes/CoreModMap.php |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/share/server/core/classes/CoreModMap.php 
b/share/server/core/classes/CoreModMap.php
index df47603..2fa4021 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -863,9 +863,8 @@ class CoreModMap extends CoreModule {
         if($bValid && $FHANDLER->isSetAndNotEmpty('map_current') && 
!$FHANDLER->match('map_current', MATCH_MAP_NAME))
             $bValid = false;
 
-        // Check if the new map already exists
-        if($bValid && 
count($this->CORE->getAvailableMaps('/^'.$FHANDLER->get('map_new_name').'$/')) 
> 0)
-            throw new NagVisException(l('The new mapname does already 
exist.'));
+        if($bValid)
+            $this->verifyMapExists($FHANDLER->get('map_new_name'), true);
 
         // Store response data
         if($bValid === true) {
@@ -907,7 +906,7 @@ class CoreModMap extends CoreModule {
             $bValid = false;
 
         if($bValid)
-            $this->verifyMapExists($FHANDLER->get('map'));
+            $this->verifyMapExists($FHANDLER->get('map'), true);
 
         // Store response data
         if($bValid === true) {
@@ -981,9 +980,16 @@ class CoreModMap extends CoreModule {
     }
 
     // Check if the map exists
-    private function verifyMapExists($map) {
-        if(count($this->CORE->getAvailableMaps('/^'.$map.'$/')) <= 0)
-            throw new NagVisException(l('The map does not exist.'));
+    private function verifyMapExists($map, $negate = false) {
+        if(!$negate) {
+            if(count($this->CORE->getAvailableMaps('/^'.$map.'$/')) <= 0) {
+                throw new NagVisException(l('The map does not exist.'));
+            }
+        } else {
+            if(count($this->CORE->getAvailableMaps('/^'.$map.'$/')) > 0) {
+                throw new NagVisException(l('The map does already exist.'));
+            }
+        }
     }
 }
 ?>


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to