[Rt-commit] r11149 - in rtfm/branches/2.3-EXPERIMENTAL: html/Admin/RTFM/Elements

falcone at bestpractical.com falcone at bestpractical.com
Thu Mar 20 17:51:52 EDT 2008


Author: falcone
Date: Thu Mar 20 17:51:51 2008
New Revision: 11149

Modified:
   rtfm/branches/2.3-EXPERIMENTAL/   (props changed)
   rtfm/branches/2.3-EXPERIMENTAL/html/Admin/RTFM/Elements/Topics

Log:
 r30427 at ketch:  falcone | 2008-03-20 17:19:40 -0400
 * rename ClassObj to RootObj to account for globals
 * add in title and Global args for use by the wrappers


Modified: rtfm/branches/2.3-EXPERIMENTAL/html/Admin/RTFM/Elements/Topics
==============================================================================
--- rtfm/branches/2.3-EXPERIMENTAL/html/Admin/RTFM/Elements/Topics	(original)
+++ rtfm/branches/2.3-EXPERIMENTAL/html/Admin/RTFM/Elements/Topics	Thu Mar 20 17:51:51 2008
@@ -49,8 +49,7 @@
 <& /Elements/ListActions, actions => \@results &>
 
 <form action="<%$RT::WebPath%><% $m->request_comp->path |n %>" method="post">
-%#<form action="<%$RT::WebPath%>/Admin/RTFM/Classes/Topics.html" method="post">
-<input type="hidden" name="id" value="<%$ClassObj->Id%>" />
+<input type="hidden" name="id" value="<%$RootObj->Id%>" />
 
 % if (!$Modify) {
 <table>
@@ -67,7 +66,7 @@
 <a href="Topics.html">New topic</a>
 % }
 
-<& .tree, Element => $tree, Action => $Modify ? "Move" : "Add", Prefix => $Modify ? "Topic-$Modify-Parent" : "Insert", ClassObj => $ClassObj, Modify => $Modify &>
+<& .tree, Element => $tree, Action => $Modify ? "Move" : "Add", Prefix => $Modify ? "Topic-$Modify-Parent" : "Insert", RootObj => $RootObj, Modify => $Modify &>
 
 </form>
 
@@ -97,13 +96,13 @@
 %     $Action = "";
 <& .edit, topic => $topic &>
 %   } else {
-<a href="<%$RT::WebPath%>/Admin/RTFM/Classes/Topics.html?id=<%$ClassObj->Id%>&Modify=<%$topic->Id%>"
+<a href="<%$RT::WebPath%>/Admin/RTFM/Classes/Topics.html?id=<%$RootObj->Id%>&Modify=<%$topic->Id%>"
    title="<%$topic->Description%>"><%$topic->Name || loc("(no name)") %></a>
 %   }
 % }
 <ul>
 % for my $e (sort {$a->getNodeValue->Name cmp $b->getNodeValue->Name} $Element->getAllChildren) {
-<li><& .tree, Element => $e, Action => $Action, Prefix => $Prefix, ClassObj => $ClassObj, Modify => $Modify &></li>
+<li><& .tree, Element => $e, Action => $Action, Prefix => $Prefix, RootObj => $RootObj, Modify => $Modify &></li>
 % }
 % if ($Action) {
 % unless ($Action eq "Move" and grep {$_->getNodeValue->Id == $Modify} $Element->getAllChildren) {
@@ -115,20 +114,20 @@
 $Element
 $Action
 $Prefix
-$ClassObj
+$RootObj
 $Modify
 </%args>
 </%def>
-</%def>
 
 <%INIT>
 
-my $ClassObj = new RT::FM::Class($session{'CurrentUser'});
-$ClassObj->Load($ARGS{'id'}) || $m->comp("/RTFM/Elements/Error", Why => "Couldn't load class '$id'");
-
-my $title = $Modify 
-  ? loc("Modify topic for [_1]", $ClassObj->Name) 
-  : loc("Edit topic hierarchy for [_1]", $ClassObj->Name);
+my $RootObj;
+if ($Global) {
+    $RootObj = $RT::FM::System;
+} else {
+    $RootObj = new RT::FM::Class($session{'CurrentUser'});
+    $RootObj->Load($ARGS{'id'}) || $m->comp("/RTFM/Elements/Error", Why => "Couldn't load class '$id'");
+}
 
 my @results;
 
@@ -162,8 +161,8 @@
                                         Parent => $1,
                                         Name => $ARGS{'Name'},
                                         Description => $ARGS{'Description'},
-                                        ObjectType => ref($ClassObj),
-                                        ObjectId => $ClassObj->Id,
+                                        ObjectType => ref($RootObj),
+                                        ObjectId => $RootObj->Id,
                                        );
         push @results, $msg;
     }
@@ -181,7 +180,7 @@
 }
 
 my $topics = new RT::FM::TopicCollection($session{'CurrentUser'});
-$topics->LimitToObject($ClassObj);
+$topics->LimitToObject($RootObj);
 $topics->OrderByCols({FIELD => 'Parent'}, {FIELD => 'id'});
 
 use Tree::Simple;
@@ -219,6 +218,8 @@
 
 <%ARGS>
 $id => undef
+$title => ""
+$Global => undef
 $Modify => ""
 </%ARGS>
 


More information about the Rt-commit mailing list