From: hickert Date: Tue, 6 Nov 2007 10:24:11 +0000 (+0000) Subject: Added php page. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4da044c484ef4c02b5cd7e56f9d79837abedfb3f;p=gosa.git Added php page. Modified generated output git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7738 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa.conf b/gosa.conf index 36b145b2e..7833c6644 100644 --- 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}|" diff --git a/include/class_ObjectList.inc b/include/class_ObjectList.inc index 9958f2fc8..01e7ac528 100644 --- a/include/class_ObjectList.inc +++ b/include/class_ObjectList.inc @@ -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')) ); diff --git a/include/class_ObjectListViewport.inc b/include/class_ObjectListViewport.inc index 84cf37c64..6f070214b 100644 --- a/include/class_ObjectListViewport.inc +++ b/include/class_ObjectListViewport.inc @@ -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 ="\n"; + foreach($this->headline as $key => $value){ + $buffer .= "".$value['name']."\n"; + } + $buffer.="\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 ="\n"; + $buffer .= "".$this->footer."\n"; + $buffer.="\n"; + return $buffer; } - /*! \brief Renders entries from the ObjectList iterator into a string + private function getEntryIcon($entry,$alt = ""){ + return("".$alt.""); + } - 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 ="\n"; - foreach($tmp as $key => $value){ - $buffer .= "".$value."\n"; - } - $buffer.="\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 ="\n"; + foreach($tmp as $key => $value){ + $buffer .= "".$value."\n"; + } + $buffer.="\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 ("".$buffer."
"); + + return ("".$buffer."
"); } @@ -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 3c8f54fe2..c023fd69c 100755 --- a/test +++ b/test @@ -1,6 +1,8 @@ #!/usr/bin/php + + + + + +
+ +
+ +