[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] addressbook/inc class.uiaddressbook_prefs.inc.php [Ve
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] addressbook/inc class.uiaddressbook_prefs.inc.php [Version-0_9_16-branch] |
Date: |
Wed, 14 Dec 2005 10:29:13 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: addressbook
Branch: Version-0_9_16-branch
Changes by: Dave Hall <address@hidden> 05/12/14 10:29:13
Modified files:
inc : class.uiaddressbook_prefs.inc.php
Log message:
make it so you can unselect the default cat, fix docs and formatting
and some general code cleanup
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/addressbook/inc/class.uiaddressbook_prefs.inc.php.diff?only_with_tag=Version-0_9_16-branch&tr1=1.1.2.5&tr2=1.1.2.6&r1=text&r2=text
Patches:
Index: addressbook/inc/class.uiaddressbook_prefs.inc.php
diff -u addressbook/inc/class.uiaddressbook_prefs.inc.php:1.1.2.5
addressbook/inc/class.uiaddressbook_prefs.inc.php:1.1.2.6
--- addressbook/inc/class.uiaddressbook_prefs.inc.php:1.1.2.5 Sat Nov 6
16:13:43 2004
+++ addressbook/inc/class.uiaddressbook_prefs.inc.php Wed Dec 14 10:29:12 2005
@@ -1,91 +1,123 @@
<?php
- /**************************************************************************\
- * phpGroupWare API - Commononly used functions *
- * This file written by Alex Borges <address@hidden> *
- * UI for addressbook preferences *
- * Copyright (C) 2003 Free Software Foundation *
- * -------------------------------------------------------------------------*
- * This library is part of the phpGroupWare Addressbook app *
- * http://www.phpgroupware.org/ *
- * ------------------------------------------------------------------------ *
- * This library is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU General Public License as published by *
- * the Free Software Foundation. *
- * 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 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 *
- \**************************************************************************/
-class uiaddressbook_prefs
-{
- var $prefs;
- var $template;
- //@param selected_fields
- //@discussion transient selected fields. Allways holds what the fields
- //that are found as selected in GET/POST vars, NOT the ones in session
data
- var $selected_fields;
- //@param cached_selected_fields
- //@discussion Selected fields that are in the session data
- var $cached_selected_fields;
- var $public_functions = array(
- 'index' => True,
- 'remove_me' => True,
- 'css' => true
- );
- /address@hidden remove_me
- @discussion transient field representing the false field to remove from
the
- table's column
- */
- var $remove_me;
- /*
- @param contacts
- @discussion Should be contacts but for now we are going to make a
uiaddressbook
- because its where the addressbook caches the com-types catalog
- */
- var $contacts;
- /*
- @param org_or_person
- @discussion A simple flag that determines if we are editing the
showable fields for
- orgs or persons.
- */
- var $org_or_person='Persons';
- var $map_tpl_to_real=array(
- 'select_columns_form_name'=> 'on_constructor',
- 'select_columns_form_action' => 'on_constructor',
- 'select_columns_selectbox_name' => 'var_dependant',
- 'select_columns_submit_value' => 'on_constructor',
- 'lang_select_cols' => 'on_constructor',
- 'lang_abprefs' => 'on_constructor',
- 'B_select_columns_form_options' => 'on_constructor',
- 'select_columns_comtypes_name' => 'var_dependant',
- 'B_select_columns_comtypes_options' => 'on_constructor',
- 'org_preferences_link' => 'on_constructor',
- 'person_preferences_link' => 'on_constructor',
- 'cat_options' => 'on_contructor',
- 'adm_pref_type' => 'user',
- 'hider_open' => '',
- 'hider_close' => ''
- );
- //@param fields_show_selectbox
- //@discussion fields to show in the selectbox
+
/**************************************************************************\
+ * phpGroupWare API - Commononly used functions
*
+ * This file written by Alex Borges <address@hidden>
*
+ * UI for addressbook preferences
*
+ * Copyright (C) 2003 Free Software Foundation
*
+ *
-------------------------------------------------------------------------*
+ * This library is part of the phpGroupWare Addressbook app
*
+ * http://www.phpgroupware.org/
*
+ *
------------------------------------------------------------------------ *
+ * This library is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
*
+ * the Free Software Foundation.
*
+ * 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 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
*
+
\**************************************************************************/
+ class uiaddressbook_prefs
+ {
+ /**
+ * @var object $bo addressbook preferences business object object
+ */
+ var $bo;
+
+ /**
+ * @var array $cached_selected_fields Selected fields that are
in the session data
+ */
+ var $cached_selected_fields;
+
+ /**
+ * @var object $contacts uiaddressbook object
+ * @internal Should be contacts but for now we are going to
make a uiaddressbook because its where the addressbook caches the com-types
catalog
+ */
+ var $contacts;
+
+ /**
+ * @var array $fields_show_selectbox fields to show in the
selectbox
+ */
var $fields_show_selectbox;
+
var $lang_fields;
- var $bo;
+
+ /**
+ * @var array $map_tpl_to_real no idea
+ * @internal TODO DOCUMENT ME!
+ */
+ var $map_tpl_to_real=array
+ (
+ 'select_columns_form_name' =>
'on_constructor',
+ 'select_columns_form_action' =>
'on_constructor',
+ 'select_columns_selectbox_name' =>
'var_dependant',
+ 'select_columns_submit_value' =>
'on_constructor',
+ 'lang_select_cols' =>
'on_constructor',
+ 'lang_abprefs' =>
'on_constructor',
+ 'B_select_columns_form_options' =>
'on_constructor',
+ 'select_columns_comtypes_name' =>
'var_dependant',
+ 'B_select_columns_comtypes_options' =>
'on_constructor',
+ 'org_preferences_link' =>
'on_constructor',
+ 'person_preferences_link' =>
'on_constructor',
+ 'cat_options' =>
'on_contructor',
+ 'adm_pref_type' => 'user',
+ 'hider_open' => '',
+ 'hider_close' => ''
+ );
+
+ /**
+ * @var string $org_or_person simple flag that determines if we
are editing the showable fields for orgs or persons
+ */
+ var $org_or_person = 'Persons';
+
+ /**
+ * @var array $prefs the user's preferences
+ */
+ var $prefs;
+
+ /**
+ * @var array $public_functions the methods of the class which
are publicly available
+ */
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'remove_me' => True,
+ 'css' => true
+ );
+
+ /**
+ * @var array $remove_me transient field representing the false
field to remove from the table's column
+ */
+ var $remove_me;
+
+ /**
+ * @var array $selected_fields transient selected fields.
Always holds what the fields that are found as selected in GET/POST vars, NOT
the ones in session data
+ */
+ var $selected_fields;
+
+ /**
+ * @var string $submit the type of form submission
+ */
var $submit;
+
+ /**
+ * @var object $template reference to the global template object
+ */
+ var $template;
+
function uiaddressbook_prefs()
{
- $this->template = $GLOBALS['phpgw']->template;
+ $this->template = &$GLOBALS['phpgw']->template;
if(!$this->session_data_saved())
{
-
$this->map_tpl_to_real['lang_select_cols']=$GLOBALS['phpgw']->lang('Fields to
show in address list');
-
$this->map_tpl_to_real['lang_abprefs']=$GLOBALS['phpgw']->lang('addressbook
preferences');
-
$this->map_tpl_to_real['select_columns_submit_value']=$GLOBALS['phpgw']->lang('select
fields');
-
$this->map_tpl_to_real['submit_save_value']=$GLOBALS['phpgw']->lang('save');
-
$this->map_tpl_to_real['submit_cancel_value']=$GLOBALS['phpgw']->lang('cancel');
-
$this->map_tpl_to_real['submit_remove_value']=$GLOBALS['phpgw']->lang('remove');
+ $this->map_tpl_to_real['lang_select_cols']
= $GLOBALS['phpgw']->lang('Fields to show in address list');
+ $this->map_tpl_to_real['lang_abprefs']
= $GLOBALS['phpgw']->lang('addressbook preferences');
+
$this->map_tpl_to_real['select_columns_submit_value'] =
$GLOBALS['phpgw']->lang('select fields');
+ $this->map_tpl_to_real['submit_save_value']
= $GLOBALS['phpgw']->lang('save');
+ $this->map_tpl_to_real['submit_cancel_value']
= $GLOBALS['phpgw']->lang('cancel');
+ $this->map_tpl_to_real['submit_remove_value']
= $GLOBALS['phpgw']->lang('remove');
}
else
{
@@ -95,7 +127,7 @@
$this->bo=CreateObject('addressbook.boaddressbook_prefs');
if($this->is_current_admin())
{
-
$temp=get_var('adm_pref_type',array('get','post'));
+ $temp = $_REQUEST['adm_pref_type'];
//print "<br /><B>Admin user var
is".$temp."</B><br />";
//Changed preference type tav
if(isset($temp))
@@ -103,7 +135,7 @@
//Prefs type change, flush cache
if($temp !=
$this->map_tpl_to_real['adm_pref_type'])
{
-
+
//print "<br /><B>Flushing
cache</B><br />";
$this->clear_dinamic_data();
}
@@ -112,61 +144,69 @@
$this->build_admin_tabs();
}
$this->bo->read_preferences($this->map_tpl_to_real['adm_pref_type']);
- // print "<br /><B>current tab
is".$this->map_tpl_to_real['adm_pref_type']."</B><br />";
+ // print "<br /><B>current tab
is".$this->map_tpl_to_real['adm_pref_type']."</B><br />";
-
$this->map_tpl_to_real['org_preferences_link']=$GLOBALS['phpgw']->link('/index.php',
- array(
- 'menuaction' =>
'addressbook.uiaddressbook_prefs.index',
- 'org_or_person' =>
'Organizations',
- 'adm_pref_type' =>
$this->map_tpl_to_real['adm_pref_type']
- )
- );
-
-
$this->map_tpl_to_real['person_preferences_link']=$GLOBALS['phpgw']->link('/index.php',
- array(
- 'menuaction' =>
'addressbook.uiaddressbook_prefs.index',
- 'org_or_person' => 'Persons',
- 'adm_pref_type' =>
$this->map_tpl_to_real['adm_pref_type']
- )
-
);
+ $this->map_tpl_to_real['org_preferences_link'] =
$GLOBALS['phpgw']->link('/index.php',
+ array
+ (
+
'menuaction' => 'addressbook.uiaddressbook_prefs.index',
+
'org_or_person' => 'Organizations',
+
'adm_pref_type' => $this->map_tpl_to_real['adm_pref_type']
+ ));
+
+ $this->map_tpl_to_real['person_preferences_link'] =
$GLOBALS['phpgw']->link('/index.php',
+ array
+ (
+
'menuaction' => 'addressbook.uiaddressbook_prefs.index',
+
'org_or_person' => 'Persons',
+
'adm_pref_type' => $this->map_tpl_to_real['adm_pref_type']
+ ));
- /* print "<p><b>Preferences</b></p>";
- print_r($this->bo->person_columns);
- print "<p><b>Preferences</b></p>";
- print_r($this->bo->org_columns);
+ /*
+ print "<p><b>Person col Preferences</b></p>";
+ echo '<pre>' . print_r($this->bo->person_columns, true)
. '</pre>';
+ print "<p><b>Org col Preferences</b></p>";
+ echo '<pre>' . print_r($this->bo->org_columns, true) .
'</pre>';
+ echo "Def cat: {$this->bo->default_category}<br />\n";
*/
}
- //@function get_addressbook_cats
- //Gets the <option> tags of the categories of the addressbook,
also asks what return selected
- function get_addressbook_cats($selected=0)
- {
- $tmp=CreateObject('phpgwapi.categories');
- $tmp->app_name='addressbook';
+
+ /**
+ * Gets the <option> tags of the categories of the addressbook,
also asks what return selected
+ *
+ * @param int $selected currently selected option
+ * @return string the select <options>
+ */
+ function get_addressbook_cats($selected = 0)
+ {
+ //We have to jump thru these hoops cos the cats class
is broken - skwashd Dec-2005
+ $curapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'addressbook';
+ $cats = CreateObject('phpgwapi.categories');
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = $curapp;
+
+ $ret = '<option value="0">' . lang('none') .
"</option>\n";
//Forced category, can be an administrator not the
forced
//preferences tab
//print "<br /><B>Default category is
".$this->bo->default_category_forced."</B><br />";
- // print "<br /><B>Tab is
".$this->map_tpl_to_real['adm_pref_type']."</B><br />";
+ // print "<br /><B>Tab is
".$this->map_tpl_to_real['adm_pref_type']."</B><br />";
if($this->bo->default_category_forced &&
$this->map_tpl_to_real['adm_pref_type']!='forced')
{
- //print "<br /><B>FORCED cat</B><BR";
- $ret="<option value='"
- .$this->bo->default_category.
- "'>".
-
$tmp->id2name($this->bo->default_category)
- ."</option>";
+ //print "<br /><B>FORCED cat</B><BR";
+ $ret .= "<option
value=\"{$this->bo->default_category}\">"
+ .
$cats->id2name($this->bo->default_category)
+ . "</option>\n";
}
else
{
-
- $ret=
$tmp->formated_list('select','all',$selected,True);
-
+ $ret .= $cats->formated_list('select', 'all',
$selected, True);
}
- if($this->map_tpl_to_real['adm_pref_type']=="forced")
+ if($this->map_tpl_to_real['adm_pref_type'] == 'forced')
{
- $ret="<option value='user_default'>User
default</option>".$ret;
+ return '<option value="user_default">' .
lang('User default') . "</option>\n" . $ret;
}
return $ret;
}
@@ -183,7 +223,7 @@
{
if(!is_array($v))
{
-
+
$tmp[$v]=True;
}
else
@@ -207,54 +247,58 @@
return $tmp;
}
+
function get_vars()
{
- $temp=get_var('org_or_person',array('get','post'));
- if($temp=='Organizations' || $temp == 'Persons')
+ $temp = $_REQUEST['org_or_person'];
+ if ( $temp == 'Organizations' || $temp == 'Persons' )
{
- $this->org_or_person=$temp;
+ $this->org_or_person = $temp;
}
-
$this->map_tpl_to_real['select_columns_form_action']=$GLOBALS['phpgw']->link
- ('/index.php',
- array(
- 'menuaction' =>
"addressbook.uiaddressbook_prefs.columns_selected",
- 'org_or_person' =>
$this->org_or_person
- )
- );
-
-
$this->map_tpl_to_real['select_columns_selectbox_name']='selected_fields['.$this->org_or_person.'][]';
-
$this->map_tpl_to_real['select_columns_comtypes_name']='selected_fields['.$this->org_or_person.'][comm_types][]';
+ $this->map_tpl_to_real['select_columns_form_action'] =
$GLOBALS['phpgw']->link('/index.php',
+
array
+
(
+
'menuaction' => 'addressbook.uiaddressbook_prefs.columns_selected',
+
'org_or_person' => $this->org_or_person
+
));
+
+ $this->map_tpl_to_real['select_columns_selectbox_name']
= 'selected_fields['.$this->org_or_person.'][]';
+ $this->map_tpl_to_real['select_columns_comtypes_name']
= 'selected_fields['.$this->org_or_person.'][comm_types][]';
+
+ $this->selected_fields = $_REQUEST['selected_fields'];
-
$this->selected_fields=get_var('selected_fields',array('post','GET'));
/*
print "<p><b>Selected fields</b></p>";
- print_r($this->selected_fields);*/
+ print_r($this->selected_fields);
+ */
+
if(is_array($this->selected_fields[$this->org_or_person]))
{
- /* print "<p><b>There are
".count($this->selected_fields[$this->org_or_person])." selected</b></p>"; */
-
$this->selected_fields[$this->org_or_person]=$this->hashify($this->selected_fields[$this->org_or_person],array('comm_types'));
+ /* print "<p><b>There are
".count($this->selected_fields[$this->org_or_person])." selected</b></p>"; */
+ $this->selected_fields[$this->org_or_person] =
$this->hashify($this->selected_fields[$this->org_or_person],array('comm_types'));
}
+
//three kinds of submit
//They have hit the button to add selected fields
- if(get_var('select_fields',array('post','get')))
+ if ( isset($_REQUEST['select_fields']) &&
$_REQUEST['select_fields'] )
{
/* print '<br /><B>selectfields</B><br />'; */
- $temp='select_fields';
+ $temp = 'select_fields';
}
- elseif(get_var('save',array('post','get')))
+ elseif( isset($_REQUEST['save']) && $_REQUEST['save'] )
{
- $temp='save';
+ $temp = 'save';
}
- elseif(get_var('cancel',array('post','get')))
+ elseif( isset($_REQUEST['cancel']) &&
$_REQUEST['cancel'] )
{
- $temp='cancel';
+ $temp = 'cancel';
}
else
{
- $temp=get_var('remove_me',array('get','post'));
+ $temp = $_REQUEST['remove_me'];
/*print '<br /><B>remove type'.$temp.'</B><br
/>';*/
-
+
if($this->selected_fields[$this->org_or_person][$temp])
{
//if we have found an element to be
removed
@@ -262,62 +306,69 @@
//This should never happen though
unset($this->select_fields[$this->org_or_person][$temp]);
}
- $this->remove_me=$temp;
- $temp='remove';
+ $this->remove_me=$temp;
+ $temp = 'remove';
}
-
- $this->submit=$temp;
- /*print '<br /><B>selected </B>';
+
+ $this->submit = $temp;
+
+ /*
+ print '<br /><B>selected </B>';
print_r($this->selected_fields);
print '<br /><B>Submited</B>';
- print $this->submit; */
- $temp=get_var('org_or_person',array('get','post'));
- if($temp=='Organizations' || $temp == 'Persons')
+ print $this->submit;
+ */
+
+ $temp = $_REQUEST['org_or_person'];
+
+ if ( $temp == 'Organizations' || $temp == 'Persons' )
{
- $this->org_or_person=$temp;
+ $this->org_or_person = $temp;
}
- $temp=get_var('cat_id',array('get','post'));
- // print $temp;
- if($temp)
+ $temp = $_REQUEST['cat_id'];
+ //echo "Cat ID: $temp <br />\n";
+ if ( is_numeric($temp) || $temp == 'user_default' )
{
//Admin wants to delete the cat_id from
preferences
- if($temp=='user_default' &&
$this->map_tpl_to_real['adm_pref_type']=='forced')
+ if ( $temp == 'user_default' &&
$this->map_tpl_to_real['adm_pref_type'] == 'forced' )
{
-
$this->bo->default_category_forced=false;
- $this->bo->default_category='__NONE__';
-
$this->map_tpl_to_real['cat_options']=$this->get_addressbook_cats();
- $temp=($this->bo->default_category ==
'' ) ? '__NONE__' : $this->bo->default_category;
+ $this->bo->default_category_forced =
false;
+ $this->bo->default_category =
'__NONE__';
+ $this->map_tpl_to_real['cat_options'] =
$this->get_addressbook_cats();
+ $temp = ($this->bo->default_category ==
'' ) ? '__NONE__' : $this->bo->default_category;
}
else
{
-
$this->map_tpl_to_real['cat_options']=$this->get_addressbook_cats($temp);
+ $this->map_tpl_to_real['cat_options'] =
$this->get_addressbook_cats($temp);
}
- $this->map_tpl_to_real['cat_id']=$temp;
+ $this->map_tpl_to_real['cat_id'] = $temp;
//print '<br /><b>Selected
catid!'.$temp.'</b><br />';
}
else
{
- /// print '<br /><b>Cached catid</b><br />';
-
- //fetch from preferences
-
$this->map_tpl_to_real['cat_id']=$this->bo->default_category;
-
if($this->map_tpl_to_real['adm_pref_type']=='forced')
+ /// print '<br /><b>Cached
catid</b><br />';
+
+ //fetch from preferences
+ $this->map_tpl_to_real['cat_id'] =
$this->bo->default_category;
+
if($this->map_tpl_to_real['adm_pref_type']=='forced')
+ {
+ if ( $this->bo->default_category !=
'__NONE__' && $this->bo->default_category_forced)
{
-
if($this->bo->default_category!='__NONE__' &&
$this->bo->default_category_forced)
- {
-
$this->map_tpl_to_real['cat_options']=$this->get_addressbook_cats($this->bo->default_category);
- }
- else
-
$this->map_tpl_to_real['cat_options']=$this->get_addressbook_cats();
+
$this->map_tpl_to_real['cat_options'] =
$this->get_addressbook_cats($this->bo->default_category);
}
else
{
-
-
$this->map_tpl_to_real['cat_options']=$this->get_addressbook_cats($this->map_tpl_to_real['cat_id']);
+
$this->map_tpl_to_real['cat_options'] = $this->get_addressbook_cats();
}
- // print '<br /><b>Preference catid</b><br
/>';
+ }
+ else
+ {
+
+ $this->map_tpl_to_real['cat_options'] =
$this->get_addressbook_cats($this->map_tpl_to_real['cat_id']);
+ }
+ // print '<br
/><b>Preference catid</b><br />';
}
}
@@ -345,10 +396,10 @@
{
return true;
}
- return false;
+ return false;
}
-
+
function fields_to_show()
{
//have uiaddressbook fill up its field => english
array, stock_contact_fields
@@ -371,10 +422,10 @@
if(!
in_array($falsefield,$org_person_array['Organizations']) )
{
$this->fields_show_selectbox[$falsefield]=$GLOBALS['phpgw']->lang($this->contacts->stock_contact_fields[$falsefield]);
- // print "<br /><br /><b>
$falsefield<\b>";
+ // print "<br
/><br /><b> $falsefield<\b>";
$this->lang_fields[$falsefield]=$this->fields_show_selectbox[$falsefield];
}
-
unset($org_person_array['Organizations'][$falsefield]);
+
unset($org_person_array['Organizations'][$falsefield]);
}
elseif($this->org_or_person=='Organizations')
{
@@ -383,8 +434,8 @@
$this->fields_show_selectbox[$falsefield]=$GLOBALS['phpgw']->lang($this->contacts->stock_contact_fields[$falsefield]);
$this->lang_fields[$falsefield]=$this->fields_show_selectbox[$falsefield];
}
-
unset($org_person_array['Persons'][$falsefield]);
-
+
unset($org_person_array['Persons'][$falsefield]);
+
}
}
else
@@ -394,38 +445,38 @@
$this->lang_fields[$falsefield]=$GLOBALS['phpgw']->lang($this->contacts->stock_contact_fields[$falsefield]);
}
- //Constructing commtype descriptions
+ //Constructing commtype descriptions
}
$possible_comtypes=$this->linearize_query($this->contacts->get_contact_comm_descr(),'comm_description');
while(list($k,$v)=each($possible_comtypes))
{
if(!$this->selected_fields[$this->org_or_person]['comm_types'][$v])
{
- // print "<B><br />Commtypes
$this->selected_fields[$this->org_or_person]['comm_types'][$v]</b><br />";
+ // print "<B><br />Commtypes
$this->selected_fields[$this->org_or_person]['comm_types'][$v]</b><br />";
$this->fields_show_selectbox['comm_types'][$v]=$v;
-
+
}
else
{
- // print "<B><br />langfields
$this->lang_fields[$v]=$v</b><br />";
+ // print "<B><br />langfields
$this->lang_fields[$v]=$v</b><br />";
$this->lang_fields[$v]=$v;
}
}
/*
-
- print "<br /><b>Columns</b><br />";
- print_r($this->lang_fields);
- print "<br /><b>Columns</b><br />"; */
+ print "<br /><b>Columns</b><br />";
+ print_r($this->lang_fields);
+
+ print "<br /><b>Columns</b><br />"; */
}
function linearize_query($qresult,$key)
{
- // print_r($qresult);
+ // print_r($qresult);
reset($qresult);
for($i=0;$i < count($qresult);$i++)
{
-
$ret[$qresult[$i][$key]]=$qresult[$i][$key];
+ $ret[$qresult[$i][$key]]=$qresult[$i][$key];
}
return $ret;
}
@@ -433,42 +484,43 @@
{
//Selecting fields, let it roll
/*print '<br /><B>SELECTFIELDS!</B><br />';*/
-
if(is_array($this->cached_selected_fields[$this->org_or_person]) &&
is_array($this->selected_fields[$this->org_or_person]))
+ if (
is_array($this->cached_selected_fields[$this->org_or_person]) &&
is_array($this->selected_fields[$this->org_or_person]) )
{
//We have cached selected fields, and someone
selected more
//Need to agregate the selected to the cached
/*print '<br /><B>Merging Selected
Fields</B><br />';
-
print_r($this->selected_fields[$this->org_or_person]);
- print '<br /><B>Merging Cached Selected
Fields</B><br />';
-
print_r($this->cached_selected_fields[$this->org_or_person]);
- */
-
$this->cached_selected_fields[$this->org_or_person]=$this->selected_fields[$this->org_or_person]=array_merge_recursive($this->cached_selected_fields[$this->org_or_person],$this->selected_fields[$this->org_or_person]);
+
print_r($this->selected_fields[$this->org_or_person]);
+ print '<br /><B>Merging Cached Selected
Fields</B><br />';
+
print_r($this->cached_selected_fields[$this->org_or_person]);
+ */
+
$this->cached_selected_fields[$this->org_or_person] =
$this->selected_fields[$this->org_or_person] =
+
array_merge_recursive($this->cached_selected_fields[$this->org_or_person],
$this->selected_fields[$this->org_or_person]);
// print '<br /><B>Merging Result</B><br />';
- //
print_r($this->selected_fields[$this->org_or_person]);
+ //
print_r($this->selected_fields[$this->org_or_person]);
}
-
elseif(is_array($this->selected_fields[$this->org_or_person]))
+ elseif (
is_array($this->selected_fields[$this->org_or_person]) )
{
$this->cached_selected_fields[$this->org_or_person]=$this->selected_fields[$this->org_or_person];
//print '<br /><B>Selected awright</B><br />';
}
-
elseif(is_array($this->cached_selected_fields[$this->org_or_person]))
+ elseif (
is_array($this->cached_selected_fields[$this->org_or_person]) )
{
$this->selected_fields[$this->org_or_person]=$this->cached_selected_fields[$this->org_or_person];
//print '<br /><B>Cached awright</B><br />';
}
- elseif($this->org_or_person == 'Persons' &&
is_array($this->bo->person_columns))
+ elseif ( $this->org_or_person == 'Persons' &&
is_array($this->bo->person_columns) )
{
//print '<br /><B>Old preferences found</B><br
/>';
-
$this->selected_fields['Persons']=$this->cached_selected_fields['Persons']=$this->bo->person_columns;
+ $this->selected_fields['Persons'] =
$this->cached_selected_fields['Persons'] = $this->bo->person_columns;
}
- elseif($this->org_or_person == 'Organizations' &&
is_array($this->bo->org_columns))
+ elseif ( $this->org_or_person == 'Organizations' &&
is_array($this->bo->org_columns) )
{
- //print '<br /><B>Old preferences found</B><br
/>';
-
$this->selected_fields['Organizations']=$this->cached_selected_fields['Organizations']=$this->bo->org_columns;
+ //print '<br /><B>Old preferences found</B><br
/>';
+ $this->selected_fields['Organizations'] =
$this->cached_selected_fields['Organizations'] = $this->bo->org_columns;
}
-
+
}
function index()
{
@@ -478,36 +530,34 @@
{
case 'cancel':
+ $this->save_sessiondata(true);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/preferences/index.php') . '#addressbook');
+ exit;
+
+ case 'save':
+
//print_r($this->cached_selected_fields);
+ //Need to get it all, we are in a tab,
so actual data is
+ //combinedly in the cache or in the
selected_fields array
+
if(is_array($this->selected_fields['Persons']))
{
- $this->save_sessiondata(true);
-
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
- return;
+
$person_columns=$this->selected_fields['Persons'];
}
- case 'save':
+ else
{
-
//print_r($this->cached_selected_fields);
- //Need to get it all, we are in
a tab, so actual data is
- //combinedly in the cache or in
the selected_fields array
-
if(is_array($this->selected_fields['Persons']))
- {
-
$person_columns=$this->selected_fields['Persons'];
- }
- else
- {
-
$person_columns=$this->cached_selected_fields['Persons'];
- }
-
if(is_array($this->selected_fields['Organizations']))
- {
-
$org_columns=$this->selected_fields['Organizations'];
- }
- else
- {
-
$org_columns=$this->cached_selected_fields['Organizations'];
- }
+
$person_columns=$this->cached_selected_fields['Persons'];
+ }
+
if(is_array($this->selected_fields['Organizations']))
+ {
+
$org_columns=$this->selected_fields['Organizations'];
+ }
+ else
+ {
+
$org_columns=$this->cached_selected_fields['Organizations'];
+ }
$this->bo->person_columns=$person_columns;
$this->bo->org_columns=$org_columns;
-
+
//print '<br
/><B>Catid'.$this->map_tpl_to_real['cat_id'].'</B><br />';
$this->bo->default_category=$this->map_tpl_to_real['cat_id'];
@@ -515,18 +565,19 @@
//print_r($this->bo->person_columns)."</B><br />";
$this->bo->save_preferences($this->map_tpl_to_real['adm_pref_type']);
- // $this->save_sessiondata(true);
- // print
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
- // return;
+ // $this->save_sessiondata(true);
+ // print
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
+ // return;
+ /*
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->get_exact_fields();
break;
- }
- case 'remove':
- {
+ */
+
+ case 'remove':
//if removing
-
+
//print '<br /><B>Removing!</B><br />';
if($this->cached_selected_fields[$this->org_or_person][$this->remove_me])
{
@@ -540,7 +591,7 @@
unset($this->cached_selected_fields[$this->org_or_person]['comm_types'][$this->remove_me]);
}
//Look if we remove_me is the last
field to be removed
-
+
if($this->cache_is_empty())
{
if($this->cached_selected_fields[$this->org_or_person]['comm_types'][$this->remove_me])
@@ -551,144 +602,136 @@
{
unset($this->cached_selected_fields[$this->org_or_person][$this->remove_me]);
}
- }
-
- }
-
- default:
- {
-
$GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
-
-
-
- //Selecting fields, let it roll
- //print '<br /><B>SELECTFIELDS!</B><br
/>';
- $this->get_exact_fields();
- //print_r($this->selected_fields);
+ }
+ break;
+ }
+
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
-
- }
- }
- $this->template->set_file(
+ //Selecting fields, let it roll
+ //print '<br /><B>SELECTFIELDS!</B><br />';
+ $this->get_exact_fields();
+ //print_r($this->selected_fields);
+ $this->template->set_file(
array(
- 'addressbook_preferences_t'
=>'preferences.tpl',
- 'preferences_bits_t' =>
'preferences_bits.tpl',
- 'select_columns_form_options_t' =>
'preferences_bits.tpl',
- 'select_columns_commtypes_options_t' =>
'preferences_bits.tpl',
- 'selected_rows_t' =>
'preferences_bits.tpl',
- 'principal_tabs_t' =>
'principal_tabs.tpl'
- )
+ 'addressbook_preferences_t'
=>'preferences.tpl',
+ 'preferences_bits_t' =>
'preferences_bits.tpl',
+ 'select_columns_form_options_t'
=> 'preferences_bits.tpl',
+
'select_columns_commtypes_options_t' => 'preferences_bits.tpl',
+ 'selected_rows_t' =>
'preferences_bits.tpl',
+ 'principal_tabs_t' =>
'principal_tabs.tpl'
+ )
);
- //first, build the selectbox, select where needed
- $this->show_selectbox();
- //Obviously Not first time, fields have been selected
- if( (is_array($this->selected_fields[$org_or_person])) ||
(is_array($this->cached_selected_fields[$this->org_or_person])) &&
!$this->cache_is_empty())
+ //first, build the selectbox, select where needed
+ $this->show_selectbox();
+ //Obviously Not first time, fields have been selected
+ if( (is_array($this->selected_fields[$org_or_person]))
|| (is_array($this->cached_selected_fields[$this->org_or_person])) &&
!$this->cache_is_empty())
+ {
+
+ //print_r($this->cached_selected_fields);
+ $this->show_cols();
+ }
+ $this->set_static_vars();
+ $this->set_tabs();
+
$this->template->parse('out','addressbook_preferences_t');
+ $this->template->p('out');
+ $this->save_sessiondata();
+ }
+ function set_static_vars()
+ {
+
+
$this->template->set_var('lang_abprefs',$this->map_tpl_to_real['lang_abprefs']);
+
$this->template->set_var('lang_select_cols',$this->map_tpl_to_real['lang_select_cols']);
+
$this->template->set_var('select_columns_submit_value',$this->map_tpl_to_real['select_columns_submit_value']);
+
+
$this->template->set_var('select_columns_selectbox_name',$this->map_tpl_to_real['select_columns_selectbox_name']);
+
$this->template->set_var('select_columns_comtypes_name',$this->map_tpl_to_real['select_columns_comtypes_name']);
+
$this->template->set_var('submit_cancel_value',$this->map_tpl_to_real['submit_cancel_value']);
+
$this->template->set_var('submit_save_value',$this->map_tpl_to_real['submit_save_value']);
+
$this->template->set_var('lang_remove_field',$GLOBALS['phpgw']->lang('remove'));
+
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+
$this->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
+ //Catergories
+
$this->template->set_var('cat_options',$this->map_tpl_to_real['cat_options']);
+ if($this->is_current_admin())
+ {
+
$tabs=$this->map_tpl_to_real['final_admin_tabs'];
+ }
+ else
+ {
+ $tabs='';
+ }
+ $this->template->set_var('admin_tabs',$tabs);
+ if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
+ {
+ $hider_open="<!--";
+ $hider_close="-->";
+ }
+ $this->template->set_var('hider_open',$hider_open);
+ $this->template->set_var('hider_close',$hider_close);
+ }
+
+ function set_tabs()
{
+
$this->template->set_block('principal_tabs_t','principal_button');
+
$this->template->set_block('principal_tabs_t','principal_tab');
+
+ //print '<br /><B>Now it is a
'.$this->org_or_person.'</B><br />';
+ $this->parse_principal_tabs(
+
$this->map_tpl_to_real['person_preferences_link'],
+ $this->get_class_css(
+ 'Persons',
+ $this->org_or_person
+ ),
+ 'Persons',
+ 'Person'
+ );
+ $this->parse_principal_tabs(
+
$this->map_tpl_to_real['org_preferences_link'],
+ $this->get_class_css(
+ 'Organizations',
+ $this->org_or_person),
+ 'Organizations',
+ 'Organization'
+ );
+
$this->template->set_var('tabs',$this->template->fp('out','principal_tab'));
- //print_r($this->cached_selected_fields);
- $this->show_cols();
- }
- $this->set_static_vars();
- $this->set_tabs();
- $this->template->parse('out','addressbook_preferences_t');
- $this->template->p('out');
- $this->save_sessiondata();
- }
- function set_static_vars()
- {
-
$this->template->set_var('lang_abprefs',$this->map_tpl_to_real['lang_abprefs']);
-
$this->template->set_var('lang_select_cols',$this->map_tpl_to_real['lang_select_cols']);
-
$this->template->set_var('select_columns_submit_value',$this->map_tpl_to_real['select_columns_submit_value']);
-
-
$this->template->set_var('select_columns_selectbox_name',$this->map_tpl_to_real['select_columns_selectbox_name']);
-
$this->template->set_var('select_columns_comtypes_name',$this->map_tpl_to_real['select_columns_comtypes_name']);
-
$this->template->set_var('submit_cancel_value',$this->map_tpl_to_real['submit_cancel_value']);
-
$this->template->set_var('submit_save_value',$this->map_tpl_to_real['submit_save_value']);
-
$this->template->set_var('lang_remove_field',$GLOBALS['phpgw']->lang('remove'));
-
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-
$this->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
- //Catergories
-
$this->template->set_var('cat_options',$this->map_tpl_to_real['cat_options']);
- if($this->is_current_admin())
- {
- $tabs=$this->map_tpl_to_real['final_admin_tabs'];
- }
- else
- {
- $tabs='';
- }
- $this->template->set_var('admin_tabs',$tabs);
- if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
- {
- $hider_open="<!--";
- $hider_close="-->";
}
- $this->template->set_var('hider_open',$hider_open);
- $this->template->set_var('hider_close',$hider_close);
- }
-
- function set_tabs()
- {
-
$this->template->set_block('principal_tabs_t','principal_button');
- $this->template->set_block('principal_tabs_t','principal_tab');
-
- //print '<br /><B>Now it is a '.$this->org_or_person.'</B><br
/>';
- $this->parse_principal_tabs(
-
$this->map_tpl_to_real['person_preferences_link'],
- $this->get_class_css(
- 'Persons',
-
$this->org_or_person
- ),
- 'Persons',
- 'Person'
- );
- $this->parse_principal_tabs(
-
$this->map_tpl_to_real['org_preferences_link'],
- $this->get_class_css(
- 'Organizations',
-
$this->org_or_person),
- 'Organizations',
- 'Organization'
- );
-
$this->template->set_var('tabs',$this->template->fp('out','principal_tab'));
-
-
- }
- function current_columns_value_is_forced($commtypes=false)
- {
- switch($this->org_or_person)
+ function current_columns_value_is_forced($commtypes=false)
{
- case 'Persons':
- {
+ switch($this->org_or_person)
+ {
+ case 'Persons':
+ {
return
$this->bo->person_columns_forced;
- }
- case 'Organizations':
- {
-
- return
$this->bo->org_columns_forced;
- }
- }
+ }
+ case 'Organizations':
+ {
- }
- function show_selectbox($org_or_person='')
- {
+ return
$this->bo->org_columns_forced;
+ }
+ }
- if(empty($org_or_person))
- {
- $org_or_person=$this->org_or_person;
}
- $this->fields_to_show();
-
$this->template->set_block('select_columns_form_options_t','B_select_columns_form_options','V_select_columns_form_options');
-
$this->template->set_block('select_columns_commtypes_options_t','B_select_ctypes_options','V_select_columns_commtypes_options');
- if(count($this->fields_show_selectbox) > 1)
+ function show_selectbox($org_or_person='')
{
- reset($this->fields_show_selectbox);
- // print "<br /><B> To Show in
Selectbox<br />".print_r($this->fields_show_selectbox)."</B><br />";
-
while(list($field,$lang)=each($this->fields_show_selectbox))
+
+ if(empty($org_or_person))
{
- //not a comtype
+ $org_or_person=$this->org_or_person;
+ }
+ $this->fields_to_show();
+
$this->template->set_block('select_columns_form_options_t','B_select_columns_form_options','V_select_columns_form_options');
+
$this->template->set_block('select_columns_commtypes_options_t','B_select_ctypes_options','V_select_columns_commtypes_options');
+ if(count($this->fields_show_selectbox) > 1)
+ {
+ reset($this->fields_show_selectbox);
+ // print "<br /><B> To
Show in Selectbox<br />".print_r($this->fields_show_selectbox)."</B><br />";
+
while(list($field,$lang)=each($this->fields_show_selectbox))
+ {
+ //not a comtype
if(!is_array($lang))
{
@@ -718,202 +761,210 @@
$this->template->parse('B_select_columns_form_options','V_select_columns_form_options');
$this->template->parse('B_select_ctypes_options',
'V_select_ctypes_options');
- }
- function show_cols($org_or_person='')
- {
- if(empty($org_or_person))
- {
- $org_or_person=$this->org_or_person;
}
-
$this->template->set_block('selected_rows_t','B_selected_rows','V_selected_rows');
-
- //print "<br /><B>Selected</B><br />";
- //print_r($this->selected_fields[$this->org_or_person]);
- reset($this->selected_fields[$this->org_or_person]);
-
while(list($k,$v)=each($this->selected_fields[$this->org_or_person]))
+ function show_cols($org_or_person='')
{
- if(!is_array($v))
+ if(empty($org_or_person))
{
-
$this->template->set_var('lang_selected_contact_field',$this->lang_fields[$k]);
- if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
- {
- $removelink='';
- }
- else
- {
- $removelink=$GLOBALS['phpgw']->link
- ('/index.php',
-
array("menuaction"=>"addressbook.uiaddressbook_prefs.index",
- "remove_me"=>$k,
- "org_or_person" =>
$this->org_or_person,
- "adm_pref_type" =>
$this->map_tpl_to_real['adm_pref_type']
-
- )
- );
- }
-
-
$this->template->set_var('remove_me_link',$removelink);
-
$this->template->parse('V_selected_rows','B_selected_rows',True);
+ $org_or_person=$this->org_or_person;
}
- else
- {
- reset($v);
- $arrays[]=$v;
- }
-
- }
- if(is_array($arrays))
- {
- if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
- {
+
$this->template->set_block('selected_rows_t','B_selected_rows','V_selected_rows');
- $removelink='';
- }
- else
- {
- $removelink=true;
- }
-
- while(list($k,$v)=each($arrays))
+ //print "<br /><B>Selected</B><br />";
+ //print_r($this->selected_fields[$this->org_or_person]);
+ reset($this->selected_fields[$this->org_or_person]);
+
while(list($k,$v)=each($this->selected_fields[$this->org_or_person]))
{
- while(list($ok,$ov)=each($v))
+ if(!is_array($v))
{
- if($removelink)
+
$this->template->set_var('lang_selected_contact_field',$this->lang_fields[$k]);
+
if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
+ {
+ $removelink='';
+ }
+ else
{
$removelink=$GLOBALS['phpgw']->link
('/index.php',
array("menuaction"=>"addressbook.uiaddressbook_prefs.index",
-
"remove_me"=>$ok,
+
"remove_me"=>$k,
"org_or_person" => $this->org_or_person,
"adm_pref_type" => $this->map_tpl_to_real['adm_pref_type']
)
);
}
-
-
$this->template->set_var('lang_selected_contact_field',$this->lang_fields[$ok]);
$this->template->set_var('remove_me_link',$removelink);
$this->template->parse('V_selected_rows','B_selected_rows',True);
}
+ else
+ {
+ reset($v);
+ $arrays[]=$v;
+ }
+
}
- }
+ if(is_array($arrays))
+ {
+ if($this->current_columns_value_is_forced() &&
$this->map_tpl_to_real['adm_pref_type'] != 'forced')
+ {
- $this->template->parse('B_selected_rows','V_selected_rows');
- }
-
- function save_sessiondata($clear=false)
- {
- if(!$clear)
- {
+ $removelink='';
+ }
+ else
+ {
+ $removelink=true;
+ }
-
$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref',
- array(
- 'selected_fields' =>
$this->cached_selected_fields,
- 'map_tpl_to_real' =>
$this->map_tpl_to_real,
- 'lang_fields' =>
$this->lang_fields
- )
- );
+ while(list($k,$v)=each($arrays))
+ {
+ while(list($ok,$ov)=each($v))
+ {
+ if($removelink)
+ {
+
$removelink=$GLOBALS['phpgw']->link
+ ('/index.php',
+
array("menuaction"=>"addressbook.uiaddressbook_prefs.index",
+
"remove_me"=>$ok,
+
"org_or_person" => $this->org_or_person,
+
"adm_pref_type" => $this->map_tpl_to_real['adm_pref_type']
+
+ )
+ );
+ }
+
+
+
$this->template->set_var('lang_selected_contact_field',$this->lang_fields[$ok]);
+
$this->template->set_var('remove_me_link',$removelink);
+
$this->template->parse('V_selected_rows','B_selected_rows',True);
+ }
+ }
+ }
+
+
$this->template->parse('B_selected_rows','V_selected_rows');
}
- else
+
+ function save_sessiondata($clear=false)
{
- // print '<br /><B>Clearing Cache </B><br />';
-
$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref','');
- }
+ if(!$clear)
+ {
- }
- function read_sessiondata()
- {
+
$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref',
+ array(
+ 'selected_fields' =>
$this->cached_selected_fields,
+ 'map_tpl_to_real' =>
$this->map_tpl_to_real,
+ 'lang_fields' =>
$this->lang_fields
+ )
+ );
+ }
+ else
+ {
+ // print '<br /><B>Clearing Cache </B><br
/>';
+
$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref','');
+ }
-// print '<br /><B>READING SESSIONDATA!</B><br />';
-
$data=$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref');
- $this->cached_selected_fields=$data['selected_fields'];
- $this->map_tpl_to_real=$data['map_tpl_to_real'];
- $this->cat_id=$this->map_tpl_to_real['cat_id'];
- $this->lang_fields=$data['lang_fields'];
- $this->cache_is_empty=$data['cache_is_empty'];
+ }
+ function read_sessiondata()
+ {
- }
- //Strange, the cached fields need to be really unset, then we clear the
cache and we are really clean
- function clear_dinamic_data()
- {
- unset($this->cached_selected_fields);
- unset($this->lang_fields);
- $this->save_sessiondata('true');
- }
+ // print '<br /><B>READING
SESSIONDATA!</B><br />';
+
$data=$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref');
+ $this->cached_selected_fields=$data['selected_fields'];
+ $this->map_tpl_to_real=$data['map_tpl_to_real'];
+ $this->cat_id=$this->map_tpl_to_real['cat_id'];
+ $this->lang_fields=$data['lang_fields'];
+ $this->cache_is_empty=$data['cache_is_empty'];
- function session_data_saved()
- {
-
$data=$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref');
- //print "<br /><B>Actually got sessiondata</B><br />";
- //print_r($data);
- return is_array($data);
- }
- function parse_principal_tabs($action,$class_css,$name,$value)
- {
- $button = array('principal_action' => $action,
- 'principal_class_css' => $class_css,
- 'principal_name' => $name,
- 'principal_value' => $value);
- $this->template->set_var($button);
- $this->template->parse('principal_buttons',
'principal_button',true);
+ }
+ //Strange, the cached fields need to be really unset, then we
clear the cache and we are really clean
+ function clear_dinamic_data()
+ {
+ unset($this->cached_selected_fields);
+ unset($this->lang_fields);
+ $this->save_sessiondata('true');
+ }
- }
- function get_class_css($tab, $current_tab)
- {
- //print "<br /><B>ITS AN $tab == $current_tab";
- if ($tab == $current_tab)
+ function session_data_saved()
{
- return 'button_style_sel';
+
$data=$GLOBALS['phpgw']->session->appsession('session_data','addressbookpref');
+ //print "<br /><B>Actually got sessiondata</B><br />";
+ //print_r($data);
+ return is_array($data);
}
- else
+ function parse_principal_tabs($action,$class_css,$name,$value)
{
- return 'button_style';
+ $button = array('principal_action' => $action,
+ 'principal_class_css' => $class_css,
+ 'principal_name' => $name,
+ 'principal_value' => $value);
+ $this->template->set_var($button);
+ $this->template->parse('principal_buttons',
'principal_button',true);
+
+ }
+ function get_class_css($tab, $current_tab)
+ {
+ //print "<br /><B>ITS AN $tab == $current_tab";
+ if ($tab == $current_tab)
+ {
+ return 'button_style_sel';
+ }
+ else
+ {
+ return 'button_style';
+ }
+
}
-
- }
function css()
{
- $tmp = 'input[type="submit"].button_style,
input[type="button"].button_style {
+ return
+ '
+ input[type=submit].button_style,
input[type=button].button_style
+ {
color: #555;
margin-left: 1px;
margin-right: 1px;
background-color: #ddd;
border:1px #888 solid;
- border-bottom-width: 0px;
+ border-bottom-width: 0px;
padding: 1px;
width: 85px;
- }
-
- input[type="submit"].button_style_sel,
input[type="button"].button_style_sel {
+ }
+
+ input[type=submit].button_style_sel,
input[type=button].button_style_sel
+ {
color: #555;
margin-left: 1px;
margin-right: 1px;
/*background-color: #e5e5e5;*/
border:1px #888 solid;
- border-bottom-width: 0px;
+ border-bottom-width: 0px;
padding: 1px;
width: 85px;
- }
-
- input[type="submit"]:hover.button_style,
input[type="button"]:hover.button_style {
+ }
+
+ input[type=submit]:hover.button_style,
input[type=button]:hover.button_style
+ {
background-color: #eee;
color: #36c;
- }
-
- input[type="submit"]:active.button_style,
input[type="button"]:active.button_style {
+ }
+
+ input[type=submit]:active.button_style,
input[type=button]:active.button_style
+ {
background-color: #eee;
color: #9ac;
- }';
- return $tmp;
+ }
+ ';
}
-
+
function is_current_admin()
{
-// print "<br /><B> Current is admin? ".
-
$GLOBALS['phpgw']->acl->check('run',1,'admin')."</B><br />";
+ /*
+ print "<br /><B> Current is admin? "
+ .
$GLOBALS['phpgw']->acl->check('run',1,'admin')."</b><br />";
+ */
return $GLOBALS['phpgw']->acl->check('run',1,'admin');
}
@@ -926,36 +977,41 @@
'label' => lang('Your
preferences'),
'link' =>
$GLOBALS['phpgw']->link('/index.php',array(
"menuaction" =>
"addressbook.uiaddressbook_prefs.index",
-
"adm_pref_type"=>"user"
- ))
+
"adm_pref_type"=>"user"
+ ))
);
$tabs[] = array(
'label' => lang('Default
preferences'),
'link' =>
$GLOBALS['phpgw']->link('/index.php',array(
"menuaction" =>
"addressbook.uiaddressbook_prefs.index",
-
"adm_pref_type"=>"default"
- ))
+
"adm_pref_type"=>"default"
+ ))
);
$tabs[] = array(
'label' => lang('Forced
preferences'),
'link' =>
$GLOBALS['phpgw']->link('/index.php',array(
"menuaction" =>
"addressbook.uiaddressbook_prefs.index",
-
"adm_pref_type"=>"forced"
- ))
+
"adm_pref_type"=>"forced"
+ ))
);
switch($this->map_tpl_to_real['adm_pref_type'])
{
- case 'user': $selected = 0; break;
- case 'default': $selected = 1; break;
- case 'forced': $selected = 2; break;
+ case 'user':
+ $selected = 0;
+ break;
+
+ case 'default':
+ $selected = 1;
+ break;
+
+ case 'forced':
+ $selected = 2;
+ break;
}
-
$this->map_tpl_to_real['final_admin_tabs']=$GLOBALS['phpgw']->common->create_tabs($tabs,$selected);
+ $this->map_tpl_to_real['final_admin_tabs'] =
$GLOBALS['phpgw']->common->create_tabs($tabs,$selected);
}
}
-
-
-
-}
+ }
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] addressbook/inc class.uiaddressbook_prefs.inc.php [Version-0_9_16-branch],
Dave Hall <=