diff options
Diffstat (limited to 'rt/share/html/Widgets')
-rw-r--r-- | rt/share/html/Widgets/BulkEdit | 67 | ||||
-rw-r--r-- | rt/share/html/Widgets/BulkProcess | 73 | ||||
-rw-r--r-- | rt/share/html/Widgets/ComboBox | 77 | ||||
-rw-r--r-- | rt/share/html/Widgets/FinalizeWidgetArguments | 64 | ||||
-rw-r--r-- | rt/share/html/Widgets/Form/Boolean | 103 | ||||
-rw-r--r-- | rt/share/html/Widgets/Form/Integer | 99 | ||||
-rw-r--r-- | rt/share/html/Widgets/Form/Select | 165 | ||||
-rw-r--r-- | rt/share/html/Widgets/Form/String | 108 | ||||
-rw-r--r-- | rt/share/html/Widgets/SavedSearch | 189 | ||||
-rw-r--r-- | rt/share/html/Widgets/SelectionBox | 254 | ||||
-rw-r--r-- | rt/share/html/Widgets/TitleBox | 54 | ||||
-rwxr-xr-x | rt/share/html/Widgets/TitleBoxEnd | 59 | ||||
-rwxr-xr-x | rt/share/html/Widgets/TitleBoxStart | 97 |
13 files changed, 1409 insertions, 0 deletions
diff --git a/rt/share/html/Widgets/BulkEdit b/rt/share/html/Widgets/BulkEdit new file mode 100644 index 000000000..facf57f30 --- /dev/null +++ b/rt/share/html/Widgets/BulkEdit @@ -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 }}} +% for my $type ( @$Types ) { +<& $Meta->{$type}{'Widget'}, + Default => $Default, + %{ $m->comp('/Widgets/FinalizeWidgetArguments', WidgetArguments => + $Meta->{$type}{'WidgetArguments'} ) }, + Name => $type, + exists $CurrentValue->{$type} ? ( CurrentValue => $CurrentValue->{$type} ) + : (), + exists $DefaultValue->{$type} ? ( DefaultValue => $DefaultValue->{$type} ) + : (), +&> +% } + +<%args> +$Types +$Meta +$Default => 0 +$CurrentValue => {} +$DefaultValue => {} +</%args> diff --git a/rt/share/html/Widgets/BulkProcess b/rt/share/html/Widgets/BulkProcess new file mode 100644 index 000000000..436808e92 --- /dev/null +++ b/rt/share/html/Widgets/BulkProcess @@ -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 }}} +<%init> +for my $type ( @$Types ) { + my $value = + $m->comp( $Meta->{$type}{Widget} . ':Process', Name => $type, + Arguments => $Arguments, Default => $Default, + DefaultValue => $DefaultValue->{$type}, + %{ $Meta->{$type}{WidgetArguments} }, + ); + unless ( $KeepUndef || defined $value ) { + delete $Store->{$type}; + } + else { + $Store->{$type} = $value; + } +} +</%init> + +<%args> +$Arguments +$Types +$Store +$Meta => {} +$KeepUndef => 0 +$Default => 0 +$DefaultValue => {} +</%args> diff --git a/rt/share/html/Widgets/ComboBox b/rt/share/html/Widgets/ComboBox new file mode 100644 index 000000000..04f7b2536 --- /dev/null +++ b/rt/share/html/Widgets/ComboBox @@ -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> +# the $z_index here is to fix wrong z-index bug in ie7 +my $z_index = 9999; +</%once> +%# reset $z_index. assuming at most 1000 comboboxx in one page +% $z_index = 9999 if $z_index < 9000; +<nobr> +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/combobox.js"></script> + +<div id="<% $Name %>_Container" class="combobox <%$Class%>" style="z-index: <%$z_index--%>"> +<input name="<% $Name %>" id="<% $Name %>" class="combo-text" value="<% $Default || '' %>" type="text" <% $Size ? "size='$Size'" : '' |n %> autocomplete="off" /> +<br style="display: none" /><span id="<% $Name %>_Button" class="combo-button">▼</span><select name="List-<% $Name %>" id="<% $Name %>_List" class="combo-list" onchange="ComboBox_SimpleAttach(this, this.form['<% $Name %>']); " size="<% $Rows %>"> +<option style="display: none" value="">-</option> +% foreach my $value (@Values) { + <option value="<%$value%>"><% $value%></option> +% } +</select> +</div> +<script language="javascript"><!-- +ComboBox_InitWith('<% $Name %>'); +//--></script> +</nobr> +<%ARGS> +$Name +$Size => undef +$Rows => 5 +$Default => '' +@Values => () +$Class => '' +</%ARGS> diff --git a/rt/share/html/Widgets/FinalizeWidgetArguments b/rt/share/html/Widgets/FinalizeWidgetArguments new file mode 100644 index 000000000..61451a560 --- /dev/null +++ b/rt/share/html/Widgets/FinalizeWidgetArguments @@ -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 %args = %$WidgetArguments; + + %args = (%args, %{ $args{Callback}->() }) if $args{Callback}; + $args{'Description'} = loc( $args{'Description'} ) if $args{'Description'}; + $args{'Hints'} = loc( $args{'Hints'} ) if $args{'Hints'}; + if ( $args{'ValuesLabel'} ) { + while (my ($k, $v) = each %{ $args{'ValuesLabel'} } ) { + $args{'ValuesLabel'}->{$k} = loc( $args{'ValuesLabel'}->{$k} ); + } + } + return \%args; +</%init> + +<%args> +$WidgetArguments => {} +</%args> diff --git a/rt/share/html/Widgets/Form/Boolean b/rt/share/html/Widgets/Form/Boolean new file mode 100644 index 000000000..505d782b6 --- /dev/null +++ b/rt/share/html/Widgets/Form/Boolean @@ -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 }}} +<%DOC> +see docs/using_forms_widgets.pod +</%DOC> +<div id="form-box-<% lc $Name %>" class="widget"> +<span class="label description"><% $Description %></span> +<span class="value"><& SELF:InputOnly, %ARGS &></span> +<span class="hints"><% $Hints %></span> +</div> +<%ARGS> +$Name => undef, +$Description => undef, +$Hints => '' +</%ARGS> + +<%METHOD InputOnly> +<%ARGS> +$Name => undef, + +$Default => 0, +$DefaultValue => 0, +$DefaultLabel => loc( 'Use default ([_1])', $DefaultValue? loc('Yes'): loc('No') ), + +$CurrentValue => undef, +</%ARGS> +% unless ( $Default ) { +<input type="hidden" name="<% $Name %>" value="0" />\ +<input type="checkbox" name="<% $Name %>" value="1" <% $CurrentValue? ' checked="checked"': '' |n %> />\ +% } else { +<input type="radio" name="<% $Name %>" value="1" <% $CurrentValue? ' checked="checked"': '' |n %> />\ +<% loc('Yes') %> +<input type="radio" name="<% $Name %>" value="0" <% defined $CurrentValue && !$CurrentValue? ' checked="checked"': '' |n %> />\ +<% loc('No') %> +<input type="radio" name="<% $Name %>" value="__empty_value__" <% !defined $CurrentValue? ' checked="checked"': '' |n %> />\ +<% $DefaultLabel %> +% } +</%METHOD> + +<%METHOD Process> +<%ARGS> +$Name +$Arguments => {}, + +$Default => 0, +$DefaultValue => 0, +</%ARGS> +<%INIT> +my $value = $Arguments->{ $Name }; +if ( $Default ) { + return undef if !defined $value || $value eq '__empty_value__'; + return $value? 1: 0; +} else { + return $value? 1: 0 if defined $value; + return $DefaultValue; +} +</%INIT> +</%METHOD> diff --git a/rt/share/html/Widgets/Form/Integer b/rt/share/html/Widgets/Form/Integer new file mode 100644 index 000000000..9d53ac5c3 --- /dev/null +++ b/rt/share/html/Widgets/Form/Integer @@ -0,0 +1,99 @@ +%# 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 }}} +<%DOC> +see docs/using_forms_widgets.pod +</%DOC> +<div id="form-box-<% lc $Name %>" class="widget"> +<span class="label description"><% $Description %></span> +<span class="value"><& SELF:InputOnly, %ARGS &></span> +% if ( $Default ) { +<span class="comment"><% $DefaultLabel %></span> +% } +<span class="hints"><% $Hints %></span> +</div> +<%INIT> +</%INIT> +<%ARGS> +$Name + +$Description => undef, +$Hints => '' + +$CurrentValue => '', + +$Default => 0, +$DefaultValue => 0, +$DefaultLabel => loc( 'Default: [_1]', $DefaultValue ), +</%ARGS> + +<%METHOD InputOnly> +<input type="text" name="<% $Name %>" value="<% $CurrentValue || '' %>" />\ +<%ARGS> +$Name +$CurrentValue => '', +</%ARGS> +</%METHOD> + +<%METHOD Process> +<%ARGS> +$Name + +$Arguments => {}, + +$Default => 0, +$DefaultValue => '', +</%ARGS> +<%INIT> +my $value = $Arguments->{ $Name }; +if ( !defined $value || $value eq '' ) { + return $DefaultValue unless $Default; + return undef; +} +return $value; +</%INIT> +</%METHOD> diff --git a/rt/share/html/Widgets/Form/Select b/rt/share/html/Widgets/Form/Select new file mode 100644 index 000000000..e77861740 --- /dev/null +++ b/rt/share/html/Widgets/Form/Select @@ -0,0 +1,165 @@ +%# 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 }}} +<%DOC> +see docs/using_forms_widgets.pod +</%DOC> +<div id="form-box-<% lc $Name %>" class="widget"> +% if ( $Description ) { +<span class="label"><% $Description %></span> +% } +<span class="value"><& SELF:InputOnly, %ARGS &></span> +</div> +<%ARGS> +$Name +$Description => undef, +</%ARGS> + +<%METHOD InputOnly> +<%ARGS> +$Name +$Description => undef, + +@Values => (), +$ValuesCallback => undef, +%ValuesLabel => (), +@CurrentValue => (), + +$Default => 1, +@DefaultValue => (), +$DefaultLabel => undef, + +$Alternative => 0, +$AlternativeLabel => loc('other...'), + +$Multiple => 0, +</%ARGS> +<select name="<% $Name %>"> + +% if ( $Default ) { +% my $selected = ''; +% $selected = 'selected="selected"' unless @CurrentValue; +<option value="__empty_value__" <% $selected |n %>><% $DefaultLabel %></option> +% } + +% foreach my $v( @Values ) { +% my $selected = ''; +% $selected = 'selected="selected"' if delete $CurrentValue{ $v }; +<option value="<% $v %>" <% $selected |n %>><% loc($ValuesLabel{ $v } || $v) %></option> +% } + +% if ( $Alternative ) { +% my $selected = ''; +% $selected = 'selected="selected"' if keys %CurrentValue; +<option value="__alternative_value__" <% $selected |n %>><% $AlternativeLabel %></option> +% } + +</select> +% if ( $Alternative ) { +<input type="text" class="alternative" name="Alternative-<% $Name %>" value="<% join ', ', @CurrentValue %>" /> +% } +<%INIT> +my %CurrentValue = map {$_ => 1} grep defined, @CurrentValue; +if ( $ValuesCallback ) { + my $values = $ValuesCallback->( + CurrentUser => $session{'CurrentUser'}, + Name => $Name, + ); + if ( ref $values eq 'ARRAY' ) { + @Values = @$values; + } else { + %ValuesLabel = %$values; + @Values = keys %ValuesLabel; + } +} +unless (defined $DefaultLabel ) { + $DefaultLabel = loc('Use system default ([_1])', join ', ', map{ loc($ValuesLabel{$_} || $_) } @DefaultValue); +} +</%INIT> +</%METHOD> + +<%METHOD Process> +<%ARGS> +$Name + +$Arguments => {}, + +@Values => (), +%ValuesLabel => (), + +$Default => 0, +@DefaultValue => (), + +$Alternative => 0, +$Multiple => 0, +</%ARGS> +<%INIT> +my $value = $Arguments->{ $Name }; +if( !defined $value || $value eq '__empty_value__' ) { + return undef if $Default; + return [ @DefaultValue ] if $Multiple; + return $DefaultValue[0]; +} +$value = [$value] unless ref $value; + +if ( $Alternative ) { + my $alt = $Arguments->{ "Alternative-". $Name }; + if( $Multiple ) { + push @$value, split /\s*,\s*/, $alt; + } else { + push @$value, $alt; + } +} + +splice @$value, 1 unless $Multiple; + +# XXX: check values + +return $value->[0] unless $Multiple; +return $value; +</%INIT> +</%METHOD> diff --git a/rt/share/html/Widgets/Form/String b/rt/share/html/Widgets/Form/String new file mode 100644 index 000000000..de5c70035 --- /dev/null +++ b/rt/share/html/Widgets/Form/String @@ -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 }}} +<%DOC> +see docs/using_forms_widgets.pod +</%DOC> +<div id="form-box-<% lc $Name %>" class="widget"> +<span class="description label"><% $Description %></span> +<span class="value"><& SELF:InputOnly, %ARGS &></span> +% if ( $Default ) { +<span class="comment"><% $DefaultLabel %></span> +% } +<span class="hints"><% $Hints %></span> +</div> +<%ARGS> +$Name + +$Description => undef, +$Hints => '' + +$CurrentValue => '', + +$Default => 0, +$DefaultValue => '', +$DefaultLabel => loc( 'Default: [_1]', $DefaultValue ), +</%ARGS> + +<%METHOD InputOnly> +<input type="<% $Type %>" name="<% $Name %>" value="<% $CurrentValue || '' %>" />\ +<%ARGS> +$Name +$CurrentValue => '', +$Type => 'text' +</%ARGS> +</%METHOD> + +<%METHOD Process> +<%ARGS> +$Name + +$Arguments => {}, + +$Default => 0, +$DefaultValue => '', +</%ARGS> +<%INIT> +my $value = $Arguments->{ $Name }; +$value = '' unless defined $value; + +# canonicalize: delete leading and trailing spaces, replaces newlines +# with one space and then replace all continuouse spaces with one ' ' +# (including tabs and other fancy things) +$value =~ s/^\s+//; +$value =~ s/\s+$//; +$value =~ s/\r*\n/ /g; +$value =~ s/\s+$/ /g; + +if ( $value eq '' ) { + return $DefaultValue unless $Default; + return undef; +} +return $value; +</%INIT> +</%METHOD> diff --git a/rt/share/html/Widgets/SavedSearch b/rt/share/html/Widgets/SavedSearch new file mode 100644 index 000000000..d3348b32a --- /dev/null +++ b/rt/share/html/Widgets/SavedSearch @@ -0,0 +1,189 @@ +%# 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 }}} +<%method new> +<%init> +return \%ARGS; +</%init> +</%method> + +<%method process> + +<%init> +my @actions; +my @Objects = RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects; +push @Objects, RT::System->new($session{'CurrentUser'}) + if $session{'CurrentUser'}->HasRight( Object=> $RT::System, + Right => 'SuperUser' ); +$self->{SearchId} ||= $args->{'SavedChartSearchId'} || 'new'; + +my $SearchParams = { map { $_ => $args->{$_} } @{$self->{SearchFields}} }; + +if ( my ( $container_object, $search_id ) = _parse_saved_search( + $args->{'SavedSearchLoad'} || $args->{'SavedChartSearchId'} ) ) { + my $search = $container_object->Attributes->WithId($search_id); + # We have a $search and now; import the others + $self->{SearchId} = $args->{'SavedSearchLoad'} || + $args->{'SavedChartSearchId'}; + $self->{CurrentSearch}{Object} = $search; + if ( $args->{'SaveSearchLoad'} ) { + for ( @{ $self->{SearchFields} } ) { + $args->{$_} = $search->SubValue($_) + } + } + + $args->{SavedChartSearchId} = $args->{'SavedSearchLoad'} + if $args->{'SavedSearchLoad'}; +# saved search in /Search/Chart.html is different from /Search/Build.html +# the former is of type 'Chart', while the latter is of type 'Ticket'. +# After loading a saved search from the former after loading one from the +# latter, accessing /Search/Build.html will still show the old one, so we +# need to delete $session{CurrentSearchHash} to let it not show the old one. +# of course, the new one should not be shown there either because it's of +# different type + delete $session{'CurrentSearchHash'}; +} + +# look for the current one in the available saved searches +if ($self->{SearchId} eq 'new') { + for my $obj (@Objects) { + for ( $m->comp( "/Search/Elements/SearchesForObject", Object => $obj ) ) { + my ( $desc, $search ) = @$_; + use Data::Dumper; + # FFS + local $Data::Dumper::Sortkeys = 1; + if ( Dumper( $search->Content ) eq + Dumper( { %$SearchParams, SearchType => $self->{SearchType} } ) ) { + $self->{CurrentSearch}{Object} = $search; + $self->{SearchId} = $search->Id; + } + } + } +} + +if ( $args->{SavedSearchSave} ) { + if ( my $search = $self->{CurrentSearch}{Object} ) { + # rename + $search->SetDescription( $args->{SavedSearchDescription} ); + $search->SetSubValues(%$SearchParams); + push @actions, loc( '[_1] [_2] updated.', loc($self->{SearchType}), $args->{SavedSearchDescription} ); + } + else { + # new saved search + my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} ); + my ( $ok, $search_msg ) = $saved_search->Save( + Privacy => $args->{'SavedSearchOwner'}, + Name => $args->{'SavedSearchDescription'}, + Type => $self->{'SearchType'}, + SearchParams => $SearchParams + ); + if ($ok) { + $self->{CurrentSearch}{Object} = $saved_search->{Attribute}; + $self->{SearchId} = $args->{SavedChartSearchId} = 'RT::User-' . + $session{CurrentUser}->id . '-SavedSearch-' . + $saved_search->Id; + push @actions, loc( '[_1] [_2] saved.', loc($self->{SearchType}), $args->{SavedSearchDescription} ); + } else { + push @actions, + [ loc("Can't save [_1]", loc($self->{SearchType})) . ': ' . loc($search_msg), 0 ]; + } + } +} + +if ( $args->{SavedSearchDelete} && $self->{CurrentSearch}{Object} ) { + my ($ok, $msg) = $self->{CurrentSearch}{Object}->Delete; + push @actions, $ok ? loc( '[_1] [_2] deleted.', loc($self->{SearchType}), $self->{CurrentSearch}{Object}->Description ) : $msg; + delete $self->{CurrentSearch}{Object}; + delete $self->{SearchId}; + delete $args->{SavedChartSearchId}; +} + +$self->{CurrentSearch}{Description} = $self->{CurrentSearch}{Object}->Description + if $self->{CurrentSearch}{Object}; + +return @actions; +</%init> +<%ARGS> +$self +$args +</%ARGS> + +</%method> + +<%method show> +<form method="post" action="<% $Action %>" name="SaveSearch"> +<& /Search/Elements/EditSearches, + Id => $self->{SearchId} || 'new', + Type => $self->{SearchType}, + CurrentSearch => $self->{CurrentSearch}, + Title => $Title, + AllowCopy => 0, + $self->{CurrentSearch}{Object} ? + ( Object => $self->{CurrentSearch}{Object}, + Description => $self->{CurrentSearch}{Object}->Description, ) : (), +&><br /> +<%PERL> +foreach my $field ( @{$self->{SearchFields}} ) { + if ( ref($ARGS{$field}) && ref($ARGS{$field}) ne 'ARRAY' ) { + $RT::Logger->error("Couldn't store '$field'. it's reference to ". ref($ARGS{$field}) ); + next; + } + foreach my $value ( grep defined, ref($ARGS{$field})? @{ $ARGS{$field} } : $ARGS{$field} ) { +</%PERL> +<input type="hidden" class="hidden" name="<% $field %>" value="<% $value %>" /> +% } +% } +<input type="hidden" class="hidden" name="SavedChartSearchId" value="<% $self->{SearchId} || 'new' %>" /> +</form> +<%ARGS> +$self => undef +$Action => '' +$Title => loc('Saved searches') +</%ARGS> +<%init> +</%init> +</%method> diff --git a/rt/share/html/Widgets/SelectionBox b/rt/share/html/Widgets/SelectionBox new file mode 100644 index 000000000..fe649484c --- /dev/null +++ b/rt/share/html/Widgets/SelectionBox @@ -0,0 +1,254 @@ +%# 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 }}} +%# The SelectionBox Widget +%# +%# SYNOPSIS +%# +%# include javascript: +%# <& /Widgets/SelectionBox:header &> +%# +%# <%init>: +%# my $sel = $m->comp ('/Widgets/SelectionBox:new', +%# Action => me.html', +%# Name => 'my-selection', +%# Available => \@items, +%# # you can do things with @{$sel->{Current}} in the +%# # OnSubmit callback +%# OnSubmit => sub { my $sel = shift; }, +%# Selected => \@selected); +%# +%# $m->comp ('/Widgets/SelectionBox:process', %ARGS, self => $sel) +%# +%# where @items is an arrayref, each element is [value, label], +%# and @selected is an arrayref of selected values from @items. +%# +%# and in html: +%# <& /Widgets/SelectionBox:show, self => $sel &> +%# +%# if the SelectionBox is created with AutoSave option, OnSubmit will be called +%# on every button clicked in non-js mode. +<%method header> +% unless ($nojs) { +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/class.js"></script> +<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/list.js"></script> +% } +<%ARGS> +$nojs => 0 +</%ARGS> +</%method> + +<%method new> +<%init> +$ARGS{_item_map} = {map {$_->[0] => $_->[1]} @{$ARGS{Available}}}; +return \%ARGS; +</%init> +</%method> + +<%method process> +<%init> +unless ($ARGS{$self->{Name}.'-Submit'}) { + # init + $self->{Current} = $self->{Selected}; + $self->{Selected} = []; + return; +} + +$self->{Selected} = $ARGS{$self->{Name}.'-Selected'}; +if ($self->{Selected} && !ref($self->{Selected})) { + $self->{Selected} = [$self->{Selected}]; +} + +if ($ARGS{fromjs}) { + $self->{Current} = $self->{Selected}; +} +else { + my $current = $self->{Current} = $ARGS{$self->{Name}.'-Current'}; + if ($current && !ref ($current)) { + $current = [$current]; + } + + unless ($self->{ReadOnly}) { + ++$self->{Modified}; + if ($ARGS{add}) { + my $choosed = $ARGS{$self->{Name}.'-Available'}; + for my $add (ref($choosed) ? @$choosed : $choosed) { + next if grep { $_ eq $add } @$current; + push @$current, $add; + } + } + + if ($ARGS{remove}) { + my $choosed = $ARGS{$self->{Name}.'-Selected'}; + for my $del (ref($choosed) ? @$choosed : $choosed) { + @$current = map { $_ eq $del ? () : $_ } @$current; + } + } + + if ($ARGS{moveup} or $ARGS{movedown}) { + my $offset = $ARGS{moveup} ? 1 : 0; + my $choosed = $ARGS{$self->{Name}.'-Selected'}; + $choosed = [$choosed] unless ref ($choosed); + my $canmove = 0; # not in the cornor + for my $i ($ARGS{moveup} ? 0..$#{$current} : reverse 0..$#{$current}) { + if (grep {$_ eq $current->[$i]} @$choosed) { + if ($canmove) { + splice (@$current, $i-$offset, 2, + @{$current}[$i+1-$offset,$i-$offset]); + } + } + else { + ++$canmove; + } + } + } + + if ($ARGS{clear}) { + $current = []; + } + + $self->{Current} = $current; + } +} + +@{$self->{Current}} = grep { exists $self->{_item_map}{$_} } @{$self->{Current}}; + +if ($self->{AutoSave} or $ARGS{$self->{Name}.'-Save'}) { + $self->{OnSubmit}->($self); + delete $self->{Modified}; +} + +</%init> +<%ARGS> +$self => undef +</%ARGS> + +</%method> + +<%method current> +% for (@{$self->{Current}}) { +<input type="hidden" class="hidden" name="<% $self->{Name} %>-Current" value="<%$_%>" /> +% } +<%INIT> +</%INIT> +<%ARGS> +$self => undef +</%ARGS> + +</%method> + +<%method show> +<form method="post" action="<%$self->{Action}%>" name="SelectionBox-<% $name %>" id="SelectionBox-<% $name %>" +% unless ($nojs) { +onsubmit="list_<% $name %>.selectAll();" +% } +> +<input type="hidden" class="hidden" name="<% $self->{Name} %>-Submit" value="1" /> +<& SelectionBox:current, self => $self &> +<input type="hidden" class="hidden" name="fromjs" value="0" /> +<&|/l&>Available</&>: +<br /> +<select name="<%$name%>-Available" id="<%$name%>-Available" size="<%$size%>" multiple="multiple"> +% for (@{$self->{Available}}) { +<option value="<% $_->[0] %>"><% $_->[1] %></option> +% } +</select> + +% unless ($self->{ReadOnly}) { +<input name="add" type="submit" class="button" value=" → " /> +% } + +<select name="<%$name%>-Selected" id="<%$name%>-Selected" size="<%$size%>" multiple="multiple"> +% for (@{$self->{Current}}) { +<option value="<% $_ %>" +% if (exists $selected{$_}) { +selected="selected" +% } +><% $self->{_item_map}{$_} ||'' %></option> +% } +</select> +% unless ($self->{'ReadOnly'}) { +% unless ($ARGS{'NoArrows'}) { + <input name="moveup" type="submit" class="button" value=" ↑ " /> + <input name="movedown" type="submit" class="button" value=" ↓ " /> +% } + <input name="remove" type="submit" class="button" value="<&|/l&>Delete</&>" /> +% if ($ARGS{'Clear'}) { + <input name="clear" type="submit" class="button" value="<&|/l&>Clear</&>" /> +% } +% if ( $ARGS{'ShowUpdate'} ) { + <input name="update" type="submit" class="button" value="<&|/l&>Update</&>" /> +% } +% } + +% my $caption = ""; +% unless ($self->{'AutoSave'}) { +% if ($self->{Modified}) { +% $caption = loc('Selections modified. Please save your changes'); +% } +<& /Elements/Submit, Caption => loc($caption), Label => loc('Save'), Name => $name.'-Save' &> +% } +</form> + +% unless ($nojs) { +<script type="text/javascript"> +//<![CDATA[ +var list_<%$name%> = new list(document.getElementById("SelectionBox-<% $name %>"), 0, "list_<%$name%>"); +//]]> +</script> +% } +<%ARGS> +$self => undef +$size => 10 +$nojs => 0 +</%ARGS> +<%INIT> +my $name = $self->{Name}; +my %selected = map {$_ => 1} @{$self->{Selected}}; +</%INIT> + +</%method> diff --git a/rt/share/html/Widgets/TitleBox b/rt/share/html/Widgets/TitleBox new file mode 100644 index 000000000..0e7437702 --- /dev/null +++ b/rt/share/html/Widgets/TitleBox @@ -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 }}} +<div class="<% $class %>"> + <& TitleBoxStart, %ARGS &><% $m->content | n %><& TitleBoxEnd &> +</div> +<%ARGS> +$class => '' +</%ARGS> + diff --git a/rt/share/html/Widgets/TitleBoxEnd b/rt/share/html/Widgets/TitleBoxEnd new file mode 100755 index 000000000..402124e28 --- /dev/null +++ b/rt/share/html/Widgets/TitleBoxEnd @@ -0,0 +1,59 @@ +%# 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 }}} + <hr class="clear" /> + </div> +</div> + +% #Manually flush the content buffer after each titlebox is displayed +% $m->flush_buffer(); + +<%ARGS> +$title => undef +$content => undef +</%ARGS> + diff --git a/rt/share/html/Widgets/TitleBoxStart b/rt/share/html/Widgets/TitleBoxStart new file mode 100755 index 000000000..624642efb --- /dev/null +++ b/rt/share/html/Widgets/TitleBoxStart @@ -0,0 +1,97 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC +%# <jesse@bestpractical.com> +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<div class="titlebox<% $class ? " $class " : '' %>" id="<% $id %>"> + <div class="titlebox-title<% $title_class ? " $title_class" : ''%>"> +% if ($hideable) { + <span class="widget"><a href="#" + onclick="return rollup('<%$tid%>');" + title="Toggle visibility"></a> + </span> +% } + <span class="left"> + <% $title_href ? qq[<a href="$title_href">] : '' | n + %><% $title %><% $title_raw |n %><% $title_href ? "</a>" : '' |n%></span> + <span class="right<%($titleright_href || $titleright || $titleright_raw) ? '' : '-empty' %>"> + <% $titleright_href ? qq[<a href="$titleright_href">] : '' | n %> + <% $titleright %><% $titleright_raw |n%><% $titleright_href ? "</a>" : '' |n%> + </span> + </div> + <div class="titlebox-content <% $bodyclass %>" id="<% $tid %>"> + +<%ARGS> +$class => '' +$bodyclass => '' +$title_href => '' +$title => '' +$title_raw => '' +$title_class => '' +$titleright_href => '' +$titleright => '' +$titleright_raw => '' +$id => '' +$hideable => 1 +</%ARGS> + +<%init> +# +# This should be pretty bulletproof +# +my $page = $m->request_comp->path; + +my $title_b64 = MIME::Base64::encode_base64(Encode::encode_utf8($title), ''); + +my $tid = "TitleBox--$page--" . + join '--', ($class, $bodyclass, $title_b64, $id); + +$tid =~ s{[^A-Za-z0-9\-_:\.]+}{_}g; + +my $i = 0; +$i++ while $m->notes("$tid-$i"); +$m->notes("$tid-$i" => 1); +$tid = "$tid-$i"; +</%init> |