merge from trunk(revision 23943:23948) to 1.4 branch

This commit is contained in:
Lars Kneschke 2007-05-26 18:45:08 +00:00
parent f32da9bdc0
commit 144faf15ff
6 changed files with 73 additions and 18 deletions

View File

@ -179,16 +179,30 @@ class boaddressbook
* *
* @internal * @internal
* @param array $datas array of contact arrays * @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 * @return array
*/ */
function data2xmlrpc($datas) function data2xmlrpc($datas,$read_customfields=false)
{ {
if(is_array($datas)) 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) foreach($datas as $n => $nul)
{ {
$data =& $datas[$n]; // $n => &$data is php5 ;-) $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 // remove empty or null elements, they dont need to be transfered
$data = array_diff($data,array('',null)); $data = array_diff($data,array('',null));
@ -213,6 +227,11 @@ class boaddressbook
{ {
$data['cat_id'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$data['cat_id'])); $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 // translate fieldnames if required
foreach($this->mapping as $from => $to) foreach($this->mapping as $from => $to)
{ {
@ -286,6 +305,20 @@ class boaddressbook
$cats = $GLOBALS['server']->xmlrpc2cats($data['cat_id']); $cats = $GLOBALS['server']->xmlrpc2cats($data['cat_id']);
$data['cat_id'] = count($cats) > 1 ? ','.implode(',',$cats).',' : (int)$cats[0]; $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; return $data;
} }
@ -303,11 +336,14 @@ class boaddressbook
* @param string $param['sort']='' sorting: ASC or DESC * @param string $param['sort']='' sorting: ASC or DESC
* @param string $param['order']='' column to order, default ('') n_family,n_given,email ASC * @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 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 * @return array of contacts
*/ */
function search($param) function search($param)
{ {
$read_customfields = !isset($param['customfields']) || $param['customfields'];
return $this->data2xmlrpc($this->contacts->old_read( return $this->data2xmlrpc($this->contacts->old_read(
(int) $param['start'], (int) $param['start'],
(int) $param['limit'], (int) $param['limit'],
@ -318,11 +354,11 @@ class boaddressbook
$param['order'], $param['order'],
$param['lastmod'] ? $param['lastmod'] : -1, $param['lastmod'] ? $param['lastmod'] : -1,
$param['cquery'] $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 * @param mixed $id $id, $id[0] or $id['id'] contains the id of the contact
* @return array contact * @return array contact

View File

@ -710,7 +710,7 @@ class uicontacts extends bocontacts
'col_filter' => array('tid' => $query['col_filter']['tid']), 'col_filter' => array('tid' => $query['col_filter']['tid']),
'org_view' => $query['org_view'], '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); $GLOBALS['egw']->preferences->add('addressbook',$do_email ? 'email_state' : 'index_state',$state);
// save prefs, but do NOT invalid the cache (unnecessary) // save prefs, but do NOT invalid the cache (unnecessary)
@ -822,8 +822,10 @@ class uicontacts extends bocontacts
$rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'],$id_only, $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']); $order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']);
// do we need the custom fields // do we need to read the custom fields, depends on the column is enabled and customfields exist
if (!$id_only && $this->prefs['custom_colum'] != 'never' && $rows && $this->customfields) $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) foreach((array) $rows as $n => $val)
{ {
@ -943,7 +945,7 @@ class uicontacts extends bocontacts
if (!$homeaddress) $rows['no_home'] = true; if (!$homeaddress) $rows['no_home'] = true;
} }
// disable customfields column, if we have no customefield(s) // 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['order'] = $order;
$rows['call_popup'] = $this->config['call_popup']; $rows['call_popup'] = $this->config['call_popup'];

View File

@ -267,6 +267,9 @@
{ {
$value['template'] =& new etemplate($value['template'],$tmpl->as_array()); $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) if ($total < 1 && $value['template']->rows > 1)
{ {
$value['template']->data[0]['h'.$value['template']->rows] .= ',1'; // disable the last data row $value['template']->data[0]['h'.$value['template']->rows] .= ',1'; // disable the last data row

View File

@ -550,7 +550,7 @@
$this->t->set_var('lang_max_uploadsize',lang('max uploadsize')); $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_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_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("th_bg",$GLOBALS['egw_info']["theme"]["th_bg"]);
$this->t->set_var("bg01",$GLOBALS['egw_info']["theme"]["bg01"]); $this->t->set_var("bg01",$GLOBALS['egw_info']["theme"]["bg01"]);

View File

@ -548,3 +548,21 @@ function fm_blink_currentInputField() {
window.setTimeout("currentInputField.style.border = '1px solid #666666'", 200); window.setTimeout("currentInputField.style.border = '1px solid #666666'", 200);
window.setTimeout("currentInputField.style.border = ''", 450); 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);
}
}

View File

@ -5,7 +5,7 @@
var composeID ="{compose_id}"; var composeID ="{compose_id}";
var activityImagePath = '{ajax-loader}'; var activityImagePath = '{ajax-loader}';
var fm_compose_langNoAddressSet = '{lang_no_address_set}';
self.focus(); 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> <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> </span>
</td> </td>
<td align="left" valign="bottom" sstyle="width:455px;"> <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>
<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 style="width:25px;" valign="bottom"><div class="divButton" style="background-image: url({img_clear_left});" onclick="deleteTableRow(this);" title="{lang_remove}"></div></td>
</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> </tr>
<!-- END destination_row --> <!-- END destination_row -->