Author: Lars Michelsen <[email protected]>
Date: Tue Oct 4 11:32:44 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Tue Oct 4 11:32:44 2011 +0200
Bugfix: Fixed map global section editing
---
ChangeLog | 1 +
share/server/core/classes/CoreModMap.php | 29 +++++++++++----------
share/server/core/classes/WuiViewMapAddModify.php | 10 +++---
share/userfiles/templates/default.header.html | 2 +-
4 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35755d7..19aab7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ Core
Frontend
* Bugfix: Added missing list code for header templates (map global section
editing)
* Bugfix: Don't hide dependent fiels where the master attribute is not
available
+ * Bugfix: Fixed map global section editing
1.6rc1
diff --git a/share/server/core/classes/CoreModMap.php
b/share/server/core/classes/CoreModMap.php
index 3cb2f83..bc76364 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -284,20 +284,9 @@ class CoreModMap extends CoreModule {
} catch(MapCfgInvalid $e) {}
// Modification/Creation?
- // 'type' is set when creating new objects. Otherwise only the
object_id is known
- if(isset($attrs['type']) && $attrs['type'] != '') {
- // Create the new object
-
- $type = $attrs['type'];
-
- $this->validateAttributes($MAPCFG->getValidObjectType($type),
$attrs);
-
- // append a new object definition to the map configuration
- $MAPCFG->addElement($type, $attrs, true);
-
- $successMsg = l('The [TYPE] has been added. Reloading in 2
seconds.',
- Array('TYPE' =>
$type));
- } else {
+ // The object_id is known on modification. When it is not known 'type'
is set
+ // to create new objects
+ if(isset($attrs['object_id']) && $attrs['object_id'] != '') {
// Modify an existing object
$type = $MAPCFG->getValue($attrs['object_id'], 'type');
@@ -313,6 +302,18 @@ class CoreModMap extends CoreModule {
$successMsg = l('The [TYPE] has been modified. Reloading in 2
seconds.',
Array('TYPE' =>
$type));
+ } else {
+ // Create the new object
+
+ $type = $attrs['type'];
+
+ $this->validateAttributes($MAPCFG->getValidObjectType($type),
$attrs);
+
+ // append a new object definition to the map configuration
+ $MAPCFG->addElement($type, $attrs, true);
+
+ $successMsg = l('The [TYPE] has been added. Reloading in 2
seconds.',
+ Array('TYPE' =>
$type));
}
// delete map lock
diff --git a/share/server/core/classes/WuiViewMapAddModify.php
b/share/server/core/classes/WuiViewMapAddModify.php
index 7b3d2d7..ffb2efd 100644
--- a/share/server/core/classes/WuiViewMapAddModify.php
+++ b/share/server/core/classes/WuiViewMapAddModify.php
@@ -117,13 +117,13 @@ class WuiViewMapAddModify {
function getFields($update) {
$ret = '';
- // 'type' is set when creating new objects. Otherwise only the
object_id is known
- if(isset($this->attrs['type']) && $this->attrs['type'] != '') {
- $type = $this->attrs['type'];
- $objId = 0;
- } else {
+ // 'object_id' is only set when modifying existing objects
+ if(isset($this->attrs['object_id']) && $this->attrs['object_id'] !=
'') {
$type = $this->MAPCFG->getValue($this->attrs['object_id'],
'type');
$objId = $this->attrs['object_id'];
+ } else {
+ $type = $this->attrs['type'];
+ $objId = 0;
}
$typeDefaults = $this->MAPCFG->getTypeDefaults($type);
diff --git a/share/userfiles/templates/default.header.html
b/share/userfiles/templates/default.header.html
index 6cb0d33..e7f94bf 100644
--- a/share/userfiles/templates/default.header.html
+++ b/share/userfiles/templates/default.header.html
@@ -91,7 +91,7 @@
</li>
<li class="spacer"><hr /></li>
<li><a href="#"
onclick="showFrontendDialog(oGeneralProperties.path_server+'?mod=Map&act=manageTmpl&show={$currentMap}',
'{$langMapManageTmpl}', 300)">{$langMapManageTmpl}</a></li>
- <li><a href="#"
onclick="showFrontendDialog(oGeneralProperties.path_server+'?mod=Map&act=addModify&do=modify&show={$currentMap}&type=global&id=0',
'{$langMapOptions}');" class="underline">{$langMapOptions}</a></li>
+ <li><a href="#"
onclick="showFrontendDialog(oGeneralProperties.path_server+'?mod=Map&act=addModify&show={$currentMap}&object_id=0',
'{$langMapOptions}');" class="underline">{$langMapOptions}</a></li>
</ul>
</li>
{/if}
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins