[Rt-commit] r3146 - in rtfm/branches/2.1-TESTING: .
html/RTFM/Article html/RTFM/Article/Elements
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Jun 14 06:34:32 EDT 2005
Author: alexmv
Date: Tue Jun 14 06:34:31 2005
New Revision: 3146
Modified:
rtfm/branches/2.1-TESTING/ (props changed)
rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html
rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks
rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics
rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks
rtfm/branches/2.1-TESTING/html/RTFM/Article/ExtractFromTicket.html
Log:
r4207 at zoq-fot-pik: chmrr | 2005-06-14 06:34:21 -0400
* Editing articles only shows topics in that class
* Default to t:12345 format when creating new article from ticket
* Render links correctly just after article creation
* UNIVERSAL::can doesn't always do the right thing, as
DBIx::SearchBuilder AUTOLOAD's methods as needed. Reinforce with
UNIVERSAL::isa calls were appropriate
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Edit.html Tue Jun 14 06:34:31 2005
@@ -45,6 +45,7 @@
<& Elements/EditTopics, ArticleObj => $ArticleObj,
ClassObj => $ArticleObj->Id ? $ArticleObj->ClassObj : $ClassObj,
+ OnlyThisClass => 1,
%ARGS &>
<& Elements/EditLinks, ArticleObj => $ArticleObj,
id => $id,
@@ -118,6 +119,7 @@
push( @results, $msg );
if ($id) {
$title = loc( 'Modify article #[_1]', $ArticleObj->Id );
+ delete $ARGS{id};
}
else {
$ClassObj->Load($Class);
@@ -180,13 +182,14 @@
my ( $val, $msg ) =
$ArticleObj->AddLink( Target => $luri, Type => $linktype );
push @results, $msg;
+ delete $ARGS{ $ArticleObj->Id . "-$linktype" } if $val;
}
for my $luri ( split( / /, $ARGS{ "$linktype-" . $ArticleObj->Id } ) ) {
my ( $val, $msg ) =
$ArticleObj->AddLink( Base => $luri, Type => $linktype );
-
push @results, $msg;
+ delete $ARGS{ "$linktype-" . $ArticleObj->Id } if $val;
}
}
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditLinks Tue Jun 14 06:34:31 2005
@@ -31,9 +31,9 @@
<INPUT TYPE=CHECKBOX NAME="DeleteLink--<%$link->Type%>-<%$link->Target%>">
% if ($link->TargetURI->IsLocal) {
<a href="<%$member->Resolver->HREF%>"><% loc($member->Object->ObjectTypeStr) %> <%$member->Object->Id%></a>:
-% if (UNIVERSAL::can($member->Object, 'Name')) {
+% if (UNIVERSAL::isa($member->Object, "RT::FM::Article") or UNIVERSAL::can($member->Object, 'Name')) {
<%$member->Object->Name%>
-% } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
<%$member->Object->Subject%>
% }
</a>
@@ -55,9 +55,9 @@
<INPUT TYPE=CHECKBOX NAME="DeleteLink-<%$link->Base%>-<%$link->Type%>-">
% if ($link->BaseURI->IsLocal) {
<a href="<%$member->Resolver->HREF%>"><% loc($member->Object->ObjectTypeStr) %> <%$member->Object->Id%></a>:
-% if (UNIVERSAL::can($member->Object, 'Name')) {
+% if (UNIVERSAL::isa($member->Object, "RT::FM::Article") or UNIVERSAL::can($member->Object, 'Name')) {
<%$member->Object->Name%>
-% } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
<%$member->Object->Subject%>
% }
</a>
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/EditTopics Tue Jun 14 06:34:31 2005
@@ -24,9 +24,10 @@
% }
<input type="hidden" name="EditTopics" value="1" />
-<select multiple size="10" name="Topics">
+<select multiple size="<% $rows > 10 ? 10 : $rows %>" name="Topics">
% if ($ClassObj->Id) {
-% $m->print("<optgroup label=\"Current class (".$ClassObj->Name.")\">");
+% $m->print("<optgroup label=\"Current class (".$ClassObj->Name.")\">")
+% unless $OnlyThisClass;
% $inTree->traverse(sub {
% my $tree = shift;
% my $topic = $tree->getNodeValue;
@@ -35,22 +36,24 @@
% .(" " x ($tree->getDepth*5)).$topic->Name."</option>\n");
% });
% }
-% my $class = $ClassObj->Id;
-% $otherTree->traverse(sub {
-% my $tree = shift;
-% my $topic = $tree->getNodeValue;
-% if ($topic->ObjectId != $class) {
-% $class = $topic->ObjectId;
-% $m->print("</optgroup>\n");
-% my $c = new RT::FM::Class($session{'CurrentUser'});
-% $c->Load($topic->ObjectId);
-% $m->print("<optgroup label=\"".$c->Name."\">\n");
-% }
-% $m->print("<option value=\"".$topic->Id."\""
-% .(exists $topics{$topic->Id} ? " selected" : "").">"
-% .(" " x ($tree->getDepth*5)).$topic->Name."</option>\n");
-% });
+% unless ($OnlyThisClass) {
+% my $class = $ClassObj->Id;
+% $otherTree->traverse(sub {
+% my $tree = shift;
+% my $topic = $tree->getNodeValue;
+% if ($topic->ObjectId != $class) {
+% $class = $topic->ObjectId;
+% $m->print("</optgroup>\n");
+% my $c = new RT::FM::Class($session{'CurrentUser'});
+% $c->Load($topic->ObjectId);
+% $m->print("<optgroup label=\"".$c->Name."\">\n");
+% }
+% $m->print("<option value=\"".$topic->Id."\""
+% .(exists $topics{$topic->Id} ? " selected" : "").">"
+% .(" " x ($tree->getDepth*5)).$topic->Name."</option>\n");
+% });
</optgroup>
+% }
</select>
% if ($ClassObj->Id) {
</td>
@@ -82,6 +85,19 @@
}
$topics{$_} = 1 for @Topics;
+my $rows = 1;
+$inTree->traverse(sub {$rows++});
+unless ($OnlyThisClass) {
+ $rows++;
+ my $class = $ClassObj->Id;
+ $otherTree->traverse(sub {
+ $rows++;
+ if ($class != $_[0]->getNodeValue->ObjectId) {
+ $rows++;
+ $class = $_[0]->getNodeValue->ObjectId;
+ }
+ });
+}
sub buildTree {
my $query = shift;
@@ -117,4 +133,5 @@
$ArticleObj => new RT::FM::Article($session{'CurrentUser'})
$ClassObj => new RT::FM::Class($session{'CurrentUser'})
@Topics => undef
+$OnlyThisClass => undef
</%ARGS>
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/ShowLinks Tue Jun 14 06:34:31 2005
@@ -29,9 +29,9 @@
<LI>
% if ($link->TargetURI->IsLocal) {
<a href="<%$member->Resolver->HREF%>"><% loc($member->Object->ObjectTypeStr) %> <%$member->Object->Id%></a>:
-% if (UNIVERSAL::can($member->Object, 'Name')) {
+% if (UNIVERSAL::isa($member->Object, "RT::FM::Article") or UNIVERSAL::can($member->Object, 'Name')) {
<%$member->Object->Name%>
-% } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
<%$member->Object->Subject%>
% }
</a>
@@ -50,9 +50,9 @@
<LI>
% if ($member->IsLocal) {
<a href="<%$member->Resolver->HREF%>"><% loc($member->Object->ObjectTypeStr) %> <%$member->Object->Id%></a>:
-% if (UNIVERSAL::can($member->Object, 'Name')) {
+% if (UNIVERSAL::isa($member->Object, "RT::FM::Article") or UNIVERSAL::can($member->Object, 'Name')) {
<%$member->Object->Name%>
-% } elsif (UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
<%$member->Object->Subject%>
% }
</a>
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/ExtractFromTicket.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/ExtractFromTicket.html (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/ExtractFromTicket.html Tue Jun 14 06:34:31 2005
@@ -20,7 +20,7 @@
<form action="Edit.html" method="post">
<input type="hidden" name="Class" value="<%$ARGS{'Class'}%>">
<input type="hidden" name="Summary" value="<%$ticket->Subject%>">
-<input type="hidden" name="new-RefersTo" value="<%$ticket->URI%>">
+<input type="hidden" name="new-RefersTo" value="t:<% $ticket->id%>">
<table width="100%" valign="top" border=0 cellspacing=0>
<p><&|/l&>Use the dropdown menus to select which transactions you want to extract into a new RTFM article</&></p>
More information about the Rt-commit
mailing list