Code

Updated config viewer
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 11:20:56 +0000 (11:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 May 2010 11:20:56 +0000 (11:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18038 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/configViewer/class_configViewer.inc
gosa-core/plugins/addons/configViewer/generic.tpl [new file with mode: 0644]
gosa-core/plugins/addons/configViewer/main.inc

index 489b4f7af5087ec6b8b769cf579e867c4b024562..51b7a2a03ea5c162b25c34a8c42d59672b05e05f 100644 (file)
@@ -35,15 +35,25 @@ class configViewer extends plugin
         $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 = "<button name='save_{$p->getClass()}:{$p->getName()}'>".msgPool::saveButton()."</button>";
+                $status.= "<button name='reset_{$p->getClass()}:{$p->getName()}'>".("Reset")."</button>";
+            }
+            if($status == 'ldap'){
+                $status = "<button name='del_{$p->getClass()}:{$p->getName()}'>".msgPool::saveButton()."</button>";
+            }
+
             $lData[$id] = array('data' => array(
                         $p->getGroup(),
                         $this->configRegistry->classToName[$p->getClass()],
                         $p->getName(),
                         "<input type='text' value=\"{$value}\" name='{$p->getClass()}:{$p->getName()}'>",
-                        $p->getStatus()
+                        $status
                         ));
         }
         $this->propertyList->setListData($data,$lData);
@@ -52,5 +62,18 @@ class configViewer extends plugin
         $smarty->assign('content', $this->propertyList->render());
         return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
     }
+
+    function save_object()
+    {
+        $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);
+                }
+            }
+        }
+    }
 }
 ?>
diff --git a/gosa-core/plugins/addons/configViewer/generic.tpl b/gosa-core/plugins/addons/configViewer/generic.tpl
new file mode 100644 (file)
index 0000000..1893271
--- /dev/null
@@ -0,0 +1,25 @@
+
+<div id="mainlist">
+ <div class="mainlist-header">
+  <p>{t}Config viewer{/t}</p>
+
+  <div class="mainlist-nav">
+   <table summary="{t}Filter{/t}" style="width: 100%;"
+      id="t_scrolltable" cellpadding="0" cellspacing="0">
+    <tr>
+     <td style='width:25%;'>{t}Search for{/t}:
+        <input value='Does not work right now' type='text'>
+     </td>
+     <td style='width:25%;'>
+        <button type='submit'>{t}Save{/t}</button>
+     </td>
+    </tr>
+   </table>
+  </div>
+ </div>
+</div>
+
+
+
+
+{$content}
index 529634db8fd1b157a195eab42e5f3c4ecf82f72a..27444ad41fef927d33bea48ba726e2046c57f4fa 100644 (file)
 */
 if ($remove_lock){
     if(session::is_set('configViewer')){
-        // Nothing to unlock here
+        $configViewer = session::get('configViewer');   
+        $configViewer->save_object();
     }
 }
 
+
 /* Remove this plugin from session
  */
 if ( $cleanup ){
+    if (session::is_set('configViewer')){
+        $configViewer = session::get('configViewer');   
+        $configViewer->save_object();
+    }
     session::un_set('configViewer');
 }else{