Code

added new kind of object listing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 14:02:55 +0000 (14:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 14:02:55 +0000 (14:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18045 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 85975aeea56cd01c4fa7dda477ba3cff86c355ea..d89d15e5deb62d1438a1cf5f08fcbebdbd933437 100644 (file)
@@ -1,13 +1,46 @@
 <?php
 
-class filterProperties {
+class filterCONFIGPROPERTIES {
 
   static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
   {
-    print_a(array($base, $scope, $filter, $attributes, $category, $objectStorage));
-    return(array());
+    global $config;
+    
+    $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());
+        $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'status', $property->getStatus());
+        $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'description', $property->getDescription());
+        $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, 'type', $property->getType());
+        $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'migrate', $property->getMigrate());
+        $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'group', $property->getGroup());
+        $entry['dn'] = $property->getName();
+        $ret[] = $entry; 
+    }
+
+    return($ret);
   }
 
+    static function fakeLdapResult($result,$name, $value){
+        if(!is_array($value)){
+            $value = array($value);
+        }
+        $value['count'] = count($value);
+        $result[] = $name;
+        $result[$name] = $value;
+        if(!isset($result['count'])){
+            $result['count'] =0;
+        }
+        $result['count'] ++;
+        return($result);
+    }
+
   static function unifyResult($result)
   {
     $res=array();
index 1737aa979764ad2e37c4f063280f6025e7c624d7..fca2fa756818a0bc5c40d78b7e09d0eac4367385 100644 (file)
@@ -23,8 +23,6 @@
 */
 if ($remove_lock){
     if(session::is_set('configViewer')){
-        $configViewer = session::get('configViewer');   
-        $configViewer->save_object();
     }
 }
 
@@ -33,8 +31,6 @@ if ($remove_lock){
  */
 if ( $cleanup ){
     if (session::is_set('configViewer')){
-        $configViewer = session::get('configViewer');   
-        $configViewer->save_object();
     }
     session::un_set('configViewer');
 }else{
@@ -42,7 +38,7 @@ if ( $cleanup ){
 
     /* Create logview object on demand */
     if (!session::is_set('configViewer')){
-        session::set('configViewer',new configViewer($config));
+        session::set('configViewer',new configViewer($config, get_userinfo()));
     }
     $configViewer = session::get('configViewer');
 
index 16eec7dc29c3113b8a3fa268a92ded00d167bc3d..cf8f5cb8db439fdecd30646714281a1d308cd9b8 100644 (file)
@@ -7,13 +7,14 @@
     <initial>true</initial>
     <default>default</default>
     <scope>one</scope>
+    <attribute>dummy</attribute>
   </definition>
 
   <search>
     <tag>default</tag>
     <label>Default filter</label>
     <query>
-      <backend>PROPERTIES</backend>
+      <backend>CONFIGPROPERTIES</backend>
       <filter>state=*</filter>
     </query>
     <autocomplete>
@@ -27,8 +28,8 @@
     <tag>default2</tag>
     <label>Default filter2</label>
     <query>
-      <backend>PROPERTIES</backend>
-      <filter>state=modified>
+      <backend>CONFIGPROPERTIES</backend>
+      <filter>state=modified</filter>
     </query>
     <autocomplete>
       <attribute>state</attribute>
index b973198d89254309d747e9636f85e785155794df..891c5a49969a20fdd0993e2df5b5e080a91f10f1 100644 (file)
@@ -6,33 +6,41 @@
     <departmentRootVisible>false</departmentRootVisible>
     <baseMode>false</baseMode>
     <multiSelect>true</multiSelect>
-    <template>sudo-list.tpl</template>
-    <module>sudo</module>
-    <label>List of sudo roles</label>
+    <template>property-list.tpl</template>
+    <module>all</module>
+    <label>List of configuration settings</label>
     <defaultSortColumn>1</defaultSortColumn>
 
     <objectType>
-      <label>Role</label>
-      <objectClass>sudoRole</objectClass>
-      <category>sudo</category>
-      <class>sudo</class>
+      <label>Property</label>
+      <objectClass>none</objectClass>
+      <category>all</category>
+      <class>all</class>
       <image>plugins/sudo/images/select_sudo.png</image>
     </objectType>
 
   </definition>
 
   <table>
-    <layout>|20px;c|120px||170px;r|</layout>
+    <layout>|20px;c|120px||||170px;r|</layout>
 
     <column>
       <value>%{filter:objectType(dn,objectClass)}</value>
     </column>
 
+    <column>
+      <label>Group</label>
+      <sortAttribute>group</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{group}</value>
+      <export>true</export>
+    </column>
+
     <column>
       <label>Name</label>
       <sortAttribute>cn</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:link(row,dn,"%s",cn)}</value>
+      <value>%{cn}</value>
       <export>true</export>
     </column>
 
@@ -40,7 +48,7 @@
       <label>Description</label>
       <sortAttribute>description</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:link(row,dn,"%s",description)}</value>
+      <value>%{description}</value>
       <export>true</export>
     </column>