From 970c3090cfd6f1f60494b9b61c3f4f4b23418fbb Mon Sep 17 00:00:00 2001 From: seek3r Date: Fri, 12 Jan 2001 04:07:40 +0000 Subject: [PATCH] cleaned up problems with utilities classes --- calendar/edit_entry.php | 4 +- ...er.inc.php => class.clientsniffer.inc.php} | 0 ...lities_http.inc.php => class.http.inc.php} | 0 phpgwapi/inc/class.linkbox.inc.php | 74 +++++++ ...xview.inc.php => class.matrixview.inc.php} | 0 ...enutree.inc.php => class.menutree.inc.php} | 0 phpgwapi/inc/class.portalbox.inc.php | 66 ++++++ phpgwapi/inc/class.resultbox.inc.php | 49 +++++ ...ssparse.inc.php => class.rssparse.inc.php} | 0 phpgwapi/inc/class.utilities.inc.php | 1 + .../inc/class.utilities_portalbox.inc.php | 155 ------------- phpgwapi/inc/class.utilities_sbox.inc.php | 208 ------------------ phpgwapi/inc/functions.inc.php | 11 +- 13 files changed, 199 insertions(+), 369 deletions(-) rename phpgwapi/inc/{class.utilities_clientsniffer.inc.php => class.clientsniffer.inc.php} (100%) rename phpgwapi/inc/{class.utilities_http.inc.php => class.http.inc.php} (100%) create mode 100644 phpgwapi/inc/class.linkbox.inc.php rename phpgwapi/inc/{class.utilities_matrixview.inc.php => class.matrixview.inc.php} (100%) rename phpgwapi/inc/{class.utilities_menutree.inc.php => class.menutree.inc.php} (100%) create mode 100755 phpgwapi/inc/class.portalbox.inc.php create mode 100644 phpgwapi/inc/class.resultbox.inc.php rename phpgwapi/inc/{class.utilities_rssparse.inc.php => class.rssparse.inc.php} (100%) delete mode 100755 phpgwapi/inc/class.utilities_portalbox.inc.php delete mode 100644 phpgwapi/inc/class.utilities_sbox.inc.php diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index ad64130ecb..7e5a763337 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -16,8 +16,8 @@ $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); include("../header.inc.php"); - include($phpgw_info["server"]["api_inc"] . "/phpgw_utilities_sbox.inc.php"); - $sb = new sbox; + + $sb = CreateObject("phpgwapi.sbox"); $cal_info = new calendar_item; diff --git a/phpgwapi/inc/class.utilities_clientsniffer.inc.php b/phpgwapi/inc/class.clientsniffer.inc.php similarity index 100% rename from phpgwapi/inc/class.utilities_clientsniffer.inc.php rename to phpgwapi/inc/class.clientsniffer.inc.php diff --git a/phpgwapi/inc/class.utilities_http.inc.php b/phpgwapi/inc/class.http.inc.php similarity index 100% rename from phpgwapi/inc/class.utilities_http.inc.php rename to phpgwapi/inc/class.http.inc.php diff --git a/phpgwapi/inc/class.linkbox.inc.php b/phpgwapi/inc/class.linkbox.inc.php new file mode 100644 index 0000000000..376a37abea --- /dev/null +++ b/phpgwapi/inc/class.linkbox.inc.php @@ -0,0 +1,74 @@ +portalbox($title, $primary, $secondary, $tertiary); + $this->setvar("outerwidth",300); + $this->setvar("innerwidth",300); + $this->setvar("width",300); + } + /* + This is the only method within the class. Quite simply, as you can see + it draws the table(s), placing the required data in the appropriate place. + */ + function draw() { + global $phpgw, $phpgw_info; + + $p = new Template($phpgw->common->get_tpl_dir('home')); + $p->set_file(array('portal_main' => 'portal_main.tpl', + 'portal_linkbox_header' => 'portal_linkbox_header.tpl', + 'portal_linkbox' => 'portal_linkbox.tpl', + 'portal_linkbox_footer' => 'portal_linkbox_footer.tpl')); + $p->set_block('portal_main','portal_linkbox_header','portal_linkbox','portal_linkbox_footer'); + + $p->set_var('outer_border',$this->getvar('outerborderwidth')); + $p->set_var('outer_width',$this->getvar('width')); + $p->set_var('outer_bordercolor',$this->getvar('outerbordercolor')); + $p->set_var('outer_bgcolor',$this->getvar('titlebgcolor')); + $p->set_var('title',$this->getvar('title')); + $p->set_var('inner_width',$this->getvar('width')); + $p->set_var('inner_bgcolor',$this->getvar('innerbgcolor')); + $p->set_var('header_background_image',$this->getvar('header_background_image')); + $p->parse('output','portal_linkbox_header',True); + + for ($x = 0; $x < count($this->data); $x++) { + $p->set_var('link',$this->data[$x][1]); + $p->set_var('text',$this->data[$x][0]); + $p->parse('output','portal_linkbox',True); + } + $p->parse('output','portal_linkbox_footer',True); + return $p->parse('out','portal_main'); + } +} diff --git a/phpgwapi/inc/class.utilities_matrixview.inc.php b/phpgwapi/inc/class.matrixview.inc.php similarity index 100% rename from phpgwapi/inc/class.utilities_matrixview.inc.php rename to phpgwapi/inc/class.matrixview.inc.php diff --git a/phpgwapi/inc/class.utilities_menutree.inc.php b/phpgwapi/inc/class.menutree.inc.php similarity index 100% rename from phpgwapi/inc/class.utilities_menutree.inc.php rename to phpgwapi/inc/class.menutree.inc.php diff --git a/phpgwapi/inc/class.portalbox.inc.php b/phpgwapi/inc/class.portalbox.inc.php new file mode 100755 index 0000000000..96603a8312 --- /dev/null +++ b/phpgwapi/inc/class.portalbox.inc.php @@ -0,0 +1,66 @@ +$var = $value; + // echo $var." = ".$this->$var."
\n"; + } + + function getvar($var="") { + if ($var=="" || !isset($this->$var)) { + global $phpgw; + echo 'Programming Error: '.$this->classname().'->getvar('.$var.')!
\n'; + $phpgw->common->phpgw_exit(); + } + //echo "Var = ".$var."
\n"; + //echo $var." = ".$this->$var."
\n"; + return $this->$var; + } + + /* + This is the constructor for the object. + */ + function portalbox($title="", $primary="", $secondary="", $tertiary="") { + $this->setvar("title",$title); + // echo "After SetVar Title = ".$this->getvar("title")."
\n"; + $this->setvar("outerborderwidth",1); + $this->setvar("titlebgcolor",$primary); + $this->setvar("innerbgcolor",$secondary); + $this->setvar("outerbordercolor",$tertiary); + } + // Methods + } diff --git a/phpgwapi/inc/class.resultbox.inc.php b/phpgwapi/inc/class.resultbox.inc.php new file mode 100644 index 0000000000..373cad0c01 --- /dev/null +++ b/phpgwapi/inc/class.resultbox.inc.php @@ -0,0 +1,49 @@ +portalbox($title, $primary, $secondary, $tertiary); + $this->setvar("outerwidth",400); + $this->setvar("innerwidth",400); + } + /* + This is the only method within the class. Quite simply, as you can see + it draws the table(s), placing the required data in the appropriate place. + */ + function draw() { + echo ''; + echo ''; + echo ''; + echo '
'.$this->getvar("title").'
'; + echo ''; + for ($x = 0; $x < count($this->data); $x++) { + echo ''; + echo ''; + echo ''; + echo ''; + } + echo '
'.$this->data[$x][0].''.$this->data[$x][1].'
'; + echo '
'; + } +} diff --git a/phpgwapi/inc/class.utilities_rssparse.inc.php b/phpgwapi/inc/class.rssparse.inc.php similarity index 100% rename from phpgwapi/inc/class.utilities_rssparse.inc.php rename to phpgwapi/inc/class.rssparse.inc.php diff --git a/phpgwapi/inc/class.utilities.inc.php b/phpgwapi/inc/class.utilities.inc.php index 85ff80f774..a8caa0782f 100644 --- a/phpgwapi/inc/class.utilities.inc.php +++ b/phpgwapi/inc/class.utilities.inc.php @@ -36,6 +36,7 @@ $phpgw->matrixview = CreateObject("phpgwapi.matrixview"); $phpgw->menutree = CreateObject("phpgwapi.menutree"); $phpgw->sbox = CreateObject("phpgwapi.sbox"); + $phpgw->sbox = CreateObject("phpgwapi.portalbox"); } } ?> diff --git a/phpgwapi/inc/class.utilities_portalbox.inc.php b/phpgwapi/inc/class.utilities_portalbox.inc.php deleted file mode 100755 index 921ca0f11d..0000000000 --- a/phpgwapi/inc/class.utilities_portalbox.inc.php +++ /dev/null @@ -1,155 +0,0 @@ -$var = $value; -// echo $var." = ".$this->$var."
\n"; - } - - function getvar($var="") { - if ($var=="" || !isset($this->$var)) { - global $phpgw; - echo 'Programming Error: '.$this->classname().'->getvar('.$var.')!
\n'; - $phpgw->common->phpgw_exit(); - } -//echo "Var = ".$var."
\n"; -//echo $var." = ".$this->$var."
\n"; - return $this->$var; - } - - /* - This is the constructor for the object. - */ - function baseportalbox($title="", $primary="", $secondary="", $tertiary="") { - $this->setvar("title",$title); -// echo "After SetVar Title = ".$this->getvar("title")."
\n"; - $this->setvar("outerborderwidth",1); - $this->setvar("titlebgcolor",$primary); - $this->setvar("innerbgcolor",$secondary); - $this->setvar("outerbordercolor",$tertiary); - } - // Methods -} - -class linkbox extends baseportalbox { - /* - Set up the Object. You will notice, we have not reserved - memory space for variables. In this circumstance it is not necessary. - */ - - /* - This is the constructor for the linkbox. The only thing this does - is to call the constructor of the parent class. Why? Well, whilst - PHP manages a certain part of OO, one of the bits it falls down on - (at the moment) is constructors within sub-classes. So, to - be sure that the sub-class is instantiated with the constructor of - the parent class, I simply call the parent constructor. Of course, - if I then wanted to override any of the values, I could easily do so. - */ - function linkbox($title="", $primary="", $secondary="", $tertiary="") { - $this->baseportalbox($title, $primary, $secondary, $tertiary); - $this->setvar("outerwidth",300); - $this->setvar("innerwidth",300); - $this->setvar("width",300); - } - /* - This is the only method within the class. Quite simply, as you can see - it draws the table(s), placing the required data in the appropriate place. - */ - function draw() { - global $phpgw, $phpgw_info; - - $p = new Template($phpgw->common->get_tpl_dir('home')); - $p->set_file(array('portal_main' => 'portal_main.tpl', - 'portal_linkbox_header' => 'portal_linkbox_header.tpl', - 'portal_linkbox' => 'portal_linkbox.tpl', - 'portal_linkbox_footer' => 'portal_linkbox_footer.tpl')); - $p->set_block('portal_main','portal_linkbox_header','portal_linkbox','portal_linkbox_footer'); - - $p->set_var('outer_border',$this->getvar('outerborderwidth')); - $p->set_var('outer_width',$this->getvar('width')); - $p->set_var('outer_bordercolor',$this->getvar('outerbordercolor')); - $p->set_var('outer_bgcolor',$this->getvar('titlebgcolor')); - $p->set_var('title',$this->getvar('title')); - $p->set_var('inner_width',$this->getvar('width')); - $p->set_var('inner_bgcolor',$this->getvar('innerbgcolor')); - $p->set_var('header_background_image',$this->getvar('header_background_image')); - $p->parse('output','portal_linkbox_header',True); - - for ($x = 0; $x < count($this->data); $x++) { - $p->set_var('link',$this->data[$x][1]); - $p->set_var('text',$this->data[$x][0]); - $p->parse('output','portal_linkbox',True); - } - $p->parse('output','portal_linkbox_footer',True); - return $p->parse('out','portal_main'); - } -} - -class resultbox extends baseportalbox { - /* - Set up the Object. You will notice, we have not reserved memory - space for variables. In this circumstance it is not necessary. - */ - - //constructor - function resultbox($title="", $primary="", $secondary="", $tertiary="") { - $this->baseportalbox($title, $primary, $secondary, $tertiary); - $this->setvar("outerwidth",400); - $this->setvar("innerwidth",400); - } - /* - This is the only method within the class. Quite simply, as you can see - it draws the table(s), placing the required data in the appropriate place. - */ - function draw() { - echo ''; - echo ''; - echo ''; - echo '
'.$this->getvar("title").'
'; - echo ''; - for ($x = 0; $x < count($this->data); $x++) { - echo ''; - echo ''; - echo ''; - echo ''; - } - echo '
'.$this->data[$x][0].''.$this->data[$x][1].'
'; - echo '
'; - } -} -?> diff --git a/phpgwapi/inc/class.utilities_sbox.inc.php b/phpgwapi/inc/class.utilities_sbox.inc.php deleted file mode 100644 index 1ccd431381..0000000000 --- a/phpgwapi/inc/class.utilities_sbox.inc.php +++ /dev/null @@ -1,208 +0,0 @@ -'; - $t_s[$selected] = " selected"; - for ($i=0; $i<24; $i++) { - $s .= ''; - $s .= "\n"; - } - $s .= ""; - return $s; - } - - function hour_text($name, $selected = 0) - { - global $phpgw; - - $s = '"; - return $s; - } - - // I would like to add a increment feature - function sec_minute_text($name, $selected = 0) - { - $s = '"; - return $s; - } - - function ap_text($name,$selected) - { - $selected = strtolower($selected); - $t[$selected] = " selected"; - $s = '"; - return $s; - } - - function full_time($hour_name,$hour_selected,$min_name,$min_selected,$sec_name,$sec_selected,$ap_name,$ap_selected) - { - // This needs to be changed to support there time format preferences - $s = $this->hour_text($hour_name,$hour_selected) - . $this->sec_minute_text($min_name,$min_selected) - . $this->sec_minute_text($sec_name,$sec_selected) - . $this->ap_text($ap_name,$ap_selected); - return $s; - } - - function getMonthText($name, $selected=0) - { - $out = "\n"; - return $out; - } - - function getDays($name, $selected=0) - { - $out = "\n"; - - for(reset($arr);current($arr);next($arr)) - { - $out .= '