mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
Addressbook cleanup
- Finish column selection change from exclusion to default list, distribution list & next/last date had some leftovers - Remove 'do_email'
This commit is contained in:
parent
b0feb5e965
commit
4889995e29
@ -79,9 +79,7 @@ class addressbook_display extends addressbook_ui
|
||||
// 'filter2_no_lang'=> True, // I set no_lang for filter2 (=dont translate the options)
|
||||
// 'filter2_onchange' => "if(this.value=='add') { add_new_list(document.getElementById(form::name('filter')).value); this.value='';} else this.form.submit();",
|
||||
'lettersearch' => true,
|
||||
'do_email' => $do_email,
|
||||
'default_cols' => '!cat_id,contact_created_contact_modified',
|
||||
'manual' => $do_email ? ' ' : false, // space for the manual icon
|
||||
'no_columnselection' => True,
|
||||
'csv_fields' => false,
|
||||
);
|
||||
|
@ -97,7 +97,7 @@ class addressbook_favorite_portlet extends home_favorite_portlet
|
||||
// Some processing to add values in for links and cats
|
||||
$success = $failed = $action_msg = $msg = null;
|
||||
if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'],
|
||||
$success,$failed,$action_msg,$values['do_email'] ? 'email' : 'index',$msg,$values['nm']['checkboxes']))
|
||||
$success,$failed,$action_msg,'index',$msg,$values['nm']['checkboxes']))
|
||||
{
|
||||
$msg .= lang('%1 contact(s) %2',$success,$action_msg);
|
||||
Api\Json\Response::get()->apply('egw.message',array($msg,'success'));
|
||||
|
@ -123,14 +123,12 @@ class addressbook_ui extends addressbook_bo
|
||||
*
|
||||
* @param array $_content =null submitted content
|
||||
* @param string $msg =null message to show
|
||||
* @param boolean $do_email =false do an email-selection popup or the regular index-page
|
||||
*/
|
||||
function index($_content=null,$msg=null,$do_email=false)
|
||||
function index($_content=null,$msg=null)
|
||||
{
|
||||
//echo "<p>uicontacts::index(".print_r($_content,true).",'$msg')</p>\n";
|
||||
if (($re_submit = is_array($_content)))
|
||||
{
|
||||
$do_email = $_content['do_email'];
|
||||
|
||||
if (isset($_content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes
|
||||
{
|
||||
@ -159,7 +157,7 @@ class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
$success = $failed = $action_msg = null;
|
||||
if ($this->action($_content['nm']['action'],$_content['nm']['selected'],$_content['nm']['select_all'],
|
||||
$success,$failed,$action_msg,$_content['do_email'] ? 'email' : 'index',$msg,$_content['nm']['checkboxes']))
|
||||
$success,$failed,$action_msg,'index',$msg,$_content['nm']['checkboxes']))
|
||||
{
|
||||
$msg .= lang('%1 contact(s) %2',$success,$action_msg);
|
||||
Framework::message($msg);
|
||||
@ -203,9 +201,7 @@ class addressbook_ui extends addressbook_bo
|
||||
$msg = lang('List creation failed, no rights!');
|
||||
}
|
||||
}
|
||||
$preserv = array(
|
||||
'do_email' => $do_email,
|
||||
);
|
||||
$preserv = array();
|
||||
$to = $_content['nm']['to'];
|
||||
$content = array();
|
||||
if($msg || $_GET['msg'])
|
||||
@ -213,7 +209,7 @@ class addressbook_ui extends addressbook_bo
|
||||
Framework::message($msg ? $msg : $_GET['msg']);
|
||||
}
|
||||
|
||||
$content['nm'] = Api\Cache::getSession('addressbook', $do_email ? 'email' : 'index');
|
||||
$content['nm'] = Api\Cache::getSession('addressbook', 'index');
|
||||
if (!is_array($content['nm']))
|
||||
{
|
||||
$content['nm'] = array(
|
||||
@ -235,7 +231,6 @@ class addressbook_ui extends addressbook_bo
|
||||
'filter2' => '', // IO filter2, if not 'no_filter2' => True
|
||||
'filter2_no_lang'=> True, // I set no_lang for filter2 (=dont translate the options)
|
||||
'lettersearch' => true,
|
||||
'do_email' => $do_email ? 1 : 0,
|
||||
// using a positiv list now, as we constantly adding new columns in addressbook, but not removing them from default
|
||||
'default_cols' => 'type,n_fileas_n_given_n_family_n_family_n_given_org_name_n_family_n_given_n_fileas,'.
|
||||
'number,org_name,org_unit,'.
|
||||
@ -244,7 +239,6 @@ class addressbook_ui extends addressbook_bo
|
||||
'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/
|
||||
'filter2_onchange' => "return app.addressbook.filter2_onchange();",
|
||||
'filter2_tags' => true,
|
||||
'manual' => $do_email ? ' ' : false, // space for the manual icon
|
||||
//'actions' => $this->get_actions(), // set on each request, as it depends on some filters
|
||||
'row_id' => 'id',
|
||||
'row_modified' => 'modified',
|
||||
@ -253,12 +247,8 @@ class addressbook_ui extends addressbook_bo
|
||||
'favorites' => true,
|
||||
);
|
||||
|
||||
if ($do_email)
|
||||
{
|
||||
$content['nm']['filter2_onchange'] = 'app.addressbook.filter2_onchange_email();';
|
||||
}
|
||||
// use the state of the last session stored in the user prefs
|
||||
if (($state = @unserialize($this->prefs[$do_email ? 'email_state' : 'index_state'])))
|
||||
if (($state = @unserialize($this->prefs['index_state'])))
|
||||
{
|
||||
$content['nm'] = array_merge($content['nm'],$state);
|
||||
}
|
||||
@ -286,23 +276,9 @@ class addressbook_ui extends addressbook_bo
|
||||
$sel_options['filter2'] = $this->get_lists(Acl::READ,array('' => lang('No distribution list')));
|
||||
$sel_options['filter2']['add'] = lang('Add a new list').'...'; // put it at the end
|
||||
}
|
||||
if ($do_email)
|
||||
{
|
||||
if (!$re_submit)
|
||||
{
|
||||
$content['nm']['to'] = 'to'; // use 'bcc' if you want bcc as preselected standard mailaddress scope
|
||||
$content['nm']['email_type'] = $this->prefs['distributionListPreferredMail'] ? $this->prefs['distributionListPreferredMail'] : 'email';
|
||||
$content['nm']['search'] = '@';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content['nm']['to'] = $to;
|
||||
$content['nm']['email_type'] = $this->prefs['distributionListPreferredMail'] ? $this->prefs['distributionListPreferredMail'] : 'email';
|
||||
}
|
||||
$content['nm']['header_left'] = 'addressbook.email.left';
|
||||
}
|
||||
|
||||
// Organisation stuff is not (yet) availible with ldap
|
||||
elseif($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
|
||||
if($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
|
||||
{
|
||||
$content['nm']['header_left'] = 'addressbook.index.left';
|
||||
}
|
||||
@ -361,9 +337,9 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
$content['nm']['grouped_view_label'] = $sel_options['grouped_view'][(string) $content['nm']['grouped_view']];
|
||||
|
||||
$this->tmpl->read($do_email ? 'addressbook.email' : 'addressbook.index');
|
||||
return $this->tmpl->exec($do_email ? 'addressbook.addressbook_ui.emailpopup' : 'addressbook.addressbook_ui.index',
|
||||
$content,$sel_options,array(),$preserv,$do_email ? 2 : 0);
|
||||
$this->tmpl->read('addressbook.index');
|
||||
return $this->tmpl->exec('addressbook.addressbook_ui.index',
|
||||
$content,$sel_options,array(),$preserv);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -842,8 +818,6 @@ class addressbook_ui extends addressbook_bo
|
||||
$actions['view']['default'] = false;
|
||||
$actions['open']['default'] = true;
|
||||
}
|
||||
//echo "<p>".__METHOD__."($do_email, $tid_filter, $org_view)</p>\n"; _debug_array($actions);
|
||||
|
||||
// Allow contacts to be dragged
|
||||
/*
|
||||
$actions['drag'] = array(
|
||||
@ -959,50 +933,6 @@ class addressbook_ui extends addressbook_bo
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address-selection popup
|
||||
*
|
||||
* @param array $content =null submitted content
|
||||
* @param string $msg =null message to show
|
||||
*/
|
||||
function emailpopup($content=null,$msg=null)
|
||||
{
|
||||
if (strpos($GLOBALS['egw_info']['flags']['java_script'],'addEmail') === false)
|
||||
{
|
||||
$handler = 'opener.addEmail(to,email)';
|
||||
$GLOBALS['egw_info']['flags']['java_script'].= "
|
||||
<script>
|
||||
window.egw_LAB.wait(function() {
|
||||
window.focus();
|
||||
|
||||
window.addEmail = function(email)
|
||||
{
|
||||
var to = 'to';
|
||||
splitter = email.indexOf(' <');
|
||||
namepart = email.substring(0,splitter);
|
||||
emailpart = email.substring(splitter);
|
||||
email = namepart.replace(/@/g,' ')+emailpart;
|
||||
|
||||
if (document.getElementById('exec[nm][to][cc]').checked == true)
|
||||
{
|
||||
to = 'cc';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (document.getElementById('exec[nm][to][bcc]').checked == true)
|
||||
{
|
||||
to = 'bcc';
|
||||
}
|
||||
}
|
||||
$handler;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
";
|
||||
}
|
||||
return $this->index($content,$msg,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contacts in an organisation via AJAX
|
||||
*
|
||||
@ -1160,7 +1090,7 @@ window.egw_LAB.wait(function() {
|
||||
* @param int &$success number of succeded actions
|
||||
* @param int &$failed number of failed actions (not enought permissions)
|
||||
* @param string &$action_msg translated verb for the actions, to be used in a message like %1 contacts 'deleted'
|
||||
* @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
|
||||
* @param string/array $session_name 'index' or array with session-data depending if we are in the main list or the popup
|
||||
* @return boolean true if all actions succeded, false otherwise
|
||||
*/
|
||||
function action($action,$checked,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg, $checkboxes = NULL)
|
||||
@ -1552,8 +1482,7 @@ window.egw_LAB.wait(function() {
|
||||
*/
|
||||
function get_rows(&$query,&$rows,&$readonlys,$id_only=false)
|
||||
{
|
||||
$do_email = $query['do_email'];
|
||||
$what = $query['sitemgr_display'] ? $query['sitemgr_display'] : ($do_email ? 'email' : 'index');
|
||||
$what = $query['sitemgr_display'] ? $query['sitemgr_display'] : 'index';
|
||||
|
||||
if (!$id_only && !$query['csv_export']) // do NOT store state for csv_export or querying id's (no regular view)
|
||||
{
|
||||
@ -1691,7 +1620,7 @@ window.egw_LAB.wait(function() {
|
||||
}
|
||||
else
|
||||
{
|
||||
$query['template'] = $do_email ? 'addressbook.email.rows' : 'addressbook.index.rows';
|
||||
$query['template'] = 'addressbook.index.rows';
|
||||
}
|
||||
if($query['col_filter']['parent_id'])
|
||||
{
|
||||
@ -1773,21 +1702,20 @@ window.egw_LAB.wait(function() {
|
||||
$wildcard = $query['advanced_search']['meth_select'] == $wildcard ? $wildcard : '';
|
||||
unset($query['advanced_search']['meth_select']);
|
||||
}
|
||||
//if ($do_email ) $email_only = array('id','owner','tid','n_fn','n_family','n_given','org_name','email','email_home');
|
||||
|
||||
$rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'],$id_only,
|
||||
$order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']);
|
||||
|
||||
// do we need to read the custom fields, depends on the column is enabled and customfields exist
|
||||
// $query['csv_export'] allways needs to read ALL cf's
|
||||
$columsel = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows'];
|
||||
// do we need to read the custom fields, depends on the column is enabled and customfields
|
||||
$columsel = $this->prefs['nextmatch-addressbook.index.rows'];
|
||||
$available_distib_lists=$this->get_lists(Acl::READ);
|
||||
$columselection = $columsel && !$query['csv_export'] ? explode(',',$columsel) : array();
|
||||
$columselection = $columsel ? explode(',',$columsel) : array();
|
||||
$ids = $calendar_participants = array();
|
||||
if (!$id_only && $rows)
|
||||
{
|
||||
$show_custom_fields = (!$columselection || in_array('customfields',$columselection) || $query['csv_export']) && $this->customfields;
|
||||
$show_calendar = !$columselection || in_array('calendar_calendar',$columselection);
|
||||
$show_distributionlist = !$columselection || in_array('distrib_lists',$columselection) || count($available_distib_lists);
|
||||
$show_custom_fields = (in_array('customfields',$columselection)) && $this->customfields;
|
||||
$show_calendar = in_array('calendar_calendar',$columselection);
|
||||
$show_distributionlist = in_array('distrib_lists',$columselection) || count($available_distib_lists);
|
||||
if ($show_calendar || $show_custom_fields || $show_distributionlist)
|
||||
{
|
||||
foreach($rows as $val)
|
||||
@ -1803,9 +1731,7 @@ window.egw_LAB.wait(function() {
|
||||
}
|
||||
$customfields = $this->read_customfields($ids,$selected_cfs);
|
||||
}
|
||||
// TODO: we need to find out where the csv_export query has been used and try to clean up
|
||||
// this columnselection condition statements.
|
||||
if ($columselection && $show_calendar && !empty($ids)) $calendar = $this->read_calendar($calendar_participants);
|
||||
if ($show_calendar && !empty($ids)) $calendar = $this->read_calendar($calendar_participants);
|
||||
// distributionlist memership for the entrys
|
||||
//_debug_array($this->get_lists(Acl::EDIT));
|
||||
if ($show_distributionlist && $available_distib_lists)
|
||||
|
@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="addressbook.email.left" template="" lang="" group="0" version="1.5.001">
|
||||
<hbox class="bold" no_lang="1">
|
||||
<radio statustext="where to add the email address" label="To" id="to" no_lang="1" options="to" class="bold"/>
|
||||
<radio statustext="where to add the email address" label="Cc" id="to" no_lang="1" options="cc" class="bold"/>
|
||||
<radio statustext="where to add the email address" label="Bcc" id="to" no_lang="1" options="bcc" class="bold"/>
|
||||
</hbox>
|
||||
<hbox class="bold" no_lang="1">
|
||||
<radio statustext="preferred type of email address to add for distribution lists" label="Business email" id="email_type" no_lang="1" options="email" class="bold"/>
|
||||
<radio statustext="preferred type of email address to add for distribution lists" label="Home email" id="email_type" no_lang="1" options="email_home" class="bold"/>
|
||||
</hbox>
|
||||
</template>
|
||||
<template id="addressbook.email.rows" template="" lang="" group="0" version="1.9.003">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
<column disabled="!@order=n_given"/>
|
||||
<column disabled="!@order=n_family"/>
|
||||
<column/>
|
||||
<column disabled="!@order=/^(org_name|n_fileas)$/"/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<description/>
|
||||
<hbox options="0,0">
|
||||
<nextmatch-sortheader label="Firstname" id="n_given"/>
|
||||
<nextmatch-sortheader label="Name" id="n_family"/>
|
||||
</hbox>
|
||||
<hbox options="0,0">
|
||||
<nextmatch-sortheader label="Name" id="n_family"/>
|
||||
<nextmatch-sortheader label="Firstname" id="n_given"/>
|
||||
</hbox>
|
||||
<nextmatch-sortheader label="Company" id="org_name"/>
|
||||
<hbox options="0,0">
|
||||
<nextmatch-sortheader label="Name" id="n_family"/>
|
||||
<nextmatch-sortheader label="Firstname" id="n_given" class="leftPad5"/>
|
||||
</hbox>
|
||||
<nextmatch-header label="Business email" id="email"/>
|
||||
<nextmatch-header label="Home email" id="email_home"/>
|
||||
<hbox align="center" class="noPrint">
|
||||
<nextmatch-header align="center" label="Actions" id="legacy_actions"/>
|
||||
<button align="right" statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('addressbook.email.rows').toggleAllSelected(); return false;" image="check"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="row" valign="top">
|
||||
<image align="center" label="$row_cont[type_label]" src="${row}[type]" no_lang="1"/>
|
||||
<hbox options="0,0">
|
||||
<description value=" " id="${row}[n_given]" no_lang="1"/>
|
||||
<description id="${row}[n_family]" no_lang="1" class="leftPad5"/>
|
||||
</hbox>
|
||||
<hbox options="0,0">
|
||||
<description id="${row}[n_family]" no_lang="1"/>
|
||||
<description value=" " id="${row}[n_given]" no_lang="1" class="leftPad5"/>
|
||||
</hbox>
|
||||
<description id="${row}[org_name]" no_lang="1"/>
|
||||
<hbox options="0,0">
|
||||
<description id="${row}[n_family]" no_lang="1"/>
|
||||
<description value=" " id="${row}[n_given]" no_lang="1" class="leftPad5"/>
|
||||
</hbox>
|
||||
<box no_lang="1" options="0,0" class="emailCol">
|
||||
<description id="${row}[email]" no_lang="1" href=""javascript:var nfn='$row_cont[n_fn]';nfn=nfn.replace(/" activate_links="|@/g" for="'');this.addEmail(nfn+' <$row_cont[email]>');"" extra_link_title=",,$row_cont[email]"/>
|
||||
</box>
|
||||
<box no_lang="1" options="0,0" class="emailCol">
|
||||
<description id="${row}[email_home]" no_lang="1" href=""javascript:var nfn='$row_cont[n_fn]';nfn=nfn.replace(/" activate_links="|@/g" for="'');this.addEmail(nfn+' <$row_cont[email_home]>');"" extra_link_title=",,$row_cont[email_home]"/>
|
||||
</box>
|
||||
<hbox options="0" class="noPrint">
|
||||
<button label="Edit" id="edit[$row_cont[id]]" onclick="window.open(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit&contact_id=$row_cont[id]'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;" image="edit"/>
|
||||
<button statustext="Delete this contact" label="Delete" id="delete[$row_cont[id]]" onclick="et2_dialog.confirm(widget,'Delete this contact','Delete')" image="delete"/>
|
||||
<checkbox align="right" statustext="Select multiple contacts for a further action" id="checked[]" options="$row_cont[id]"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.email" template="" lang="" group="0" version="1.3.001">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row disabled="!@msg">
|
||||
<description align="center" id="msg" no_lang="1" span="all" class="redItalic"/>
|
||||
<description/>
|
||||
<description/>
|
||||
</row>
|
||||
<row disabled="1">
|
||||
<template id="addressbook.email.left"/>
|
||||
<description align="right"/>
|
||||
</row>
|
||||
<row>
|
||||
<nextmatch id="nm" template="addressbook.email.rows" span="all"/>
|
||||
</row>
|
||||
<row class="noPrint">
|
||||
<button statustext="Add a new contact" label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=addressbook.uicontacts.edit'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;"/>
|
||||
<hbox align="right">
|
||||
<checkbox statustext="Apply the action on the whole query, NOT only the shown contacts!!!" label="whole query" id="use_all" onchange="if (this.checked==true && !confirm('Apply the action on the whole query, NOT only the shown contacts!!!')) this.checked=false;"/>
|
||||
<menulist>
|
||||
<menupopup statustext="Select an action or addressbook to move to" id="action" no_lang="1" onchange="if (this.value != '') { this.form.submit(); this.value=''; }" options="Select an action or addressbook to move to..."/>
|
||||
</menulist>
|
||||
<button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="toggle_all(this.form,form::name('nm[rows][checked][]')); return false;" image="arrow_ltr" class="checkAllArrow"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
</overlay>
|
@ -79,8 +79,8 @@
|
||||
<row class="noPrint dialogFooterToolbar" disabled="!@nm[selectcols]=/legacy_actions/">
|
||||
<button statustext="Add a new contact" label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;"/>
|
||||
<hbox align="right" span="all">
|
||||
<buttononly statustext="Select action" label="Select action" id="legacy_actions" onclick="if (!egw_globalObjectManager.getObjectById('addressbook.'+({$cont['nm']['do_email']} ? 'email' : 'index') + '.rows').executeActionImplementation(this, 'popup')) alert(egw::lang('You need to select some entries first!')); return false;;"/>
|
||||
<button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('addressbook.'+({$cont['nm']['do_email']} ? 'email' : 'index') + '.rows').toggleAllSelected(); return false;" image="arrow_ltr" class="checkAllArrow"/>
|
||||
<buttononly statustext="Select action" label="Select action" id="legacy_actions" onclick="if (!egw_globalObjectManager.getObjectById('addressbook.index.rows').executeActionImplementation(this, 'popup')) alert(egw::lang('You need to select some entries first!')); return false;;"/>
|
||||
<button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('addressbook.index.rows').toggleAllSelected(); return false;" image="arrow_ltr" class="checkAllArrow"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
|
Loading…
Reference in New Issue
Block a user