forked from extern/egroupware
merge from trunk(revision 23943:23948) to 1.4 branch
This commit is contained in:
parent
f32da9bdc0
commit
144faf15ff
@ -179,16 +179,30 @@ class boaddressbook
|
||||
*
|
||||
* @internal
|
||||
* @param array $datas array of contact arrays
|
||||
* @param boolean $read_customfields=false should the customfields be read, default no (contacts::read() does it already)
|
||||
* @return array
|
||||
*/
|
||||
function data2xmlrpc($datas)
|
||||
function data2xmlrpc($datas,$read_customfields=false)
|
||||
{
|
||||
if(is_array($datas))
|
||||
{
|
||||
if ($read_customfields)
|
||||
{
|
||||
$ids = array();
|
||||
foreach($datas as $data)
|
||||
{
|
||||
$ids[] = $data['id'];
|
||||
}
|
||||
$customfields = $this->contacts->read_customfields($ids);
|
||||
}
|
||||
foreach($datas as $n => $nul)
|
||||
{
|
||||
$data =& $datas[$n]; // $n => &$data is php5 ;-)
|
||||
|
||||
|
||||
if ($customfields && isset($customfields[$data['id']]))
|
||||
{
|
||||
$data += $customfields[$data['id']];
|
||||
}
|
||||
// remove empty or null elements, they dont need to be transfered
|
||||
$data = array_diff($data,array('',null));
|
||||
|
||||
@ -213,6 +227,11 @@ class boaddressbook
|
||||
{
|
||||
$data['cat_id'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$data['cat_id']));
|
||||
}
|
||||
// replacing the fieldname in tel_prefer with the actual number, if it exists and is non-empty
|
||||
if (substr($data['tel_prefer'],0,4) === 'tel_' && $data[$data['tel_prefer']])
|
||||
{
|
||||
$data['tel_prefer'] = $data[$data['tel_prefer']];
|
||||
}
|
||||
// translate fieldnames if required
|
||||
foreach($this->mapping as $from => $to)
|
||||
{
|
||||
@ -286,6 +305,20 @@ class boaddressbook
|
||||
$cats = $GLOBALS['server']->xmlrpc2cats($data['cat_id']);
|
||||
$data['cat_id'] = count($cats) > 1 ? ','.implode(',',$cats).',' : (int)$cats[0];
|
||||
}
|
||||
// replacing the number in tel_prefer with the fieldname, if it matches a phone-number, otherwise keep it's content as is
|
||||
if ($data['tel_prefer'])
|
||||
{
|
||||
$prefer = $data['tel_prefer'];
|
||||
unset($data['tel_prefer']);
|
||||
if (($key = array_search($prefer,$data)) !== false && substr($key,0,4) === 'tel_')
|
||||
{
|
||||
$data['tel_prefer'] = $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['tel_prefer'] = $prefer;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -303,11 +336,14 @@ class boaddressbook
|
||||
* @param string $param['sort']='' sorting: ASC or DESC
|
||||
* @param string $param['order']='' column to order, default ('') n_family,n_given,email ASC
|
||||
* @param int $param['lastmod']=-1 return only values modified after given timestamp, default (-1) return all
|
||||
* @param string $param['cquery='' return only entries starting with given character, default ('') all
|
||||
* @param string $param['cquery']='' return only entries starting with given character, default ('') all
|
||||
* @param string $param['customfields']=true return the customfields too, default yes
|
||||
* @return array of contacts
|
||||
*/
|
||||
function search($param)
|
||||
{
|
||||
$read_customfields = !isset($param['customfields']) || $param['customfields'];
|
||||
|
||||
return $this->data2xmlrpc($this->contacts->old_read(
|
||||
(int) $param['start'],
|
||||
(int) $param['limit'],
|
||||
@ -318,11 +354,11 @@ class boaddressbook
|
||||
$param['order'],
|
||||
$param['lastmod'] ? $param['lastmod'] : -1,
|
||||
$param['cquery']
|
||||
));
|
||||
),$read_customfields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read one contract
|
||||
* Read one contact
|
||||
*
|
||||
* @param mixed $id $id, $id[0] or $id['id'] contains the id of the contact
|
||||
* @return array contact
|
||||
|
@ -710,7 +710,7 @@ class uicontacts extends bocontacts
|
||||
'col_filter' => array('tid' => $query['col_filter']['tid']),
|
||||
'org_view' => $query['org_view'],
|
||||
));
|
||||
if ($state != $this->prefs['index_state'])
|
||||
if ($state != $this->prefs[$do_email ? 'email_state' : 'index_state'])
|
||||
{
|
||||
$GLOBALS['egw']->preferences->add('addressbook',$do_email ? 'email_state' : 'index_state',$state);
|
||||
// save prefs, but do NOT invalid the cache (unnecessary)
|
||||
@ -821,9 +821,11 @@ class uicontacts extends bocontacts
|
||||
}
|
||||
$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 the custom fields
|
||||
if (!$id_only && $this->prefs['custom_colum'] != 'never' && $rows && $this->customfields)
|
||||
|
||||
// do we need to read the custom fields, depends on the column is enabled and customfields exist
|
||||
$columselection = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows'];
|
||||
if ($columselection) $columselection = explode(',',$columselection);
|
||||
if (!$id_only && (!$columselection || in_array('customfields',$columselection)) && $rows && $this->customfields)
|
||||
{
|
||||
foreach((array) $rows as $n => $val)
|
||||
{
|
||||
@ -943,7 +945,7 @@ class uicontacts extends bocontacts
|
||||
if (!$homeaddress) $rows['no_home'] = true;
|
||||
}
|
||||
// disable customfields column, if we have no customefield(s)
|
||||
if (!$customfields) $rows['no_customfields'] = true;
|
||||
if (!$this->customfields || !$this->prefs['no_auto_hide'] && !$customfields) $rows['no_customfields'] = true;
|
||||
|
||||
$rows['order'] = $order;
|
||||
$rows['call_popup'] = $this->config['call_popup'];
|
||||
|
@ -267,6 +267,9 @@
|
||||
{
|
||||
$value['template'] =& new etemplate($value['template'],$tmpl->as_array());
|
||||
}
|
||||
$extension_data['template'] = $value['template']->name; // used for the column-selection, and might be set in get_rows()
|
||||
$extension_data['columnselection_pref'] = $value['columnselection_pref'];
|
||||
|
||||
if ($total < 1 && $value['template']->rows > 1)
|
||||
{
|
||||
$value['template']->data[0]['h'.$value['template']->rows] .= ',1'; // disable the last data row
|
||||
|
@ -550,7 +550,7 @@
|
||||
$this->t->set_var('lang_max_uploadsize',lang('max uploadsize'));
|
||||
$this->t->set_var('lang_adding_file_please_wait',lang('Adding file to message. Please wait!'));
|
||||
$this->t->set_var('lang_receive_notification',lang('Receive notification'));
|
||||
|
||||
$this->t->set_var('lang_no_address_set',lang('can not send message. no recipient defined!'));
|
||||
|
||||
$this->t->set_var("th_bg",$GLOBALS['egw_info']["theme"]["th_bg"]);
|
||||
$this->t->set_var("bg01",$GLOBALS['egw_info']["theme"]["bg01"]);
|
||||
|
@ -548,3 +548,21 @@ function fm_blink_currentInputField() {
|
||||
window.setTimeout("currentInputField.style.border = '1px solid #666666'", 200);
|
||||
window.setTimeout("currentInputField.style.border = ''", 450);
|
||||
}
|
||||
|
||||
function fm_compose_sendEMail() {
|
||||
var addressTable = document.getElementById('addressRows').rows;
|
||||
var addressSet = false;
|
||||
|
||||
for (i=0; i<addressTable.length; i++) {
|
||||
if(addressTable.item(i).cells[2].firstChild.value != '') {
|
||||
addressSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(addressSet == true) {
|
||||
document.doit.submit();
|
||||
} else {
|
||||
alert(fm_compose_langNoAddressSet);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
var composeID ="{compose_id}";
|
||||
|
||||
var activityImagePath = '{ajax-loader}';
|
||||
|
||||
var fm_compose_langNoAddressSet = '{lang_no_address_set}';
|
||||
|
||||
self.focus();
|
||||
|
||||
@ -203,12 +203,8 @@
|
||||
<button type="button" onclick="fm_compose_selectFolder();" title="{lang_select_folder}" style="border: solid #aaaaaa 1px; border-right: solid black 1px; border-bottom: solid black 1px; font-size:9px; font-weight:bold; height:15px; width:20px; line-height:14px; text-align:center; cursor: pointer;">...</button>
|
||||
</span>
|
||||
</td>
|
||||
<td align="left" valign="bottom" sstyle="width:455px;">
|
||||
<input class="input_text" onkeypress="return disabledKeyCodes(disabledKeys1);" autocomplete="off" type=text style="width:99%;" name="address[]" value="{address}" onfocus="initResultBox(this)" onblur="stopCapturingEvents()">
|
||||
</td>
|
||||
<td style="width:25px;" valign="bottom">
|
||||
<div class="divButton" style="background-image: url({img_clear_left});" onclick="deleteTableRow(this);" title="{lang_remove}"></div>
|
||||
</td>
|
||||
<td align="left" valign="bottom"><input class="input_text" onkeypress="return disabledKeyCodes(disabledKeys1);" autocomplete="off" type=text style="width:99%;" name="address[]" value="{address}" onfocus="initResultBox(this)" onblur="stopCapturingEvents()"></td>
|
||||
<td style="width:25px;" valign="bottom"><div class="divButton" style="background-image: url({img_clear_left});" onclick="deleteTableRow(this);" title="{lang_remove}"></div></td>
|
||||
</tr>
|
||||
<!-- END destination_row -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user