extended email-addressbook to be able to insert a complete selection into To, Cc or Bcc, eg. to use a categorie as mailinglist

This commit is contained in:
Ralf Becker 2003-11-03 00:29:11 +00:00
parent 6486998106
commit cde51aa8dd
4 changed files with 140 additions and 40 deletions

View File

@ -44,15 +44,17 @@
'bcc' => lang('Bcc'),
'lang_email' => lang('Select work email address'),
'lang_hemail' => lang('Select home email address'),
'lang_to_title' => lang('Select all %1 %2 for %3')
));
$start = intval(get_var('start',array('POST','GET'),0));
$filter = get_var('filter',array('POST','GET'),'none');
$cat_id = intval(get_var('cat_id',array('POST','GET'),0));
$query = get_var('query',array('POST','GET'));
$sort = get_var('sort',array('POST','GET'));
$order = get_var('order',array('POST','GET'));
list($all) = @each($_POST['all']);
$inserted = $_GET['inserted'];
$common_vars = array(
'filter' => $filter,
@ -63,9 +65,10 @@
);
$link = '/phpgwapi/addressbook.php';
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link($link,$common_vars+array(
$full_link = $GLOBALS['phpgw']->link($link,$common_vars+array(
'start' => $start,
)));
));
$GLOBALS['phpgw']->template->set_var('form_action',$full_link);
$qfilter = 'tid=n';
switch($filter)
@ -110,8 +113,21 @@
'email_home' => 'email_home'
);
$entries = $contacts->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
if ($all)
{
$qfilter .= ',email'.($all[0] == 'h' ? '_home' : '')."=!''";
$entries = $contacts->read(0,0,$cols,$query,$qfilter,$sort,$order,$account_id);
//echo "<pre>".print_r($entries,True)."</pre>\n";
if (!$entries)
{
$all = False;
$inserted = 0;
}
}
if (!$all)
{
$entries = $contacts->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
}
//------------------------------------------- nextmatch --------------------------------------------
$GLOBALS['phpgw']->template->set_var('left',$GLOBALS['phpgw']->nextmatchs->left(
$link,$start,$contacts->total_records,'&'.explode('&',$common_vars)));
@ -140,6 +156,22 @@
}
// --------------------------------------- end nextmatch ------------------------------------------
foreach(array(
'work' => lang('work email'),
'home' => lang('home email')
) as $type => $lang_type)
{
foreach(array(
'to' => lang('To'),
'cc' => lang('Cc'),
'bcc'=> lang('Bcc')) as $target => $lang_target)
{
$GLOBALS['phpgw']->template->set_var('title_'.$type.'_'.$target,
lang('Insert all %1 addresses of the %2 contacts in %3',$lang_type,
$contacts->total_records,$lang_target));
}
}
// ------------------- list header variable template-declaration -----------------------
$GLOBALS['phpgw']->template->set_var('cats_list',$cats->formated_list('select','all',$cat_id,'True'));
@ -158,23 +190,25 @@
));
// --------------------------- end header declaration ----------------------------------
for ($i=0;$i<count($entries);$i++)
$all_emails = array();
if ($entries)
foreach ($entries as $entry)
{
$GLOBALS['phpgw']->template->set_var('tr_class',
$GLOBALS['phpgw']->nextmatchs->alternate_row_color('',True));
$firstname = $entries[$i]['n_given'];
$firstname = $entry['n_given'];
if (!$firstname)
{
$firstname = '&nbsp;';
}
$lastname = $entries[$i]['n_family'];
$lastname = $entry['n_family'];
if (!$lastname)
{
$lastname = '&nbsp;';
}
// thanks to dave.hall@mbox.com.au for adding company
$company = $entries[$i]['org_name'];
$company = $entry['org_name'];
if (!$company)
{
$company = '&nbsp;';
@ -200,50 +234,81 @@
if (($personal_part == '') ||
($include_personal == False))
{
$id = $entries[$i]['id'];
$email = $entries[$i]['email'];
$hemail = $entries[$i]['email_home'];
$id = $entry['id'];
$email = $entry['email'];
$hemail = $entry['email_home'];
}
else
{
$id = $entries[$i]['id'];
if ((isset($entries[$i]['email'])) &&
(trim($entries[$i]['email']) != ''))
$id = $entry['id'];
if ((isset($entry['email'])) &&
(trim($entry['email']) != ''))
{
$email = '&quot;'.$personal_part.'&quot; &lt;'.$entries[$i]['email'].'&gt;';
$email = '"'.$personal_part.'" <'.$entry['email'].'>';
}
else
{
$email = $entries[$i]['email'];
$email = $entry['email'];
}
if ((isset($entries[$i]['email_home'])) &&
(trim($entries[$i]['email_home']) != ''))
if ((isset($entry['email_home'])) &&
(trim($entry['email_home']) != ''))
{
$hemail = '&quot;'.$personal_part.'&quot; &lt;'.$entries[$i]['email_home'].'&gt;';
$hemail = '"'.$personal_part.'" <'.$entry['email_home'].'>';
}
else
{
$hemail = $entries[$i]['email_home'];
$hemail = $entry['email_home'];
}
}
// --------------------- template declaration for list records --------------------------
$GLOBALS['phpgw']->template->set_var(array(
'firstname' => $firstname,
'lastname' => $lastname,
'company' => $company
));
if ($all)
{
$all_emails[] = $all[0] == 'h' ? $hemail : $email;
}
else
{
$email = htmlspecialchars($email);
$hemail = htmlspecialchars($hemail);
$GLOBALS['phpgw']->template->set_var('id',$id);
$GLOBALS['phpgw']->template->set_var('email',$email);
$GLOBALS['phpgw']->template->set_var('hemail',$hemail);
// --------------------- template declaration for list records --------------------------
$GLOBALS['phpgw']->template->set_var(array(
'firstname' => $firstname,
'lastname' => $lastname,
'company' => $company
));
$GLOBALS['phpgw']->template->parse('list','addressbook_list',True);
$GLOBALS['phpgw']->template->set_var('id',$id);
$GLOBALS['phpgw']->template->set_var('email',$email);
$GLOBALS['phpgw']->template->set_var('hemail',$hemail);
$GLOBALS['phpgw']->template->parse('list','addressbook_list',True);
}
}
// --------------------------- end record declaration ---------------------------
$GLOBALS['phpgw']->template->parse('out','addressbook_list_t',True);
$GLOBALS['phpgw']->template->p('out');
if ($all && count($all_emails))
{
$full_link .= '&inserted='.count($all_emails);
$target = substr($all,1);
echo "<script type=\"text/javascript\">
if (opener.document.doit.$target.value != '')
{
opener.document.doit.$target.value += ',';
}
opener.document.doit.$target.value += '".str_replace("'","\\'",implode(',',$all_emails))."';
window.location.href = '$full_link';
</script>
</body>
</html>\n";
}
else
{
if ($inserted || $inserted === 0)
{
$GLOBALS['phpgw']->template->set_var('message','<b>'.
lang('%1 email addresses inserted',intval($_GET['inserted'])).'</b>');
}
$GLOBALS['phpgw']->template->parse('out','addressbook_list_t',True);
$GLOBALS['phpgw']->template->p('out');
}
$GLOBALS['phpgw']->common->phpgw_exit();
?>

View File

@ -1,3 +1,4 @@
%1 email addresses inserted common de %1 Email Adressen eingefügt
about %1 common de Über %1
access common de Zugriff
access not permitted common de Zugriff verweigert
@ -44,6 +45,7 @@ bahrain common de BAHRAIN
bangladesh common de BANGLADESH
barbados common de BARBADOS
based on common de Basierend auf
bcc common de Blindkopie
belarus common de BELORUSSLAND (WEISSRUSSLAND)
belgium common de BELGIEN
belize common de BELIZE
@ -72,6 +74,7 @@ category common de Kategorie
category %1 has been added ! common de Kategorie %1 wurde hinzugefügt !
category %1 has been updated ! common de Kategorie %1 wurde überarbeitet !
cayman islands common de KAIMAN INSELN
cc common de Kopie
central african republic common de ZENTRAL AFRIKANISCHE REPUBLIK
chad common de TSCHAD
change common de ändern
@ -87,6 +90,7 @@ close common de Schlie
cocos (keeling) islands common de COCOS INSELN
colombia common de KOLUMBIEN
comoros common de KOMOREN
company common de Unternehmen
congo common de KONGO
congo, the democratic republic of the common de KONGO, DIE DEMOKRATISCHE REPUBLIK DES
cook islands common de COOK INSELN
@ -131,6 +135,7 @@ edit common de Editieren
edit %1 category for common de %1 Kategorie editieren für
edit categories common de Kategorien editieren
edit category common de Kategorie editieren
egroupware: login blocked for user '%1', ip %2 common de eGroupWare: Anmelden gesperrt für Benutzer '%1', IP %2
egypt common de ÄGYPTEN
el salvador common de EL SALVADOR
email common de E-Mail
@ -208,12 +213,14 @@ high common de Hoch
highest common de Höchste
holy see (vatican city state) common de VATICAN
home common de Home
home email common de private Email
honduras common de HONDURAS
hong kong common de HONG KONG
hungary common de UNGARN
iceland common de ISLAND
india common de INDIEN
indonesia common de INDONESIEN
insert all %1 addresses of the %2 contacts in %3 common de Alle %1 Adressen der %2 Kontakte in %3 einfügen
international common de International
invalid ip address common de Ungültige IP Adresse
invalid password common de Ungültiges Passwort
@ -412,8 +419,10 @@ select common de Ausw
select category common de Kategorie auswählen
select date common de Datum auswählen
select group common de Gruppe auswählen
select home email address common de private Email-Adresse auswählen
select one common de Einen auswählen
select user common de Benutzer auswählen
select work email address common de geschäftl. Email-Addresse auswählen
send common de Abschicken
senegal common de SENEGAL
september common de September
@ -423,6 +432,7 @@ session has been killed common de Session wurde gel
setup common de Setup
seychelles common de SEYCHELLEN
show all common de alle anzeigen
show all categorys common de Alle Kategorien anzeigen
showing %1 common de %1 Einträge
showing %1 - %2 of %3 common de %1 - %2 von %3 Einträgen
sierra leone common de SIERRA LEONE
@ -466,6 +476,7 @@ time common de Zeit
time zone common de Zeitzone
time zone offset common de Zeitzonen Differenz
title common de Titel
to common de An
to correct this error for the future you will need to properly set the common de Um diesen Fehler in der Zukunft zu verhindern, müssen sie folgendes setzen:
to go back to the msg list, click <a href= %1 >here</a> common de Um zur Liste der Meldungen zurück zu gehen, <a href="%1">hier</a> anklicken
today common de Heute
@ -474,6 +485,7 @@ toggle first day of week common de ersten Tag der Woche wechseln
togo common de TOGO
tokelau common de TOKELAU
tonga common de TONGA
too many unsucessful attempts to login: %1 for the user '%2', %3 for the ip %4 common de Zu viele ungültige Versuche sich anzumelden: %1 für den Benutzer '%2', %3 für die IP %4
total common de Gesamt
trinidad and tobago common de TRINIDAD AND TOBAGO
tuesday common de Dienstag
@ -516,6 +528,7 @@ welcome common de Willkommen
western sahara common de WEST SAHARA
which groups common de Welche Gruppen
wk common de KW
work email common de geschäftliche Email
written by common de Geschrieben von
written by: common de Geschrieben von:
year common de Jahr

View File

@ -1,3 +1,4 @@
%1 email addresses inserted common en %1 email addresses inserted
about %1 common en About %1
access common en Access
access not permitted common en Access not permitted
@ -43,6 +44,7 @@ bahamas common en BAHAMAS
bahrain common en BAHRAIN
bangladesh common en BANGLADESH
barbados common en BARBADOS
bcc common en Bcc
belarus common en BELARUS
belgium common en BELGIUM
belize common en BELIZE
@ -71,6 +73,7 @@ category common en Category
category %1 has been added ! common en Category %1 has been added !
category %1 has been updated ! common en Category %1 has been updated !
cayman islands common en CAYMAN ISLANDS
cc common en Cc
central african republic common en CENTRAL AFRICAN REPUBLIC
chad common en CHAD
change common en Change
@ -86,6 +89,7 @@ close common en Close
cocos (keeling) islands common en COCOS (KEELING) ISLANDS
colombia common en COLOMBIA
comoros common en COMOROS
company common en Company
congo common en CONGO
congo, the democratic republic of the common en CONGO, THE DEMOCRATIC REPUBLIC OF THE
cook islands common en COOK ISLANDS
@ -129,6 +133,7 @@ edit common en Edit
edit %1 category for common en Edit %1 category for
edit categories common en Edit Categories
edit category common en Edit category
egroupware: login blocked for user '%1', ip %2 common en eGroupWare: login blocked for user '%1', IP %2
egypt common en EGYPT
el salvador common en EL SALVADOR
email common en E-Mail
@ -205,12 +210,14 @@ high common en High
highest common en Highest
holy see (vatican city state) common en HOLY SEE (VATICAN CITY STATE)
home common en Home
home email common en home email
honduras common en HONDURAS
hong kong common en HONG KONG
hungary common en HUNGARY
iceland common en ICELAND
india common en INDIA
indonesia common en INDONESIA
insert all %1 addresses of the %2 contacts in %3 common en Insert all %1 addresses of the %2 contacts in %3
international common en International
invalid ip address common en Invalid IP address
invalid password common en Invalid password
@ -408,8 +415,10 @@ select common en Select
select category common en Select Category
select date common en Select date
select group common en Select group
select home email address common en Select home email address
select one common en Select one
select user common en Select user
select work email address common en Select work email address
send common en Send
senegal common en SENEGAL
september common en September
@ -419,6 +428,7 @@ session has been killed common en Session has been killed
setup common en Setup
seychelles common en SEYCHELLES
show all common en show all
show all categorys common en Show all categorys
showing %1 common en showing %1
showing %1 - %2 of %3 common en showing %1 - %2 of %3
sierra leone common en SIERRA LEONE
@ -462,6 +472,7 @@ time common en Time
time zone common en Timezone
time zone offset common en Time zone offset
title common en Title
to common en To
to correct this error for the future you will need to properly set the common en To correct this error for the future you will need to properly set the
to go back to the msg list, click <a href= %1 >here</a> common en To go back to the msg list, click <a href="%1">here</a>
today common en Today
@ -470,6 +481,7 @@ toggle first day of week common en Toggle first day of week
togo common en TOGO
tokelau common en TOKELAU
tonga common en TONGA
too many unsucessful attempts to login: %1 for the user '%2', %3 for the ip %4 common en Too many unsucessful attempts to login: %1 for the user '%2', %3 for the IP %4
total common en Total
trinidad and tobago common en TRINIDAD AND TOBAGO
tuesday common en Tuesday
@ -512,6 +524,7 @@ welcome common en Welcome
western sahara common en WESTERN SAHARA
which groups common en Which groups
wk common en wk
work email common en work email
written by: common en Written by:
year common en Year
yemen common en YEMEN

View File

@ -35,6 +35,7 @@
}
</script>
<div id="divMain">
<p align="center">{message}</p>
<p align="center">{lang_showing}<br>
<table border="0" width="100%">
<tr valign="top">
@ -62,12 +63,20 @@
<td width="40%" colspan="2">
{sort_org_name}
</td>
<form action="{form_action}" name="form" method="POST">
<td width="30%" align="center" rowspan="2">
{lang_email}
{lang_email}<br>
<input type="submit" name="all[wto]" value="{to}" title="{title_work_to}">
<input type="submit" name="all[wcc]" value="{cc}" title="{title_work_cc}">
<input type="submit" name="all[wbcc]" value="{bcc}" title="{title_work_bcc}">
</td>
<td width="30%" align="center" rowspan="2">
{lang_hemail}
{lang_hemail}<br>
<input type="submit" name="all[hto]" value="{to}" title="{title_home_to}">
<input type="submit" name="all[hcc]" value="{cc}" title="{title_home_cc}">
<input type="submit" name="all[hbcc]" value="{bcc}" title="{title_home_bcc}">
</td>
</form>
</tr>
<tr class="th">
<td>{sort_n_family}</td>
@ -88,9 +97,9 @@
<form>
<td align="center" rowspan="2">
<input type="text" style="width: 100%" name="hemail" value="{hemail}"><br>
<input type="button" name="h_to" value="{to}" onClick="ExchangeTo(this.form);">
<input type="button" name="h_cc" value="{cc}" onClick="ExchangeCc(this.form);">
<input type="button" name="h_bcc" value="{bcc}" onClick="ExchangeBcc(this.form);">
<input type="button" name="hto" value="{to}" onClick="ExchangeTo(this.form);">
<input type="button" name="hcc" value="{cc}" onClick="ExchangeCc(this.form);">
<input type="button" name="hbcc" value="{bcc}" onClick="ExchangeBcc(this.form);">
</td>
</form>
</tr>