Overload the "http-link" entry in the User Map to do things, like maybe calling a link to an image.
You'll like this post.
If you want to do this in stock (database) OTRS, you'll want to make sure the entire CustomerUser section is in Config.pm (copy from Defaults.pm):
Code: Select all
$Self->{CustomerUser} = {
#################################################################################################
#... other content from Defaults.pm was not pasted in this post ... you still need to copy them #
#################################################################################################
Map => [
# note: Login, Email and CustomerID needed!
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
[ 'UserSalutation', 'Salutation', 'salutation', 1, 0, 'var', '', 0 ],
[ 'UserFirstname', 'Firstname', 'first_name', 1, 1, 'var', '', 0 ],
[ 'UserLastname', 'Lastname', 'last_name', 1, 1, 'var', '', 0 ],
[ 'UserLogin', 'Username', 'login', 1, 1, 'var', '', 0 ],
[ 'UserPassword', 'Password', 'pw', 0, 0, 'var', '', 0 ],
[ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ],
# [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '$Env{"CGIHandle"}?Action=AgentTicketCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}', 0 ],
[ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
# [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
[ 'UserPhone', 'Phone', 'phone', 1, 0, 'var', '', 0 ],
[ 'UserFax', 'Fax', 'fax', 1, 0, 'var', '', 0 ],
[ 'UserMobile', 'Mobile', 'mobile', 1, 0, 'var', '', 0 ],
[ 'UserStreet', 'Street', 'street', 1, 0, 'var', '', 0 ],
[ 'UserZip', 'Zip', 'zip', 1, 0, 'var', '', 0 ],
[ 'UserCity', 'City', 'city', 1, 0, 'var', '', 0 ],
[ 'UserCountry', 'Country', 'country', 1, 0, 'var', '', 0 ],
[ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
[ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int', '', 0 ],
],
};
The code that handles index 6 (http link) and index 8 (target) is in Kernel/Output/HTML/LayoutTicket.pm:
Code: Select all
Field 6
if ( $Field->[6] ) {
$Record{LinkStart} = "<a href=\"$Field->[6]\"";
if ( $Field->[8] ) {
$Record{LinkStart} .= " target=\"$Field->[8]\"";
}
$Record{LinkStart} .= "\">";
$Record{LinkStop} = "</a>";
}
Some background:
The entry with index 6 (after "var") is intended to be a hyperlink that surrounds the field. index 8 (last entry after read-only "0") if it exists, will be used for "target" of html. "_blank" opens new page/new window, for instance.
You can link the field to practically anything, such as
Code: Select all
[ 'UserCity', 'City', 'city', 1, 0, 'var', 'http://maps.google.com/?q=$Data{"UserCity"},$Data{"UserZip"}', 0,"_blank" ], #What's this? a city map on click, in a new window?
[ 'UserLogin', 'Username', 'login', 1, 1, 'var', '$Env{"CGIHandle"}?Action=AdminCustomerUser&Subaction=Change&ID=$Data{"UserLogin"}', 0 ], #the username goes to edit screen
There's a javascript implementation of MD5, so passing $Data{UserEmail} to the MD5summer javascript function and returning http://www.gravatar.com/avatar/md5sumresult in an image tag isn't totally out of the question.
oh?Wait. you said "image!"
Code: Select all
[ 'UserFirstname', 'Firstname', 'first_name', 1, 1, 'var', '#"><img src="http://www.gravatar.com/avatar" /></a><a href="#', 0 ],
The first occurrence of "#" is the address that applies to the img tag. Because of the code above, the img *must* be hyperlinked. If you don't want that, change the .dtl, not this.
The second occurrence of "#" is the address that applies to the field (text). It is necessary to be there because the code forces the termination of (it appends "> to) the hyperlink string, since it exists in the entry.
Of course, you can replace "#" with something more relevant.