summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b667dac)
raw | patch | inline | side by side (parent: b667dac)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 12 Nov 2007 17:55:17 +0000 (17:55 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 12 Nov 2007 17:55:17 +0000 (17:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7782 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_GOsaGuiElement.inc | patch | blob | history | |
include/class_ObjectListViewport.inc | patch | blob | history |
index d8284f2c6847ca41536f543b6ba950f334263f76..6959bc4f3e02b4f9ff4e75909cb34f9392e4751c 100644 (file)
<?php
-/**
+/*! \brief GOsaGuiElement base class
+ \author Cajus Pollmeier <pollmeier@gonicus.de>
+ \version 1.00
+ \date 2007/11/12
+
+ This abstract base class defines a GOsaGuiElement.
*/
abstract class GOsaGuiElement implements GOsaGuiElementInteraction {
- protected $errorMessage= "asdf";
+ protected $errorMessage= "";
+ protected $id;
+
+
+ public function __construct() {
+ /* Generate an unique id */
+ $this->id= "G".uniqid()."_";
+ }
+
public function render() {
+ #TODO: Add "tooltip" for errorMessage
if ($this->errorMessage) {
return "<div class='GOsaGuiElementError'>\n".$this->__render()."</div>\n";
} else {
}
}
+
public function process() {
+ /* Return original processing results */
return $this->__process();
}
+
+ protected function createVariable($name) {
+ return ($this->id."_$name");
+ }
+
+
+ protected function __call($method, $parameters) {
+
+ #FIXME: hack should be done by RequestHandler, but it is not ready yet
+ if (preg_match('/^getRequestVariable_/', $method)){
+ $name= preg_replace('/^[^_]+_/', '', $method);
+
+ if (isset($_REQUEST[$this->id.$name])){
+ return strip_tags(rtrim($_REQUEST[$this->id.$name], "\0"));
+ } else {
+ return "";
+ }
+ }
+
+ throw new Exception(sprintf(_("Unknown method '%s' called for '%s'."), $method, get_class()));
+ }
+
+
abstract protected function __render();
abstract protected function __process();
index 91a0d3e40f2a399e5dc9fb15b4479e14e7d0cdf6..eb454a53f16c4f88d596d8a2286b4156a8b82e66 100644 (file)
protected $displayHeaderFlag= TRUE;
protected $displayFooterFlag= TRUE;
- protected $numberOfCols= 0;
+ private $numberOfCols= 0;
/*!
\brief Container for objects
*/
protected $multiselect;
- /*! \brief ID used to identify objects of same list */
- protected $id = "";
-
-
/*! \brief ObjectListViewport constructor
The ObjectListViewport class renders/handles the ObjectList defined by $config.
*/
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;
/* Load and instanciate classes, extract filter, icons, view hooks, etc. */
$this->objects= new ObjectList($config);
-
- /* generate an unique id */
- $this->id= uniqid();
- }
-
-
- /*! \brief Handles _POST / _GET events
-
- Processes the list of registered plugins to do their eventHandler and adapt
- internal objectlist according to this.
- */
- public function eventHandler(){
- /* Reloads the list if things have changed interally */
- $this->objects->reload();
}
*/
protected function __process(){
+ /* FIXME: Dummy Action*/
+ $this->objects->reload();
+
/* TODO: process input */
return FALSE;
}
#}
- /* TODO: replace this -> not our task */
+ /* FIXME: replace this -> not our task */
private function getEntryIcon($entry,$alt = ""){
return("<img src='images/".$entry['_icon']."' alt='".$alt."' class='center'>");
}
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);
+ $buffer= preg_replace('/\{_filter\('.normalizePreg($match[1]).'\)\}/',
+ $this->applyEntryFilter($filterName, $filterParameter),
+ $buffer);
}
#TODO: Make $buffer a proper HTML table output
$tmp = split("\|",trim($buffer,"|"));
- /* define entry template */
+ /* Define entry template */
$tpl = "<td class='ObjectListViewport_Entry_Cell' style='{style_1}'>
<div style='{style_2}'>
{content}
$entries .= $this->renderEntry($value);
}
- $smarty = get_smarty();
- $smarty->assign("OLV_Entries",array("Doesn't work" => "Does not work."));//$objects);
- $smarty->assign("OLV_List_Id",$this->id);
-
- /* Footer variables */
- $smarty->assign("OLV_Footer_Enabled",$this->displayFooterFlag);
- $smarty->assign("OLV_Footer_Message",$this->footer);
- $smarty->assign("OLV_Num_Cols",$this->numberOfCols);
-
- /* Assign Headline values */
- $smarty->assign("OLV_Header_Enabled",$this->displayHeaderFlag);
- $smarty->assign("OLV_Header",$this->headline);
+ return "README ;-)\n";
+
+ #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",array("Doesn't work" => "Does not work."));//$objects);
+ #$smarty->assign("OLV_List_Id",$this->id);
+
+ #/* Footer variables */
+ #$smarty->assign("OLV_Footer_Enabled",$this->displayFooterFlag);
+ #$smarty->assign("OLV_Footer_Message",$this->footer);
+ #$smarty->assign("OLV_Num_Cols",$this->numberOfCols);
+
+ #/* Assign Headline values */
+ #$smarty->assign("OLV_Header_Enabled",$this->displayHeaderFlag);
+ #$smarty->assign("OLV_Header",$this->headline);
- return($smarty->fetch("ObjectListViewport.tpl"));
+ #return($smarty->fetch("ObjectListViewport.tpl"));
}
$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;";