This commit is contained in:
Cornelius Weiß 2006-10-24 20:12:33 +00:00
parent a0bc65dcab
commit cc0705e83a
2 changed files with 14 additions and 58 deletions

View File

@ -6,6 +6,8 @@
* @package etemplate * @package etemplate
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Cornelius Weiss <egw@von-und-zu-weiss.de> * @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @deprecated Don't use any more, this will be removed after 1.4 release.
* Please manage advanced searches in you app!
* @version $Id$ * @version $Id$
*/ */
@ -52,6 +54,7 @@
*/ */
function advancedsearch_widget($ui='') function advancedsearch_widget($ui='')
{ {
error_log(__LINE__. __FILE__. "@deprecated Don't use any more, this will be removed after 1.4 release. Please manage advanced searches in you app! ");
} }
/** /**
@ -158,7 +161,9 @@
else else
{ {
$GLOBALS['egw_info']['etemplate']['advanced_search'] = true; $GLOBALS['egw_info']['etemplate']['advanced_search'] = true;
$tpl->add_child($tpl, $search_template = $tpl->empty_cell('template',$extension_data['input_template'])); $GLOBALS['egw_info']['flags']['include_xajax'] = true;
//$tpl->add_child($tpl, $search_template = $tpl->empty_cell('template',$extension_data['input_template']));
$button_box = $tpl->empty_cell('hbox','button_box'); $button_box = $tpl->empty_cell('hbox','button_box');
$tpl->add_child($tpl, $button_box); $tpl->add_child($tpl, $button_box);
$tpl->add_child($button_box, $op_select = $tpl->empty_cell('select','opt_select',array( $tpl->add_child($button_box, $op_select = $tpl->empty_cell('select','opt_select',array(
@ -177,8 +182,16 @@
'no_lang' => true, 'no_lang' => true,
'default' => '%', 'default' => '%',
))); )));
$prefix = $extension_data['prefix'];
$tpl->add_child($button_box, $search_button = $tpl->empty_cell('button','button[search]',array( $tpl->add_child($button_box, $search_button = $tpl->empty_cell('button','button[search]',array(
'label' => 'Search', 'label' => 'Search',
'onclick' => "
var fromobj = document.getElementsByName('eTemplate');
opener.document.getElementById('exec[$prefix][search]').value=xajax.getFormValues(fromobj[0])+xajax.getFormValues(this.form);
opener.document.getElementById('exec[$prefix][start_search]').form.submit()
opener.document.getElementById('exec[$prefix][search]').value='';
return false;
",
))); )));
} }
$cell['size'] = $cell['name']; $cell['size'] = $cell['name'];

View File

@ -31,8 +31,6 @@
* 'never_hide' => True// I never hide the nextmatch-line if less then maxmatch entries * 'never_hide' => True// I never hide the nextmatch-line if less then maxmatch entries
* 'lettersearch' => True// I show a lettersearch * 'lettersearch' => True// I show a lettersearch
* 'searchletter' => // I0 active letter of the lettersearch or false for [all] * 'searchletter' => // I0 active letter of the lettersearch or false for [all]
* 'advsearch_dlg' => // I function that returns complete html dialog app.class.function
* 'advsearch_cont => // 0 content from advanced_search dialog
* 'start' => // IO position in list * 'start' => // IO position in list
* 'num_rows' => // IO number of rows to show, defaults to maxmatches from the general prefs * 'num_rows' => // IO number of rows to show, defaults to maxmatches from the general prefs
* 'cat_id' => // IO category, if not 'no_cat' => True * 'cat_id' => // IO category, if not 'no_cat' => True
@ -64,7 +62,6 @@
var $public_functions = array( var $public_functions = array(
'pre_process' => True, 'pre_process' => True,
'post_process' => True, 'post_process' => True,
'open_advsearch' => True,
); );
/** /**
* availible extensions and there names for the editor * availible extensions and there names for the editor
@ -500,58 +497,4 @@
} }
return True; return True;
} }
/**
* Show an advancedsearch dialog (as popup)
* @abstract This function is a wrapper for an advanced search dialog.
* It "just" manages the communication with the next match template AND
* showes the Search buttons.
*
* @param string $_function Name of function that returns complete html dialog app.class.method
* @param string $_prefix name of opening nextmatch template e.g. 'nm'
*/
function open_advsearch( $_function, $_prefix ) {
$function = $_function ? $_function : $_GET['function'] ? $_GET['function'] : false;
$prefix = $_prefix ? $_prefix : $_GET['prefix'] ? $_GET['prefix'] : false;
if (!$function || !$prefix) {
die("Error: No function name given!");
}
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
ExecMethod2($function);
$tpl =& new etemplate;
$tpl->init('*** generated advanced search widget','','',0,'',0,0); // make an empty template
$tpl->add_child($tpl, $search_template = $tpl->empty_cell('template',$extension_data['input_template']));
$button_box = $tpl->empty_cell('hbox','button_box');
$tpl->add_child($tpl, $button_box);
$tpl->add_child($button_box, $op_select = $tpl->empty_cell('select','opt_select',array(
'sel_options' => array(
'OR' => 'OR',
'AND' => 'AND'
),
'label' => 'Operator',
'no_lang' => true,
)));
$tpl->add_child($button_box, $meth_select = $tpl->empty_cell('select','meth_select',array(
'sel_options' => array(
'%' => lang('contains'),
false => lang('exact'),
),
'no_lang' => true,
'default' => '%',
)));
$tpl->add_child($button_box, $search_button = $tpl->empty_cell('button','button[search]',array(
'label' => 'Search',
'onclick' => "
var fromobj = document.getElementsByName('eTemplate');
opener.document.getElementById('exec[$prefix][search]').value=xajax.getFormValues(fromobj[0])+xajax.getFormValues(this.form);
opener.document.getElementById('exec[$prefix][start_search]').form.submit()
opener.document.getElementById('exec[$prefix][search]').value='';
return false;
",
)));
echo $tpl->exec('','','','','',1);
}
} }