diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 00:56:06 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 00:56:06 -0700 |
commit | 43a06151e47d2c59b833cbd8c26d97865ee850b6 (patch) | |
tree | 42c51d94e7fa265461b508d061562be204ccc2c1 /rt/share/html/Elements | |
parent | 6587f6ba7d047ddc1686c080090afe7d53365bd4 (diff) |
starting to work...
Diffstat (limited to 'rt/share/html/Elements')
118 files changed, 1670 insertions, 1279 deletions
diff --git a/rt/share/html/Elements/BevelBoxRaisedEnd b/rt/share/html/Elements/BevelBoxRaisedEnd index 4c009ac2f..369dc9560 100755 --- a/rt/share/html/Elements/BevelBoxRaisedEnd +++ b/rt/share/html/Elements/BevelBoxRaisedEnd @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/BevelBoxRaisedStart b/rt/share/html/Elements/BevelBoxRaisedStart index bd36cd567..51038b89b 100755 --- a/rt/share/html/Elements/BevelBoxRaisedStart +++ b/rt/share/html/Elements/BevelBoxRaisedStart @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/Callback b/rt/share/html/Elements/Callback index 2b4ec11be..bd48bc5cd 100755 --- a/rt/share/html/Elements/Callback +++ b/rt/share/html/Elements/Callback @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/Checkbox b/rt/share/html/Elements/Checkbox index 2e9f05b98..c72b40126 100755 --- a/rt/share/html/Elements/Checkbox +++ b/rt/share/html/Elements/Checkbox @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/CollectionAsTable/Header b/rt/share/html/Elements/CollectionAsTable/Header index 878a77e70..81d8bbb27 100644 --- a/rt/share/html/Elements/CollectionAsTable/Header +++ b/rt/share/html/Elements/CollectionAsTable/Header @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -126,7 +126,7 @@ foreach my $col ( @Format ) { my $new_order = 'ASC'; $new_order = $Order[0] eq 'ASC'? 'DESC': 'ASC' - if $OrderBy[0] && $OrderBy[0] eq $attr; + if $OrderBy[0] && ($OrderBy[0] eq $attr or "$attr|$OrderBy[0]" =~ /^(Created|id)\|(Created|id)$/); $m->out( '<a href="' . $BaseURL diff --git a/rt/share/html/Elements/CollectionAsTable/ParseFormat b/rt/share/html/Elements/CollectionAsTable/ParseFormat index e9d3143d3..c2c1c5364 100644 --- a/rt/share/html/Elements/CollectionAsTable/ParseFormat +++ b/rt/share/html/Elements/CollectionAsTable/ParseFormat @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -77,6 +77,7 @@ while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) { } elsif ( $col =~ /^__(NEWLINE|NBSP)__$/ || $col =~ /^(NEWLINE|NBSP)$/ ) { $colref->{'title'} = $1; + $colref->{'last_attribute'} = ''; } elsif ( $col =~ /__(.*?)__/io ) { my @subcols; diff --git a/rt/share/html/Elements/CollectionAsTable/Row b/rt/share/html/Elements/CollectionAsTable/Row index 9037e5d11..f91520952 100644 --- a/rt/share/html/Elements/CollectionAsTable/Row +++ b/rt/share/html/Elements/CollectionAsTable/Row @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -60,7 +60,6 @@ $Classes => '' $m->out( '<tr class="' . $Classes . ' ' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' . "\n" ); -use HTML::Entities; my $item; foreach my $column (@Format) { if ( defined $column->{title} && $column->{title} eq 'NEWLINE' ) { @@ -77,7 +76,7 @@ foreach my $column (@Format) { next; } - my $class = $column->{class} ? encode_entities( $column->{class}, q{'"&<>} ) : 'collection-as-table'; + my $class = $column->{class} ? $m->interp->apply_escapes($column->{class}, 'h') : 'collection-as-table'; $m->out(qq{<td class="$class" }); my %attrs; @@ -131,7 +130,7 @@ foreach my $column (@Format) { Arguments => [$record, $i], ); } - s/\n/<br \/>/gs for grep { defined } @out; + s/\n/<br \/>/gs for grep defined $_, @out; $m->out( $_ .'="'. $m->interp->apply_escapes( $attrs{$_} => 'h' ) .'"' ) foreach grep $attrs{$_}, qw(align style colspan); diff --git a/rt/share/html/Elements/CollectionList b/rt/share/html/Elements/CollectionList index 522db5811..0c816fe2f 100644 --- a/rt/share/html/Elements/CollectionList +++ b/rt/share/html/Elements/CollectionList @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -51,7 +51,7 @@ if (!$Collection && $Class eq 'RT::Tickets') { $Collection->FromSQL($Query); } -my $TotalFound = $Collection->CountAll(); +$TotalFound = $Collection->CountAll() unless defined $TotalFound; return '' if !$TotalFound && !$ShowEmpty; if ( $Rows ) { @@ -105,13 +105,14 @@ foreach my $col (@Format) { } } -$Class ||= ref $Collection; -$Class =~ s/s$//; -$Class =~ s/:/_/g; +$Class ||= $Collection->ColumnMapClassName; +if ($Class =~ /::/) { # older passed in value + $Class =~ s/s$//; + $Class =~ s/:/_/g; +} -$m->out('<table border="0" cellspacing="0" cellpadding="1"' . - ' width="100%" class="' . - ($Collection->isa('RT::Tickets') ? 'ticket-list' : 'collection') . '">'); +$m->out('<table class="' . + ($Collection->isa('RT::Tickets') ? 'ticket-list' : 'collection') . ' collection-as-table">'); if ( $ShowHeader ) { $m->comp('/Elements/CollectionAsTable/Header', @@ -184,6 +185,7 @@ if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) { <%ARGS> $Class => '' $Collection => undef +$TotalFound => undef $Format => undef $DisplayFormat => undef @Order => () diff --git a/rt/share/html/Elements/CollectionListPaging b/rt/share/html/Elements/CollectionListPaging index 7be9ea62c..b1faa2101 100644 --- a/rt/share/html/Elements/CollectionListPaging +++ b/rt/share/html/Elements/CollectionListPaging @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ColumnMap b/rt/share/html/Elements/ColumnMap index 5e5354ade..745e57f83 100644 --- a/rt/share/html/Elements/ColumnMap +++ b/rt/share/html/Elements/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -73,7 +73,7 @@ my $COLUMN_MAP = { value => sub { return $_[0]->CreatedObj->AgeAsString } }, CreatedBy => { - attribute => 'CreatedBy', + attribute => 'Creator', title => 'Created By', # loc value => sub { return $_[0]->CreatorObj->Name } }, @@ -150,7 +150,7 @@ my $COLUMN_MAP = { my $arg = $m->request_args->{ $name }; my $checked = ''; $checked = 'checked="checked"' if $arg && $arg == $id; - return \qq{<input type="radio" name="SelectedTicket" value="$id" $checked />}; + return \qq{<input type="radio" name="}, $name, \qq{" value="$id" $checked />}; }, }, (map { diff --git a/rt/share/html/Elements/CreateTicket b/rt/share/html/Elements/CreateTicket index 02275ef34..6e541db9b 100755 --- a/rt/share/html/Elements/CreateTicket +++ b/rt/share/html/Elements/CreateTicket @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,8 +45,14 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<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 action="<% RT->Config->Get('WebPath') %><% $SendTo %>" name="CreateTicketInQueue" id="CreateTicketInQueue" \ +% $m->callback(CallbackName => 'InFormElement'); +> +% my $button_start = '<input type="submit" class="button" value="'; +% my $button_end = '" />'; +% my $queue_selector = $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()', SendTo => $SendTo ); +<&|/l, $button_start, $button_end, $queue_selector &>[_1]New ticket in[_2] [_3]</&> +% $m->callback(CallbackName => 'BeforeFormEnd'); </form> <%ARGS> $SendTo => '/Ticket/Create.html', diff --git a/rt/share/html/Elements/DashboardTabs b/rt/share/html/Elements/DashboardTabs deleted file mode 100644 index b9f4bbbff..000000000 --- a/rt/share/html/Elements/DashboardTabs +++ /dev/null @@ -1,99 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@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> -$CurrentDashboard => undef -</%args> -<%init> -my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards"); -my $limit = 7; - -$m->callback( - Dashboards => \@dashboards, - Limit => \$limit, - CallbackName => 'MassageDashboards', -); - -my $more = 0; -if (@dashboards > $limit) { - $more = 1; - splice @dashboards, $limit; -} - -# always include the current dashboard, even if it's not in the initial list -push @dashboards, $CurrentDashboard - if $CurrentDashboard - && 0 == grep { $_->Id == $CurrentDashboard->Id } @dashboards; - -my $position = 0; - -my $tabs = { - map { - ++$position; - my $key = sprintf 'D-%03d', $position; - $key => { - title => $_->Name, - path => 'Dashboards/' . $_->Id . '/' . $_->Name, - } - } - @dashboards -}; - -$tabs->{"A"} = { - title => loc('Home'), - path => 'index.html', -}; - -if ($more) { - $tabs->{"D-more"} = { - title => loc('More'), - path => 'Dashboards/index.html', - } -} - -return $tabs; -</%init> diff --git a/rt/share/html/Elements/Dashboards b/rt/share/html/Elements/Dashboards index d13477b97..4867a75a0 100644 --- a/rt/share/html/Elements/Dashboards +++ b/rt/share/html/Elements/Dashboards @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,22 +45,13 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<div class="dashboards"> <&|/Widgets/TitleBox, - title => loc("Dashboards"), + title => loc('Dashboards'), title_href => RT->Config->Get('WebPath').'/Dashboards/index.html', - bodyclass => "", titleright => loc("Edit"), - titleright_href => RT->Config->Get('WebPath').'/Dashboards/', + titleright_href => RT->Config->Get('WebPath').'/Dashboards/index.html', &> -<& /Dashboards/Elements/ShowDashboards:table, - Dashboards => \@dashboards, - Verbose => 0, -&> -</&> -</div> -<%INIT> -my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards"); -</%INIT> +<& /Dashboards/Elements/ShowDashboards, IncludeSuperuserGroups => 0 &> +</&> diff --git a/rt/share/html/Elements/EditCustomField b/rt/share/html/Elements/EditCustomField index 6c5d7f5cf..c7c8bfa36 100644 --- a/rt/share/html/Elements/EditCustomField +++ b/rt/share/html/Elements/EditCustomField @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldAutocomplete b/rt/share/html/Elements/EditCustomFieldAutocomplete index 13a43ed67..aaf551716 100644 --- a/rt/share/html/Elements/EditCustomFieldAutocomplete +++ b/rt/share/html/Elements/EditCustomFieldAutocomplete @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,22 +46,38 @@ %# %# END BPS TAGGED BLOCK }}} % if ( $Multiple ) { -<textarea cols="<% $Cols %>" rows="<% $Rows %>" name="<% $name %>-Values" id="<% $name %>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default %></textarea><div id="<% $name %>-Choices" class="autocomplete"></div> +<textarea cols="<% $Cols %>" rows="<% $Rows %>" name="<% $name %>-Values" id="<% $name %>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default || '' %></textarea> + <script type="text/javascript"> -new Ajax.Autocompleter( - "<% $name %>-Values", - "<% $name %>-Choices", - "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues", - { tokens: [ '\n' ] } +var id = '<% $name . '-Values' %>'; +id = id.replace(/:/g,'\\:'); +jQuery('#'+id).autocomplete( { + source: "<%RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues?<% $name . '-Values' %>", + focus: function () { + // prevent value inserted on focus + return false; + }, + select: function(event, ui) { + var terms = this.value.split(/\n/); + // remove the current input + terms.pop(); + // add the selected item + terms.push( ui.item.value ); + // add placeholder to get the comma-and-space at the end + terms.push(""); + this.value = terms.join("\n"); + return false; + } +} ); % } else { -<input type="text" id="<% $name %>-Value" name="<% $name %>-Value" class="CF-<%$CustomField->id%>-Edit" value="<% $Default %>"/><div id="<% $name %>-Choices" class="autocomplete"></div> +<input type="text" id="<% $name %>-Value" name="<% $name %>-Value" class="CF-<%$CustomField->id%>-Edit" value="<% $Default || '' %>"/> <script type="text/javascript"> -new Ajax.Autocompleter( - "<% $name %>-Value", - "<% $name %>-Choices", - "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues", - {} +var id = '<% $name . '-Value' %>'; +id = id.replace(/:/g,'\\:'); +jQuery('#'+id).autocomplete( { + source: "<%RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues?<% $name . '-Value' %>" +} ); % } </script> diff --git a/rt/share/html/Elements/EditCustomFieldBinary b/rt/share/html/Elements/EditCustomFieldBinary index 1128c5a18..0a2098556 100644 --- a/rt/share/html/Elements/EditCustomFieldBinary +++ b/rt/share/html/Elements/EditCustomFieldBinary @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldCombobox b/rt/share/html/Elements/EditCustomFieldCombobox index 970b11b30..6d8f74376 100644 --- a/rt/share/html/Elements/EditCustomFieldCombobox +++ b/rt/share/html/Elements/EditCustomFieldCombobox @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldDate b/rt/share/html/Elements/EditCustomFieldDate index b6359d7e0..c66640fab 100644 --- a/rt/share/html/Elements/EditCustomFieldDate +++ b/rt/share/html/Elements/EditCustomFieldDate @@ -1,40 +1,40 @@ %# BEGIN BPS TAGGED BLOCK {{{ -%# +%# %# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC -%# <jesse@bestpractical.com> -%# +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# <sales@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/copyleft/gpl.html. -%# -%# +%# 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 @@ -43,14 +43,14 @@ %# 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 }}} % my $name = $NamePrefix.$CustomField->Id.'-Values'; -<& /Elements/SelectDate, Name => "$name", ShowTime => 0, current => 0 &> (<%$DateObj->AsString%>) +<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0)%>) <%INIT> -my $DateObj = new RT::Date ( $session{'CurrentUser'} ); -$DateObj->Set( Format => 'ISO', Value => $Default ); +my $DateObj = RT::Date->new ( $session{'CurrentUser'} ); +$DateObj->Set( Format => 'unknown', Value => $Default ); </%INIT> <%ARGS> $Object => undef diff --git a/rt/share/html/Elements/EditCustomFieldFreeform b/rt/share/html/Elements/EditCustomFieldFreeform index 542d94bf9..7a5a458bb 100644 --- a/rt/share/html/Elements/EditCustomFieldFreeform +++ b/rt/share/html/Elements/EditCustomFieldFreeform @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldImage b/rt/share/html/Elements/EditCustomFieldImage index 6a3ed4b7f..09cbf85f3 100644 --- a/rt/share/html/Elements/EditCustomFieldImage +++ b/rt/share/html/Elements/EditCustomFieldImage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldSelect b/rt/share/html/Elements/EditCustomFieldSelect index bf2a8289d..b3fefbd49 100644 --- a/rt/share/html/Elements/EditCustomFieldSelect +++ b/rt/share/html/Elements/EditCustomFieldSelect @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -65,7 +65,7 @@ % } elsif ($CustomField->BasedOnObj->id) { <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script> <script type="text/javascript"><!-- -doOnLoad( function () { +jQuery( function () { var basedon = document.getElementById('<% $NamePrefix . $CustomField->BasedOnObj->id %>-Values'); if (basedon != null) { var oldchange = basedon.onchange; @@ -91,6 +91,22 @@ doOnLoad( function () { % $m->out($out); </select> % } + +% if ( $RenderType eq 'List' ) { +<fieldset class="cfedit"> +% if ( $checktype eq 'radio' ) { + <input type="<% $checktype %>" name="<% $name %>" id="<% $name %>-none" value="" <% keys %default ? '' : ' checked="checked"' |n%> /> + <label for="<% $name %>-none"><&|/l&>(no value)</&></label><br /> +% } +% my $CFVs = $CustomField->Values; +% while ( my $value = $CFVs->Next ) { +% my $content = $value->Name; +% my $labelid = "$name-". $value->id; + <input type="<% $checktype %>" name="<% $name %>" id="<% $labelid %>" value="<% $content %>" <% $default{ lc $content }? ' checked="checked"' : '' |n%> /> + <label for="<% $labelid %>"><% $content %></label><br /> +% } +</fieldset> +% } else { <select name="<%$id%>-Values" id="<%$id%>-Values" class="CF-<%$CustomField->id%>-Edit" % if ( $Rows && ( $Multiple || !@category ) ) { @@ -100,15 +116,40 @@ doOnLoad( function () { <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option> % $m->out($out); </select> +% } +<%init> +# Handle render types +$RenderType ||= $CustomField->RenderType; +if ( $RenderType eq 'Dropdown' ) { + # Turn it into a dropdown + $Rows = 0; +} + +# The following is for rendering checkboxes / radio buttons only +my ($checktype, $name); +if ( $MaxValues == 1 ) { + ($checktype, $name) = ('radio', $NamePrefix . $CustomField->Id . '-Value'); +} else { + ($checktype, $name) = ('checkbox', $NamePrefix . $CustomField->Id . '-Values'); +} + +@Default = grep defined && length, @Default; +if ( !@Default && $Values ) { + @Default = map $_->Content, @{ $Values->ItemsArrayRef }; +} +my %default = map {lc $_ => 1} @Default; +</%init> <%ARGS> $Object => undef $CustomField => undef $NamePrefix => undef -$Default => undef +@Default => () $Values => undef $Multiple => 0 $Rows => undef $HideCategory => 0 +$RenderType => undef +$MaxValues => 1 </%ARGS> <%METHOD options> diff --git a/rt/share/html/Elements/EditCustomFieldText b/rt/share/html/Elements/EditCustomFieldText index 53ec5a94c..65a5e3bcf 100644 --- a/rt/share/html/Elements/EditCustomFieldText +++ b/rt/share/html/Elements/EditCustomFieldText @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditCustomFieldWikitext b/rt/share/html/Elements/EditCustomFieldWikitext index 30e3d5e03..a07317e2f 100644 --- a/rt/share/html/Elements/EditCustomFieldWikitext +++ b/rt/share/html/Elements/EditCustomFieldWikitext @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditLinks b/rt/share/html/Elements/EditLinks index d6d1ee955..40667a869 100755 --- a/rt/share/html/Elements/EditLinks +++ b/rt/share/html/Elements/EditLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -119,6 +119,7 @@ <h3><&|/l&>New Links</&></h3> % if (ref($Object) eq 'RT::Ticket') { <i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&> +<br /><&|/l&>You may enter links to Articles as "a:###", where ### represents the number of the Article.</&> % $m->callback( CallbackName => 'ExtraLinkInstructions' ); </i><br /> % } elsif (ref($Object) eq 'RT::Queue') { diff --git a/rt/share/html/Elements/EditPassword b/rt/share/html/Elements/EditPassword index eaa3d7552..06e816d9e 100644 --- a/rt/share/html/Elements/EditPassword +++ b/rt/share/html/Elements/EditPassword @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/EditTimeValue b/rt/share/html/Elements/EditTimeValue index 8e2e64537..40e3b677a 100644 --- a/rt/share/html/Elements/EditTimeValue +++ b/rt/share/html/Elements/EditTimeValue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -58,8 +58,8 @@ $InputUnits => 'minutes' $ValueName ||= $Name; $UnitName ||= ($Name||$ValueName) . '-TimeUnits'; -if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours')) { - $Default = sprintf '%.3g', $Default / 60 +if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'})) { + $Default = sprintf '%.3f', $Default / 60 unless $Default eq ''; } </%INIT> diff --git a/rt/share/html/Elements/EmailInput b/rt/share/html/Elements/EmailInput index dbd45a23c..67eb57c2c 100644 --- a/rt/share/html/Elements/EmailInput +++ b/rt/share/html/Elements/EmailInput @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<input name="<% $Name %>" size="<% $Size %>" value="<% $Default || '' %>" /> +<input type="text" id="<% $Name %>" name="<% $Name %>" <% defined $Size ? qq{size="$Size"} : '' |n %> value="<% $Default || '' %>" /> <%ARGS> $Name $Size => 40 diff --git a/rt/share/html/Elements/Error b/rt/share/html/Elements/Error index 84593735c..50f3b775c 100755 --- a/rt/share/html/Elements/Error +++ b/rt/share/html/Elements/Error @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -49,7 +49,7 @@ % unless ($SuppressHeader) { <& /Elements/Header, Code => $Code, Why => $Why, Title => $Title &> -<& /Elements/Tabs, Title => $Title &> +<& /Elements/Tabs &> % } <div class="error"> diff --git a/rt/share/html/Elements/Footer b/rt/share/html/Elements/Footer index e339a05e0..76819747c 100755 --- a/rt/share/html/Elements/Footer +++ b/rt/share/html/Elements/Footer @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -55,10 +55,8 @@ <%$d->Dump() %> </pre> % } - </body> </html> - <%ARGS> $Debug => 0 $Menu => 1 diff --git a/rt/share/html/Elements/GnuPG/KeyIssues b/rt/share/html/Elements/GnuPG/KeyIssues index 6478b1af2..23276c251 100644 --- a/rt/share/html/Elements/GnuPG/KeyIssues +++ b/rt/share/html/Elements/GnuPG/KeyIssues @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/GnuPG/SelectKeyForEncryption b/rt/share/html/Elements/GnuPG/SelectKeyForEncryption index 383553792..d61cde513 100644 --- a/rt/share/html/Elements/GnuPG/SelectKeyForEncryption +++ b/rt/share/html/Elements/GnuPG/SelectKeyForEncryption @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/GnuPG/SelectKeyForSigning b/rt/share/html/Elements/GnuPG/SelectKeyForSigning index 8e2b837de..244b46464 100644 --- a/rt/share/html/Elements/GnuPG/SelectKeyForSigning +++ b/rt/share/html/Elements/GnuPG/SelectKeyForSigning @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/GnuPG/SignEncryptWidget b/rt/share/html/Elements/GnuPG/SignEncryptWidget index 8be14af73..0ae0f841f 100644 --- a/rt/share/html/Elements/GnuPG/SignEncryptWidget +++ b/rt/share/html/Elements/GnuPG/SignEncryptWidget @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,10 +46,15 @@ %# %# END BPS TAGGED BLOCK }}} <table><tr> -<td><% loc('Sign')%></td> -<td><& /Widgets/Form/Boolean:InputOnly, Name => 'Sign', CurrentValue => $self->{'Sign'} &> -using <& SelectKeyForSigning, User => $session{'CurrentUser'}->UserObj &> -</td> +% my $columnsplit = "</td><td>"; +<td><% loc( 'Sign[_1][_2] using [_3]', + $columnsplit, + $m->scomp('/Widgets/Form/Boolean:InputOnly', + Name => 'Sign', CurrentValue => $self->{'Sign'} + ), + $m->scomp('SelectKeyForSigning', User => $session{'CurrentUser'}->UserObj ), +) |n %></td> + <td><% loc('Encrypt')%></td> <td><& /Widgets/Form/Boolean:InputOnly, Name => 'Encrypt', CurrentValue => $self->{'Encrypt'} &></td> </tr></table> @@ -143,23 +148,11 @@ if ( $self->{'Encrypt'} ) { my @recipients; if ( $Operation eq 'Update' ) { - # skip any email addresses that we won't be sending mail to - my %squelch = $m->comp( - '/Ticket/Elements/PreviewScrips:SquelchRecipients', - %$self, - TicketObj => $TicketObj - ); - - @recipients = $m->comp( - '/Ticket/Elements/PreviewScrips:GetRecipients', - %$self, TicketObj => $TicketObj - ); + @recipients = $TicketObj->DryRun(%$self)->Recipients; } elsif ( $Operation eq 'Create' ) { - @recipients = $m->comp( - '/Ticket/Elements/PreviewScrips:GetRecipientsOnCreate', - %$self, - ); + $TicketObj = RT::Ticket->new( $session{'CurrentUser'} ); + @recipients = $TicketObj->DryRunCreate(%$self)->Recipients; } else { $RT::Logger->crit('Incorrect operation: '. $Operation ); diff --git a/rt/share/html/Elements/GotoTicket b/rt/share/html/Elements/GotoTicket index 06ab81835..52db37532 100755 --- a/rt/share/html/Elements/GotoTicket +++ b/rt/share/html/Elements/GotoTicket @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/Header b/rt/share/html/Elements/Header index 64d548dc3..67588e33d 100755 --- a/rt/share/html/Elements/Header +++ b/rt/share/html/Elements/Header @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -54,6 +54,9 @@ } &> <%INIT> +#for "Site CSS from theme editor" below +#use Scalar::Util qw(blessed); + $r->headers_out->{'Pragma'} = 'no-cache'; $r->headers_out->{'Cache-control'} = 'no-cache'; @@ -65,23 +68,37 @@ $id =~ s|index$||g if $id ne 'index'; $id =~ s|-$||g; +my $style = $session{'CurrentUser'} + ? $session{'CurrentUser'}->Stylesheet + : RT->Config->Get('WebDefaultStylesheet'); + +my @css_files; +if ( RT->Config->Get('DevelMode') ) { + @css_files = ( "$style/main.css", RT->Config->Get('CSSFiles' ) ); +} +else { + my $key = + RT::Interface::Web::SquishedCSS( $style )->Key; + @css_files = "$style-squished-$key.css"; +} + my $head = ''; +#XXX $head .= <& /Elements/Framekiller &>; + if ($Refresh && $Refresh =~ /^(\d+)/ && $1 > 0) { $head .= qq( <meta http-equiv="refresh" content="$Refresh" /> ); } my $WebPath = RT->Config->Get('WebPath'); my $WebImagesURL = RT->Config->Get('WebImagesURL'); -my $WebDefaultStylesheet = - RT->Config->Get('WebDefaultStylesheet', $session{'CurrentUser'}); my $squished = RT->Config->Get('DevelMode') ? '' : '-squished'; -$head .= <<END; -<link rel="shortcut icon" href="$WebImagesURL/favicon.png" type="image/png" /> -<link rel="stylesheet" href="$WebPath/NoAuth/css/$WebDefaultStylesheet/main$squished.css" type="text/css" media="all" /> -<link rel="stylesheet" href="$WebPath/NoAuth/css/print.css" type="text/css" media="print" /> -END +$head .= qq(<link rel="shortcut icon" href="${WebImagesURL}favicon.png" type="image/png" />\n); +for my $cssfile ( @css_files ) { + $head .= qq(<link rel="stylesheet" href="$WebPath/NoAuth/css/$cssfile" type="text/css" media="all" />\n); +} +$head .= qq(<link rel="stylesheet" href="$WebPath/NoAuth/css/print.css" type="text/css" media="print" />\n); for (keys %{$LinkRel || {}}) { $head .= qq(<link rel="$_" href="$WebPath) . $LinkRel->{$_} . '" />'; @@ -92,18 +109,27 @@ if ( $RSSAutoDiscovery ) { } if ($JavaScript) { - $head .= $m->scomp('HeaderJavascript', focus => $Focus, onload => $onload); + $head .= $m->scomp('HeaderJavascript', focus => $Focus, onload => $onload, RichText => $RichText ); } -my $stylesheet_plugin = "/NoAuth/css/$WebDefaultStylesheet/InHeader"; +my $stylesheet_plugin = "/NoAuth/css/$style/InHeader"; if ($m->comp_exists($stylesheet_plugin) ) { $head .= $m->scomp($stylesheet_plugin); } +#<!-- Site CSS from theme editor --> +#<style type="text/css" media="all" id="sitecss"> +#%# Header is used when there isn't a database (such as in the Installer) which means there is no +#%# RT::System object, nor are there attributes. +#% if (blessed(RT->System) and my $attr = RT->System->FirstAttribute('UserCSS')) { +#<% $attr->Content |n %> +#% } +#</style> + # $m->callback( %ARGS, CallbackName => 'Head' ); $head .= $m->scomp( '/Elements/Callback', _CallbackName => 'Head', %ARGS ); -my $etc = ''; +my $etc = qq[ class="\L$style" ]; $etc .= qq[ id="comp-$id"] if $id; </%INIT> @@ -121,4 +147,6 @@ $RSSAutoDiscovery => undef $onload => undef $LinkRel => undef $JavaScript => 1 +$SkipDoctype => 0 +$RichText => 1 </%ARGS> diff --git a/rt/share/html/Elements/HeaderJavascript b/rt/share/html/Elements/HeaderJavascript index ce0b97621..e392ac262 100644 --- a/rt/share/html/Elements/HeaderJavascript +++ b/rt/share/html/Elements/HeaderJavascript @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -49,75 +49,39 @@ $focus => undef $onload => undef </%args> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/util.js"></script> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/titlebox-state.js"></script> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/ahah.js"></script> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/prototype/prototype.js"></script> -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls"></script> -% if ( RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ) { -<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/RichText/fckeditor.js"></script> + +% for my $jsfile ( @js_files ) { +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/<% $jsfile %>"></script> +% } + +% if ( $RichText and RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ) { +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/RichText/ckeditor.js"></script> % } <script type="text/javascript"><!-- - doOnLoad(loadTitleBoxStates); + jQuery( loadTitleBoxStates ); % if ( $focus ) { - doOnLoad(function () { focusElementById('<% $focus %>') }); + jQuery(function () { focusElementById('<% $focus %>') }); % } - % if ( $onload ) { - doOnLoad(<% $onload |n %>); + jQuery( <% $onload |n %> ); % } -% if ( RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})) { - function ReplaceAllTextareas() { - var sAgent = navigator.userAgent.toLowerCase(); - if (!FCKeditor_IsCompatibleBrowser() || - sAgent.indexOf('iphone') != -1 || - sAgent.indexOf('ipad') != -1 || - sAgent.indexOf('android') != -1 ) - return false; - - // replace all content and signature message boxes - var allTextAreas = document.getElementsByTagName("textarea"); - - for (var i=0; i < allTextAreas.length; i++) { - var textArea = allTextAreas[i]; - if ( (textArea.getAttribute('class') == 'messagebox') - || (textArea.getAttribute('className') == 'messagebox')) { - // Turn the original plain text content into HTML - -%# Special case - when we re-edit a textarea, don't re-encode it -% if (!$m->request_args->{'FCKeditorEncoded'}) { - textArea.value = textArea.value.replace( - /&/g, "&" - ).replace( - /</g, "<" - ).replace( - />/g, ">" - ).replace( - /\n/g, "\n<br />" - ); +% if ( $RichText and RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})) { + jQuery().ready(function () { ReplaceAllTextareas('<%$m->request_args->{'CKeditorEncoded'} || 0 %>') }); % } +--></script> +<%ARGS> +$RichText => 1 +</%ARGS> +<%INIT> -%# for this template.. - var FCKeditorEncoded = document.createElement('input'); - FCKeditorEncoded.setAttribute('type', 'hidden'); - FCKeditorEncoded.setAttribute('name', 'FCKeditorEncoded'); - FCKeditorEncoded.setAttribute('value', '1'); - textArea.parentNode.appendChild(FCKeditorEncoded); - -%# for FCKeditor.. - var typeField = document.createElement('input'); - typeField.setAttribute('type', 'hidden'); - typeField.setAttribute('name', textArea.name + 'Type'); - typeField.setAttribute('value', 'text/html'); - textArea.parentNode.appendChild(typeField); +my @js_files; +if ( RT->Config->Get('DevelMode') ) { + @js_files = RT->Config->Get('JSFiles' ); +} +else { + my $key = RT::Interface::Web::SquishedJS()->Key; + @js_files = "squished-$key.js"; +} - var oFCKeditor = new FCKeditor( textArea.name, '100%', <% RT->Config->Get('MessageBoxRichTextHeight', $session{CurrentUser} ) %> ); - oFCKeditor.BasePath = "<%RT->Config->Get('WebPath')%>/NoAuth/RichText/"; - oFCKeditor.ReplaceTextarea(); - } - } - } - doOnLoad(ReplaceAllTextareas); -% } ---></script> +</%INIT> diff --git a/rt/share/html/Elements/ListActions b/rt/share/html/Elements/ListActions index c0dee5bb7..999d3fe5b 100755 --- a/rt/share/html/Elements/ListActions +++ b/rt/share/html/Elements/ListActions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ListMenu b/rt/share/html/Elements/ListMenu index 57489e31f..7c9af5c5d 100644 --- a/rt/share/html/Elements/ListMenu +++ b/rt/share/html/Elements/ListMenu @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,13 +46,45 @@ %# %# END BPS TAGGED BLOCK }}} <%args> -$items +$menu </%args> <ul class="list-menu"> -% foreach my $key (sort keys %$items) { -<li><span class="menu-item"><a href="<%RT->Config->Get('WebPath')%><%$items->{$key}->{'path'}|n %>"><%$items->{$key}->{'title'}%></a></span><br /> -<span class="description"><%$items->{$key}->{description} || $items->{$key}->{text} %></span> - +% for my $child ($menu->children) { +<li><span class="menu-item"><% $show_link->( $child ) |n %></span><br /> +% if ( my $description = $child->description ) { +<span class="description"><% $description %></span>\ +% } </li> -%} +% } </ul> + +<%INIT> +my $web_path = RT->Config->Get('WebPath'); +my $interp = $m->interp; +my $show_link = sub { + my $e = shift; + my $res = ''; + if ( $e->path) { + $res .= '<a'; + my $url = (not $e->path or $e->path =~ m{^\w+:/}) + ? $e->path + : $web_path . $e->path; + $res .= ' href="'. $interp->apply_escapes($url, 'h') .'"' + if $url; + + if ( $e->target ) { + $res .= ' target="'. $interp->apply_escapes( $e->target, 'h' ) .'"'; + } + $res .= '>'; + } + + my $title = $e->title; + $title = $interp->apply_escapes( $title, 'h' ); + $res .= $title; + + if ( $e->path) { + $res .= '</a>'; + } + return $res; +}; +</%INIT> diff --git a/rt/share/html/Elements/Login b/rt/share/html/Elements/Login index eb645d47a..b86bfef16 100755 --- a/rt/share/html/Elements/Login +++ b/rt/share/html/Elements/Login @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} % $m->callback( %ARGS, CallbackName => 'Header' ); -<& /Elements/Header, Title => loc('Login'), Focus => 'user' &> - - -%# End of div#quickbar from /Elements/Header -</div> +<& /Elements/Header, Title => loc('Login'), Focus => 'user', RichText => 0 &> <div id="body" class="login-body"> @@ -80,6 +76,15 @@ <input type="hidden" name="next" value="<% $next %>" /> +<script type="text/javascript"> +jQuery(function(){ + if (window.location.hash) { + var form = jQuery("form[name=login]"); + form.attr('action', form.attr('action') + '#' + window.location.hash.replace(/^#/, '')); + } +}); +</script> + <div class="button-row"> <span class="input"><input type="submit" class="button" value="<&|/l&>Login</&>" /></span> </div> diff --git a/rt/share/html/Elements/Logo b/rt/share/html/Elements/Logo index d7cbd0bfb..8b4be4c81 100644 --- a/rt/share/html/Elements/Logo +++ b/rt/share/html/Elements/Logo @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,12 +45,18 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<div id="logo"> +<div id="<% $id %>"> +% if ($user_logo) { +<a href="<%$ARGS{'LogoLinkURL'}||RT->Config->Get('LogoLinkURL')%>"><img + src="<% RT->Config->Get('WebPath') %>/NoAuth/Helpers/CustomLogo/<% $user_logo->Content->{'hash'} %>" + alt="<%loc($ARGS{'LogoAltText'}||RT->Config->Get('LogoAltText'))%>" /></a> +% } else { <a href="<%$ARGS{'LogoLinkURL'}||RT->Config->Get('LogoLinkURL')%>"><img src="<%$ARGS{'LogoURL'}||RT->Config->Get('LogoURL')%>" 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> % } @@ -60,8 +66,28 @@ if ( exists $ARGS{'show_name'} ) { $RT::Logger->warning('show_name argument was renamed, use ShowName'); $ShowName = delete $ARGS{'show_name'}; } + +use Scalar::Util qw(blessed); +my $user_logo = blessed $RT::System ? $RT::System->FirstAttribute('UserLogo') : undef; + +# If we have the attribute, but no content, we don't really have a user logo +if ($user_logo) { + my $content = $user_logo->Content; + undef $user_logo + unless ref $content eq 'HASH' + and defined $content->{'data'}; +} + +if ($OnlyCustom + and not $user_logo + and ($ARGS{LogoURL}||RT->Config->Get('LogoURL')) =~ /bpslogo\.png$/) +{ + return; +} </%INIT> <%ARGS> $ShowName => 1 +$OnlyCustom => 0 $Name => undef +$id => 'logo' </%ARGS> diff --git a/rt/share/html/Elements/Logout b/rt/share/html/Elements/Logout deleted file mode 100644 index da01dc10d..000000000 --- a/rt/share/html/Elements/Logout +++ /dev/null @@ -1,62 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@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="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html"><&|/l&>Logout</&></a> -<%INIT> -my $show = 0; -if ( $session{'CurrentUser'}->Name - && ( !RT->Config->Get('WebExternalAuth') - || RT->Config->Get('WebFallbackToInternalAuth') - ) -) { - $show = 1; -} - -$m->callback( %ARGS, show => \$show ); - -return unless $show; -</%INIT> diff --git a/rt/share/html/Elements/MakeClicky b/rt/share/html/Elements/MakeClicky index 2f2b87990..57964f7a9 100644 --- a/rt/share/html/Elements/MakeClicky +++ b/rt/share/html/Elements/MakeClicky @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -61,8 +61,6 @@ my %actions = ( url_overwrite => sub { my %args = @_; my $result = qq{<a target="new" href="$args{'value'}">}; - #XXX: use spaces here. ­ <wbr> are not well supported :( - $args{'value'} =~ s/(\S{30})/$1 /g; $result .= qq{$args{'value'}</a>}; return qq{<span class="clickylink">$result</span>}; }, @@ -71,12 +69,12 @@ my %actions = ( my @types = ( { name => "httpurl", - regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}/, + regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#\S+)?/, action => "url", }, { name => "httpurl_overwrite", - regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}/, + regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}(?:#\S+)?/, action => "url_overwrite", }, ); @@ -178,9 +176,7 @@ provides two formats: link after the URL. * 'httpurl_overwrite': also detects URLs as 'httpurl' format, but - replace URL with link and *adds spaces* into text if it's longer - then 30 chars. This allow browser to wrap long URLs and avoid - horizontal scrolling. + replace URL with link. To extend this with your own types of data, use the callback. It will be provided with: @@ -202,6 +198,6 @@ It will be provided with: 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 +Read more about writing new actions in docs/extending/clickable_links.pod </%doc> diff --git a/rt/share/html/Elements/Menu b/rt/share/html/Elements/Menu index c87981a3b..b56bacda8 100755 --- a/rt/share/html/Elements/Menu +++ b/rt/share/html/Elements/Menu @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,95 +45,40 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<ul<% !$level ? ' id="system-menu"' : ''|n %><% $menu_class ? qq[ class="$menu_class"] : ''|n %>> -<div<% $menu_class ? qq[ class="$menu_class"] : ''|n %>><div class="wrapper"> -<%perl> - my $sep = 0; - my $postsep = 0; - my $accesskey = 1; - - $count = 0; - $class = {}; - -my @tabs = sort keys %$toptabs; - foreach $tab (@tabs) { - $count++; - - my $current = $current_toptab || ''; - my $path = $toptabs->{$tab}->{'path'} || ""; - - $path =~ s#/index.html$##gi; - $current =~ s#/index.html$##gi; - - $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0; - - my @aclass; - push @aclass, 'selected' - if $path eq $current; - - push @aclass, 'odd' - if $level % 2; - - $class->{a} = join ' ', @aclass; - - my @li; - push @li, 'first' - if $count == 1; - - push @li, 'pre-separator' - if $sep; - - push @li, 'post-separator' - if $postsep; - - push @li, 'last' if ( $tab eq $tabs[-1]); - $class->{li} = join ' ', @li; - - my $url = ($toptabs->{$tab}->{'path'}||'') =~ /^(?:https?|mailto):/i - ? $toptabs->{$tab}->{'path'} || '' - : RT->Config->Get('WebPath') . "/" . $toptabs->{$tab}->{'path'}; - -</%perl> - <li<% $class->{'li'} ? qq[ class="$class->{li}"] : ''|n %> > - <% $count > 1 && !$postsep && qq[<span class="bullet">· </span>]|n%> - <a href="<% $url %>" - <% $class->{a} && qq[ class="$class->{a}"] |n %> - <% !$level && " accesskey='".$accesskey++."'" |n %>> - <% $toptabs->{$tab}->{'title'}%></a> - -%# Second-level items -% if ($toptabs->{$tab}->{'subtabs'} -% and keys %{$toptabs->{$tab}->{'subtabs'}}) -% { - <& /Elements/Menu, level => $level+1, - current_toptab => $toptabs->{$tab}->{'current_subtab'}, - toptabs => $toptabs->{$tab}->{'subtabs'}, - last_level => $toptabs->{$tab}->{last_system_menu_level} &> -% } - </li> -% if ($sep) { - <li class="separator">···</li> -% } -% -% $postsep = $sep; +% return unless ($menu); +<%" " x $depth%><ul<%$id ? ' id="'.$id.'"' : '' |n%><% $toplevel? ' class="toplevel"' : '' |n %>> +% for my $child ($menu->children) { +% my $item_id = lc(($parent_id? $parent_id."-" : "") .$child->key); +% $item_id =~ s/\s/-/g; +% my @classes; +% push @classes, 'has-children' if $child->has_children; +% push @classes, 'active' if $child->active; +<%" " x ($depth+1)%><li id="li-<%$item_id%>"\ +% if (@classes) { + class="<% join ' ', @classes %>"\ % } -</div></div> -</ul> - -<%INIT> -my ($tab, $class, $count); - -my @ul; -push @ul, 'last-menu-level' - if $last_level; -push @ul, 'odd' - if $level % 2; -my $menu_class = join ' ', @ul; -</%INIT> +>\ +% if ($child->raw_html) { +<% $child->raw_html |n %> +% } else { +% my $url = (not $child->path or $child->path =~ m{^\w+:/}) ? $child->path : RT->Config->Get('WebPath').$child->path; +<a id="<%$item_id%>" class="menu-item <% $child->class || '' %>"<% $child->path ? ' href="'.$url.'"' : '' |n%><% $child->target ? ' target="'.$child->target.'"' : '' |n %>>\ +<% $child->escape_title ? $m->interp->apply_escapes($child->title, 'h') : $child->title |n %>\ +</a>\ +% } +% if ($child->has_children) { +<& Menu, menu => $child, toplevel => 0, parent_id => ($parent_id? $parent_id."-": '').$child->key, depth=> ($depth+1) &> +<%" " x ($depth+1)%></li> +% } else { +</li> +% } +% } +<%" " x $depth%></ul>\ <%ARGS> -$toptabs => {} -$current_toptab => '' -$level => 0 -$last_level => 0 +$menu +$id => undef +$toplevel => 1 +$parent_id => '' +$depth => 0 </%ARGS> diff --git a/rt/share/html/Elements/MessageBox b/rt/share/html/Elements/MessageBox index 3bc73eb5a..2943cab4e 100755 --- a/rt/share/html/Elements/MessageBox +++ b/rt/share/html/Elements/MessageBox @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,7 +45,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<textarea class="messagebox" cols="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\ +<textarea autocomplete="off" class="messagebox" <% $cols |n %> rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\ +% $m->comp('/Articles/Elements/IncludeArticle', %ARGS); % $m->callback( %ARGS, SignatureRef => \$signature ); <% $Default || '' %><% $message %><% $signature %></textarea> % $m->callback( %ARGS, CallbackName => 'AfterTextArea' ); @@ -70,13 +71,19 @@ if ( not RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ) { $wrap_type = qq(wrap="$Wrap"); } +# If there's no cols specified, we want to set the width to 100% +my $cols = 'style="width: 100%"'; +if ( defined $Width and length $Width ) { + $cols = qq(cols="$Width"); +} + </%INIT> <%ARGS> $QuoteTransaction => undef $Name => 'Content' $Default => '' -$Width => RT->Config->Get('MessageBoxWidth', $session{'CurrentUser'} ) || 72 +$Width => RT->Config->Get('MessageBoxWidth', $session{'CurrentUser'} ) $Height => RT->Config->Get('MessageBoxHeight', $session{'CurrentUser'} ) || 15 -$Wrap => RT->Config->Get('MessageBoxWrap') || 'HARD' +$Wrap => RT->Config->Get('MessageBoxWrap', $session{'CurrentUser'} ) || 'SOFT' $IncludeSignature => RT->Config->Get('MessageBoxIncludeSignature'); </%ARGS> diff --git a/rt/share/html/Elements/MyAdminQueues b/rt/share/html/Elements/MyAdminQueues index e54d05464..92c87b53a 100644 --- a/rt/share/html/Elements/MyAdminQueues +++ b/rt/share/html/Elements/MyAdminQueues @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,9 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <&|/Widgets/TitleBox, title => loc("Queues I administer"), bodyclass => "" &> -<& /Elements/QueueSummary, - cache => 'my_admin_queues', +<& /Elements/QueueSummaryByStatus, queue_filter => sub { $_->CurrentUserHasRight('AdminQueue') }, - conditions => [ {cond => "Status = 'new'", name => loc ('new') }, - {cond => "Status = 'open'", name => loc ('open') }] &> +&> </&> diff --git a/rt/share/html/Elements/MyRT b/rt/share/html/Elements/MyRT index e8cc4bba2..2447fed04 100644 --- a/rt/share/html/Elements/MyRT +++ b/rt/share/html/Elements/MyRT @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -75,6 +75,8 @@ unless ( $Portlets ) { ); } +$m->callback( CallbackName => 'MassagePortlets', Portlets => $Portlets ); + my ($body, $summary) = @{$Portlets}{qw(body summary)}; unless( $body && @$body ) { $body = $summary || []; diff --git a/rt/share/html/Elements/MyReminders b/rt/share/html/Elements/MyReminders index 83c945452..2de4b530f 100755 --- a/rt/share/html/Elements/MyReminders +++ b/rt/share/html/Elements/MyReminders @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,35 +48,13 @@ %# DEPRECATED <&|/Widgets/TitleBox, class => 'reminders', - title => loc("Reminders") &> -<table width="100%"> -% my $i =0; -% while (my $reminder = $reminders->Next) { -% $i++; -% if ($reminder->RefersTo->First) { -% my $ticket= $reminder->RefersTo->First->TargetObj; -% if ( $ticket ) { -<tr class="<%$i%2 ? 'evenline' : 'oddline'%>"><td><a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$ticket->id%>"><%$reminder->Subject%></a><br /> -<blockquote> -#<%$ticket->id%>: <%$ticket->Subject%><br /> -<& /Elements/ShowUser, User => $reminder->OwnerObj &> <%$reminder->DueObj->Unix >0 ? '• '.$reminder->DueObj->AgeAsString : '' |n %> -</blockquote> -</td> -</tr> -% } -% else { - <div class="error"><div class="error"> -Couldn't find TargetObj for reminder <% $reminder->id %>.<br/> -Maybe Organization config was changed? Please contact administrator. - </div></div> -% }}} -</table> + title => loc("My reminders"), + title_href => RT->Config->Get('WebPath') . '/Tools/MyReminders.html' &> + +<& /Elements/ShowReminders &> + </&> <%init> return unless RT->Config->Get('EnableReminders'); -my $reminders = RT::Tickets->new($session{'CurrentUser'}); -$reminders->FromSQL('(Owner = "Nobody" OR Owner = "'.$session{'CurrentUser'}->Name.'")' . - ' AND Type = "reminder" AND (Status = "new" OR Status = "open")'); -$reminders->OrderBy(FIELD => 'Due', ORDER => 'ASC'); </%init> diff --git a/rt/share/html/Elements/MyRequests b/rt/share/html/Elements/MyRequests index be7a9f549..2ceb7f5b8 100755 --- a/rt/share/html/Elements/MyRequests +++ b/rt/share/html/Elements/MyRequests @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/MySupportQueues b/rt/share/html/Elements/MySupportQueues index 5a531f0ae..a098d5e8e 100644 --- a/rt/share/html/Elements/MySupportQueues +++ b/rt/share/html/Elements/MySupportQueues @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,15 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <&|/Widgets/TitleBox, title => loc("Queues I'm an AdminCc for"), bodyclass => "" &> -<& /Elements/QueueSummary, - cache => 'my_support_queues', +<& /Elements/QueueSummaryByStatus, queue_filter => sub { $_->IsAdminCc($session{'CurrentUser'}->Id) }, - conditions => \@conditions, &> </&> -<%INIT> -my @conditions = (); -foreach ( RT::Queue->ActiveStatusArray ) { - push @conditions, { cond => "Status = '$_'", name => loc($_) }; -} -</%INIT> diff --git a/rt/share/html/Elements/MyTickets b/rt/share/html/Elements/MyTickets index 84ab491af..2b9423299 100755 --- a/rt/share/html/Elements/MyTickets +++ b/rt/share/html/Elements/MyTickets @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/PageLayout b/rt/share/html/Elements/PageLayout index cc0bb06dc..5956a3bed 100755 --- a/rt/share/html/Elements/PageLayout +++ b/rt/share/html/Elements/PageLayout @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,210 +48,17 @@ <% include('/elements/init_calendar.html') |n %> -% if (0) { ## new ticket via customer, and we already have a ticket search box -<div id="topactions"> -% foreach my $action (reverse sort keys %{$topactions}) { -<span class="topaction" id="topaction-<%$action%>"><% $topactions->{"$action"}->{'html'} |n %></span> -% } -</div> -% } - -% if (0) { ##FREESIDE MENUS INSTEAD## if ( $show_menu ) { % if ( $show_menu ) { -<div id="nav"> -<& /Elements/Menu, toptabs => $toptabs, current_toptab => $current_toptab &> -</div> -% } -% } - -<div id="header"> -%#already shown <h1><% $title %></h1> -<div id="page-navigation"> -% my $sep = 0; -% my $postsep = 0; -% my $count = 0; -% my $class = { }; -% - <ul id="page-menu" <% (($actions && %$actions) || ($subactions && %$subactions)) && q[ class="actions-present"] | n %>> - <div><div><div> -<%perl> - if ($page_tabs) { - my @tabs = ( sort grep { $_ !~ /^(?:current_toptab|this)$/ } keys %{$page_tabs}); - my $tab_idx = -1; - foreach my $tab ( @tabs ) { - $count++; - $tab_idx++; - - my $current = $page_tabs->{current_toptab} || ""; - my $path = $page_tabs->{$tab}->{'path'} || ""; - - $path =~ s#(/index\.html)?(\?)?$##gi; - $current =~ s#(/index\.html)?(\?)?$##gi; - - $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0; - - my $next_tab = $tabs[$tab_idx+1]; - if ($next_tab && $toptabs->{$next_tab}->{'pre_separator'}) { - $sep = 1; - } - - $class->{a} = $path eq $current ? ' class="selected"' : undef; - - my @li; - push @li, 'first' if $count == 1; - push @li, 'pre-separator' if $sep; - push @li, 'post-separator' if $postsep; - push @li, 'last' if $tab eq $tabs[-1]; - $class->{li} = join ' ', @li; - - my $href = $page_tabs->{$tab}->{'path'} || ""; - $href = RT->Config->Get('WebPath') .'/'. $href - unless $path =~ /^\w+:/; - my $target = $page_tabs->{$tab}->{'target'} || ''; - $target = $m->interp->apply_escapes( $target, 'h' ); -</%perl> - <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && "· "|n%><a href="<% $href %>"<%$class->{a}|n%><% $class->{a} ? ' name="focus"' : ''|n %><% $target? " target='$target'": '' |n %>><% $page_tabs->{$tab}->{'title'} %></a></li> -% -% if ($sep) { - <li class="separator">···</li> -% } -% $postsep = $sep; -% } -% } else { - -% } - </div></div></div> - </ul> - -% if (($actions && %$actions) || ($subactions && %$subactions)) { - <ul id="actions-menu"> - <div><div><div> -<%perl> - $sep = 0; - $postsep = 0; - $count = 0; - $class = { }; - - for my $type ($actions, $subactions) { - - if ($type && %$type) { - my @actions = sort keys %{$type}; - my $action_idx = -1; - foreach my $action (@actions) { - $count++; - $action_idx++; - - $sep = $type->{$action}->{'separator'} ? 1 : 0; - - my $next_action = $actions[$action_idx+1]; - if ($next_action && $type->{$next_action}->{'pre_separator'}) { - $sep = 1; - } - - my @li; - push @li, 'first' if $count == 1; - push @li, 'pre-separator' if $sep; - push @li, 'post-separator' if $postsep; - push @li, 'last' if $action eq $actions[-1]; - - $class->{li} = join ' ', @li; -</%perl> - <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && qq[<span class="bullet">· </span>]|n%> -% if ($type->{"$action"}->{'html'}) { - <% $type->{"$action"}->{'html'} | n %> -% } else { - <a href="<%RT->Config->Get('WebPath')%>/<%$type->{$action}->{'path'}%>"<% $type->{$action}->{class} && ' class="'.$type->{$action}->{class}.'"' |n %><% $type->{$action}->{id} && ' id="'.$type->{$action}->{id}.'"' |n %>><%$type->{$action}->{'title'}%></a> -% } - </li> -% if ($sep) { - <li class="separator">···</li> -% } -% $postsep = $sep; -% } -% } +%# #FREESIDE MENUS INSTEAD## <div id="main-navigation"><& /Elements/Menu, menu => Menu(), id => 'app-nav' &></div> +<div id="page-navigation"><& /Elements/Menu, menu => PageMenu(), id => 'page-menu', 'parent_id' => 'page' &></div> % } - </div></div></div> - </ul> +% if (0) { ## new ticket via customer, and we already have a ticket search box +<div id="topactions"><& /Elements/WidgetBar, menu => PageWidgets() &></div> % } -</div> -</div> <div id="body"> % $m->callback( %ARGS, CallbackName => 'BeforeBody' ); % $m->flush_buffer(); # we've got the page laid out, let's flush the buffer; - -<%INIT> -if ( defined $current_toptab ) { - foreach my $tab ( values %{$toptabs} ) { - next unless $tab->{'path'} eq $current_toptab; - @{ $tab }{ qw(subtabs current_subtab) } = ($tabs, $current_tab); - } -} - -my ($menu_depth, $almost_last, $page_tabs); - -# don't pull out the last submenu for 3.5-compat theme -# see #14853 for details. -if (RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} ) ne '3.4-compat') { - ($menu_depth, $almost_last) = @{ $m->comp('.menu_recurse', data => $toptabs, current => $current_toptab ) }; - - if (defined $almost_last->{subtabs} and %{$almost_last->{subtabs}}) { - $page_tabs = { - current_toptab => $almost_last->{current_subtab}, - %{$almost_last->{subtabs}}, - }; - - delete $almost_last->{subtabs}; - delete $almost_last->{current_subtab}; - } -} -</%INIT> - -%# There's probably a better way to do this that involves three times as -%# much work and redoing the whole menu/tab system... which would seem a -%# bit out of scope. -%# -%# This function recurses through the menu and returns the second to -%# last menu, that is, the menu holding the last reference to -%# and submenu. It also returns the number of menu levels minus -%# the last submenu. -<%def .menu_recurse> - <%args> - $data => { } - $current => '' - $pdata => { } - $ppdata => { } - $level => 0 - </%args> - <%init> - if ($current) { - for my $key (keys %$data) { - next if !defined $data->{$key}->{'path'} - || $data->{$key}->{'path'} ne $current; - next unless ref( $data->{$key} ) eq 'HASH' - && ref( $data->{$key}->{'subtabs'} ) eq 'HASH' - && keys %{ $data->{$key}->{'subtabs'} }; - return $m->comp('.menu_recurse', - data => $data->{$key}->{'subtabs'}, - current => $data->{$key}->{'current_subtab'} || '', - pdata => $data->{$key}, - ppdata => $pdata, - level => $level + 1, - ); - } - } - $ppdata->{last_system_menu_level}++; - return [$level, $pdata]; - </%init> -</%def> - <%ARGS> -$current_toptab => undef -$current_tab => undef -$toptabs => undef -$topactions => undef -$tabs => undef -$actions => undef -$subactions => undef $title => $m->callers(-1)->path $show_menu => 1 </%ARGS> diff --git a/rt/share/html/Elements/PersonalQuickbar b/rt/share/html/Elements/PersonalQuickbar index 993c4578f..d9b152879 100644 --- a/rt/share/html/Elements/PersonalQuickbar +++ b/rt/share/html/Elements/PersonalQuickbar @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,14 +50,8 @@ $Prefs => '/Prefs/Other.html' </%ARGS> <div id="quick-personal"> <span class="hide"><a href="#skipnav"><&|/l&>Skip Menu</&></a> | </span> -% if ($session{'CurrentUser'}->Name) { - <&|/l, "<span>".$session{'CurrentUser'}->Name."</span>" &>Logged in as [_1]</&> -% if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System ) ) { - | <a href="<%RT->Config->Get('WebPath')%><%$Prefs%>"><&|/l&>Preferences</&></a> -% } -% } else { - <&|/l&>Not logged in.</&> +% unless ($session{'CurrentUser'}->Id) { + <span id="not-logged-in"><&|/l&>Not logged in.</&></span> % } % $m->callback( %ARGS ); -<& Logout, %ARGS &> </div> diff --git a/rt/share/html/Elements/QueryString b/rt/share/html/Elements/QueryString index a19b54ee7..35a579c1a 100644 --- a/rt/share/html/Elements/QueryString +++ b/rt/share/html/Elements/QueryString @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/QueueSummary b/rt/share/html/Elements/QueueSummary deleted file mode 100644 index a18444032..000000000 --- a/rt/share/html/Elements/QueueSummary +++ /dev/null @@ -1,108 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@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 }}} -<table border="0" cellspacing="0" cellpadding="1" width="100%" class="queue-summary"> -<tr> - <th class="collection-as-table"><&|/l&>Queue</&></th> -% for my $condition (@$conditions) { - <th class="collection-as-table"><% $condition->{name} %></th> -% } -</tr> -% my $i; -% for my $queue (@queues) { -% $i++; -% my $name = $queue->{Name}; -% $name =~ s/'/\\'/g; -% my $queue_cond = "Queue = '$name' AND "; -% my $all_q = $queue_cond . "(".join( " OR ", map $_->{cond}, @$conditions).")"; -<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" > -<td><a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $all_q |u,n %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a></td> -% for my $condition (@$conditions) { -% $Tickets->FromSQL( "Queue = $queue->{id} AND ". $condition->{cond} ); -<td align="right"><a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $queue_cond.$condition->{cond} |u,n %>"><% $Tickets->Count %></a></td> -% } -</tr> -% } -</table> -<%INIT> -# Ensure sane default -unless ( @$conditions ) { - foreach (RT::Queue->ActiveStatusArray()) { - push @$conditions, { cond => "Status = '$_'", name => loc($_) }; - } -} - - -my @queues; - -if ($cache && exists $session{$cache}) { - @queues = @{$session{$cache}}; -} -else { - my $Queues = RT::Queues->new($session{'CurrentUser'}); - $Queues->UnLimit(); - @queues = grep $queue_filter->($_), @{$Queues->ItemsArrayRef}; - - $m->callback( CallbackName => 'Filter', Queues => \@queues ); - - @queues = map { { - id => $_->Id, - Name => $_->Name, - Description => $_->Description, - } } grep $_, @queues; - - $session{$cache} = \@queues if $cache; -} - - -my $Tickets = RT::Tickets->new($session{'CurrentUser'}); -</%INIT> -<%ARGS> -$cache => undef -$queue_filter => undef -$conditions => [] -</%ARGS> diff --git a/rt/share/html/Elements/QuickCreate b/rt/share/html/Elements/QuickCreate index a4d5235e2..94be7eb9c 100644 --- a/rt/share/html/Elements/QuickCreate +++ b/rt/share/html/Elements/QuickCreate @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,7 +47,11 @@ %# END BPS TAGGED BLOCK }}} <div class="quick-create"> <&| /Widgets/TitleBox, title => loc('Quick ticket creation') &> -<form method="post" action="<%RT->Config->Get('WebPath')%>/index.html"> +<form + method="post" + action="<%RT->Config->Get('WebPath')%>/index.html" +% $m->callback(CallbackName => 'InFormElement'); +> <input type="hidden" class="hidden" name="QuickCreate" value="1" /> <table> <tr class="input-row"><td class="label"><&|/l&>Subject</&>:</td> @@ -58,7 +62,7 @@ <td class="label"><&|/l&>Owner</&>:</td><td class="value"> <select type="select" name="Owner"> <option value="<%$session{'CurrentUser'}->id%>" selected="selected"><&|/l&>Me</&></option> -<option value="<%$RT::Nobody->id%>"><%loc('Nobody')%></option> +<option value="<%RT->Nobody->id%>"><%loc('Nobody')%></option> </select> </td> </tr> diff --git a/rt/share/html/Elements/Quicksearch b/rt/share/html/Elements/Quicksearch index 0eaa76367..abc859b7d 100755 --- a/rt/share/html/Elements/Quicksearch +++ b/rt/share/html/Elements/Quicksearch @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,21 +46,21 @@ %# %# END BPS TAGGED BLOCK }}} <div class="ticket-overview"> -<&|/Widgets/TitleBox, title => loc("Quick search"), bodyclass => "", - titleright => loc("Edit"), titleright_href => RT->Config->Get('WebPath').'/Prefs/Quicksearch.html' &> -<& /Elements/QueueSummary, - cache => 'quick_search_queues', +<&|/Widgets/TitleBox, + title => loc("Quick search"), + bodyclass => "", + titleright => loc("Edit"), + titleright_href => RT->Config->Get('WebPath').'/Prefs/Quicksearch.html', +&> +<& $comp, queue_filter => sub { $_->CurrentUserHasRight('ShowTicket') && !exists $unwanted->{$_->Name} }, - conditions => \@conditions, &> </&> </div> <%INIT> my $unwanted = $session{'CurrentUser'}->UserObj->Preferences('QuickSearch', {}); - -my @conditions = (); -foreach ( RT::Queue->ActiveStatusArray ) { - push @conditions, { cond => "Status = '$_'", name => loc($_) }; -} -$m->callback( CallbackName => 'Conditions', conditions => \@conditions ); +my $comp = $SplitByLifecycle? '/Elements/QueueSummaryByLifecycle' : '/Elements/QueueSummaryByStatus'; </%INIT> +<%ARGS> +$SplitByLifecycle => 1 +</%ARGS> diff --git a/rt/share/html/Elements/RT__CustomField/ColumnMap b/rt/share/html/Elements/RT__CustomField/ColumnMap index c0e17f264..06e2674ca 100644 --- a/rt/share/html/Elements/RT__CustomField/ColumnMap +++ b/rt/share/html/Elements/RT__CustomField/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/RT__Group/ColumnMap b/rt/share/html/Elements/RT__Group/ColumnMap index 8985048ce..bfc520b0f 100644 --- a/rt/share/html/Elements/RT__Group/ColumnMap +++ b/rt/share/html/Elements/RT__Group/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/RT__Queue/ColumnMap b/rt/share/html/Elements/RT__Queue/ColumnMap index 938e63142..00655c5eb 100644 --- a/rt/share/html/Elements/RT__Queue/ColumnMap +++ b/rt/share/html/Elements/RT__Queue/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -89,6 +89,7 @@ my $COLUMN_MAP = { foreach my $field (qw( Name Description CorrespondAddress CommentAddress InitialPriority FinalPriority DefaultDueIn + Lifecycle )) { $COLUMN_MAP->{$field} = { title => $field, diff --git a/rt/share/html/Elements/RT__SavedSearch/ColumnMap b/rt/share/html/Elements/RT__SavedSearch/ColumnMap index 780ee838a..381e120f7 100644 --- a/rt/share/html/Elements/RT__SavedSearch/ColumnMap +++ b/rt/share/html/Elements/RT__SavedSearch/ColumnMap @@ -2,8 +2,8 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC -%# <jesse@bestpractical.com> +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) %# @@ -58,7 +58,7 @@ my $COLUMN_MAP = { value => sub { return $_[0]->Id }, }, Name => { - title => sub { return "foo" }, #'Name', # loc + title => 'Name', # loc attribute => 'Name', value => sub { return $_[0]->Name()||loc("Unnamed search") }, }, diff --git a/rt/share/html/Elements/RT__Scrip/ColumnMap b/rt/share/html/Elements/RT__Scrip/ColumnMap index 8130ea686..776a2d8a3 100644 --- a/rt/share/html/Elements/RT__Scrip/ColumnMap +++ b/rt/share/html/Elements/RT__Scrip/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/RT__Template/ColumnMap b/rt/share/html/Elements/RT__Template/ColumnMap index d9d55cf90..5a8c6f2c7 100644 --- a/rt/share/html/Elements/RT__Template/ColumnMap +++ b/rt/share/html/Elements/RT__Template/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/RT__Ticket/ColumnMap b/rt/share/html/Elements/RT__Ticket/ColumnMap index 35c0aad86..787862d6a 100644 --- a/rt/share/html/Elements/RT__Ticket/ColumnMap +++ b/rt/share/html/Elements/RT__Ticket/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -266,10 +266,10 @@ $COLUMN_MAP = { { my %key = RT::Crypt::GnuPG::GetKeyInfo($email); if (!defined $key{'info'}) { - $email .= loc(" (no pubkey!)"); + $email .= ' ' . loc("(no pubkey!)"); } elsif ($key{'info'}{'TrustLevel'} == 0) { - $email .= loc(" (untrusted!)"); + $email .= ' ' . loc("(untrusted!)"); } } return join ', ', @requestors; diff --git a/rt/share/html/Elements/RT__User/ColumnMap b/rt/share/html/Elements/RT__User/ColumnMap index 2d2dab7a9..1f8fc20cb 100644 --- a/rt/share/html/Elements/RT__User/ColumnMap +++ b/rt/share/html/Elements/RT__User/ColumnMap @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -59,78 +59,88 @@ my $COLUMN_MAP = { }, Name => { title => 'Name', # loc - attribute => 'Name', - value => sub { return $_[0]->Name() }, + attribute => 'Name', + value => sub { return $_[0]->Name() }, }, RealName => { - title => 'RealName', # loc - attribute => 'RealName', - value => sub { return $_[0]->RealName() }, + title => 'Real Name', # loc + attribute => 'RealName', + value => sub { return $_[0]->RealName() }, }, NickName => { - title => 'NickName', # loc - attribute => 'NickName', - value => sub { return $_[0]->NickName() }, + title => 'Nickname', # loc + attribute => 'NickName', + value => sub { return $_[0]->NickName() }, }, EmailAddress => { - title => 'EmailAddress', # loc - attribute => 'EmailAddress', - value => sub { return $_[0]->EmailAddress() }, + title => 'Email Address', # loc + attribute => 'EmailAddress', + value => sub { return $_[0]->EmailAddress() }, }, Organization => { title => 'Organization', # loc - attribute => 'Organization', - value => sub { return $_[0]->Organization() }, + attribute => 'Organization', + value => sub { return $_[0]->Organization() }, }, HomePhone => { - title => 'HomePhone', # loc - attribute => 'HomePhone', - value => sub { return $_[0]->HomePhone() }, + title => 'Home Phone', # loc + attribute => 'HomePhone', + value => sub { return $_[0]->HomePhone() }, }, WorkPhone => { - title => 'WorkPhone', # loc - attribute => 'WorkPhone', - value => sub { return $_[0]->WorkPhone() }, + title => 'Work Phone', # loc + attribute => 'WorkPhone', + value => sub { return $_[0]->WorkPhone() }, }, MobilePhone => { - title => 'MobilePhone', # loc - attribute => 'MobilePhone', - value => sub { return $_[0]->MobilePhone() }, + title => 'Mobile Phone', # loc + attribute => 'MobilePhone', + value => sub { return $_[0]->MobilePhone() }, }, PagerPhone => { - title => 'PagerPhone', # loc - attribute => 'PagerPhone', - value => sub { return $_[0]->PagerPhone() }, + title => 'Pager Phone', # loc + attribute => 'PagerPhone', + value => sub { return $_[0]->PagerPhone() }, }, Address1 => { - title => 'Address1', # loc - attribute => 'Address1', - value => sub { return $_[0]->Address1() }, + title => 'Address', # loc + attribute => 'Address1', + value => sub { return $_[0]->Address1() }, }, Address2 => { - title => 'Address2', # loc - attribute => 'Address2', - value => sub { return $_[0]->Address2() }, + title => 'Address 2', # loc + attribute => 'Address2', + value => sub { return $_[0]->Address2() }, }, City => { title => 'City', # loc - attribute => 'City', - value => sub { return $_[0]->City() }, + attribute => 'City', + value => sub { return $_[0]->City() }, }, State => { title => 'State', # loc - attribute => 'State', - value => sub { return $_[0]->State() }, + attribute => 'State', + value => sub { return $_[0]->State() }, }, Zip => { title => 'Zip', # loc - attribute => 'Zip', - value => sub { return $_[0]->Zip() }, + attribute => 'Zip', + value => sub { return $_[0]->Zip() }, }, Country => { title => 'Country', # loc - attribute => 'Country', - value => sub { return $_[0]->Country() }, + attribute => 'Country', + value => sub { return $_[0]->Country() }, + }, + Gecos => { + title => 'Unix login', #loc + attribute => 'Gecos', + value => sub { return $_[0]->Gecos() }, + }, + Lang => { + title => 'Language', #loc + attribute => 'Lang', + value => sub { return $_[0]->Lang() }, }, }; diff --git a/rt/share/html/Elements/Refresh b/rt/share/html/Elements/Refresh index b09ff80e6..ee51fb3af 100755 --- a/rt/share/html/Elements/Refresh +++ b/rt/share/html/Elements/Refresh @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/RefreshHomepage b/rt/share/html/Elements/RefreshHomepage index cb6611a74..2cdaf4af9 100644 --- a/rt/share/html/Elements/RefreshHomepage +++ b/rt/share/html/Elements/RefreshHomepage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SavedSearches b/rt/share/html/Elements/SavedSearches index 96d589fc1..b18d86c52 100644 --- a/rt/share/html/Elements/SavedSearches +++ b/rt/share/html/Elements/SavedSearches @@ -1,70 +1,76 @@ -<& /Elements/ListActions, actions => \@results &> -<table width="100%"><tr> -% foreach my $type ('Ticket', 'Chart') { -<td width="50%"> -<&|/Widgets/TitleBox, title => loc('Saved '.$titles{$type}) &> -% foreach my $Object (@Objects) { -% $SavedSearches = RT::SavedSearches->new($session{CurrentUser}); -% $SavedSearches->LimitToPrivacy(join('-',ref($Object),$Object->Id), $type); -% my $title = $titles{$type}; -% if (ref $Object eq 'RT::User' && $Object->Id == $session{CurrentUser}->Id) { -% $title = loc("My saved ".lc($title)); -% } else { -% $title = loc("[_1]'s saved ".lc($title),$Object->Name); -% } -% $title = $m->interp->apply_escapes($title, 'h'); -% -% my $oid = join('-', ref($Object), $Object->Id, 'SavedSearch', '__id__'); -% my $resultpath = $paths{$type}; -% my @cols = ( -% qq{<a href="__WebPath__/$resultpath?__ResultsURL__">__Name__</a>/TITLE:$title}, -% '__Query__', -% qq{<a href="__WebPath__/Search/Build.html?SavedSearchLoad=$oid">[Edit]</a> } . -% qq{<a href="$uri?Delete=$oid">[Delete]</a>/TITLE:}, -% ); -% my $format = join(',', map { "'$_'" } @cols); +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# <sales@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 }}} +<&|/Widgets/TitleBox, title => loc('Saved Searches') &> +% foreach my $Object (@Objects) { +% my $SavedSearches = RT::SavedSearches->new($session{CurrentUser}); +% $SavedSearches->LimitToPrivacy(join('-',ref($Object),$Object->Id),'Ticket'); +% my $title; +% if (ref $Object eq 'RT::User' && $Object->Id == $session{CurrentUser}->Id) { +% $title = loc("My saved searches"); +% } else { +% $title = loc("[_1]'s saved searches",$Object->Name); +% } +% $title = $m->interp->apply_escapes($title, 'h'); <& /Elements/CollectionList, %ARGS, Class => 'RT::SavedSearch', - Format => $format, + Format => qq{'<a href="__WebPath__/Search/Results.html?__ResultsURL__">__Name__</a>/TITLE:$title'}, Collection => $SavedSearches, PassArguments => [qw(Format Name id)], &> -% } #foreach $Object +% } </&> -</td> -% } #foreach $type -</tr></table> <%init> -my @Objects; -my $SavedSearches = RT::SavedSearches->new($session{'CurrentUser'}); -push @Objects, $SavedSearches->_PrivacyObjects; +my @Objects = RT::SavedSearch->new($session{CurrentUser})->ObjectsForLoading; push @Objects, RT::System->new( $session{'CurrentUser'} ) if $session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser' ); - -my $uri = '__WebPath__'.$m->request_path; - -my @results; -if ( $Delete =~ /(.*)-SavedSearch-(\d+)/) { - my ($privacy, $id) = ($1, $2); - my $record = RT::SavedSearch->new($session{'CurrentUser'}); - $record->Load($privacy, $id); - if ( $record->Id ) { - my ($status, $msg) = $record->Delete; - push @results, $msg; - } - else { - push @results, "Saved search #$Delete not found"; - } -} - -my %titles = ( 'Ticket' => 'Searches', 'Chart' => 'Charts' ); -my %paths = ( 'Ticket' => 'Search/Results.html', - 'Chart' => 'Search/Chart.html', -); </%init> <%ARGS> $user_attrs => undef -$Delete => undef </%ARGS> diff --git a/rt/share/html/Elements/ScrubHTML b/rt/share/html/Elements/ScrubHTML index 87aaaf387..47d125d89 100644 --- a/rt/share/html/Elements/ScrubHTML +++ b/rt/share/html/Elements/ScrubHTML @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,32 +45,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<%ONCE> -my $scrubber = new HTML::Scrubber; -$scrubber->default( - 0, - { - '*' => 0, - id => 1, - class => 1, - # 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, - face => 1, - size => 1, - target => 1, - style => qr{^(?:(?:color:\s*rgb\(\d+,\s*\d+,\s*\d+\))| - (?:text-align:\s*))}ix, - } -); -$scrubber->deny(qw[*]); -$scrubber->allow( - qw[A B U P BR I HR BR SMALL EM FONT SPAN STRONG SUB SUP STRIKE H1 H2 H3 H4 H5 H6 DIV UL OL LI DL DT DD PRE] -); -$scrubber->comment(0); -</%ONCE> <%init> -return $scrubber->scrub($Content); +return ScrubHTML($Content); </%init> <%args> $Content => undef diff --git a/rt/share/html/Elements/Section b/rt/share/html/Elements/Section index 3142a5ea0..8929d9e0e 100755 --- a/rt/share/html/Elements/Section +++ b/rt/share/html/Elements/Section @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectAttachmentField b/rt/share/html/Elements/SelectAttachmentField index bc2a0a455..41477427e 100755 --- a/rt/share/html/Elements/SelectAttachmentField +++ b/rt/share/html/Elements/SelectAttachmentField @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,7 +47,9 @@ %# END BPS TAGGED BLOCK }}} <select name="<%$Name%>"> <option value="Subject"><&|/l&>Subject</&></option> +% if ( RT->Config->Get('FullTextSearch')->{'Enable'} ) { <option value="Content"><&|/l&>Content</&></option> +% } <option value="ContentType"><&|/l&>Content-Type</&></option> <option value="Filename"><&|/l&>Filename</&></option> </select> diff --git a/rt/share/html/Elements/SelectBoolean b/rt/share/html/Elements/SelectBoolean index eb6d1a9cb..2de10246f 100755 --- a/rt/share/html/Elements/SelectBoolean +++ b/rt/share/html/Elements/SelectBoolean @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectCustomFieldOperator b/rt/share/html/Elements/SelectCustomFieldOperator index 0e389a3ed..73243dae4 100755 --- a/rt/share/html/Elements/SelectCustomFieldOperator +++ b/rt/share/html/Elements/SelectCustomFieldOperator @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectCustomFieldValue b/rt/share/html/Elements/SelectCustomFieldValue index 31a41dd3c..5c2e2ceb7 100755 --- a/rt/share/html/Elements/SelectCustomFieldValue +++ b/rt/share/html/Elements/SelectCustomFieldValue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectDate b/rt/share/html/Elements/SelectDate index 5bdbceeeb..46178b059 100755 --- a/rt/share/html/Elements/SelectDate +++ b/rt/share/html/Elements/SelectDate @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,8 +46,10 @@ %# %# END BPS TAGGED BLOCK }}} %# in PageLayout instead, once <% include('/elements/init_calendar.html') |n %> -<input type="text" id="<% $Name %>" name="<% $Name %>" value="<% $Value %>" size="<% $Size %>" /> +% $m->callback( %ARGS, Name => $Name, CallbackName => 'BeforeDateInput' ); +<input type="text" class="ui-datepicker<% $ShowTime ? ' withtime' : '' %>" id="<% $Name %>" name="<% $Name %>" value="<% $Value %>" size="<% $Size %>" /> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $Name %>_date_button" STYLE="cursor: pointer" TITLE="Select date"> +% $m->callback( %ARGS, Name => $Name, CallbackName => 'AfterDateInput' ); <script type="text/javascript"> Calendar.setup({ inputField: <% $Name |n,js_string %>, diff --git a/rt/share/html/Elements/SelectDateRelation b/rt/share/html/Elements/SelectDateRelation index f970cd269..654806e99 100755 --- a/rt/share/html/Elements/SelectDateRelation +++ b/rt/share/html/Elements/SelectDateRelation @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectDateType b/rt/share/html/Elements/SelectDateType index 37dca60aa..68f6ffe66 100755 --- a/rt/share/html/Elements/SelectDateType +++ b/rt/share/html/Elements/SelectDateType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectEqualityOperator b/rt/share/html/Elements/SelectEqualityOperator index f88a07fe3..1295b3951 100755 --- a/rt/share/html/Elements/SelectEqualityOperator +++ b/rt/share/html/Elements/SelectEqualityOperator @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectGroups b/rt/share/html/Elements/SelectGroups index cb0d804b0..302f73e77 100755 --- a/rt/share/html/Elements/SelectGroups +++ b/rt/share/html/Elements/SelectGroups @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectLang b/rt/share/html/Elements/SelectLang index 46db6c267..df98a1309 100755 --- a/rt/share/html/Elements/SelectLang +++ b/rt/share/html/Elements/SelectLang @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectLinkType b/rt/share/html/Elements/SelectLinkType index 30ef3ac54..cc6f852dc 100755 --- a/rt/share/html/Elements/SelectLinkType +++ b/rt/share/html/Elements/SelectLinkType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectMatch b/rt/share/html/Elements/SelectMatch index e46337538..692b0efca 100755 --- a/rt/share/html/Elements/SelectMatch +++ b/rt/share/html/Elements/SelectMatch @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectNewTicketQueue b/rt/share/html/Elements/SelectNewTicketQueue index db41e85f9..03644187b 100755 --- a/rt/share/html/Elements/SelectNewTicketQueue +++ b/rt/share/html/Elements/SelectNewTicketQueue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -50,5 +50,12 @@ </label> <%INIT> my $queue = RT->Config->Get("DefaultQueue", $session{'CurrentUser'}); + +if (RT->Config->Get("RememberDefaultQueue", $session{'CurrentUser'})) { + if (my $session_default = $session{'DefaultQueue'}) { + $queue = $session_default; + } +} + $m->callback(Queue => \$queue, CallbackName => 'DefaultQueue'); </%INIT> diff --git a/rt/share/html/Elements/SelectOwner b/rt/share/html/Elements/SelectOwner index 3ba7af634..cc64e247b 100755 --- a/rt/share/html/Elements/SelectOwner +++ b/rt/share/html/Elements/SelectOwner @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,26 +45,14 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<select name="<%$Name%>" id="<%$Name%>"> -%if ($DefaultValue) { -<option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel |n%></option> -%} -% $Default = 0 unless defined $Default && $Default =~ /^\d+$/; -% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $m->scomp('/Elements/ShowUser', User => $_)]} grep { $_->id != $RT::Nobody->id } @users; -% my $nobody = [$RT::Nobody, $m->scomp('/Elements/ShowUser', User => $RT::Nobody)]; -% unshift @formatednames, $nobody; -%foreach my $UserRef ( @formatednames) { -%my $User = $UserRef->[0]; -<option <% ( $User->Id == $Default) ? qq[ selected="selected"] : '' |n %> -%if ($ValueAttribute eq 'id') { - value="<%$User->id%>" -%} elsif ($ValueAttribute eq 'Name') { - value="<%$User->Name%>" -%} -><% $UserRef->[1] |n %></option> -%} -</select> +<& "SelectOwner$Widget", %ARGS, Objects => \@objects &> <%INIT> +my $Widget; +if ( !$QueueObj && !$TicketObj && RT->Config->Get('AutocompleteOwnersForSearch') ) { + $Widget = 'Autocomplete'; +} +$Widget ||= RT->Config->Get('AutocompleteOwners', $session{'CurrentUser'}) + ? 'Autocomplete' : 'Dropdown'; my @objects; if ($TicketObj) { @@ -74,58 +62,20 @@ if ($TicketObj) { } elsif ($cfqueues) { @objects = keys %{$cfqueues}; } else { -# Let's check rights on an empty queue object. that will do a search -# for any queue. + # Let's check rights on an empty queue object. that will do a search + # for any queue. my $queue = RT::Queue->new( $session{'CurrentUser'} ); push( @objects, $queue ); } -my %user_uniq_hash; - $m->callback( %ARGS, objects => \@objects, CallbackName => 'UpdateObjectList' ); - -my $isSU = $session{CurrentUser} - ->HasRight( Right => 'SuperUser', Object => $RT::System ); -foreach my $object (@objects) { - my $Users = RT::Users->new( $session{CurrentUser} ); - $Users->WhoHaveRight( - Right => 'OwnTicket', - Object => $object, - IncludeSystemRights => 1, - IncludeSuperusers => $isSU - ); - while ( my $User = $Users->Next() ) { - $user_uniq_hash{ $User->Id() } = $User; - } -} -if ($Default && $Default != $RT::Nobody->id && !$user_uniq_hash{$Default}) { - $user_uniq_hash{$Default} = RT::User->new($session{CurrentUser}); - $user_uniq_hash{$Default}->Load($Default); -} - -my @users = values %user_uniq_hash; - -$m->callback( - %ARGS, - objects => \@objects, - CallbackName => 'UpdateObjectList' -); - - </%INIT> - <%ARGS> -$QueueObj => undef -$Name => undef -$Default => 0 -$User => undef -$TicketObj => undef -$DefaultValue => 1 -$DefaultLabel => "-" -$ValueAttribute => 'id' -$cfqueues => undef +$TicketObj => undef +$QueueObj => undef +$cfqueues => undef </%ARGS> diff --git a/rt/share/html/Elements/SelectPriority b/rt/share/html/Elements/SelectPriority index ec380888e..1b4dac148 100644 --- a/rt/share/html/Elements/SelectPriority +++ b/rt/share/html/Elements/SelectPriority @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectQueue b/rt/share/html/Elements/SelectQueue index 0cfdd915d..b0a191a7e 100755 --- a/rt/share/html/Elements/SelectQueue +++ b/rt/share/html/Elements/SelectQueue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,29 +46,25 @@ %# %# END BPS TAGGED BLOCK }}} % if ($Lite) { -% my $d = new RT::Queue($session{'CurrentUser'}); +% my $d = RT::Queue->new($session{'CurrentUser'}); % $d->Load($Default); <input name="<%$Name%>" size="25" value="<%$d->Name%>" class="<%$Class%>" /> % } % else { -<select name="<%$Name%>" <% ($Multiple) ? 'multiple="multiple"' : '' %> <% ($OnChange) ? 'onchange="'.$OnChange.'"' : '' |n %> class="<%$Class%>"> +<select name="<%$Name%>" <% ($Multiple) ? qq{multiple="multiple" size="$Size"} : '' |n%> <% ($OnChange) ? 'onchange="'.$OnChange.'"' : '' |n %> class="<%$Class%>"> % if ($ShowNullOption) { - <option value="">-</option> + <option value=""><% $DefaultLabel %></option> % } % for my $queue (@{$session{$cache_key}{queues}}) { - <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>" - + <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>"\ % if ($queue->{Id} eq ($Default||'') || $queue->{Name} eq ($Default||'')) { - selected="selected" + selected="selected"\ % } - -> - <%$queue->{Name}%> - +><%$queue->{Name}%>\ % if ($Verbose and $queue->{Description}) { - (<%$queue->{Description}%>) + (<%$queue->{Description}%>)\ % } - </option> +</option> % } </select> % } @@ -79,10 +75,12 @@ $ShowAllQueues => 1 $Name => undef $Verbose => undef $NamedValues => 0 +$DefaultLabel => "-" $Default => 0 $Lite => 0 $OnChange => undef $Multiple => 0 +$Size => 6 $Class => 'select-queue' </%args> <%init> @@ -98,10 +96,18 @@ if ( defined $session{$cache_key} && delete $session{$cache_key}; } +if ( defined $session{$cache_key} && ref $session{$cache_key} eq 'ARRAY') { + delete $session{$cache_key}; +} +if ( defined $session{$cache_key} && + $session{$cache_key}{lastupdated} <= RT->System->QueueCacheNeedsUpdate ) { + delete $session{$cache_key}; +} + if ( not defined $session{$cache_key} and not $Lite ) { - my $q = new RT::Queues($session{'CurrentUser'}); + my $q = RT::Queues->new($session{'CurrentUser'}); $q->UnLimit; - + while (my $queue = $q->Next) { if ($ShowAllQueues || $queue->CurrentUserHasRight($CheckQueueRight)) { push @{$session{$cache_key}{queues}}, { diff --git a/rt/share/html/Elements/SelectResultsPerPage b/rt/share/html/Elements/SelectResultsPerPage index b472a8601..eababedd9 100755 --- a/rt/share/html/Elements/SelectResultsPerPage +++ b/rt/share/html/Elements/SelectResultsPerPage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectSortOrder b/rt/share/html/Elements/SelectSortOrder index 418d97c5f..0515ab18e 100755 --- a/rt/share/html/Elements/SelectSortOrder +++ b/rt/share/html/Elements/SelectSortOrder @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectStatus b/rt/share/html/Elements/SelectStatus index 5718a2a9d..e571baf63 100755 --- a/rt/share/html/Elements/SelectStatus +++ b/rt/share/html/Elements/SelectStatus @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,24 +46,57 @@ %# %# END BPS TAGGED BLOCK }}} % my $onchange_attr = $onchange ? " onchange=\"$onchange\"" : ''; -<select id="<%$Name%>" name="<%$Name%>"<% $onchange_attr |n%>> -%if ($DefaultValue) { -<option value=""<% !$Default && qq[ selected="selected"] |n %>><%$DefaultLabel%></option> -%} -%foreach my $status (@status) { -%next if ($SkipDeleted && $status eq 'deleted'); -<option value="<%$status%>"<% (defined $Default && $status eq $Default) && qq[ selected="selected"] |n %>><%loc($status)%></option> +<select id="<%$Name%>" name="<%$Name%>" <% $Multiple ? qq{multiple="multiple" size="$Size"} : '' |n %> <% $onchange_attr |n%>> +% if ( $DefaultValue ) { +<option value=""<% !$Default && qq[ selected="selected"] |n %>><% $DefaultLabel %></option> +% } +% foreach my $status (@status) { +% next if ($SkipDeleted && $status eq 'deleted'); +% my $selected = defined $Default && $status eq $Default ? 'selected="selected"' : ''; +<option value="<% $status %>" <% $selected |n %>><% loc($status) %></option> % } </select> -<%ONCE> -my $queue = new RT::Queue($session{'CurrentUser'}); -my @status = $queue->StatusArray(); -</%ONCE> +<%INIT> +### XXX: no cover for Tools/MyDay.html + + +my @status; +if ( @Statuses ) { + @status = @Statuses; +} +elsif ( $TicketObj ) { + my $current = $TicketObj->Status; + my $lifecycle = $TicketObj->QueueObj->Lifecycle; + + my %has = (); + foreach my $next ( $lifecycle->Transitions( $current ) ) { + my $check = $lifecycle->CheckRight( $current => $next ); + $has{ $check } = $TicketObj->CurrentUserHasRight( $check ) + unless exists $has{ $check }; + push @status, $next if $has{ $check }; + } +} +elsif ( $QueueObj ) { + @status = $QueueObj->Lifecycle->Transitions(''); +} +else { + @status = RT::Queue->Lifecycle->Valid; +} +</%INIT> <%ARGS> $Name => undef + +@Statuses => () +$TicketObj => undef +$QueueObj => undef + $Default => '' $SkipDeleted => 0 $DefaultValue => 1 $DefaultLabel => "-" + +$Multiple => 0 +$Size => 6 + $onchange => '' </%ARGS> diff --git a/rt/share/html/Elements/SelectTicketSortBy b/rt/share/html/Elements/SelectTicketSortBy index 6a1f2d909..29db77f84 100755 --- a/rt/share/html/Elements/SelectTicketSortBy +++ b/rt/share/html/Elements/SelectTicketSortBy @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -52,7 +52,7 @@ </select> <%INIT> -my $tickets = new RT::Tickets($session{'CurrentUser'}); +my $tickets = RT::Tickets->new($session{'CurrentUser'}); my @sortfields = $tickets->SortFields(); </%INIT> diff --git a/rt/share/html/Elements/SelectTicketTypes b/rt/share/html/Elements/SelectTicketTypes index 50c9038bd..d83c6c93f 100755 --- a/rt/share/html/Elements/SelectTicketTypes +++ b/rt/share/html/Elements/SelectTicketTypes @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/SelectTimeUnits b/rt/share/html/Elements/SelectTimeUnits index 714c5a46d..3ac6a12dc 100755 --- a/rt/share/html/Elements/SelectTimeUnits +++ b/rt/share/html/Elements/SelectTimeUnits @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -55,7 +55,7 @@ </select> <%INIT> $Name .= '-TimeUnits' unless $Name =~ /-TimeUnits$/io; -my $HoursDefault = RT->Config->Get('DefaultTimeUnitsToHours'); +my $HoursDefault = RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'}); </%INIT> <%ARGS> $Name => '' diff --git a/rt/share/html/Elements/SelectTimezone b/rt/share/html/Elements/SelectTimezone index 5ff603e24..c77311e8f 100644 --- a/rt/share/html/Elements/SelectTimezone +++ b/rt/share/html/Elements/SelectTimezone @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,26 +46,18 @@ %# %# END BPS TAGGED BLOCK }}} <%ONCE> -my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone }; -my $HAS_DATETIME = eval { require DateTime }; +use DateTime; -my (@names, %label); -if ( $HAS_DATETIME_TZ ) { - @names = DateTime::TimeZone->all_names; -} +my @names = DateTime::TimeZone->all_names; -if ( $HAS_DATETIME ) { - my $dt = DateTime->now; - for ( @names ) { - $dt->set_time_zone( $_ ); - $label{$_} = $_ . ' ' . $dt->strftime('%z'); - } +my %label; +my $dt = DateTime->now; +for ( @names ) { + $dt->set_time_zone( $_ ); + $label{$_} = $_ . ' ' . $dt->strftime('%z'); } </%ONCE> -% unless ( $HAS_DATETIME_TZ && @names ) { -<input type="text" name="<% $Name %>" value="<% $Default %>" /> -% } else { <select name="<% $Name %>"> % if ( $ShowNullOption ) { <option value=""><&|/l&>System Default</&></option> @@ -75,7 +67,6 @@ if ( $HAS_DATETIME ) { |n %> ><% $label{$tz} || $tz %></option> % } </select> -% } <%ARGS> $ShowNullOption => 1 $Name => undef diff --git a/rt/share/html/Elements/SelectUsers b/rt/share/html/Elements/SelectUsers index b250ba639..2522a92ed 100755 --- a/rt/share/html/Elements/SelectUsers +++ b/rt/share/html/Elements/SelectUsers @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,7 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <select name="UserField"> -% foreach my $col (RT::User->BasicColumns) { +% foreach my $col (@fields) { <option <% ($UserField eq $col->[0]) ? 'selected="selected"' : '' |n %> value="<% $col->[0] %>"><% loc($col->[1]) %></option> % } % while (my $CF = $CFs->Next) { @@ -60,9 +60,22 @@ my $CFs = RT::CustomFields->new($session{'CurrentUser'}); $CFs->LimitToChildType('RT::User'); $CFs->OrderBy( FIELD => 'Name' ); + +my @fields = RT::User->BasicColumns; + +if ( $Fields and ref $Fields eq 'ARRAY' ) { + if ( ref $Fields->[0] eq 'ARRAY' ) { + @fields = @$Fields; + } + else { + # make the name equal the label + @fields = [ @$Fields, @$Fields ]; + } +} </%INIT> <%ARGS> $UserField => '' $UserOp => '' $UserString => '' +$Fields => undef </%ARGS> diff --git a/rt/share/html/Elements/SelectWatcherType b/rt/share/html/Elements/SelectWatcherType index 3d37ee7c5..44beee00d 100755 --- a/rt/share/html/Elements/SelectWatcherType +++ b/rt/share/html/Elements/SelectWatcherType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -57,7 +57,7 @@ <%INIT> my @types; if ($Scope =~ 'queue') { - @types = qw(Cc AdminCc); + @types = RT::Queue->ManageableRoleGroupTypes; } else { @types = qw(Requestor Cc AdminCc); diff --git a/rt/share/html/Elements/SetupSessionCookie b/rt/share/html/Elements/SetupSessionCookie index ae1284daa..6c024c248 100755 --- a/rt/share/html/Elements/SetupSessionCookie +++ b/rt/share/html/Elements/SetupSessionCookie @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ShowCustomFieldBinary b/rt/share/html/Elements/ShowCustomFieldBinary index d08e807f2..04e6877dc 100644 --- a/rt/share/html/Elements/ShowCustomFieldBinary +++ b/rt/share/html/Elements/ShowCustomFieldBinary @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content %>"><% $Object->Content %></a> +<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |u %>"><% $Object->Content %></a> <%ARGS> $Object => undef </%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldDate b/rt/share/html/Elements/ShowCustomFieldDate index 4e8ad676c..8c94c131c 100644 --- a/rt/share/html/Elements/ShowCustomFieldDate +++ b/rt/share/html/Elements/ShowCustomFieldDate @@ -1,40 +1,40 @@ %# BEGIN BPS TAGGED BLOCK {{{ -%# +%# %# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC -%# <jesse@bestpractical.com> -%# +%# +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# <sales@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 @@ -43,13 +43,13 @@ %# 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 }}} <%INIT> my $content = $Object->Content; - my $DateObj = new RT::Date ( $session{'CurrentUser'} ); - $DateObj->Set( Format => 'ISO', Value => $content ); - $content = $DateObj->AsString; + my $DateObj = RT::Date->new ( $session{'CurrentUser'} ); + $DateObj->Set( Format => 'unknown', Value => $content ); + $content = $DateObj->AsString(Time => 0); </%INIT> <%$content|n%> <%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldImage b/rt/share/html/Elements/ShowCustomFieldImage index 3d22e5ced..0272b409d 100644 --- a/rt/share/html/Elements/ShowCustomFieldImage +++ b/rt/share/html/Elements/ShowCustomFieldImage @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,7 +45,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -% my $url = RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$Object->Id.'/'.$Object->Content; +% my $url = RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$Object->Id.'/'.$m->interp->apply_escapes($Object->Content, 'u'); <a href="<% $url %>"><% $Object->Content %></a> <img type="<% $Object->ContentType %>" height="64" src="<% $url %>" align="middle" /> <%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldText b/rt/share/html/Elements/ShowCustomFieldText index 4192112c8..2b0fd3e14 100644 --- a/rt/share/html/Elements/ShowCustomFieldText +++ b/rt/share/html/Elements/ShowCustomFieldText @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ShowCustomFieldWikitext b/rt/share/html/Elements/ShowCustomFieldWikitext index efadaa833..337606139 100644 --- a/rt/share/html/Elements/ShowCustomFieldWikitext +++ b/rt/share/html/Elements/ShowCustomFieldWikitext @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields index 1bb61435f..fcd530e95 100644 --- a/rt/share/html/Elements/ShowCustomFields +++ b/rt/share/html/Elements/ShowCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -77,11 +77,16 @@ % $m->callback( CallbackName => 'AfterCustomFields', Object => $Object ); <%INIT> $m->callback( + %ARGS, CallbackName => 'MassageCustomFields', Object => $Object, CustomFields => $CustomFields, ); +# don't print anything if there is no custom fields +return unless $CustomFields->First; +$CustomFields->GotoFirstItem; + my $print_value = sub { my ($cf, $value) = @_; my $linked = $value->LinkValueTo; @@ -108,13 +113,13 @@ my $print_value = sub { if ( $cf->IncludeContentForValue ) { my $vid = $value->id; $m->out( '<div class="object_cf_value_include" id="object_cf_value_'. $vid .'">' ); - $m->print( loc("See also:") ); + $m->out( loc("See also:") ); $m->out( '<a href="'. $value->IncludeContentForValue .'">' ); - $m->print( $value->IncludeContentForValue ); + $m->out( $value->IncludeContentForValue ); $m->out( qq{</a></div>\n} ); - $m->out( qq{<script><!--\nahah('} ); - $m->print( $value->IncludeContentForValue ); - $m->out( qq{', 'object_cf_value_$vid');\n--></script>\n} ); + $m->out( qq{<script><!--\njQuery('#object_cf_value_$vid').load('} ); + $m->out( $value->IncludeContentForValue ); + $m->out( qq{');\n--></script>\n} ); } }; diff --git a/rt/share/html/Elements/ShowLink b/rt/share/html/Elements/ShowLink index 0bd0019a3..8913a32fb 100644 --- a/rt/share/html/Elements/ShowLink +++ b/rt/share/html/Elements/ShowLink @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -48,14 +48,16 @@ <a href="<%$URI->Resolver->HREF%>"> % 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")) { % my $inactive = $member->QueueObj->IsInactiveStatus($member->Status); <span class="<% $inactive ? 'ticket-inactive' : '' %>"> -<%$member->Id%>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject%> [<% loc($member->Status) %>] + +<%$member->Id%>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject || ''%> [<% loc($member->Status) %>] </span> -% } elsif ( UNIVERSAL::can($member, 'Name')) { +% } elsif ($has_name) { <%$URI->Resolver->AsString%>: <%$member->Name%> % } else { <%$URI->Resolver->AsString%> diff --git a/rt/share/html/Elements/ShowLinks b/rt/share/html/Elements/ShowLinks index d674fea72..61628de4d 100755 --- a/rt/share/html/Elements/ShowLinks +++ b/rt/share/html/Elements/ShowLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,12 +47,17 @@ %# END BPS TAGGED BLOCK }}} <table> <tr> - <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="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> - <%PERL> -my ( @active, @inactive, @not_tickets ); -for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { +my ( $depends_on, @active, @inactive, @not_tickets ); +$depends_on = $Ticket->DependsOn; + +while ( my $link = $depends_on->Next ) { my $target = $link->TargetObj; if ( $target && $target->isa('RT::Ticket') ) { if ( $target->QueueObj->IsInactiveStatus( $target->Status ) ) { @@ -67,8 +72,6 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { } } </%PERL> - - <ul> % for my $Link (@not_tickets, @active, @inactive) { <li><& ShowLink, URI => $Link &></li> @@ -77,7 +80,11 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <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="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:\ +% if ($can_create) { + <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 +94,27 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <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="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>:\ +% if ($can_create) { + <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"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>: <span class="create">(<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>:\ +% if ($can_create) { + <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"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>: <span class="create">(<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>:\ +% if ($can_create) { + <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 +124,11 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <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="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> <ul> % while (my $Link = $Ticket->ReferredToBy->Next) { @@ -115,13 +138,9 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </ul> </td> </tr> - - % # Allow people to add more rows to the table % $m->callback( %ARGS ); - </table> - <%INIT> my $id = $Ticket->id; @@ -133,6 +152,7 @@ my $path . $Ticket->Queue . '&CloneTicket=' . $id; +my $can_create = $Ticket->QueueObj->CurrentUserHasRight('CreateTicket'); for my $relation ( qw(RefersTo ReferredToBy)) { @@ -154,7 +174,6 @@ for my $relation ( qw(MemberOf Members DependsOn DependedOnBy)) { } </%INIT> - <%ARGS> $Ticket => undef </%ARGS> diff --git a/rt/share/html/Elements/ShowMemberships b/rt/share/html/Elements/ShowMemberships index ab1567289..07fcdc67b 100644 --- a/rt/share/html/Elements/ShowMemberships +++ b/rt/share/html/Elements/ShowMemberships @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -82,7 +82,11 @@ $GroupMembers->OrderByCols( { ALIAS => $alias, FIELD => 'Domain' }, { ALIAS => $alias, FIELD => 'Name' }, ); + +$GroupMembers->RowsPerPage($Limit) if $Limit; + </%INIT> <%ARGS> $UserObj +$Limit => undef </%ARGS> diff --git a/rt/share/html/Elements/ShowRelationLabel b/rt/share/html/Elements/ShowRelationLabel index 3b045e703..9e6ea97a3 100644 --- a/rt/share/html/Elements/ShowRelationLabel +++ b/rt/share/html/Elements/ShowRelationLabel @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ShowSearch b/rt/share/html/Elements/ShowSearch index 904c82760..2b23181c2 100644 --- a/rt/share/html/Elements/ShowSearch +++ b/rt/share/html/Elements/ShowSearch @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,7 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <&|/Widgets/TitleBox, - title => loc($search->Description, $ProcessedSearchArg->{'Rows'}), + title => loc($desc, $ProcessedSearchArg->{'Rows'}), title_href => $query_link_url.$QueryString, titleright => $customize ? loc('Edit') : '', titleright_href => $customize, @@ -72,6 +72,7 @@ if ($SavedSearch) { $m->out(loc("Saved Search [_1] not found", $SavedSearch)) unless $IgnoreMissing; return; } + $SearchArg->{'SavedSearchId'} ||= $SavedSearch; $SearchArg->{'SearchType'} ||= 'Ticket'; if ( $SearchArg->{SearchType} ne 'Ticket' ) { @@ -119,6 +120,7 @@ $m->callback( foreach ( $SearchArg, $ProcessedSearchArg ) { $_->{'Format'} ||= ''; + $_->{'Query'} ||= ''; $_->{'Format'} =~ s/__(Web(?:Path|Base|BaseURL))__/scalar RT->Config->Get($1)/ge; # extract-message-catalog would "$1", so we avoid quotes for loc calls @@ -140,6 +142,13 @@ foreach ( $SearchArg, $ProcessedSearchArg ) { my $QueryString = '?' . $m->comp( '/Elements/QueryString', %$SearchArg ); +my $desc = $search->Description; + +# we only use [_1] here, let's escape other "[" and "]" unless they are +# escaped already +$desc =~ s/(?<!~)\[(?!_1\])/~[/g; +$desc =~ s/(?<!~)(?<!\[_1)\]/~]/g; + </%init> <%ARGS> $Name => undef diff --git a/rt/share/html/Elements/ShowUser b/rt/share/html/Elements/ShowUser index 6381594d9..044ec4c84 100644 --- a/rt/share/html/Elements/ShowUser +++ b/rt/share/html/Elements/ShowUser @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -59,13 +59,14 @@ unless ( $m->comp_exists( $comp ) ) { . ', but '. $comp . "doesn't exist" ); return $m->comp('/Elements/ShowUserConcise', - User => $User, Address => $Address, + User => $User, Address => $Address, NoEscape => $NoEscape ); } -return $m->comp( $comp, User => $User, Address => $Address ); +return $m->comp( $comp, User => $User, Address => $Address, NoEscape => $NoEscape ); </%INIT> <%ARGS> $User => undef $Address => undef +$NoEscape => 0 $style => RT->Config->Get('UsernameFormat', $session{'CurrentUser'}) </%ARGS> diff --git a/rt/share/html/Elements/ShowUserConcise b/rt/share/html/Elements/ShowUserConcise index d2cac1141..b56ba8372 100644 --- a/rt/share/html/Elements/ShowUserConcise +++ b/rt/share/html/Elements/ShowUserConcise @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,7 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} %# Released under the terms of version 2 of the GNU Public License -<% $Address || $User->RealName || $User->Name %>\ +<% $display |n %>\ <%ARGS> $User => undef $Address => undef @@ -61,4 +61,7 @@ if ( !$User && $Address ) { $Address = $Address->address; } } +my $display = $Address || $User->RealName || $User->Name; + $display = $m->interp->apply_escapes( $display, 'h' ) + unless $ARGS{'NoEscape'}; </%INIT> diff --git a/rt/share/html/Elements/ShowUserEmailFrequency b/rt/share/html/Elements/ShowUserEmailFrequency index a7fbd4c2f..4a02e124c 100644 --- a/rt/share/html/Elements/ShowUserEmailFrequency +++ b/rt/share/html/Elements/ShowUserEmailFrequency @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ShowUserVerbose b/rt/share/html/Elements/ShowUserVerbose index 6a85a5b6f..9ff8cbbc8 100644 --- a/rt/share/html/Elements/ShowUserVerbose +++ b/rt/share/html/Elements/ShowUserVerbose @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,30 +46,24 @@ %# %# END BPS TAGGED BLOCK }}} %# Released under the terms of version 2 of the GNU Public License -% if ( $Address->phrase || $Address->comment ) { -<% sprintf q{%s <%s> %s}, map $Address->$_, qw( phrase address comment ) %> -% } else { -<% $Address->address %> -% } +<% $display |n %>\ <%INIT> -my ($phrase, $address, $comment); +my $phrase = ''; +my $address = ''; +my $comment = ''; if ($User) { $address = $User->EmailAddress; - $phrase = $User->RealName - if $User->RealName && lc $User->RealName ne lc $address; + $phrase = $User->RealName if $User->RealName && lc $User->RealName ne lc $address; $comment = $User->Name if lc $User->Name ne lc $address; - $comment = "($comment)" if defined $comment and length $comment; - $Address = Email::Address->new( $phrase, $address, $comment ); +} else { + $address = $Address; } -$Address->comment('') if $comment and defined $Address->user and lc $Address->user eq lc $comment; -if ( $phrase and my ( $l, $r ) = ( $phrase =~ /^(\w+) (\w+)$/ ) ) { - $Address->phrase('') - if $Address->user =~ /^\Q$l\E.\Q$r\E$/ - || $Address->user =~ /^\Q$r\E.\Q$l\E$/; -} +my $display = ($phrase || $comment || '' ) . ($address ? ' <'.$address.'>' : ''); +$display = $m->interp->apply_escapes( $display, 'h' ) + unless $ARGS{'NoEscape'}; </%INIT> <%ARGS> $User => undef diff --git a/rt/share/html/Elements/SimpleSearch b/rt/share/html/Elements/SimpleSearch index aee31ec3e..533698d67 100755 --- a/rt/share/html/Elements/SimpleSearch +++ b/rt/share/html/Elements/SimpleSearch @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/Submit b/rt/share/html/Elements/Submit index fd2ecde41..cbf3f58e8 100755 --- a/rt/share/html/Elements/Submit +++ b/rt/share/html/Elements/Submit @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -52,10 +52,10 @@ id="<%$id%>" > <div class="extra-buttons"> % if ($CheckAll) { - <input type="button" value="<%$CheckAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', true);return false;" class="button" /> + <input type="button" value="<%$CheckAllLabel%>" onclick="setCheckbox(this.form, <% length $CheckboxName ? qq{'$CheckboxName'} : length $CheckboxNameRegex ? $CheckboxNameRegex : q{''} %>, true);return false;" class="button" /> % } % if ($ClearAll) { - <input type="button" value="<%$ClearAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', false);return false;" class="button" /> + <input type="button" value="<%$ClearAllLabel%>" onclick="setCheckbox(this.form, <% length $CheckboxName ? qq{'$CheckboxName'} : length $CheckboxNameRegex ? $CheckboxNameRegex : q{''} %>, false);return false;" class="button" /> % } % if ($Reset) { <input type="reset" value="<%$ResetLabel%>" class="button" /> @@ -63,18 +63,30 @@ id="<%$id%>" </div> <div class="buttons"> % if ( $Back ) { - <span class="caption"><%$BackCaption%></span> - <input type="submit" <% $BackOnClick ? qq[ onclick="$BackOnClick"] : '' | n %> <% - $BackName ? qq[ name="$BackName"] : '' | n %> value="<%$BackLabel%>" class="button" /> + <div class="next"> % } % if ($AlternateLabel) { <span class="caption"><%$AlternateCaption%></span> - <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> value="<%$AlternateLabel%>" class="button" /> + <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> <% $SubmitId ? qq[ id="$SubmitId"] : '' | n %> value="<%$AlternateLabel%>" class="button" /> % } else { <span class="caption"><%$Caption%></span> - <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> value="<%$Label%>" class="button" /> + <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> <% $SubmitId ? qq[ id="$SubmitId"] : '' | n %> value="<%$Label%>" class="button" /> +% } + +% if ( $Back ) { + </div> +% } + + +% if ( $Back ) { + <div class="back"> + <span class="caption"><%$BackCaption%></span> + <input type="submit" <% $BackOnClick ? qq[ onclick="$BackOnClick"] : '' | n %> <% + $BackName ? qq[ name="$BackName"] : '' | n %> value="<%$BackLabel%>" class="button" /> + </div> % } + </div> <div class="submit-clear"></div> </div> @@ -91,6 +103,7 @@ $CheckAllLabel => loc('Check All') $ClearAll => undef $ClearAllLabel => loc('Clear All') $CheckboxName => '' +$CheckboxNameRegex => '' $Back => undef $BackName => 'Back' $BackLabel => loc('Back') @@ -99,5 +112,6 @@ $BackOnClick => undef $OnClick => undef $Reset => undef $ResetLabel => loc('Reset') +$SubmitId => undef $id => undef </%ARGS> diff --git a/rt/share/html/Elements/Tabs b/rt/share/html/Elements/Tabs index 004e04b73..3a80d9b48 100755 --- a/rt/share/html/Elements/Tabs +++ b/rt/share/html/Elements/Tabs @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -45,84 +45,845 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/PageLayout, - current_toptab => $current_toptab, - current_tab => $current_tab, - toptabs => $toptabs, - topactions => $topactions, - tabs => $tabs, - actions => $actions, - subactions => $subactions, - title => $Title, - show_menu => $show_menu, -&> +<& /Elements/PageLayout, show_menu => $show_menu &> <a name="skipnav" id="skipnav" accesskey="8"></a> <%INIT> -my $action; -my $basetopactions = { - A => { html => $m->scomp('/Elements/CreateTicket') - }, - B => { html => $m->scomp('/Elements/SimpleSearch') - } - }; -my $basetabs = { A => { title => loc('Homepage'), - path => 'index.html', - }, - Ab => { title => loc('Simple Search'), - path => 'Search/Simple.html' - }, - B => { title => loc('Tickets'), - path => 'Search/Build.html' - }, - C => { title => loc('Tools'), - path => 'Tools/index.html' - }, - }; - -if ($session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', - Object => $RT::System )) { - $basetabs->{E} = { title => loc('Configuration'), - path => 'Admin/', - }; -} -if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', - Object => $RT::System )) { - $basetabs->{K} = { title => loc('Preferences'), - path => 'Prefs/Other.html' - }; -} +#my $request_path = $HTML::Mason::Commands::r->path_info; +my $request_path = $m->request_comp->path; + +my $query_string = sub { + my %args = @_; + my $u = URI->new(); + $u->query_form(%args); + return $u->query; +}; + +my $build_admin_menu = sub { + my $top = shift; + my $admin = $top->child( config => title => loc('Configuration'), path => '/Admin/', sort_order => 99 ); + if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) { + my $users = $admin->child( users => + title => loc('Users'), + description => loc('Manage users and passwords'), + path => '/Admin/Users/', + ); + $users->child( select => title => loc('Select'), path => "/Admin/Users/" ); + $users->child( create => title => loc('Create'), path => "/Admin/Users/Modify.html?Create=1" ); + } + my $groups = $admin->child( groups => + title => loc('Groups'), + description => loc('Manage groups and group membership'), + path => '/Admin/Groups/', + ); + $groups->child( select => title => loc('Select'), path => "/Admin/Groups/" ); + $groups->child( create => title => loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" ); + + my $queues = $admin->child( queues => + title => loc('Queues'), + description => loc('Manage queues and queue-specific properties'), + path => '/Admin/Queues/', + ); + $queues->child( select => title => loc('Select'), path => "/Admin/Queues/" ); + $queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" ); + + if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminCustomField' ) ) { + my $cfs = $admin->child( 'custom-fields' => + title => loc('Custom Fields'), + description => loc('Manage custom fields and custom field values'), + path => '/Admin/CustomFields/', + ); + $cfs->child( select => title => loc('Select'), path => "/Admin/CustomFields/" ); + $cfs->child( create => title => loc('Create'), path => "/Admin/CustomFields/Modify.html?Create=1" ); + } + + my $admin_global = $admin->child( global => + title => loc('Global'), + description => loc('Manage properties and configuration which apply to all queues'), + path => '/Admin/Global/', + ); + + my $scrips = $admin_global->child( scrips => + title => loc('Scrips'), + description => loc('Modify scrips which apply to all queues'), + path => '/Admin/Global/Scrips.html', + ); + $scrips->child( select => title => loc('Select'), path => "/Admin/Global/Scrips.html" ); + $scrips->child( create => title => loc('Create'), path => "/Admin/Global/Scrip.html?Create=1" ); + + my $templates = $admin_global->child( templates => + title => loc('Templates'), + description => loc('Edit system templates'), + path => '/Admin/Global/Templates.html', + ); + $templates->child( select => title => loc('Select'), path => "/Admin/Global/Templates.html" ); + $templates->child( create => title => loc('Create'), path => "/Admin/Global/Template.html?Create=1" ); + + my $cfadmin = $admin_global->child( 'custom-fields' => + title => loc('Custom Fields'), + description => loc('Modify global custom fields'), + path => '/Admin/Global/CustomFields/index.html', + ); + $cfadmin->child( users => + title => loc('Users'), + description => loc('Select custom fields for all users'), + path => '/Admin/Global/CustomFields/Users.html', + ); + $cfadmin->child( groups => + title => loc('Groups'), + description => loc('Select custom fields for all user groups'), + path => '/Admin/Global/CustomFields/Groups.html', + ); + $cfadmin->child( queues => + title => loc('Queues'), + description => loc('Select custom fields for all queues'), + path => '/Admin/Global/CustomFields/Queues.html', + ); + $cfadmin->child( tickets => + title => loc('Tickets'), + description => loc('Select custom fields for tickets in all queues'), + path => '/Admin/Global/CustomFields/Queue-Tickets.html', + ); + $cfadmin->child( transactions => + title => loc('Ticket Transactions'), + description => loc('Select custom fields for transactions on tickets in all queues'), + path => '/Admin/Global/CustomFields/Queue-Transactions.html', + ); + $cfadmin->child( 'custom-fields' => + title => loc('Articles'), + description => loc('Select Custom Fields for Articles in all Classes'), + path => '/Admin/Global/CustomFields/Class-Article.html', + ); + + my $article_admin = $admin->child( articles => title => loc('Articles'), path => "/Admin/Articles/index.html" ); + my $class_admin = $article_admin->child(classes => title => loc('Classes'), path => '/Admin/Articles/Classes/' ); + $class_admin->child( select => + title => loc('Select'), + description => loc('Modify and Create Classes'), + path => '/Admin/Articles/Classes/', + ); + $class_admin->child( create => + title => loc('Create'), + description => loc('Modify and Create Custom Fields for Articles'), + path => '/Admin/Articles/Classes/Modify.html?Create=1', + ); + + + my $cfs = $article_admin->child( 'custom-fields' => + title => loc('Custom Fields'), + path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', type => 'RT::Class-RT::Article'), + ); + $cfs->child( select => + title => loc('Select'), + path => '/Admin/CustomFields/index.html?'.$m->comp('/Elements/QueryString', type => 'RT::Class-RT::Article'), + ); + $cfs->child( create => + title => loc('Create'), + path => '/Admin/CustomFields/Modify.html?'.$m->comp("/Elements/QueryString", Create=>1, LookupType=> "RT::Class-RT::Article" ), + ); + + $admin_global->child( 'group-rights' => + title => loc('Group Rights'), + description => loc('Modify global group rights'), + path => '/Admin/Global/GroupRights.html', + ); + $admin_global->child( 'user-rights' => + title => loc('User Rights'), + description => loc('Modify global user rights'), + path => '/Admin/Global/UserRights.html', + ); + $admin_global->child( 'my-rt' => + title => loc('RT at a glance'), + description => loc('Modify the default "RT at a glance" view'), + path => '/Admin/Global/MyRT.html', + ); + $admin_global->child( 'topics' => + title => loc('Topics'), + description => loc('Modify global article topics'), + path => '/Admin/Global/Topics.html', + ); + + my $admin_tools = $admin->child( tools => + title => loc('Tools'), + description => loc('Use other RT administrative tools'), + path => '/Admin/Tools/', + ); + $admin_tools->child( configuration => + title => loc('System Configuration'), + description => loc('Detailed information about your RT setup'), + path => '/Admin/Tools/Configuration.html', + ); + $admin_tools->child( theme => + title => loc('Theme'), + description => loc('Customize the look of your RT'), + path => '/Admin/Tools/Theme.html', + ); + if (RT->Config->Get('StatementLog') + && $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) { + $admin_tools->child( 'sql-queries' => + title => loc('SQL Queries'), + description => loc('Browse the SQL queries made in this process'), + path => '/Admin/Tools/Queries.html', + ); + } + $admin_tools->child( shredder => + title => loc('Shredder'), + description => loc('Permanently wipeout data from RT'), + path => '/Admin/Tools/Shredder', + ); + + if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields)} ) { + my $type = $1; + my $tabs = PageMenu(); + + my %labels = ( + Queues => loc("Queues"), + Users => loc("Users"), + Groups => loc("Groups"), + CustomFields => loc("Custom Fields"), + ); + + my $section; + if ( $request_path =~ m|^/Admin/$type/?(?:index.html)?$| + || ( $request_path =~ m|^/Admin/$type/(?:Modify.html)$| + && $m->request_args->{'Create'} ) + ) + { + $section = $tabs; + + } else { + $section = $tabs->child( select => title => $labels{$type}, + path => "/Admin/$type/" ); + } + + $section->child( select => title => loc('Select'), path => "/Admin/$type/" ); + $section->child( create => title => loc('Create'), path => "/Admin/$type/Modify.html?Create=1" ); + } + + if ( $request_path =~ m{^/Admin/Queues} ) { + if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ + || + $m->request_args->{'Queue'} && $m->request_args->{'Queue'} =~ /^\d+$/ + ) { + my $id = $m->request_args->{'Queue'} || $m->request_args->{'id'}; + my $queue_obj = RT::Queue->new( $session{'CurrentUser'} ); + $queue_obj->Load($id); + + my $queue = PageMenu(); + $queue->child( basics => title => loc('Basics'), path => "/Admin/Queues/Modify.html?id=" . $id ); + $queue->child( people => title => loc('Watchers'), path => "/Admin/Queues/People.html?id=" . $id ); + + my $templates = $queue->child(templates => title => loc('Templates'), path => "/Admin/Queues/Templates.html?id=" . $id); + $templates->child( select => title => loc('Select'), path => "/Admin/Queues/Templates.html?id=".$id); + $templates->child( create => title => loc('Create'), path => "/Admin/Queues/Template.html?Create=1;Queue=".$id); + + my $scrips = $queue->child( scrips => title => loc('Scrips'), path => "/Admin/Queues/Scrips.html?id=" . $id); + $scrips->child( select => title => loc('Select'), path => "/Admin/Queues/Scrips.html?id=" . $id ); + $scrips->child( create => title => loc('Create'), path => "/Admin/Queues/Scrip.html?Create=1;Queue=" . $id); + + my $ticket_cfs = $queue->child( 'ticket-custom-fields' => title => loc('Ticket Custom Fields'), + path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket&id=' . $id ); + + my $txn_cfs = $queue->child( 'transaction-custom-fields' => title => loc('Transaction Custom Fields'), + path => '/Admin/Queues/CustomFields.html?SubType=RT::Ticket-RT::Transaction&id='.$id ); + + $queue->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Queues/GroupRights.html?id=".$id ); + $queue->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Queues/UserRights.html?id=" . $id ); + + + $m->callback( CallbackName => 'PrivilegedQueue', queue_id => $id, page_menu => $queue); + } + } + if ( $request_path =~ m{^/Admin/Users} ) { + if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) { + my $id = $m->request_args->{'id'}; + my $obj = RT::User->new( $session{'CurrentUser'} ); + $obj->Load($id); + + my $tabs = PageMenu(); + $tabs->child( basics => title => loc('Basics'), path => "/Admin/Users/Modify.html?id=" . $id ); + $tabs->child( memberships => title => loc('Memberships'), path => "/Admin/Users/Memberships.html?id=" . $id ); + $tabs->child( history => title => loc('History'), path => "/Admin/Users/History.html?id=" . $id ); + $tabs->child( 'my-rt' => title => loc('RT at a glance'), path => "/Admin/Users/MyRT.html?id=" . $id ); + if ( RT->Config->Get('GnuPG')->{'Enable'} ) { + $tabs->child( pgp => title => loc('GnuPG'), path => "/Admin/Users/GnuPG.html?id=" . $id ); + } + } + + } + + if ( $request_path =~ m{^/Admin/Groups} ) { + if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) { + my $id = $m->request_args->{'id'}; + my $obj = RT::Group->new( $session{'CurrentUser'} ); + $obj->Load($id); + + my $tabs = PageMenu(); + $tabs->child( basics => title => loc('Basics'), path => "/Admin/Groups/Modify.html?id=" . $obj->id ); + $tabs->child( members => title => loc('Members'), path => "/Admin/Groups/Members.html?id=" . $obj->id ); + $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Groups/GroupRights.html?id=" . $obj->id ); + $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Groups/UserRights.html?id=" . $obj->id ); + $tabs->child( history => title => loc('History'), path => "/Admin/Groups/History.html?id=" . $obj->id ); + } + } -if ($session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', - Object => $RT::System )) { - $basetabs->{P} = { title => loc('Approval'), - path => 'Approvals/' + if ( $request_path =~ m{^/Admin/CustomFields/} ) { + if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) { + my $id = $m->request_args->{'id'}; + my $obj = RT::CustomField->new( $session{'CurrentUser'} ); + $obj->Load($id); + + my $tabs = PageMenu(); + $tabs->child( basics => title => loc('Basics'), path => "/Admin/CustomFields/Modify.html?id=".$id ); + $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/CustomFields/GroupRights.html?id=" . $id ); + $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/CustomFields/UserRights.html?id=" . $id ); + $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/CustomFields/Objects.html?id=" . $id ); + } + } + + if ( $request_path =~ m{^/Admin/Global/(Scrip|Template)s?\.html} ) { + my $type = $1; + my $tabs = PageMenu(); + + # With only two elements, swapping between dropdown and menu is kinda dumb + # In the glorious future this should be cleaner. + + $tabs->child( select => title => loc('Select'), path => "/Admin/Global/${type}s.html" ); + $tabs->child( create => title => loc('Create'), path => "/Admin/Global/${type}.html?Create=1" ); + } + + if ( $request_path =~ m{^/Admin/Articles/Classes/} ) { + my $tabs = PageMenu(); + if ( my $id = $m->request_args->{'id'} ) { + my $obj = RT::CustomField->new( $session{'CurrentUser'} ); + $obj->Load($id); + + my $section = $tabs->child( select => title => loc("Classes"), path => "/Admin/Articles/Classes/" ); + $section->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" ); + $section->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" ); + + $tabs->child( basics => title => loc('Basics'), path => "/Admin/Articles/Classes/Modify.html?id=".$id ); + $tabs->child( topics => title => loc('Topics'), path => "/Admin/Articles/Classes/Topics.html?id=".$id ); + $tabs->child( 'custom-fields' => title => loc('Custom Fields'), path => "/Admin/Articles/Classes/CustomFields.html?id=".$id ); + $tabs->child( 'group-rights' => title => loc('Group Rights'), path => "/Admin/Articles/Classes/GroupRights.html?id=".$id ); + $tabs->child( 'user-rights' => title => loc('User Rights'), path => "/Admin/Articles/Classes/UserRights.html?id=".$id ); + $tabs->child( 'applies-to' => title => loc('Applies to'), path => "/Admin/Articles/Classes/Objects.html?id=$id" ); + } else { + $tabs->child( select => title => loc('Select'), path => "/Admin/Articles/Classes/" ); + $tabs->child( create => title => loc('Create'), path => "/Admin/Articles/Classes/Modify.html?Create=1" ); + } + } +}; + + +my $build_main_nav = sub { + + my $home = Menu->child( home => title => loc('Homepage'), path => '/' ); + # We explicitly exclude superusers; otherwise the dashboards for + # groups you're not in (but can see the dashboards of by dint of + # being a superuser) would push the useful ones from the groups + # you're actually in off of the stack. + my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards", IncludeSuperuserGroups => 0); + my $limit = 7; + + my $more = 0; + if ( @dashboards > $limit ) { + $more = 1; + splice @dashboards, $limit; + } + + my $dashes = Menu()->child('home'); + if (@dashboards) { + for my $dash (@dashboards) { + $home->child( 'dashboard-' . $dash->id, + title => $dash->Name, + path => '/Dashboards/' . $dash->id . '/' . $dash->Name + ); + } + + $dashes->child( more => title => loc('All Dashboards'), path => 'Dashboards/index.html' ); + } + my $dashboard = RT::Dashboard->new( $session{CurrentUser} ); + if ( $dashboard->CurrentUserCanCreateAny ) { + $dashes->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1" ); + } + + my $tickets = Menu->child( search => title => loc('Tickets'), path => '/Search/Build.html' ); + $tickets->child( simple => title => loc('Simple Search'), path => "/Search/Simple.html" ); + $tickets->child( new => title => loc('New Search'), path => "/Search/Build.html?NewQuery=1" ); + + + my $tools = Menu->child( tools => title => loc('Tools'), path => '/Tools/index.html' ); + my $articles = $tools->child( articles => title => loc('Articles'), path => "/Articles/index.html"); + $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" ); + $articles->child( search => title => loc('Search'), path => "/Articles/Article/Search.html" ); + $articles->child( topics => title => loc('Topics'), path => "/Articles/Topics.html" ); + + $tools->child( my_day => + title => loc('My Day'), + description => loc('Easy updating of your open tickets'), + path => '/Tools/MyDay.html', + ); + + if ( RT->Config->Get('EnableReminders') ) { + $tools->child( my_reminders => + title => loc('My Reminders'), + description => loc('Easy viewing of your reminders'), + path => '/Tools/MyReminders.html', + ); + } + + $tools->child( offline => + title => loc('Offline'), + description => loc('Create tickets offline'), + path => '/Tools/Offline.html', + ); + + if ( $session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', Object => RT->System ) ) { + $tools->child( approval => + title => loc('Approval'), + description => loc('My Approvals'), + path => '/Approvals/', + ); + } + + if ( $session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab', Object => RT->System ) ) + { + $build_admin_menu->($tools); + } + + my $username = '<span class="current-user">' + . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h') + . '</span>'; + my $about_me = Menu->child( 'preferences' => + title => loc('Logged in as [_1]', $username), + escape_title => 0, + sort_order => 99, + ); + + + if ( $session{'CurrentUser'}->UserObj + && $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System )) { + my $settings = $about_me->child( settings => title => loc('Settings'), path => '/Prefs/Other.html' ); + $settings->child( options => title => loc('Options'), path => '/Prefs/Other.html' ); + $settings->child( about_me => title => loc('About me'), path => '/User/Prefs.html' ); + $settings->child( search_options => title => loc('Search options'), path => '/Prefs/SearchOptions.html' ); + $settings->child( myrt => title => loc('RT at a glance'), path => '/Prefs/MyRT.html' ); + $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/Quicksearch.html' ); + + my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') ); + my $searches = [ $m->comp( "/Search/Elements/SearchesForObject", + Object => RT::System->new( $session{'CurrentUser'} )) ]; + my $i = 0; + + for my $search (@$searches) { + $search_menu->child( "search-" . $i++ => + title => $search->[0], + path => "/Prefs/Search.html?" + . $query_string->( name => ref( $search->[1] ) . '-' . $search->[1]->Id ), + ); + + } + } + if ( $session{'CurrentUser'}->Name + && ( !RT->Config->Get('WebExternalAuth') + || RT->Config->Get('WebFallbackToInternalAuth') )) { + $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' ); + } + if ( $request_path =~ m{^/Dashboards/(\d+)?}) { + if ( my $id = ( $1 || $m->request_args->{'id'} ) ) { + my $obj = RT::Dashboard->new( $session{'CurrentUser'} ); + $obj->LoadById($id); + if ( $obj and $obj->id ) { + my $tabs = PageMenu; + $tabs->child( basics => title => loc('Basics'), path => "/Dashboards/Modify.html?id=" . $obj->id); + $tabs->child( content => title => loc('Content'), path => "/Dashboards/Queries.html?id=" . $obj->id); + $tabs->child( subscription => title => loc('Subscription'), path => "/Dashboards/Subscription.html?id=" . $obj->id) + if $obj->CurrentUserCanSubscribe; + $tabs->child( show => title => loc('Show'), path => "/Dashboards/" . $obj->id . "/" . $obj->Name) + } + } + } + + + if ( $request_path =~ m{^/Ticket/} ) { + if ( ( $m->request_args->{'id'} || '' ) =~ /^(\d+)$/ ) { + my $id = $1; + my $obj = RT::Ticket->new( $session{'CurrentUser'} ); + $obj->Load($id); + + my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order => 95 ); + my $tabs = PageMenu(); + $tabs->child( bookmark => raw_html => $m->scomp( '/Ticket/Elements/Bookmark', id => $id ), sort_order => 99 ); + $tabs->child( display => title => loc('Display'), path => "/Ticket/Display.html?id=" . $id ); + $tabs->child( history => title => loc('History'), path => "/Ticket/History.html?id=" . $id ); + + my %can = %{ $obj->CurrentUser->PrincipalObj->HasRights( Object => $obj ) }; + $can{'_ModifyOwner'} = $can{'OwnTicket'} || $can{'TakeTicket'} || $can{'StealTicket'}; + my $can = sub { + unless ($_[0] eq 'ExecuteCode') { + return $can{$_[0]} || $can{'SuperUser'}; + } else { + return !RT->Config->Get('DisallowExecuteCode') + && ( $can{'ExecuteCode'} || $can{'SuperUser'} ); + } }; -} -if (!defined $toptabs) { - $toptabs = $basetabs; -} -if (!defined $topactions) { - $topactions = $basetopactions; + # comment out until we can do it for an individual custom field + #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') ) { + $tabs->child( basics => title => loc('Basics'), path => "/Ticket/Modify.html?id=" . $id ); + + #} + + if ( $can->('ModifyTicket') || $can->('_ModifyOwner') || $can->('Watch') || $can->('WatchAsAdminCc') ) { + $tabs->child( people => title => loc('People'), path => "/Ticket/ModifyPeople.html?id=" . $id ); + } + + if ( $can->('ModifyTicket') ) { + $tabs->child( dates => title => loc('Dates'), path => "/Ticket/ModifyDates.html?id=" . $id ); + $tabs->child( links => title => loc('Links'), path => "/Ticket/ModifyLinks.html?id=" . $id ); + } + + #if ( $can->('ModifyTicket') || $can->('ModifyCustomField') || $can->('_ModifyOwner') ) { + $tabs->child( jumbo => title => loc('Jumbo'), path => "/Ticket/ModifyAll.html?id=" . $id ); + #} + + if ( RT->Config->Get('EnableReminders') ) { + $tabs->child( reminders => title => loc('Reminders'), path => "/Ticket/Reminders.html?id=" . $id ); + } + + if ( $can->('ModifyTicket') or $can->('ReplyToTicket') ) { + $actions->child( reply => title => loc('Reply'), path => "/Ticket/Update.html?Action=Respond;id=" . $id ); + } + + if ( $can->('ModifyTicket') or $can->('CommentOnTicket') ) { + $actions->child( comment => title => loc('Comment'), path => "/Ticket/Update.html?Action=Comment;id=" . $id ); + } + + if ( $can->('ForwardMessage') ) { + $actions->child( forward => title => loc('Forward'), path => "/Ticket/Forward.html?id=" . $id ); + } + + my $hide_resolve_with_deps = RT->Config->Get('HideResolveActionsWithDependencies') + && $obj->HasUnresolvedDependencies; + + my $current = $obj->Status; + my $lifecycle = $obj->QueueObj->Lifecycle; + my $i = 1; + foreach my $info ( $lifecycle->Actions($current) ) { + my $next = $info->{'to'}; + next unless $lifecycle->IsTransition( $current => $next ); + + my $check = $lifecycle->CheckRight( $current => $next ); + next unless $can->($check); + + next if $hide_resolve_with_deps + && $lifecycle->IsInactive($next) + && !$lifecycle->IsInactive($current); + + my $action = $info->{'update'} || ''; + my $url = '/Ticket/'; + if ($action) { + $url .= "Update.html?" + . $query_string->( + Action => $action, + DefaultStatus => $next, + id => $id, + ); + } else { + $url .= "Display.html?" + . $query_string->( + Status => $next, + id => $id, + ); + } + my $key = $info->{'label'} || ucfirst($next); + $actions->child( $key => title => loc( $key ), path => $url); + } + + if ( $can->('OwnTicket') ) { + if ( $obj->OwnerObj->Id == RT->Nobody->id + && ( $can->('ModifyTicket') or $can->('TakeTicket') ) ) { + $actions->child( take => title => loc('Take'), path => "/Ticket/Display.html?Action=Take;id=" . $id ); + } + + elsif ( $obj->OwnerObj->id != RT->Nobody->id + && $obj->OwnerObj->id != $session{CurrentUser}->id + && ( $can->('ModifyTicket') or $can->('StealTicket') ) ) { + $actions->child( steal => title => loc('Steal'), path => "/Ticket/Display.html?Action=Steal;id=" . $id ); + } + } + + # TODO needs a "Can extract article into a class applied to this queue" check + $actions->child( 'extract-article' => + title => loc('Extract Article'), + path => "/Articles/Article/ExtractIntoClass.html?Ticket=".$obj->id, + ); + + if ( defined $session{"tickets"} ) { + # we have to update session data if we get new ItemMap + my $updatesession = 1 unless ( $session{"tickets"}->{'item_map'} ); + + my $item_map = $session{"tickets"}->ItemMap; + + if ($updatesession) { + $session{"tickets"}->PrepForSerialization(); + } + + my $search = Menu()->child('search'); + # Don't display prev links if we're on the first ticket + if ( $item_map->{$id}->{prev} ) { + $search->child( first => + title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first}); + $search->child( prev => + title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev}); + } + # Don't display next links if we're on the last ticket + if ( $item_map->{$id}->{next} ) { + $search->child( next => + title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next}); + $search->child( last => + title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last}); + } + } + } + } + + if ( + ( + $request_path =~ m{^/(?:Ticket|Search)/} + && $request_path !~ m{^/Search/Simple\.html} + ) + || ( $request_path =~ m{^/Search/Simple\.html} + && $m->request_args->{'q'} ) + ) + { + my $search = Menu()->child('search'); + my $args = ''; + my $has_query = ''; + my $current_search = $session{"CurrentSearchHash"} || {}; + my $search_id = $m->request_args->{'SavedSearchLoad'} || $m->request_args->{'SavedSearchId'} || $current_search->{'SearchId'} || ''; + my $chart_id = $m->request_args->{'SavedChartSearchId'} || $current_search->{SavedChartSearchId}; + + $has_query = 1 if ( $m->request_args->{'Query'} or $current_search->{'Query'} ); + + my %query_args; + my %fallback_query_args = ( + SavedSearchId => ( $search_id eq 'new' ) ? undef : $search_id, + SavedChartSearchId => $chart_id, + ( + map { + my $p = $_; + $p => $m->request_args->{$p} || $current_search->{$p} + } qw(Query Format OrderBy Order Page) + ), + RowsPerPage => ( + defined $m->request_args->{'RowsPerPage'} + ? $m->request_args->{'RowsPerPage'} + : $current_search->{'RowsPerPage'} + ), + ); + + if ($QueryString) { + $args = '?' . $QueryString; + } + else { + my %final_query_args = (); + # key => callback to avoid unnecessary work + + for my $param (keys %fallback_query_args) { + $final_query_args{$param} = defined($QueryArgs->{$param}) + ? $QueryArgs->{$param} + : $fallback_query_args{$param}; + } + + for my $field (qw(Order OrderBy)) { + if ( ref( $final_query_args{$field} ) eq 'ARRAY' ) { + $final_query_args{$field} = join( "|", @{ $final_query_args{$field} } ); + } elsif (not defined $final_query_args{$field}) { + delete $final_query_args{$field}; + } + else { + $final_query_args{$field} ||= ''; + } + } + + $args = '?' . $query_string->(%final_query_args); + } + + my $current_search_menu; + if ( $request_path =~ m{^/Ticket} ) { + $current_search_menu = $search->child( current_search => title => loc('Current Search') ); + $current_search_menu->path("/Search/Results.html$args") if $has_query; + } else { + $current_search_menu = PageMenu(); + } + + $current_search_menu->child( edit_search => + title => loc('Edit Search'), path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) ); + $current_search_menu->child( advanced => + title => loc('Advanced'), path => "/Search/Edit.html$args" ); + if ($has_query) { + $current_search_menu->child( results => title => loc('Show Results'), path => "/Search/Results.html$args" ); + } + + if ( $has_query ) { + $current_search_menu->child( bulk => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" ); + $current_search_menu->child( chart => title => loc('Chart'), path => "/Search/Chart.html$args" ); + + my $more = $current_search_menu->child( more => title => loc('Feeds') ); + + $more->child( spreadsheet => title => loc('Spreadsheet'), path => "/Search/Results.tsv$args" ); + + my %rss_data = map { + $_ => $QueryArgs->{$_} || $fallback_query_args{$_} || '' } + qw(Query Order OrderBy); + my $RSSQueryString = "?" + . $query_string->( Query => $rss_data{Query}, + Order => $rss_data{Order}, + OrderBy => $rss_data{OrderBy} + ); + my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ), + $session{'CurrentUser'}->UserObj->Name, + $session{'CurrentUser'} + ->UserObj->GenerateAuthString( $rss_data{Query} + . $rss_data{Order} + . $rss_data{OrderBy} ); + + $more->child( rss => title => loc('RSS'), path => "/NoAuth/rss/$RSSPath/$RSSQueryString"); + my $ical_path = join '/', map $m->interp->apply_escapes($_, 'u'), + $session{'CurrentUser'}->UserObj->Name, + $session{'CurrentUser'}->UserObj->GenerateAuthString( $rss_data{Query} ), + $rss_data{Query}; + $more->child( ical => title => loc('iCal'), path => '/NoAuth/iCal/'.$ical_path); + + if ($request_path =~ m{^/Search/Results.html} + && #XXX TODO better abstraction + $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => RT->System )) { + my $shred_args = $query_string->( + search => 1, + plugin => 'Tickets', + 'Tickets:query' => $rss_data{'Query'}, + 'Tickets:limit' => $QueryArgs->{'Rows'}, + ); + + $more->child( shredder => title => loc('Shredder'), path => '/Admin/Tools/Shredder/?' . $shred_args); + } + + } + } + + if ( $request_path =~ m{^/Article/} ) { + if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) { + my $id = $m->request_args->{'id'}; + my $tabs = PageMenu(); + + $tabs->child( display => title => loc('Display'), path => "/Articles/Article/Display.html?id=".$id ); + $tabs->child( history => title => loc('History'), path => "/Articles/Article/History.html?id=".$id ); + $tabs->child( modify => title => loc('Modify'), path => "/Articles/Article/Edit.html?id=".$id ); + $tabs->child( delete => title => loc('Delete'), path => "/Articles/Article/Delete.html?id=".$id ); + } + } + + if ( $request_path =~ m{^/Articles/} ) { + my $tabs = PageMenu(); + $tabs->child( search => title => loc("Search"), path => "/Articles/Article/Search.html" ); + $tabs->child( create => title => loc("New Article" ), path => "/Articles/Article/PreCreate.html" ); + if ( ( $m->request_args->{'id'} || '' ) =~ /^(\d+)$/ ) { + my $id = $1; + my $obj = RT::Article->new( $session{'CurrentUser'} ); + $obj->Load($id); + + $tabs->child( display => title => loc("Display"), path => "/Articles/Article/Display.html?id=" . $id ); + $tabs->child( history => title => loc('History'), path => '/Articles/Article/History.html?id=' . $id ); + + if ( $obj->CurrentUserHasRight('ModifyArticle') ) { + $tabs->child(modify => title => loc('Modify'), path => '/Articles/Article/Edit.html?id=' . $id ); + } + if ( $obj->CurrentUserHasRight('DeleteArticle') ) { + $tabs->child(delete => title => loc('Delete'), path => '/Articles/Article/Delete.html?id=' . $id ); + } + } + + } + + if ( $request_path =~ /^\/(?:index.html|$)/ ) { + PageMenu()->child( edit => title => loc('Edit'), path => '/Prefs/MyRT.html' ); + } + + PageWidgets()->child( simple_search => raw_html => $m->scomp('SimpleSearch') ); + PageWidgets()->child( create_ticket => raw_html => $m->scomp('CreateTicket') ); + + $m->callback( CallbackName => 'Privileged' ); +}; + +my $build_selfservice_nav = sub { + my $queues = RT::Queues->new( $session{'CurrentUser'} ); + $queues->UnLimit; + + my $queue_count = 0; + my $queue_id = 1; + + while ( my $queue = $queues->Next ) { + next unless $queue->CurrentUserHasRight('CreateTicket'); + $queue_id = $queue->id; + $queue_count++; + last if ( $queue_count > 1 ); + } + + + my $tickets = Menu->child( tickets => title => loc('Tickets')); + $tickets->child( open => title => loc('Open tickets'), path => '/SelfService/' ); + $tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' ); + if ( $queue_count > 1 ) { + $tickets->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' ); + } else { + $tickets->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id ); + } + + + my $username = '<span class="current-user">' + . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h') + . '</span>'; + my $about_me = Menu->child( preferences => + title => loc('Logged in as [_1]', $username), + escape_title => 0, + sort_order => 99, + ); + + if ( $session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => RT->System ) ) { + $about_me->child( prefs => title => loc('Preferences'), path => '/SelfService/Prefs.html' ); + } + + if ( $session{'CurrentUser'}->Name + && ( !RT->Config->Get('WebExternalAuth') + || RT->Config->Get('WebFallbackToInternalAuth') )) { + $about_me->child( logout => title => loc('Logout'), path => '/NoAuth/Logout.html' ); + } + + if ($session{'CurrentUser'}->HasRight( Right => 'ShowArticle', Object => RT->System )) { + PageWidgets->child( 'goto-article' => raw_html => $m->scomp('/SelfService/Elements/SearchArticle') ); + } + + PageWidgets->child( goto => raw_html => $m->scomp('/SelfService/Elements/GotoTicket') ); + + $m->callback( CallbackName => 'SelfService' ); +}; + + + +if ( $request_path !~ m{^/SelfService/} ) { + $build_main_nav->(); +} else { + $build_selfservice_nav->(); } - -# Now let callbacks add their extra tabs -$m->callback( - topactions => $topactions, - toptabs => $toptabs, - %ARGS -); + + + </%INIT> <%ARGS> -$current_toptab => undef -$current_tab => undef -$toptabs => undef -$topactions => undef -$tabs => undef -$actions => undef -$subactions => undef -$Title => undef $show_menu => 1 +$QueryString => '' +$QueryArgs => {} </%ARGS> diff --git a/rt/share/html/Elements/TicketList b/rt/share/html/Elements/TicketList index 53318ab3c..66253ae7d 100644 --- a/rt/share/html/Elements/TicketList +++ b/rt/share/html/Elements/TicketList @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/TitleBox b/rt/share/html/Elements/TitleBox index eb8da2a8f..fa81a32f4 100644 --- a/rt/share/html/Elements/TitleBox +++ b/rt/share/html/Elements/TitleBox @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/TitleBoxEnd b/rt/share/html/Elements/TitleBoxEnd index fccb9a336..96d2076e1 100644 --- a/rt/share/html/Elements/TitleBoxEnd +++ b/rt/share/html/Elements/TitleBoxEnd @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/TitleBoxStart b/rt/share/html/Elements/TitleBoxStart index 0f6f0a1a4..cc1a55f68 100644 --- a/rt/share/html/Elements/TitleBoxStart +++ b/rt/share/html/Elements/TitleBoxStart @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) diff --git a/rt/share/html/Elements/ValidateCustomFields b/rt/share/html/Elements/ValidateCustomFields index 539c6f483..922b885f2 100644 --- a/rt/share/html/Elements/ValidateCustomFields +++ b/rt/share/html/Elements/ValidateCustomFields @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -81,7 +81,32 @@ while ( my $CF = $CustomFields->Next ) { grep defined, @values; @values = ('') unless @values; - foreach my $value( @values ) { + for my $value( @values ) { + if ($value) { + if ( $CF->Type eq 'IPAddress' ) { + use Regexp::Common qw(RE_net_IPv4); + my $ip = RT::ObjectCustomFieldValue->ParseIP( $value ); + unless ( $ip ) { + my $msg = + loc( "Input can not be parsed as an IP address" ); + $m->notes( ( 'InvalidField-' . $CF->Id ) => $msg ); + push @res, $msg; + $valid = 0; + } + } + elsif ( $CF->Type eq 'IPAddressRange' ) { + my ( $start_ip, $end_ip ) = + RT::ObjectCustomFieldValue->ParseIPRange($value); + unless ( $start_ip && $end_ip ) { + my $msg = + loc( "Input can not be parsed as an IP address range" ); + $m->notes( ( 'InvalidField-' . $CF->Id ) => $msg ); + push @res, $msg; + $valid = 0; + } + } + } + next if $CF->MatchPattern($value); my $msg = loc("Input must match [_1]", $CF->FriendlyPattern); |