[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] addressbook/inc/class.widget_lists.inc.php, 1.1.2.4
From: |
nomail |
Subject: |
[Phpgroupware-cvs] addressbook/inc/class.widget_lists.inc.php, 1.1.2.4 |
Date: |
Thu, 20 May 2004 15:07:54 -0000 |
Update of /addressbook/inc
Modified Files:
Branch: Version-0_9_16-branch
class.widget_lists.inc.php
date: 2004/04/13 22:24:45; author: jarg; state: Exp; lines: +72 -6
Log Message:
Add support for filters and now use the functions of
phpgwapi/js/contacts/selectboxes.js in the next comiit i will remove my js
function i only want be sure that this not give problems.
=====================================================================
No syntax errors detected in -
=====================================================================
Index: addressbook/inc/class.widget_lists.inc.php
diff -u addressbook/inc/class.widget_lists.inc.php:1.1.2.3
addressbook/inc/class.widget_lists.inc.php:1.1.2.4
--- addressbook/inc/class.widget_lists.inc.php:1.1.2.3 Thu Jan 8 00:27:30 2004
+++ addressbook/inc/class.widget_lists.inc.php Tue Apr 13 22:24:45 2004
@@ -29,12 +29,13 @@
* @param array $form_name The name form where it will be this
widget
* @param string $use_combos Use True if you want to have combos
in your widget
*/
- function widget_lists($title, $form_name, $use_combos=True)
+ function widget_lists($title, $form_name, $use_combos=True,
$use_filter=False)
{
$this->template = &$GLOBALS['phpgw']->template;
$this->title = $title;
$this->form_name = $form_name;
$this->use_combos = $use_combos;
+ $this->use_filter = $use_filter;
}
/**
@@ -44,12 +45,15 @@
*/
function get_widget()
{
+
$this->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('addressbook'));
$this->template->set_file(array('widget_list_t' =>
'widget_lists.tpl'));
$this->template->set_block('widget_list_t',
'many_actions', 'many_actions');
$this->template->set_block('widget_list_t', 'combos',
'combos');
+ $this->template->set_block('widget_list_t',
'option_filter', 'option_filter');
$this->template->set_var('lang_general_title',
$this->title);
-
+ $this->template->set_var('widget_list_form_name',
$this->form_name);
+
if($this->use_combos)
{
$this->template->set_var('lang_left_combo_title', $this->left_combo_title);
@@ -59,6 +63,20 @@
$this->template->parse('combos_lists',
'combos');
}
+ if($this->use_filter)
+ {
+ $this->template->set_var('filter_by_label',
+ lang('Filter by: '));
+
$this->template->set_var('filter_by_option_list',
+
$this->get_list_filters());
+ $this->template->set_var('search_by_label',
+ lang('Search: '));
+
$this->template->set_var('all_option_list_filter',
+
$this->get_list_filters());
+
$this->template->parse('all_option_list_filter_body',
+ 'option_filter');
+ }
+
if(is_array($this->selected_option_list))
{
$this->all_option_list =
array_diff($this->all_option_list, $this->selected_option_list);
@@ -75,6 +93,15 @@
$this->template->set_var('selected_option_list_name',
$this->selected_option_list_name);
$this->template->set_var('selected_option_list',
$this->get_option_list($this->selected_option_list));
+ if($this->right_combo_link_opt)
+ {
+ $this->template->set_var('current_opt',
$this->right_combo_name);
+ }
+ elseif($this->left_combo_link_opt)
+ {
+ $this->template->set_var('current_opt',
$this->left_combo_name);
+ }
+
$this->template->set_var('th_bg',
$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->template->set_var('th_text',
$GLOBALS['phpgw_info']['theme']['th_text']);
$this->template->set_var('row_on',
$GLOBALS['phpgw_info']['theme']['row_on']);
@@ -135,10 +162,12 @@
* @param boolean $use_js For use javascript
* @return mixed The left combo box
*/
- function set_left_combo($title, $list_name, $list=array(),
$selected='', $use_js=False)
+ function set_left_combo($title, $list_name, $list=array(),
$selected='', $use_js=False, $link_opt=False)
{
$this->left_combo_title = $title;
+ $this->left_combo_name = $list_name;
$this->left_combo = $this->get_combo($list_name, $list,
$selected, $use_js);
+ $this->left_combo_link_opt = $link_opt;
}
function set_left_text($title, $list_name, $value='')
@@ -157,10 +186,12 @@
* @param boolean $use_js For use javascript
* @return mixed The right combo box
*/
- function set_right_combo($title, $list_name, $list=array(),
$selected='', $use_js=False)
+ function set_right_combo($title, $list_name, $list=array(),
$selected='', $use_js=False, $link_opt=False)
{
$this->right_combo_title = $title;
+ $this->right_combo_name = $list_name;
$this->right_combo = $this->get_combo($list_name,
$list, $selected, $use_js);
+ $this->right_combo_link_opt = $link_opt;
}
/**
@@ -251,7 +282,40 @@
*/
function get_onsubmit_js_string()
{
- return
'onsubmit="process_list(\''.$this->all_option_list_name.'\',\''.$this->selected_option_list_name.'\')"';
+ return 'onsubmit="process_list(\''
+ .$this->all_option_list_name
+ .'\',\''
+ .$this->selected_option_list_name.'\')"';
+ }
+
+ function set_list_filters($list_options, $selected='')
+ {
+ if(is_array($list_options))
+ {
+ $sel_opt[$selected] = 'selected';
+ foreach($list_options as $key => $value)
+ {
+ $opt .= '<option
value="'.$key.'"'.$sel_opt.'>'.$value.'</option>';
+ }
+ $this->filter_option_list = $opt;
+ }
+ else
+ {
+ $this->filter_option_list = $list_options;
+ }
+ }
+
+ function get_list_filters()
+ {
+ return $this->filter_option_list;
+ }
+
+ function get_onload_js_string()
+ {
+ return 'onload="setUpVisual(\''
+ .$this->form_name
+ .'\',\''.$this->all_option_list_name
+
.'\',\'searchautocomplete\');obj1.bldUpdate();"';
}
/**
@@ -355,7 +419,9 @@
}
}
- </script>';
+ </script>'
+ .
+ '<script
src="'.$GLOBALS['phpgw']->link("/phpgwapi/js/contacts/selectboxes.js").'">
</script>';
return $tmp;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] addressbook/inc/class.widget_lists.inc.php, 1.1.2.4,
nomail <=