Code

Created some kind of simple filtering
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 14:52:19 +0000 (14:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 14:52:19 +0000 (14:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18047 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/configViewer/class_filterProperties.inc
gosa-core/plugins/addons/configViewer/property-filter.xml
gosa-core/plugins/addons/configViewer/property-list.tpl
gosa-core/plugins/addons/configViewer/property-list.xml

index d89d15e5deb62d1438a1cf5f08fcbebdbd933437..b95a1eec3a19e433346690632bf673860bbb96c2 100644 (file)
@@ -9,6 +9,7 @@ class filterCONFIGPROPERTIES {
     $all = $config->configRegistry->getAllProperties();
     $ret = array();
     foreach($all as $property){
+
         $entry = array();
         $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'cn', $property->getName());
         $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'objectClass', $property->getStatus());
@@ -21,7 +22,20 @@ class filterCONFIGPROPERTIES {
         $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'migrate', $property->getMigrate());
         $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'group', $property->getGroup());
         $entry['dn'] = $property->getName();
-        $ret[] = $entry; 
+
+        $found =TRUE;
+        if(!empty($filter)){
+            $tests = preg_split("/§/", $filter);
+            foreach($tests as $test){
+                list($name,$value) = preg_split("/=/",$test);
+                $value =preg_replace("/\*/",'',$value);
+                if(empty($value)) $value='.*';
+                if(!isset($entry[$name][0]) || !preg_match("/{$value}/",$entry[$name][0])){
+                    $found = false;
+                }
+            } 
+        }
+       if($found) $ret[] = $entry; 
     }
 
     return($ret);
index cf8f5cb8db439fdecd30646714281a1d308cd9b8..dde011cfcc8e4c36874a1c1c7ede819430054d4b 100644 (file)
 
   <search>
     <tag>default</tag>
-    <label>Default filter</label>
+    <label>Used properties</label>
     <query>
       <backend>CONFIGPROPERTIES</backend>
-      <filter>state=*</filter>
+      <filter>status=(ldap|file)§cn=$</filter>
     </query>
     <autocomplete>
-      <attribute>state</attribute>
+      <attribute>status</attribute>
       <frequency>0.5</frequency>
       <characters>3</characters>
     </autocomplete>
 
   <search>
     <tag>default2</tag>
-    <label>Default filter2</label>
+    <label>All properties</label>
     <query>
       <backend>CONFIGPROPERTIES</backend>
-      <filter>state=modified</filter>
+      <filter>cn=$</filter>
     </query>
     <autocomplete>
-      <attribute>state</attribute>
+      <attribute>status</attribute>
       <frequency>0.5</frequency>
       <characters>3</characters>
     </autocomplete>
index c80f9a2389577f40e56489b37a374fc60e4f18ed..008ab32be4fb72eac0e6d74d710d160c2cc9a81b 100644 (file)
@@ -5,9 +5,6 @@
    <div class="mainlist-nav">
     <table summary="{$HEADLINE}">
      <tr>
-      <td>{$ROOT}</td>
-      <td>{$BACK}</td>
-      <td>{$HOME}</td>
       <td>{$RELOAD}</td>
       <td class="left-border">{$ACTIONS}</td>
       <td class="left-border">{$FILTER}</td>
     </table>
    </div>
   </div>
-
   {$LIST}
 </div>
 
 <div class="clear"></div>
-
-<input type="hidden" name="ignore">
index 891c5a49969a20fdd0993e2df5b5e080a91f10f1..2c452ac4edca160bafd90a367e51e0dade9530b3 100644 (file)
     <defaultSortColumn>1</defaultSortColumn>
 
     <objectType>
-      <label>Property</label>
-      <objectClass>none</objectClass>
+      <label>Property not used</label>
+      <objectClass>undefined</objectClass>
       <category>all</category>
       <class>all</class>
-      <image>plugins/sudo/images/select_sudo.png</image>
+      <image>images/lists/element.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Modified property</label>
+      <objectClass>modified</objectClass>
+      <category>all</category>
+      <class>all</class>
+      <image>plugins/configViewer/images/ldap.png[new]</image>
+    </objectType>
+
+    <objectType>
+      <label>Property configured in ldap</label>
+      <objectClass>ldap</objectClass>
+      <category>all</category>
+      <class>all</class>
+      <image>plugins/configViewer/images/ldap.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Property configured in config file</label>
+      <objectClass>file</objectClass>
+      <category>all</category>
+      <class>all</class>
+      <image>plugins/configViewer/images/file.png</image>
     </objectType>
 
   </definition>
       <export>true</export>
     </column>
 
+    <column>
+      <label>Value</label>
+      <sortAttribute>value</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{value}</value>
+      <export>true</export>
+    </column>
+
     <column>
       <label>Description</label>
       <sortAttribute>description</sortAttribute>