using the new url, email, phone widget

This commit is contained in:
Ralf Becker 2008-06-11 07:17:30 +00:00
parent c0ec512113
commit c350dddc9b
4 changed files with 37 additions and 73 deletions

View File

@ -1010,33 +1010,16 @@ class addressbook_ui extends addressbook_bo
{ {
$this->type_icon($row['owner'],$row['private'],$row['tid'],$row['type'],$row['type_label']); $this->type_icon($row['owner'],$row['private'],$row['tid'],$row['type'],$row['type_label']);
static $tel2show = array('tel_work','tel_cell','tel_home'); static $tel2show = array('tel_work','tel_cell','tel_home','tel_fax');
foreach($tel2show as $name) foreach($tel2show as $name)
{ {
$this->call_link($row[$name],$row[$name.'_link']);
$row[$name] .= ' '.($row['tel_prefer'] == $name ? '♥' : ''); // .' ' to NOT remove the field $row[$name] .= ' '.($row['tel_prefer'] == $name ? '♥' : ''); // .' ' to NOT remove the field
} }
// allways show the prefered phone, if not already shown // allways show the prefered phone, if not already shown
if (!in_array($row['tel_prefer'],$tel2show) && $row[$row['tel_prefer']]) if (!in_array($row['tel_prefer'],$tel2show) && $row[$row['tel_prefer']])
{ {
$this->call_link($row[$row['tel_prefer']],$row['tel_prefered_link']);
$row['tel_prefered'] = $row[$row['tel_prefer']].' ♥'; $row['tel_prefered'] = $row[$row['tel_prefer']].' ♥';
} }
foreach(array('email','email_home') as $name)
{
if ($row[$name])
{
$row[$name.'_link'] = $this->email2link($row[$name]);
if ($GLOBALS['egw_info']['user']['apps']['felamimail'])
{
$row[$name.'_popup'] = '700x750';
}
}
else
{
$row[$name] = ' '; // to NOT remove the field
}
}
$readonlys["delete[$row[id]]"] = !$this->check_perms(EGW_ACL_DELETE,$row); $readonlys["delete[$row[id]]"] = !$this->check_perms(EGW_ACL_DELETE,$row);
$readonlys["edit[$row[id]]"] = !$this->check_perms(EGW_ACL_EDIT,$row); $readonlys["edit[$row[id]]"] = !$this->check_perms(EGW_ACL_EDIT,$row);
@ -1862,31 +1845,6 @@ $readonlys['button[vcard]'] = true;
} }
} }
/**
* returns link to call the given phonenumber
*
* replaces '%1' with the phonenumber to call, '%u' with the user's account_lid and '%t' with his work-phone-number
*
* @param string $number phone number
* @param string &$link returns the link
* @return boolean true if we have a link, false if not
*/
function call_link($number,&$link)
{
if (!$number || !$this->config['call_link']) return false;
static $userphone;
if (is_null($userphone))
{
$user = $this->read('account:'.$GLOBALS['egw_info']['user']['account_id']);
$userphone = is_array($user) ? ($user['tel_work'] ? $user['tel_work'] : $user['tel_home']) : false;
}
$number = str_replace(array(' ','(',')','/','-'),'',$number); // remove number formatting chars messing up the links
$link = str_replace(array('%1','%u','%t'),array(urlencode($number),$GLOBALS['egw_info']['user']['account_lid'],$userphone),
$this->config['call_link']);
}
function js() function js()
{ {
return '<script LANGUAGE="JavaScript"> return '<script LANGUAGE="JavaScript">

File diff suppressed because one or more lines are too long

View File

@ -380,7 +380,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="addressbook.editphones" template="" lang="" group="0" version="1.3.002"> <template id="addressbook.editphones" template="" lang="" group="0" version="1.5.001">
<grid class="editphones"> <grid class="editphones">
<columns> <columns>
<column/> <column/>
@ -400,27 +400,27 @@
</row> </row>
<row> <row>
<description value="business" options=",,,tel_work2" class="bold"/> <description value="business" options=",,,tel_work2" class="bold"/>
<textbox size="30" id="tel_work2"/> <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"/> <radio options="tel_work,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="mobile phone" options=",,,tel_cell2"/> <description value="mobile phone" options=",,,tel_cell2"/>
<textbox size="30" id="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"/> <radio options="tel_cell,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="fax" options=",,,tel_fax"/> <description value="fax" options=",,,tel_fax"/>
<textbox size="30" id="tel_fax2"/> <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"/> <radio options="tel_fax,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="car phone" options=",,,tel_car"/> <description value="car phone" options=",,,tel_car"/>
<textbox size="30" id="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"/> <radio options="tel_car,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="pager" options=",,,tel_pager"/> <description value="pager" options=",,,tel_pager"/>
<textbox size="30" id="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"/> <radio options="tel_pager,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
@ -432,7 +432,7 @@
</row> </row>
<row> <row>
<description value="number" options=",,,tel_assistent"/> <description value="number" options=",,,tel_assistent"/>
<textbox size="30" id="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"/> <radio options="tel_assistent,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
@ -440,17 +440,17 @@
</row> </row>
<row> <row>
<description value="Private" options=",,,tel_home2" class="bold"/> <description value="Private" options=",,,tel_home2" class="bold"/>
<textbox size="30" id="tel_home2"/> <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"/> <radio options="tel_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="mobile phone" options=",,,tel_cell_private"/> <description value="mobile phone" options=",,,tel_cell_private"/>
<textbox size="30" id="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"/> <radio options="tel_cell_private,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description value="fax" options=",,,tel_fax_home"/> <description value="fax" options=",,,tel_fax_home"/>
<textbox size="30" id="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"/> <radio options="tel_fax_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
@ -458,7 +458,7 @@
</row> </row>
<row> <row>
<description value=" Other Phone" options=",,,tel_other"/> <description value=" Other Phone" options=",,,tel_other"/>
<textbox size="30" id="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"/> <radio options="tel_other,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
@ -467,7 +467,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="addressbook.edit" template="" lang="" group="0" version="1.5.004"> <template id="addressbook.edit" template="" lang="" group="0" version="1.5.005">
<grid> <grid>
<columns> <columns>
<column width="450"/> <column width="450"/>
@ -535,25 +535,25 @@
<row> <row>
<image src="phone"/> <image src="phone"/>
<description value="business" options=",,,tel_work"/> <description value="business" options=",,,tel_work"/>
<textbox id="tel_work" size="24" maxlength="40" class="telNumbers"/> <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"/> <radio options="tel_work,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description/> <description/>
<description value="mobile phone" options=",,,tel_cell"/> <description value="mobile phone" options=",,,tel_cell"/>
<textbox id="tel_cell" size="24" maxlength="40" class="telNumbers"/> <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"/> <radio options="tel_cell,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description/> <description/>
<description value="Private" options=",,,tel_home"/> <description value="Private" options=",,,tel_home"/>
<textbox id="tel_home" size="24" maxlength="40" class="telNumbers"/> <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"/> <radio options="tel_home,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
<description/> <description/>
<description value="Fax"/> <description value="Fax"/>
<textbox id="tel_fax" size="24" maxlength="40" class="telNumbers"/> <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"/> <radio options="tel_fax,&amp;hearts;" id="tel_prefer" statustext="select phone number as prefered way of contact"/>
</row> </row>
<row> <row>
@ -577,22 +577,22 @@
<row> <row>
<image src="internet"/> <image src="internet"/>
<description value="url" options=",,,url"/> <description value="url" options=",,,url"/>
<textbox id="url" size="28" maxlength="128"/> <url id="url" options="28,128"/>
</row> </row>
<row> <row>
<description/> <description/>
<description options=",,,url_home" value="Private"/> <description options=",,,url_home" value="Private"/>
<textbox id="url_home" size="28" maxlength="128"/> <url id="url_home" options="28,128"/>
</row> </row>
<row> <row>
<image src="email.png"/> <image src="email.png"/>
<description value="email" options=",,,email"/> <description value="email" options=",,,email"/>
<textbox id="email" size="28" maxlength="128"/> <url-email id="email" options="28,128"/>
</row> </row>
<row> <row>
<description/> <description/>
<description value="Private" options=",,,email_home"/> <description value="Private" options=",,,email_home"/>
<textbox id="email_home" size="28" maxlength="128"/> <url-email id="email_home" options="28,128"/>
</row> </row>
</rows> </rows>
</grid> </grid>

View File

@ -14,7 +14,7 @@
</hbox> </hbox>
<styles>.rightPadAdd { width: 30px; }</styles> <styles>.rightPadAdd { width: 30px; }</styles>
</template> </template>
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.5.005"> <template id="addressbook.index.rows" template="" lang="" group="0" version="1.5.006">
<grid width="100%"> <grid width="100%">
<columns> <columns>
<column/> <column/>
@ -134,16 +134,16 @@
<description id="${row}[adr_two_street2]" no_lang="1"/> <description id="${row}[adr_two_street2]" no_lang="1"/>
</vbox> </vbox>
<vbox options="0,0"> <vbox options="0,0">
<description no_lang="1" id="${row}[tel_work]" class="telNumbers" options=",$row_cont[tel_work_link],,,calling,$cont[call_popup]"/> <url-phone id="${row}[tel_work]" class="telNumbers" readonly="true"/>
<description id="${row}[tel_cell]" no_lang="1" class="telNumbers" options=",$row_cont[tel_cell_link],,,calling,$cont[call_popup]"/> <url-phone id="${row}[tel_cell]" class="telNumbers" readonly="true"/>
<description id="${row}[tel_home]" no_lang="1" class="telNumbers" options=",$row_cont[tel_home_link],,,calling,$cont[call_popup]"/> <url-phone id="${row}[tel_home]" class="telNumbers" readonly="true"/>
<description id="${row}[tel_fax]" no_lang="1"/> <url-phone id="${row}[tel_fax]" readonly="true"/>
<description id="${row}[tel_prefered]" no_lang="1" options=",$row_cont[tel_prefered_link],,,calling,$cont[call_popup]"/> <description id="${row}[tel_prefered]" no_lang="1" options=",$row_cont[tel_prefered_link],,,calling,$cont[call_popup]"/>
</vbox> </vbox>
<vbox options="0,0"> <vbox options="0,0">
<description options=",,1" class="fixedHeight" no_lang="1" id="${row}[url]"/> <url class="fixedHeight" id="${row}[url]" readonly="true"/>
<description options=",@${row}[email_link],,,_blank,$row_cont[email_popup]" class="fixedHeight" id="${row}[email]" no_lang="1"/> <url-email class="fixedHeight" id="${row}[email]" readonly="true"/>
<description options=",@${row}[email_home_link],,,_blank,$row_cont[email_home_popup]" class="fixedHeight" id="${row}[email_home]" no_lang="1"/> <url-email class="fixedHeight" id="${row}[email_home]" readonly="true"/>
</vbox> </vbox>
<customfields-list rows="1" cols="1" id="$row" class="customfields"/> <customfields-list rows="1" cols="1" id="$row" class="customfields"/>
<description id="${row}[distrib_lists]"/> <description id="${row}[distrib_lists]"/>