Code

Added php page.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 6 Nov 2007 10:24:11 +0000 (10:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 6 Nov 2007 10:24:11 +0000 (10:24 +0000)
Modified generated output

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7738 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa.conf
include/class_ObjectList.inc
include/class_ObjectListViewport.inc
test
test.php [new file with mode: 0644]

index 36b145b2e852be4e24fbda165d6bce46c82e1137..7833c6644b23cf46476b1697253281e97db004b3 100644 (file)
--- a/gosa.conf
+++ b/gosa.conf
@@ -119,6 +119,6 @@ kiosk-path = "/var/spool/kiosk"
 ppd-path = "/var/spool/ppds"
 
 [plugin/sample]
-headline= "|{196px}|{:CB}Name|{64px:R}Actions|"
+headline= "|{18px}|{:L}Name|{64px:R}Actions|"
 footer= "Statistics with no information currently"
 entryFormat= "|{_icon}|{cn} ({_filter(uppercase,{cn})})|{_actions}|"
index 9958f2fc890a999fd3f2fcd17d1b7d334b84fddd..01e7ac52838b6a0a2b5270284b828f14e01eaf7d 100644 (file)
@@ -74,276 +74,276 @@ class ObjectList implements IteratorAggregate {
  array("dn" => "cn=1aherbertskiste,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "1aherbertskiste",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=72:9c:13:e9:72:2b,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "72:9c:13:e9:72:2b",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=8f:9c:d0:d5:42:c0,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "8f:9c:d0:d5:42:c0",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=a.b_c,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "a.b_c",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=a5:35:77:86:ff:ca,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "a5:35:77:86:ff:ca",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=cl1--141,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "cl1--141",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=d9:57:9d:08:2c:65,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "d9:57:9d:08:2c:65",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=dyn-111,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "dyn-111",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=e3:b4:43:51:f6:13,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "e3:b4:43:51:f6:13",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=f2:d7:ef:92:e6:43,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "f2:d7:ef:92:e6:43",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=f9:fa:4e:f8:1a:40,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "f9:fa:4e:f8:1a:40",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=hu_ber-test.gonicus.de,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "hu_ber-test.gonicus.de",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=loghost-01,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "loghost-01",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=ntp.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "ntp.jp.",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=phone-1.gonicus.de.,ou=phones,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "phone-1.gonicus.de.",
               "_icon" => "select_phone.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=printer.222,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "printer.222",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=printer,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "printer",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=shares.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "shares.jp. [Share server]",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=terminal.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "terminal.jp.",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=test.test.etst,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "test.test.etst",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=tester,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "tester",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=vserver-04.intranet.gonicus.de,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "vserver-04.intranet.gonicus.de [Mail Server]",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=workstation,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "workstation",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
  array("dn" => "cn=1aherbertskiste,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "1aherbertskiste",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=72:9c:13:e9:72:2b,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "72:9c:13:e9:72:2b",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=8f:9c:d0:d5:42:c0,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "8f:9c:d0:d5:42:c0",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=a.b_c,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "a.b_c",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=a5:35:77:86:ff:ca,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "a5:35:77:86:ff:ca",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=cl1--141,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "cl1--141",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=d9:57:9d:08:2c:65,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "d9:57:9d:08:2c:65",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=dyn-111,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "dyn-111",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=e3:b4:43:51:f6:13,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "e3:b4:43:51:f6:13",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=f2:d7:ef:92:e6:43,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "f2:d7:ef:92:e6:43",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=f9:fa:4e:f8:1a:40,ou=incoming,o=Landeshauptstadt München,c=de",
               "cn" => "f9:fa:4e:f8:1a:40",
               "_icon" => "select_newsystem.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=hu_ber-test.gonicus.de,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "hu_ber-test.gonicus.de",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=loghost-01,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "loghost-01",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=ntp.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "ntp.jp.",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=phone-1.gonicus.de.,ou=phones,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "phone-1.gonicus.de.",
               "_icon" => "select_phone.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=printer.222,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "printer.222",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=printer,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "printer",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=shares.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "shares.jp. [Share server]",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=terminal.jp.,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "terminal.jp.",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=test.test.etst,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "test.test.etst",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=tester,ou=printers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "tester",
               "_icon" => "select_printer.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=vserver-04.intranet.gonicus.de,ou=servers,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "vserver-04.intranet.gonicus.de [Mail Server]",
               "_icon" => "select_server.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation')),
 
  array("dn" => "cn=workstation,ou=workstations,ou=systems,o=Landeshauptstadt München,c=de",
               "cn" => "workstation",
               "_icon" => "select_workstation.png",
-              "_actions" => "CPSRED",
+              "_actions" => "CPSREDX",
               "objectClass" => array('gotoWorkstation'))
 
         );
index 84cf37c648691f8fb3530196d27cecfd218ea7f9..6f070214b3fbb88ffac2a47a7265c7b95c90f96c 100644 (file)
@@ -30,6 +30,7 @@ class ObjectListViewport {
   private $footer;
   private $entryFormat;
   private $attributes= array('cn', '_icon', '_actions', 'dn');
+
   /* <---- Dummy here */
 
   /*!
@@ -83,10 +84,11 @@ class ObjectListViewport {
       \return HTML rendered headline
         */
   private function renderHeadline(){
-    # Dummy implementation. Use pre-defined headline.
-    $buffer= $this->headline."\n";
-
-    #TODO: Make $buffer a proper HTML table output
+    $buffer ="<tr>\n";
+    foreach($this->headline as $key => $value){
+      $buffer .= "<td style='".$value['style']."'>".$value['name']."</td>\n";
+    }
+    $buffer.="</tr>\n";
     return $buffer;
   }
 
@@ -98,18 +100,21 @@ class ObjectListViewport {
       \return HTML rendered footer
         */
   private function renderFooter(){
-    # Dummy implementation. Use pre-defined footer.
-    $buffer= "|".$this->footer."|";
 
-    #TODO: Make $buffer a proper HTML table output
-    return $buffer."|\n";
+    $buffer ="<tr>\n";
+    $buffer .= "<td colspan='".count($this->headline)."'>".$this->footer."</td>\n";
+    $buffer.="</tr>\n";
+    return $buffer;
   }
 
 
-       /*! \brief Renders entries from the ObjectList iterator into a string
+  private function getEntryIcon($entry,$alt = ""){
+    return("<img src='images/".$entry['_icon']."' alt='".$alt."' class='center'>");
+  }
 
-           Gets the entry descriptions from the ObjectList object and renders them.
 
+       /*! \brief Renders entries from the ObjectList iterator into a string
+           Gets the entry descriptions from the ObjectList object and renders them.
       \return HTML rendered list entries
         */
   private function renderEntry($entry){
@@ -117,20 +122,17 @@ class ObjectListViewport {
     /* Copy template */
     $buffer= $this->entryFormat;
 
-    $tmp = split("\|",trim($this->entryFormat,"|"));  
-
-    $buffer ="<tr>\n";
-    foreach($tmp as $key => $value){
-      $buffer .= "<td style='".$this->headline[$key]['style']."'>".$value."</td>\n";
-    }
-    $buffer.="</tr>\n";
-
     /* Replace set of attributes */
     foreach ($this->attributes as $attribute){
       if (!isset($entry[$attribute])){
         throw new ObjectListViewportException(sprintf(_("Can't locate attribute '%s' to replace in entry!"), $attribute));
       } else {
-        $buffer= preg_replace('/\{'.$attribute.'\}/', $entry[$attribute],$buffer);
+
+        if(preg_match("/_icon/i",$attribute)){
+          $buffer= preg_replace('/\{'.$attribute.'\}/', $this->getEntryIcon($entry),$buffer); 
+        }else{
+          $buffer= preg_replace('/\{'.$attribute.'\}/', $entry[$attribute],$buffer);
+        }
       }
     }
 
@@ -144,6 +146,14 @@ class ObjectListViewport {
 
     #TODO: Make $buffer a proper HTML table output
 
+    $tmp = split("\|",trim($buffer,"|"));  
+
+    $buffer ="<tr>\n";
+    foreach($tmp as $key => $value){
+      $buffer .= "<td class='ObjectListViewportEntry' style='".$this->headline[$key]['style']."'>".$value."</td>\n";
+    }
+    $buffer.="</tr>\n";
+
     return $buffer."\n";
   }
 
@@ -173,6 +183,7 @@ class ObjectListViewport {
 
     /* Apply current filter */
     $objects= new ObjectListFilterIterator($this->objects->getIterator());
+    
     foreach ($objects as $value){
       $buffer.= $this->renderEntry($value);
     }
@@ -180,7 +191,8 @@ class ObjectListViewport {
     /* Generate footer */
     $buffer.= $this->renderFooter();
 
-    return ("<table border=1 style='width:100%'>".$buffer."</table>");
+
+    return ("<table class='ObjectListViewportTable'>".$buffer."</table>");
   }
 
 
@@ -200,7 +212,7 @@ class ObjectListViewport {
       $s_width    = "";
       $s_alignment= "";
       $s_name     = preg_replace("/\{[^\}]*+\}/","",$data);
-      $s_style    = "height:40px;";
+      $s_style    = "";
     
       /* Parse format string and detect width & alignment */
       if(preg_match("/\{.*\}/",$data)){
@@ -241,6 +253,9 @@ class ObjectListViewport {
     }
     return($cell_formats);
   }
+
+
+  
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/test b/test
index 3c8f54fe20355daecd2efab71df836af6c8edcfa..c023fd69ce70ef93f135b19abe680f44ef57cb52 100755 (executable)
--- a/test
+++ b/test
@@ -1,6 +1,8 @@
 #!/usr/bin/php
+
 <?php
 
+
 /* This is good for testing... */
 error_reporting (E_ALL | E_STRICT);
 
diff --git a/test.php b/test.php
new file mode 100644 (file)
index 0000000..c58318f
--- /dev/null
+++ b/test.php
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+       "http://www.w3.org/TR/html4/transitional.dtd">
+<html>
+<head>
+</head>
+<body>
+<div style='overflow:scroll;height:500px; width:700px;'>
+<?php
+echo passthru("./test");
+?>
+</div>
+</body>
+</html>