[Rt-commit] rt branch, 4.2/web-home-path-column-map, created. rt-4.0.8-590-g159e206
Thomas Sibley
trs at bestpractical.com
Tue Nov 27 19:35:25 EST 2012
The branch, 4.2/web-home-path-column-map has been created
at 159e2067b990c1f844fb47d76f65b84d84dfd874 (commit)
- Log -----------------------------------------------------------------
commit 159e2067b990c1f844fb47d76f65b84d84dfd874
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 27 16:14:22 2012 -0800
WebHomePath column map for use in hrefs inside search Formats
Returns WebPath if the logged in user is privileged, otherwise returns
WebPath + /SelfService. It is the "homepage" URL path for the logged in
user. This lets you build a mirrored page structure under / and
/SelfService/ and use a single Format when rendering.
While the "Web" prefix is unnecessary, it maintains consistency with the
existing column map entries.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index daa4ae5..aa64e27 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3360,7 +3360,7 @@ our @SCRUBBER_ALLOWED_TAGS = qw(
our %SCRUBBER_ALLOWED_ATTRIBUTES = (
# Match http, ftp and relative urls
# XXX: we also scrub format strings with this module then allow simple config options
- href => qr{^(?:http:|ftp:|https:|/|__Web(?:Path|BaseURL|URL)__)}i,
+ href => qr{^(?:http:|ftp:|https:|/|__Web(?:Path|HomePath|BaseURL|URL)__)}i,
face => 1,
size => 1,
target => 1,
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index 1ad3524..0064b54 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -160,6 +160,15 @@ my $COLUMN_MAP = {
} qw(WebPath WebBaseURL WebURL)),
WebRequestPath => { value => sub { substr( $m->request_path, 1 ) } },
WebRequestPathDir => { value => sub { substr( $m->request_comp->dir_path, 1 ) } },
+ WebHomePath => {
+ value => sub {
+ my $path = RT->Config->Get("WebPath");
+ if (not $session{CurrentUser}->Privileged) {
+ $path .= "/SelfService";
+ }
+ return \$path;
+ },
+ },
};
$COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'};
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list