From 381d421466c63eb2ee2e32b04e2299f6a719e6cd Mon Sep 17 00:00:00 2001
From: Ralf Becker addressbook_contactform::display($content,$addressbook,".print_r($fields,true).",$msg) '.$content['msg'].'
'.$content['msg'].'
'; + } + else + { + return ''.lang('There was an error saving your data :-(').'
'.
+ lang('Either the configured email addesses are wrong or the mail configuration.').'
addressbook_tracking::get_config($name,".print_r($data,true).",...)
\n"; + switch($name) + { + case 'copy': + if ($data['is_contactform']) + { + return split(', ?',$data['email_contactform']); + } + break; + + case 'sender': + if ($data['is_contactform']) + { + //echo "addressbook_tracking::get_config($name,...) email={$data['email']}, n_given={$data['n_given']}, n_family={$data['n_family']}
\n"; + return $data['email'] ? $data['n_given'].' '.$data['n_family'].' <'.$data['email'].'>' : null; + } + break; + } + return null; + } + + /** + * Get the modified / new message (1. line of mail body) for a given entry, can be reimplemented + * + * @param array $data + * @param array $old + * @return string + */ + function get_message($data,$old) + { + if (!$data['modified'] || !$old) + { + return lang('New contact submitted by %1 at %2', + $GLOBALS['egw']->common->grab_owner_name($data['creator']), + $this->datetime($data['created']-$this->tracker->tz_offset_s)); + } + return lang('Contact modified by %1 at %2', + $GLOBALS['egw']->common->grab_owner_name($data['modifier']), + $this->datetime($data['modified']-$this->tracker->tz_offset_s)); + } + + /** + * Get the subject of the notification + * + * @param array $data + * @param array $old + * @return string + */ + function get_subject($data,$old) + { + if ($data['is_contactform']) + { + $prefix = ($data['subject_contactform'] ? $data['subject_contactform'] : lang('Contactform')).': '; + } + return $prefix.parent::get_subject($data,$old); + } + + /** + * Get the details of an entry + * + * @param array $data + * @param string $datetime_format of user to notify, eg. 'Y-m-d H:i' + * @param int $tz_offset_s offset in sec to be add to server-time to get the user-time of the user to notify + * @return array of details as array with values for keys 'label','value','type' + */ + function get_details($data) + { + foreach($this->contacts->contact_fields as $name => $label) + { + if (!$data[$name] && $name != 'owner') continue; + + switch($name) + { + case 'n_prefix': case 'n_given': case 'n_middle': case 'n_family': case 'n_suffix': // already in n_fn + case 'tid': + break; + case 'created': case 'modified': + $details[$name] = array( + 'label' => $label, + 'value' => $this->datetime($data[$name]-$this->contacts->tz_offset_s), + ); + break; + case 'bday': + if ($data[$name]) + { + list($y,$m,$d) = explode('-',$data[$name]); + $details[$name] = array( + 'label' => $label, + 'value' => $GLOBALS['egw']->common->dateformatorder($y,$m,$d,true), + ); + } + break; + case 'owner': case 'creator': case 'modifier': + $details[$name] = array( + 'label' => $label, + 'value' => $GLOBALS['egw']->common->grab_owner_name($data[$name]), + ); + break; + case 'cat_id': + if ($data[$name]) + { + $cats = array(); + foreach(is_array($data[$name]) ? $data[$name] : explode(',',$data[$name]) as $cat_id) + { + $cats[] = $GLOBALS['egw']->cats->id2name($cat_id); + } + $details[$name] = array( + 'label' => $label, + 'value' => explode(', ',$cats), + ); + } + case 'note': + $details[$name] = array( + 'label' => $label, + 'value' => $data[$name], + 'type' => 'multiline', + ); + break; + default: + $details[$name] = array( + 'label' => $label, + 'value' => $data[$name], + ); + break; + } + } + return $details; + } +} \ No newline at end of file diff --git a/addressbook/setup/phpgw_de.lang b/addressbook/setup/phpgw_de.lang index 9b3f327b8f..56cd6754c6 100644 --- a/addressbook/setup/phpgw_de.lang +++ b/addressbook/setup/phpgw_de.lang @@ -80,6 +80,7 @@ contact copied addressbook de Kontakt kopiert contact deleted addressbook de Kontakt gelöscht contact fields to show addressbook de Kontaktfelder die angezeigt werden sollen contact id addressbook de Kontakt ID +contact modified by %1 at %2 addressbook de Kontakt geändert von %1 am %2 contact repository admin de Speicherort Kontakte contact saved addressbook de Kontakt gespeichert contact settings admin de Kontakt Einstellungen @@ -97,6 +98,7 @@ credit addressbook de Darlehen csv-fieldname addressbook de CSV-Feldname csv-filename addressbook de CSV-Dateiname custom addressbook de Benutzerdefiniert +custom etemplate for the contactform addressbook de Eigenes eTemplate für das Kontaktformular custom fields addressbook de Benutzerdefinierte Felder debug output in browser addressbook de Debugausgaben in Browser default address format addressbook de Vorgabe für Format der Adresse @@ -125,7 +127,9 @@ edit custom field addressbook de Benutzerdefiniertes Feld bearbeiten edit custom fields admin de Benutzerdefinierte Felder bearbeiten edit extra account-data in the addressbook admin de Zusätzliche Benutzerdaten im Adressbuch bearbeiten. edit phonenumbers - addressbook de Telefonnummern bearbeiten +either the configured email addesses are wrong or the mail configuration. addressbook de Entweder die konfigurierte Email Adresse ist falsch oder die Mail Konfiguration. email & internet addressbook de E-Mail & Internet +email addresses (comma separated) to send the contact data addressbook de Email Adressen (Komma getrennt) zum Senden der Kontaktdaten empty for all addressbook de leer für alle enable an extra private addressbook addressbook de Privates Adressbuch einschalten enter the path to the exported file here addressbook de Bitte geben Sie den Pfad für die exportierte Datei an @@ -222,6 +226,7 @@ moved addressbook de verschoben multiple vcard addressbook de Mehrere VCards name for the distribution list addressbook de Name für die Verteilerliste name, address addressbook de Name, Adresse +new contact submitted by %1 at %2 addressbook de Neuer Kontakt eingetragen von %1 am %2 no vcard addressbook de Keine VCard number addressbook de Nummer number of records to read (%1) addressbook de Anzahl der einzulesenden Datensätze (%1) @@ -281,6 +286,7 @@ start admin de Starten startrecord addressbook de Startdatensatz state common de Bundesland street common de Straße +subject for email addressbook de Betreff der Email successfully imported %1 records into your addressbook. addressbook de %1 Kontakte wurden erfolgreich in Ihr Adressbuch importiert suffix addressbook de Zusatz tel home addressbook de Telefon privat @@ -332,6 +338,7 @@ you are not permittet to delete this contact addressbook de Sie haben nicht die you are not permittet to edit this contact addressbook de Sie haben nicht die Berechtigung diesen Kontakt zu bearbeiten you are not permittet to view this contact addressbook de Sie haben nicht die Berechtigung diesen Kontakt zu betrachen you can only use ldap as contact repository if the accounts are stored in ldap too! admin de Sie können LDAP nur dann zum Speichern von Kontakten verwenden, wenn die Benutzerkonten auch in LDAP gespeichert sind! +you can respond by visiting: addressbook de Link zum Anzeigen: you must select a vcard. (*.vcf) addressbook de Sie müssen eine VCard auswählen (*.vcf) you must select at least 1 column to display addressbook de Sie müssen mindestens eine Spalte zum Anzeigen auswählen you need to select a distribution list addressbook de Sie müssen eine Verteilerliste auswählen diff --git a/addressbook/setup/phpgw_en.lang b/addressbook/setup/phpgw_en.lang index 5742ee089b..b82485fca7 100644 --- a/addressbook/setup/phpgw_en.lang +++ b/addressbook/setup/phpgw_en.lang @@ -80,6 +80,7 @@ contact copied addressbook en Contact copied contact deleted addressbook en Contact deleted contact fields to show addressbook en Contact fields to show contact id addressbook en Contact ID +contact modified by %1 at %2 addressbook en Contact modified by %1 at %2 contact repository admin en Contact repository contact saved addressbook en Contact saved contact settings admin en Contact Settings @@ -97,6 +98,7 @@ credit addressbook en Credit csv-fieldname addressbook en CSV-Fieldname csv-filename addressbook en CSV-Filename custom addressbook en Custom +custom etemplate for the contactform addressbook en Custom eTemplate for the contactform custom fields addressbook en Custom Fields debug output in browser addressbook en Debug output in browser default address format addressbook en Default address format @@ -125,7 +127,9 @@ edit custom field addressbook en Edit Custom Field edit custom fields admin en Edit Custom Fields edit extra account-data in the addressbook admin en Edit extra account-data in the addressbook edit phonenumbers - addressbook en Edit Phonenumbers - +either the configured email addesses are wrong or the mail configuration. addressbook en Either the configured email addesses are wrong or the mail configuration. email & internet addressbook en Email & Internet +email addresses (comma separated) to send the contact data addressbook en Email addresses (comma separated) to send the contact data empty for all addressbook en empty for all enable an extra private addressbook addressbook en Enable an extra private addressbook enter the path to the exported file here addressbook en Enter the path to the exported file here @@ -222,6 +226,7 @@ moved addressbook en moved multiple vcard addressbook en Multiple VCard name for the distribution list addressbook en Name for the distribution list name, address addressbook en Name, Address +new contact submitted by %1 at %2 addressbook en New contact submitted by %1 at %2 no vcard addressbook en No VCard number addressbook en Number number of records to read (%1) addressbook en Number of records to read (%1) @@ -281,6 +286,7 @@ start admin en Start startrecord addressbook en Startrecord state common en State street common en Street +subject for email addressbook en Subject for email successfully imported %1 records into your addressbook. addressbook en Successfully imported %1 record(s) into your addressbook. suffix addressbook en Suffix tel home addressbook en tel home @@ -332,6 +338,7 @@ you are not permittet to delete this contact addressbook en You are not permitte you are not permittet to edit this contact addressbook en You are not permittet to edit this contact you are not permittet to view this contact addressbook en you are not permittet to view this contact you can only use ldap as contact repository if the accounts are stored in ldap too! admin en You can only use LDAP as contact repository if the accounts are stored in LDAP too! +you can respond by visiting: addressbook en To view it visit: you must select a vcard. (*.vcf) addressbook en You must select a vcard. (*.vcf) you must select at least 1 column to display addressbook en You must select at least 1 column to display you need to select a distribution list addressbook en You need to select a distribution list diff --git a/addressbook/sitemgr/class.module_addressbook_contactform.inc.php b/addressbook/sitemgr/class.module_addressbook_contactform.inc.php index 89ec10b928..d2990620ba 100644 --- a/addressbook/sitemgr/class.module_addressbook_contactform.inc.php +++ b/addressbook/sitemgr/class.module_addressbook_contactform.inc.php @@ -79,6 +79,17 @@ class module_addressbook_contactform extends sitemgr_module '' => lang('None'), )+$uicontacts->get_addressbooks(EGW_ACL_ADD) // add to not show the accounts! ), + 'arg4' => array( + 'type' => 'textfield', + 'label' => lang('Email addresses (comma separated) to send the contact data'), + 'params' => array('size' => 80), + ), + 'arg6' => array( + 'type' => 'textfield', + 'label' => lang('Subject for email'), + 'params' => array('size' => 80), + 'default' => lang('Contactform'), + ), 'arg2' => array( 'type' => 'select', 'label' => lang('Contact fields to show'), @@ -93,6 +104,12 @@ class module_addressbook_contactform extends sitemgr_module 'params' => array('size' => 80), 'default' => lang('Thank you for contacting us.'), ), + 'arg5' => array( + 'type' => 'textfield', + 'label' => lang('Custom eTemplate for the contactform'), + 'params' => array('size' => 40), + 'default' => 'addressbook.contactform', + ), ); return parent::get_user_interface(); } diff --git a/etemplate/inc/class.bo_tracking.inc.php b/etemplate/inc/class.bo_tracking.inc.php index 5c6295f9b5..a171f50ccb 100644 --- a/etemplate/inc/class.bo_tracking.inc.php +++ b/etemplate/inc/class.bo_tracking.inc.php @@ -306,7 +306,7 @@ class bo_tracking { if (!$email) return false; - //echo "botracker::send_notification(,'$email',$user_or_lang)
\n"; + //echo "bo_trackering::send_notification(,'$email',$user_or_lang)
\n"; //echo "old"; _debug_array($old); //echo "data"; _debug_array($data); @@ -366,7 +366,7 @@ class bo_tracking } $send->AddCustomHeader("X-eGroupWare-type: {$this->app}update"); - $sender = $this->get_sender($user,$data,$old); + $sender = $this->get_sender($data,$old); if (preg_match('/^(.+) *<(.+)>/',$sender,$matches)) // allow to use eg. "Ralf Beckerbo_trackering::send_notification(): sending
".print_r($send,true)."\n"; if (!$send->Send()) { $this->errors[] = lang('Error while notifying %1: %2',$email,$send->ErrorInfo); @@ -418,6 +419,7 @@ class bo_tracking * The default implementation prefers depending on the prefer_user_as_sender class-var the user over * what is returned by get_config('sender'). * + * @param int $user account_lid of user * @param array $data * @param array $old * @return string @@ -425,15 +427,21 @@ class bo_tracking function get_sender($data,$old) { $sender = $this->get_config('sender',$data,$old); - + //echo "
bo_tracking::get_sender() get_config('sender',...)='".htmlspecialchars($sender)."'
\n"; + if (($this->prefer_user_as_sender || !$sender) && $this->user && ($email = $GLOBALS['egw']->accounts->id2name($this->user,'account_email'))) { $name = $GLOBALS['egw']->accounts->id2name($this->user,'account_fullname'); - return $name ? $name.' <'.$email.'>' : $email; + $sender = $name ? $name.' <'.$email.'>' : $email; } - return $sender ? $sender : 'eGroupWare '.lang($this->app).'bo_tracking::get_sender()='".htmlspecialchars($sender)."'
\n"; + return $sender; } /** @@ -528,7 +536,7 @@ class bo_tracking foreach($this->get_details($data) as $name => $detail) { $modified = $old && $data[$name] != $old[$name]; - if ($modified) error_log("data[$name]='{$data[$name]}', old[$name]='{$old[$name]}' --> modified=".(int)$modified); + //if ($modified) error_log("data[$name]='{$data[$name]}', old[$name]='{$old[$name]}' --> modified=".(int)$modified); if (empty($detail['value']) && !$modified) continue; // skip unchanged, empty values $body .= $this->format_line($html_email,$detail['type'],$modified,