diff options
author | ivan <ivan> | 2009-12-31 13:16:41 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-12-31 13:16:41 +0000 |
commit | b4b0c7e72d7eaee2fbfc7022022c9698323203dd (patch) | |
tree | ba4cd21399e412c32fe3737eaa8478e3271509f9 /rt/share/html/Prefs | |
parent | 2dfda73eeb3eae2d4f894099754794ef07d060dd (diff) |
import rt 3.8.7
Diffstat (limited to 'rt/share/html/Prefs')
-rw-r--r-- | rt/share/html/Prefs/Elements/Tabs | 76 | ||||
-rw-r--r-- | rt/share/html/Prefs/MyRT.html | 157 | ||||
-rw-r--r-- | rt/share/html/Prefs/Other.html | 111 | ||||
-rw-r--r-- | rt/share/html/Prefs/Quicksearch.html | 97 | ||||
-rw-r--r-- | rt/share/html/Prefs/Search.html | 111 | ||||
-rw-r--r-- | rt/share/html/Prefs/SearchOptions.html | 111 |
6 files changed, 663 insertions, 0 deletions
diff --git a/rt/share/html/Prefs/Elements/Tabs b/rt/share/html/Prefs/Elements/Tabs new file mode 100644 index 000000000..3a63b73e4 --- /dev/null +++ b/rt/share/html/Prefs/Elements/Tabs @@ -0,0 +1,76 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /User/Elements/Tabs, + subtabs => $tabs, + current_tab => 'Prefs/Other.html', + current_subtab => $current_subtab, + Title => $Title &> + +<%INIT> +my $tabs; +$Searches ||= [$m->comp("/Search/Elements/SearchesForObject", Object => RT::System->new($session{'CurrentUser'}))]; + +$tabs->{a} = { + title => loc('Quick search'), + path => 'Prefs/Quicksearch.html', +}; + +for my $search (@$Searches) { + $tabs->{ $search->[0] } = { + title => $search->[0], + path => "Prefs/Search.html?" + .$m->comp('/Elements/QueryString', name => ref($search->[1]).'-'.$search->[1]->Id), + }; +} +</%INIT> +<%ARGS> +$GroupObj => undef +$current_subtab => undef +$Title => undef +$Searches => undef +</%ARGS> diff --git a/rt/share/html/Prefs/MyRT.html b/rt/share/html/Prefs/MyRT.html new file mode 100644 index 000000000..c91e0f797 --- /dev/null +++ b/rt/share/html/Prefs/MyRT.html @@ -0,0 +1,157 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /Prefs/Elements/Tabs, + current_tab => 'Prefs/MyRT.html', + Title => $title, + Searches => \@sys_searches +&> +<& /Elements/ListActions, actions => \@results &> + +<& /Widgets/SelectionBox:header, nojs => 1 &> + +<form method="post" action="MyRT.html"> +<input type="hidden" name="Reset" value="1" /> +<input type="submit" class="button" value="<% loc('Reset to default') %>"> +</form> + +<br /> + +% for my $pane ( @panes ) { +<&|/Widgets/TitleBox, + title => loc('RT at a glance') .': '. loc( $pane->{Name} ), + bodyclass => "" +&> +<& /Widgets/SelectionBox:show, self => $pane, nojs => 1 &> +</&> +% } + +<&|/Widgets/TitleBox, title => loc('Options'), bodyclass => "" &> +<form method="post" action="MyRT.html"> +<&|/l&>Rows per box</&>: +<input name="SummaryRows" value="<% $ARGS{SummaryRows} %>" /> +<input type="submit" class="button" name="UpdateSummaryRows" value="<% loc('Save') %>" /> +</form> +</&> + +<%INIT> +my @results; +my $title = loc("Customize").' '.loc("RT at a glance"); +my $user = $session{'CurrentUser'}->UserObj; + +if ( $ARGS{'UpdateSummaryRows'} ) { + unless ( $ARGS{SummaryRows} && int $ARGS{SummaryRows} > 0 ) { + push @results, loc ("Illegal '[_1]' preference value.", loc('summary rows')); + $ARGS{SummaryRows} = 0; + } + else { + my ($ok, $msg) = $user->SetPreferences( 'SummaryRows', int $ARGS{SummaryRows} ); + push @results, $ok ? loc('Preferences saved for [_1].', loc('summary rows')) : $msg; + } +} +$ARGS{'SummaryRows'} ||= $user->Preferences('SummaryRows', RT->Config->Get('DefaultSummaryRows')); + +if ($ARGS{Reset}) { + my ($ok, $msg) = $user->SetPreferences('HomepageSettings', {}); + push @results, $ok ? loc('Preferences saved.') : $msg; + delete $session{'my_rt_portlets'}; +} + +unless (exists $session{'my_rt_portlets'}) { + my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings'); + my $portlets = $default_portlets ? $default_portlets->Content : {}; + $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $portlets); +} +my $portlets = $session{'my_rt_portlets'}; + +my %seen; +my @items = map ["component-$_", $_], grep !$seen{$_}++, @{RT->Config->Get('HomepageComponents')}; + +my $sys = RT::System->new($session{'CurrentUser'}); +my @objs = ($sys); + +push @objs, RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects + if $session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', + Object => $RT::System ); + +my @sys_searches; +for my $object (@objs) { + for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) { + my ($desc, $search) = @$_; + my $SearchType = $search->Content->{'SearchType'} || 'Ticket'; + if ($object eq $sys && $SearchType eq 'Ticket') { + push @items, ["system-$desc", $desc]; + push @sys_searches, [$desc, $search]; + } + else { + my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id; + my $type = ($SearchType eq 'Ticket') + ? 'Saved Search' : $SearchType; # loc + push @items, ["saved-$oid", loc($type).": $desc"]; + } + } +} + +my @panes = $m->comp( + '/Admin/Elements/ConfigureMyRT', + panes => ['body', 'summary'], + Action => 'MyRT.html', + items => \@items, + current_portlets => $portlets, + OnSave => sub { + my ( $conf, $pane ) = @_; + my ($ok, $msg) = $user->SetPreferences( 'HomepageSettings', $conf ); + push @results, $ok ? loc('Preferences saved for [_1].', $pane) : $msg; + delete $session{'my_rt_portlets'}; + } +); + +$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_, nojs => 1 ) + for @panes; + +</%INIT> diff --git a/rt/share/html/Prefs/Other.html b/rt/share/html/Prefs/Other.html new file mode 100644 index 000000000..9608fb6b7 --- /dev/null +++ b/rt/share/html/Prefs/Other.html @@ -0,0 +1,111 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /User/Elements/Tabs, + current_tab => 'Prefs/Other.html', + Title => $title, +&> +<& /Elements/ListActions, actions => \@results &> + +<form method="post" action="Other.html"> +% foreach my $section( RT->Config->Sections ) { +<&|/Widgets/TitleBox, title => loc( $section ) &> +% foreach my $option( RT->Config->Options( Section => $section ) ) { +% my $meta = RT->Config->Meta( $option ); +<& $meta->{'Widget'}, + Default => 1, + %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments => + $meta->{'WidgetArguments'} ) }, + Name => $option, + DefaultValue => scalar RT->Config->Get( $option ), + CurrentValue => $preferences->{ $option }, +&> +% } +</&> +% } + +% if ( RT->Config->Get('GnuPG')->{'Enable'} ) { +<&|/Widgets/TitleBox, title => loc( 'Cryptography' ) &> +<&|/l&>Preferred key</&>: <& /Elements/GnuPG/SelectKeyForEncryption, EmailAddress => $UserObj->EmailAddress, Default => $UserObj->PreferredKey &> +</&> +% } + +<& /Elements/Submit, Name => 'Update', Label => loc('Save Changes') &> +</form> +<%INIT> +my @results; +my $title = loc("Settings"); + +my $UserObj = $session{'CurrentUser'}->UserObj; +my $preferences = $UserObj->Preferences( $RT::System ); + +if ((defined $PreferredKey) && $PreferredKey ne $UserObj->FirstAttribute('PreferredKey')) { + my ($code, $msg) = $UserObj->SetAttribute(Name => 'PreferredKey', Content => $PreferredKey); + push @results, loc('Preferred Key: [_1]', loc_fuzzy($msg)); +} + +if ( $Update ) { + $preferences ||= {}; + $m->comp( '/Widgets/BulkProcess', Meta => { + map { $_ => RT->Config->Meta($_) } RT->Config->Options + }, + Store => $preferences, + Types => [RT->Config->Options], Default => 1, Arguments => \%ARGS, + DefaultValue => { map { $_ => RT->Config->Get($_) } + RT->Config->Options + }, ); + + my ($ok, $msg) = $UserObj->SetPreferences( $RT::System, $preferences ); + push @results, $ok ? loc("Preferences saved.") : $msg; +} +</%INIT> +<%ARGS> +$Update => 0, +$User => undef, +$PreferredKey => undef, +</%ARGS> diff --git a/rt/share/html/Prefs/Quicksearch.html b/rt/share/html/Prefs/Quicksearch.html new file mode 100644 index 000000000..fc1457738 --- /dev/null +++ b/rt/share/html/Prefs/Quicksearch.html @@ -0,0 +1,97 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /Prefs/Elements/Tabs, + current_tab => 'Prefs/MyRT.html', + current_subtab => 'Prefs/Quicksearch.html', + Title => $title +&> +<& /Elements/ListActions, actions => \@actions &> +<h1><&|/l&>Select queues to be displayed on the "RT at a glance" page</&></h1> +<form method="post" action="Quicksearch.html" name="Preferences"> +<ul> +% for my $queue (@queues) { +<li><input type="checkbox" class="checkbox" name="Want-<%$queue->Name%>" value="1" +% unless ($unwanted->{$queue->Name}) { +checked="checked" +% } +/><%$queue->Name%>: <%$queue->Description%></li> +% } +</ul> +<& /Elements/Submit, Caption => loc("Save Changes"), Label => loc('Save'), Name => 'Save'&> + +</form> + +<%INIT> +my @actions; +my $title = loc("Customize").' '.loc("Quick search"); +# The queue list is not loaded from cache, so it might be a bit inconsistent +my $user = $session{'CurrentUser'}->UserObj; +my $unwanted = $user->Preferences('QuickSearch', {}); +my $Queues = RT::Queues->new($session{'CurrentUser'}); +$Queues->UnLimit; +my @queues = grep {$_->CurrentUserHasRight('ShowTicket')} @{$Queues->ItemsArrayRef}; + +if ($ARGS{'Save'}) { + for my $queue (@queues) { + if ($ARGS{"Want-".$queue->Name}) { + delete $unwanted->{$queue->Name}; + } + else { + ++$unwanted->{$queue->Name}; + } + } + + my ($ok, $msg) = $user->SetPreferences('QuickSearch', $unwanted); + push @actions, $ok ? loc('Preferences saved.') : $msg; + + # Let QueueSummary rebuild the cache + delete $session{'quick_search_queues'}; +} + +</%INIT> diff --git a/rt/share/html/Prefs/Search.html b/rt/share/html/Prefs/Search.html new file mode 100644 index 000000000..c64078b39 --- /dev/null +++ b/rt/share/html/Prefs/Search.html @@ -0,0 +1,111 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /Prefs/Elements/Tabs, + current_tab => 'Prefs/MyRT.html', +# current_subtab => 'Prefs/Search.html?name='.$m->comp('/Elements/QueryString', name => $ARGS{name}), + current_subtab => 'Prefs/Search.html?name='.$ARGS{name}, + Title => $title +&> +<& /Elements/ListActions, actions => \@actions &> +% if ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) { +<p> + <&|/l&>You can also edit the predefined search itself</&>: + <a href="<% RT->Config->Get('WebPath').'/Search/Build.html?'. + $m->comp('/Elements/QueryString', + SavedSearchLoad => 'RT::System-1-SavedSearch-'.$id) %>"><% $search->Name %></a> +</p> +% } + +<form method="post" action="Search.html" name="BuildQuery"> +<input type="hidden" name="name" value="<%$ARGS{name}%>" class="hidden" /> +<input type="hidden" name="Format" value="<%$ARGS{Format}%>" class="hidden" /> + +<& /Search/Elements/DisplayOptions, %$SearchArg, %ARGS, + AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat &> +<& /Elements/Submit, Caption => loc("Save Changes"), Label => loc('Save'), Name => 'Save'&> + +</form> + +<%INIT> +my @actions; +my $title = loc("Customize").' '; + +my @fields = qw(Format Order OrderBy RowsPerPage); +$ARGS{name} ||= ''; +my ($class, $id) = ( $ARGS{name} =~ m/^(.*)-(\d+)$/ ); + +Abort('No search specified') + unless defined $class and $class eq 'RT::Attribute'; + +my $search = $class->new ($session{'CurrentUser'}); +$search->LoadById ($id); +$title .= loc ($search->Description, loc ('"N"')); +my $user = $session{'CurrentUser'}->UserObj; +my $SearchArg = $user->Preferences($search, $search->Content); +$ARGS{Order} = (ref $ARGS{Order} ? join('|',grep {/\S/} @{$ARGS{Order}}) : $ARGS{Order}); +$ARGS{OrderBy} = (ref $ARGS{OrderBy} ? join('|',grep {/\S/} @{$ARGS{OrderBy}}) : $ARGS{OrderBy}); +for (@fields) { + $ARGS{$_} = $SearchArg->{$_} unless defined $ARGS{$_}; +} +$ARGS{'Order'} = join '|', grep defined && /\S/, (ref $ARGS{'Order'})? @{$ARGS{'Order'}}: $ARGS{'Order'}; +$ARGS{'OrderBy'} = join '|', grep defined && /\S/, (ref $ARGS{'OrderBy'})? @{$ARGS{'OrderBy'}}: $ARGS{'OrderBy'}; + +my ( $AvailableColumns, $CurrentFormat ); +( $ARGS{Format}, $AvailableColumns, $CurrentFormat ) = $m->comp( + '/Search/Elements/BuildFormatString', + cfqueues => {}, %ARGS +); + +if ($ARGS{'Save'}) { + my $hash = {map { $_ => $ARGS{$_}} @fields}; + my ($ok, $msg) = $user->SetPreferences($search, $hash); + push @actions, $ok ? loc('Preferences saved.') : $msg; +} + +</%INIT> diff --git a/rt/share/html/Prefs/SearchOptions.html b/rt/share/html/Prefs/SearchOptions.html new file mode 100644 index 000000000..e40265f23 --- /dev/null +++ b/rt/share/html/Prefs/SearchOptions.html @@ -0,0 +1,111 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => loc("Search Preferences") &> +<& /User/Elements/Tabs, + current_tab => "Prefs/SearchOptions.html", + Title => loc("Search Preferences") +&> +<& /Elements/ListActions, actions => \@actions &> + +<form method="post" action="SearchOptions.html"> +<input type="hidden" class="hidden" name="Format" value="<%$Format%>" /> + <& /Search/Elements/DisplayOptions, %ARGS, + Format=> $Format, + AvailableColumns => $AvailableColumns, + CurrentFormat => $CurrentFormat, + RowsPerPage => $RowsPerPage, + OrderBy => $OrderBy, + Order => $Order &> + +<& /Elements/Submit, Name => 'SavePreferences', Label => loc('Save Changes') &> +</form> +<%INIT> +my @actions; + +# {{{ If we're saving search preferences, do that now +$Order = join '|', grep defined && /\S/, (ref $Order)? @{$Order}: $Order; +$OrderBy = join '|', grep defined && /\S/, (ref $OrderBy)? @{$OrderBy}: $OrderBy; + +$Order = (ref $Order ? join('|',grep {/\S/} @{$Order}) : $Order); +$OrderBy = (ref $OrderBy ? join('|',grep {/\S/} @{$OrderBy}) : $OrderBy); +if ($ARGS{'SavePreferences'}) { + my ($ok, $msg) = $session{'CurrentUser'}->UserObj->SetPreferences("SearchDisplay", + { + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + }); + push @actions, $ok ? loc("Preferences saved.") : $msg; +} + +# }}} + +# Read from user preferences +my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}; + +$Format ||= $prefs->{'Format'}; +$Order ||= ($prefs->{'Order'} || 'ASC'); +$OrderBy ||= ($prefs->{'OrderBy'} || 'id'); +($RowsPerPage = defined( $prefs->{'RowsPerPage'} ) ? $prefs->{'RowsPerPage'} : 50) unless defined ($RowsPerPage); + +my ( $AvailableColumns, $CurrentFormat ); +( $Format, $AvailableColumns, $CurrentFormat ) = $m->comp( + '/Search/Elements/BuildFormatString', + %ARGS, Format => $Format +); +</%INIT> + +<%ARGS> +$Format => undef +$Description => undef +$Order => undef +$OrderBy => undef +$RowsPerPage => undef +</%ARGS> + |