diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index 10fe79703f..e3b80d7f06 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -184,7 +184,13 @@ class uicontacts extends bocontacts 'vcard' => lang('Export as VCard'), // ToDo: move this to importexport framework // 'export' => lang('Export selection'), // ToDo: 'copy' => lang('Copy a contact and edit the copy'), - )+$this->get_addressbooks(EGW_ACL_ADD); + ); + if ($do_email) + { + $sel_options['action']['email'] = lang('Add %1',lang('business email')); + $sel_options['action']['email_home'] = lang('Add %1',lang('home email')); + } + $sel_options['action'] += $this->get_addressbooks(EGW_ACL_ADD); if (!array_key_exists('importexport',$GLOBALS['egw_info']['user']['apps'])) unset($sel_options['action']['export']); @@ -342,14 +348,13 @@ class uicontacts extends bocontacts $Ok = false; break; } - foreach($checked as $id) { switch($action) { case 'delete': $action_msg = lang('deleted'); - if (($Ok = ($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact))) + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact))) { if ($contact['owner']) // regular contact { @@ -370,6 +375,18 @@ class uicontacts extends bocontacts } } break; + + case 'email': + case 'email_home': + $action_msg = lang('%1 added',$action=='email'?lang('Business email') : lang('Home email')); + if (($Ok = !!($contact = $this->read($id)) && strstr($contact[$action],'@'))) + { + if(!@is_object($GLOBALS['egw']->js)) $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); + + $GLOBALS['egw']->js->set_onload("addEmail('".addslashes( + $contact['n_fn'] ? $contact['n_fn'].' <'.$contact[$action].'>' : $contact[$action])."');"); + } + break; default: // move to an other addressbook if (!is_numeric($action) || !($this->grants[(string) (int) $action] & EGW_ACL_EDIT)) // might be ADD in the future @@ -377,7 +394,7 @@ class uicontacts extends bocontacts return false; } $action_msg = lang('moved'); - if (($OK = ($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact))) + if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact))) { if (!$contact['owner']) // no mass-change of accounts { @@ -396,7 +413,7 @@ class uicontacts extends bocontacts { ++$success; } - else + elseif ($action != 'email' && $action != 'email_home') { ++$failed; } @@ -416,8 +433,10 @@ class uicontacts extends bocontacts */ function get_rows(&$query,&$rows,&$readonlys,$id_only=false) { - $do_email = $query['do_email']; - + if (($do_email=$query['do_email']) && $GLOBALS['egw_info']['etemplate']['loop'] && is_object($GLOBALS['egw']->js)) + { // remove previous addEmail() calls, otherwise they will be run again + $GLOBALS['egw']->js->body['onLoad'] = preg_replace('/addEmail\([^)]+\);/','',$GLOBALS['egw']->js->body['onLoad']); + } //echo "

uicontacts::get_rows(".print_r($query,true).")

\n"; if (!$id_only) { @@ -451,7 +470,7 @@ class uicontacts extends bocontacts )); if ($state != $this->prefs['index_state']) { - $GLOBALS['egw']->preferences->add('addressbook',$do_mail ? '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) $GLOBALS['egw']->preferences->save_repository(false,'user',false); } diff --git a/addressbook/setup/phpgw_de.lang b/addressbook/setup/phpgw_de.lang index 5eed19759a..af4e8e3699 100644 --- a/addressbook/setup/phpgw_de.lang +++ b/addressbook/setup/phpgw_de.lang @@ -1,3 +1,4 @@ +%1 added addressbook de %1 hinzugefügt %1 contact(s) %2 addressbook de %1 Kontakt(e) %2 %1 contact(s) %2, %3 failed because of insufficent rights !!! addressbook de %1 Kontakt(e) %2, %3 nicht wegen fehlender Rechte !!! %1 fields in %2 other organisation member(s) changed addressbook de %1 Felder in %2 Mitglied(ern) der Organisation geändert @@ -10,6 +11,7 @@ account repository admin de Speicherort für Benutzerkonten accounts addressbook de Benutzerkonten actions addressbook de Befehle +add %1 addressbook de %1 hinzufügen add a contact to this organisation addressbook de Einen Kontakt zu dieser Organisation hinzufügen add a new contact addressbook de Neuen Kontakt anlegen add a single entry by passing the fields. addressbook de Hinzufügen eines einzelnen Eintrags durch Übergeben der Felder. @@ -119,6 +121,7 @@ export as vcard addressbook de Exportieren als VCard export contacts addressbook de Kontakte exportieren export file name addressbook de Dateiname zum Exportieren export from addressbook addressbook de Export vom Adressbuch +export selection addressbook de Auswahl exportieren exported addressbook de exportiert extra addressbook de Extra failed to change %1 organisation member(s) (insufficent rights) !!! addressbook de %1 Mitglied(er) der Organisation nicht geändert (fehlende Rechte) !!! diff --git a/addressbook/setup/phpgw_en.lang b/addressbook/setup/phpgw_en.lang index 644c805f12..5fb16c120e 100644 --- a/addressbook/setup/phpgw_en.lang +++ b/addressbook/setup/phpgw_en.lang @@ -1,3 +1,4 @@ +%1 added addressbook en %1 added %1 contact(s) %2 addressbook en %1 contact(s) %2 %1 contact(s) %2, %3 failed because of insufficent rights !!! addressbook en %1 contact(s) %2, %3 failed because of insufficent rights !!! %1 fields in %2 other organisation member(s) changed addressbook en %1 fields in %2 other organisation member(s) changed @@ -10,6 +11,7 @@ account repository admin en Account repository accounts addressbook en Accounts actions addressbook en Actions +add %1 addressbook en Add %1 add a contact to this organisation addressbook en Add a contact to this organisation add a new contact addressbook en Add a new contact add a single entry by passing the fields. addressbook en Add a single entry by passing the fields. @@ -119,6 +121,7 @@ export as vcard addressbook en Export as VCard export contacts addressbook en Export Contacts export file name addressbook en Export file name export from addressbook addressbook en Export from Addressbook +export selection addressbook en Export selection exported addressbook en exported extra addressbook en Extra failed to change %1 organisation member(s) (insufficent rights) !!! addressbook en failed to change %1 organisation member(s) (insufficent rights) !!!