From 57f1e0ba2e7a63374cb13b3236b274ca1ba49909 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 4 May 2010 15:31:36 +0000 Subject: [PATCH] Updated property filtering git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18050 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../configViewer/class_configViewer.inc | 102 +++++++----------- .../configViewer/class_filterProperties.inc | 1 + .../addons/configViewer/property-filter.xml | 2 +- .../addons/configViewer/property-list.xml | 45 +++----- 4 files changed, 52 insertions(+), 98 deletions(-) diff --git a/gosa-core/plugins/addons/configViewer/class_configViewer.inc b/gosa-core/plugins/addons/configViewer/class_configViewer.inc index 74e2ddc78..f209392ec 100644 --- a/gosa-core/plugins/addons/configViewer/class_configViewer.inc +++ b/gosa-core/plugins/addons/configViewer/class_configViewer.inc @@ -23,83 +23,53 @@ class configViewer extends management // Build headpage $headpage = new listing(get_template_path("property-list.xml", true)); + $headpage->registerElementFilter("propertyName", "configViewer::propertyName"); + $headpage->registerElementFilter("propertyGroup", "configViewer::propertyGroup"); + $headpage->registerElementFilter("propertyClass", "configViewer::propertyClass"); + $headpage->registerElementFilter("propertyValue", "configViewer::propertyValue"); $headpage->setFilter($filter); parent::__construct($config, $ui, "property", $headpage); } -} - -class configViewer_old extends plugin -{ - - var $configRegistry = NULL; - var $viewType = 'byClass'; - var $viewTypes = array(); - function __construct (&$config, $dn= NULL) + static function propertyGroup($group, $description = array()) { - $this->config = &$config; - $this->configRegistry = &$config->configRegistry; - $this->viewTypes = array( - 'byClass' => _("By class name"), - 'byName' => _("By property name"), - 'byStatus'=> _("By status"), - 'byGroup' => _('By group')); - - - $this->propertyList = new sortableListing(); - $this->propertyList->setDeleteable(false); - $this->propertyList->setEditable(false); - $this->propertyList->setWidth("100%"); - $this->propertyList->setHeight("500px"); - $this->propertyList->setHeader(array(_("Group"),_("Class"),_("Name"),_("Value"), _("Status"))); - $this->propertyList->setDefaultSortColumn(0); - $this->propertyList->setAcl('rwcdm'); + $title = _("No description"); + if(!empty($description[0])) $title=$description[0]; + return("{$group[0]}"); } - - function execute() + static function propertyClass($class, $description = array()) { - $all = $this->configRegistry->getAllProperties(); - $data = $lData = array(); - foreach($all as $id => $p){ - $value = htmlentities($p->getValue(), ENT_COMPAT, 'UTF-8'); - $data[$id] = $p; - - - $status = $p->getStatus(); - if($status == 'modified'){ - $status = ""; - $status.= ""; - } - if($status == 'ldap'){ - $status = ""; - } - - $lData[$id] = array('data' => array( - $p->getGroup(), - $this->configRegistry->classToName[$p->getClass()], - $p->getName(), - "", - $status - )); + global $config; + if(isset($config->configRegistry->classToName[$class[0]])){ + $class = $config->configRegistry->classToName[$class[0]]; + }else{ + $class = $class[0]; } - $this->propertyList->setListData($data,$lData); - $this->propertyList->update(); - $smarty = get_smarty(); - $smarty->assign('content', $this->propertyList->render()); - return($smarty->fetch(get_template_path('generic.tpl', TRUE))); + $title = _("No description"); + if(!empty($description[0])) $title=$description[0]; + return("{$class}"); } - - function save_object() + static function propertyName($cn, $description = array()) { - $all = $this->configRegistry->getAllProperties(); - foreach($all as $id => $p){ - if(isset($_POST[$p->getClass().":".$p->getName()])){ - $val = get_post($p->getClass().":".$p->getName()); - if($val != $p->getValue()){ - $p->setValue($val); - } - } + $title = _("No description"); + if(!empty($description[0])) $title=$description[0]; + return("{$cn[0]}"); + } + static function propertyValue($class,$cn, $value,$type,$default,$description) + { + $name = "{$class[0]}:{$cn[0]}"; + $value = htmlentities($value[0], ENT_COMPAT , 'UTF-8'); + $title = _("No description"); + if(!empty($description[0])) $title=$description[0]; + switch($type[0]){ + case 'string': + case 'integer': + $res = ""; + break; + default: $res = ""; } + + return($res); } } ?> diff --git a/gosa-core/plugins/addons/configViewer/class_filterProperties.inc b/gosa-core/plugins/addons/configViewer/class_filterProperties.inc index b95a1eec3..08a1c2f01 100644 --- a/gosa-core/plugins/addons/configViewer/class_filterProperties.inc +++ b/gosa-core/plugins/addons/configViewer/class_filterProperties.inc @@ -18,6 +18,7 @@ class filterCONFIGPROPERTIES { $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'value', $property->getValue()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'default', $property->getDefault()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'check', $property->getCheck()); + $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'class', $property->getClass()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'type', $property->getType()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'migrate', $property->getMigrate()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'group', $property->getGroup()); diff --git a/gosa-core/plugins/addons/configViewer/property-filter.xml b/gosa-core/plugins/addons/configViewer/property-filter.xml index bda7d3f15..b4bc1e511 100644 --- a/gosa-core/plugins/addons/configViewer/property-filter.xml +++ b/gosa-core/plugins/addons/configViewer/property-filter.xml @@ -25,7 +25,7 @@ - default2 + all CONFIGPROPERTIES diff --git a/gosa-core/plugins/addons/configViewer/property-list.xml b/gosa-core/plugins/addons/configViewer/property-list.xml index 2c452ac4e..15e51d37e 100644 --- a/gosa-core/plugins/addons/configViewer/property-list.xml +++ b/gosa-core/plugins/addons/configViewer/property-list.xml @@ -46,7 +46,7 @@ - |20px;c|120px||||170px;r| + |20px;c|80px|100px|100px||60px;r| %{filter:objectType(dn,objectClass)} @@ -56,31 +56,31 @@ group string - %{group} + %{filter:propertyGroup(group,description)} true - - cn + + group string - %{cn} + %{filter:propertyClass(class,description)} true - - value + + cn string - %{value} + %{filter:propertyName(cn,description)} true - - description + + value string - %{description} + %{filter:propertyValue(class,cn,value,type,default,description)} true @@ -143,31 +143,14 @@ - - - - cp - copypaste - - - - edit - entry - images/lists/edit.png - - - - - snapshot - snapshot - + remove entry + ldap images/lists/trash.png - sudo/sudo[d] - + -- 2.30.2