From: cajus Date: Thu, 15 Nov 2007 15:19:02 +0000 (+0000) Subject: Reorganization X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=47bef81f71e6488da599224b757d3f03cd40a499;p=gosa.git Reorganization git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7804 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_LdapAttributeFactory.inc b/include/class_LdapAttributeFactory.inc deleted file mode 100644 index 5db70014c..000000000 --- a/include/class_LdapAttributeFactory.inc +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/include/class_LdapManager.inc b/include/class_LdapManager.inc deleted file mode 100644 index 5db70014c..000000000 --- a/include/class_LdapManager.inc +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/include/class_LdapObject.inc b/include/class_LdapObject.inc deleted file mode 100644 index 5db70014c..000000000 --- a/include/class_LdapObject.inc +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/include/class_ObjectListEntryFilter_uppercase.inc b/include/class_ObjectListEntryFilter_uppercase.inc deleted file mode 100644 index b538dc912..000000000 --- a/include/class_ObjectListEntryFilter_uppercase.inc +++ /dev/null @@ -1,17 +0,0 @@ - - \version 1.00 - \date 2007/11/02 - - This class converts entries in lists to upper case. - */ -class ObjectListEntryFilter_uppercase implements ObjectListEntryFilter { - static public function filter($string) { - return strtoupper($string); - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/include/class_ObjectListViewport.inc b/include/class_ObjectListViewport.inc deleted file mode 100644 index 4bf3f5bc8..000000000 --- a/include/class_ObjectListViewport.inc +++ /dev/null @@ -1,279 +0,0 @@ - - \version 1.00 - \date 2007/11/02 - - This class handles the exceptions occuring in ObjectListViewport. - */ -class ObjectListViewportException extends Exception { - public function __construct($message, $code = 0) { - parent::__construct($message, $code); - } -} - - -/*! \brief Implementation for ObjectListViewport - \author Cajus Pollmeier - \version 1.00 - \date 2007/11/02 - - This class handles painting of ObjectList objects. - - \sa ObjectList - */ -class ObjectListViewport extends GOsaGuiElement { - - /* Internal variable for color alternation */ - private $colorAlternator= 0; - - protected $headline; - protected $footer; - protected $entryFormat; - - /* Dummy here ----> */ - private $attributes= array('cn', '_icon', '_actions', 'dn'); - /* <---- Dummy here */ - - protected $displayHeaderFlag= TRUE; - protected $displayFooterFlag= TRUE; - private $numberOfColumns= 0; - - /*! - \brief Container for objects - - This variable stores the ObjectList object to be displayed. - */ - protected $objects; - - /*! - \brief Switch to handle multiselect or not - */ - protected $multiselect; - - /*! \brief ObjectListViewport constructor - - The ObjectListViewport class renders/handles the ObjectList defined by $config. - - \param config Config section that is used to configure this ObjectListViewport - */ - public function __construct($config, $multiselect= TRUE, $displayHeader= TRUE, $displayFooter= FALSE){ - - /* Initialize from parents method */ - parent::__construct(); - - /* Transfer initialization values */ - $this->displayFooterFlag= $displayFooter; - $this->displayHeaderFlag= $displayHeader; - $this->multiselect= $multiselect; - - /* Load list configuration from ConfigManager */ - $cr= Registry::getInstance("ConfigManager"); - $cr->setSection($config); - $this->parseHeadline($cr->getValue("headline")); - $this->footer= $cr->getValue("footer"); - $this->entryFormat= $cr->getValue("entryFormat"); - - /* Load and instanciate classes, extract filter, icons, view hooks, etc. */ - $this->objects= new ObjectList($config); - } - - - /*! \brief Processes post events - - Processes all post events and acts as needed. - - \return bool for if changes are present or not - */ - protected function __process(){ - - /* FIXME: Dummy Action*/ - $this->objects->reload(); - - /* TODO: process input */ - return FALSE; - } - - - /*! \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){ - - /* Copy template */ - $buffer= $this->entryFormat; - - /* 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); - } - } - - /* Execute optional filters */ - preg_match_all ( '/\{_filter\(([^)]+)\)\}/', $buffer, $matches, PREG_SET_ORDER); - foreach ($matches as $match){ - $filterName= preg_replace('/,.+$/', '', $match[1]); - $filterParameter= preg_replace('/^[^,]+,/', '', $match[1]); - $buffer= preg_replace('/\{_filter\('.normalizePreg($match[1]).'\)\}/', - $this->applyEntryFilter($filterName, $filterParameter), - $buffer); - } - - #TODO: Make $buffer a proper HTML table output - $tmp = split("\|",trim($buffer,"|")); - $cols = array(); - - for($i= 0; $i < $this->numberOfColumns; $i++){ - - /* If current entry is the last to appen, then skip adding styles */ - if($i == ($this->numberOfColumns-1)){ - $cols[$i]['style1'] = $this->columnInformation[$i]['style']; - $cols[$i]['style2'] = "width:100%;overflow:hidden;"; - $cols[$i]['value'] = $tmp[$i]; - }else{ - $cols[$i]['style1'] = $this->columnInformation[$i]['style']; - $cols[$i]['style2'] = "width:100%;overflow:hidden;".$this->columnInformation[$i]['style']; - $cols[$i]['value'] = $tmp[$i]; - } - } - - /* Add class depending on given id, to alternate background colors */ - if($this->colorAlternator++ & 1){ - $data['row']['class'] = "ObjectListViewport_Entry_Row1"; - }else{ - $data['row']['class'] = "ObjectListViewport_Entry_Row2"; - } - - $data['cols'] = $cols; - return($data); - } - - - /*! \brief Applies filter to the given entry format string. - - Instanciates the given ObjectListEntryFilter and calls the method. - - \return rendered output - \sa ObjectListEntryFilter - */ - private function applyEntryFilter($filterName, $string){ - $className= "ObjectListEntryFilter_".$filterName; - $cl= new $className; - return $cl->filter("$string"); - } - - - /*! \brief Renders complete ObjectList into a string - - \return HTML rendered list - */ - protected function __render() { - - /* Apply current filter */ - $entries = ""; - $objects= new ObjectListFilterIterator($this->objects->getIterator()); - foreach ($objects as $key => $value){ - $entries[$key] = $this->renderEntry($value); - $this->createVariable("OLV_Entry_".$key); - } - - #Fabian: _POST/_GET Variablen bitte mit $this->createVariable('name'); - # erstellen. - # Damit kann das von der übergreifenden Funktion extrahiert werden - # und wir haben keinen doppelten Code dafür. - # - # Wurde z.B. eine Variable via $this->createVariable('cn') erzeugt und via - # smarty eingebunden, dann kann Sie nach einem _POST oder _GET via - # $this->getRequestVariable_cn() wieder abgefragt werden. - - $smarty = get_smarty(); - $smarty->assign("OLV_Entries",$entries); - $smarty->assign("OLV_List_Id",$this->id); - $smarty->assign("OLV_Multiselect_Enabled",$this->multiselect); - - /* Footer variables */ - $smarty->assign("OLV_Footer_Enabled",$this->displayFooterFlag); - $smarty->assign("OLV_Footer_Message",$this->footer); - $smarty->assign("OLV_Num_Cols",$this->numberOfColumns); - - /* Assign Headline values */ - $smarty->assign("OLV_Header_Enabled",$this->displayHeaderFlag); - $smarty->assign("OLV_Header",$this->columnInformation); - - return($smarty->fetch("ObjectListViewport.tpl")); - } - - - /*! \brief Parses the given headline format string - - \return Array with cell properties (width, alignment,name) - */ - private function parseHeadline($data) - { - /* Each cell definition is seperated by | - * split by and go through each definition - */ - $this->columnInformation= array(); - $this->numberOfColumns= 0; - $tmp= split("\|", trim($data, "|")); - $cell_formats= array(); - - foreach($tmp as $key => $dta){ - - $width= ""; - $alignment= ""; - $name= preg_replace("/\{[^\}]*+\}/", "", $dta); - $style= ""; - - /* Parse format string and detect width & alignment */ - if(preg_match("/\{.*\}/", $dta)){ - $format= preg_replace("/^[^\{]*+\{([^\}]*).*$/", "\\1", $dta); - - /* Get aligment */ - if(preg_match("/:/",$format)){ - $al= preg_replace("/^[^:]*+:([a-z]*).*$/i", "\\1", $format); - - if(preg_match("/T/i", $al)){ - $alignment.= "top-"; - $style.= "vertical-align: top;"; - } - - if(preg_match("/B/i", $al)){ - $alignment.= "bottom-"; - $style.= "vertical-align: bottom;"; - } - - if(preg_match("/R/i", $al)){ - $alignment.= "right"; - $style.= "text-align: right;"; - }elseif(preg_match("/L/i", $al)){ - $alignment.= "left"; - $style.= "text-align: left;"; - }elseif(preg_match("/C/i", $al) || preg_match("/M/i", $al) ){ - $alignment.= "center"; - $style.= "text-align: center;"; - } - } - - /* Get width */ - $width = preg_replace("/^([^:]*).*$/","\\1", $format); - if(!empty($width)){ - $style.= "width: ".$width.";"; - } - } - - $cell_formats[$key]= array("name" => $name, "width" => $width, "alignment" => $alignment, "style" => $style); - $this->numberOfColumns++; - } - $this->columnInformation= $cell_formats; - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/include/class_Utils.inc b/include/class_Utils.inc deleted file mode 100644 index 94f71bc64..000000000 --- a/include/class_Utils.inc +++ /dev/null @@ -1,28 +0,0 @@ - "de_DE.UTF-8", - "French" => "fr_FR.UTF-8", - ); - } - -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/include/components/GUIObjectList/class_ObjectListEntryFilter_uppercase.inc b/include/components/GUIObjectList/class_ObjectListEntryFilter_uppercase.inc new file mode 100644 index 000000000..b538dc912 --- /dev/null +++ b/include/components/GUIObjectList/class_ObjectListEntryFilter_uppercase.inc @@ -0,0 +1,17 @@ + + \version 1.00 + \date 2007/11/02 + + This class converts entries in lists to upper case. + */ +class ObjectListEntryFilter_uppercase implements ObjectListEntryFilter { + static public function filter($string) { + return strtoupper($string); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/include/components/GUIObjectList/class_ObjectListViewport.inc b/include/components/GUIObjectList/class_ObjectListViewport.inc new file mode 100644 index 000000000..4bf3f5bc8 --- /dev/null +++ b/include/components/GUIObjectList/class_ObjectListViewport.inc @@ -0,0 +1,279 @@ + + \version 1.00 + \date 2007/11/02 + + This class handles the exceptions occuring in ObjectListViewport. + */ +class ObjectListViewportException extends Exception { + public function __construct($message, $code = 0) { + parent::__construct($message, $code); + } +} + + +/*! \brief Implementation for ObjectListViewport + \author Cajus Pollmeier + \version 1.00 + \date 2007/11/02 + + This class handles painting of ObjectList objects. + + \sa ObjectList + */ +class ObjectListViewport extends GOsaGuiElement { + + /* Internal variable for color alternation */ + private $colorAlternator= 0; + + protected $headline; + protected $footer; + protected $entryFormat; + + /* Dummy here ----> */ + private $attributes= array('cn', '_icon', '_actions', 'dn'); + /* <---- Dummy here */ + + protected $displayHeaderFlag= TRUE; + protected $displayFooterFlag= TRUE; + private $numberOfColumns= 0; + + /*! + \brief Container for objects + + This variable stores the ObjectList object to be displayed. + */ + protected $objects; + + /*! + \brief Switch to handle multiselect or not + */ + protected $multiselect; + + /*! \brief ObjectListViewport constructor + + The ObjectListViewport class renders/handles the ObjectList defined by $config. + + \param config Config section that is used to configure this ObjectListViewport + */ + public function __construct($config, $multiselect= TRUE, $displayHeader= TRUE, $displayFooter= FALSE){ + + /* Initialize from parents method */ + parent::__construct(); + + /* Transfer initialization values */ + $this->displayFooterFlag= $displayFooter; + $this->displayHeaderFlag= $displayHeader; + $this->multiselect= $multiselect; + + /* Load list configuration from ConfigManager */ + $cr= Registry::getInstance("ConfigManager"); + $cr->setSection($config); + $this->parseHeadline($cr->getValue("headline")); + $this->footer= $cr->getValue("footer"); + $this->entryFormat= $cr->getValue("entryFormat"); + + /* Load and instanciate classes, extract filter, icons, view hooks, etc. */ + $this->objects= new ObjectList($config); + } + + + /*! \brief Processes post events + + Processes all post events and acts as needed. + + \return bool for if changes are present or not + */ + protected function __process(){ + + /* FIXME: Dummy Action*/ + $this->objects->reload(); + + /* TODO: process input */ + return FALSE; + } + + + /*! \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){ + + /* Copy template */ + $buffer= $this->entryFormat; + + /* 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); + } + } + + /* Execute optional filters */ + preg_match_all ( '/\{_filter\(([^)]+)\)\}/', $buffer, $matches, PREG_SET_ORDER); + foreach ($matches as $match){ + $filterName= preg_replace('/,.+$/', '', $match[1]); + $filterParameter= preg_replace('/^[^,]+,/', '', $match[1]); + $buffer= preg_replace('/\{_filter\('.normalizePreg($match[1]).'\)\}/', + $this->applyEntryFilter($filterName, $filterParameter), + $buffer); + } + + #TODO: Make $buffer a proper HTML table output + $tmp = split("\|",trim($buffer,"|")); + $cols = array(); + + for($i= 0; $i < $this->numberOfColumns; $i++){ + + /* If current entry is the last to appen, then skip adding styles */ + if($i == ($this->numberOfColumns-1)){ + $cols[$i]['style1'] = $this->columnInformation[$i]['style']; + $cols[$i]['style2'] = "width:100%;overflow:hidden;"; + $cols[$i]['value'] = $tmp[$i]; + }else{ + $cols[$i]['style1'] = $this->columnInformation[$i]['style']; + $cols[$i]['style2'] = "width:100%;overflow:hidden;".$this->columnInformation[$i]['style']; + $cols[$i]['value'] = $tmp[$i]; + } + } + + /* Add class depending on given id, to alternate background colors */ + if($this->colorAlternator++ & 1){ + $data['row']['class'] = "ObjectListViewport_Entry_Row1"; + }else{ + $data['row']['class'] = "ObjectListViewport_Entry_Row2"; + } + + $data['cols'] = $cols; + return($data); + } + + + /*! \brief Applies filter to the given entry format string. + + Instanciates the given ObjectListEntryFilter and calls the method. + + \return rendered output + \sa ObjectListEntryFilter + */ + private function applyEntryFilter($filterName, $string){ + $className= "ObjectListEntryFilter_".$filterName; + $cl= new $className; + return $cl->filter("$string"); + } + + + /*! \brief Renders complete ObjectList into a string + + \return HTML rendered list + */ + protected function __render() { + + /* Apply current filter */ + $entries = ""; + $objects= new ObjectListFilterIterator($this->objects->getIterator()); + foreach ($objects as $key => $value){ + $entries[$key] = $this->renderEntry($value); + $this->createVariable("OLV_Entry_".$key); + } + + #Fabian: _POST/_GET Variablen bitte mit $this->createVariable('name'); + # erstellen. + # Damit kann das von der übergreifenden Funktion extrahiert werden + # und wir haben keinen doppelten Code dafür. + # + # Wurde z.B. eine Variable via $this->createVariable('cn') erzeugt und via + # smarty eingebunden, dann kann Sie nach einem _POST oder _GET via + # $this->getRequestVariable_cn() wieder abgefragt werden. + + $smarty = get_smarty(); + $smarty->assign("OLV_Entries",$entries); + $smarty->assign("OLV_List_Id",$this->id); + $smarty->assign("OLV_Multiselect_Enabled",$this->multiselect); + + /* Footer variables */ + $smarty->assign("OLV_Footer_Enabled",$this->displayFooterFlag); + $smarty->assign("OLV_Footer_Message",$this->footer); + $smarty->assign("OLV_Num_Cols",$this->numberOfColumns); + + /* Assign Headline values */ + $smarty->assign("OLV_Header_Enabled",$this->displayHeaderFlag); + $smarty->assign("OLV_Header",$this->columnInformation); + + return($smarty->fetch("ObjectListViewport.tpl")); + } + + + /*! \brief Parses the given headline format string + + \return Array with cell properties (width, alignment,name) + */ + private function parseHeadline($data) + { + /* Each cell definition is seperated by | + * split by and go through each definition + */ + $this->columnInformation= array(); + $this->numberOfColumns= 0; + $tmp= split("\|", trim($data, "|")); + $cell_formats= array(); + + foreach($tmp as $key => $dta){ + + $width= ""; + $alignment= ""; + $name= preg_replace("/\{[^\}]*+\}/", "", $dta); + $style= ""; + + /* Parse format string and detect width & alignment */ + if(preg_match("/\{.*\}/", $dta)){ + $format= preg_replace("/^[^\{]*+\{([^\}]*).*$/", "\\1", $dta); + + /* Get aligment */ + if(preg_match("/:/",$format)){ + $al= preg_replace("/^[^:]*+:([a-z]*).*$/i", "\\1", $format); + + if(preg_match("/T/i", $al)){ + $alignment.= "top-"; + $style.= "vertical-align: top;"; + } + + if(preg_match("/B/i", $al)){ + $alignment.= "bottom-"; + $style.= "vertical-align: bottom;"; + } + + if(preg_match("/R/i", $al)){ + $alignment.= "right"; + $style.= "text-align: right;"; + }elseif(preg_match("/L/i", $al)){ + $alignment.= "left"; + $style.= "text-align: left;"; + }elseif(preg_match("/C/i", $al) || preg_match("/M/i", $al) ){ + $alignment.= "center"; + $style.= "text-align: center;"; + } + } + + /* Get width */ + $width = preg_replace("/^([^:]*).*$/","\\1", $format); + if(!empty($width)){ + $style.= "width: ".$width.";"; + } + } + + $cell_formats[$key]= array("name" => $name, "width" => $width, "alignment" => $alignment, "style" => $style); + $this->numberOfColumns++; + } + $this->columnInformation= $cell_formats; + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/include/components/GUIObjectList/interface_ObjectListEntryFilter.inc b/include/components/GUIObjectList/interface_ObjectListEntryFilter.inc new file mode 100644 index 000000000..218814250 --- /dev/null +++ b/include/components/GUIObjectList/interface_ObjectListEntryFilter.inc @@ -0,0 +1,16 @@ + + \version 1.00 + \date 2007/11/02 + + This interface describes what we need to filter a string + for use with list objects. + */ +interface ObjectListEntryFilter { + static public function filter($string); +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/include/interface_ObjectListEntryFilter.inc b/include/interface_ObjectListEntryFilter.inc deleted file mode 100644 index 218814250..000000000 --- a/include/interface_ObjectListEntryFilter.inc +++ /dev/null @@ -1,16 +0,0 @@ - - \version 1.00 - \date 2007/11/02 - - This interface describes what we need to filter a string - for use with list objects. - */ -interface ObjectListEntryFilter { - static public function filter($string); -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/include/ldap/class_LdapAttributeFactory.inc b/include/ldap/class_LdapAttributeFactory.inc new file mode 100644 index 000000000..5db70014c --- /dev/null +++ b/include/ldap/class_LdapAttributeFactory.inc @@ -0,0 +1,3 @@ + diff --git a/include/ldap/class_LdapManager.inc b/include/ldap/class_LdapManager.inc new file mode 100644 index 000000000..5db70014c --- /dev/null +++ b/include/ldap/class_LdapManager.inc @@ -0,0 +1,3 @@ + diff --git a/include/ldap/class_LdapObject.inc b/include/ldap/class_LdapObject.inc new file mode 100644 index 000000000..5db70014c --- /dev/null +++ b/include/ldap/class_LdapObject.inc @@ -0,0 +1,3 @@ + diff --git a/include/utils/class_Utils.inc b/include/utils/class_Utils.inc new file mode 100644 index 000000000..94f71bc64 --- /dev/null +++ b/include/utils/class_Utils.inc @@ -0,0 +1,28 @@ + "de_DE.UTF-8", + "French" => "fr_FR.UTF-8", + ); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>