Author: Lars Michelsen <[email protected]>
Date: Mon Jan 16 19:44:20 2012 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Mon Jan 16 19:44:20 2012 +0100
Bugfix: Non user-configured (-> conf.d) backends can be configured
as default backends using the web GUI; Non user-configurex: Non
can not be edited using the web GUI
---
.f12 | 2 +-
ChangeLog | 5 ++++-
share/server/core/classes/CoreModMainCfg.php | 6 +++---
share/server/core/classes/GlobalCore.php | 2 +-
share/server/core/classes/GlobalMainCfg.php | 6 ++++--
.../server/core/classes/WuiViewManageBackends.php | 9 ++++++++-
.../templates/default.wuiManageBackends.html | 6 ++++--
7 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/.f12 b/.f12
index 7a7acdf..ffd78d4 100755
--- a/.f12
+++ b/.f12
@@ -1,6 +1,6 @@
#!/bin/bash
-SITE=${1-lancom}
+[ -z $SITE ] && SITE=lancom
cd /d1/nagvis
diff --git a/ChangeLog b/ChangeLog
index d5be622..2484aca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,9 +7,12 @@ Core
Frontend
* Showing dummy shape image when configured shape does not exist
* Added the color picker to background image creation form
+ * Bugfix: Non user-configured (-> conf.d) backends can be configured as
+ default backends using the web GUI; Non user-configurex: Non
+ can not be edited using the web GUI
* Bugfix: Preventing loops in relative coords
* Bugfix: Preventing JS error when trying to position objects relative but
- no target object can be found
+ no target object can be found
* Bugfix: Fixed file upload input field styling issues (at least in Firefox)
* Bugfix: Removed backendtype fields from "Manage Backends" dialog forms
* Bugfix: Fixed problem with the hover menu when using the hover_delay
parameter
diff --git a/share/server/core/classes/CoreModMainCfg.php
b/share/server/core/classes/CoreModMainCfg.php
index 5ead760..c854984 100644
--- a/share/server/core/classes/CoreModMainCfg.php
+++ b/share/server/core/classes/CoreModMainCfg.php
@@ -57,9 +57,9 @@ class CoreModMainCfg extends CoreModule {
break;
case 'doEdit':
$this->handleResponse('handleResponseEdit', 'doEdit',
- l('The main configuration has been
updated.'),
- l('The main
configuration could not be updated.'),
- 1);
+ l('The main configuration has been
updated.'),
+ l('The main configuration could not
be updated.'),
+ 1);
break;
case 'manageBackends':
diff --git a/share/server/core/classes/GlobalCore.php
b/share/server/core/classes/GlobalCore.php
index 46185e2..4490608 100644
--- a/share/server/core/classes/GlobalCore.php
+++ b/share/server/core/classes/GlobalCore.php
@@ -75,7 +75,7 @@ class GlobalCore {
if(!isset($_UMAINCFG)) {
$_UMAINCFG = new GlobalMainCfg();
$_UMAINCFG->setConfigFiles(Array(CONST_MAINCFG));
- $_UMAINCFG->init('-user-only');
+ $_UMAINCFG->init(True, '-user-only');
}
return $_UMAINCFG;
}
diff --git a/share/server/core/classes/GlobalMainCfg.php
b/share/server/core/classes/GlobalMainCfg.php
index fc577a9..399f329 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -33,6 +33,7 @@ class GlobalMainCfg {
protected $preUserConfig = null;
protected $runtimeConfig = Array();
protected $stateWeight;
+ protected $onlyUserConfig = false;
protected $configFiles;
@@ -1065,7 +1066,8 @@ class GlobalMainCfg {
return $files;
}
- public function init($cacheSuffix = '') {
+ public function init($onlyUserConfig = false, $cacheSuffix = '') {
+ $this->onlyUserConfig = $onlyUserConfig;
// Get the valid configuration definitions from the available backends
$this->getBackendValidConf();
@@ -1453,7 +1455,7 @@ class GlobalMainCfg {
}
// Check if the configured backend is defined
in main configuration file
- if($type == 'defaults' && $key == 'backend' &&
!isset($this->config['backend_'.$val])) {
+ if(!$this->onlyUserConfig && $type ==
'defaults' && $key == 'backend' && !isset($this->config['backend_'.$val])) {
if($printErr) {
throw new
NagVisException(l('backendNotDefined', Array('BACKENDID' => $val)));
}
diff --git a/share/server/core/classes/WuiViewManageBackends.php
b/share/server/core/classes/WuiViewManageBackends.php
index bef51f7..ce297fc 100644
--- a/share/server/core/classes/WuiViewManageBackends.php
+++ b/share/server/core/classes/WuiViewManageBackends.php
@@ -39,6 +39,9 @@ class WuiViewManageBackends {
$TMPL = New CoreTemplateSystem($CORE);
$TMPLSYS = $TMPL->getTmplSys();
+ $editableBackends = array_merge(Array('' => ''),
$CORE->getDefinedBackends(ONLY_USERCFG));
+ $definedBackends = array_merge(Array('' => ''),
$CORE->getDefinedBackends());
+
$aData = Array(
'htmlBase' => cfg('paths', 'htmlbase'),
'langSetDefaultBackend' => l('defaultBackend'),
@@ -48,8 +51,12 @@ class WuiViewManageBackends {
'langAddBackend' => l('addBackend'),
'langEditBackend' => l('editBackend'),
'langDelBackend' => l('delBackend'),
+ 'langSomeNotEditable' => l('Some backends are not editable by
using the web gui. They can only be '
+ .'configured by modifying the file in
the NagVis conf.d directory.'),
'defaultBackend' => cfg('defaults', 'backend', true),
- 'definedBackends' => array_merge(Array('' => ''),
$CORE->getDefinedBackends(ONLY_USERCFG)),
+ 'definedBackends' => $definedBackends,
+ 'editableBackends' => $editableBackends,
+ 'someNotEditable' => $editableBackends != $definedBackends,
'availableBackends' => array_merge(Array('' => ''),
$CORE->getAvailableBackends()),
'backendAttributes' =>
$CORE->getMainCfg()->getValidObjectType('backend'),
'validMainCfg' =>
json_encode($CORE->getMainCfg()->getValidConfig()),
diff --git a/share/userfiles/templates/default.wuiManageBackends.html
b/share/userfiles/templates/default.wuiManageBackends.html
index 8f1cbd2..abc0cb5 100644
--- a/share/userfiles/templates/default.wuiManageBackends.html
+++ b/share/userfiles/templates/default.wuiManageBackends.html
@@ -29,6 +29,8 @@ lang = {$lang};
</table>
</form>
+{if $someNotEditable}<p>{$langSomeNotEditable}</p>{/if}
+
<form name="backend_add" id="backend_add" method="POST"
action="javascript:submitFrontendForm('{$htmlBase}/server/core/ajax_handler.php?mod=MainCfg&act=doBackendAdd',
'backend_add');" onsubmit="return check_backend_add();">
<table name="mytable" class="mytable" id="table_backend_add">
<tr>
@@ -62,7 +64,7 @@ lang = {$lang};
<td class="tdlabel" style="color:red;">backendid</td>
<td class="tdfield">
<select name="backendid" onChange="updateBackendOptions('',
this.value, 'backend_edit');">
- {foreach $definedBackends backendId}<option
value="{$backendId}">{$backendId}</option>{/foreach}
+ {foreach $editableBackends backendId}<option
value="{$backendId}">{$backendId}</option>{/foreach}
</select>
</td>
</tr>
@@ -81,7 +83,7 @@ lang = {$lang};
<td class="tdlabel" style="color:red;">backendid</td>
<td class="tdfield">
<select name="backendid">
- {foreach $definedBackends backendId}<option
value="{$backendId}">{$backendId}</option>{/foreach}
+ {foreach $editableBackends backendId}<option
value="{$backendId}">{$backendId}</option>{/foreach}
</select>
</td>
</tr>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins