From fbb8eee4ee5e7775f042ea8e1a3b56cb258fbccd Mon Sep 17 00:00:00 2001
From: Ralf Becker <ralfbecker@outdoor-training.de>
Date: Thu, 6 Jul 2006 22:51:45 +0000
Subject: [PATCH] removed not used sbox classes, use html-, country- or
 uiaccountsel-class instead

---
 phpgwapi/inc/class.sbox.inc.php  | 407 ---------------------
 phpgwapi/inc/class.sbox2.inc.php | 603 -------------------------------
 2 files changed, 1010 deletions(-)
 delete mode 100644 phpgwapi/inc/class.sbox.inc.php
 delete mode 100644 phpgwapi/inc/class.sbox2.inc.php

diff --git a/phpgwapi/inc/class.sbox.inc.php b/phpgwapi/inc/class.sbox.inc.php
deleted file mode 100644
index d125589ba9..0000000000
--- a/phpgwapi/inc/class.sbox.inc.php
+++ /dev/null
@@ -1,407 +0,0 @@
-<?php
-	/**************************************************************************\
-	* eGroupWare API - Select Box                                              *
-	* This file written by Marc Logemann <loge@phpgroupware.org>               *
-	* Class for creating predefines select boxes                               *
-	* Copyright (C) 2000, 2001 Dan Kuykendall                                  *
-	* -------------------------------------------------------------------------*
-	* This library is part of the eGroupWare API                               *
-	* ------------------------------------------------------------------------ *
-	* This library is free software; you can redistribute it and/or modify it  *
-	* under the terms of the GNU Lesser General Public License as published by *
-	* the Free Software Foundation; either version 2.1 of the License,         *
-	* or any later version.                                                    *
-	* This library is distributed in the hope that it will be useful, but      *
-	* WITHOUT ANY WARRANTY; without even the implied warranty of               *
-	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
-	* See the GNU Lesser General Public License for more details.              *
-	* You should have received a copy of the GNU Lesser General Public License *
-	* along with this library; if not, write to the Free Software Foundation,  *
-	* Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
-	\**************************************************************************/
-	/* $Id$ */
-
-	class sbox
-	{
-		var $monthnames = array(
-			'',
-			'January',
-			'February',
-			'March',
-			'April',
-			'May',
-			'June',
-			'July',
-			'August',
-			'September',
-			'October',
-			'November',
-			'December'
-		);
-
-		var $weekdays = array(
-			'',
-			'Monday',
-			'Tuesday',
-			'Wednesday',
-			'Thursday',
-			'Friday',
-			'Saturday',
-			'Sunday'
-		);
-
-		function sbox()
-		{
-			if (!$this->country_array)
-			{
-				$country = CreateObject('phpgwapi.country');
-				$this->country_array = &$country->country_array;
-				unset($country);
-				unset($this->country_array['  ']);
-				// try to translate them and sort alphabetic
-				foreach($this->country_array as $k => $name)
-				{
-					if (($translated = lang($name)) != $name.'*')
-					{
-						$this->country_array[$k] = $translated;
-					}
-				}
-				asort($this->country_array);
-			}
-		}
-
-		function hour_formated_text($name, $selected = 0)
-		{
-			$s = '<select name="' . $name . '">';
-			$t_s[$selected] = ' selected';
-
-			for ($i=0; $i<24; $i++)
-			{
-				$s .= '<option value="' . $i . '"' . $t_s[$i] . '>'
-					. $GLOBALS['phpgw']->common->formattime($i+1,"00") . '</option>' . "\n";
-			}
-			$s .= "</select>";
-
-			return $s;
-		}
-
-		function hour_text($name, $selected = 0)
-		{
-			$s = '<select name="' . $name . '">';
-			$t_s[$selected] = " selected";
-			for ($i=1; $i<13; $i++)
-			{
-				$s .= '<option value="' . $i . '"' . $t_s[$i] . '>'
-					. $i . '</option>';
-				$s .= "\n";
-			}
-			$s .= "</select>";
-
-			return $s;
-		}
-
-		// I would like to add a increment feature
-		function sec_minute_text($name, $selected = 0)
-		{
-			$s = '<select name="' . $name . '">';
-			$t_s[$selected] = " selected";
-
-			for ($i=0; $i<60; $i++)
-			{
-				$s .= '<option value="' . $i . '"' . $t_s[sprintf("%02d",$i)] . '>' . sprintf("%02d",$i) . '</option>';
-				$s .= "\n";
-			}
-			$s .= "</select>";
-			return $s;
-		}
-
-		function ap_text($name,$selected)
-		{
-			$selected = strtolower($selected);
-			$t[$selected] = " selected";
-			$s = '<select name="' . $name . '">'
-				. ' <option value="am"' . $t['am'] . '>am</option>'
-				. ' <option value="pm"' . $t['pm'] . '>pm</option>';
-			$s .= '</select>';
-			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 getWeekdays($name, $selected=0)
-		{
-			$out = '';
-			for($i=0;$i<count($this->weekdays);$i++)
-			{
-				$out .= '<option value="'.$i.'"'.($selected!=$i?'':' selected').'>'.($this->weekdays[$i]!=''?lang($this->weekdays[$i]):'').'</option>'."\n";
-			}
-			return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
-		}
-
-		function nr2weekday($selected = 0)
-		{
-			for($i=0;$i<count($this->weekdays);$i++)
-			{
-				if ($selected > 0 && $selected == $i)
-				{
-					return lang($this->weekdays[$i]);
-				}
-			}
-		}
-
-		function getMonthText($name, $selected=0)
-		{
-			$out = '';
-			$c_monthnames = count($this->monthnames);
-			for($i=0;$i<$c_monthnames;$i++)
-			{
-				$out .= '<option value="'.$i.'"'.($selected!=$i?'':' selected').'>'.($this->monthnames[$i]!=''?lang($this->monthnames[$i]):'').'</option>'."\n";
-			}
-			return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
-		}
-
-		function getDays($name, $selected=0)
-		{
-			$out = '';
-
-			for($i=0;$i<32;$i++)
-			{
-				$out .= '<option value="'.($i?$i:'').'"'.($selected!=$i?'':' selected').'>'.($i?$i:'').'</option>'."\n";
-			}
-			return '<select name="'.$name.'">'."\n".$out.'</select>'."\n";
-		}
-
-		function getYears($name, $selected = 0, $startYear = 0, $endyear = 0)
-		{
-			if (!$startYear)
-			{
-				$startYear = date('Y') - 5;
-			}
-			if ($selected && $startYear > $selected) $startYear = $selected;
-
-			if (!$endyear)
-			{
-				$endyear = date('Y') + 6;
-			}
-			if ($selected && $endYear < $selected) $endYear = $selected;
-
-			$out = '<select name="'.$name.'">'."\n";
-
-			$out .= '<option value=""';
-			if ($selected == 0 OR $selected == '')
-			{
-				$out .= ' SELECTED';
-			}
-			$out .= '></option>'."\n";
-
-			// We need to add some good error checking here.
-			for ($i=$startYear;$i<$endyear; $i++)
-			{
-				$out .= '<option value="'.$i.'"';
-				if ($selected==$i)
-				{
-					$out .= ' SELECTED';
-				}
-				$out .= '>'.$i.'</option>'."\n";
-			}
-			$out .= '</select>'."\n";
-
-			return $out;
-		}
-
-		function getPercentage($name, $selected=0)
-		{
-			$out = "<select name=\"$name\">\n";
-
-			for($i=0;$i<101;$i=$i+10)
-			{
-				$out .= "<option value=\"$i\"";
-				if($selected==$i)
-				{
-					$out .= " SELECTED";
-				}
-				$out .= ">$i%</option>\n";
-			}
-			$out .= "</select>\n";
-			// echo $out;
-			return $out;
-		}
-
-		function getPriority($name, $selected=2)
-		{
-			$arr = array('','low','normal','high');
-			$out = '<select name="' . $name . '">';
-
-			for($i=1;$i<count($arr);$i++)
-			{
-				$out .= "<option value=\"";
-				$out .= $i;
-				$out .= "\"";
-				if ($selected==$i)
-				{
-					$out .= ' SELECTED';
-				}
-				$out .= ">";
-				$out .= lang($arr[$i]);
-				$out .= "</option>\n";
-			}
-			$out .= "</select>\n";
-			return $out;
-		}
-
-		function getAccessList($name, $selected="private")
-		{
-			$arr = array(
-				"private" => "Private",
-				"public" => "Global public",
-				"group" => "Group public"
-			);
-
-			if (ereg(",", $selected))
-			{
-				$selected = "group";
-			}
-
-			$out = "<select name=\"$name\">\n";
-
-			for(reset($arr);current($arr);next($arr))
-			{
-				$out .= '<option value="' . key($arr) . '"';
-				if($selected==key($arr))
-				{
-					$out .= " SELECTED";
-				}
-				$out .= ">" . pos($arr) . "</option>\n";
-			}
-			$out .= "</select>\n";
-			return $out;
-		}
-
-		function getGroups($groups, $selected="", $name="n_groups[]")
-		{
-			$out = '<select name="' . $name . '" multiple>';
-			while (list($null,$group) = each($groups))
-			{
-				$out .= '<option value="' . $group['account_id'] . '"';
-				if(@is_array($selected))
-				{
-					for($i=0;$i<count($selected);$i++)
-					{
-						if ($group['account_id'] == $selected[$i])
-						{
-							$out .= " SELECTED";
-							break;
-						}
-					}
-				}
-				elseif (ereg("," . $group['account_id'] . ",", $selected))
-				{
-					$out .= " SELECTED";
-				}
-				$out .= ">" . $group['account_name'] . "</option>\n";
-			}
-			$out .= "</select>\n";
-
-			return $out;
-		}
-
-		function list_states($name, $selected = '')
-		{
-			$states = array(
-				''		=> lang('Select one'),
-				'--'	=> 'non US',
-				'AL'	=>	'Alabama',
-				'AK'	=>	'Alaska',
-				'AZ'	=>	'Arizona',
-				'AR'	=>	'Arkansas',
-				'CA'	=>	'California',
-				'CO'	=>	'Colorado',
-				'CT'	=>	'Connecticut',
-				'DE'	=>	'Delaware',
-				'DC'	=>	'District of Columbia',
-				'FL'	=>	'Florida',
-				'GA'	=>	'Georgia',
-				'HI'	=>	'Hawaii',
-				'ID'	=>	'Idaho',
-				'IL'	=>	'Illinois',
-				'IN'	=>	'Indiana',
-				'IA'	=>	'Iowa',
-				'KS'	=>	'Kansas',
-				'KY'	=>	'Kentucky',
-				'LA'	=>	'Louisiana',
-				'ME'	=>	'Maine',
-				'MD'	=>	'Maryland',
-				'MA'	=>	'Massachusetts',
-				'MI'	=>	'Michigan',
-				'MN'	=>	'Minnesota',
-				'MO'	=>	'Missouri',
-				'MS'	=>	'Mississippi',
-				'MT'	=>	'Montana',
-				'NC'	=>	'North Carolina',
-				'ND'	=>	'Noth Dakota',
-				'NE'	=>	'Nebraska',
-				'NH'	=>	'New Hampshire',
-				'NJ'	=>	'New Jersey',
-				'NM'	=>	'New Mexico',
-				'NV'	=>	'Nevada',
-				'NY'	=>	'New York',
-				'OH'	=>	'Ohio',
-				'OK'	=>	'Oklahoma',
-				'OR'	=>	'Oregon',
-				'PA'	=>	'Pennsylvania',
-				'RI'	=>	'Rhode Island',
-				'SC'	=>	'South Carolina',
-				'SD'	=>	'South Dakota',
-				'TN'	=>	'Tennessee',
-				'TX'	=>	'Texas',
-				'UT'	=>	'Utah',
-				'VA'	=>	'Virginia',
-				'VT'	=>	'Vermont',
-				'WA'	=>	'Washington',
-				'WI'	=>	'Wisconsin',
-				'WV'	=>	'West Virginia',
-				'WY'	=>	'Wyoming'
-			);
-
-			while (list($sn,$ln) = each($states))
-			{
-				$s .= '<option value="' . $sn . '"';
-				if ($selected == $sn)
-				{
-					$s .= ' selected';
-				}
-				$s .= '>' . $ln . '</option>';
-			}
-			return '<select name="' . $name . '">' . $s . '</select>';
-		}
-
-		function form_select($selected,$name='')
-		{
-			if($name=='')
-			{
-				$name = 'country';
-			}
-			$str = '<select name="'.$name.'">'."\n"
-				. ' <option value="  "'.($selected == '  '?' selected':'').'>'.lang('Select One').'</option>'."\n";
-			foreach($this->country_array as $key => $value)
-			{
-				$str .= ' <option value="'.$key.'"'.($selected == $key?' selected':'') . '>'.$value.'</option>'."\n";
-			}
-			$str .= '</select>'."\n";
-			return $str;
-		}
-
-		function get_full_name($selected)
-		{
-			return($this->country_array[$selected]);
-		}
-	}
-?>
diff --git a/phpgwapi/inc/class.sbox2.inc.php b/phpgwapi/inc/class.sbox2.inc.php
deleted file mode 100644
index 50b5c36873..0000000000
--- a/phpgwapi/inc/class.sbox2.inc.php
+++ /dev/null
@@ -1,603 +0,0 @@
-<?php
-  /**************************************************************************\
-  * eGroupWare API - Select Box 2                                            *
-  * Written by Ralf Becker <RalfBecker@outdoor-training.de>                  *
-  * Class for creating select boxes for addresse, projects, array items, ... *
-  * Copyright (C) 2000, 2001 Dan Kuykendall                                  *
-  * ------------------------------------------------------------------------ *
-  * This library is part of the eGroupWare API                               *
-  * http://www.egroupware.org/api                                            *
-  * ------------------------------------------------------------------------ *
-  * This library is free software; you can redistribute it and/or modify it  *
-  * under the terms of the GNU Lesser General Public License as published by *
-  * the Free Software Foundation; either version 2.1 of the License,         *
-  * or any later version.                                                    *
-  * This library is distributed in the hope that it will be useful, but      *
-  * WITHOUT ANY WARRANTY; without even the implied warranty of               *
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
-  * See the GNU Lesser General Public License for more details.              *
-  * You should have received a copy of the GNU Lesser General Public License *
-  * along with this library; if not, write to the Free Software Foundation,  *
-  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
-  \**************************************************************************/
-
-  /* $Id$ */
-
-	if(!isset($GLOBALS['egw_info']['flags']['included_classes']['sbox']))
-	{
-		include(EGW_API_INC . '/class.sbox.inc.php');
-		$GLOBALS['egw_info']['flags']['included_classes']['sbox'] = True;
-	}
-
-	class sbox2 extends sbox
-	{
-		/*
-		 * Function: search for an id of an db-entry, eg. an address
-		 * Parameter: $name   base name for all template-vars and of the submitted vars (not to conflict with other template-var-names !!!)
-		 *            $lang_name titel of the field
-		 *            $prompt  for the JavaScript prompt()
-		 *            $id_name  id of previosly selected entry
-		 *            $content  from id (eg. 'company: lastname, givenname' for address $id) if $id != 0, or
-		 *                      array with searchresult (id's as key), if array is empty if search was unsucsessful
-		 *            $multipe	present a multiple selectable box instead of one selector-button
-		 * Returns:  array with vars to set in temaplate, the vars are:
-		 *           {doSearchFkt}  Javascript Funktion, place somewhere in Template (before rest of the vars)
-		 *           {$name.'_title} button with titel $lang_name (if JS) or just $lang_name
-		 *           {$name}    content of $id if != 0, or lang('use Button to search for').$lang_name
-		 *           {$name.'_nojs}  searchfield + button if we have no JavaScript, else empty
-		 *
-		 * To use call $template->set_var(getIdSearch(...));
-		 * the template should look like {doSearchFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr>   (XXX is content of $name)
-		 * In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
-		 */
-
-		function sbox2()
-		{
-			$this->sbox();	// call constructor extended class
-		}
-
-		function getId($name,$lang_name,$prompt,$id_name,$content='',$note='',$multiple=False)
-		{
-			// echo "<p>getId('$name','$lang_name','$prompt',$id_name,'$content') =";
-			$ret['doSearchFkt'] =
-'<script language="JavaScript">'."\n".
-" function doSearch(field,ask) {\n".
-"  field.value = prompt(ask,'');\n".
-"  if (field.value != 'null') {\n".
-"   if (field.value.length == 0)\n".
-"    field.value = '%';\n".
-"   field.form.submit();\n".
-"  } else\n".
-"   field.value = ''\n".
-" }\n".
-'</script>';
-
-			$ret[$name.'_title'] = is_array($content) && count($content) ? $lang_name :
-'<script language="JavaScript">'."\n".
-" document.writeln('<input type=\"hidden\" name=\"query_$name\" value=\"\">');\n".
-" document.writeln('<input type=\"button\" onClick=\"doSearch(this.form.query_$name,\'$prompt\')\" value=\"$lang_name\">');\n".
-"</script>\n".
-"<noscript>\n".
-" $lang_name\n".
-"</noscript>";
-
-			if (is_array($content))
-			{
-				// result from search
-				if (!count($content))
-				{
-					// search was unsuccsessful
-					$ret[$name] = lang('no entries found, try again ...');
-				}
-				else
-				{
-					$ret[$name.'_OK'] = '';	// flag we have something so select
-					if ($multiple)
-					{
-						$ret[$name] = '<select name="id_'.$name.'[]" size=10 multiple>'."\n";
-					}
-					else
-					{
-						$ret[$name] = '<select name="id_'.$name.'">'."\n";
-					}
-					while (list($id,$text) = each($content))
-					{
-						$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['egw']->strip_html($text) . "\n";
-					}
-					$ret[$name] .= '<option value="0">'.lang('none')."\n";
-					$ret[$name] .= '</select>';
-				}
-			}
-			else
-			{
-				if ($id_name)
-				{
-					$ret[$name] = $content . "\n<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">";
-				}
-				else
-				{
-					$ret[$name] = "<span class=note>$note</span>";
-				}
-			}
-
-			$ret[$name.'_nojs'] =
-"<noscript>\n".
-" <input name=\"query_$name\" value=\"\" size=10> &nbsp;<input type=\"submit\" value=\"?\">\n".
-"</noscript>";
-
-			// print_r($ret);
-			return $ret;
-		}
-
-		function event2name($event)
-		{
-			if (!is_object($this->bocal))
-			{
-				$this->bocal = createobject('calendar.bocalendar');
-			}
-			if (!is_array($event) && (int)$event > 0)
-			{
-				$event = $this->bocal->read_entry($event);
-			}
-			if (!is_array($event))
-			{
-				return 'not an event !!!';
-			}
-			$name = $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
-			$name .= ' -- ' . $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
-			$name .= ': ' . $event['title'];
-
-			return $GLOBALS['egw']->strip_html($name);
-		}
-
-		/*
-		 * Function		Allows you to show and select an event from the calendar (works with and without javascript !!!)
-		 * Parameters	$name 		string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
-		 *					$id_name		id of the address for edit or 0 if none selected so far
-		 *					$query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
-		 *					$multipe	present a multiple selectable box instead of one selector-button
-		 * On Submit	$id_XXX		contains the selected event (if != 0)
-		 *					$query_XXX	search pattern if the search button is pressed by the user, or '' if regular submit
-		 * Returns		array with vars to set for the template, set with: $template->set_var(getEvent(...)); (see getId())
-		 *
-		 * Note			As query's for an event are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
-		 */
-		function getEvent($name,$id_name,$query_name,$title='',$multiple=False)
-		{
-			// echo "<p>getEvent('$name',$id_name,'$query_name','$title')</p>";
-
-			// fallback if calendar is not installed or not enabled for user
-			if (!file_exists(EGW_SERVER_ROOT.'/calendar') || !$GLOBALS['egw_info']['user']['apps']['calendar']['enabled'])
-			{
-				return array(
-					$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
-					$name.'_no_js' => '',
-					$name.'_title' => ''
-				);
-			}
-			if ($id_name || $query_name)
-			{
-				if (!is_object($this->bocal))
-				{
-					$this->bocal = createobject('calendar.bocalendar');
-				}
-				if ($query_name)
-				{
-					$event_ids = $this->bocal->search_keywords($query_name);
-					$content = array();
-					while ($event_ids && list($key,$id) = each($event_ids))
-					{
-						$content[$id] = $this->event2name($id);
-					}
-				}
-				else
-				{
-					$event = $this->bocal->read_entry($id_name);
-					if ($event && is_array($event))
-					{
-						$content = $this->event2name($event);
-					}
-				}
-			}
-			if (!$title)
-			{
-				$title = lang('Calendar');
-			}
-			return $this->getId($name,$title,lang('Pattern for Search in Calendar'),$id_name,$content,lang('use Button to search for Calendarevent'),$multiple);
-		}
-
-		function addr2name($addr)
-		{
-			$name = $addr['n_family'];
-			if ($addr['n_given'])
-			{
-				$name .= ', '.$addr['n_given'];
-			}
-			else
-			{
-				if ($addr['n_prefix'])
-				{
-					$name .= ', '.$addr['n_prefix'];
-				}
-			}
-			if ($addr['org_name'])
-			{
-				$name = $addr['org_name'].': '.$name;
-			}
-			return $GLOBALS['egw']->strip_html($name);
-		}
-
-		/*
-		 * Function		Allows you to show and select an address from the addressbook (works with and without javascript !!!)
-		 * Parameters	$name 		string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
-		 *					$id_name		id of the address for edit or 0 if none selected so far
-		 *					$query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
-		 *					$multipe	present a multiple selectable box instead of one selector-button
-		 * On Submit	$id_XXX		contains the selected address (if != 0)
-		 *					$query_XXX	search pattern if the search button is pressed by the user, or '' if regular submit
-		 * Returns		array with vars to set for the template, set with: $template->set_var(getAddress(...)); (see getId())
-		 *
-		 * Note			As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
-		 */
-		function getAddress($name,$id_name,$query_name,$title='',$multiple=False)
-		{
-			// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
-			if ($id_name || $query_name)
-			{
-				$contacts = createobject('phpgwapi.contacts');
-
-				if ($query_name)
-				{
-					$addrs = $contacts->read(0,0,'',$query_name,'','DESC','org_name,n_family,n_given');
-					$content = array();
-					while ($addrs && list($key,$addr) = each($addrs))
-					{
-						$content[$addr['id']] = $this->addr2name($addr);
-					}
-				}
-				else
-				{
-					list($addr) = $contacts->read_single_entry($id_name);
-					if (count($addr))
-					{
-						$content = $this->addr2name($addr);
-					}
-				}
-			}
-			if (!$title)
-			{
-				$title = lang('Addressbook');
-			}
-			return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content,lang('use Button to search for Address'),$multiple);
-		}
-
-		function addr2email($addr,$home='')
-		{
-			if (!is_array($addr))
-			{
-				$home = substr($addr,-1) == 'h';
-				$contacts = createobject('phpgwapi.contacts');
-				list($addr) = $contacts->read_single_entry((int)$addr);
-			}
-			if ($home)
-			{
-				$home = '_home';
-			}
-
-			if (!count($addr) || !$addr['email'.$home])
-			{
-				return False;
-			}
-
-			if ($addr['n_given'])
-			{
-				$name = $addr['n_given'];
-			}
-			else
-			{
-				if ($addr['n_prefix'])
-				{
-					$name = $addr['n_prefix'];
-				}
-			}
-			$name .= ($name ? ' ' : '') . $addr['n_family'];
-
-			return $name.' <'.$addr['email'.$home].'>';
-		}
-
-		function getEmail($name,$id_name,$query_name,$title='')
-		{
-			// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
-			if ($id_name || $query_name)
-			{
-				$contacts = createobject('phpgwapi.contacts');
-
-				if ($query_name)
-				{
-					$addrs = $contacts->read(0,0,'',$query_name,'','DESC','org_name,n_family,n_given');
-					$content = array();
-					while($addrs && list($key,$addr) = each($addrs))
-					{
-						if ($addr['email'])
-						{
-							$content[$addr['id']] = $this->addr2email($addr);
-						}
-						if ($addr['email_home'])
-						{
-							$content[$addr['id'].'h'] = $this->addr2email($addr,'_home');
-						}
-					}
-				}
-				else
-				{
-					$content = $this->addr2email($id_name);
-				}
-			}
-			if (!$title)
-			{
-				$title = lang('Addressbook');
-			}
-
-			return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content);
-		}
-
-		/*
-		 * Function		Allows you to show and select an project from the projects-app (works with and without javascript !!!)
-		 * Parameters	$name 		string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
-		 *					$id_name		id of the project for edit or 0 if none selected so far
-		 *					$query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
-		 * On Submit	$id_XXX		contains the selected address (if != 0)
-		 *					$query_XXX	search pattern if the search button is pressed by the user, or '' if regular submit
-		 * Returns		array with vars to set for the template, set with: $template->set_var(getProject(...)); (see getId())
-		 *
-		 * Note			As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
-		 */
-		function getProject($name,$id_name,$query_name,$title='')
-		{
-			// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
-
-			// fallback if projects is not installed or not enabled for user
-			if (!file_exists(EGW_SERVER_ROOT.'/projects') || !$GLOBALS['egw_info']['user']['apps']['projects']['enabled'])
-			{
-				return array(
-					$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
-					$name.'_no_js' => '',
-					$name.'_title' => ''
-				);
-			}
-			if ($id_name || $query_name)
-			{
-				$projects = createobject('projects.boprojects');
-				if (!is_object($projects))
-				{
-					return '';
-				}
-				if ($query_name)
-				{
-					$projs = $projects->list_projects(0,0,$query_name,'','','','',0,'mains','');
-					$content = array();
-					while ($projs && list($key,$proj) = each($projs))
-					{
-						$content[$proj['project_id']] = $proj['title'];
-					}
-				}
-				else
-				{
-					if ($proj = $projects->read_single_project($id_name))
-					{
-						$content = $proj['title'];
-						// $customer_id = $proj['customer'];
-					}
-				}
-			}
-			if (!$title)
-			{
-				$title = lang('Project');
-			}
-
-			return $this->getId($name,$title,lang('Pattern for Search in Projects'),$id_name,$content,lang('use Button to search for Project'));
-		}
-
-		/*
-		 * Function:		Allows to show and select one item from an array
-		 *	Parameters:		$name		string with name of the submitted var which holds the key of the selected item form array
-		 *						$key		key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
-		 *						$arr		array with items to select, eg. $arr = array ('y' => 'yes','n' => 'no','m' => 'maybe');
-		 *						$no_lang	if !$no_lang send items through lang()
-		 *						$options	additional options (e.g. 'multiple')
-		 * On submit		$XXX		is the key of the selected item (XXX is the content of $name)
-		 * Returns:			string to set for a template or to echo into html page
-		 */
-		function getArrayItem($name, $key, $arr=0,$no_lang=0,$options='',$multiple=0)
-		{
-			// should be in class common.sbox
-			if (!is_array($arr))
-			{
-				$arr = array('no','yes');
-			}
-			if (0+$multiple > 0)
-			{
-				$options .= ' MULTIPLE SIZE='.(0+$multiple);
-				if (substr($name,-2) != '[]')
-				{
-					$name .= '[]';
-				}
-			}
-			$out = "<select name=\"$name\" $options>\n";
-
-			if (is_array($key))
-			{
-				$key = implode(',',$key);
-			}
-			while (list($k,$text) = each($arr))
-			{
-				$out .= '<option value="'.$k.'"';
-				if($k == $key || strstr(",$key,",",$k,"))
-				{
-					$out .= " SELECTED";
-				}
-				$out .= ">" . ($no_lang || $text == '' ? $text : lang($text)) . "</option>\n";
-			}
-			$out .= "</select>\n";
-
-			return $out;
-		}
-
-		function getPercentage($name, $selected=0,$options='')
-		{
-			// reimplemented using getArrayItem
-			for ($i=0; $i <= 100; $i+=10)
-			{
-				$arr[$i] = "$i%";
-			}
-			return $this->getArrayItem($name,$selected,$arr,1,$options);
-		}
-
-		function getPriority($name, $selected=2,$options='')
-		{
-			// reimplemented using getArrayItem
-			$arr = array('','low','normal','high');
-
-			return $this->getArrayItem($name,$selected,$arr,0,$options);
-		}
-
-		function getAccessList($name,$selected='private',$options='')
-		{
-			// reimplemented using getArrayItem
-			$arr = array(
-				'private' => 'Private',
-				'public' => 'Global public',
-				'group' => 'Group public'
-			);
-
-			if (strstr($selected,','))
-			{
-				$selected = "group";
-			}
-
-			return $this->getArrayItem($name,$selected,$arr,0,$options);
-		}
-
-		function getCountry($name='country',$selected='  ',$options='')
-		{
-			// reimplemented using getArrayItem
-			return $this->getArrayItem($name,$selected,$this->country_array,0,$options);
-		}
-
-		function form_select($name='country',$selected='  ',$options='')
-		{
-			// reimplemented using getArrayItem (stupid name!!!)
-			return getCountry($name,$selected,$options);
-		}
-
-		function accountInfo($id,$account_data=0,$longnames=0,$show_type=0)
-		{
-			if (!$id)
-			{
-				return '&nbsp;';
-			}
-
-			if (!is_array($account_data))
-			{
-				$accounts = createobject('phpgwapi.accounts',$id);
-				$accounts->db = $GLOBALS['egw']->db;
-				$accounts->read_repository();
-				$account_data = $accounts->data;
-			}
-			$info = $show_type ? '('.$account_data['account_type'].') ' : '';
-
-			switch ($longnames)
-			{
-				case 2: $info .= '&lt;'.$account_data['account_lid'].'&gt; '; // fall-through
-				case 1: $info .= $account_data['account_firstname'].' '.$account_data['account_lastname']; break;
-				default: $info .= $account_data['account_lid']; break;
-			}
-			return $info;
-		}
-
-		/*
-		 * Function:		Allows to select one accountname
-		 *	Parameters:		$name		string with name of the submitted var, which holds the account_id or 0 after submit
-		 *						$id		account_id of already selected account
-		 *						$longnames -1=as user prefs, 0=account_lid 1=firstname lastname
-		 */
-		function getAccount($name,$id,$longnames=-1,$type='accounts',$multiple=0,$options='')
-		{
-			$accs = $GLOBALS['egw']->accounts->get_list($type);
-
-			if ($multiple < 0)
-			{
-				$aarr[] = lang('not assigned');
-			}
-			while ($a = current($accs))
-			{
-				$aarr[$a['account_id']] = $longnames == -1 ?
-					$GLOBALS['egw']->common->display_fullname($a['account_lid'],$a['account_firstname'],$a['account_lastname']) :
-					$this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
-
-				next($accs);
-			}
-			return $this->getArrayItem($name,$id,$aarr,1,$options,$multiple);
-		}
-
-		function getDate($n_year,$n_month,$n_day,$date,$options='')
-		{
-			if (is_array($date))
-			{
-				list($year,$month,$day) = $date;
-			}
-			elseif (!$date)
-			{
-				$day = $month = $year = 0;
-			}
-			else
-			{
-				$day = date('d',$date);
-				$month = date('m',$date);
-				$year = date('Y',$date);
-			}
-			return $GLOBALS['egw']->common->dateformatorder(
-				$this->getYears($n_year,$year),
-				$this->getMonthText($n_month,$month),
-				$this->getDays($n_day,$day)
-			);
-		}
-
-		function getCategory($name,$cat_id='',$notall=False,$jscript=True,$multiple=0,$options='')
-		{
-			if (!is_object($this->cat))
-			{
-				$this->cat = CreateObject('phpgwapi.categories');
-			}
-			if ($jscript)
-			{
-				$options .= ' onChange="this.form.submit();"';
-			}
-			if (0+$multiple > 0)
-			{
-				$options .= ' MULTIPLE SIZE='.(0+$multiple);
-				if (substr($name,-2) != '[]')
-				{
-					$name .= '[]';
-				}
-			}
-			/* Setup all and none first */
-			$cats_link  = "\n<SELECT NAME=\"$name\" $options>\n";
-
-			if (!$notall)
-			{
-				$cats_link .= '<option value=""';
-				if ($cat_id=='all')
-				{
-					$cats_link .= ' selected';
-				}
-				$cats_link .= '>'.lang("all")."</option>\n";
-			}
-
-			/* Get global and app-specific category listings */
-			$cats_link .= $this->cat->formatted_list('select','all',$cat_id,True);
-			$cats_link .= '</select>'."\n";
-
-			return $cats_link;
-		}
-	}