diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-05-27 15:20:05 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-05-27 15:20:05 -0700 |
commit | c5922713bc199600bc8c203155a4016c9d24cbbc (patch) | |
tree | 1b9ec8323fdab801c4ca6aaf74234bfe8f74c56c /rt/share/html/Elements | |
parent | 7c841dec307feed06ee532ac18e4114ef68243a8 (diff) |
rt 4.0.20 (RT#13852)
Diffstat (limited to 'rt/share/html/Elements')
-rw-r--r-- | rt/share/html/Elements/CollectionAsTable/ParseFormat | 3 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldAutocomplete | 9 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldDateTime | 3 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldFreeform | 15 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldSelect | 4 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldText | 18 | ||||
-rw-r--r-- | rt/share/html/Elements/EditCustomFieldWikitext | 18 | ||||
-rw-r--r-- | rt/share/html/Elements/MakeClicky | 48 | ||||
-rw-r--r-- | rt/share/html/Elements/MyRT | 8 | ||||
-rw-r--r-- | rt/share/html/Elements/ShowLink | 2 | ||||
-rwxr-xr-x | rt/share/html/Elements/SimpleSearch | 3 |
11 files changed, 77 insertions, 54 deletions
diff --git a/rt/share/html/Elements/CollectionAsTable/ParseFormat b/rt/share/html/Elements/CollectionAsTable/ParseFormat index e56e9ce0f..5d55ffbeb 100644 --- a/rt/share/html/Elements/CollectionAsTable/ParseFormat +++ b/rt/share/html/Elements/CollectionAsTable/ParseFormat @@ -55,6 +55,7 @@ my @Columns; while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) { my $col = $1; + my $colref = { original_string => $col }; if ($col =~ /^$RE{quoted}$/o) { substr($col,0,1) = ""; @@ -62,8 +63,6 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) { $col =~ s/\\(.)/$1/g; } - my $colref = { }; - $m->callback(CallbackName => 'PreColumn', Column => $colref, col => \$col); while ( $col =~ s{/(STYLE|CLASS|TITLE|ALIGN|SPAN|ATTRIBUTE):([^/]*)}{}i ) { diff --git a/rt/share/html/Elements/EditCustomFieldAutocomplete b/rt/share/html/Elements/EditCustomFieldAutocomplete index 7bfe91114..8eb7b427a 100644 --- a/rt/share/html/Elements/EditCustomFieldAutocomplete +++ b/rt/share/html/Elements/EditCustomFieldAutocomplete @@ -46,7 +46,14 @@ %# %# END BPS TAGGED BLOCK }}} % if ( $Multiple ) { -<textarea cols="<% $Cols %>" rows="<% $Rows %>" name="<% $name %>-Values" id="<% $name %>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default || '' %></textarea> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<% $name %>-Values" id="<% $name %>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default || '' %></textarea> <script type="text/javascript"> var id = <% "$name-Values" |n,j%>; diff --git a/rt/share/html/Elements/EditCustomFieldDateTime b/rt/share/html/Elements/EditCustomFieldDateTime index 25d1ce160..edf125e80 100644 --- a/rt/share/html/Elements/EditCustomFieldDateTime +++ b/rt/share/html/Elements/EditCustomFieldDateTime @@ -50,7 +50,7 @@ <%INIT> my $DateObj = RT::Date->new ( $session{'CurrentUser'} ); -$DateObj->Set( Format => 'ISO', Value => $Default ); +$DateObj->Set( Format => $Format, Value => $Default ); </%INIT> <%ARGS> $Object => undef @@ -59,4 +59,5 @@ $NamePrefix => undef $Default => undef $Values => undef $MaxValues => 1 +$Format => 'ISO' </%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldFreeform b/rt/share/html/Elements/EditCustomFieldFreeform index 67248738b..f0f8ee6de 100644 --- a/rt/share/html/Elements/EditCustomFieldFreeform +++ b/rt/share/html/Elements/EditCustomFieldFreeform @@ -47,9 +47,20 @@ %# END BPS TAGGED BLOCK }}} % my $name = $NamePrefix . $CustomField->Id . '-Value'; % if ($Multiple) { -<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$name%>s" id="<%$name%>s" wrap="off" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<%$name%>s" id="<%$name%>s" wrap="off" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> % } else { -<input name="<%$name%>" id="<%$name%>" size="<%$Cols%>" class="CF-<%$CustomField->id%>-Edit" value="<% defined($Default) ? $Default : ''%>" /> +<input type="text" name="<%$name%>" id="<%$name%>" \ +% if ( defined $Cols ) { +size="<% $Cols %>" \ +% } +class="CF-<%$CustomField->id%>-Edit" value="<% defined($Default) ? $Default : ''%>" /> % } <%INIT> if ( $Multiple and $Values ) { diff --git a/rt/share/html/Elements/EditCustomFieldSelect b/rt/share/html/Elements/EditCustomFieldSelect index 87400ab2e..b343d8266 100644 --- a/rt/share/html/Elements/EditCustomFieldSelect +++ b/rt/share/html/Elements/EditCustomFieldSelect @@ -104,7 +104,7 @@ jQuery( function () { % if ( $RenderType eq 'List' ) { <fieldset class="cfedit"> -<div name="<%$id%>-Values" id="<%$id%>-Values"> +<div data-name="<%$id%>-Values" id="<%$id%>-Values"> % if ( $checktype eq 'radio' ) { <div class="none"> <input class="none" type="<% $checktype %>" name="<% $name %>" id="<% $name %>-none" value="" <% keys %default ? '' : ' checked="checked"' |n%> /> @@ -115,7 +115,7 @@ jQuery( function () { % while ( my $value = $CFVs->Next ) { % my $content = $value->Name; % my $labelid = "$name-". $value->id; -<div name="<% $value->Category %>"> +<div data-name="<% $value->Category || '' %>"> <input type="<% $checktype %>" name="<% $name %>" id="<% $labelid %>" value="<% $content %>" <% $default{ lc $content }? ' checked="checked"' : '' |n%> /> <label for="<% $labelid %>"><% $content %></label><br /> </div> diff --git a/rt/share/html/Elements/EditCustomFieldText b/rt/share/html/Elements/EditCustomFieldText index 866460472..ca7a266c3 100644 --- a/rt/share/html/Elements/EditCustomFieldText +++ b/rt/share/html/Elements/EditCustomFieldText @@ -46,10 +46,24 @@ %# %# END BPS TAGGED BLOCK }}} % while ($Values and my $value = $Values->Next ) { -<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> % } % if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { -<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> % } <%INIT> # XXX - MultiValue textarea is for now outlawed. diff --git a/rt/share/html/Elements/EditCustomFieldWikitext b/rt/share/html/Elements/EditCustomFieldWikitext index 1a36ae333..d4b79cd38 100644 --- a/rt/share/html/Elements/EditCustomFieldWikitext +++ b/rt/share/html/Elements/EditCustomFieldWikitext @@ -46,10 +46,24 @@ %# %# END BPS TAGGED BLOCK }}} % while ($Values and my $value = $Values->Next ) { -<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> % } % if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { -<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default %></textarea> +<textarea \ +% if ( defined $Cols ) { +cols="<% $Cols %>" \ +% } +% if ( defined $Rows ) { +rows="<% $Rows %>" \ +% } +name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default %></textarea> % } <%INIT> # XXX - MultiValue textarea is for now outlawed. diff --git a/rt/share/html/Elements/MakeClicky b/rt/share/html/Elements/MakeClicky index e22e75fbb..8efe78c4a 100644 --- a/rt/share/html/Elements/MakeClicky +++ b/rt/share/html/Elements/MakeClicky @@ -96,6 +96,8 @@ my $handle = sub { } }; +my $cache; # only defined via callback + # Hook to add more Clicky types # XXX Have to have Page argument, as Mason gets caller wrong in Callback? # This happens as we are in <%ONCE> block @@ -104,6 +106,7 @@ $m->callback( types => \@types, actions => \%actions, handle => \$handle, + cache => \$cache, ); @@ -131,6 +134,15 @@ $html => undef </%ARGS> <%INIT> return unless defined $$content; +if ( defined $cache ) { + my $cached_content = $cache->(fetch => $content); + if ( $cached_content ) { + RT->Logger->debug("Found MakeClicky cache"); + $$content = $cached_content; + return; + } +} + unless ( $regexp ) { RT::Interface::Web::EscapeUTF8( $content ) unless $html; return; @@ -165,40 +177,6 @@ substr( $$content, $pos ) = $escaper->( substr( $$content, $pos ) ) unless ($pos == length $$content) || $html; pos($$content) = 0; +$cache->(store => $content) if defined $cache; </%INIT> -<%doc> - -MakeClicky detects various formats of data in headers and email -messages, and extends them with supporting links. By default, RT -provides two formats: - - * 'httpurl': detects http:// and https:// URLs and adds '[Open URL]' - link after the URL. - - * 'httpurl_overwrite': also detects URLs as 'httpurl' format, but - replace URL with link. - -To extend this with your own types of data, use the callback. -It will be provided with: - - * 'types': An array reference of hash references. Modify this array - reference to add your own types; the first matching type will be - used. Each hashref should contain: - - 'name': The name of the data format; this is used in the - configuration file to enable the format. - - 'regex': A regular expression to match against - - 'action': The name of the action to run (see "actions", below) - - * 'actions': A hash reference of 'actions'. Modify this hash - reference to change or add action types. Values are subroutine - references which will get called when needed. They should return - the modified string. Note that subroutine must escape HTML. - - * 'handler': A reference to a subroutine reference; modify it if you - have to. This can be used to add pre- or post-processing around - all actions. - -Read more about writing new actions in docs/extending/clickable_links.pod - -</%doc> diff --git a/rt/share/html/Elements/MyRT b/rt/share/html/Elements/MyRT index c59ec1c32..84db949f7 100644 --- a/rt/share/html/Elements/MyRT +++ b/rt/share/html/Elements/MyRT @@ -67,12 +67,10 @@ my %allowed_components = map {$_ => 1} @{RT->Config->Get('HomepageComponents')}; my $user = $session{'CurrentUser'}->UserObj; -$Portlets ||= $session{'my_rt_portlets'}; +$Portlets ||= $user->Preferences('HomepageSettings'); unless ( $Portlets ) { - my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings'); - $Portlets = $session{'my_rt_portlets'} = $user->Preferences( - HomepageSettings => $default_portlets? $default_portlets->Content: {}, - ); + my ($defaults) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings'); + $Portlets = $defaults ? $defaults->Content : {}; } $m->callback( CallbackName => 'MassagePortlets', Portlets => $Portlets ); diff --git a/rt/share/html/Elements/ShowLink b/rt/share/html/Elements/ShowLink index cccc3d824..35b26381a 100644 --- a/rt/share/html/Elements/ShowLink +++ b/rt/share/html/Elements/ShowLink @@ -49,7 +49,7 @@ % if ($URI->IsLocal) { % my $member = $URI->Object; % my $has_name = UNIVERSAL::can($member, 'Name') || (UNIVERSAL::can($member, '_Accessible') && $member->_Accessible('Name', 'read')); -% if (UNIVERSAL::isa($member, "RT::Ticket")) { +% if (UNIVERSAL::isa($member, "RT::Ticket") and $member->CurrentUserHasRight('ShowTicket')) { % my $inactive = $member->QueueObj->IsInactiveStatus($member->Status); <span class="<% $inactive ? 'ticket-inactive' : '' %>"> diff --git a/rt/share/html/Elements/SimpleSearch b/rt/share/html/Elements/SimpleSearch index bd8a87642..d9f34fa07 100755 --- a/rt/share/html/Elements/SimpleSearch +++ b/rt/share/html/Elements/SimpleSearch @@ -46,8 +46,9 @@ %# %# END BPS TAGGED BLOCK }}} <form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" id="simple-search"> - <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<&|/l&>Search</&>..." onfocus="if (this.value=='<&|/l&>Search</&>...') this.value=''" /> + <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<% $Placeholder %>..." onfocus="if (this.value==(<% $Placeholder, |n,j %>+'...')) this.value=''" /> </form> <%ARGS> $SendTo => '/Search/Simple.html' +$Placeholder => loc('Search') </%ARGS> |