diff options
Diffstat (limited to 'rt/share/html/Elements')
111 files changed, 9540 insertions, 0 deletions
diff --git a/rt/share/html/Elements/BevelBoxRaisedEnd b/rt/share/html/Elements/BevelBoxRaisedEnd new file mode 100755 index 000000000..575a47ab7 --- /dev/null +++ b/rt/share/html/Elements/BevelBoxRaisedEnd @@ -0,0 +1,50 @@ +%# 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 }}} + </td> +</tr> +</table> diff --git a/rt/share/html/Elements/BevelBoxRaisedStart b/rt/share/html/Elements/BevelBoxRaisedStart new file mode 100755 index 000000000..980c4cf95 --- /dev/null +++ b/rt/share/html/Elements/BevelBoxRaisedStart @@ -0,0 +1,50 @@ +%# 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 }}} +<table cellspacing="0" cellpadding="0" width="100%" height="100%"> + <tr> + <td width="100%" height="100%"> diff --git a/rt/share/html/Elements/Callback b/rt/share/html/Elements/Callback new file mode 100755 index 000000000..ec647097f --- /dev/null +++ b/rt/share/html/Elements/Callback @@ -0,0 +1,53 @@ +%# 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 }}} +<%INIT> +$ARGS{'CallbackPage'} = delete $ARGS{'Page'} || $m->callers(1)->path; +$ARGS{'CallbackName'} = delete $ARGS{'_CallbackName'}; +$RT::Logger->debug("$ARGS{'CallbackPage'} calls old style callback, use \$m->callback"); +return $m->callback( %ARGS ); +</%INIT> diff --git a/rt/share/html/Elements/Checkbox b/rt/share/html/Elements/Checkbox new file mode 100755 index 000000000..72ab677b6 --- /dev/null +++ b/rt/share/html/Elements/Checkbox @@ -0,0 +1,63 @@ +%# 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 }}} +<input type="checkbox" class="checkbox" name="<%$Name%>" value="1" <%$IsChecked%> /> + +<%ARGS> +$Name => undef +$Default => undef +$True => undef +$False => undef +$IsChecked => undef +</%ARGS> + +<%INIT> +$IsChecked = + ($Default && $Default =~ /checked/i) + ? ' checked="checked" ' : ""; +1; +</%INIT> diff --git a/rt/share/html/Elements/CollectionAsTable/Header b/rt/share/html/Elements/CollectionAsTable/Header new file mode 100644 index 000000000..550ce9f3f --- /dev/null +++ b/rt/share/html/Elements/CollectionAsTable/Header @@ -0,0 +1,142 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Class => 'RT__Ticket' + +@Format => undef +$FormatString => undef +@OrderBy => () +@Order => () +$Query => undef +$Rows => undef +$Page => undef +$GenericQueryArgs => undef +$maxitems => undef + +$AllowSorting => undef +$BaseURL => undef +@PassArguments => qw(Query Format Rows Page Order OrderBy) +</%ARGS> +<tr class="collection-as-table"> +<%PERL> + +my $generic_query_args = $GenericQueryArgs || {map { $_ => $ARGS{$_} } @PassArguments}; +# backward compatibility workaround +$generic_query_args->{'Format'} = $FormatString if grep $_ eq 'Format', @PassArguments; + +my $item = 0; +foreach my $col ( @Format ) { + my $title = $col->{'title'} || ''; + if ( $title eq 'NEWLINE' ) { + while ( $item < $maxitems ) { + $m->out(qq{<th class="collection-as-table"> </th>\n}); + $item++; + } + + $item = 0; + $m->out(qq{</tr>\n<tr class="collection-as-table">}); + next; + } elsif ( $title eq 'NBSP' ) { + $item++; + $m->out(qq{<th class="collection-as-table"> </th>\n}); + next; + } + + my $span = $col->{'span'}; + $item += ($span || 1); + + $m->out('<th class="collection-as-table"'); + $m->out(' colspan="' . $m->interp->apply_escapes($span => 'h') . '"') + if $span; + $m->out('>'); + + # if title is not defined then use defined attribute or last + # one we saw in the format + unless ( defined $col->{'title'} ) { + my $attr = $col->{'attribute'} || $col->{'last_attribute'}; + my $tmp = $m->comp( '/Elements/ColumnMap', + Class => $Class, + Name => $attr, + Attr => 'title', + ); + $title = ProcessColumnMapValue( $tmp, Arguments => [ $attr ] ); + } else { + $title = $m->comp('/Elements/ScrubHTML', Content => $title); + } + + if ( $AllowSorting and $col->{'attribute'} + and my $attr = $m->comp( + "/Elements/ColumnMap", + Class => $Class, + Name => $col->{'attribute'}, + Attr => 'attribute' + ) + ) + { + $attr = ProcessColumnMapValue( $attr, Arguments => [ $col->{'attribute'} ], Escape => 0 ); + + my $new_order = 'ASC'; + $new_order = $Order[0] eq 'ASC'? 'DESC': 'ASC' + if $OrderBy[0] && $OrderBy[0] eq $attr; + + $m->out( + '<a href="' . $BaseURL + . $m->comp( '/Elements/QueryString', + %$generic_query_args, + OrderBy => $attr, Order => $new_order + ) + . '">'. loc($title) .'</a>' + ); + } + else { + $m->out( loc($title) ); + } + $m->out('</th>'); +} +</%PERL> +</tr> diff --git a/rt/share/html/Elements/CollectionAsTable/ParseFormat b/rt/share/html/Elements/CollectionAsTable/ParseFormat new file mode 100644 index 000000000..d58246fff --- /dev/null +++ b/rt/share/html/Elements/CollectionAsTable/ParseFormat @@ -0,0 +1,108 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Format +</%ARGS> + +<%init> +use Regexp::Common qw/delimited/; +my @Columns; + +while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) { + my $col = $1; + + if ($col =~ /^$RE{quoted}$/o) { + substr($col,0,1) = ""; + substr($col,-1,1) = ""; + } + + my $colref = { }; + + $m->callback(CallbackName => 'PreColumn', Column => $colref, col => \$col); + + while ( $col =~ s{/(STYLE|CLASS|TITLE|ALIGN|SPAN|ATTRIBUTE):([^/]*)}{}i ) { + $colref->{ lc $1 } = $2; + } + $colref->{'last_attribute'} = $colref->{'attribute'}; + + unless ( length $col ) { + $colref->{'output'} = []; + $colref->{'last_attribute'} = $colref->{'attribute'} = '' + unless defined $colref->{'attribute'}; + } + elsif ( $col =~ /^__(NEWLINE|NBSP)__$/ || $col =~ /^(NEWLINE|NBSP)$/ ) { + $colref->{'title'} = $1; + } + elsif ( $col =~ /__(.*?)__/io ) { + my @subcols; + while ( $col =~ s/^(.*?)__(.*?)__//o ) { + push ( @subcols, $1 ) if $1; + push ( @subcols, "__$2__" ); + $colref->{'last_attribute'} = $2; + } + push @subcols, $col; + $colref->{'output'} = \@subcols; + $colref->{'attribute'} = $colref->{'last_attribute'} + unless defined $colref->{'attribute'}; + } + else { + $colref->{'output'} = [ "__" . $col . "__" ]; + $colref->{'last_attribute'} = $col; + $colref->{'attribute'} = $col + unless defined $colref->{'attribute'}; + } + + $m->callback(CallbackName => 'PostColumn', Column => $colref, col => \$col); + + push @Columns, $colref; +} + +$m->callback(CallbackName => 'PostProcess', Columns => \@Columns, Format => $Format); + +return(@Columns); +</%init> diff --git a/rt/share/html/Elements/CollectionAsTable/Row b/rt/share/html/Elements/CollectionAsTable/Row new file mode 100644 index 000000000..fa7474b6c --- /dev/null +++ b/rt/share/html/Elements/CollectionAsTable/Row @@ -0,0 +1,143 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$i => undef +@Format => undef +$record => undef +$maxitems => undef +$Depth => undef +$Warning => undef +$ColumnMap => {} +$Class => 'RT__Ticket' +</%ARGS> +<%init> +$m->out( '<tr class="' + . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' + . "\n" ); +use HTML::Entities; +my $item; +foreach my $column (@Format) { + if ( defined $column->{title} && $column->{title} eq 'NEWLINE' ) { + while ( $item < $maxitems ) { + $m->out(qq{<td class="collection-as-table"> </td>\n}); + $item++; + } + $item = 0; + $m->out( '</tr>' . "\n" ); + $m->out( '<tr class="' + . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) + . '" >' + . "\n" ); + next; + } + + my $class = $column->{class} ? encode_entities( $column->{class}, q{'"&<>} ) : 'collection-as-table'; + $m->out(qq{<td class="$class" }); + + my %attrs; + foreach my $attr (qw(style align)) { + if ( defined $column->{ $attr } ) { + $attrs{ $attr } = $column->{ $attr }; + next; + } + + # if it's not defined then use column map + my $col = $column->{'attribute'} || $column->{'last_attribute'}; + unless ( exists $ColumnMap->{$col}{$attr} ) { + next unless $col; + + $ColumnMap->{$col}{$attr} = $m->comp( + "/Elements/ColumnMap", + Class => $Class, + Name => $col, + Attr => $attr, + ); + } + $attrs{ $attr } = ProcessColumnMapValue( + $ColumnMap->{$col}{$attr}, + Arguments => [$record, $i], + Escape => 0, + ); + } + + $attrs{colspan} = $column->{span}; + $item += ($attrs{'colspan'} || 1); + + my @out; + foreach my $subcol ( @{ $column->{output} } ) { + my ($col) = ($subcol =~ /^__(.*?)__$/); + unless ( $col ) { + push @out, $subcol; + next; + } + + unless ( exists $ColumnMap->{$col}{'value'} ) { + $ColumnMap->{$col}{'value'} = $m->comp( + "/Elements/ColumnMap", + Class => $Class, + Name => $col, + Attr => 'value' + ); + } + + push @out, ProcessColumnMapValue( + $ColumnMap->{$col}{'value'}, + Arguments => [$record, $i], + ); + } + s/\n/<br \/>/gs for @out; + + $m->out( $_ .'="'. $m->interp->apply_escapes( $attrs{$_} => 'h' ) .'"' ) + foreach grep $attrs{$_}, qw(align style colspan); + + $m->out('>'); + $m->out(@out) if @out; + $m->out( '</td>' . "\n" ); +} +$m->out('</tr>'); +</%init> diff --git a/rt/share/html/Elements/CollectionList b/rt/share/html/Elements/CollectionList new file mode 100644 index 000000000..6f21420f5 --- /dev/null +++ b/rt/share/html/Elements/CollectionList @@ -0,0 +1,175 @@ +%# 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 }}} +<%INIT> +if (!$Collection && $Class eq 'RT::Tickets') { + $Collection = RT::Tickets->new( $session{'CurrentUser'} ); + $Collection->FromSQL($Query); +} + +my $TotalFound = $Collection->CountAll(); +return '' if !$TotalFound && !$ShowEmpty; + +if ( @OrderBy ) { + if ( $OrderBy[0] =~ /\|/ ) { + @OrderBy = split /\|/, $OrderBy[0]; + @Order = split /\|/,$Order[0]; + } + $Collection->OrderByCols( + map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } + ( 0 .. $#OrderBy ) + ); +} + +$Collection->RowsPerPage( $Rows ) if $Rows; +$Page = 1 unless $Page && $Page > 0; # workaround problems with $Page = '' or undef +$Collection->GotoPage( $Page - 1 ); # SB uses page 0 as the first page + +# DisplayFormat lets us use a "temporary" format for display, while +# still using our original format for next/prev page links. +# bulk update uses this feature to add checkboxes + +$DisplayFormat ||= $Format; + +# Scrub the html of the format string to remove any potential nasties. +$Format = $m->comp('/Elements/ScrubHTML', Content => $Format); +$DisplayFormat = $m->comp('/Elements/ScrubHTML', Content => $DisplayFormat); + +my @Format = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $DisplayFormat); + +# Find the maximum number of items in any row, so we can pad the table. +my ($maxitems, $item) = (0, 0); +foreach my $col (@Format) { + $item++; + if ( $col->{title} && ($col->{title} eq 'NEWLINE') ) { + $item = 0; + } + else { + $maxitems = $item if $item > $maxitems; + } +} + +$Class ||= ref $Collection; +$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') . '">'); + +if ( $ShowHeader ) { + $m->comp('/Elements/CollectionAsTable/Header', + %ARGS, + Class => $Class, + Format => \@Format, + FormatString => $Format, + Order => \@Order, + OrderBy => \@OrderBy, + Rows => $Rows, + Page => $Page, + AllowSorting => $AllowSorting, + BaseURL => $BaseURL, + GenericQueryArgs => $GenericQueryArgs, + maxitems => $maxitems, + ); +} + +my ($i, $column_map) = (0, {}); +while ( my $record = $Collection->Next ) { + # Every ten rows, flush the buffer and put something on the page. + $m->flush_buffer unless ++$i % 10; + $m->comp('/Elements/CollectionAsTable/Row', + i => $i, + Format => \@Format, + record => $record, + maxitems => $maxitems, + ColumnMap => $column_map, + Class => $Class, + ); +} + +$m->out('</table>'); +if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) { + my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1; + my $pages = int( $TotalFound / $Rows ) + $oddRows; + $pages = 1 if $pages < 1; + + + my %query_args = map { $_ => $ARGS{$_} } @PassArguments; + $m->comp( + '/Elements/CollectionListPaging', + BaseURL => $BaseURL, + Rows => $Rows, + TotalFound => $TotalFound, + CurrentPage => $Page, + Pages => $pages, + URLParams => \%query_args + ); + +} + +</%INIT> +<%ARGS> +$Class => '' +$Collection => undef +$Format => undef +$DisplayFormat => undef +@Order => () +@OrderBy => () +$GenericQueryArgs => undef +$Rows => undef +$Page => 1 +$Title => loc('Ticket Search') +$BaseURL => RT->Config->Get('WebPath') . $m->request_comp->path .'?' +@PassArguments => qw( Query Format Rows Page Order OrderBy) + +$AllowSorting => 0 +$ShowNavigation => 1 +$ShowHeader => 1 +$ShowEmpty => 0 +$Query => 0 +</%ARGS> diff --git a/rt/share/html/Elements/CollectionListPaging b/rt/share/html/Elements/CollectionListPaging new file mode 100644 index 000000000..8fc0632b8 --- /dev/null +++ b/rt/share/html/Elements/CollectionListPaging @@ -0,0 +1,108 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$BaseURL => undef +$Rows => undef +$TotalFound => undef +$CurrentPage => undef +$Pages => undef +$URLParams => undef +</%ARGS> + +<%INIT> +$m->out(qq{<div class="paging">}); +if ($Pages == 1) { + $m->out(loc('Page 1 of 1')); +} +else{ +$m->out(loc('Page') . ' '); +my $prev = $m->comp( + '/Elements/QueryString', + %$URLParams, + Page => ( $CurrentPage - 1 ) + ); +my $next = $m->comp( + '/Elements/QueryString', + %$URLParams, + Page => ( $CurrentPage + 1 ) + ); +my %show; +$show{1} = 1; +$show{$_} = 1 for (($CurrentPage - 2)..($CurrentPage + 2)); +$show{$Pages} = 1; +my $dots; + +for my $number ( 1 .. $Pages ) { + if ( $show{$number} ) { + $dots = undef; + my $qs = + $m->comp( '/Elements/QueryString', %$URLParams, Page => $number ); + $m->out(qq{<span class="pagenum">}); + if ( $number == $CurrentPage ) { + $m->out(qq{<span class="currentpage">$number</span> }); + } + else { + $m->out(qq{<a href="$BaseURL$qs">$number</a> }); + } + } + elsif ( not $dots ) { + $dots = 1; + $m->out(qq{<span class="dots">...</span>}); + } + $m->out(qq{</span>}); +} + +if ($CurrentPage > 1) { + $m->out(qq{<a href="$BaseURL$prev" class="nav">}.loc('Previous') . qq{</a>}); +} +if (($CurrentPage * $Rows) < $TotalFound) { + $m->out(qq{<a href="$BaseURL$next" class="nav">}.loc('Next').qq{</a>}); +} +} +$m->out(qq{</div>}); +</%INIT> diff --git a/rt/share/html/Elements/ColumnMap b/rt/share/html/Elements/ColumnMap new file mode 100644 index 000000000..71517e063 --- /dev/null +++ b/rt/share/html/Elements/ColumnMap @@ -0,0 +1,151 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Class => 'RT__Ticket' +$Name +$Attr => undef +</%ARGS> +<%ONCE> + +# This is scary and should totally be refactored -- jesse +my $COLUMN_MAP = { + id => { + attribute => 'id', + title => 'id', # loc + align => 'right', + value => sub { return $_[0]->id } + }, + + Created => { + attribute => 'Created', + title => 'Created', # loc + value => sub { return $_[0]->CreatedObj->AsString } + }, + CreatedRelative => { + attribute => 'Created', + title => 'Created', # loc + value => sub { return $_[0]->CreatedObj->AgeAsString } + }, + CreatedBy => { + attribute => 'CreatedBy', + title => 'Created By', # loc + value => sub { return $_[0]->CreatorObj->Name } + }, + LastUpdated => { + attribute => 'LastUpdated', + title => 'Last Updated', # loc + value => sub { return $_[0]->LastUpdatedObj->AsString } + }, + LastUpdatedRelative => { + attribute => 'LastUpdated', + title => 'Last Updated', # loc + value => sub { return $_[0]->LastUpdatedObj->AgeAsString } + }, + LastUpdatedBy => { + attribute => 'LastUpdatedBy', + title => 'Last Updated By', # loc + value => sub { return $_[0]->LastUpdatedByObj->Name } + }, + + + CheckBox => { + title => sub { + my $name = $_[1] || 'SelectedTickets'; + my $checked = $m->request_args->{ $name .'All' }? 'checked="checked"': ''; + + return \qq{<input type="checkbox" name="${name}All" value="1" $checked + onclick="setCheckbox(this.form, '$name', this.checked)" />}; + }, + value => sub { + my $id = $_[0]->id; + + my $name = $_[2] || 'SelectedTickets'; + return \qq{<input type="checkbox" name="$name" value="$id" checked="checked" />} + if $m->request_args->{ $name . 'All'}; + + my $arg = $m->request_args->{ $name }; + my $checked = ''; + if ( $arg && ref $arg ) { + $checked = 'checked="checked"' if grep $_ == $id, @$arg; + } + elsif ( $arg ) { + $checked = 'checked="checked"' if $arg == $id; + } + return \qq{<input type="checkbox" name="$name" value="$id" $checked />} + }, + }, + RadioButton => { + title => \' ', + value => sub { + my $id = $_[0]->id; + + my $name = $_[2] || 'SelectedTicket'; + 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 />}; + }, + }, + (map { + my $value = RT->Config->Get($_); + $_ => { value => sub { return \$value } }; + + } qw(WebPath WebBaseURL WebURL)), +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 ); +$m->callback( COLUMN_MAP => $COLUMN_MAP ); + +# first deal with class specific things +my $class_map = $m->comp("/Elements/$Class/ColumnMap", Attr => $Attr, Name => $Name ); +return $class_map if defined $class_map; +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); + +</%INIT> diff --git a/rt/share/html/Elements/CreateTicket b/rt/share/html/Elements/CreateTicket new file mode 100755 index 000000000..9c8f3aadf --- /dev/null +++ b/rt/share/html/Elements/CreateTicket @@ -0,0 +1,50 @@ +%# 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 }}} +<form action="<% RT->Config->Get('WebPath') %>/Ticket/Create.html" name="CreateTicketInQueue" id="CreateTicketInQueue"> +<&|/l, $m->scomp('/Elements/SelectNewTicketQueue', OnChange => 'document.CreateTicketInQueue.submit()')&><input type="submit" class="button" value="New ticket in" /> [_1]</&> +</form> diff --git a/rt/share/html/Elements/DashboardTabs b/rt/share/html/Elements/DashboardTabs new file mode 100644 index 000000000..f9493d5fe --- /dev/null +++ b/rt/share/html/Elements/DashboardTabs @@ -0,0 +1,52 @@ +<%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 new file mode 100644 index 000000000..3653aa5b8 --- /dev/null +++ b/rt/share/html/Elements/Dashboards @@ -0,0 +1,66 @@ +%# 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 }}} +<div class="dashboards"> +<&|/Widgets/TitleBox, + title => loc("Dashboards"), + title_href => RT->Config->Get('WebPath').'/Dashboards/index.html', + bodyclass => "", + titleright => loc("Edit"), + titleright_href => RT->Config->Get('WebPath').'/Dashboards/', +&> + +<& /Dashboards/Elements/ShowDashboards:table, + Dashboards => \@dashboards, + Verbose => 0, +&> +</&> +</div> +<%INIT> +my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards"); +</%INIT> + diff --git a/rt/share/html/Elements/EditCustomField b/rt/share/html/Elements/EditCustomField new file mode 100644 index 000000000..d1bb0c295 --- /dev/null +++ b/rt/share/html/Elements/EditCustomField @@ -0,0 +1,116 @@ +%# 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 }}} +<%INIT> + +my $Type = $CustomField->Type; +unless ( $Type ) { + # if we can't see the type, all hell will break loose. + $RT::Logger->error( "Custom field #". $CustomField->id ." has empty type" ); + return; +} + +my $Values; +if ( $Object && $Object->id ) { + $NamePrefix ||= join '-', + 'Object', ref($Object), $Object->Id, 'CustomField', ''; + + $Values = $Object->CustomFieldValues( $CustomField->id ); + $Values->Columns( + qw( id CustomField ObjectType ObjectId Disabled Content + ContentType ContentEncoding SortOrder Creator Created + LastUpdatedBy LastUpdated ) + ); + # Don't take care of $Values if there isn't values inside + undef ( $Values ) unless ( $Values->Count ); +} + +# Always fill $Default with submited values if it's empty +if ( ( !defined $Default || !length $Default ) && $DefaultsFromTopArguments ) { + my %TOP = $m->request_args; + $Default = $TOP{ $NamePrefix .$CustomField->Id . '-Values' } + || $TOP{ $NamePrefix .$CustomField->Id . '-Value' }; +} + +my $MaxValues = $CustomField->MaxValues; +if ($MaxValues == 1 && $Values) { + # what exactly is this doing? Without the "unless" it breaks RTFM + # transaction extraction into articles. + $Default = ($Values->First ? $Values->First->Content : '') unless $Default; + $Values->GotoFirstItem; +} +# The "Magic" hidden input causes RT to know that we were trying to edit the field, even if +# we don't see a value later, since browsers aren't compelled to submit empty form fields +$m->out("\n".'<input type="hidden" class="hidden" name="'.$NamePrefix.$CustomField->Id.'-Values-Magic" value="1" />'."\n"); + +my $EditComponent = "EditCustomField$Type"; +$m->callback( %ARGS, CallbackName => 'EditComponentName', Name => \$EditComponent, CustomField => $CustomField, Object => $Object ); +$EditComponent = "EditCustomField$Type" unless $m->comp_exists($EditComponent); + +return $m->comp( + $EditComponent, + %ARGS, + Rows => $Rows, + Cols => $Cols, + Default => $Default, + Object => $Object, + Values => $Values, + MaxValues => $MaxValues, + Multiple => ($MaxValues != 1), + NamePrefix => $NamePrefix, + CustomField => $CustomField, +); +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Rows => 5 +$Cols => 15 +$Default => undef +$DefaultsFromTopArguments => 1, +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldAutocomplete b/rt/share/html/Elements/EditCustomFieldAutocomplete new file mode 100644 index 000000000..ba7907b19 --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldAutocomplete @@ -0,0 +1,88 @@ +%# 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 }}} +% 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> +<script type="text/javascript"> +new Ajax.Autocompleter( + "<% $name %>-Values", + "<% $name %>-Choices", + "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues", + { tokens: [ '\n' ] } +); +% } else { +<input type="text" id="<% $name %>-Value" name="<% $name %>-Value" class="CF-<%$CustomField->id%>-Edit" value="<% $Default %>"/><div id="<% $name %>-Choices" class="autocomplete"></div> +<script type="text/javascript"> +new Ajax.Autocompleter( + "<% $name %>-Value", + "<% $name %>-Choices", + "<% RT->Config->Get('WebPath')%>/Helpers/Autocomplete/CustomFieldValues", + {} +); +% } +</script> +<%INIT> +my $name = $NamePrefix . $CustomField->Id; +if ( $Default && !$Multiple ) { + $Default =~ s/\s*\r*\n\s*/ /g; +} +if ( $Multiple and $Values ) { + $Default = ''; + while (my $value = $Values->Next ) { + $Default .= $value->Content ."\n"; + } +} +</%INIT> +<%ARGS> +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => undef +$Rows => undef +$Cols => undef +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldBinary b/rt/share/html/Elements/EditCustomFieldBinary new file mode 100644 index 000000000..89a669f9f --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldBinary @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ( $Values and my $value = $Values->Next ) { +%# XXX - let user download the file(s) here? +<input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $value->Id %>/<% $value->Content %>"><% $value->Content %></a><br /> +% } +% if (!$MaxValues || !$Values || $Values->Count < $MaxValues) { +<input type="file" name="<% $NamePrefix %><% $CustomField->Id %>-Upload" class="CF-<%$CustomField->id%>-Edit" /> +% } +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldCombobox b/rt/share/html/Elements/EditCustomFieldCombobox new file mode 100644 index 000000000..e6b76ff10 --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldCombobox @@ -0,0 +1,69 @@ +%# 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 }}} +% while ($Values and my $value = $Values->Next and $Multiple) { +<input type="checkbox" class="checkbox CF-<%$CustomField->id%>-Edit" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><% $value->Content %> +<br /> +% } +% (!$Multiple or !$MaxValues or !$Values or $Values->Count < $MaxValues) or return; +<& /Widgets/ComboBox, + Name => $NamePrefix . $CustomField->Id . "-Value", + Default => $Default, + Rows => $Rows, + Class => "CF-".$CustomField->id."-Edit", + Values => [map {$_->Name} @{$CustomField->Values->ItemsArrayRef}], +&> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => 0 +$Rows => undef +$MaxValues => undef +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldFreeform b/rt/share/html/Elements/EditCustomFieldFreeform new file mode 100644 index 000000000..856a61f31 --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldFreeform @@ -0,0 +1,71 @@ +%# 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 }}} +% my $name = $NamePrefix . $CustomField->Id . '-Value'; +% if ($Multiple) { +<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$name%>s" id="<%$name%>s" wrap="off" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> +% } else { +<input name="<%$name%>" id="<%$name%>" size="<%$Cols%>" class="CF-<%$CustomField->id%>-Edit" value="<% defined($Default) ? $Default : ''%>" /> +% } +<%INIT> +if ( $Multiple and $Values ) { + $Default = join "\n", map $_->Content, @{ $Values->ItemsArrayRef }; +} +unless ( $Multiple ) { + $Default =~ s/\s*\n+\s*/ /g if $Default; +} +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldImage b/rt/share/html/Elements/EditCustomFieldImage new file mode 100644 index 000000000..b15cc5d2c --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldImage @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +% while ($Values and my $value = $Values->Next ) { +<input type="checkbox" class="checkbox" name="<%$NamePrefix%><%$CustomField->Id%>-DeleteValueIds" class="CF-<%$CustomField->id%>-Edit" value="<% $value->Id %>" /><& ShowCustomFieldImage, Object => $value &> +<br /> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<input type="file" name="<%$NamePrefix%><%$CustomField->Id%>-Upload" class="CF-<%$CustomField->id%>-Edit" /> +% } +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldSelect b/rt/share/html/Elements/EditCustomFieldSelect new file mode 100644 index 000000000..8fe79f9f9 --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldSelect @@ -0,0 +1,161 @@ +%# 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 }}} +%# Build up the set of cascading select boxes as "guides" +%# each one limits the options of the final one a bit +%# (perhaps by tweaking the .display style?) +% my $selected = 0; +% my @category; +% my $id = $NamePrefix . $CustomField->Id; +% my $out = $m->scomp('SELF:options', %ARGS, SelectedRef => \$selected, CategoryRef => \@category); +% if (@category and not $CustomField->BasedOnObj->id) { + <script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script> +%# XXX - Hide this select from w3m? + <select onchange="filter_cascade('<% $id %>-Values', this.value)" name="<% $id %>-Category" class="CF-<%$CustomField->id%>-Edit"> + <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>-</&></option> +% foreach my $cat (@category) { +% my ($depth, $name) = @$cat; + <option value="<% $name %>"><% ' ' x $depth |n %><% $name %></option> +% } + </select><br /> +% } elsif ($CustomField->BasedOnObj->id) { +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/cascaded.js"></script> +<script type="text/javascript"><!-- +doOnLoad( function () { + var basedon = document.getElementById('<% $NamePrefix . $CustomField->BasedOnObj->id %>-Values'); + if (basedon != null) { + var oldchange = basedon.onchange; + basedon.onchange = function () { + filter_cascade( + '<% $id %>-Values', + basedon.value, + 1 + ); + if (oldchange != null) + oldchange(); + }; + basedon.onchange(); + } +}); +--></script> +% } +% if (@category) { +%# this hidden select is to supply a full list of values, +%# see filter_cascade() in js/cascaded.js + <select name="<%$id%>-Values-Complete" id="<%$id%>-Values-Complete" class="hidden" disabled="disabled"> + <option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option> +% $m->out($out); + </select> +% } +<select + name="<%$id%>-Values" id="<%$id%>-Values" class="CF-<%$CustomField->id%>-Edit" +% if ( $Rows && ( $Multiple || !@category ) ) { + size="<% $Rows %>" +% } +<% $Multiple && qq[multiple="multiple"] |n %> > +<option value=""<% !$selected && qq[ selected="selected"] |n %>><&|/l&>(no value)</&></option> +% $m->out($out); +</select> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$Multiple => 0 +$Rows => undef +</%ARGS> + +<%METHOD options> +% @Default = grep defined && length, @Default; +% # $Values->HasEntry is too slow here +% if ( !@Default && $Values ) { +% @Default = map $_->Content, @{$Values->ItemsArrayRef}; +% } +% $_ = lc $_ foreach @Default; +% my $selected; +% my $CFVs = $CustomField->Values; +% my @levels; +% while ( my $value = $CFVs->Next ) { +% my $name = $value->Name; +% my $category = $value->Category || ''; +% my $level = (split /:/, $category, 2)[0] || ''; +% while (@levels) { +% if ($levels[-1] eq $level) { +% $level = ''; +% last; +% } elsif (index($level, $levels[-1]) != 0) { +% $m->out('</optgroup>'); +% pop @levels; +% } else { +% last; +% } +% } +% if ( length $level ) { +% push @$CategoryRef, [0+@levels, $level]; + <optgroup style="padding-left: <% @levels/2 %>em" label="<% $category %>"> +% push @levels, $level; +% } + <option value="<% $name %>" +% if ( grep $_ eq lc $name, @Default ) +% { +% $$SelectedRef = 1; + selected="selected" +% } + ><% $name %></option> +% } +% for (@levels) { + </optgroup> +% } +<%ARGS> +$CustomField => undef +@Default => () +$Values => undef +$SelectedRef => undef +$CategoryRef => undef +</%ARGS> +</%METHOD> diff --git a/rt/share/html/Elements/EditCustomFieldText b/rt/share/html/Elements/EditCustomFieldText new file mode 100644 index 000000000..7d69ffcea --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldText @@ -0,0 +1,67 @@ +%# 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 }}} +% while ($Values and my $value = $Values->Next ) { +<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% defined($Default) ? $Default : '' %></textarea> +% } +<%INIT> +# XXX - MultiValue textarea is for now outlawed. +$MaxValues = 1; +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => '' +$Default => undef +$Values => undef +$MaxValues => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/share/html/Elements/EditCustomFieldWikitext b/rt/share/html/Elements/EditCustomFieldWikitext new file mode 100644 index 000000000..f11b48d74 --- /dev/null +++ b/rt/share/html/Elements/EditCustomFieldWikitext @@ -0,0 +1,67 @@ +%# 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 }}} +% while ($Values and my $value = $Values->Next ) { +<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $value->Content %></textarea><br /> +% } +% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) { +<textarea cols="<%$Cols%>" rows="<%$Rows%>" name="<%$NamePrefix%><%$CustomField->Id%>-Values" class="CF-<%$CustomField->id%>-Edit"><% $Default %></textarea> +% } +<%INIT> +# XXX - MultiValue textarea is for now outlawed. +$MaxValues = 1; +</%INIT> +<%ARGS> +$Object => undef +$CustomField => undef +$NamePrefix => undef +$Default => undef +$Values => undef +$MaxValues => undef +$Cols +$Rows +</%ARGS> diff --git a/rt/share/html/Elements/EditLinks b/rt/share/html/Elements/EditLinks new file mode 100755 index 000000000..637762e1b --- /dev/null +++ b/rt/share/html/Elements/EditLinks @@ -0,0 +1,178 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<table width="100%"> + <tr> + <td valign="top" width="50%"> + <h3><&|/l&>Current Links</&></h3> + +<table> + <tr> + <td class="labeltop"><&|/l&>Depends on</&>:</td> + <td class="value"> +% while (my $link = $Object->DependsOn->Next) { + <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> + <& ShowLink, URI => $link->TargetURI &><br /> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Depended on by</&>:</td> + <td class="value"> +% while (my $link = $Object->DependedOnBy->Next) { + <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" /> + <& ShowLink, URI => $link->BaseURI &><br /> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Parents</&>:</td> + <td class="value"> +% while (my $link = $Object->MemberOf->Next) { + <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> + <& ShowLink, URI => $link->TargetURI &><br /> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Children</&>:</td> + <td class="value"> +% while (my $link = $Object->Members->Next) { + <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" /> + <& ShowLink, URI => $link->BaseURI &><br /> +% } + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Refers to</&>:</td> + <td class="value"> +% while (my $link = $Object->RefersTo->Next) { + <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" /> + <& ShowLink, URI => $link->TargetURI &><br /> +%} + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Referred to by</&>:</td> + <td class="value"> +% while (my $link = $Object->ReferredToBy->Next) { +% # Skip reminders +% next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket') && $link->BaseObj->Type eq 'reminder'); + <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" /> + <& ShowLink, URI => $link->BaseURI &><br /> +% } + </td> + </tr> + <tr> + <td></td> + <td><i><&|/l&>(Check box to delete)</&></i></td> + </tr> +</table> + +</td> +<td valign="top"> +<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.</&> +% $m->callback( CallbackName => 'ExtraLinkInstructions' ); +</i><br /> +% } elsif (ref($Object) eq 'RT::Queue') { +<i><&|/l&>Enter queues or URIs to link queues to. Separate multiple entries with spaces.</&> +</i><br /> +% } else { +<i><&|/l&>Enter objects or URIs to link objects to. Separate multiple entries with spaces.</&></i><br /> +% } +<table> +% if ($Merge) { + <tr> + <td class="label"><&|/l&>Merge into</&>:</td> + <td class="entry"><input name="<%$id%>-MergeInto" /> <i><&|/l&>(only one ticket)</&></i></td> + </tr> +% } + <tr> + <td class="label"><&|/l&>Depends on</&>:</td> + <td class="entry"><input name="<%$id%>-DependsOn" /></td> + </tr> + <tr> + <td class="label"><&|/l&>Depended on by</&>:</td> + <td class="entry"><input name="DependsOn-<%$id%>" /></td> + </tr> + <tr> + <td class="label"><&|/l&>Parents</&>:</td> + <td class="entry"><input name="<%$id%>-MemberOf" /></td> + </tr> + <tr> + <td class="label"><&|/l&>Children</&>:</td> + <td class="entry"> <input name="MemberOf-<%$id%>" /></td> + </tr> + <tr> + <td class="label"><&|/l&>Refers to</&>:</td> + <td class="entry"><input name="<%$id%>-RefersTo" /></td> + </tr> + <tr> + <td class="label"><&|/l&>Referred to by</&>:</td> + <td class="entry"> <input name="RefersTo-<%$id%>" /></td> + </tr> +% $m->callback( CallbackName => 'NewLink' ); +</table> +</td> +</tr> +</table> + +<%INIT> +my $id; +if ($Object && $Object->Id) { + $id = $Object->Id; +} else { + $id = 'new'; +} +</%INIT> + +<%ARGS> +$Object => undef +$Merge => 0 +</%ARGS> diff --git a/rt/share/html/Elements/EditTimeValue b/rt/share/html/Elements/EditTimeValue new file mode 100644 index 000000000..863f8bfec --- /dev/null +++ b/rt/share/html/Elements/EditTimeValue @@ -0,0 +1,65 @@ +%# 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 }}} +<input name="<% $ValueName %>" value="<% $Default || '' %>" size="5" /> +<& /Elements/SelectTimeUnits, Name => $UnitName &> +<%ARGS> +$Default => '' +$Name => '' +$ValueName => '' +$UnitName => '' +$InputUnits => 'minutes' +</%ARGS> +<%INIT> +$ValueName ||= $Name; +$UnitName ||= ($Name||$ValueName) . '-TimeUnits'; + +if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours')) { + $Default = sprintf '%.3g', $Default / 60 + unless $Default eq ''; +} +</%INIT> diff --git a/rt/share/html/Elements/EmailInput b/rt/share/html/Elements/EmailInput new file mode 100644 index 000000000..5c7f27772 --- /dev/null +++ b/rt/share/html/Elements/EmailInput @@ -0,0 +1,53 @@ +%# 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 }}} +<input name="<% $Name %>" size="<% $Size %>" value="<% $Default || '' %>" /> +<%ARGS> +$Name +$Size => 40 +$Default => '' +</%ARGS> diff --git a/rt/share/html/Elements/Error b/rt/share/html/Elements/Error new file mode 100755 index 000000000..604d29be4 --- /dev/null +++ b/rt/share/html/Elements/Error @@ -0,0 +1,90 @@ +%# 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 }}} +% $m->callback( %ARGS, error => $error ); + +% unless ($SuppressHeader) { +<& /Elements/Header, Code => $Code, Why => $Why, Title => $Title &> +<& /Elements/Tabs, Title => $Title &> +% } + +<div class="error"> +<%$Why%> +<br /> +<%$Details%> +</div> + +<%cleanup> +$m->comp('/Elements/Footer'); +$m->abort(); +</%cleanup> + +<%args> +$Code => undef +$Details => '' +$Title => loc("RT Error") +$Why => loc("the calling component did not specify why"), +$SuppressHeader => 0, +</%args> + +<%INIT> +my $error = "WebRT: $Why"; +$error .= " ($Details)" if defined $Details && length $Details; + +# TODO: Log::Dispatch isn't UTF-8 safe. Autrijus needs to talk to dave rolsky about getting this fixed +use Encode (); +Encode::_utf8_off($error); + +$RT::Logger->error($error); + +if ( defined $session{'SessionType'} && $session{'SessionType'} eq 'REST' ) { + $r->content_type('text/plain'); + $m->out( "Error: " . $Why . "\n" ); + $m->out( $Details . "\n" ) if defined $Details && length $Details; + $m->abort(); +} +</%INIT> diff --git a/rt/share/html/Elements/Footer b/rt/share/html/Elements/Footer new file mode 100755 index 000000000..2fcdee949 --- /dev/null +++ b/rt/share/html/Elements/Footer @@ -0,0 +1,84 @@ +%# 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 }}} +%# End of div#body from /Elements/PageLayout +</div> +% $m->callback( %ARGS ); +<div id="footer"> +% if ($m->{'rt_base_time'}) { + <p id="time"> + <span><&|/l&>Time to display</&>: <%Time::HiRes::tv_interval( $m->{'rt_base_time'} )%></span> + </p> +%} + <p id="bpscredits"> + <span> +<&|/l, '»|«', $RT::VERSION, '2009', '<a href="http://www.bestpractical.com?rt='.$RT::VERSION.'">Best Practical Solutions, LLC</a>', &>[_1] RT [_2] Copyright 1996-[_3] [_4].</&> +</span> +</p> +% if (!$Menu) { + <p id="legal"> +<&|/l&>Distributed under version 2 <a href="http://www.gnu.org/copyleft/gpl.html"> of the GNU GPL.</a></&><br /> +<&|/l, '<a href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>' &>To inquire about support, training, custom development or licensing, please contact [_1].</&><br /> + </p> +% } + +</div> +% if ($Debug >= 2 ) { +% require Data::Dumper; +% my $d = Data::Dumper->new([\%ARGS], [qw(%ARGS)]); +<pre> +<%$d->Dump() %> +</pre> +% } + + </body> +</html> + +<%ARGS> +$Debug => 0 +$Menu => 1 +</%ARGS> diff --git a/rt/share/html/Elements/GnuPG/KeyIssues b/rt/share/html/Elements/GnuPG/KeyIssues new file mode 100644 index 000000000..48a7fd21e --- /dev/null +++ b/rt/share/html/Elements/GnuPG/KeyIssues @@ -0,0 +1,92 @@ +%# 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 }}} +% if ( @$Issues || @$SignAddresses ) { +<&| /Widgets/TitleBox, title => loc('GnuPG issues') &> + +% if ( @$SignAddresses ) { +<% loc("The system is unable to sign outgoing email messages. This usually indicates that the passphrase was mis-set, or that GPG Agent is down. Please alert your system administrator immediately. The problem addresses are:") %> +<ul> +% for my $address (@$SignAddresses) { + <li><% $address %></li> +% } +</ul> +% } + +% if (@$Issues == 1) { +<% loc("You are going to encrypt outgoing email messages, but there is a problem with a recipient's public key. You have to fix the problem with the key, disable sending a message to that recipient, or disable encryption.") %> +% } elsif (@$Issues > 1) { +<% loc("You are going to encrypt outgoing email messages, but there are problems with recipients' public keys. You have to fix the problems with the keys, disable sending a message to the recipients with key problems, or disable encryption.") %> +% } + +<ul> +% foreach my $issue ( @$Issues ) { +<li> +% if ( $issue->{'User'} ) { +User <a href="<% RT->Config->Get('WebPath') %>/Admin/Users/Modify.html?id=<% $issue->{'User'}->id %>"><&/Elements/ShowUser, User => $issue->{'User'} &></a> has a problem. +% } else { +There is a problem with key(s) for address <% $issue->{'EmailAddress'} %>, but there is no user in the DB for this address. +% } +<% $issue->{'Message'} %> +<br /> +Select a key you want to use for encryption: +<& /Elements/GnuPG/SelectKeyForEncryption, + Name => 'UseKey-'. $issue->{'EmailAddress'}, + EmailAddress => $issue->{'EmailAddress'}, + Default => ( $issue->{'User'}? $issue->{'User'}->PreferredKey : undef ), +&> +</li> +% } +</ul> +</&> +% } + +<%ARGS> +$Issues => [] +$SignAddresses => [] +</%ARGS> + diff --git a/rt/share/html/Elements/GnuPG/SelectKeyForEncryption b/rt/share/html/Elements/GnuPG/SelectKeyForEncryption new file mode 100644 index 000000000..c28c5ad3f --- /dev/null +++ b/rt/share/html/Elements/GnuPG/SelectKeyForEncryption @@ -0,0 +1,81 @@ +%# 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 }}} +% if (!@keys) { +<% loc("No usable keys.") %> +% } else { +<select name="<% $Name %>"> +% foreach my $key (@keys) { +<option value="<% $key->{'Fingerprint'} %>"><% $key->{'Fingerprint'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option> +% } +</select> +% } + +<%INIT> +require RT::Crypt::GnuPG; +my $d; + +my %res = RT::Crypt::GnuPG::GetKeysForEncryption($EmailAddress); +# move the preferred key to the top of the list +my @keys = map { + $_->{'Fingerprint'} eq ( $Default || '' ) + ? do { $d = $_; () } + : $_ + } + @{ $res{'info'} }; + +@keys = sort { $b->{'TrustLevel'} <=> $a->{'TrustLevel'} } @keys; + +unshift @keys, $d if defined $d; + +</%INIT> +<%ARGS> +$Name => 'PreferredKey' +$EmailAddress => undef +$Default => undef +</%ARGS> + diff --git a/rt/share/html/Elements/GnuPG/SelectKeyForSigning b/rt/share/html/Elements/GnuPG/SelectKeyForSigning new file mode 100644 index 000000000..13b40df26 --- /dev/null +++ b/rt/share/html/Elements/GnuPG/SelectKeyForSigning @@ -0,0 +1,64 @@ +%# 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 }}} +% if ( $user_key ) { +<select name="<% $Name %>"> +<option value=""><% loc("Queue's key") %></option> +<option value="<% $user_key %>"><% $user_key %></option> +</select> +% } else { +<% loc("Queue's key") %> +% } +<%ARGS> +$Name => 'SignUsing', +$User => undef, +</%ARGS> +<%INIT> +return unless RT->Config->Get('GnuPG')->{'Enable'}; + +my $user_key = $User->PrivateKey; +</%INIT> diff --git a/rt/share/html/Elements/GnuPG/SignEncryptWidget b/rt/share/html/Elements/GnuPG/SignEncryptWidget new file mode 100644 index 000000000..9303fb52a --- /dev/null +++ b/rt/share/html/Elements/GnuPG/SignEncryptWidget @@ -0,0 +1,184 @@ +%# 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 }}} +<table> +<td><% loc('Sign')%></td> +<td><& /Widgets/Form/Boolean:InputOnly, Name => 'Sign', CurrentValue => $self->{'Sign'} &> +using <& SelectKeyForSigning, User => $session{'CurrentUser'}->UserObj &> +</td> +<td><% loc('Encrypt')%></td> +<td><& /Widgets/Form/Boolean:InputOnly, Name => 'Encrypt', CurrentValue => $self->{'Encrypt'} &></td> +</table> +<%ARGS> +$self => undef, +</%ARGS> +<%INIT> +return unless $self; +</%INIT> + +<%METHOD new> +<%ARGS> +$Arguments => {} +</%ARGS> +<%INIT> +return undef unless RT->Config->Get('GnuPG')->{'Enable'}; + +require RT::Crypt::GnuPG; +return { %$Arguments }; +</%INIT> +</%METHOD> + +<%METHOD ShowIssues> +<%ARGS> +$self => undef, +</%ARGS> +<%INIT> +return unless $self; + +return $m->comp( '/Elements/GnuPG/KeyIssues', + Issues => $self->{'GnuPGRecipientsKeyIssues'} || [], + SignAddresses => $self->{'GnuPGCanNotSignAs'} || [], +); +</%INIT> +</%METHOD> + + +<%METHOD Process> +<%ARGS> +$self => undef +$QueueObj => undef +$TicketObj => undef +</%ARGS> +<%INIT> +return unless $self; + +$QueueObj ||= $TicketObj->QueueObj if $TicketObj; + +foreach ( qw(Sign Encrypt) ) { + $self->{ $_ } = $m->comp( '/Widgets/Form/Boolean:Process', + Name => $_, + DefaultValue => $QueueObj->$_, + Arguments => $self, + ); +} +</%INIT> +</%METHOD> + +<%METHOD Check> +<%ARGS> +$self => undef +$Operation => 'Update' +$TicketObj => undef +$QueueObj => undef +</%ARGS> +<%INIT> +return 1 unless $self; + +my $checks_failure = 0; + +if ( $self->{'Sign'} ) { + $QueueObj ||= $TicketObj->QueueObj + if $TicketObj; + + my $address = $self->{'SignUsing'}; + $address ||= ($self->{'UpdateType'} && $self->{'UpdateType'} eq "private") + ? ( $QueueObj->CommentAddress || RT->Config->Get('CommentAddress') ) + : ( $QueueObj->CorrespondAddress || RT->Config->Get('CorrespondAddress') ); + + unless ( RT::Crypt::GnuPG::DrySign( $address ) ) { + push @{ $self->{'GnuPGCanNotSignAs'} ||= [] }, $address; + $checks_failure = 1; + } else { + RT::Crypt::GnuPG::UseKeyForSigning( $self->{'SignUsing'} ) + if $self->{'SignUsing'}; + } +} + +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 + ); + } + elsif ( $Operation eq 'Create' ) { + @recipients = $m->comp( + '/Ticket/Elements/PreviewScrips:GetRecipientsOnCreate', + %$self, + ); + } + else { + $RT::Logger->crit('Incorrect operation: '. $Operation ); + } + + my %seen; + @recipients = grep !$seen{ lc $_ }++, @recipients; + + RT::Crypt::GnuPG::UseKeyForEncryption( + map { (/^UseKey-(.*)$/)[0] => $self->{ $_ } } + grep $self->{ $_ } && /^UseKey-/, + keys %$self + ); + + my ($status, @issues) = RT::Crypt::GnuPG::CheckRecipients( @recipients ); + push @{ $self->{'GnuPGRecipientsKeyIssues'} ||= [] }, @issues; + $checks_failure = 1 unless $status; +} + +return $checks_failure ? 0 : 1; +</%INIT> +</%METHOD> diff --git a/rt/share/html/Elements/GotoTicket b/rt/share/html/Elements/GotoTicket new file mode 100755 index 000000000..517bee77c --- /dev/null +++ b/rt/share/html/Elements/GotoTicket @@ -0,0 +1,50 @@ +%# 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 }}} +<form action="<% RT->Config->Get('WebPath') %>/Ticket/Display.html"> +<input type="submit" class="button" value="<&|/l&>Goto ticket</&>" /> <input size="5" name="id" accesskey="0" /> +</form> diff --git a/rt/share/html/Elements/Header b/rt/share/html/Elements/Header new file mode 100755 index 000000000..953efcb22 --- /dev/null +++ b/rt/share/html/Elements/Header @@ -0,0 +1,118 @@ +%# 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 }}} +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> +<title><%$Title%></title> + + +% if ($Refresh && $Refresh =~ /^(\d+)/ && $1 > 0) { + <meta http-equiv="refresh" content="<% $Refresh %>" /> +% } + +<link rel="shortcut icon" href="<%RT->Config->Get('WebImagesURL')%>/favicon.png" type="image/png" /> +<link rel="stylesheet" href="<%RT->Config->Get('WebPath')%>/NoAuth/css/<% RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} ) %>/main<% RT->Config->Get('DevelMode')? '' : '-squished' %>.css" type="text/css" media="all" /> +<link rel="stylesheet" href="<%RT->Config->Get('WebPath')%>/NoAuth/css/print.css" type="text/css" media="print" /> + +% for (keys %{$LinkRel || {}}) { + <link rel="<% $_ %>" href="<% RT->Config->Get('WebPath') . $LinkRel->{$_} %>" /> +% } + +% if ( $RSSAutoDiscovery ) { + <link rel="alternate" href="<%$RSSAutoDiscovery%>" type="application/rss+xml" title="RSS RT Search" /> +% } + +% if ($JavaScript) { +<& HeaderJavascript, focus => $Focus, onload => $onload &> +% } + +% my $stylesheet_plugin = "/NoAuth/css/". RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} )."/InHeader"; +% if ($m->comp_exists($stylesheet_plugin) ) { +<& $stylesheet_plugin &> +% } +% $m->callback( %ARGS, CallbackName => 'Head' ); + +</head> + <body<% $id && qq[ id="comp-$id"] |n %>> + +% if ($ShowBar) { +<& /Elements/Logo, %ARGS &> + +<div id="quickbar"> + <& /Elements/PersonalQuickbar, %ARGS &> +% } + +<%INIT> +$r->headers_out->{'Pragma'} = 'no-cache'; +$r->headers_out->{'Cache-control'} = 'no-cache'; + +my $id = $m->request_comp->path; +$id =~ s|^/||g; +$id =~ s|/|-|g; +$id =~ s|\.html$||g; +$id =~ s|index$||g + if $id ne 'index'; +$id =~ s|-$||g; +</%INIT> + +<%ARGS> +#$Focus => 'focus' +$Focus => '' +$Title => 'RT' +$Code => undef +$Refresh => 0 +$Why => undef +$ShowBar => 1 +$URL => undef +$RSSAutoDiscovery => undef +$onload => undef +$LinkRel => undef +$JavaScript => 1 +</%ARGS> diff --git a/rt/share/html/Elements/HeaderJavascript b/rt/share/html/Elements/HeaderJavascript new file mode 100644 index 000000000..6ee88a13b --- /dev/null +++ b/rt/share/html/Elements/HeaderJavascript @@ -0,0 +1,122 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$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> +% } +<script type="text/javascript"><!-- + doOnLoad(loadTitleBoxStates); +% if ( $focus ) { + doOnLoad(function () { focusElementById('<% $focus %>') }); +% } + +% if ( $onload ) { + doOnLoad(<% $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('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 />" + ); +% } + +%# 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); + + var oFCKeditor = new FCKeditor( textArea.name, '100%', <% RT->Config->Get('MessageBoxRichTextHeight') %> ); + oFCKeditor.BasePath = "<%RT->Config->Get('WebPath')%>/NoAuth/RichText/"; + oFCKeditor.ReplaceTextarea(); + } + } + } + doOnLoad(ReplaceAllTextareas); +% } +--></script> diff --git a/rt/share/html/Elements/ListActions b/rt/share/html/Elements/ListActions new file mode 100755 index 000000000..86773aeb7 --- /dev/null +++ b/rt/share/html/Elements/ListActions @@ -0,0 +1,94 @@ +%# 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 }}} +<div class="results"> +<&| /Widgets/TitleBox, title => loc('Results') &> + <ul class="action-results"> +% foreach my $action (@actions) { + <li><%$action%></li> +% } + </ul> +</&> +</div> +<%init> + +# backward compatibility, don't use array in new code, but use keyed hash +if ( ref( $session{'Actions'} ) eq 'ARRAY' ) { + unshift @actions, @{ delete $session{'Actions'} }; +} + +if ( ref( $session{'Actions'}{''} ) eq 'ARRAY' ) { + unshift @actions, @{ delete $session{'Actions'}{''} }; +} + +my $actions_pointer = $m->request_args->{'results'}; + +if ($actions_pointer && ref( $session{'Actions'}->{$actions_pointer} ) eq 'ARRAY' ) { + unshift @actions, @{ delete $session{'Actions'}->{$actions_pointer} }; +} + +# XXX: run callbacks per row really crazy idea +@actions = + grep $_, + grep { + my $skip; + $m->callback( + %ARGS, + row => \$_, + skip => \$skip, + CallbackName => 'ModifyRow', + ); + !$skip; + } + grep $_, @actions; + +return unless @actions; + +</%init> +<%ARGS> +@actions => undef +</%ARGS> diff --git a/rt/share/html/Elements/ListMenu b/rt/share/html/Elements/ListMenu new file mode 100644 index 000000000..63d4a1e86 --- /dev/null +++ b/rt/share/html/Elements/ListMenu @@ -0,0 +1,58 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$items +</%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> + +</li> +%} +</ul> diff --git a/rt/share/html/Elements/Login b/rt/share/html/Elements/Login new file mode 100755 index 000000000..8dfbe51d1 --- /dev/null +++ b/rt/share/html/Elements/Login @@ -0,0 +1,139 @@ +%# 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 }}} +<%INIT> +if ($m->request_comp->path =~ '^/REST/\d+\.\d+/') { + $r->content_type("text/plain"); + $m->error_format("text"); + $m->out("RT/$RT::VERSION 401 Credentials required\n"); + $m->out("\n$Error\n") if $Error; + $m->abort; +} + +my $req_uri; + +if (UNIVERSAL::can($r, 'uri') and $r->uri =~ m{.*/(.*)}) { + $req_uri = $1; +} + +my $form_action = defined $goto ? $goto + : defined $req_uri ? $req_uri + : RT->Config->Get('WebPath') + ; +</%INIT> + +% $m->callback( %ARGS, CallbackName => 'Header' ); +<& /Elements/Header, Title => loc('Login'), Focus => 'user' &> + + +%# End of div#quickbar from /Elements/Header +</div> + +<div id="body" class="login-body"> +% if ($Error) { +<&| "/Widgets/TitleBox", title => loc('Error'), hideable => 0, class => 'error' &> +<% $Error %> +</&> +% } + +% $m->callback( %ARGS, CallbackName => 'BeforeForm' ); + +<div id="login-box"> +<&| /Widgets/TitleBox, title => loc('Login'), titleright => $RT::VERSION, hideable => 0 &> + +% unless (RT->Config->Get('WebExternalAuth') and !RT->Config->Get('WebFallbackToInternalAuth')) { +<form id="login" name="login" method="post" action="<% $form_action %>"> + +<div class="input-row"> + <span class="label"><&|/l&>Username</&>:</span> + <span class="input"><input name="user" value="<%$user%>" id="user" /></span> +</div> + +<div class="input-row"> + <span class="label"><&|/l&>Password</&>:</span> + <span class="input"><input type="password" name="pass" autocomplete="off" /></span> +</div> + +<div class="button-row"> + <span class="input"><input type="submit" class="button" value="<&|/l&>Login</&>" /></span> +</div> + +%# Give callbacks a chance to add more control elements +% $m->callback( %ARGS ); + +% # From mason 1.0.1 forward, this doesn't work. in fact, it breaks things. +% # But on Mason 1.15 it's fixed again, so we still use it. +% # The code below iterates through everything in the passed in arguments +% # Preserving all the old parameters +% # This would be easier, except mason is 'smart' and calls multiple values +% # arrays rather than multiple hash keys +% my $key; my $val; +% foreach $key (keys %ARGS) { +% if (($key ne 'user') and ($key ne 'pass')) { +% if (ref($ARGS{$key}) =~ /ARRAY/) { +% foreach $val (@{$ARGS{$key}}) { +<input type="hidden" class="hidden" name="<%$key %>" value="<% $val %>" /> +% } +% } +% else { +<input type="hidden" class="hidden" name="<% $key %>" value="<% $ARGS{$key} %>" /> +% } +% } +% } +</form> +% } +</&> +</div><!-- #login-box --> +% $m->callback( %ARGS, CallbackName => 'AfterForm' ); +</div><!-- #login-body --> +<& /Elements/Footer, Menu => 0 &> +<%ARGS> +$user => "" +$pass => undef +$goto => undef +$Error => undef +</%ARGS> diff --git a/rt/share/html/Elements/Logo b/rt/share/html/Elements/Logo new file mode 100644 index 000000000..359738b5e --- /dev/null +++ b/rt/share/html/Elements/Logo @@ -0,0 +1,66 @@ +%# 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 }}} +<div id="logo"> +<a href="http://bestpractical.com"><img + src="<%$ARGS{'LogoURL'}||RT->Config->Get('LogoURL')%>" + alt="<% loc("Best Practical Solutions, LLC corporate logo") %>" + width="177" height="33" /></a> +% if ( $ShowName ) { + <span class="rtname"><% $Name || loc("RT for [_1]", RT->Config->Get('rtname')) %></span> +% } +</div> +<%INIT> +if ( exists $ARGS{'show_name'} ) { + $RT::Logger->warning('show_name argument was renamed, use ShowName'); + $ShowName = delete $ARGS{'show_name'}; +} +</%INIT> +<%ARGS> +$ShowName => 1 +$Name => undef +</%ARGS> diff --git a/rt/share/html/Elements/Logout b/rt/share/html/Elements/Logout new file mode 100644 index 000000000..34ed1a317 --- /dev/null +++ b/rt/share/html/Elements/Logout @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} + | <a href="<% RT->Config->Get('WebPath') %>/NoAuth/Logout.html<% $URL ? "?URL=". $URL : '' %>"><&|/l&>Logout</&></a> +<%ARGS> +$URL => undef +</%ARGS> +<%INIT> +my $show = 0; +if ( $session{'CurrentUser'}->Name + && ( !RT->Config->Get('WebExternalAuth') + || RT->Config->Get('WebFallbackToInternalAuth') + ) +) { + $show = 1; +} + +$m->callback( %ARGS, URL => \$URL, show => \$show ); + +return unless $show; +</%INIT> diff --git a/rt/share/html/Elements/MakeClicky b/rt/share/html/Elements/MakeClicky new file mode 100644 index 000000000..f0aaf0696 --- /dev/null +++ b/rt/share/html/Elements/MakeClicky @@ -0,0 +1,207 @@ +%# 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 }}} +<%ONCE> +use Regexp::Common qw(URI); + +my %actions = ( + default => sub { + my %args = @_; + return $args{value}; + }, + url => sub { + my %args = @_; + my $result = qq{[<a target="new" href="$args{value}">}. loc('Open URL') .qq{</a>]}; + return $args{value} . qq{ <span class="clickylink">$result</span>}; + }, + 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>}; + }, +); + +my @types = ( + { + name => "httpurl", + regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}/, + action => "url", + }, + { + name => "httpurl_overwrite", + regex => qr/$RE{URI}{HTTP}{-keep}{-scheme => 'https?'}/, + action => "url_overwrite", + }, +); + +my $handle = sub { + my %args = @_; + for my $rec( @types ) { + return $rec->{action}->( + %args, + all_matches => [ $args{value}, $1, $2, $3, $4, $5, $6, $7, $8, $9 ], + ) if $args{value} =~ $rec->{regex}; + } +}; + +my $escaper = sub { + my $content = shift; + RT::Interface::Web::EscapeUTF8( \$content ); + return $content; +}; + +# Hook to add more Clicky types +# XXX Have to have Page argument, as Mason gets caller wrong in Callback? +# This happens as we are in <%ONCE> block +$m->callback( + CallbackPage => "/Elements/MakeClicky", + types => \@types, + actions => \%actions, + handle => \$handle, +); + + +# Filter +my %active; +$active{$_}++ for RT->Config->Get('Active_MakeClicky'); +@types = grep $active{$_->{name}}, @types; + +# Build up the whole match +my $regexp = join "|", map $_->{regex}, @types; + +# Make sure we have a default +$actions{default} ||= sub {}; + +# Anchor the regexes and look up the actions +foreach my $type ( @types ) { + $type->{regex} = qr/^$type->{regex}$/; + $type->{action} = $actions{$type->{action}} || $actions{default}; +} + +</%ONCE> +<%ARGS> +$content => undef +$html => undef +</%ARGS> +<%INIT> +return unless defined $$content; +unless ( $regexp ) { + RT::Interface::Web::EscapeUTF8( $content ) unless $html; + return; +} + +my $pos = 0; +while ( $$content =~ /($regexp)/gsio ) { + my $match = $1; + next if $` =~ /href=(?:"|")$/; + my $skipped_len = pos($$content) - $pos - length($match); + if ( $skipped_len > 0 ) { + my $plain; + if ( $html ) { + $plain = substr( $$content, $pos, $skipped_len ); + } + else { + $plain = $escaper->( substr( $$content, $pos, $skipped_len ) ) + } + substr( $$content, $pos, $skipped_len ) = $plain; + $pos += length($plain); + } + my $plain = $handle->( + %ARGS, + value => $match, + all_matches => [ $1, $2, $3, $4, $5, $6, $7, $8, $9 ], + ); + substr( $$content, $pos, length($match) ) = $plain; + pos($$content) = ( $pos += length($plain) ); + +} +substr( $$content, $pos ) = $escaper->( substr( $$content, $pos ) ) unless +($pos == length $$content) || $html; + +pos($$content) = 0; + +</%INIT> +<%doc> + +MakeClicky detects various formats of data in headers and email +messages, and extends them with supporting links. By default, RT +provides two formats: + + * 'httpurl': detects http:// and https:// URLs and adds '[Open URL]' + link after the URL. + + * 'httpurl_overwrite': also detects URLs as 'httpurl' format, but + replace URL with link and *adds spaces* into text if it's longer + then 30 chars. This allow browser to wrap long URLs and avoid + horizontal scrolling. + +To extend this with your own types of data, use the callback. +It will be provided with: + + * 'types': An array reference of hash references. Modify this array + reference to add your own types; the first matching type will be + used. Each hashref should contain: + - 'name': The name of the data format; this is used in the + configuration file to enable the format. + - 'regex': A regular expression to match against + - 'action': The name of the action to run (see "actions", below) + + * 'actions': A hash reference of 'actions'. Modify this hash + reference to change or add action types. Values are subroutine + references which will get called when needed. They should return + the modified string. Note that subroutine must escape HTML. + + * 'handler': A reference to a subroutine reference; modify it if you + have to. This can be used to add pre- or post-processing around + all actions. + +Read more about writing new actions in docs/extending_clickable_links.pod + +</%doc> diff --git a/rt/share/html/Elements/Menu b/rt/share/html/Elements/Menu new file mode 100755 index 000000000..83644da11 --- /dev/null +++ b/rt/share/html/Elements/Menu @@ -0,0 +1,139 @@ +%# 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 }}} +<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; +% } +</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> + +<%ARGS> +$toptabs => {} +$current_toptab => '' +$level => 0 +$last_level => 0 +</%ARGS> diff --git a/rt/share/html/Elements/MessageBox b/rt/share/html/Elements/MessageBox new file mode 100755 index 000000000..4985b23e3 --- /dev/null +++ b/rt/share/html/Elements/MessageBox @@ -0,0 +1,82 @@ +%# 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 }}} +<textarea class="messagebox" cols="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\ +% $m->callback( %ARGS ); +<% $Default || '' %><% $message %><% $signature %></textarea> +% $m->callback( %ARGS, CallbackName => 'AfterTextArea' ); +<%INIT> + +my $message = ''; + +if ( $QuoteTransaction ) { + my $transaction = RT::Transaction->new( $session{'CurrentUser'} ); + $transaction->Load( $QuoteTransaction ); + $message = $transaction->Content( Quote => 1 ); +} + +my $signature = ''; +if ( $IncludeSignature and my $text = $session{'CurrentUser'}->UserObj->Signature ) { + $signature = "-- \n". $text; +} + +# wrap="something" seems to really break IE + richtext +my $wrap_type = ''; +if ( not RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ) { + $wrap_type = qq(wrap="$Wrap"); +} + +</%INIT> +<%ARGS> +$QuoteTransaction => undef +$Name => 'Content' +$Default => '' +$Width => RT->Config->Get('MessageBoxWidth', $session{'CurrentUser'} ) || 72 +$Height => RT->Config->Get('MessageBoxHeight', $session{'CurrentUser'} ) || 15 +$Wrap => RT->Config->Get('MessageBoxWrap') || 'HARD' +$IncludeSignature => RT->Config->Get('MessageBoxIncludeSignature'); +</%ARGS> diff --git a/rt/share/html/Elements/MyAdminQueues b/rt/share/html/Elements/MyAdminQueues new file mode 100644 index 000000000..e7d2b2ac7 --- /dev/null +++ b/rt/share/html/Elements/MyAdminQueues @@ -0,0 +1,54 @@ +%# 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 }}} +<&|/Widgets/TitleBox, title => loc("Queues I administer"), bodyclass => "" &> +<& /Elements/QueueSummary, + cache => 'my_admin_queues', + 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 new file mode 100644 index 000000000..7b719fd42 --- /dev/null +++ b/rt/share/html/Elements/MyRT @@ -0,0 +1,106 @@ +%# 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 }}} +% $m->callback( ARGSRef => \%ARGS, CallbackName => 'BeforeTable' ); +<table class="myrt"> +<tr valign="top"> + +<td class="boxcontainer"> +% $show_cb->($_) foreach @$body; +</td> + +% if ( $summary ) { +<td class="boxcontainer"> +% $show_cb->($_) foreach @$summary; +</td> +% } + +</tr></table> +% $m->callback( ARGSRef => \%ARGS, CallbackName => 'AfterTable' ); +<%INIT> + +# XXX: we don't use this, but should. +my %allowed_components = map {$_ => 1} @{RT->Config->Get('HomepageComponents')}; + +my $user = $session{'CurrentUser'}->UserObj; +$Portlets ||= $session{'my_rt_portlets'}; +unless ( $Portlets ) { + my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings'); + $Portlets = $session{'my_rt_portlets'} = $user->Preferences( + HomepageSettings => $default_portlets? $default_portlets->Content: {}, + ); +} + +my ($body, $summary) = @{$Portlets}{qw(body summary)}; +unless( $body && @$body ) { + $body = $summary || []; + $summary = undef; +} +$summary = undef unless $summary && @$summary; + +my $Rows = $user->Preferences( 'SummaryRows', ( RT->Config->Get('DefaultSummaryRows') || 10 ) ); + +my $show_cb = sub { + my $entry = shift; + my $type = $entry->{type}; + my $name = $entry->{'name'}; + if ( $type eq 'component' ) { + # XXX: security check etc. + $m->comp( $name, %{ $entry->{arguments} || {} } ); + } elsif ( $type eq 'system' ) { + $m->comp( '/Elements/ShowSearch', Name => $name, Override => { Rows => $Rows } ); + } elsif ( $type eq 'saved' ) { + $m->comp( '/Elements/ShowSearch', SavedSearch => $name, Override => { Rows => $Rows }, IgnoreMissing => 1 ); + } else { + $RT::Logger->error("unknown portlet type '$type'"); + } +}; + +</%INIT> +<%ARGS> +$Portlets => undef +</%ARGS> diff --git a/rt/share/html/Elements/MyReminders b/rt/share/html/Elements/MyReminders new file mode 100755 index 000000000..25fdf5d48 --- /dev/null +++ b/rt/share/html/Elements/MyReminders @@ -0,0 +1,74 @@ +%# 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 }}} +%# DEPRECATED +<&|/Widgets/TitleBox, + 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; +<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 /> +<%$reminder->OwnerObj->Name %> <%$reminder->DueObj->Unix >0 ? '• '.$reminder->DueObj->AgeAsString : '' |n %> +</blockquote> +</td> +</tr> +% }} +</table> +</&> + +<%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 new file mode 100755 index 000000000..c08560db8 --- /dev/null +++ b/rt/share/html/Elements/MyRequests @@ -0,0 +1,49 @@ +%# 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 }}} +%# DEPRECATED +<& /Elements/ShowSearch, Name => 'My Requests' &> diff --git a/rt/share/html/Elements/MySupportQueues b/rt/share/html/Elements/MySupportQueues new file mode 100644 index 000000000..e59c62384 --- /dev/null +++ b/rt/share/html/Elements/MySupportQueues @@ -0,0 +1,60 @@ +%# 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 }}} +<&|/Widgets/TitleBox, title => loc("Queues I'm an AdminCc for"), bodyclass => "" &> +<& /Elements/QueueSummary, + cache => 'my_support_queues', + 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 new file mode 100755 index 000000000..354a9642e --- /dev/null +++ b/rt/share/html/Elements/MyTickets @@ -0,0 +1,49 @@ +%# 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 }}} +%# DEPRECATED +<& /Elements/ShowSearch, Name => 'My Tickets' &> diff --git a/rt/share/html/Elements/PageLayout b/rt/share/html/Elements/PageLayout new file mode 100755 index 000000000..981e58a3c --- /dev/null +++ b/rt/share/html/Elements/PageLayout @@ -0,0 +1,251 @@ +%# 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 }}} +<div id="topactions"> +% foreach my $action (reverse sort keys %{$topactions}) { +<span class="topaction" id="topaction-<%$action%>"><% $topactions->{"$action"}->{'html'} |n %></span> +% } +</div> + +%# End of div#quickbar from /Elements/Header +</div> + +% if ( $show_menu ) { +<div id="nav"> +<& /Elements/Menu, toptabs => $toptabs, current_toptab => $current_toptab &> +</div> +% } + +<div id="header"> +<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; +% } +% } +% } + </div></div></div> + </ul> +% } +</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); + +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 new file mode 100644 index 000000000..5d6497ce1 --- /dev/null +++ b/rt/share/html/Elements/PersonalQuickbar @@ -0,0 +1,16 @@ +<%ARGS> +$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.</&> +% } +% $m->callback( %ARGS ); +<& Logout, %ARGS &> +</div> diff --git a/rt/share/html/Elements/QueryString b/rt/share/html/Elements/QueryString new file mode 100644 index 000000000..e55454cd9 --- /dev/null +++ b/rt/share/html/Elements/QueryString @@ -0,0 +1,64 @@ +%# 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 }}} +<%INIT> +my @params; +for my $key (sort keys %ARGS) { + my $value = $ARGS{$key}; + next unless defined $value; + $key = $m->interp->apply_escapes( $key, 'u' ); + if( UNIVERSAL::isa( $value, 'ARRAY' ) ) { + push @params, + map $key ."=". $m->interp->apply_escapes( $_, 'u' ), + @$value; + } else { + push @params, $key ."=". $m->interp->apply_escapes($value, 'u'); + } +} + +return join '&', sort(@params); +</%INIT> diff --git a/rt/share/html/Elements/QueueSummary b/rt/share/html/Elements/QueueSummary new file mode 100644 index 000000000..bbfd65e56 --- /dev/null +++ b/rt/share/html/Elements/QueueSummary @@ -0,0 +1,108 @@ +%# 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 }}} +<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 new file mode 100644 index 000000000..45e2e2f97 --- /dev/null +++ b/rt/share/html/Elements/QuickCreate @@ -0,0 +1,77 @@ +%# 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 }}} +<div class="quick-create"> +<&| /Widgets/TitleBox, title => loc('Quick ticket creation') &> +<form method="post" action="<%RT->Config->Get('WebPath')%>/index.html"> +<input type="hidden" class="hidden" name="QuickCreate" value="1" /> +<table> +<tr class="input-row"><td class="label"><&|/l&>Subject</&>:</td> + <td colspan="3" class="value"><input type="text" size="50" name="Subject" /></td> + </tr><tr class="input-row"> +<td class="label"><&|/l&>Queue</&>:</td><td class="value"><& /Elements/SelectNewTicketQueue, Name => 'Queue' &> +</td> +<td class="label"><&|/l&>Owner</&>:</td><td class="value"> +<select type="select" name="Owner"> +<option value="<%$session{'CurrentUser'}->id%>" selected="selected"><%$session{'CurrentUser'}->Name %></option> +<option value="<%$RT::Nobody->id%>"><%loc('Nobody')%></option> +</select> +</td> +</tr> +<tr class="input-row"> + <td class="label"><&|/l&>Requestors</&>:</td> + <td colspan="3" class="value"><& /Elements/EmailInput, Name => 'Requestors', Size => '40', Default => $ARGS{Requestors} || $session{CurrentUser}->EmailAddress &></td> +</tr> +<tr class="input-row"> +<td class="labeltop"><&|/l&>Content</&>:</td> +<td colspan="3" class="value"><textarea name="Content" cols="50" rows="3"></textarea></td></tr> +</table> +<& /Elements/Submit, Label => loc('Create') &> +</form> +</&> +</div> + diff --git a/rt/share/html/Elements/Quicksearch b/rt/share/html/Elements/Quicksearch new file mode 100755 index 000000000..402a2f23f --- /dev/null +++ b/rt/share/html/Elements/Quicksearch @@ -0,0 +1,65 @@ +%# 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 }}} +<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', + 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($_) }; +} +</%INIT> diff --git a/rt/share/html/Elements/RT__Group/ColumnMap b/rt/share/html/Elements/RT__Group/ColumnMap new file mode 100644 index 000000000..f7dd0f89d --- /dev/null +++ b/rt/share/html/Elements/RT__Group/ColumnMap @@ -0,0 +1,92 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + HasMember => { + title => 'Member', # loc + value => sub { + my $group = $_[0]; + my $uid = $_[2] || return ''; + return $group->HasMember( $uid )? $_[0]->loc('yes'): $_[0]->loc('no'); + }, + }, + HasMemberRecursively => { + title => 'Recursive member', # loc + value => sub { + my $group = $_[0]; + my $uid = $_[2] || return ''; + return $group->HasMemberRecursively( $uid )? $_[0]->loc('yes'): $_[0]->loc('no'); + }, + }, + Name => { + title => 'Name', # loc + attribute => 'Name', + value => sub { return $_[0]->Name() }, + }, + Description => { + title => 'Description', # loc + attribute => 'Description', + value => sub { return $_[0]->Description() }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> diff --git a/rt/share/html/Elements/RT__Queue/ColumnMap b/rt/share/html/Elements/RT__Queue/ColumnMap new file mode 100644 index 000000000..5c56004d1 --- /dev/null +++ b/rt/share/html/Elements/RT__Queue/ColumnMap @@ -0,0 +1,115 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name => undef +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + Disabled => { + title => \' ', + attribute => 'Disabled', + value => sub { return $_[0]->Disabled? $_[0]->loc('Disabled'): $_[0]->loc('Enabled') }, + }, + Priority => { + title => 'Priority', # loc + value => sub { return $_[0]->InitialPriority .'-'. $_[0]->FinalPriority }, + }, + Address => { + title => 'Address', # loc + value => sub { return ($_[0]->CorrespondAddress||'-') .'/'. ($_[0]->CommentAddress||'-') }, + }, + Name => { + title => 'Name', # loc + attribute => 'Name', + value => sub { return $_[0]->Name() }, + }, + Description => { + title => 'Description', # loc + attribute => 'Description', + value => sub { return $_[0]->Description() }, + }, + CorrespondAddress => { + title => 'CorrespondAddress', # loc + attribute => 'CorrespondAddress', + value => sub { return $_[0]->CorrespondAddress() }, + }, + CommentAddress => { + title => 'CommentAddress', # loc + attribute => 'CommentAddress', + value => sub { return $_[0]->CommentAddress() }, + }, + InitialPriority => { + title => 'InitialPriority', # loc + attribute => 'InitialPriority', + value => sub { return $_[0]->InitialPriority() }, + }, + FinalPriority => { + title => 'FinalPriority', # loc + attribute => 'FinalPriority', + value => sub { return $_[0]->FinalPriority() }, + }, + DefaultDueIn => { + title => 'DefaultDueIn', # loc + attribute => 'DefaultDueIn', + value => sub { return $_[0]->DefaultDueIn() }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> + diff --git a/rt/share/html/Elements/RT__Scrip/ColumnMap b/rt/share/html/Elements/RT__Scrip/ColumnMap new file mode 100644 index 000000000..88b4c4bea --- /dev/null +++ b/rt/share/html/Elements/RT__Scrip/ColumnMap @@ -0,0 +1,103 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + Queue => { + title => 'Queue', # loc + value => sub { + return $_[0]->QueueObj->Name if $_[0]->Queue; + return $_[0]->loc('Global'); + }, + }, + Condition => { + title => 'Condition', # loc + value => sub { return $_[0]->loc( $_[0]->ScripConditionObj->Name ) }, + }, + Action => { + title => 'Action', # loc + value => sub { return $_[0]->loc( $_[0]->ScripActionObj->Name ) }, + }, + Template => { + title => 'Template', # loc + value => sub { return $_[0]->loc( $_[0]->TemplateObj->Name ) }, + }, + AutoDescription => { + title => 'Condition, Action and Template', # loc + value => sub { return $_[0]->loc( "[_1] [_2] with template [_3]", + $_[0]->loc($_[0]->ConditionObj->Name), + $_[0]->loc($_[0]->ActionObj->Name), + $_[0]->loc($_[0]->TemplateObj->Name), + ) }, + }, + Description => { + title => 'Description', # loc + attribute => 'Description', + value => sub { return $_[0]->Description() }, + }, + Stage => { + title => 'Stage', # loc + attribute => 'Stage', + value => sub { return $_[0]->Stage() }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> diff --git a/rt/share/html/Elements/RT__Template/ColumnMap b/rt/share/html/Elements/RT__Template/ColumnMap new file mode 100644 index 000000000..851cc9dec --- /dev/null +++ b/rt/share/html/Elements/RT__Template/ColumnMap @@ -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 }}} +<%ARGS> +$Name +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + Name => { + title => 'Name', # loc + attribute => 'Name', + value => sub { return $_[0]->Name() }, + }, + Description => { + title => 'Description', # loc + attribute => 'Description', + value => sub { return $_[0]->Description() }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> diff --git a/rt/share/html/Elements/RT__Ticket/ColumnMap b/rt/share/html/Elements/RT__Ticket/ColumnMap new file mode 100644 index 000000000..7df471009 --- /dev/null +++ b/rt/share/html/Elements/RT__Ticket/ColumnMap @@ -0,0 +1,355 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name => undef +$Attr => undef +</%ARGS> + + +<%ONCE> +my $COLUMN_MAP; + +my $LinkCallback = sub { + my $method = shift; + + my $mode = $RT::Ticket::LINKTYPEMAP{$method}{Mode}; + my $type = $RT::Ticket::LINKTYPEMAP{$method}{Type}; + my $other_mode = ($mode eq "Target" ? "Base" : "Target"); + my $mode_uri = $mode.'URI'; + my $local_type = 'Local'.$mode; + + return sub { + map { + \'<a href="', + $_->$mode_uri->Resolver->HREF, + \'">', + ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ), + \'</a><br />', + } @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef } + } +}; + +$COLUMN_MAP = { + Queue => { + attribute => 'Queue', + title => 'Queue id', # loc + value => sub { return $_[0]->Queue } + }, + QueueName => { + attribute => 'Queue', + title => 'Queue', # loc + value => sub { return $_[0]->QueueObj->Name } + }, + OwnerName => { + title => 'Owner', # loc + attribute => 'Owner', + value => sub { return $_[0]->OwnerObj->Name } + }, + Status => { + title => 'Status', # loc + attribute => 'Status', + value => sub { return loc($_[0]->Status) } + }, + Subject => { + title => 'Subject', # loc + attribute => 'Subject', + value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" } + }, + ExtendedStatus => { + title => 'Status', # loc + attribute => 'Status', + value => sub { + my $Ticket = shift; + + if ( my $count = $Ticket->HasUnresolvedDependencies ) { + if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' ) + or $Ticket->HasUnresolvedDependencies( Type => 'code' ) ) + { + return \'<em>', loc('(pending approval)'), \'</em>'; + } + else { + my $Query = "DependedOnBy = " . $Ticket->id; + $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")"; + + my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query); + + return \'<a href="',$SearchURL,\'">', loc('(pending [quant,_1,other ticket])',$count), \'</a>'; + } + } + else { + return loc( $Ticket->Status ); + } + + } + }, + Priority => { + title => 'Priority', # loc + attribute => 'Priority', + value => sub { return $_[0]->Priority } + }, + InitialPriority => { + title => 'InitialPriority', # loc + attribute => 'InitialPriority', + name => 'Initial Priority', + value => sub { return $_[0]->InitialPriority } + }, + FinalPriority => { + title => 'FinalPriority', # loc + attribute => 'FinalPriority', + name => 'Final Priority', + value => sub { return $_[0]->FinalPriority } + }, + EffectiveId => { + title => 'EffectiveId', # loc + attribute => 'EffectiveId', + value => sub { return $_[0]->EffectiveId } + }, + Type => { + title => 'Type', # loc + attribute => 'Type', + value => sub { return $_[0]->Type } + }, + TimeWorked => { + attribute => 'TimeWorked', + title => 'Time Worked', # loc + value => sub { return $_[0]->TimeWorked } + }, + TimeLeft => { + attribute => 'TimeLeft', + title => 'Time Left', # loc + value => sub { return $_[0]->TimeLeftAsString } + }, + TimeEstimated => { + attribute => 'TimeEstimated', + title => 'Time Estimated', # loc + value => sub { return $_[0]->TimeEstimated } + }, + Requestors => { + title => 'Requestors', # loc + attribute => 'Requestor.EmailAddress', + value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString } + }, + Cc => { + title => 'Cc', # loc + attribute => 'Cc.EmailAddress', + value => sub { return $_[0]->Cc->MemberEmailAddressesAsString } + }, + AdminCc => { + title => 'AdminCc', # loc + attribute => 'AdminCc.EmailAddress', + value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString } + }, + StartsRelative => { + title => 'Starts', # loc + attribute => 'Starts', + value => sub { return $_[0]->StartsObj->AgeAsString } + }, + StartedRelative => { + title => 'Started', # loc + attribute => 'Started', + value => sub { return $_[0]->StartedObj->AgeAsString } + }, + ToldRelative => { + title => 'Told', # loc + attribute => 'Told', + value => sub { return $_[0]->ToldObj->AgeAsString } + }, + DueRelative => { + title => 'Due', # loc + attribute => 'Due', + value => sub { + my $date = $_[0]->DueObj; + # Highlight the date if it was due in the past, and it's still active + if ( $date && $date->Unix > 0 && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) { + return (\'<span class="overdue">' , $date->AgeAsString , \'</span>'); + } else { + return $date->AgeAsString; + } + } + }, + ResolvedRelative => { + title => 'Resolved', # loc + attribute => 'Resolved', + value => sub { return $_[0]->ResolvedObj->AgeAsString } + }, + Starts => { + title => 'Starts', # loc + attribute => 'Starts', + value => sub { return $_[0]->StartsObj->AsString } + }, + Started => { + title => 'Started', # loc + attribute => 'Started', + value => sub { return $_[0]->StartedObj->AsString } + }, + Told => { + title => 'Told', # loc + attribute => 'Told', + value => sub { return $_[0]->ToldObj->AsString } + }, + Due => { + title => 'Due', # loc + attribute => 'Due', + value => sub { return $_[0]->DueObj->AsString } + }, + Resolved => { + title => 'Resolved', # loc + attribute => 'Resolved', + value => sub { return $_[0]->ResolvedObj->AsString } + }, + UpdateStatus => { + title => 'New messages', # loc + value => sub { + my $txn = $_[0]->SeenUpTo or return $_[0]->loc('No'); + return \('<a href="'. RT->Config->Get('WebPath') .'/Ticket/Display.html?id=' + . $_[0]->id .'#txn-'. $txn->id .'">'), + $_[0]->loc('New'), \'</a>'; + }, + }, + KeyRequestors => { + title => 'Requestors', # loc + attribute => 'Requestor.EmailAddress', + value => sub { + my $t = shift; + my @requestors = $t->Requestors->MemberEmailAddresses; + for my $email (@requestors) + { + my %key = RT::Crypt::GnuPG::GetKeyInfo($email); + if (!defined $key{'info'}) { + $email .= loc(" (no pubkey!)"); + } + elsif ($key{'info'}{'TrustLevel'} == 0) { + $email .= loc(" (untrusted!)"); + } + } + return join ', ', @requestors; + } + }, + KeyOwnerName => { + title => 'Owner', # loc + attribute => 'Owner', + value => sub { + my $t = shift; + my $name = $t->OwnerObj->Name; + my %key = RT::Crypt::GnuPG::GetKeyInfo($t->OwnerObj->EmailAddress); + if (!defined $key{'info'}) { + $name .= ' '. loc("(no pubkey!)"); + } + elsif ($key{'info'}{'TrustLevel'} == 0) { + $name .= ' '. loc("(untrusted!)"); + } + + return $name; + } + }, + + # Everything from LINKTYPEMAP + (map { + $_ => { value => $LinkCallback->( $_ ) } + } keys %RT::Ticket::LINKTYPEMAP), + + '_CLASS' => { + value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' } + }, + '_CHECKBOX' => { + attribute => 'checkbox', + title => 'Update', # loc + align => 'right', + value => sub { return \('<input type="checkbox" class="checkbox" name="UpdateTicket'.$_[0]->id.'" value="1" checked="checked" />') } + }, + + CustomField => { + attribute => sub { return shift @_ }, + title => sub { return pop @_ }, + value => sub { + # Display custom field contents, separated by newlines. + # For Image custom fields we also show a thumbnail here. + + my $values = $_[0]->CustomFieldValues( $_[-1] ); + my @values = map { + ( + ($_->CustomFieldObj->Type eq 'Image') + ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ )) + : $_->Content + ), + \'<br />', + } @{ $values->ItemsArrayRef }; + pop @values; # Remove that last <br /> + return @values; + }, + }, + Bookmark => { + title => ' ', + value => sub { + my $bookmark = $m->scomp( '/Ticket/Elements/Bookmark', id => $_[0]->id ); + # the CollectionAsTable/Row template replaces newlines with <br> + $bookmark =~ s/\n//g; + + return \$bookmark; + }, + }, +}; + +$COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'}; + +# if no GPG support, then KeyOwnerName and KeyRequestors fall back to the regular +# versions +if (RT->Config->Get('GnuPG')->{'Enable'}) { + require RT::Crypt::GnuPG; +} +else { + $COLUMN_MAP->{KeyOwnerName} = $COLUMN_MAP->{OwnerName}; + $COLUMN_MAP->{KeyRequestors} = $COLUMN_MAP->{Requestors}; +} +</%ONCE> +<%init> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 ); +# backward compatibility +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap' ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%init> diff --git a/rt/share/html/Elements/RT__User/ColumnMap b/rt/share/html/Elements/RT__User/ColumnMap new file mode 100644 index 000000000..bb93b978f --- /dev/null +++ b/rt/share/html/Elements/RT__User/ColumnMap @@ -0,0 +1,141 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%ARGS> +$Name +$Attr => undef +</%ARGS> +<%ONCE> +my $COLUMN_MAP = { + id => { + title => '#', # loc + attribute => 'id', + align => 'right', + value => sub { return $_[0]->id }, + }, + Name => { + title => 'Name', # loc + attribute => 'Name', + value => sub { return $_[0]->Name() }, + }, + RealName => { + title => 'RealName', # loc + attribute => 'RealName', + value => sub { return $_[0]->RealName() }, + }, + NickName => { + title => 'NickName', # loc + attribute => 'NickName', + value => sub { return $_[0]->NickName() }, + }, + EmailAddress => { + title => 'EmailAddress', # loc + attribute => 'EmailAddress', + value => sub { return $_[0]->EmailAddress() }, + }, + Organization => { + title => 'Organization', # loc + attribute => 'Organization', + value => sub { return $_[0]->Organization() }, + }, + HomePhone => { + title => 'HomePhone', # loc + attribute => 'HomePhone', + value => sub { return $_[0]->HomePhone() }, + }, + WorkPhone => { + title => 'WorkPhone', # loc + attribute => 'WorkPhone', + value => sub { return $_[0]->WorkPhone() }, + }, + MobilePhone => { + title => 'MobilePhone', # loc + attribute => 'MobilePhone', + value => sub { return $_[0]->MobilePhone() }, + }, + PagerPhone => { + title => 'PagerPhone', # loc + attribute => 'PagerPhone', + value => sub { return $_[0]->PagerPhone() }, + }, + Address1 => { + title => 'Address1', # loc + attribute => 'Address1', + value => sub { return $_[0]->Address1() }, + }, + Address2 => { + title => 'Address2', # loc + attribute => 'Address2', + value => sub { return $_[0]->Address2() }, + }, + City => { + title => 'City', # loc + attribute => 'City', + value => sub { return $_[0]->City() }, + }, + State => { + title => 'State', # loc + attribute => 'State', + value => sub { return $_[0]->State() }, + }, + Zip => { + title => 'Zip', # loc + attribute => 'Zip', + value => sub { return $_[0]->Zip() }, + }, + Country => { + title => 'Country', # loc + attribute => 'Country', + value => sub { return $_[0]->Country() }, + }, +}; + +</%ONCE> +<%INIT> +$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 ); +return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr ); +</%INIT> diff --git a/rt/share/html/Elements/Refresh b/rt/share/html/Elements/Refresh new file mode 100755 index 000000000..7e36c6855 --- /dev/null +++ b/rt/share/html/Elements/Refresh @@ -0,0 +1,69 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="-1" +%unless ($Default) { + selected="selected" +%} +><&|/l&>Don't refresh this page.</&></option> +%foreach my $value (@refreshevery) { +<option value="<%$value%>" +% if ( $Default && ($value == $Default)) { +selected="selected" +% } +><&|/l, $value/60 &>Refresh this page every [_1] minutes.</&></option> +%} +</select> + +<%INIT> +my @refreshevery = qw(120 300 600 1200 3600 7200); +</%INIT> +<%ARGS> +$Name => undef +$Default => 0 +</%ARGS> diff --git a/rt/share/html/Elements/RefreshHomepage b/rt/share/html/Elements/RefreshHomepage new file mode 100644 index 000000000..bf91a9522 --- /dev/null +++ b/rt/share/html/Elements/RefreshHomepage @@ -0,0 +1,54 @@ +%# 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 }}} +<&|/Widgets/TitleBox, title => loc('Refresh')&> +<form method="get" action="<% RT->Config->Get('WebPath') . $m->request_path %>"> +<& /Elements/Refresh, Name => 'HomeRefreshInterval', + Default => $session{'home_refresh_interval'}||RT->Config->Get('HomePageRefreshInterval', $session{'CurrentUser'}) &> +<& /Elements/Submit, Label => loc('Go!') &> +</&> +</form> diff --git a/rt/share/html/Elements/ScrubHTML b/rt/share/html/Elements/ScrubHTML new file mode 100644 index 000000000..7744a8532 --- /dev/null +++ b/rt/share/html/Elements/ScrubHTML @@ -0,0 +1,77 @@ +%# 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 }}} +<%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); +</%init> +<%args> +$Content => undef +</%args> diff --git a/rt/share/html/Elements/Section b/rt/share/html/Elements/Section new file mode 100755 index 000000000..b67115d85 --- /dev/null +++ b/rt/share/html/Elements/Section @@ -0,0 +1,51 @@ +%# 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 }}} +<h1><%$title%></h1> +<%ARGS> +$title => undef +</%ARGS> diff --git a/rt/share/html/Elements/SelectAttachmentField b/rt/share/html/Elements/SelectAttachmentField new file mode 100755 index 000000000..459b6926e --- /dev/null +++ b/rt/share/html/Elements/SelectAttachmentField @@ -0,0 +1,56 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="Subject"><&|/l&>Subject</&></option> +<option value="Content"><&|/l&>Content</&></option> +<option value="ContentType"><&|/l&>Content-Type</&></option> +<option value="Filename"><&|/l&>Filename</&></option> +</select> +<%ARGS> +$Name => 'AttachmentField' +</%ARGS> diff --git a/rt/share/html/Elements/SelectBoolean b/rt/share/html/Elements/SelectBoolean new file mode 100755 index 000000000..e535ae547 --- /dev/null +++ b/rt/share/html/Elements/SelectBoolean @@ -0,0 +1,71 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="<%$TrueVal%>" <%$TrueDefault|n%>><%$True%></option> +<option value="<%$FalseVal%>" <%$FalseDefault|n%>><%$False%></option> +</select> + +<%ARGS> +$Name => undef +$True => loc("is") +$Default => 'true' +$TrueVal => 1 +$FalseVal => 0 +$False => loc("isn't") +</%ARGS> + +<%INIT> +my $TrueDefault = ''; +my $FalseDefault = ''; +if ($Default && $Default !~ /true/i) { + $FalseDefault = 'selected="selected"'; +} +else { + $TrueDefault = 'selected="selected"'; +} +</%INIT> diff --git a/rt/share/html/Elements/SelectCustomFieldOperator b/rt/share/html/Elements/SelectCustomFieldOperator new file mode 100755 index 000000000..f7fdaadf5 --- /dev/null +++ b/rt/share/html/Elements/SelectCustomFieldOperator @@ -0,0 +1,64 @@ +%# 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 }}} +<select name="<% $Name %>"> +% while (my $option = shift @Options) { +% my $value = shift @Values; +<option value="<% $value %>" +% if ($Default eq $value) { +selected="selected" +% } +><% $option %></option> +% } +</select> + +<%ARGS> +$Name => undef +@Options => ( loc('matches'), loc("doesn't match"), loc('is'), loc("isn't"), loc('less than'), loc('greater than')) +@Values => ('LIKE', 'NOT LIKE', '=', '!=', '<', '>') +$Default => '' +</%ARGS> diff --git a/rt/share/html/Elements/SelectCustomFieldValue b/rt/share/html/Elements/SelectCustomFieldValue new file mode 100755 index 000000000..579f6962a --- /dev/null +++ b/rt/share/html/Elements/SelectCustomFieldValue @@ -0,0 +1,65 @@ +%# 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 }}} +% $m->callback( Name => $Name, CustomField => $CustomField ); +% if ($CustomField->Type =~ /Select/i) { +% my $values = $CustomField->Values; +<select name="<%$Name%>"> +<option value="" selected="selected">-</option> +<option value="NULL"><&|/l&>(no value)</&></option> +% while (my $value = $values->Next) { +<option value="<%$value->Name%>"><%$value->Name%></option> +% } +</select> +% } +% else { +<input name="<%$Name%>" size="20" /> +% } +<%args> +$Name => undef +$CustomField =>undef +</%args> diff --git a/rt/share/html/Elements/SelectDate b/rt/share/html/Elements/SelectDate new file mode 100755 index 000000000..32a173db4 --- /dev/null +++ b/rt/share/html/Elements/SelectDate @@ -0,0 +1,77 @@ +%# 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 }}} +<script type="text/javascript"><!-- + onLoadHook('createCalendarLink("<% $Name %>");'); +--></script> +<input type="text" id="<% $Name %>" name="<% $Name %>" value="<% $Value %>" size="<% $Size %>" /> +<%init> +unless ((defined $Default) or + ($current <= 0)) { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime($current); + $Default = sprintf("%04d-%02d-%02d %02d:%02d", + $year+1900,$mon+1,$mday, + $hour,$min); +} +$Value = $Value || $Default; + +unless ($Name) { + $Name = $menu_prefix. "_Date"; +} +</%init> + +<%args> + +$ShowTime => 1 +$menu_prefix=>'' +$current=>time +$Default => '' +$Value => '' +$Name => undef +$Size => 16 +</%args> diff --git a/rt/share/html/Elements/SelectDateRelation b/rt/share/html/Elements/SelectDateRelation new file mode 100755 index 000000000..61ab350f3 --- /dev/null +++ b/rt/share/html/Elements/SelectDateRelation @@ -0,0 +1,60 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="<"><%$Before%></option> +<option value="="><%$On%></option> +<option value=">"><%$After%></option> +</select> + +<%ARGS> +$Name => undef +$Default => undef +$Before => loc('before') +$On => loc('on') +$After => loc('after') +</%ARGS> diff --git a/rt/share/html/Elements/SelectDateType b/rt/share/html/Elements/SelectDateType new file mode 100755 index 000000000..a8631134d --- /dev/null +++ b/rt/share/html/Elements/SelectDateType @@ -0,0 +1,60 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="Created"><&|/l&>Created</&></option> +<option value="Started"><&|/l&>Started</&></option> +<option value="Resolved"><&|/l&>Resolved</&></option> +<option value="Told"><&|/l&>Last Contacted</&></option> +<option value="LastUpdated"><&|/l&>Last Updated</&></option> +<option value="Starts"><&|/l&>Starts</&></option> +<option value="Due"><&|/l&>Due</&></option> +<option value="Updated"><&|/l&>Updated</&></option> +</select> +<%ARGS> +$Name => 'DateType' +</%ARGS> diff --git a/rt/share/html/Elements/SelectEqualityOperator b/rt/share/html/Elements/SelectEqualityOperator new file mode 100755 index 000000000..2d52df7f0 --- /dev/null +++ b/rt/share/html/Elements/SelectEqualityOperator @@ -0,0 +1,64 @@ +%# 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 }}} +<select name="<%$Name%>"> +% while (my $option = shift @Options) { +% my $value = shift @Values; +<option value="<%$value%>" +% if ($Default eq $value) { +selected="selected" +% } +><%$option%></option> +% } +</select> + +<%ARGS> +$Name => undef +@Options => (loc('less than'), loc('equal to'), loc('greater than'), loc('not equal to')) +@Values => qw(< = > !=) +$Default =>'' +</%ARGS> diff --git a/rt/share/html/Elements/SelectGroups b/rt/share/html/Elements/SelectGroups new file mode 100755 index 000000000..766a389c4 --- /dev/null +++ b/rt/share/html/Elements/SelectGroups @@ -0,0 +1,68 @@ +%# 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 }}} +<select name="GroupField"> +% foreach my $col (RT::Group->BasicColumns) { +<option <% ($GroupField eq $col->[0]) ? 'selected="selected"' : '' %> value="<% $col->[0] %>"><% loc($col->[1]) %></option> +% } +% while (my $CF = $CFs->Next) { +% my $val = "CustomField-" . $CF->Id; +<option <% ($GroupField eq $val) ? 'selected="selected"' : '' %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option> +% } +</select> +<& /Elements/SelectMatch, Name => 'GroupOp', Default => $GroupOp &> +<input size="8" name="GroupString" value="<% $GroupString %>" /> +<%INIT> +my $CFs = RT::CustomFields->new($session{'CurrentUser'}); +$CFs->LimitToChildType('RT::Group'); +$CFs->OrderBy( FIELD => 'Name' ); +</%INIT> +<%ARGS> +$GroupField => '' +$GroupOp => '' +$GroupString => '' +</%ARGS> diff --git a/rt/share/html/Elements/SelectLang b/rt/share/html/Elements/SelectLang new file mode 100755 index 000000000..914a6f59c --- /dev/null +++ b/rt/share/html/Elements/SelectLang @@ -0,0 +1,80 @@ +%# 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 }}} +<select name="<%$Name%>"> +% if ($ShowNullOption) { +<option value="">-</option> +% } +% foreach my $lang (@lang) { +<option value="<%$lang%>"<%(defined($Default) && ($lang eq $Default)) && qq[ selected="selected"] |n%>><% $lang_to_desc{$lang} %> +% if (($Verbose) and (my $description = I18N::LangTags::List::native_name($lang)) ){ +(<%$description%>) +% } +</option> +% } +</select> +<%ARGS> +$ShowNullOption => 1 +$ShowAllQueues => 1 +$Name => undef +$Verbose => undef +$Default => 0 +$Lite => 0 +</%ARGS> + +<%ONCE> +use I18N::LangTags::List; +my (@lang, %lang_to_desc); +foreach my $lang (map { s/:://; s/_/-/g; $_ } grep { /^\w+::$/ } keys %RT::I18N::) { + next if $lang =~ /i-default|en-us/; + my $desc = I18N::LangTags::List::name($lang); + next unless ($desc); + $desc =~ s/(.*) (.*)/$2 ($1)/ unless ( $desc =~ /.* \(.*\)/ ); + $lang_to_desc{$lang} = $desc; +} +@lang = sort { $lang_to_desc{$a} cmp $lang_to_desc{$b} } keys %lang_to_desc; +</%ONCE> diff --git a/rt/share/html/Elements/SelectLinkType b/rt/share/html/Elements/SelectLinkType new file mode 100755 index 000000000..e4babe3c9 --- /dev/null +++ b/rt/share/html/Elements/SelectLinkType @@ -0,0 +1,57 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option <% ($Default eq 'MemberOf') ? 'selected="selected"' : '' %> value="MemberOf"><&|/l&>Member of</&></option> +<option <% ($Default eq 'DependsOn') ? 'selected="selected"' : '' %> value="DependsOn"><&|/l&>Depends on</&></option> +<option <% ($Default eq 'RefersTo') ? 'selected="selected"' : '' %> value="RefersTo"><&|/l&>Refers to</&></option> +</select> + +<%ARGS> +$Name => "LinkType" +$Default => '' +</%ARGS> diff --git a/rt/share/html/Elements/SelectMatch b/rt/share/html/Elements/SelectMatch new file mode 100755 index 000000000..78a87caae --- /dev/null +++ b/rt/share/html/Elements/SelectMatch @@ -0,0 +1,82 @@ +%# 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 }}} +<select name="<%$Name%>"> +<option value="LIKE" <%$LikeDefault|n%>><%$Like%></option> +<option value="NOT LIKE" <%$NotLikeDefault|n%>><%$NotLike%></option> +<option value="=" <%$TrueDefault|n%>><%$True%></option> +<option value="!=" <%$FalseDefault|n%>><%$False%></option> +</select> + +<%ARGS> +$Name => undef +$Like => loc('matches') +$NotLike => loc("doesn't match") +$True => loc('is') +$False => loc("isn't") +$Default => undef +</%ARGS> +<%INIT> + +my $TrueDefault = ''; +my $FalseDefault=''; +my $LikeDefault=''; +my $NotLikeDefault =''; + +if ($Default && $Default =~ /false|!=/i) { + $FalseDefault = qq[ selected="selected"]; +} +elsif ($Default && $Default =~ /true|=/i) { + $TrueDefault = qq[ selected="selected"]; +} +elsif ($Default && $Default =~ /notlike|NOT LIKE/i) { + $NotLikeDefault = qq[ selected="selected"]; +} +else { + $LikeDefault = qq[ selected="selected"]; +} +</%INIT> diff --git a/rt/share/html/Elements/SelectNewTicketQueue b/rt/share/html/Elements/SelectNewTicketQueue new file mode 100755 index 000000000..d7d406ea7 --- /dev/null +++ b/rt/share/html/Elements/SelectNewTicketQueue @@ -0,0 +1,50 @@ +%# 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 }}} +<label accesskey="9"> + <& /Elements/SelectQueue, Name => 'Queue', Default => RT->Config->Get("DefaultQueue", $session{'CurrentUser'}), %ARGS, ShowNullOption => 0, ShowAllQueues => 0 &> +</label> diff --git a/rt/share/html/Elements/SelectOwner b/rt/share/html/Elements/SelectOwner new file mode 100755 index 000000000..6bdb24064 --- /dev/null +++ b/rt/share/html/Elements/SelectOwner @@ -0,0 +1,133 @@ +%# 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 }}} +<select name="<%$Name%>" id="<%$Name%>"> +%if ($DefaultValue) { +<option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel%></option> +%} +% $Default = 0 unless defined $Default && $Default =~ /^\d+$/; +% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $m->scomp('/Elements/ShowUser', User => $_)]} @users; +%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> +<%INIT> + +my @objects; +if ($TicketObj) { + @objects = ($TicketObj); +} elsif ($QueueObj) { + @objects = ($QueueObj); +} elsif ($cfqueues) { + @objects = keys %{$cfqueues}; +} else { +# 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() ) { + next + if ( $User->id == $RT::Nobody->id ) + ; # skip nobody here, so we can make them first later + $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 = sort { uc( $a->Name ) cmp uc( $b->Name ) } values %user_uniq_hash; +unshift( @users, $RT::Nobody ); + +$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 +</%ARGS> diff --git a/rt/share/html/Elements/SelectPriority b/rt/share/html/Elements/SelectPriority new file mode 100644 index 000000000..c8af7cca8 --- /dev/null +++ b/rt/share/html/Elements/SelectPriority @@ -0,0 +1,8 @@ +<input name="<% $Name %>" value="<% $Default %>" size="5" /> +<%ARGS> +$Name => 'Priority' +$Default => '' +</%ARGS> +<%INIT> +$Default = '' unless defined $Default; +</%INIT> diff --git a/rt/share/html/Elements/SelectQueue b/rt/share/html/Elements/SelectQueue new file mode 100755 index 000000000..20a5b7d9d --- /dev/null +++ b/rt/share/html/Elements/SelectQueue @@ -0,0 +1,106 @@ +%# 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 }}} +% if ($Lite) { +% my $d = new RT::Queue($session{'CurrentUser'}); +% $d->Load($Default); +<input name="<%$Name%>" size="25" value="<%$d->Name%>" class="<%$Class%>" /> +% } +% else { +<select name="<%$Name%>" <% ($OnChange) ? 'onchange="'.$OnChange.'"' : '' |n %> class="<%$Class%>"> +% if ($ShowNullOption) { + <option value="">-</option> +% } +% for my $queue (@{$session{$cache_key}}) { + <option value="<% ($NamedValues ? $queue->{Name} : $queue->{Id}) %>" + +% if ($queue->{Id} eq ($Default||'') || $queue->{Name} eq ($Default||'')) { + selected="selected" +% } + +> + <%$queue->{Name}%> + +% if ($Verbose and $queue->{Description}) { + (<%$queue->{Description}%>) +% } + </option> +% } +</select> +% } +<%args> +$CheckQueueRight => 'CreateTicket' +$ShowNullOption => 1 +$ShowAllQueues => 1 +$Name => undef +$Verbose => undef +$NamedValues => 0 +$Default => 0 +$Lite => 0 +$OnChange => undef +$Class => 'select-queue' +</%args> +<%init> +my $cache_key = "SelectQueue---" + . $session{'CurrentUser'}->Id + . "---$CheckQueueRight---$ShowAllQueues"; + +if (not defined $session{$cache_key} and not $Lite) { + my $q = new RT::Queues($session{'CurrentUser'}); + $q->UnLimit; + + while (my $queue = $q->Next) { + if ($ShowAllQueues || $queue->CurrentUserHasRight($CheckQueueRight)) { + push @{$session{$cache_key}}, { + Id => $queue->Id, + Name => $queue->Name, + Description => $queue->Description, + }; + } + } +} +</%init> diff --git a/rt/share/html/Elements/SelectResultsPerPage b/rt/share/html/Elements/SelectResultsPerPage new file mode 100755 index 000000000..ec1f27f3c --- /dev/null +++ b/rt/share/html/Elements/SelectResultsPerPage @@ -0,0 +1,68 @@ +%# 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 }}} +%# TODO: Better default handling + +<select name="<% $Name %>"> +% foreach my $value ( @values ) { +<option value="<% $value %>" <% $value == $Default? 'selected="selected"': '' |n%>> +<% shift @labels %> +</option> +% } +</select> + +<%INIT> +my @values = qw(0 10 25 50 100); +my @labels = (loc('Unlimited'), qw(10 25 50 100)); +$Default = 50 unless defined $Default; +</%INIT> +<%ARGS> + +$Name => undef +$Default => 50 + +</%ARGS> diff --git a/rt/share/html/Elements/SelectSortOrder b/rt/share/html/Elements/SelectSortOrder new file mode 100755 index 000000000..ded5a99c9 --- /dev/null +++ b/rt/share/html/Elements/SelectSortOrder @@ -0,0 +1,65 @@ +%# 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 }}} +<select name="<%$Name%>"> +%foreach my $order (@orders) { +<option value="<%$order%>"<%$order eq $Default && qq[ selected="selected"] |n %>> +<% shift @order_names %> +</option> +% } +</select> + +<%INIT> +my @orders = qw (ASC DESC); +my @order_names = (loc('Ascending'), loc('Descending')); + +</%INIT> + +<%ARGS> +$Name => 'SortOrder' +$Default => 'ASC' +</%ARGS> diff --git a/rt/share/html/Elements/SelectStatus b/rt/share/html/Elements/SelectStatus new file mode 100755 index 000000000..7f328e5b4 --- /dev/null +++ b/rt/share/html/Elements/SelectStatus @@ -0,0 +1,67 @@ +%# 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 }}} +<select name="<%$Name%>"> +%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> +<%ONCE> +my $queue = new RT::Queue($session{'CurrentUser'}); +my @status = $queue->StatusArray(); +</%ONCE> +<%ARGS> +$Name => undef +$Default => '' +$SkipDeleted => 0 +$DefaultValue => 1 +$DefaultLabel => "-" +</%ARGS> diff --git a/rt/share/html/Elements/SelectTicketSortBy b/rt/share/html/Elements/SelectTicketSortBy new file mode 100755 index 000000000..d6964ec5b --- /dev/null +++ b/rt/share/html/Elements/SelectTicketSortBy @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<select name="<%$Name%>"> +% foreach my $field (@sortfields) { +<option value="<%$field%>"<% $field eq $Default && qq[ selected="selected"] |n%>><% loc($field) %></option> +% } +</select> + +<%INIT> +my $tickets = new RT::Tickets($session{'CurrentUser'}); +my @sortfields = $tickets->SortFields(); + +</%INIT> +<%ARGS> +$Name => 'SortTicketsBy' +$Default => 'id' +</%ARGS> diff --git a/rt/share/html/Elements/SelectTicketTypes b/rt/share/html/Elements/SelectTicketTypes new file mode 100755 index 000000000..792130988 --- /dev/null +++ b/rt/share/html/Elements/SelectTicketTypes @@ -0,0 +1,58 @@ +%# 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 }}} +<select name="<%$Name%>"> +%foreach (@Types) { +<option value="<% $_ %>"<% ($_ eq $Default) && qq[ selected="selected"] |n %>><% loc($_) %> +%} +</select> + +<%ARGS> +$Name => 'TickType' +$Default => undef +@Types => qw(Approval Ticket) +</%ARGS> diff --git a/rt/share/html/Elements/SelectTimeUnits b/rt/share/html/Elements/SelectTimeUnits new file mode 100755 index 000000000..5438d3d6c --- /dev/null +++ b/rt/share/html/Elements/SelectTimeUnits @@ -0,0 +1,62 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<select class="TimeUnits" id="<% $Name %>" name="<% $Name %>"> +<option value="minutes" <% $HoursDefault ? '' : 'selected="selected"' |n%>> + <% loc('Minutes') %> +</option> +<option value="hours" <% $HoursDefault ? 'selected="selected"' : '' |n%>> + <% loc('Hours') %> +</option> +</select> +<%INIT> +$Name .= '-TimeUnits' unless $Name =~ /-TimeUnits$/io; +my $HoursDefault = RT->Config->Get('DefaultTimeUnitsToHours'); +</%INIT> +<%ARGS> +$Name => '' +</%ARGS> diff --git a/rt/share/html/Elements/SelectTimezone b/rt/share/html/Elements/SelectTimezone new file mode 100644 index 000000000..09399e1ce --- /dev/null +++ b/rt/share/html/Elements/SelectTimezone @@ -0,0 +1,84 @@ +%# 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 }}} +<%ONCE> +my $HAS_DATETIME_TZ = eval { require DateTime::TimeZone }; +my $HAS_DATETIME = eval { require DateTime }; + +my (@names, %label); +if ( $HAS_DATETIME_TZ ) { + @names = DateTime::TimeZone->all_names; +} + +if ( $HAS_DATETIME ) { + 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> +% } +% foreach my $tz (@names) { +<option value="<% $tz %>" <% ($Default||'') eq $tz? 'selected="selected"' :'' + |n %> ><% $label{$tz} || $tz %></option> +% } +</select> +% } +<%ARGS> +$ShowNullOption => 1 +$Name => undef +$Default => 0 +</%ARGS> + diff --git a/rt/share/html/Elements/SelectUsers b/rt/share/html/Elements/SelectUsers new file mode 100755 index 000000000..b4a3aa0db --- /dev/null +++ b/rt/share/html/Elements/SelectUsers @@ -0,0 +1,68 @@ +%# 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 }}} +<select name="UserField"> +% foreach my $col (RT::User->BasicColumns) { +<option <% ($UserField eq $col->[0]) ? 'selected="selected"' : '' |n %> value="<% $col->[0] %>"><% loc($col->[1]) %></option> +% } +% while (my $CF = $CFs->Next) { +% my $val = "CustomField-" . $CF->Id; +<option <% ($UserField eq $val) ? 'selected="selected"' : '' |n %> value="<% $val %>"><&|/l&>CustomField</&>: <% $CF->Name %></option> +% } +</select> +<& /Elements/SelectMatch, Name => 'UserOp', Default => $UserOp &> +<input size="8" name="UserString" value="<% $UserString %>" /> +<%INIT> +my $CFs = RT::CustomFields->new($session{'CurrentUser'}); +$CFs->LimitToChildType('RT::User'); +$CFs->OrderBy( FIELD => 'Name' ); +</%INIT> +<%ARGS> +$UserField => '' +$UserOp => '' +$UserString => '' +</%ARGS> diff --git a/rt/share/html/Elements/SelectWatcherType b/rt/share/html/Elements/SelectWatcherType new file mode 100755 index 000000000..b5636af49 --- /dev/null +++ b/rt/share/html/Elements/SelectWatcherType @@ -0,0 +1,71 @@ +%# 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 }}} +<select name="<%$Name%>"> +% if ($AllowNull) { +<option value="">-</option> +% } +%for my $option (@types) { +<option value="<%$option%>"<%defined($Default) && $option eq $Default && qq[ selected="selected"] |n %>><%loc($option)%></option> +%} +</select> + +<%INIT> +my @types; +if ($Scope =~ 'queue') { + @types = qw(Cc AdminCc); +} +else { + @types = qw(Requestor Cc AdminCc); +} +</%INIT> +<%ARGS> +$AllowNull => 1 +$Default=>undef +$Scope => 'ticket' +$Name => 'WatcherType' +</%ARGS> diff --git a/rt/share/html/Elements/SetupSessionCookie b/rt/share/html/Elements/SetupSessionCookie new file mode 100755 index 000000000..3afe68376 --- /dev/null +++ b/rt/share/html/Elements/SetupSessionCookie @@ -0,0 +1,57 @@ +%# 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 }}} +<%INIT> +return if $m->is_subrequest; # avoid reentrancy, as suggested by masonbook + +RT::Interface::Web::LoadSessionFromCookie(); + +return (); +</%INIT> +<%ARGS> +$SessionCookie => undef +</%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldBinary b/rt/share/html/Elements/ShowCustomFieldBinary new file mode 100644 index 000000000..9c73e8026 --- /dev/null +++ b/rt/share/html/Elements/ShowCustomFieldBinary @@ -0,0 +1,51 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content %>"><% $Object->Content %></a> +<%ARGS> +$Object => undef +</%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldImage b/rt/share/html/Elements/ShowCustomFieldImage new file mode 100644 index 000000000..2f470cdbd --- /dev/null +++ b/rt/share/html/Elements/ShowCustomFieldImage @@ -0,0 +1,53 @@ +%# 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 }}} +% my $url = RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$Object->Id.'/'.$Object->Content; +<a href="<% $url %>"><% $Object->Content %></a> +<img type="<% $Object->ContentType %>" height="64" src="<% $url %>" align="middle" /> +<%ARGS> +$Object +</%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldText b/rt/share/html/Elements/ShowCustomFieldText new file mode 100644 index 000000000..beaa2a5a1 --- /dev/null +++ b/rt/share/html/Elements/ShowCustomFieldText @@ -0,0 +1,56 @@ +%# 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 }}} +<%init> + my $content = $Object->LargeContent || $Object->Content; + $content = $m->comp('/Elements/ScrubHTML', Content => $content); + $content =~ s|\n|<br />|g; +</%init> +<%$content|n%> +<%ARGS> +$Object +</%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFieldWikitext b/rt/share/html/Elements/ShowCustomFieldWikitext new file mode 100644 index 000000000..49376aeb3 --- /dev/null +++ b/rt/share/html/Elements/ShowCustomFieldWikitext @@ -0,0 +1,58 @@ +%# 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 }}} +% my $content = $Object->LargeContent || $Object->Content; +% $content = $m->comp('/Elements/ScrubHTML', Content => $content); +% my $base = $Object->Object->WikiBase; +% my $wiki_content = Text::WikiFormat::format( $content."\n" , {}, { extended => 1, absolute_links => 1, implicit_links => RT->Config->Get('WikiImplicitLinks'), prefix => $base} ); +<%$wiki_content|n%> +<%init> +use Text::WikiFormat; +</%init> +<%ARGS> +$Object +</%ARGS> diff --git a/rt/share/html/Elements/ShowCustomFields b/rt/share/html/Elements/ShowCustomFields new file mode 100644 index 000000000..ddb8b72e3 --- /dev/null +++ b/rt/share/html/Elements/ShowCustomFields @@ -0,0 +1,123 @@ +%# 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 }}} +% if ($Table) { +<table> +% } +% while ( my $CustomField = $CustomFields->Next ) { +% my $Values = $Object->CustomFieldValues( $CustomField->Id ); +% my $count = $Values->Count; + <tr id="CF-<%$CustomField->id%>-ShowRow"> + <td class="label"><% $CustomField->Name %>:</td> + <td class="value"> +% unless ( $count ) { +<i><&|/l&>(no value)</&></i> +% } elsif ( $count == 1 ) { +% $print_value->( $CustomField, $Values->First ); +% } else { +<ul> +% while ( my $Value = $Values->Next ) { +<li> +% $print_value->( $CustomField, $Value ); +</li> +% } +</ul> +% } + </td> + </tr> +% } +% if ($Table) { +</table> +% } +<%INIT> +$m->callback( + CallbackName => 'MassageCustomFields', + Object => $Object, + CustomFields => $CustomFields, +); + +my $print_value = sub { + my ($cf, $value) = @_; + my $linked = $cf->LinkValueTo; + if ( $linked ) { + $m->out('<a href="'. $value->LinkValueTo .'" target="_new">'); + } + my $comp = "ShowCustomField". $cf->Type; + $m->callback( + CallbackName => 'ShowComponentName', + Name => \$comp, + CustomField => $cf, + Object => $Object, + ); + if ( $m->comp_exists( $comp ) ) { + $m->comp( $comp, Object => $value ); + } else { + $m->out( $m->interp->apply_escapes( $value->Content, 'h' ) ); + } + $m->out('</a>') if $linked; + + # This section automatically populates a div with the "IncludeContentForValue" for this custom + # field if it's been defined + 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( '<a href="'. $value->IncludeContentForValue .'">' ); + $m->print( $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} ); + } +}; + +</%INIT> +<%ARGS> +$Object => undef +$CustomFields => $Object->CustomFields +$Table => 1 +</%ARGS> diff --git a/rt/share/html/Elements/ShowLink b/rt/share/html/Elements/ShowLink new file mode 100644 index 000000000..6bd9021b7 --- /dev/null +++ b/rt/share/html/Elements/ShowLink @@ -0,0 +1,69 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<a href="<%$URI->Resolver->HREF%>"> +% if ($URI->IsLocal) { +% my $member = $URI->Object; +% if (UNIVERSAL::isa($member, "RT::Ticket")) { +% my $inactive = $member->QueueObj->IsInactiveStatus($member->Status); + +<span class="<% $inactive ? 'ticket-inactive' : '' %>"> +<%$member->Id%>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<% loc($member->Status) %>] +</span> + +% } elsif ( UNIVERSAL::can($member, 'Name')) { +<%$URI->Resolver->AsString%>: <%$member->Name%> +% } else { +<%$URI->Resolver->AsString%> +% } +% } else { +<%$URI->Resolver->AsString%> +% } +</a> +<%ARGS> +$URI => undef +</%ARGS> diff --git a/rt/share/html/Elements/ShowLinks b/rt/share/html/Elements/ShowLinks new file mode 100755 index 000000000..569bad39c --- /dev/null +++ b/rt/share/html/Elements/ShowLinks @@ -0,0 +1,160 @@ +%# 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 }}} +<table> + <tr> + <td class="labeltop"><&|/l&>Depends on</&>: (<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</td> + <td class="value"> + +<%PERL> +my ( @active, @inactive, @not_tickets ); +for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { + my $target = $link->TargetObj; + if ( $target && $target->isa('RT::Ticket') ) { + if ( $target->QueueObj->IsInactiveStatus( $target->Status ) ) { + push( @inactive, $link->TargetURI ); + } + else { + push( @active, $link->TargetURI ); + } + } + else { + push( @not_tickets, $link->TargetURI ); + } +} +</%PERL> + + +<ul> +% for my $Link (@not_tickets, @active, @inactive) { +<li><& ShowLink, URI => $Link &></li> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Depended on by</&>: (<a href="<%$clone->{'new-DependsOn'}%>"><% loc('Create') %></a>)</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->DependedOnBy->Next) { +<li><& ShowLink, URI => $Link->BaseURI &></li> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Parents</&>: (<a href="<%$clone->{'MemberOf-new'}%>"><% loc('Create') %></a>)</td> + <td class="value"><& /Ticket/Elements/ShowParents, Ticket => $Ticket &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Children</&>: (<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</td> + <td class="value"><& /Ticket/Elements/ShowMembers, Ticket => $Ticket &></td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Refers to</&>: (<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</td> + <td class="value"> +<ul> +% while (my $Link = $Ticket->RefersTo->Next) { +<li><& ShowLink, URI => $Link->TargetURI &></li> +% } +</ul> + </td> + </tr> + <tr> + <td class="labeltop"><&|/l&>Referred to by</&>: (<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</td> + <td class="value"> + <ul> +% while (my $Link = $Ticket->ReferredToBy->Next) { +% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->Type eq 'reminder'); +<li><& ShowLink, URI => $Link->BaseURI &></li> +% } +</ul> + </td> + </tr> + + +% # Allow people to add more rows to the table +% $m->callback( %ARGS ); + +</table> + +<%INIT> + +my $clone = {}; +my $path + = RT->Config->Get('WebPath') + . '/Ticket/Create.html?Queue=' + . $Ticket->Queue + . '&CloneTicket=' + . $Ticket->id; + + +for my $relation ( + qw(RefersTo ReferredToBy)) { + my $mode = $RT::Ticket::LINKTYPEMAP{$relation}->{Mode}; + my $type = $RT::Ticket::LINKTYPEMAP{$relation}->{Type}; + my $other = "Local" . $mode; + my $field = $mode eq 'Base' ? 'new-' . $type : $type . '-new'; + $clone->{$field} + = $path . "&$field=" + . join( '%20', + ( map { $_->$other() } @{ $Ticket->$relation->ItemsArrayRef } ), + $Ticket->id ); +} + +for my $relation ( qw(MemberOf Members DependsOn DependedOnBy)) { + my $mode = $RT::Ticket::LINKTYPEMAP{$relation}->{Mode}; + my $type = $RT::Ticket::LINKTYPEMAP{$relation}->{Type}; + my $field = $mode eq 'Base' ? 'new-' . $type : $type . '-new'; + $clone->{$field} = $path . "&$field=". $Ticket->id ; +} + +</%INIT> + +<%ARGS> +$Ticket => undef +</%ARGS> diff --git a/rt/share/html/Elements/ShowMemberships b/rt/share/html/Elements/ShowMemberships new file mode 100644 index 000000000..84f7155f8 --- /dev/null +++ b/rt/share/html/Elements/ShowMemberships @@ -0,0 +1,88 @@ +%# 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 }}} +<ul> +% while ( my $GroupMember = $GroupMembers->Next ) { +% my $Group = RT::Group->new($session{'CurrentUser'}); +% $Group->Load($GroupMember->GroupId) or next; +% if ($Group->Domain eq 'UserDefined') { +<li><a href="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html?id=<% $Group->Id %>"><% $Group->Name %></a></li> +% } elsif ($Group->Domain eq 'SystemInternal') { +<li><em><% loc($Group->Type) %></em></li> +% } +% } +</ul> +<%INIT> +my $GroupMembers = RT::GroupMembers->new($session{'CurrentUser'}); +$GroupMembers->Limit( FIELD => 'MemberId', VALUE => $UserObj->Id ); +my $alias = $GroupMembers->Join( + TYPE => 'left', + ALIAS1 => 'main', + FIELD1 => 'GroupId', + TABLE2 => 'Groups', + FIELD2 => 'id' +); +$GroupMembers->Limit( + ALIAS => $alias, + FIELD => 'Domain', + OPERATOR => '=', + VALUE => 'SystemInternal', +); +$GroupMembers->Limit( + ALIAS => $alias, + FIELD => 'Domain', + OPERATOR => '=', + VALUE => 'UserDefined', +); +$GroupMembers->OrderByCols( + { ALIAS => $alias, FIELD => 'Domain' }, + { ALIAS => $alias, FIELD => 'Name' }, +); +</%INIT> +<%ARGS> +$UserObj +</%ARGS> diff --git a/rt/share/html/Elements/ShowSearch b/rt/share/html/Elements/ShowSearch new file mode 100644 index 000000000..a7fc54566 --- /dev/null +++ b/rt/share/html/Elements/ShowSearch @@ -0,0 +1,151 @@ +%# 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 }}} +<&|/Widgets/TitleBox, + title => loc($search->Description, $ProcessedSearchArg->{'Rows'}), + title_href => $query_link_url.$QueryString, + titleright => $customize ? loc('Edit') : '', + titleright_href => $customize, + hideable => $hideable &> +<& $query_display_component, hideable => $hideable, %$ProcessedSearchArg, ShowNavigation => 0, Class => 'RT::Tickets' &> +</&> +<%init> +my $search; +my $user = $session{'CurrentUser'}->UserObj; +my $SearchArg; +my $customize; +my $query_display_component = '/Elements/CollectionList'; +my $query_link_url = RT->Config->Get('WebPath').'/Search/Results.html'; + +if ($SavedSearch) { + my ( $container_object, $search_id ) = _parse_saved_search($SavedSearch); + unless ( $container_object ) { + $m->out(loc("Either you have no rights to view saved search [_1] or identifier is incorrect", $SavedSearch)); + return; + } + $search = $container_object->Attributes->WithId($search_id); + unless ( $search->Id && ref( $SearchArg = $search->Content ) eq 'HASH' ) { + $m->out(loc("Saved Search [_1] not found", $SavedSearch)) unless $IgnoreMissing; + return; + } + $SearchArg->{'SearchType'} ||= 'Ticket'; + if ( $SearchArg->{SearchType} ne 'Ticket' ) { + + # XXX: dispatch to different handler here + $query_display_component + = '/Search/Elements/' . $SearchArg->{SearchType}; + $query_link_url = RT->Config->Get('WebURL') . "/Search/$SearchArg->{SearchType}.html"; + } elsif ($ShowCustomize) { + $customize = RT->Config->Get('WebPath') . '/Search/Build.html?' + . $m->comp( '/Elements/QueryString', + SavedSearchLoad => $SavedSearch ); + } +} else { + ($search) = RT::System->new( $session{'CurrentUser'} ) ->Attributes->Named( 'Search - ' . $Name ); + unless ( $search && $search->Id ) { + my (@custom_searches) = RT::System->new( $session{'CurrentUser'} )->Attributes->Named('SavedSearch'); + foreach my $custom (@custom_searches) { + if ($custom->Description eq $Name) { $search = $custom; last } + } + unless ($search && $search->id) { + $m->out("Predefined search $Name not found"); + return; + } + } + + $SearchArg = $user->Preferences( $search, $search->Content ); + if ($ShowCustomize) { + $customize = RT->Config->Get('WebPath') . '/Prefs/Search.html?' + . $m->comp( '/Elements/QueryString', + name => ref($search) . '-' . $search->Id ); + } +} + +# ProcessedSearchArg is a search with overridings, but for link we use +# orginal search's poperties +my $ProcessedSearchArg = $SearchArg; +$ProcessedSearchArg = { %$SearchArg, %Override } if keys %Override; + +$m->callback( + %ARGS, + CallbackName => 'ModifySearch', + OriginalSearch => $SearchArg, + Search => $ProcessedSearchArg, +); + +foreach ( $SearchArg, $ProcessedSearchArg ) { + $_->{'Format'} ||= ''; + + $_->{'Format'} =~ s/__(Web(?:Path|Base|BaseURL))__/scalar RT->Config->Get($1)/ge; + # extract-message-catalog would "$1", so we avoid quotes for loc calls + $_->{'Format'} =~ s/__loc\(["']?(\w+)["']?\)__/my $f = "$1"; loc($f)/ge; + if ( $_->{'Query'} =~ /__Bookmarked__/ ) { + $_->{'Rows'} = 999; + } + elsif ( $_->{'Query'} =~ /__Bookmarks__/ ) { + $_->{'Rows'} = 999; + + # DEPRECATED: will be here for a while up to 3.10/4.0 + my $bookmarks = $session{'CurrentUser'}->UserObj->FirstAttribute('Bookmarks'); + $bookmarks = $bookmarks->Content if $bookmarks; + $bookmarks ||= {}; + my $query = join(" OR ", map " id = '$_' ", grep $bookmarks->{ $_ }, keys %$bookmarks ) || 'id=0'; + $_->{'Query'} =~ s/__Bookmarks__/( $query )/g; + } +} + +my $QueryString = '?' . $m->comp( '/Elements/QueryString', %$SearchArg ); + +</%init> +<%ARGS> +$Name => undef +$SavedSearch => undef +%Override => () +$IgnoreMissing => undef +$hideable => 1 +$ShowCustomize => 1 +</%ARGS> diff --git a/rt/share/html/Elements/ShowUser b/rt/share/html/Elements/ShowUser new file mode 100644 index 000000000..2fbdcbc3e --- /dev/null +++ b/rt/share/html/Elements/ShowUser @@ -0,0 +1,69 @@ +%# 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 }}} +%# Released under the terms of version 2 of the GNU Public License +<%INIT> +# $User is an RT::User object +# $Address is Email::Address object +if ( !$User && $Address ) { + $User = RT::User->new( $session{'CurrentUser'} ); + $User->LoadByEmail( $Address->address ); + unless ( $User->Id ) { + $m->comp( '/Elements/ShowUserVerbose', Address => $Address ); + return; + } +} +if ( $style eq 'concise' ) { + $m->comp( '/Elements/ShowUserConcise', User => $User ); +} +else { $m->comp( '/Elements/ShowUserVerbose', User => $User ); } +</%INIT> +<%ARGS> +$User => undef +$Address => undef +$style => RT->Config->Get('UsernameFormat', $session{'CurrentUser'}) +</%ARGS> diff --git a/rt/share/html/Elements/ShowUserConcise b/rt/share/html/Elements/ShowUserConcise new file mode 100644 index 000000000..3cdba10dd --- /dev/null +++ b/rt/share/html/Elements/ShowUserConcise @@ -0,0 +1,52 @@ +%# 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 }}} +%# Released under the terms of version 2 of the GNU Public License +<% $User->RealName || $User->Name %>\ +<%ARGS> +$User +</%ARGS> diff --git a/rt/share/html/Elements/ShowUserEmailFrequency b/rt/share/html/Elements/ShowUserEmailFrequency new file mode 100644 index 000000000..b7654944b --- /dev/null +++ b/rt/share/html/Elements/ShowUserEmailFrequency @@ -0,0 +1,56 @@ +%# 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 }}} +(<% loc($frequency) %>) +<%INIT> +my $frequency = $User->EmailFrequency( Ticket => $Ticket ); +return unless $frequency; +</%INIT> +<%ARGS> +$User +$Ticket => undef +</%ARGS> diff --git a/rt/share/html/Elements/ShowUserVerbose b/rt/share/html/Elements/ShowUserVerbose new file mode 100644 index 000000000..82d65b0b3 --- /dev/null +++ b/rt/share/html/Elements/ShowUserVerbose @@ -0,0 +1,73 @@ +%# 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 }}} +%# Released under the terms of version 2 of the GNU Public License +<%$Address->format%>\ +<%INIT> +my ($phrase, $address, $comment); + +if ($User) { + $address = $User->EmailAddress; + $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 ); +} + +$Address->comment('') if $comment && 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$/; +} + +</%INIT> +<%ARGS> +$User => undef +$Address => undef +</%ARGS> diff --git a/rt/share/html/Elements/SimpleSearch b/rt/share/html/Elements/SimpleSearch new file mode 100755 index 000000000..16b55fcee --- /dev/null +++ b/rt/share/html/Elements/SimpleSearch @@ -0,0 +1,53 @@ +%# 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 }}} +<form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" id="simple-search"> + <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<&|/l&>Search</&>..." onfocus="if (this.value=='<&|/l&>Search</&>...') this.value=''" /> +</form> +<%ARGS> +$SendTo => '/Search/Simple.html' +</%ARGS> diff --git a/rt/share/html/Elements/Submit b/rt/share/html/Elements/Submit new file mode 100755 index 000000000..79d87a6c8 --- /dev/null +++ b/rt/share/html/Elements/Submit @@ -0,0 +1,103 @@ +%# 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 }}} +<div class="submit" +% if($id) { +id="<%$id%>" +% } +> + <div class="extra-buttons"> +% if ($CheckAll) { + <input type="button" value="<%$CheckAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', true);return false;" class="button" /> +% } +% if ($ClearAll) { + <input type="button" value="<%$ClearAllLabel%>" onclick="setCheckbox(this.form, '<% $CheckboxName %>', false);return false;" class="button" /> +% } +% if ($Reset) { + <input type="reset" value="<%$ResetLabel%>" class="button" /> +% } + </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" /> +% } + +% if ($AlternateLabel) { + <span class="caption"><%$AlternateCaption%></span> + <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | 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" /> +% } + </div> + <div class="submit-clear"></div> +</div> + +<%ARGS> +$color => undef +$Caption => '' +$AlternateCaption => undef +$AlternateLabel => undef +$Label => loc('Submit') +$Name => undef +$CheckAll => undef +$CheckAllLabel => loc('Check All') +$ClearAll => undef +$ClearAllLabel => loc('Clear All') +$CheckboxName => '' +$Back => undef +$BackName => 'Back' +$BackLabel => loc('Back') +$BackCaption => '' +$BackOnClick => undef +$OnClick => undef +$Reset => undef +$ResetLabel => loc('Reset') +$id => undef +</%ARGS> diff --git a/rt/share/html/Elements/Tabs b/rt/share/html/Elements/Tabs new file mode 100755 index 000000000..0e0ab978d --- /dev/null +++ b/rt/share/html/Elements/Tabs @@ -0,0 +1,128 @@ +%# 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/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, +&> +<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' + }; +} + +if ($session{'CurrentUser'}->HasRight( Right => 'ShowApprovalsTab', + Object => $RT::System )) { + $basetabs->{P} = { title => loc('Approval'), + path => 'Approvals/' + }; +} + +if (!defined $toptabs) { + $toptabs = $basetabs; +} +if (!defined $topactions) { + $topactions = $basetopactions; +} + +# 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 +</%ARGS> diff --git a/rt/share/html/Elements/TicketList b/rt/share/html/Elements/TicketList new file mode 100644 index 000000000..059ad7be0 --- /dev/null +++ b/rt/share/html/Elements/TicketList @@ -0,0 +1,70 @@ +%# 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 }}} +<%INIT> +$m->comp( + '/Elements/CollectionList', + %ARGS, + Class => 'RT::Tickets' + ); +</%INIT> +<%ARGS> +$Collection => undef +$Query => undef +$Format => RT->Config->Get('DefaultSearchResultFormat') +$DisplayFormat => undef +$Order => undef +$OrderBy => undef +$Rows => 50 +$Page => 1 +$Title => loc('Ticket Search') +$BaseURL => undef +$AllowSorting => undef +$ShowNavigation => 1 +$ShowHeader => 1 +$ShowEmpty => 0 +</%ARGS> diff --git a/rt/share/html/Elements/TitleBox b/rt/share/html/Elements/TitleBox new file mode 100644 index 000000000..1efb45a80 --- /dev/null +++ b/rt/share/html/Elements/TitleBox @@ -0,0 +1,51 @@ +%# 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 }}} +<%init> +# For compatibility with 3.4 +$m->comp('/Widgets/TitleBox', %ARGS ); +</%init> diff --git a/rt/share/html/Elements/TitleBoxEnd b/rt/share/html/Elements/TitleBoxEnd new file mode 100644 index 000000000..1c10a866c --- /dev/null +++ b/rt/share/html/Elements/TitleBoxEnd @@ -0,0 +1,51 @@ +%# 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 }}} +<%init> +# For compatibility with 3.4 +$m->comp('/Widgets/TitleBoxEnd', %ARGS ); +</%init> diff --git a/rt/share/html/Elements/TitleBoxStart b/rt/share/html/Elements/TitleBoxStart new file mode 100644 index 000000000..65e750348 --- /dev/null +++ b/rt/share/html/Elements/TitleBoxStart @@ -0,0 +1,51 @@ +%# 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 }}} +<%init> +# For compatibility with 3.4 +$m->comp('/Widgets/TitleBoxStart', %ARGS ); +</%init> diff --git a/rt/share/html/Elements/ValidateCustomFields b/rt/share/html/Elements/ValidateCustomFields new file mode 100644 index 000000000..0253e1cbc --- /dev/null +++ b/rt/share/html/Elements/ValidateCustomFields @@ -0,0 +1,100 @@ +%# 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 }}} +<%INIT> +my ($valid, @res) = (1, ()); +$CustomFields->GotoFirstItem; +while ( my $CF = $CustomFields->Next ) { + my $field = $NamePrefix . $CF->Id . "-Value"; + + my $value; + if ($ARGSRef->{"${field}s-Magic"} and exists $ARGSRef->{"${field}s"}) { + $value = $ARGSRef->{"${field}s"}; + + # We only validate Single Combos -- multis can never be user input + next if ref $value; + } + else { + $value = $ARGSRef->{$field}; + } + $m->notes(('Field-' . $CF->Id) => $value); + + my @values = (); + if ( ref $value eq 'ARRAY' ) { + @values = @$value; + } elsif ( $CF->Type =~ /text/i ) { + @values = ($value); + } else { + @values = split /\r*\n/, ( defined $value ? $value : ''); + } + @values = grep $_ ne '', + map { + s/\r+\n/\n/g; + s/^\s+//; + s/\s+$//; + $_; + } + grep defined, @values; + @values = ('') unless @values; + + foreach my $value( @values ) { + next if $CF->MatchPattern($value); + + my $msg = loc("Input must match [_1]", $CF->FriendlyPattern); + $m->notes( ('InvalidField-' . $CF->Id) => $msg ); + push @res, $msg; + $valid = 0; + } +} +$m->notes('ValidFields', $valid); +return wantarray? ($valid, @res): $valid; +</%INIT> +<%ARGS> +$CustomFields +$ARGSRef +$NamePrefix => "Object-RT::Ticket--CustomField-" +</%ARGS> |