diff options
author | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-02 19:56:20 +0000 |
commit | ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 (patch) | |
tree | a2ea500cf510739908761a6bfbd14e990131f2cc /rt/html/Widgets | |
parent | a513c0bef534d05f03c1242831b6f3be19b97dae (diff) |
import rt 3.6.4
Diffstat (limited to 'rt/html/Widgets')
-rw-r--r-- | rt/html/Widgets/ComboBox | 69 | ||||
-rw-r--r-- | rt/html/Widgets/SavedSearch | 150 | ||||
-rw-r--r-- | rt/html/Widgets/SelectionBox | 234 | ||||
-rw-r--r-- | rt/html/Widgets/TitleBox | 54 | ||||
-rwxr-xr-x | rt/html/Widgets/TitleBoxEnd | 59 | ||||
-rwxr-xr-x | rt/html/Widgets/TitleBoxStart | 88 |
6 files changed, 654 insertions, 0 deletions
diff --git a/rt/html/Widgets/ComboBox b/rt/html/Widgets/ComboBox new file mode 100644 index 000000000..8fb5682d9 --- /dev/null +++ b/rt/html/Widgets/ComboBox @@ -0,0 +1,69 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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 }}} +<nobr> +<script type="text/javascript" src="<%$RT::WebPath%>/NoAuth/js/combobox.js"></script> + +<span id="<% $Name %>_Container" class="combobox"> +<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></span><select name="List-<% $Name %>" id="<% $Name %>_List" class="combo-list" onchange="ComboBox_SimpleAttach(this, this.form['<% $Name %>']); " rows="<% $Rows %>"> +<option style="display: none" value="">-</option> +% foreach my $value (@Values) { + <option value="<%$value%>"><% $value%></option> +% } +</select> +<script language="javascript"><!-- +ComboBox_InitWith('<% $Name %>'); +//--></script> +</nobr> +<%ARGS> +$Name +$Size => undef +$Rows => 5 +$Default => '' +@Values => () +</%ARGS> diff --git a/rt/html/Widgets/SavedSearch b/rt/html/Widgets/SavedSearch new file mode 100644 index 000000000..b8313daf8 --- /dev/null +++ b/rt/html/Widgets/SavedSearch @@ -0,0 +1,150 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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} ||= 'new'; +my $SearchParams = { map { $_ => $args->{$_} } @{$self->{SearchFields}} }; + +if ( my ( $container_object, $search_id ) = _parse_saved_search( $args->{'LoadSavedSearch'} ) ) { + my $search = $container_object->Attributes->WithId($search_id); + # We have a $search and now; import the others + $self->{SearchId} = $args->{'LoadSavedSearch'}; + $self->{CurrentSearch}{Object} = $search; + $args->{$_} = $search->SubValue($_) for @{ $self->{SearchFields} }; +} + +# 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->{Save} ) { + if ( my $search = $self->{CurrentSearch}{Object} ) { + # rename + $search->SetDescription( $args->{Description} ); + push @actions, loc($self->{SearchType}).loc( ' [_1] renamed to [_2].', $self->{CurrentSearch}{Description}, $args->{Description} ); + } + else { + # new saved search + my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} ); + my ( $ok, $search_msg ) = $saved_search->Save( + Privacy => $args->{'Owner'}, + Name => $args->{'Description'}, + Type => $self->{'SearchType'}, + SearchParams => $SearchParams + ); + if ($ok) { + $self->{CurrentSearch}{Object} = $saved_search->{Attribute}; + push @actions, loc($self->{SearchType}).loc( ' [_1] saved.', $args->{Description} ); + } else { + push @actions, + [ loc("Can't save [_1]", loc($self->{SearchType})) . ': ' . loc($search_msg), 0 ]; + } + } +} + +if ( $args->{Delete} && $self->{CurrentSearch}{Object} ) { + my ($ok, $msg) = $self->{CurrentSearch}{Object}->Delete; + push @actions, $ok ? loc($self->{SearchType}).loc( ' [_1] deleted.', $self->{CurrentSearch}{Object}->Description ) : $msg; + delete $self->{CurrentSearch}{Object}; + delete $self->{SearchId}; + +} + +$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, Name => 'Owner', SearchType => $self->{SearchType}, AllowCopy => 0, + CurrentSearch => $self->{CurrentSearch}, SearchId => $self->{SearchId}, Title => $Title &><br /> +% for my $field (@{$self->{SearchFields}}) { +<input type="hidden" class="hidden" name="<%$field%>" value="<%$ARGS{$field} || ''%>" /> +% } +</form> +<%ARGS> +$self => undef +$Action => '' +$Title => 'Saved searches' +</%ARGS> +<%init> +</%init> +</%method> diff --git a/rt/html/Widgets/SelectionBox b/rt/html/Widgets/SelectionBox new file mode 100644 index 000000000..910b20b25 --- /dev/null +++ b/rt/html/Widgets/SelectionBox @@ -0,0 +1,234 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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:sow, 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::WebPath%>/NoAuth/js/class.js"></script> +<script type="text/javascript" src="<%$RT::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'}; + ++$self->{Modified}; + if ($current && !ref ($current)) { + $current = [$current]; + } + + 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; + } + } + } + + $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> +<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> + <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</&>" /> + +% 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/html/Widgets/TitleBox b/rt/html/Widgets/TitleBox new file mode 100644 index 000000000..00d9e4c63 --- /dev/null +++ b/rt/html/Widgets/TitleBox @@ -0,0 +1,54 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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/html/Widgets/TitleBoxEnd b/rt/html/Widgets/TitleBoxEnd new file mode 100755 index 000000000..b12b58f4d --- /dev/null +++ b/rt/html/Widgets/TitleBoxEnd @@ -0,0 +1,59 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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/html/Widgets/TitleBoxStart b/rt/html/Widgets/TitleBoxStart new file mode 100755 index 000000000..7edc8a154 --- /dev/null +++ b/rt/html/Widgets/TitleBoxStart @@ -0,0 +1,88 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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 %>" id="<% $id %>"> + <div class="titlebox-title<% $title_class && " $title_class" %>"> +% if ($hideable) { + <span class="widget"><a href="#" onclick="return rollup('<%$tid%>');" onfocus="this.blur(); return false;" title="Toggle visibility">X</a></span> +% } + <span class="left"><% $title_href && qq[<a href="$title_href">] | n %><% $title |n %><% $title_href && "</a>" |n%></span> + <span class="right"><% $titleright_href && qq[<a href="$titleright_href">] | n %><% $titleright |n %><% $titleright_href && "</a>" |n%></span> + </div> + <div class="titlebox-content <% $bodyclass %>" id="<%$tid%>"> + +<%ARGS> +$width => undef +$class => '' +$bodyclass => '' +$title_href => undef +$title => '' +$title_class => '' +$titleright_href => undef +$titleright => undef +$contentbg => "#dddddd" +$color => "#336699" +$id => '' +$hideable => 1 +</%ARGS> + +<%init> +# +# This should be pretty bulletproof +# +my $page = $m->request_comp->path; + +my $tid = "TitleBox--$page--" . + join '--', ($class, $bodyclass, $title, $id); + +$tid =~ s{/}{_}g; + +my $i = 0; +$i++ while $m->notes("$tid-$i"); +$m->notes("$tid-$i" => 1); +$tid = "$tid-$i"; +</%init> |