summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57f1e0b)
raw | patch | inline | side by side (parent: 57f1e0b)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 May 2010 15:50:19 +0000 (15:50 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 May 2010 15:50:19 +0000 (15:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18051 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc
index 416865203d7a8e2957b7606c9ee563207585c981..3e9cb3b275bbc7873ac2148d4252c1c5eb3634c0 100644 (file)
}
return("");
}
+
+ function saveChanges()
+ {
+ foreach($this->properties as $prop){
+ $prop->save();
+ }
+ }
}
$this->value = $str;
}
+ function restoreDefault()
+ {
+ $this->setStatus('removed');
+ }
+
function save()
{
if($this->getStatus() == 'modified'){
echo $ldap->get_error();
}
}
+ }elseif($this->getStatus() == 'removed'){
+ $ldap = $this->parent->config->get_ldap_link();
+ $ldap->cd($this->parent->config->current['BASE']);
+ $dn = "cn={$this->class},".$this->parent->config->current['CONFIG'];
+ $ldap->cat($dn);
+ $attrs = $ldap->fetch();
+ $data = array();
+ for($i = 0;$i<$attrs['gosaSetting']['count']; $i ++){
+ $set = $attrs['gosaSetting'][$i];
+ if(preg_match("/^{$this->name}:/", $set)){
+ continue;
+ }
+ $data['gosaSetting'][] = $set;
+ }
+ $ldap->cd($dn);
+ $ldap->modify($data);
+ if($ldap->success()){
+ $this->status = 'undefined';
+
+ // Second check for values in the config file.
+ if(isset($this->parent->fileStoredProperties[$this->class][$this->name])){
+ $this->setStatus('file');
+ $this->value = $this->parent->fileStoredProperties[$this->class][$this->name];
+ }
+
+ // If there still wasn't found anything then fallback to the default.
+ if($this->getStatus() == 'undefined'){
+ $this->value = $this->getDefault();
+ }
+
+ }else{
+ echo $ldap->get_error();
+ }
}
}
private function setStatus($state)
{
- if(!in_array($state, array('ldap','file','undefined','modified'))) {
+ if(!in_array($state, array('ldap','file','undefined','modified','removed'))) {
trigger_error("Unknown property status given '{$state}' for {$this->class}:{$this->name}!");
}else{
$this->status = $state;
diff --git a/gosa-core/plugins/addons/configViewer/class_configViewer.inc b/gosa-core/plugins/addons/configViewer/class_configViewer.inc
index f209392ec0a69ecb7c7034adc615675e70f289b2..fea8e2e8d18e439cce344b1a49d94bd4a83b6c31 100644 (file)
$headpage->registerElementFilter("propertyValue", "configViewer::propertyValue");
$headpage->setFilter($filter);
parent::__construct($config, $ui, "property", $headpage);
+
+ $this->registerAction("saveProperties","saveProperties");
+ $this->registerAction("cancelProperties","cancelProperties");
+ }
+
+ function cancelProperties()
+ {
+ $this->config->configRegistry->reload($force=TRUE);
+ }
+
+ function saveProperties()
+ {
+ $this->config->configRegistry->saveChanges();
}
+ function detectPostActions()
+ {
+ $action = management::detectPostActions();
+ if(isset($_POST['saveProperties'])) $action['action'] = 'saveProperties';
+ if(isset($_POST['cancelProperties'])) $action['action'] = 'cancelProperties';
+ return($action);
+ }
+
+ protected function removeEntryRequested($action="",$target=array(),$all=array())
+ {
+ foreach($target as $dn){
+ list($class,$name) = preg_split("/:/", $dn);
+ if($this->config->configRegistry->propertyExists($class,$name)){
+ $prop = $this->config->configRegistry->getProperty($class,$name);
+ $prop->restoreDefault();
+ }
+ }
+ }
+
static function propertyGroup($group, $description = array())
{
$title = _("No description");
diff --git a/gosa-core/plugins/addons/configViewer/class_filterProperties.inc b/gosa-core/plugins/addons/configViewer/class_filterProperties.inc
index 08a1c2f0182d5cbdd22fc38ef75b920ad75fbf9c..d475c37531a98963e31f76b5e704b66661323632 100644 (file)
$entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'type', $property->getType());
$entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'migrate', $property->getMigrate());
$entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'group', $property->getGroup());
- $entry['dn'] = $property->getName();
+ $entry['dn'] = $property->getClass().":".$property->getName();
$found =TRUE;
if(!empty($filter)){
diff --git a/gosa-core/plugins/addons/configViewer/main.inc b/gosa-core/plugins/addons/configViewer/main.inc
index fca2fa756818a0bc5c40d78b7e09d0eac4367385..afdbdfc9db652a70f59a2e61c441d92177b2b4a4 100644 (file)
/* Execute formular */
$display= $configViewer->execute ();
- $display.= "<input type=\"hidden\" name=\"ignore\">\n";
/* Store changes in session */
session::set('configViewer',$configViewer);
diff --git a/gosa-core/plugins/addons/configViewer/property-filter.xml b/gosa-core/plugins/addons/configViewer/property-filter.xml
index b4bc1e511e5ab5e196d732235e3afb222cce0e0c..2e42280efa04cdd333125c3bc5068564ebe543e9 100644 (file)
<label>Used properties</label>
<query>
<backend>CONFIGPROPERTIES</backend>
- <filter>status=(ldap|file|modified)§cn=$</filter>
+ <filter>status=(ldap|file|modified|removed)§cn=$</filter>
</query>
<autocomplete>
<attribute>status</attribute>
diff --git a/gosa-core/plugins/addons/configViewer/property-list.tpl b/gosa-core/plugins/addons/configViewer/property-list.tpl
index 008ab32be4fb72eac0e6d74d710d160c2cc9a81b..082f5dea62d40943b9ebb55bc36f626d89d4605d 100644 (file)
{$LIST}
</div>
-<div class="clear"></div>
+<div class="plugin-actions">
+ <button name='saveProperties'>{msgPool type='okButton'}</button>
+ <button name='cancelProperties'>{msgPool type='cancelButton'}</button>
+</div>
diff --git a/gosa-core/plugins/addons/configViewer/property-list.xml b/gosa-core/plugins/addons/configViewer/property-list.xml
index 15e51d37e896bfb6f334ed2b33e241e1abd09673..eab54b3de980833c616b918e1b6336e7f9f36fc5 100644 (file)
<image>images/lists/element.png</image>
</objectType>
+ <objectType>
+ <label>Property will be restored</label>
+ <objectClass>removed</objectClass>
+ <category>all</category>
+ <class>all</class>
+ <image>images/lists/trash.png</image>
+ </objectType>
+
<objectType>
<label>Modified property</label>
<objectClass>modified</objectClass>