[Rt-commit] r2205 - in RT-View-Tree: .
html/Callbacks/RT-Tree-View/Elements/RT__Ticket
html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap
html/Callbacks/RT-Tree-View/Elements/Ticket
html/Callbacks/RT-Tree-View/Search
html/Callbacks/RT-Tree-View/Search/Elements
html/Callbacks/RT-Tree-View/Search/Elements/PickBasics
html/Callbacks/RT-Tree-View/Search/Results.html
html/Callbacks/RT-Tree-View/Ticket/Elements/Tabs
html/Elements html/Elements/CollectionAsTable
html/Elements/RT__Ticket html/Elements/Ticket html/NoAuth
html/Search html/Search/Elements html/Ticket
html/Ticket/Elements lib/RT/View
jesse at bestpractical.com
jesse at bestpractical.com
Thu Feb 10 13:55:39 EST 2005
Author: jesse
Date: Thu Feb 10 13:55:38 2005
New Revision: 2205
Added:
RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/
RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/
RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Elements/
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Elements/PickBasics/
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Elements/PickBasics/EndOfList
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Results.html/
RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Results.html/SearchActions
RT-View-Tree/html/Elements/CollectionAsTable/
RT-View-Tree/html/Elements/CollectionAsTable/Header
RT-View-Tree/html/Elements/CollectionAsTable/ParseFormat
RT-View-Tree/html/Elements/CollectionAsTable/Row
RT-View-Tree/html/Elements/RT__Ticket/
RT-View-Tree/html/Elements/RT__Ticket/ColumnMap
Removed:
RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/Ticket/
RT-View-Tree/html/Elements/ParseColumnDefs
RT-View-Tree/html/Elements/Ticket/
RT-View-Tree/html/Elements/TicketListHeader
RT-View-Tree/html/Elements/TicketListRow
RT-View-Tree/html/NoAuth/
RT-View-Tree/html/Search/Elements/BuildFormatString
RT-View-Tree/html/Search/Elements/EditFormat
RT-View-Tree/html/Ticket/DisplayTree.html
RT-View-Tree/html/Ticket/Elements/
Modified:
RT-View-Tree/ (props changed)
RT-View-Tree/META.yml
RT-View-Tree/Makefile.PL
RT-View-Tree/html/Callbacks/RT-Tree-View/Ticket/Elements/Tabs/Default
RT-View-Tree/html/Elements/TicketList
RT-View-Tree/html/Search/Tree.html
RT-View-Tree/lib/RT/View/Tree.pm
Log:
r2292 at hualien (orig r290): jesse | 2004-08-29T03:17:17.670838Z
----------------------------------------------------------------------
r8459 at tinbook: jesse | 2004-08-29T03:05:55.598163Z
A complete implementation
----------------------------------------------------------------------
r8460 at tinbook: jesse | 2004-08-29T03:14:44.910794Z
Build fixes
----------------------------------------------------------------------
Modified: RT-View-Tree/META.yml
==============================================================================
--- RT-View-Tree/META.yml (original)
+++ RT-View-Tree/META.yml Thu Feb 10 13:55:38 2005
@@ -1,5 +1,5 @@
name: RT-View-Tree
-version: 0.2
+version: 0.5
abstract: RT View-Tree Extension
license: unknown
distribution_type: module
Modified: RT-View-Tree/Makefile.PL
==============================================================================
--- RT-View-Tree/Makefile.PL (original)
+++ RT-View-Tree/Makefile.PL Thu Feb 10 13:55:38 2005
@@ -1,5 +1,5 @@
use inc::Module::Install;
RTx('RT-View-Tree');
-version('0.2');
+version_from('lib/RT/View/Tree.pm');
&WriteAll;
Added: RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap Thu Feb 10 13:55:38 2005
@@ -0,0 +1,6 @@
+<%ARGS>
+$COLUMN_MAP => undef
+</%ARGS>
+<%init>
+$COLUMN_MAP->{'_RT_TreeView_Indent'} = { value => sub { my $ticket = shift; my $depth = shift; return " "x$depth} };
+</%init>
Added: RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Elements/PickBasics/EndOfList
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Elements/PickBasics/EndOfList Thu Feb 10 13:55:38 2005
@@ -0,0 +1,20 @@
+<%args>
+</%args>
+<%init>
+</%init>
+<TR>
+<TD align="right">
+<&|/l&>Type</&>
+</TD>
+<TD>
+<& /Elements/SelectBoolean, Name => "TypeOp",
+ True => loc("is"),
+ False => loc("isn't"),
+ TrueVal=> '=',
+ FalseVal => '!='
+&>
+</TD>
+<TD>
+<input type="text" size="10" name="ValueOfType">
+</TD>
+</TR>
Added: RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Results.html/SearchActions
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Callbacks/RT-Tree-View/Search/Results.html/SearchActions Thu Feb 10 13:55:38 2005
@@ -0,0 +1,5 @@
+<%args>
+$QueryString => undef
+</%args>
+<a href="<%$RT::WebPath%>/Search/Tree.html<%$QueryString%>"><&|/l&>Tree view</&></a> (<%$QueryString%>)
+
Modified: RT-View-Tree/html/Callbacks/RT-Tree-View/Ticket/Elements/Tabs/Default
==============================================================================
--- RT-View-Tree/html/Callbacks/RT-Tree-View/Ticket/Elements/Tabs/Default (original)
+++ RT-View-Tree/html/Callbacks/RT-Tree-View/Ticket/Elements/Tabs/Default Thu Feb 10 13:55:38 2005
@@ -17,10 +17,30 @@
%# END LICENSE BLOCK
<%init>
-$tabs->{'this'}->{'subtabs'}->{'_ZZ-Treeview'} = { title =>loc("Tree"),
- path => "/Search/Tree.html?id=" . $Ticket->id} if ($Ticket->id);
+if ($Ticket) {
+ $tabs->{'this'}->{'subtabs'}->{'_ZZ-Treeview'} = {
+ title => loc("Tree view"),
+ path => "Search/Tree.html?id=" . $Ticket->id . "&Query=id%20=%20" . $Ticket->id
+ };
+ if ( $current_tab =~ qr{^Search/Tree.html} ) {
+ $tabs->{'this'}->{'current_subtab'} = "Search/Tree.html?id=" . $Ticket->id . "&Query=id%20=%20" . $Ticket->id
+ }
+}
+
+if ( $current_tab =~ qr{^Search/Tree.html} ) {
+
+ # insert after tab h
+ $tabs->{'hb_TreeView'} = {
+ title => loc($Title),
+ path => $current_tab
+ };
+
+}
+
</%init>
<%args>
+$Title => undef
$tabs =>undef
+$current_tab => undef
$Ticket => undef
</%args>
Added: RT-View-Tree/html/Elements/CollectionAsTable/Header
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Elements/CollectionAsTable/Header Thu Feb 10 13:55:38 2005
@@ -0,0 +1,91 @@
+%# BEGIN LICENSE BLOCK;
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# 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.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+
+<%ARGS>
+ at Format => undef
+$AllowSorting => undef
+$Order=>undef
+$BaseURL => undef
+$Query => undef
+$Rows => undef
+$Page => undef
+$maxitems => undef
+</%ARGS>
+<TR>
+<%perl>
+
+my %generic_query_args = ( Query => $Query, Rows => $Rows, Page => $Page );
+
+my $item = 0;
+$$maxitems = 0;
+foreach my $col (@Format) {
+ $item++;
+ $$maxitems = $item if $item > $$maxitems;
+ if ( $col->{title} eq 'NEWLINE' ) {
+ $m->out('</TR> <TR>');
+ $item = 0;
+ }
+ else {
+ $m->out('<TH align="center">');
+ my $title = $col->{title};
+ $title =~ s/^__(.*)__$/$1/o;
+ $title = ( $m->comp('/Elements/RT__Ticket/ColumnMap',
+ Name => $title,
+ Attr => 'title'
+ )
+ || $title
+ );
+ if ( $AllowSorting
+ && $col->{'attribute'}
+ && $m->comp('/Elements/RT__Ticket/ColumnMap',
+ Name => $col->{'attribute'},
+ Attr => 'attribute' )
+ )
+ {
+
+ $m->out(
+ '<a href="' . $BaseURL
+ . $m->comp(
+ '/Elements/QueryString',
+ %generic_query_args,
+ OrderBy => (
+ $m->comp('/Elements/RT__Ticket/ColumnMap',
+ Name => $col->{'attribute'},
+ Attr => 'attribute'
+ )
+ || $col->{'attribute'}
+ ),
+ Order => ( $ARGS{'Order'} eq 'ASC' ? 'DESC' : 'ASC' )
+ ).
+ '">' . loc($title) . '</a>'
+ );
+ }
+ else {
+ $m->out( loc($title) );
+ }
+ $m->out('</TH>');
+ }
+}
+</%perl>
+</TR>
Added: RT-View-Tree/html/Elements/CollectionAsTable/ParseFormat
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Elements/CollectionAsTable/ParseFormat Thu Feb 10 13:55:38 2005
@@ -0,0 +1,81 @@
+%# BEGIN LICENSE BLOCK;
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# 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.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+
+<%ARGS>
+$Format
+</%ARGS>
+
+<%init>
+use Regexp::Common qw(delimited);
+my @Columns;
+#my $quoted = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+];
+my $justquoted = qr[$RE{delimited}{-delim=>qq{\'\"}}];
+#my $quoted = $RE{quoted}{-esc};
+my $word = qr [(?:\{|\}|\w|\.)+];
+
+while ($Format =~ /($justquoted|$word)/igx) {
+ my $col = $1;
+
+ if ($col =~ /^$RE{quoted}{-esc}$/) {
+ substr($col,0,1) = "";
+ substr($col,-1,1) = "";
+ }
+
+ my $colref;
+ if ( $col =~ s/\/STYLE:(.*?)$//io ) {
+ $colref->{'style'} = $1;
+ }
+ if ( $col =~ s/\/CLASS:(.*?)$//io ) {
+ $colref->{'class'} = $1;
+ }
+ if ( $col =~ s/\/TITLE:(.*?)$//io ) {
+ $colref->{'title'} = $1;
+ }
+ if ( $col =~ /__(.*?)__/gio ) {
+ my @subcols;
+ while ( $col =~ s/^(.*?)__(.*?)__//o ) {
+ push ( @subcols, $1 ) if ($1);
+ push ( @subcols, "__$2__" );
+ $colref->{'attribute'} = $2;
+ }
+ push ( @subcols, $col );
+ @{ $colref->{'output'} } = @subcols;
+ }
+ else {
+ @{ $colref->{'output'} } = ( "__" . $col . "__" );
+ $colref->{'attribute'} = $col;
+ }
+
+ if ( !$colref->{'title'} && grep { /^__(.*?)__$/io }
+ @{ $colref->{'output'} } )
+ {
+ $colref->{'title'} = $1;
+ $colref->{'attribute'} = $1;
+ }
+
+
+ push @Columns, $colref;
+}
+ return(@Columns);
+</%init>
Added: RT-View-Tree/html/Elements/CollectionAsTable/Row
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Elements/CollectionAsTable/Row Thu Feb 10 13:55:38 2005
@@ -0,0 +1,69 @@
+%# BEGIN LICENSE BLOCK;
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# 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.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+
+<%ARGS>
+$i => undef
+ at Format => undef
+$record => undef
+$maxitems => undef
+$Depth => undef
+$Warning => undef
+</%ARGS>
+
+<%PERL>
+$m->out( '<TR class="' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' );
+my $item;
+foreach my $column (@Format) {
+ if ( $column->{title} eq 'NEWLINE' ) {
+ while ($item < $maxitems) {
+ $m->out("<td> </td>\n");
+ $item++;
+ }
+ $item = 0;
+ $m->out('</TR>');
+ $m->out( '<TR class="' .
+ ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' );
+ next;
+ }
+ $item++;
+ $m->out('<td align="left">');
+ foreach my $subcol ( @{ $column->{output} } ) {
+ if ( $subcol =~ /^__(.*?)__$/o ) {
+ my $col = $1;
+ my $value = $m->comp('/Elements/RT__Ticket/ColumnMap', Name => $col, Attr => 'value');
+
+ if ( $value && ref($value)) {
+ $m->out( &{ $value } ( $record, $i ) );
+ } else {
+ $m->out($value );
+ }
+ }
+ else {
+ $m->out( Encode::decode_utf8($subcol) );
+ }
+ }
+ $m->out('</td>');
+}
+$m->out('</TR>');
+</%PERL>
Added: RT-View-Tree/html/Elements/RT__Ticket/ColumnMap
==============================================================================
--- (empty file)
+++ RT-View-Tree/html/Elements/RT__Ticket/ColumnMap Thu Feb 10 13:55:38 2005
@@ -0,0 +1,387 @@
+%# BEGIN LICENSE BLOCK;
+%#
+%# Copyright (c) 1996-2003 Jesse Vincent <jesse at bestpractical.com>
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# 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.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+
+<%ARGS>
+$Name => undef
+$Attr => undef
+</%ARGS>
+
+<%perl>
+return ColumnMap($Name, $Attr);
+</%perl>
+
+<%INIT>
+our ( $COLUMN_MAP, $CUSTOM_FIELD_MAP );
+
+sub ColumnMap {
+ my $name = shift;
+ my $attr = shift;
+
+ # First deal with the simple things from the map
+ if ( $COLUMN_MAP->{$name} ) {
+ return ( $COLUMN_MAP->{$name}->{$attr} );
+ }
+
+ # now, let's deal with harder things, like Custom Fields
+
+ elsif ( $name =~ /^(?:CF|CustomField).(.*)$/ ) {
+ my $field = $1;
+ my $cf;
+ if ( $CUSTOM_FIELD_MAP->{$field} ) {
+ $cf = $CUSTOM_FIELD_MAP->{$field};
+ }
+ else {
+
+ $cf = RT::CustomField->new( $session{'CurrentUser'} );
+
+ if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
+ $cf->LoadByNameAndQueue( Queue => $1, Name => $2 );
+ }
+ else {
+ $field = $1 if $field =~ /^{(.+)}$/; # trim { }
+ $cf->LoadByNameAndQueue( Queue => "0", Name => $field );
+ }
+ $CUSTOM_FIELD_MAP->{$field} = $cf if ( $cf->id );
+ }
+
+ unless ( $cf->id ) {
+ return undef;
+ }
+
+ if ( $attr eq 'attribute' ) {
+ return (undef);
+ }
+ elsif ( $attr eq 'title' ) {
+ return ( $cf->Name );
+ }
+ elsif ( $attr eq 'value' ) {
+ my $value = eval "sub {
+ my \$values = \$_[0]->CustomFieldValues('" . $cf->id . "');
+ return ( join( ', ', map { \$_->Content } \@{ \$values->ItemsArrayRef } ))
+ }" || die $@;
+ return ($value);
+ }
+ }
+}
+
+$COLUMN_MAP = {
+ QueueName => {
+ attribute => 'Queue',
+ title => 'Queue',
+ value => sub { return $_[0]->QueueObj->Name }
+ },
+ OwnerName => {
+ title => 'Owner',
+ attribute => 'Owner',
+ value => sub { return $_[0]->OwnerObj->Name }
+ },
+ id => {
+ attribute => 'id',
+ align => 'right',
+ value => sub { return $_[0]->id }
+ },
+ Status => {
+ attribute => 'Status',
+ value => sub { return $_[0]->Status }
+ },
+ Subject => {
+ attribute => 'Subject',
+ value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" }
+ },
+ ExtendedStatus => {
+ title => 'Status',
+ attribute => 'Status',
+ value => sub {
+ my $Ticket = shift;
+
+ if ( $Ticket->HasUnresolvedDependencies ) {
+ if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' )
+ or $Ticket->HasUnresolvedDependencies( Type => 'code' ) )
+ {
+ return "<em>" . loc('(pending approval)') . "</em>";
+ }
+ else {
+ return "<em>" . loc('(pending other Collection)') . "</em>";
+ }
+ }
+ else {
+ return loc( $Ticket->Status );
+ }
+
+ }
+ },
+ Priority => {
+ attribute => 'Priority',
+ value => sub { return $_[0]->Priority }
+ },
+ InitialPriority => {
+ attribute => 'InitialPriority',
+ value => sub { return $_[0]->InitialPriority }
+ },
+ FinalPriority => {
+ attribute => 'FinalPriority',
+ value => sub { return $_[0]->FinalPriority }
+ },
+ EffectiveId => {
+ attribute => 'EffectiveId',
+ value => sub { return $_[0]->EffectiveId }
+ },
+ Type => {
+ attribute => 'Type',
+ value => sub { return $_[0]->Type }
+ },
+ TimeWorked => {
+ attribute => 'TimeWorked',
+ value => sub { return $_[0]->TimeWorked }
+ },
+ TimeLeft => {
+ attribute => 'TimeLeft',
+ value => sub { return $_[0]->TimeLeft }
+ },
+ TimeEstimated => {
+ attribute => 'TimeEstimated',
+ value => sub { return $_[0]->TimeEstimated }
+ },
+ Requestors => {
+ value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
+ },
+ Cc => {
+ value => sub { return $_[0]->Cc->MemberEmailAddressesAsString }
+ },
+ AdminCc => {
+ value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString }
+ },
+ StartsRelative => {
+ title => 'Starts',
+ attribute => 'Starts',
+ value => sub { return $_[0]->StartsObj->AgeAsString }
+ },
+ StartedRelative => {
+ title => 'Started',
+ attribute => 'Started',
+ value => sub { return $_[0]->StartedObj->AgeAsString }
+ },
+ CreatedRelative => {
+ title => 'Created',
+ attribute => 'Created',
+ value => sub { return $_[0]->CreatedObj->AgeAsString }
+ },
+ LastUpdatedRelative => {
+ title => 'LastUpdated',
+ attribute => 'LastUpdated',
+ value => sub { return $_[0]->LastUpdatedObj->AgeAsString }
+ },
+ ToldRelative => {
+ title => 'Told',
+ attribute => 'Told',
+ value => sub { return $_[0]->ToldObj->AgeAsString }
+ },
+ DueRelative => {
+ title => 'Due',
+ attribute => 'Due',
+ value => sub { return $_[0]->DueObj->AgeAsString }
+ },
+ ResolvedRelative => {
+ title => 'Resolved',
+ attribute => 'Resolved',
+ value => sub { return $_[0]->ResolvedObj->AgeAsString }
+ },
+ Starts => {
+ attribute => 'Starts',
+ value => sub { return $_[0]->StartsObj->AsString }
+ },
+ Started => {
+ attribute => 'Started',
+ value => sub { return $_[0]->StartedObj->AsString }
+ },
+ Created => {
+ attribute => 'Created',
+ value => sub { return $_[0]->CreatedObj->AsString }
+ },
+ CreatedBy => {
+ attribute => 'CreatedBy',
+ value => sub { return $_[0]->CreatorObj->Name }
+ },
+ LastUpdated => {
+ attribute => 'LastUpdated',
+ value => sub { return $_[0]->LastUpdatedObj->AsString }
+ },
+ LastUpdatedBy => {
+ attribute => 'LastUpdatedBy',
+ value => sub { return $_[0]->LastUpdatedByObj->Name }
+ },
+ Told => {
+ attribute => 'Told',
+ value => sub { return $_[0]->ToldObj->AsString }
+ },
+ Due => {
+ attribute => 'Due',
+ value => sub { return $_[0]->DueObj->AsString }
+ },
+ Resolved => {
+ attribute => 'Resolved',
+ value => sub { return $_[0]->ResolvedObj->AsString }
+ },
+
+ DependedOnBy => {
+ value => sub {
+ my $links = $_[0]->DependedOnBy;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->BaseURI->Resolver->HREF . '">'
+ . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ Members => {
+ value => sub {
+ my $links = $_[0]->Members;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->BaseURI->Resolver->HREF . '">'
+ . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ Children => {
+ value => sub {
+ my $links = $_[0]->Members;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->BaseURI->Resolver->HREF . '">'
+ . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ ReferredToBy => {
+ value => sub {
+ my $links = $_[0]->ReferredToBy;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->BaseURI->Resolver->HREF . '">'
+ . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+
+ DependsOn => {
+ value => sub {
+ my $links = $_[0]->DependsOn;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->TargetURI->Resolver->HREF . '">'
+ . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ MemberOf => {
+ value => sub {
+ my $links = $_[0]->MemberOf;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->TargetURI->Resolver->HREF . '">'
+ . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ Parents => {
+ value => sub {
+ my $links = $_[0]->MemberOf;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->TargetURI->Resolver->HREF . '">'
+ . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+ RefersTo => {
+ value => sub {
+ my $links = $_[0]->RefersTo;
+ return (
+ join(
+ "<br>",
+ map {
+ '<A HREF="'
+ . $_->TargetURI->Resolver->HREF . '">'
+ . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+ . '</A>'
+ } @{ $links->ItemsArrayRef }
+ )
+ );
+ }
+ },
+
+ '_CLASS' => {
+ value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' }
+ },
+
+};
+
+
+
+# }}}
+$m->comp( '/Elements/Callback', COLUMN_MAP => $COLUMN_MAP, _CallbackName => 'ColumnMap');
+</%INIT>
Modified: RT-View-Tree/html/Elements/TicketList
==============================================================================
--- RT-View-Tree/html/Elements/TicketList (original)
+++ RT-View-Tree/html/Elements/TicketList Thu Feb 10 13:55:38 2005
@@ -29,7 +29,7 @@
% }
% if ($ShowHeader) {
-<& /Elements/TicketListHeader,
+<& /Elements/CollectionAsTable/Header,
Format => \@Format,
AllowSorting => $AllowSorting,
Order => $Order,
@@ -42,12 +42,12 @@
% }
% if (defined $SingleRecord) {
-<& /Elements/TicketListRow, Format => \@Format, i => 0, record => $SingleRecord, maxitems => $maxitems &>
+<& /Elements/CollectionAsTable/Row, Format => \@Format, i => 0, record => $SingleRecord, maxitems => $maxitems &>
% } else {
% my $i;
% while (my $record = $Collection->Next) {
% $i++;
-<& /Elements/TicketListRow, Format => \@Format, i => $i, record => $record, maxitems => $maxitems &>
+<& /Elements/CollectionAsTable/Row, Format => \@Format, i => $i, record => $record, maxitems => $maxitems &>
% }
% }
@@ -96,7 +96,7 @@
$Collection->FromSQL($Query);
}
-my (@Format) = $m->comp('/Elements/ParseColumnDefs', Format => $Format);
+my (@Format) = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $Format);
$Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order);
$Collection->RowsPerPage($Rows);
Modified: RT-View-Tree/html/Search/Tree.html
==============================================================================
--- RT-View-Tree/html/Search/Tree.html (original)
+++ RT-View-Tree/html/Search/Tree.html Thu Feb 10 13:55:38 2005
@@ -1,78 +1,211 @@
-<& /Elements/Header &>
+<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
+<& /Ticket/Elements/Tabs,
+ current_tab => "Search/Tree.html".$QueryString,
+ Ticket => $Ticket,
+ Title => $title,
+ Format => $Format,
+ Query => $Query,
+ Rows => $Rows,
+ OrderBy => $OrderBy,
+ Order => $Order &>
+<hr>
+
+
<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
+<& /Elements/CollectionAsTable/Header,
+ Format => \@Format,
+ AllowSorting => 0,
+ Query => $Query,
+
+&>
<%perl>
-my ($title, $ticketcount);
-my $tickets = RT::Tickets->new($session{'CurrentUser'});
-$tickets->FromSQL($Query );
+
+
+foreach my $ticket (values %$top_tickets ) {
+ $m->comp( '.entry', Ticket => $ticket, Depth => 0, Format => \@Format,
+ MaxDepth => $MaxDepth,
+ HideChildren => $HideChildren,
+ HideDependencies => $HideDependencies
+ );
+
+}
+
+</%perl>
+</table>
+<hr>
+<form method="get" action="/Search/Tree.html">
+<input type="hidden" name="Query" value="<%$Query%>">
+<input type="hidden" name="Format" value="<%$Format%>">
+<& /Elements/TitleBoxStart, title => loc('Display options') &>
+<ul>
+<li><&|/l&>Show this many levels:</&> <input type=text size=3 name="MaxDepth"
+value=<%$MaxDepth%>>
+(<i><&|/l&>Leave this field blank to show everything</&></i>)
+</li>
+<li><input type="checkbox" name="HideChildren" <%$HideChildren%>><&|/l&>Hide subtasks</&></li>
+<li><input type="checkbox" name="HideDependencies" <%$HideDependencies%>><&|/l&>Hide dependencies</&></li>
+</ul>
+<& /Elements/Submit &>
+<& /Elements/TitleBoxEnd &>
+</form>
+
+
+<%ARGS>
+$id => undef
+$Query => undef
+$Format => undef
+$Rows => undef
+$OrderBy => undef
+$Order => undef
+$Page => undef
+$MaxDepth => undef
+$HideChildren => undef
+$HideDependencies => undef
+</%ARGS>
+<%init>
+my $title = loc('Tree view');
+
+my $QueryString = "?"
+ . $m->comp(
+ '/Elements/QueryString',
+ Query => $Query,
+ Format => $Format,
+ Rows => $Rows,
+ OrderBy => $OrderBy,
+ Order => $Order,
+ Page => $Page,
+ MaxDepth => $MaxDepth,
+ HideChildren => $HideChildren,
+ HideDependencies => $HideDependencies
+ );
+
+# If we load a ticket, this search is on a given ticket and we'll get the
+# ticket menus instead of the tree ones
+my $Ticket;
+if ($id) {
+ $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
+ $Ticket->Load($id) if ($id);
+}
+$Format ||= $RT::DefaultSearchResultFormat;
+
+# Scrub the html of the format string to remove any potential nasties.a
+$Format = $m->comp( '/Elements/ScrubHTML', Content => $Format );
+my (@Format) = $m->comp( '/Elements/CollectionAsTable/ParseFormat', Format => $Format );
+
+# Update the format string to do treeview style indents
+my @TreeFormat;
+foreach my $entry (@Format) {
+
+ my @output;
+ foreach my $item ( @{ $entry->{'output'} } ) {
+ if ( $item eq '__Subject__' ) {
+ push @output, '___RT_TreeView_Indent__', $item;
+ }
+ else {
+ push @output, $item;
+ }
+ }
+ $entry->{'output'}=\@output;
+}
+
+
+my ($ticketcount);
+my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+$tickets->FromSQL($Query);
my $top_tickets = ();
-foreach my $ticket ( @{ $tickets->ItemsArrayRef } ) {
+my @tickets;
+ at tickets = @{ $tickets->ItemsArrayRef || [] };
+foreach my $ticket (@tickets) {
$top_tickets->{ $ticket->id } = $ticket;
}
# for each ticket found by our search, check to see if it depends on any
# others. if so, discard it
-foreach my $ticket (@{$tickets->ItemsArrayRef}) {
- next unless exists $top_tickets->{$ticket->id};
+foreach my $ticket (@tickets) {
+ next unless exists $top_tickets->{ $ticket->id };
my $deps = RT::Tickets->new( $session{'CurrentUser'} );
- $deps->FromSQL( 'MemberOf = ' . $ticket->id );
- while (my $dep = $deps->Next) {
+ my @query;
+ unless ($HideDependencies) {
+ push @query, 'DependsOn = '.$ticket->id;
+ }
+ unless ($HideChildren) {
+ push @query, 'MemberOf = '.$ticket->id;
+
+ }
+ $deps->FromSQL( join(' OR ', @query));
+ while ( my $dep = $deps->Next ) {
+
# Discard
- delete $top_tickets->{$dep->id};
+ delete $top_tickets->{ $dep->id };
}
}
-foreach my $ticket (values %$top_tickets ) {
- $m->comp( '.entry', Ticket => $ticket, Depth => 0 );
-}
-</%perl>
-</table>
-<%ARGS>
-$Query => 'Subject LIKE "TreeView"'
-</%ARGS>
+</%init>
<%DEF .entry>
<%args>
$Ticket
$Depth => 0
$Parents => undef
+ at Format => undef
+$MaxDepth => undef
+$HideChildren => undef
+$HideDependencies => undef
</%args>
-<%init>
-my $kids = RT::Tickets->new($session{'CurrentUser'});
-$kids->FromSQL('MemberOf = '.$Ticket->id);
-my @Format = $m->comp('/Elements/ParseColumnDefs', Format => 'id, "___RT_TreeView_Indent__ __Subject__"');
-
-</%init>
-<& /Elements/TicketListRow, Format => \@Format, i => $Depth, record => $Ticket&>
+<& /Elements/CollectionAsTable/Row, Format => \@Format, i => $Depth, record => $Ticket&>
<%perl>
- if ( $Parents->{ $Ticket->id } ) {
- my @Blank;
- foreach my $entry (@Format) {
- my @output = [ ' '];
- foreach my $item (@{$entry->{'output'}}){
- if ($item =~ /Subject/i) {
- @output = ['___RT_TreeView_Indent__' ,'...'];
- }
- }
- push @Blank, {output => @output };
- }
- $m->comp('/Elements/TicketListRow', Format => \@Blank, i => $Depth+1, record => $Ticket);
+if ( !$MaxDepth || $Depth <= $MaxDepth ) {
- }
- else {
+ # if we have not found a loop, print the kid.
+ unless ( $Parents->{ $Ticket->id } ) {
$Parents->{ $Ticket->id } = 1;
+ my $kids = RT::Tickets->new( $session{'CurrentUser'} );
+ my @query;
+ unless ($HideDependencies) {
+ push @query, 'DependsOn = ' . $Ticket->id;
+ }
+ unless ($HideChildren) {
+ push @query, 'MemberOf = ' . $Ticket->id;
+ }
+ $kids->FromSQL( join( ' OR ', @query ) );
+
while ( my $kid = $kids->Next ) {
# look to see if the child is a parent up the tree
$m->comp(
'.entry',
- Ticket => $kid,
- Depth => ( $Depth + 1 ),
- Parents => $Parents
+ Ticket => $kid,
+ Depth => ( $Depth + 1 ),
+ Parents => $Parents,
+ MaxDepth => $MaxDepth,
+ HideChildren => $HideChildren,
+ HideDependencies => $HideDependencies,
+ Format => \@Format
);
}
}
+ else { # found a loop
+ my @Blank;
+ foreach my $entry (@Format) {
+ my @output = [' '];
+ foreach my $item ( @{ $entry->{'output'} } ) {
+ if ( $item =~ /Subject/i ) {
+ @output = [ '___RT_TreeView_Indent__', '...' ];
+ }
+ }
+ push @Blank, { output => @output };
+ }
+ $m->comp(
+ '/Elements/CollectionAsTable/Row',
+ Format => \@Blank,
+ i => $Depth + 1,
+ record => $Ticket
+ );
+
+ }
+}
</%perl>
</%DEF>
Modified: RT-View-Tree/lib/RT/View/Tree.pm
==============================================================================
--- RT-View-Tree/lib/RT/View/Tree.pm (original)
+++ RT-View-Tree/lib/RT/View/Tree.pm Thu Feb 10 13:55:38 2005
@@ -1,6 +1,6 @@
package RT::View::Tree;
-our $VERSION = '0.2';
+our $VERSION = '0.5';
1;
More information about the Rt-commit
mailing list