@@ -123,6 +123,7 @@ public function process() {
123123 if (array_key_exists ('contact_id ' , $ this ->request ->get )) {
124124 $ contacts = $ this ->get ('contact_store ' );
125125 $ contact = $ contacts ->get ($ this ->request ->get ['contact_id ' ]);
126+
126127 if ($ contact ) {
127128 $ to = sprintf ('%s <%s> ' , $ contact ->value ('display_name ' ), $ contact ->value ('email_address ' ));
128129 $ this ->out ('compose_draft ' , array ('draft_to ' => $ to , 'draft_subject ' => '' , 'draft_body ' => '' ));
@@ -396,16 +397,34 @@ protected function output() {
396397 $ this ->html_safe ($ c ->value ('phone_number ' )).'</a></td> ' .
397398 '<td class="text-end" style="width : 100px"> ' ;
398399 if (in_array ($ c ->value ('type ' ).': ' .$ c ->value ('source ' ), $ editable , true )) {
399- $ res .= '<a data-id=" ' .$ this ->html_safe ($ c ->value ('id ' )).'" data-type=" ' .$ this ->html_safe ($ c ->value ('type ' )).'" data-source=" ' .$ this ->html_safe ($ c ->value ('source ' )).
400- '" class="delete_contact cursor-pointer" title=" ' .$ this ->trans ('Delete ' ).'"><i class="bi bi-trash3 text-danger ms-2"></i></a> ' .
401- '<a href="?page=contacts&contact_id= ' .$ this ->html_safe ($ c ->value ('id ' )).'&contact_source= ' .
400+ $ delete_attrs = 'data-id=" ' .$ this ->html_safe ($ c ->value ('id ' )).'" data-type=" ' .$ this ->html_safe ($ c ->value ('type ' )).'" data-source=" ' .$ this ->html_safe ($ c ->value ('source ' )).'" ' ;
401+
402+ if (class_exists ('Hm_LDAP_Contact ' )) {
403+ $ delete_attrs .= Hm_LDAP_Contact::generateDeleteAttributes ($ c , [$ this , 'html_safe ' ]);
404+ }
405+
406+ $ edit_url = '?page=contacts&contact_id= ' .$ this ->html_safe ($ c ->value ('id ' )).'&contact_source= ' .
402407 $ this ->html_safe ($ c ->value ('source ' )).'&contact_type= ' .
403- $ this ->html_safe ($ c ->value ('type ' )).'&contact_page= ' .$ current_page .
404- '" class="edit_contact cursor-pointer" title=" ' .$ this ->trans ('Edit ' ).'"><i class="bi bi-gear ms-2"></i></a> ' ;
408+ $ this ->html_safe ($ c ->value ('type ' )).'&contact_page= ' .$ current_page ;
409+
410+ if (class_exists ('Hm_LDAP_Contact ' )) {
411+ $ edit_url = Hm_LDAP_Contact::addDNToUrl ($ c , $ edit_url );
412+ }
413+
414+ $ res .= '<a ' .$ delete_attrs .' class="delete_contact cursor-pointer" title=" ' .$ this ->trans ('Delete ' ).'"><i class="bi bi-trash3 text-danger ms-2"></i></a> ' .
415+ '<a href=" ' .$ edit_url .'" class="edit_contact cursor-pointer" title=" ' .$ this ->trans ('Edit ' ).'"><i class="bi bi-pencil-square ms-2"></i></a> ' ;
405416 }
406- $ res .= '<a href="?page=compose&contact_id= ' .$ this ->html_safe ($ c ->value ('id ' )).
407- '" class="send_to_contact cursor-pointer" title=" ' .$ this ->trans ('Send To ' ).'"> ' .
408- '<i class="bi bi-file-earmark-text ms-2"></i></a> ' ;
417+
418+ $ send_to_url = '?page=compose&contact_id= ' .$ this ->html_safe ($ c ->value ('id ' )).
419+ '&contact_source= ' .$ this ->html_safe ($ c ->value ('source ' )).
420+ '&contact_type= ' .$ this ->html_safe ($ c ->value ('type ' ));
421+
422+ if (class_exists ('Hm_LDAP_Contact ' )) {
423+ $ send_to_url = Hm_LDAP_Contact::addDNToUrl ($ c , $ send_to_url );
424+ }
425+
426+ $ res .= '<a href=" ' .$ send_to_url .'" class="send_to_contact cursor-pointer" title=" ' .$ this ->trans ('Send To ' ).'"> ' .
427+ '<i class="bi bi-envelope-arrow-up ms-2"></i></a> ' ;
409428
410429 $ res .= '</td></tr> ' ;
411430 $ res .= '<tr><td id="contact_ ' .$ this ->html_safe ($ c ->value ('id ' )).'_detail" class="contact_detail_row" colspan="6"> ' ;
@@ -607,6 +626,7 @@ function build_contact_detail($output_mod, $contact, $id) {
607626 $ all_fields = false ;
608627 $ contacts = $ contact ->export ();
609628 ksort ($ contacts );
629+
610630 foreach ($ contacts as $ name => $ val ) {
611631 if ($ name == 'all_fields ' ) {
612632 $ all_fields = $ val ;
@@ -624,7 +644,7 @@ function build_contact_detail($output_mod, $contact, $id) {
624644 if ($ all_fields ) {
625645 ksort ($ all_fields );
626646 foreach ($ all_fields as $ name => $ val ) {
627- if (in_array ($ name , array (0 , 'raw ' , 'objectclass ' , 'dn ' , ' ID ' , 'APP:EDITED ' , 'UPDATED ' ), true )) {
647+ if (in_array ($ name , array (0 , 'raw ' , 'objectclass ' , 'ID ' , 'APP:EDITED ' , 'UPDATED ' ), true )) {
628648 continue ;
629649 }
630650 $ res .= '<tr><th> ' .$ output_mod ->trans (name_map ($ name )).'</th> ' ;
@@ -681,7 +701,8 @@ function name_map($val) {
681701 'fn ' => 'Full Name ' ,
682702 'uid ' => 'Uid ' ,
683703 'src_url ' => 'URL ' ,
684- 'adr ' => 'Address '
704+ 'adr ' => 'Address ' ,
705+ 'dn ' => 'Distinguished Name '
685706 );
686707 if (array_key_exists ($ val , $ names )) {
687708 return $ names [$ val ];
0 commit comments