- fix for egw.org bug #2729: extended search for recipients filtered by categories does not work

- cancel button in advanced search, cancels now the advanced search and not just closes the window
This commit is contained in:
Ralf Becker 2010-10-12 14:01:36 +00:00
parent d7d719a73d
commit 93d34b8557
3 changed files with 696 additions and 13 deletions

View File

@ -1813,15 +1813,24 @@ class addressbook_ui extends addressbook_bo
*/
function search($_content=array())
{
if(!empty($_content)) {
if(!empty($_content))
{
$do_email = $_content['do_email'];
$response = new xajaxResponse();
$query = egw_session::appsession($do_email ? 'email' : 'index','addressbook');
$query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select'))));
foreach ($query['advanced_search'] as $key => $value)
if ($_content['button']['cancel'])
{
if(!$value) unset($query['advanced_search'][$key]);
unset($query['advanced_search']);
}
else
{
$query['advanced_search'] = array_intersect_key($_content,array_flip(array_merge($this->get_contact_columns(),array('operator','meth_select'))));
foreach ($query['advanced_search'] as $key => $value)
{
if(!$value) unset($query['advanced_search'][$key]);
}
}
$query['start'] = 0;
$query['search'] = '';
@ -1837,18 +1846,22 @@ class addressbook_ui extends addressbook_bo
opener.location.href=link.replace(/\#/,'');
xajax_eT_wrapper();
");
if ($_content['button']['cancel']) $response->addScript('window.close();');
return $response->getXML();
}
else {
else
{
$do_email = strpos($_SERVER['HTTP_REFERER'],'emailpopup') !== false;
}
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
$GLOBALS['egw_info']['flags']['java_script'] .= "<script>window.focus()</script>";
$GLOBALS['egw_info']['etemplate']['advanced_search'] = true;
// initialize etemplate arrays
$sel_options = $readonlys = $preserv = array();
$sel_options = $readonlys = array();
$content = egw_session::appsession('advanced_search','addressbook');
$content['n_fn'] = $this->fullname($content);
for($i = -23; $i<=23; $i++) $tz[$i] = ($i > 0 ? '+' : '').$i;
$sel_options['tz'] = $tz + array('' => lang('doesn\'t matter'));
@ -1894,7 +1907,9 @@ class addressbook_ui extends addressbook_bo
$content['disable_change_org'] = true;
$this->tmpl->read('addressbook.search');
return $this->tmpl->exec('addressbook.addressbook_ui.search',$content,$sel_options,$readonlys,$preserv,2);
return $this->tmpl->exec('addressbook.addressbook_ui.search',$content,$sel_options,$readonlys,array(
'do_email' => $do_email,
),2);
}
/**

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,670 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="addressbook.search" template="" lang="" group="0" version="">
<grid width="100%">
<template id="addressbook.edit.upload" template="" lang="" group="0" version="1.3.004">
<grid class="uploadphoto">
<columns>
<column/>
</columns>
<rows>
<row disabled="!@jpegphoto">
<checkbox label="delete" id="delete_photo" statustext="Deletes the photo"/>
</row>
<row>
<file id="upload_photo" class="photo" statustext="Select a portrait format jpeg photo. It will be resized to 60 pixel width."/>
</row>
<row>
<button label="Ok" align="center" onclick="set_style_by_class('table','uploadphoto','display','none'); return false;"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.name" template="" lang="" group="0" version="1.3.004">
<grid width="310" height="160" class="editname">
<columns>
<column width="20%"/>
<column/>
</columns>
<rows>
<row>
<description options=",,,n_prefix" value="prefix"/>
<textbox id="n_prefix" size="35" maxlength="64" onchange="setName(this);"/>
</row>
<row>
<description value="first name" options=",,,n_given"/>
<textbox id="n_given" size="35" maxlength="64" onchange="setName(this);"/>
</row>
<row>
<description options=",,,n_middle" value="middle name"/>
<textbox id="n_middle" size="35" maxlength="64" onchange="setName(this);"/>
</row>
<row>
<description options=",,,n_family" value="last name"/>
<textbox id="n_family" size="35" maxlength="64" onchange="setName(this);"/>
</row>
<row>
<description options=",,,n_suffix" value="suffix"/>
<textbox id="n_suffix" size="35" maxlength="64" onchange="setName(this);"/>
</row>
<row>
<description/>
<button label="Ok" onclick="set_style_by_class('table','editname','display','none'); if(document.getElementById(form::name('title'))){document.getElementById(form::name('title')).focus();} return false;"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.general" template="" lang="" group="0" version="1.9.002">
<grid height="286">
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row valign="top">
<image src="accounts"/>
<vbox>
<image src="photo" class="photo" onclick="set_style_by_class('table','uploadphoto','display','inline'); return false;"/>
<template id="addressbook.edit.upload"/>
</vbox>
<grid>
<columns>
<column/>
<column/>
<column/>
<column/>
</columns>
<rows>
<row>
<description value="Name"/>
<textbox rows="1" cols="3" id="n_fn" no_lang="1" onclick="set_style_by_class('table','editname','display','inline'); document.getElementById(form::name('n_prefix')).focus();" size="-36" span="2" class="cursorHand" readonly="true"/>
</row>
<row>
<description/>
<template id="addressbook.edit.name"/>
<description/>
<description/>
</row>
<row>
<description options=",,,title" value="Title"/>
<textbox size="36" maxlength="64" id="title" span="2"/>
<description/>
</row>
<row>
<description options=",,,role" value="Role"/>
<textbox size="20" maxlength="64" id="role"/>
<textbox size="5" label="Room" id="room"/>
<description/>
</row>
</rows>
</grid>
</row>
<row>
<image src="home"/>
<description value="Organisation"/>
<textbox id="org_name" size="45" maxlength="128" onchange="setName(this);"/>
</row>
<row>
<description/>
<description value="department" options=",,,org_unit"/>
<textbox id="org_unit" size="45" maxlength="64"/>
</row>
<row>
<image src="gohome"/>
<description value="street" options=",,,adr_one_street"/>
<textbox size="45" maxlength="64" id="adr_one_street"/>
</row>
<row>
<description/>
<description/>
<textbox size="45" maxlength="64" id="adr_one_street2" statustext="address line 2"/>
</row>
<row disabled="@addr_format=city_state_postcode">
<description/>
<description value="city" options=",,,adr_one_locality"/>
<hbox options="0,0">
<textbox size="5" maxlength="64" id="adr_one_postalcode" statustext="ZIP Code"/>
<textbox size="35" maxlength="64" id="adr_one_locality" statustext="City" class="leftPad5"/>
</hbox>
</row>
<row disabled="@addr_format=city_state_postcode">
<description/>
<description value="country" options=",,,adr_one_countryname"/>
<hbox options="0,0">
<menulist class="countrySelect">
<menupopup type="select-country" options="Select one,0,1" id="adr_one_countrycode" onchange="show_custom_country(this);"/>
</menulist>
<textbox id="adr_one_countryname" class="custom_country"/>
<textbox class="leftPad5" size="19" maxlength="64" id="adr_one_region" statustext="State"/>
</hbox>
</row>
<row disabled="!@addr_format=city_state_postcode">
<description/>
<description value="City"/>
<hbox options="0,0">
<textbox size="30" maxlength="64" id="adr_one_locality" statustext="City"/>
<textbox class="leftPad5" size="3" maxlength="64" id="adr_one_region" statustext="State"/>
<textbox size="5" maxlength="64" id="adr_one_postalcode" statustext="ZIP Code" class="leftPad5"/>
</hbox>
</row>
<row disabled="!@addr_format=city_state_postcode">
<description/>
<description value="country" options=",,,adr_one_countryname"/>
<hbox options="0,0">
<menulist class="countrySelect">
<menupopup type="select-country" options="Select one,0,1" id="adr_one_countrycode" onchange="show_custom_country(this);"/>
</menulist>
<textbox id="adr_one_countryname" class="custom_country"/>
</hbox>
</row>
<row valign="bottom" height="25">
<image src="private.png"/>
<description value="Addressbook"/>
<menulist class="owner">
<menupopup id="owner" statustext="Addressbook the contact should be saved to" no_lang="1"/>
</menulist>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.cats" template="" lang="" group="0" version="1.4.001">
<grid width="100%" height="258" overflow="auto">
<columns>
<column/>
<column/>
<column disabled="@cat_tab=Tree"/>
<column disabled="!@cat_tab=Tree"/>
</columns>
<rows>
<row valign="top">
<image src="folder"/>
<description value="Categories"/>
<listbox type="select-cat" id="cat_id" rows="013" options=",width:99%"/>
<tree-cat id="cat_id" options="13,,width:99%"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.home" template="" lang="" group="0" version="1.9.001">
<grid height="258">
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row>
<image src="accounts"/>
<description value="street" options=",,,adr_two_street"/>
<textbox size="45" maxlength="64" id="adr_two_street"/>
</row>
<row>
<description/>
<description options=",,,adr_two_street2"/>
<textbox size="45" maxlength="64" id="adr_two_street2" statustext="address line 2"/>
</row>
<row disabled="@addr_format2=city_state_postcode">
<description/>
<description value="city" options=",,,adr_two_locality"/>
<hbox options="0,0">
<textbox size="5" maxlength="64" id="adr_two_postalcode" statustext="ZIP Code"/>
<textbox size="35" maxlength="64" id="adr_two_locality" statustext="City" class="leftPad5"/>
</hbox>
</row>
<row disabled="@addr_format2=city_state_postcode">
<description/>
<description value="country" options=",,,adr_two_countryname"/>
<hbox options="0,0">
<menulist class="countrySelect">
<menupopup type="select-country" options="Select one,0,1" id="adr_two_countrycode" onchange="show_custom_country(this);"/>
</menulist>
<textbox id="adr_two_countryname" class="custom_country"/>
<textbox class="leftPad5" size="19" maxlength="64" id="adr_two_region" statustext="State"/>
</hbox>
</row>
<row disabled="!@addr_format2=city_state_postcode">
<description/>
<description value="city" options=",,,adr_two_locality"/>
<hbox options="0,0">
<textbox size="30" maxlength="64" id="adr_two_locality" statustext="City"/>
<textbox class="leftPad5" size="3" maxlength="64" id="adr_two_region" statustext="State"/>
<textbox size="5" maxlength="64" id="adr_two_postalcode" statustext="ZIP Code" class="leftPad5"/>
</hbox>
</row>
<row disabled="!@addr_format2=city_state_postcode">
<description/>
<description value="Country"/>
<hbox options="0,0">
<menulist class="countrySelect">
<menupopup type="select-country" options="Select one,0,1" id="adr_two_countrycode" onchange="show_custom_country(this);"/>
</menulist>
<textbox id="adr_two_countryname" class="custom_country"/>
</hbox>
</row>
<row height="30">
<image src="gear"/>
<description options=",,,bday" value="Birthday"/>
<hbox options="0,0">
<date options="Y-m-d" id="bday"/>
<menulist>
<menupopup id="tz" no_lang="1" label="Timezone" align="right"/>
</menulist>
</hbox>
</row>
<row valign="top">
<image src="private.png"/>
<description value="Public key" options=",,,pubkey"/>
<textbox multiline="true" rows="4" cols="40" id="pubkey"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.details" template="" lang="" group="0" version="1.5.001">
<grid width="100%" height="258" overflow="auto">
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row valign="top" disabled="@cat_tab">
<image src="folder"/>
<description value="Categories"/>
<listbox type="select-cat" id="cat_id" rows="3" options=",width:99%"/>
</row>
<row class="row_off" valign="top">
<image src="edit"/>
<description value="Notes"/>
<textbox multiline="true" rows="6" cols="50" id="note"/>
</row>
<row class="row_on" disabled="@disable_change_org">
<image src="check"/>
<description/>
<checkbox label="change all organisation members" id="change_org" span="all" statustext="Apply changes to all members, whose fields have the same previous content"/>
</row>
<row>
<image src="home"/>
<description value="Last date"/>
<link id="last_link"/>
</row>
<row>
<description/>
<description value="Next date"/>
<link id="next_link"/>
</row>
<row class="row_off" valign="top">
<image src="gear"/>
<menulist>
<menupopup type="select-account" readonly="true" label="Created"/>
</menulist>
<hbox readonly="true" options="0,0">
<menulist>
<menupopup type="select-account" id="creator" readonly="true"/>
</menulist>
<date-time id="created" class="leftPad5" readonly="true"/>
</hbox>
</row>
<row class="row_on">
<description/>
<description value="Last modified"/>
<hbox readonly="true" options="0,0">
<menulist>
<menupopup type="select-account" id="modifier" readonly="true"/>
</menulist>
<date-time id="modified" class="leftPad5" readonly="true"/>
</hbox>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.links" template="" lang="" group="0" version="1.3.001">
<grid width="100%" height="258" overflow="auto">
<columns>
<column/>
</columns>
<rows>
<row class="th" disabled="@view">
<description value="Create new links"/>
</row>
<row>
<link-to id="link_to"/>
</row>
<row class="th">
<description value="Existing links"/>
</row>
<row>
<link-list id="link_to"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.distribution_list" template="" lang="" group="0" version="1.5.001">
<grid width="100%" height="258" overflow="auto">
<columns>
<column/>
</columns>
<rows>
<row class="th">
<description value="Distribution lists"/>
</row>
<row>
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description span="all" id="distrib_lists"/>
</row>
</rows>
</grid>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.custom" template="" lang="" group="0" version="1.5.002">
<grid width="100%" height="258" class="row_on" spacing="0" padding="0" overflow="auto">
<columns>
<column/>
</columns>
<rows>
<row class="th" height="20">
<description value="Custom fields"/>
</row>
<row height="100%">
<customfields options="$cont[tid],$cont[no_private_cfs]"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.custom_private" template="" lang="" group="0" version="1.5.002">
<grid width="100%" height="258" class="row_on" spacing="0" padding="0" overflow="auto">
<columns>
<column/>
</columns>
<rows>
<row class="th" height="20">
<description value="Custom fields"/>
</row>
<row height="100%">
<customfields options="$cont[tid],1"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit.history" template="" lang="" group="0" version="">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<advancedsearch id="advs"/>
<historylog id="history"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.editphones" template="" lang="" group="0" version="1.5.001">
<grid class="editphones">
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row>
<description span="all" class="windowheader" value="Edit Phonenumbers - " no_lang="1" align="center" id="fn"/>
<description/>
<description/>
</row>
<row class="th">
<description value="Description"/>
<description value="Number"/>
<description value="pref"/>
</row>
<row>
<description value="business" options=",,,tel_work2" class="bold"/>
<url-phone options="30" id="tel_work2"/>
<radio options="tel_work,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="mobile phone" options=",,,tel_cell2"/>
<url-phone options="30" id="tel_cell2"/>
<radio options="tel_cell,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="fax" options=",,,tel_fax"/>
<url-phone options="30" id="tel_fax2"/>
<radio options="tel_fax,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="car phone" options=",,,tel_car"/>
<url-phone options="30" id="tel_car"/>
<radio options="tel_car,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="pager" options=",,,tel_pager"/>
<url-phone options="30" id="tel_pager"/>
<radio options="tel_pager,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<hrule span="all"/>
</row>
<row>
<description value="Assistent" options=",,,assistent" class="bold"/>
<textbox size="35" id="assistent" span="2"/>
</row>
<row>
<description value="number" options=",,,tel_assistent"/>
<url-phone options="30" id="tel_assistent"/>
<radio options="tel_assistent,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<hrule span="all"/>
</row>
<row>
<description value="Private" options=",,,tel_home2" class="bold"/>
<url-phone options="30" id="tel_home2"/>
<radio options="tel_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="mobile phone" options=",,,tel_cell_private"/>
<url-phone options="30" id="tel_cell_private"/>
<radio options="tel_cell_private,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description value="fax" options=",,,tel_fax_home"/>
<url-phone options="30" id="tel_fax_home"/>
<radio options="tel_fax_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<hrule span="all"/>
</row>
<row>
<description value=" Other Phone" options=",,,tel_other"/>
<url-phone options="30" id="tel_other"/>
<radio options="tel_other,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<button label="Ok" onclick="set_style_by_class('table','editphones','display','none'); if (window.hidephones) hidephones(this.form); return false;" span="all" align="center"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.edit" template="" lang="" group="0" version="1.7.001">
<grid>
<columns>
<column width="450"/>
<column width="350"/>
</columns>
<rows>
<row disabled="!@msg">
<htmlarea span="all" class="redItalic" id="msg" no_lang="1" readonly="true"/>
<description/>
</row>
<row>
<menulist class="fileas">
<menupopup rows="1" cols="3" id="fileas_type" no_lang="1" blur="Name" statustext="own sorting"/>
</menulist>
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row disabled="@no_tid">
<menulist class="leftPad5">
<menupopup no_lang="1" id="tid" onchange="1" label="Type"/>
</menulist>
<html class="space" needed="1" label=" " no_lang="1" id="typegfx" readonly="true"/>
</row>
</rows>
</grid>
</row>
<row valign="top">
<tabbox id="tabs">
<tabs>
<tab label="General" statustext="Name, Address"/>
<tab label="Categories" statustext="Categories"/>
<tab label="Private" statustext="Home address, Birthday, ..."/>
<tab label="Details" statustext="Categories, Notes, ..."/>
<tab label="Links" statustext="Links"/>
<tab label="Distribution lists" statustext="Distribution lists, ..."/>
<tab label="Extra" statustext="Custom fields"/>
<tab label="Extra private" statustext="Private custom fields"/>
<tab label="History" statustext=""/>
</tabs>
<tabpanels>
<template id="addressbook.edit.general"/>
<template id="addressbook.edit.cats"/>
<template id="addressbook.edit.home"/>
<template id="addressbook.edit.details"/>
<template id="addressbook.edit.links"/>
<template id="addressbook.edit.distribution_list"/>
<template id="addressbook.edit.custom"/>
<template id="addressbook.edit.custom_private"/>
<template id="addressbook.edit.history"/>
</tabpanels>
</tabbox>
<vbox>
<template id="addressbook.editphones"/>
<groupbox class="phoneGroup">
<caption label="Phone Numbers"/>
<grid>
<columns>
<column width="20"/>
<column width="120"/>
<column/>
<column/>
</columns>
<rows>
<row>
<image src="phone"/>
<description value="business" options=",,,tel_work"/>
<url-phone id="tel_work" options="24,40" class="telNumbers"/>
<radio options="tel_work,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description/>
<description value="mobile phone" options=",,,tel_cell"/>
<url-phone id="tel_cell" options="24,40" class="telNumbers"/>
<radio options="tel_cell,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description/>
<description value="Private" options=",,,tel_home"/>
<url-phone id="tel_home" options="24,40" class="telNumbers"/>
<radio options="tel_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description/>
<description value="Fax"/>
<url-phone id="tel_fax" options="24,40" class="telNumbers"/>
<radio options="tel_fax,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row>
<row>
<description/>
<description/>
<button label="More ..." onclick="set_style_by_class('table','editphones','display','inline'); if (window.showphones) showphones(this.form); return false;" accesskey="m"/>
<description/>
</row>
</rows>
</grid>
</groupbox>
<groupbox class="emailGroup">
<caption label="Email &amp; Internet"/>
<grid>
<columns>
<column width="20"/>
<column width="120"/>
<column/>
</columns>
<rows>
<row>
<image src="internet"/>
<description value="url" options=",,,url"/>
<url id="url" options="28,128"/>
</row>
<row>
<description/>
<description options=",,,url_home" value="Private"/>
<url id="url_home" options="28,128"/>
</row>
<row>
<image src="email.png"/>
<description value="email" options=",,,email"/>
<url-email id="email" options="28,128"/>
</row>
<row>
<description/>
<description value="Private" options=",,,email_home"/>
<url-email id="email_home" options="28,128"/>
</row>
</rows>
</grid>
</groupbox>
</vbox>
</row>
<row disabled="@hidebuttons">
<hbox>
<button label="Edit" id="button[edit]" onclick="window.open(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit&amp;contact_id=$cont[id]'),'_blank','dependent=yes,width=850,height=460,scrollbars=yes,status=yes'); return false;"/>
<button label="Copy" id="button[copy]" onclick="window.open(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit&amp;contact_id=$cont[id]&amp;makecp=1'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;"/>
<button label="vCard" id="button[vcard]" statustext="download this contact as vCard file"/>
<button label="Save" id="button[save]" accesskey="s"/>
<button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]" onclick="if($cont[view]0) return true; self.close(); return false;"/>
</hbox>
<button label="Delete" id="button[delete]" onclick="return confirm('Are you shure you want to delete this contact?');" align="right" tabindex="25"/>
</row>
</rows>
</grid>
</template>
<template id="addressbook.search" template="" lang="" group="0" version="1.8.001">
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<template id="addressbook.edit"/>
<description/>
</row>
<row>
<hbox span="all">
<menulist>
<menupopup label="Operator" id="operator" no_lang="1"/>
</menulist>
<menulist>
<menupopup id="meth_select" no_lang="1"/>
</menulist>
</hbox>
</row>
<row>
<hbox span="all">
<button label="Search" id="button[search]" onclick="xajax_eT_wrapper(this); return false;"/>
<button label="Cancel" id="button[cancel]" onclick="xajax_eT_wrapper(this); return false;"/>
</hbox>
</row>
</rows>
</grid>