diff options
Diffstat (limited to 'rt/share/html/Elements')
23 files changed, 446 insertions, 109 deletions
diff --git a/rt/share/html/Elements/CollectionAsTable/Row b/rt/share/html/Elements/CollectionAsTable/Row index fa7474b6c..a1af9f383 100644 --- a/rt/share/html/Elements/CollectionAsTable/Row +++ b/rt/share/html/Elements/CollectionAsTable/Row @@ -54,9 +54,10 @@ $Depth => undef $Warning => undef $ColumnMap => {} $Class => 'RT__Ticket' +$Classes => '' </%ARGS> <%init> -$m->out( '<tr class="' +$m->out( '<tr class="' . $Classes . ' ' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' . "\n" ); use HTML::Entities; diff --git a/rt/share/html/Elements/CollectionList b/rt/share/html/Elements/CollectionList index 6f21420f5..c7bdfd903 100644 --- a/rt/share/html/Elements/CollectionList +++ b/rt/share/html/Elements/CollectionList @@ -54,7 +54,9 @@ if (!$Collection && $Class eq 'RT::Tickets') { my $TotalFound = $Collection->CountAll(); return '' if !$TotalFound && !$ShowEmpty; -if ( @OrderBy ) { +# XXX: ->{'order_by'} is hacky, but there is no way to check if +# collection is ordered or not +if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) { if ( $OrderBy[0] =~ /\|/ ) { @OrderBy = split /\|/, $OrderBy[0]; @Order = split /\|/,$Order[0]; @@ -122,13 +124,27 @@ my ($i, $column_map) = (0, {}); while ( my $record = $Collection->Next ) { # Every ten rows, flush the buffer and put something on the page. $m->flush_buffer unless ++$i % 10; + + my $warning = 0; + my $Classes = ''; + + $m->callback( + CallbackName => 'EachRow', + Record => $record, + Warning => \$warning, + Classes => \$Classes, + Format => \@Format, + ); + $m->comp('/Elements/CollectionAsTable/Row', - i => $i, - Format => \@Format, - record => $record, - maxitems => $maxitems, + i => $i, + Format => \@Format, + record => $record, + maxitems => $maxitems, ColumnMap => $column_map, Class => $Class, + Warning => $warning, + Classes => $Classes, ); } diff --git a/rt/share/html/Elements/ColumnMap b/rt/share/html/Elements/ColumnMap index 71517e063..a1475a99d 100644 --- a/rt/share/html/Elements/ColumnMap +++ b/rt/share/html/Elements/ColumnMap @@ -92,6 +92,26 @@ my $COLUMN_MAP = { value => sub { return $_[0]->LastUpdatedByObj->Name } }, + CustomField => { + attribute => sub { return shift @_ }, + title => sub { return pop @_ }, + value => sub { + # Display custom field contents, separated by newlines. + # For Image custom fields we also show a thumbnail here. + + my $values = $_[0]->CustomFieldValues( $_[-1] ); + my @values = map { + ( + ($_->CustomFieldObj->Type eq 'Image') + ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ )) + : $_->Content + ), + \'<br />', + } @{ $values->ItemsArrayRef }; + pop @values; # Remove that last <br /> + return @values; + }, + }, CheckBox => { title => sub { @@ -136,8 +156,12 @@ my $COLUMN_MAP = { $_ => { value => sub { return \$value } }; } qw(WebPath WebBaseURL WebURL)), + WebRequestPath => { value => sub { substr( $m->request_path, 1 ) } }, + WebRequestPathDir => { value => sub { substr( $m->request_comp->dir_path, 1 ) } }, }; +$COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'}; + </%ONCE> <%INIT> $m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 ); diff --git a/rt/share/html/Elements/CreateTicket b/rt/share/html/Elements/CreateTicket index 9c8f3aadf..fd2ba9e53 100755 --- a/rt/share/html/Elements/CreateTicket +++ b/rt/share/html/Elements/CreateTicket @@ -45,6 +45,9 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<form action="<% RT->Config->Get('WebPath') %>/Ticket/Create.html" name="CreateTicketInQueue" id="CreateTicketInQueue"> -<&|/l, $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()')&><input type="submit" class="button" value="New ticket in" /> [_1]</&> +<form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" name="CreateTicketInQueue" id="CreateTicketInQueue"> +<&|/l, $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()', SendTo => $SendTo ) &><input type="submit" class="button" value="New ticket in" /> [_1]</&> </form> +<%ARGS> +$SendTo => '/Ticket/Create.html', +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldSelect b/rt/share/html/Elements/EditCustomFieldSelect index 8fe79f9f9..30b06dbd1 100644 --- a/rt/share/html/Elements/EditCustomFieldSelect +++ b/rt/share/html/Elements/EditCustomFieldSelect @@ -52,7 +52,7 @@ % my @category; % my $id = $NamePrefix . $CustomField->Id; % my $out = $m->scomp('SELF:options', %ARGS, SelectedRef => \$selected, CategoryRef => \@category); -% if (@category and not $CustomField->BasedOnObj->id) { +% if (!$HideCategory and @category and not $CustomField->BasedOnObj->id) { <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script> %# XXX - Hide this select from w3m? <select onchange="filter_cascade('<% $id %>-Values', this.value)" name="<% $id %>-Category" class="CF-<%$CustomField->id%>-Edit"> @@ -108,6 +108,7 @@ $Default => undef $Values => undef $Multiple => 0 $Rows => undef +$HideCategory => 0 </%ARGS> <%METHOD options> diff --git a/rt/share/html/Elements/EditLinks b/rt/share/html/Elements/EditLinks index 637762e1b..90acb4692 100755 --- a/rt/share/html/Elements/EditLinks +++ b/rt/share/html/Elements/EditLinks @@ -52,7 +52,7 @@ <table> <tr> - <td class="labeltop"><&|/l&>Depends on</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>:</td> <td class="value"> % while (my $link = $Object->DependsOn->Next) { <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> @@ -61,7 +61,7 @@ </td> </tr> <tr> - <td class="labeltop"><&|/l&>Depended on by</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:</td> <td class="value"> % while (my $link = $Object->DependedOnBy->Next) { <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" /> @@ -70,7 +70,7 @@ </td> </tr> <tr> - <td class="labeltop"><&|/l&>Parents</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>:</td> <td class="value"> % while (my $link = $Object->MemberOf->Next) { <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> @@ -79,7 +79,7 @@ </td> </tr> <tr> - <td class="labeltop"><&|/l&>Children</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>:</td> <td class="value"> % while (my $link = $Object->Members->Next) { <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" /> @@ -88,7 +88,7 @@ </td> </tr> <tr> - <td class="labeltop"><&|/l&>Refers to</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>:</td> <td class="value"> % while (my $link = $Object->RefersTo->Next) { <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> @@ -97,7 +97,7 @@ </td> </tr> <tr> - <td class="labeltop"><&|/l&>Referred to by</&>:</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:</td> <td class="value"> % while (my $link = $Object->ReferredToBy->Next) { % # Skip reminders @@ -134,27 +134,27 @@ </tr> % } <tr> - <td class="label"><&|/l&>Depends on</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>:</td> <td class="entry"><input name="<%$id%>-DependsOn" /></td> </tr> <tr> - <td class="label"><&|/l&>Depended on by</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:</td> <td class="entry"><input name="DependsOn-<%$id%>" /></td> </tr> <tr> - <td class="label"><&|/l&>Parents</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>:</td> <td class="entry"><input name="<%$id%>-MemberOf" /></td> </tr> <tr> - <td class="label"><&|/l&>Children</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>:</td> <td class="entry"> <input name="MemberOf-<%$id%>" /></td> </tr> <tr> - <td class="label"><&|/l&>Refers to</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>:</td> <td class="entry"><input name="<%$id%>-RefersTo" /></td> </tr> <tr> - <td class="label"><&|/l&>Referred to by</&>:</td> + <td class="label"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:</td> <td class="entry"> <input name="RefersTo-<%$id%>" /></td> </tr> % $m->callback( CallbackName => 'NewLink' ); diff --git a/rt/share/html/Elements/EditPassword b/rt/share/html/Elements/EditPassword new file mode 100644 index 000000000..3b0ec0b32 --- /dev/null +++ b/rt/share/html/Elements/EditPassword @@ -0,0 +1,34 @@ +% unless ( $cond{'CanSet'} ) { +<% $cond{'Reason'} %><br /> +% } else { +<table> + +% if ( $cond{'RequireCurrent'} ) { +<tr> +<td><&|/l&>Your current password</&>:</td> +<td><input type="password" name="<% $Name[0] %>" size="16" autocomplete="off" /></td> +</tr> +% } + +<tr> +<td><&|/l&>New password</&>:</td> +<td><input type="password" name="<% $Name[1] %>" size="16" autocomplete="off" /></td> +</tr> + +<tr> +<td><&|/l&>Retype Password</&>:</td> +<td><input type="password" name="<% $Name[2] %>" size="16" autocomplete="off" /></td> +</tr> + +</table> +% } + +<%ARGS> +$User +@Name => qw(CurrentPass NewPass1 NewPass2) +</%ARGS> +<%INIT> + +my %cond = $User->CurrentUserRequireToSetPassword; + +</%INIT> diff --git a/rt/share/html/Elements/HeaderJavascript b/rt/share/html/Elements/HeaderJavascript index 6ee88a13b..c4eb17504 100644 --- a/rt/share/html/Elements/HeaderJavascript +++ b/rt/share/html/Elements/HeaderJavascript @@ -111,7 +111,7 @@ $onload => undef typeField.setAttribute('value', 'text/html'); textArea.parentNode.appendChild(typeField); - var oFCKeditor = new FCKeditor( textArea.name, '100%', <% RT->Config->Get('MessageBoxRichTextHeight') %> ); + var oFCKeditor = new FCKeditor( textArea.name, '100%', <% RT->Config->Get('MessageBoxRichTextHeight', $session{CurrentUser} ) %> ); oFCKeditor.BasePath = "<%RT->Config->Get('WebPath')%>/NoAuth/RichText/"; oFCKeditor.ReplaceTextarea(); } diff --git a/rt/share/html/Elements/Login b/rt/share/html/Elements/Login index 8dfbe51d1..e768b0e7a 100755 --- a/rt/share/html/Elements/Login +++ b/rt/share/html/Elements/Login @@ -64,6 +64,21 @@ my $form_action = defined $goto ? $goto : defined $req_uri ? $req_uri : RT->Config->Get('WebPath') ; + +# sanitize $form_action +my $uri = URI->new($form_action); + +# You get undef scheme with a relative uri like "/Search/Build.html" +unless (!defined($uri->scheme) || $uri->scheme eq 'http' || $uri->scheme eq 'https') { + $form_action = RT->Config->Get('WebPath'); +} + +# Make sure we're logging in to the same domain +# You can get an undef authority with a relative uri like "index.html" +my $uri_base_url = URI->new(RT->Config->Get('WebBaseURL')); +unless (!defined($uri->authority) || $uri->authority eq $uri_base_url->authority) { + $form_action = RT->Config->Get('WebPath'); +} </%INIT> % $m->callback( %ARGS, CallbackName => 'Header' ); diff --git a/rt/share/html/Elements/Logo b/rt/share/html/Elements/Logo index 359738b5e..e6cb1ad4b 100644 --- a/rt/share/html/Elements/Logo +++ b/rt/share/html/Elements/Logo @@ -46,10 +46,11 @@ %# %# END BPS TAGGED BLOCK }}} <div id="logo"> -<a href="http://bestpractical.com"><img +<a href="<%$ARGS{'LogoLinkURL'}||RT->Config->Get('LogoLinkURL')%>"><img src="<%$ARGS{'LogoURL'}||RT->Config->Get('LogoURL')%>" - alt="<% loc("Best Practical Solutions, LLC corporate logo") %>" - width="177" height="33" /></a> + alt="<%loc($ARGS{'LogoAltText'}||RT->Config->Get('LogoAltText'))%>" + width="<%$ARGS{'LogoImageWidth'}||RT->Config->Get('LogoImageWidth')%>" + height="<%$ARGS{'LogoImageHeight'}||RT->Config->Get('LogoImageHeight')%>" /></a> % if ( $ShowName ) { <span class="rtname"><% $Name || loc("RT for [_1]", RT->Config->Get('rtname')) %></span> % } diff --git a/rt/share/html/Elements/MessageBox b/rt/share/html/Elements/MessageBox index 4985b23e3..854528c23 100755 --- a/rt/share/html/Elements/MessageBox +++ b/rt/share/html/Elements/MessageBox @@ -46,7 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <textarea class="messagebox" cols="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\ -% $m->callback( %ARGS ); +% $m->callback( %ARGS, SignatureRef => \$signature ); <% $Default || '' %><% $message %><% $signature %></textarea> % $m->callback( %ARGS, CallbackName => 'AfterTextArea' ); <%INIT> diff --git a/rt/share/html/Elements/MyReminders b/rt/share/html/Elements/MyReminders index 25fdf5d48..53e3f99c7 100755 --- a/rt/share/html/Elements/MyReminders +++ b/rt/share/html/Elements/MyReminders @@ -47,6 +47,7 @@ %# END BPS TAGGED BLOCK }}} %# DEPRECATED <&|/Widgets/TitleBox, + class => 'reminders', title => loc("Reminders") &> <table width="100%"> % my $i =0; diff --git a/rt/share/html/Elements/RT__CustomField/ColumnMap b/rt/share/html/Elements/RT__CustomField/ColumnMap new file mode 100644 index 000000000..6d8d76a4c --- /dev/null +++ b/rt/share/html/Elements/RT__CustomField/ColumnMap @@ -0,0 +1,178 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name => undef +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + Disabled => { + title => \' ', + attribute => 'Disabled', + value => sub { return $_[0]->Disabled? $_[0]->loc('Disabled'): $_[0]->loc('Enabled') }, + }, + + map( + { my $c = $_; $c => { + title => $c, attribute => $c, + value => sub { return $_[0]->$c() }, + } } + qw(Name Description Type LookupType Pattern) + ), + map( + { my $c = $_; my $short = $c; $short =~ s/^Friendly//; + $c => { + title => $short, attribute => $short, + value => sub { return $_[0]->$c() }, + } } + qw(FriendlyLookupType FriendlyType FriendlyPattern) + ), + MaxValues => { + title => 'MaxValues', # loc + attribute => 'MaxValues', + value => sub { + my $v = $_[0]->MaxValues; + return !$v ? $_[0]->loc('unlimited') : $v == 0 ? $_[0]->loc('one') : $v; + }, + }, + AppliedTo => { + title => 'Applied', # loc + value => sub { + if ( $_[0]->IsApplied ) { + return $_[0]->loc('Global'); + } + + my $collection = $_[0]->AppliedTo; + return '' unless $collection; + + $collection->RowsPerPage(10); + + my $found = 0; + my $res = ''; + while ( my $record = $collection->Next ) { + $res .= ', ' if $res; + + my $id = ''; + $id = $record->Name if $record->can('Name'); + $id ||= "#". $record->id; + $res .= $id; + + $found++; + } + $res .= ', ...' if $found >= 10; + return $res; + }, + + }, + RemoveCheckBox => { + title => sub { + my $name = 'RemoveCustomField'; + my $checked = $m->request_args->{ $name .'All' }? 'checked="checked"': ''; + + return \qq{<input type="checkbox" name="${name}All" value="1" $checked + onclick="setCheckbox(this.form, '$name', this.checked)" />}; + }, + value => sub { + my $id = $_[0]->id; + return '' if $_[0]->IsApplied; + + my $name = 'RemoveCustomField'; + my $arg = $m->request_args->{ $name }; + + my $checked = ''; + if ( $arg && ref $arg ) { + $checked = 'checked="checked"' if grep $_ == $id, @$arg; + } + elsif ( $arg ) { + $checked = 'checked="checked"' if $arg == $id; + } + return \qq{<input type="checkbox" name="$name" value="$id" $checked />} + }, + }, + MoveCF => { + title => 'Move', + value => sub { + my $id = $_[0]->id; + + my $context = $_[2] || 0; + return '' unless $_[0]->IsApplied( $context ); + + my $name = 'MoveCustomField'; + my $args = $m->caller_args( 1 ); + my @pass = ref $args->{'PassArguments'} + ? @{$args->{'PassArguments'}} + : ($args->{'PassArguments'}); + my %pass = map { $_ => $args->{$_} } grep exists $args->{$_}, @pass; + + my $uri = RT->Config->Get('WebPath') . $m->request_path; + + my @res = ( + \'<a href="', + $uri .'?'. $m->comp("/Elements/QueryString", %pass, MoveCustomFieldUp => $id ), + \'">', loc('[Up]'), \'</a>', + \' <a href="', + $uri .'?'. $m->comp("/Elements/QueryString", %pass, MoveCustomFieldDown => $id ), + \'">', loc('[Down]'), \'</a>' + ); + + return @res; + }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> diff --git a/rt/share/html/Elements/RT__Queue/ColumnMap b/rt/share/html/Elements/RT__Queue/ColumnMap index 5c56004d1..f44ab32c3 100644 --- a/rt/share/html/Elements/RT__Queue/ColumnMap +++ b/rt/share/html/Elements/RT__Queue/ColumnMap @@ -70,43 +70,33 @@ my $COLUMN_MAP = { title => 'Address', # loc value => sub { return ($_[0]->CorrespondAddress||'-') .'/'. ($_[0]->CommentAddress||'-') }, }, - Name => { - title => 'Name', # loc - attribute => 'Name', - value => sub { return $_[0]->Name() }, - }, - Description => { - title => 'Description', # loc - attribute => 'Description', - value => sub { return $_[0]->Description() }, - }, - CorrespondAddress => { - title => 'CorrespondAddress', # loc - attribute => 'CorrespondAddress', - value => sub { return $_[0]->CorrespondAddress() }, - }, - CommentAddress => { - title => 'CommentAddress', # loc - attribute => 'CommentAddress', - value => sub { return $_[0]->CommentAddress() }, - }, - InitialPriority => { - title => 'InitialPriority', # loc - attribute => 'InitialPriority', - value => sub { return $_[0]->InitialPriority() }, + + # SubjectTag is special as we can not sort + SubjectTag => { + title => 'SubjectTag', # loc + value => sub { return $_[0]->SubjectTag }, }, - FinalPriority => { - title => 'FinalPriority', # loc - attribute => 'FinalPriority', - value => sub { return $_[0]->FinalPriority() }, + Sign => { + title => 'Sign', # loc + value => sub { return $_[0]->Sign? $_[0]->loc('yes') : $_[0]->loc('no') }, }, - DefaultDueIn => { - title => 'DefaultDueIn', # loc - attribute => 'DefaultDueIn', - value => sub { return $_[0]->DefaultDueIn() }, + Encrypt => { + title => 'Encrypt', # loc + value => sub { return $_[0]->Encrypt? $_[0]->loc('yes') : $_[0]->loc('no') }, }, }; +foreach my $field (qw( + Name Description CorrespondAddress CommentAddress + InitialPriority FinalPriority DefaultDueIn +)) { + $COLUMN_MAP->{$field} = { + title => $field, + attribute => $field, + value => sub { return $_[0]->$field() }, + }, +} + </%ONCE> <%INIT> $m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); diff --git a/rt/share/html/Elements/RT__Scrip/ColumnMap b/rt/share/html/Elements/RT__Scrip/ColumnMap index 88b4c4bea..3e1d4074f 100644 --- a/rt/share/html/Elements/RT__Scrip/ColumnMap +++ b/rt/share/html/Elements/RT__Scrip/ColumnMap @@ -64,6 +64,10 @@ my $COLUMN_MAP = { return $_[0]->loc('Global'); }, }, + QueueId => { + title => 'Queue', # loc + value => sub { $_[0]->Queue }, + }, Condition => { title => 'Condition', # loc value => sub { return $_[0]->loc( $_[0]->ScripConditionObj->Name ) }, diff --git a/rt/share/html/Elements/RT__Template/ColumnMap b/rt/share/html/Elements/RT__Template/ColumnMap index 851cc9dec..e7c149575 100644 --- a/rt/share/html/Elements/RT__Template/ColumnMap +++ b/rt/share/html/Elements/RT__Template/ColumnMap @@ -67,6 +67,17 @@ my $COLUMN_MAP = { attribute => 'Description', value => sub { return $_[0]->Description() }, }, + Queue => { + title => 'Queue', # loc + value => sub { + return $_[0]->QueueObj->Name if $_[0]->Queue; + return $_[0]->loc('Global'); + }, + }, + QueueId => { + title => 'Queue', # loc + value => sub { $_[0]->Queue }, + }, }; </%ONCE> diff --git a/rt/share/html/Elements/RT__Ticket/ColumnMap b/rt/share/html/Elements/RT__Ticket/ColumnMap index 7df471009..c1f9e319a 100644 --- a/rt/share/html/Elements/RT__Ticket/ColumnMap +++ b/rt/share/html/Elements/RT__Ticket/ColumnMap @@ -303,26 +303,6 @@ $COLUMN_MAP = { value => sub { return \('<input type="checkbox" class="checkbox" name="UpdateTicket'.$_[0]->id.'" value="1" checked="checked" />') } }, - CustomField => { - attribute => sub { return shift @_ }, - title => sub { return pop @_ }, - value => sub { - # Display custom field contents, separated by newlines. - # For Image custom fields we also show a thumbnail here. - - my $values = $_[0]->CustomFieldValues( $_[-1] ); - my @values = map { - ( - ($_->CustomFieldObj->Type eq 'Image') - ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ )) - : $_->Content - ), - \'<br />', - } @{ $values->ItemsArrayRef }; - pop @values; # Remove that last <br /> - return @values; - }, - }, Bookmark => { title => ' ', value => sub { @@ -335,8 +315,6 @@ $COLUMN_MAP = { }, }; -$COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'}; - # if no GPG support, then KeyOwnerName and KeyRequestors fall back to the regular # versions if (RT->Config->Get('GnuPG')->{'Enable'}) { diff --git a/rt/share/html/Elements/SelectQueue b/rt/share/html/Elements/SelectQueue index 20a5b7d9d..c78afe9ce 100755 --- a/rt/share/html/Elements/SelectQueue +++ b/rt/share/html/Elements/SelectQueue @@ -51,7 +51,7 @@ <input name="<%$Name%>" size="25" value="<%$d->Name%>" class="<%$Class%>" /> % } % else { -<select name="<%$Name%>" <% ($OnChange) ? 'onchange="'.$OnChange.'"' : '' |n %> class="<%$Class%>"> +<select name="<%$Name%>" <% ($Multiple) ? 'multiple="multiple"' : '' %> <% ($OnChange) ? 'onchange="'.$OnChange.'"' : '' |n %> class="<%$Class%>"> % if ($ShowNullOption) { <option value="">-</option> % } @@ -82,6 +82,7 @@ $NamedValues => 0 $Default => 0 $Lite => 0 $OnChange => undef +$Multiple => 0 $Class => 'select-queue' </%args> <%init> diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields index ddb8b72e3..b60c49ae8 100644 --- a/rt/share/html/Elements/ShowCustomFields +++ b/rt/share/html/Elements/ShowCustomFields @@ -45,6 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} +% $m->callback( CallbackName => 'BeforeCustomFields' ); % if ($Table) { <table> % } @@ -73,6 +74,7 @@ % if ($Table) { </table> % } +% $m->callback( CallbackName => 'AfterCustomFields', Object => $Object ); <%INIT> $m->callback( CallbackName => 'MassageCustomFields', @@ -82,9 +84,10 @@ $m->callback( my $print_value = sub { my ($cf, $value) = @_; - my $linked = $cf->LinkValueTo; - if ( $linked ) { - $m->out('<a href="'. $value->LinkValueTo .'" target="_new">'); + my $linked = $value->LinkValueTo; + if ( defined $linked && length $linked ) { + my $linked = $m->interp->apply_escapes( $linked, 'h' ); + $m->out('<a href="'. $linked .'" target="_new">'); } my $comp = "ShowCustomField". $cf->Type; $m->callback( @@ -98,7 +101,7 @@ my $print_value = sub { } else { $m->out( $m->interp->apply_escapes( $value->Content, 'h' ) ); } - $m->out('</a>') if $linked; + $m->out('</a>') if defined $linked && length $linked; # This section automatically populates a div with the "IncludeContentForValue" for this custom # field if it's been defined diff --git a/rt/share/html/Elements/ShowLinks b/rt/share/html/Elements/ShowLinks index 569bad39c..e3b3ef509 100755 --- a/rt/share/html/Elements/ShowLinks +++ b/rt/share/html/Elements/ShowLinks @@ -47,7 +47,7 @@ %# END BPS TAGGED BLOCK }}} <table> <tr> - <td class="labeltop"><&|/l&>Depends on</&>: (<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>: <span class="create">(<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</span></td> <td class="value"> <%PERL> @@ -77,7 +77,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><&|/l&>Depended on by</&>: (<a href="<%$clone->{'new-DependsOn'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>: <span class="create">(<a href="<%$clone->{'new-DependsOn'}%>"><% loc('Create') %></a>)</span></td> <td class="value"> <ul> % while (my $Link = $Ticket->DependedOnBy->Next) { @@ -87,15 +87,15 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><&|/l&>Parents</&>: (<a href="<%$clone->{'MemberOf-new'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>: <span class="create">(<a href="<%$clone->{'MemberOf-new'}%>"><% loc('Create') %></a>)</span></td> <td class="value"><& /Ticket/Elements/ShowParents, Ticket => $Ticket &></td> </tr> <tr> - <td class="labeltop"><&|/l&>Children</&>: (<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>: <span class="create">(<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</span></td> <td class="value"><& /Ticket/Elements/ShowMembers, Ticket => $Ticket &></td> </tr> <tr> - <td class="labeltop"><&|/l&>Refers to</&>: (<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>: <span class="create">(<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</span></td> <td class="value"> <ul> % while (my $Link = $Ticket->RefersTo->Next) { @@ -105,7 +105,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><&|/l&>Referred to by</&>: (<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>: <span class="create">(<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</span></td> <td class="value"> <ul> % while (my $Link = $Ticket->ReferredToBy->Next) { @@ -124,14 +124,15 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { <%INIT> +my $id = $Ticket->id; + my $clone = {}; my $path = RT->Config->Get('WebPath') . '/Ticket/Create.html?Queue=' . $Ticket->Queue . '&CloneTicket=' - . $Ticket->id; - + . $id; for my $relation ( qw(RefersTo ReferredToBy)) { @@ -142,15 +143,14 @@ for my $relation ( $clone->{$field} = $path . "&$field=" . join( '%20', - ( map { $_->$other() } @{ $Ticket->$relation->ItemsArrayRef } ), - $Ticket->id ); + ( map { $_->$other() } @{ $Ticket->$relation->ItemsArrayRef } ), $id ); } for my $relation ( qw(MemberOf Members DependsOn DependedOnBy)) { my $mode = $RT::Ticket::LINKTYPEMAP{$relation}->{Mode}; my $type = $RT::Ticket::LINKTYPEMAP{$relation}->{Type}; my $field = $mode eq 'Base' ? 'new-' . $type : $type . '-new'; - $clone->{$field} = $path . "&$field=". $Ticket->id ; + $clone->{$field} = $path . "&$field=$id"; } </%INIT> diff --git a/rt/share/html/Elements/ShowRelationLabel b/rt/share/html/Elements/ShowRelationLabel new file mode 100644 index 000000000..3c1ed1514 --- /dev/null +++ b/rt/share/html/Elements/ShowRelationLabel @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<a href="<%$SearchURL |n %>"><%$Label%></a> +<%INIT> +my $typemap = RT::Ticket->LINKTYPEMAP->{$Relation}; +my $search_mode = $typemap->{Mode}; +my $search_type = $typemap->{Type}; +my $search_relation = RT::Ticket->LINKDIRMAP->{$search_type}{$search_mode}; + +my $Query = $search_relation . ' = ' . $id; +my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query); +</%INIT> +<%ARGS> +$id +$Label +$Relation +</%ARGS> diff --git a/rt/share/html/Elements/ShowUser b/rt/share/html/Elements/ShowUser index 2fbdcbc3e..01de7256a 100644 --- a/rt/share/html/Elements/ShowUser +++ b/rt/share/html/Elements/ShowUser @@ -49,18 +49,20 @@ <%INIT> # $User is an RT::User object # $Address is Email::Address object -if ( !$User && $Address ) { - $User = RT::User->new( $session{'CurrentUser'} ); - $User->LoadByEmail( $Address->address ); - unless ( $User->Id ) { - $m->comp( '/Elements/ShowUserVerbose', Address => $Address ); - return; - } + +my $comp = '/Elements/ShowUser'. ucfirst lc $style; +unless ( $m->comp_exists( $comp ) ) { + $RT::Logger->error( + 'Either system config or user #' + . $session{'CurrentUser'}->id + . ' picked UsernameFormat '. $style + . ', but '. $comp . "doesn't exist" + ); + return $m->comp('/Elements/ShowUserConcise', + User => $User, Address => $Address, + ); } -if ( $style eq 'concise' ) { - $m->comp( '/Elements/ShowUserConcise', User => $User ); -} -else { $m->comp( '/Elements/ShowUserVerbose', User => $User ); } +return $m->comp( $comp, User => $User, Address => $Address ); </%INIT> <%ARGS> $User => undef diff --git a/rt/share/html/Elements/ShowUserConcise b/rt/share/html/Elements/ShowUserConcise index 3cdba10dd..c4cccca75 100644 --- a/rt/share/html/Elements/ShowUserConcise +++ b/rt/share/html/Elements/ShowUserConcise @@ -46,7 +46,19 @@ %# %# END BPS TAGGED BLOCK }}} %# Released under the terms of version 2 of the GNU Public License -<% $User->RealName || $User->Name %>\ +<% $Address || $User->RealName || $User->Name %>\ <%ARGS> -$User +$User => undef +$Address => undef </%ARGS> +<%INIT> +if ( !$User && $Address ) { + $User = RT::User->new( $session{'CurrentUser'} ); + $User->LoadByEmail( $Address->address ); + if ( $User->Id ) { + $Address = ''; + } else { + $Address = $Address->address; + } +} +</%INIT> |