From e70abd21bab68b23488f7ef1ee2e693a3b365691 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 May 2010 18:49:59 +0000 Subject: import rt 3.8.8 --- rt/share/html/Elements/CollectionAsTable/Row | 3 +- rt/share/html/Elements/CollectionList | 26 +++- rt/share/html/Elements/ColumnMap | 24 +++ rt/share/html/Elements/CreateTicket | 7 +- rt/share/html/Elements/EditCustomFieldSelect | 3 +- rt/share/html/Elements/EditLinks | 24 +-- rt/share/html/Elements/EditPassword | 34 +++++ rt/share/html/Elements/HeaderJavascript | 2 +- rt/share/html/Elements/Login | 15 ++ rt/share/html/Elements/Logo | 7 +- rt/share/html/Elements/MessageBox | 2 +- rt/share/html/Elements/MyReminders | 1 + rt/share/html/Elements/RT__CustomField/ColumnMap | 178 +++++++++++++++++++++++ rt/share/html/Elements/RT__Queue/ColumnMap | 54 +++---- rt/share/html/Elements/RT__Scrip/ColumnMap | 4 + rt/share/html/Elements/RT__Template/ColumnMap | 11 ++ rt/share/html/Elements/RT__Ticket/ColumnMap | 22 --- rt/share/html/Elements/SelectQueue | 3 +- rt/share/html/Elements/ShowCustomFields | 11 +- rt/share/html/Elements/ShowLinks | 22 +-- rt/share/html/Elements/ShowRelationLabel | 62 ++++++++ rt/share/html/Elements/ShowUser | 24 +-- rt/share/html/Elements/ShowUserConcise | 16 +- 23 files changed, 446 insertions(+), 109 deletions(-) create mode 100644 rt/share/html/Elements/EditPassword create mode 100644 rt/share/html/Elements/RT__CustomField/ColumnMap create mode 100644 rt/share/html/Elements/ShowRelationLabel (limited to 'rt/share/html/Elements') 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 => '' <%init> -$m->out( '' . "\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 + ), + \'
', + } @{ $values->ItemsArrayRef }; + pop @values; # Remove that last
+ 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'}; + <%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 }}} -
-<&|/l, $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()')&> [_1] + +<&|/l, $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()', SendTo => $SendTo ) &> [_1]
+<%ARGS> +$SendTo => '/Ticket/Create.html', + 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) { %# XXX - Hide this select from w3m? @@ -61,7 +61,7 @@ - <&|/l&>Depended on by: + <& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>: % while (my $link = $Object->DependedOnBy->Next) { @@ -70,7 +70,7 @@ - <&|/l&>Parents: + <& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>: % while (my $link = $Object->MemberOf->Next) { @@ -79,7 +79,7 @@ - <&|/l&>Children: + <& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>: % while (my $link = $Object->Members->Next) { @@ -88,7 +88,7 @@ - <&|/l&>Refers to: + <& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>: % while (my $link = $Object->RefersTo->Next) { @@ -97,7 +97,7 @@ - <&|/l&>Referred to by: + <& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>: % while (my $link = $Object->ReferredToBy->Next) { % # Skip reminders @@ -134,27 +134,27 @@ % } - <&|/l&>Depends on: + <& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>: - <&|/l&>Depended on by: + <& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>: - <&|/l&>Parents: + <& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>: - <&|/l&>Children: + <& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>: - <&|/l&>Refers to: + <& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>: - <&|/l&>Referred to by: + <& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>: % $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'} %>
+% } else { + + +% if ( $cond{'RequireCurrent'} ) { + + + + +% } + + + + + + + + + + + +
<&|/l&>Your current password:
<&|/l&>New password:
<&|/l&>Retype Password:
+% } + +<%ARGS> +$User +@Name => qw(CurrentPass NewPass1 NewPass2) + +<%INIT> + +my %cond = $User->CurrentUserRequireToSetPassword; + + 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'); +} % $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 }}}