email_image::get_user_email (public)
email_image::get_user_email -user_id user_id \ [ -return_url return_url ] [ -bgcolor bgcolor ] \ [ -transparent transparent ] [ -subsite_id subsite_id ]
Defined in packages/acs-subsite/tcl/email-image-procs.tcl
Returns the email in different ways (text level 4, image or text and image level 3, link level 2, ...) according to the priv_email field in the users table. To create an image the ImageMagick software is required, if ImageMagick is not present then the @ symbol in the email will be shown as an image. When creating an image you can choose the background color (In this format \#xxxxxx). Also you can make the background color transparent (1 or 0).
- Switches:
- -user_id (required)
- -return_url (optional)
- The url to return when the email is shown as a link
- -bgcolor (optional)
- The Background color of the image. Default to \#ffffff
- -transparent (optional)
- If the bgcolor is transparent. Default to 1
- -subsite_id (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set email [email_image::get_email -user_id $user_id] set user_level [email_image::get_priv_email -user_id $user_id] if { $user_level == 5 } { # We get the privacy level from PrivateEmailLevelP parameter set priv_level [email_image::get_priv_email_from_parameter -subsite_id $subsite_id] } else { # We use the privacy level that the user select set priv_level $user_level } set send_email_url [ns_quotehtml "/shared/send-email?sendto=$user_id&return_url=$return_url"] switch -- $priv_level { "4" { return [subst {<a href="mailto:$email" title="#acs-subsite.Send_email_to_this_user#">$email</a>}] } "3" { set email_image_id [email_image::get_related_item_id -user_id $user_id] if { $email_image_id != "-1" } { # The user has an email image stored in the content repository set revision_id [content::item::get_latest_revision -item_id $email_image_id] set img_src [ns_quotehtml "/shared/email-image-bits.tcl?user_id=$user_id&revision_id=$revision_id"] return [subst {<a href="$send_email_url"><img style="border:0" src="$img_src" alt="#acs-subsite.Email#"></a>}] } else { # Create a new email_image if { [catch { set email_image [email_image::new_item -user_id $user_id -return_url $return_url -bgcolor $bgcolor -transparent $transparent] } errmsg ] } { ns_log Error "email_image::get_user_email failed \n $errmsg" # ImageMagick not present, we protect the email by adding # an image replacing the "@" symbol set email_user [lindex [split $email '@'] 0] set email_domain [lindex [split $email '@'] 1] set email_image [subst {<a href="$send_email_url">$email_user<img style="border:0" src="/shared/images/at.gif" alt="@">$email_domain</a>}] } } return $email_image } "2" { return [subst {<a href="$send_email_url">#acs-subsite.Send_email_to_this_user#</a>}] } "1" { #Do not show e-mail return "\#acs-subsite.email_not_available\#" } }Generic XQL file: packages/acs-subsite/tcl/email-image-procs.xql
PostgreSQL XQL file: packages/acs-subsite/tcl/email-image-procs-postgresql.xql
Oracle XQL file: packages/acs-subsite/tcl/email-image-procs-oracle.xql