[Rt-commit] [svn] r1060 - in RT-Journal/trunk: . html/Journal html/Journal/Elements html/Journal/User lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Sun Jun 13 00:47:32 EDT 2004


Author: jesse
Date: Sun Jun 13 00:47:31 2004
New Revision: 1060

Added:
   RT-Journal/trunk/Changes
   RT-Journal/trunk/README
Modified:
   RT-Journal/trunk/html/Journal/Article.html
   RT-Journal/trunk/html/Journal/Elements/Attr
   RT-Journal/trunk/html/Journal/Elements/BlogAsHTML
   RT-Journal/trunk/html/Journal/Elements/Entry
   RT-Journal/trunk/html/Journal/Prefs.html
   RT-Journal/trunk/html/Journal/Show.html
   RT-Journal/trunk/html/Journal/User/dhandler
   RT-Journal/trunk/lib/RT/Journal.pm
Log:
This be 0.02

Added: RT-Journal/trunk/Changes
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/Changes	Sun Jun 13 00:47:31 2004
@@ -0,0 +1 @@
+0.02 - Initial release

Added: RT-Journal/trunk/README
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/README	Sun Jun 13 00:47:31 2004
@@ -0,0 +1,7 @@
+This packages adds a Journals feature to your RT 3.1/3.2 instance.  
+
+It's underdocumented. This will be fixed before 1.0
+
+perl Makefile.PL
+make install
+make initdb

Modified: RT-Journal/trunk/html/Journal/Article.html
==============================================================================
--- RT-Journal/trunk/html/Journal/Article.html	(original)
+++ RT-Journal/trunk/html/Journal/Article.html	Sun Jun 13 00:47:31 2004
@@ -26,7 +26,7 @@
 else {
     $post->Load($id);
     if ($comment) {
-        $post->Comment( Content => $comment );
+        $post->Correspond( Content => $comment );
     }
 }
 </%init>
@@ -61,7 +61,7 @@
 <hr>
 
 % my $history = $post->Transactions();
-% $history->Limit(FIELD => 'Type', VALUE => 'Comment');
+% $history->Limit(FIELD => 'Type', VALUE => 'Correspond');
 % while (my $comment = $history->Next) {
 % my $attach = $comment->Attachments;
 

Modified: RT-Journal/trunk/html/Journal/Elements/Attr
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/Attr	(original)
+++ RT-Journal/trunk/html/Journal/Elements/Attr	Sun Jun 13 00:47:31 2004
@@ -3,10 +3,10 @@
 $User => undef
 </%args>
 <%init>
-
+$RT::Logger->crit($User . " $Name");
 my @attr = $User->Attributes->Named('RT::Journal-'.$Name);
-if( UNIVERSAL::can($attr[0], 'Value') {
-	$m->out($attr[0]->Value);
+if( UNIVERSAL::can($attr[0], 'Content')){
+	$m->out($attr[0]->Content);
 }
 return();
 </%init>

Modified: RT-Journal/trunk/html/Journal/Elements/BlogAsHTML
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/BlogAsHTML	(original)
+++ RT-Journal/trunk/html/Journal/Elements/BlogAsHTML	Sun Jun 13 00:47:31 2004
@@ -23,7 +23,7 @@
 [<a href="Edit.html?id=<%$post->Id%>"><&|/l&>Edit</&></a>]
 % }
 % my $comments = $post->Transactions;
-% $comments->Limit(FIELD => 'Type', VALUE => 'Comment', OPERATOR => '=');
+% $comments->Limit(FIELD => 'Type', VALUE => 'Correspond', OPERATOR => '=');
 <div class="blog-footer">
 <a href="<& Attr, User => $User, Name=>'BaseURL'&>/Entry/<%$post->Id%>"><&|/l,$comments->Count&>[_1] Comments</&></a> |
 <a href="<& Attr, User => $User, Name=>'BaseURL'&>/Entry/<%$post->Id%>"><&|/l&>Permalink</&></a>
@@ -49,5 +49,5 @@
 </%ARGS>
 <%init>
 #return if ($m->cache_self([expires_in => '1 hour']));
-my $guest = RT::CurrentUser->new('guest');
+my $guest = RT::CurrentUser->new('RT::Journal-guest');
 </%init>

Modified: RT-Journal/trunk/html/Journal/Elements/Entry
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/Entry	(original)
+++ RT-Journal/trunk/html/Journal/Elements/Entry	Sun Jun 13 00:47:31 2004
@@ -41,7 +41,7 @@
 <hr>
 % my $history = $post->Transactions();
 % while (my $comment = $history->Next) {
-% next unless ($comment->Type eq 'Comment');
+% next unless ($comment->Type eq 'Correspond');
 % my $attach = $comment->Attachments;
 % my $header = $comment->Attachments->First->Headers;
 % my ($subject, $sender);
@@ -72,13 +72,15 @@
 </html>
 
 <%INIT>
-my $guest = RT::CurrentUser->new('RT::Journal-Guest');
-my $post = RT::Ticket->new( $session{'CurrentUser'} || $guest );
+my $guest = RT::CurrentUser->new('RT::Journal-guest');
+my $post = RT::Ticket->new( $guest );
 $post->Load($id);
 unless ($post->id) {
 $m->comp("Abort", Message => "Invalid post id" );
 	
 }
+
+
   unless 
     ( $post->OwnerObj->id == $User->Id )  {
 $m->comp("Abort", Message => "Not a post in this blog ".$post->OwnerObj->id . " is not ".$User->id );
@@ -88,10 +90,10 @@
 	# comment on the ticket 
 	my $entity = MIME::Entity->build(Subject => $args->{'Subject'},
 				         From => $args->{'From'},
-					 X-IP-Address => $ENV{'REMOTE_ADDR'},
+					 'X-IP-Address' => $ENV{'REMOTE_ADDR'},
 					 Data => $args->{'comment'});
 
-	$post->Comment(MIMEObj => $entity);
+	$post->Correspond(MIMEObj => $entity);
 
 }
 

Modified: RT-Journal/trunk/html/Journal/Prefs.html
==============================================================================
--- RT-Journal/trunk/html/Journal/Prefs.html	(original)
+++ RT-Journal/trunk/html/Journal/Prefs.html	Sun Jun 13 00:47:31 2004
@@ -1,30 +1,28 @@
 <%init>
 
-
-
-my $link            = {};
-my $pref_base =
-  "fsck.com://RT/User/" . $session{'CurrentUser'}->id . "/Journal/";
-
+my %params;
 foreach my $param qw(BaseURL Title StyleURL) {
-	my $value = $ARGS{$param};
-	next unless($value);
-
-	my @attrs =$session{'CurrentUser'}->Attributes->Named('RT::Journal-'.$param);
+	my $default;
+	my @attr =$session{'CurrentUser'}->UserObj->Attributes->Named('RT::Journal-'.$param);
 	if ($attr[0]) {
-		$default = $attr[0]->Value;
+		$params{$param} = $attr[0]->Content;
 	}
+	my $value = $ARGS{$param};
+	next unless($value);
 
-    if ( $value ) {
-    	if ($attr[0]) { $attr[0]->SetValue($value); }
-	else { $session->{'CurrentUser'}->AddAttribute( Name => $param, Value => $value ) }
+    if ( $value && $value != $default) {
+    	if ($attr[0]) { $attr[0]->SetContent($value); }
+	else { $session{'CurrentUser'}->UserObj->AddAttribute( Name => 'RT::Journal-'. $param, Content => $value ) }
+		$params{$param} = $attr[0]->Content;
         }
+	
+
     }
 </%init>
 <& Elements/Tabs, Title => loc('Journal Preferences')&>
 <form method="post" action="Prefs.html">
 %foreach my $param qw(BaseURL Title StyleURL) {
-<%$param%>: <input type=text name="<%$param%>" value="<%($link->{$param} && $link->{$param}->Target)%>"> <br>
+<%$param%>: <input type=text name="<%$param%>" value="<%$params{$param}%>"> <br>
 % }
 <&/Elements/Submit&>
 </form>

Modified: RT-Journal/trunk/html/Journal/Show.html
==============================================================================
--- RT-Journal/trunk/html/Journal/Show.html	(original)
+++ RT-Journal/trunk/html/Journal/Show.html	Sun Jun 13 00:47:31 2004
@@ -20,9 +20,9 @@
 <a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$my_category%>"><%$my_category%></a>
 <hr>
 % }
-<a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$category%>&first=<%$first+1%>"><&|/l&>Next page</&></a> |
-% if ($page > 1) {
-<a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$category%>&first=<%$first-1%>"><&|/l&>Previous page</&></a> |
+<a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$category%>&first=<%$first+$count%>"><&|/l&>Next page</&></a> |
+% if ($first > 1) {
+<a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$category%>&first=<%$first-$count%>"><&|/l&>Previous page</&></a> |
 % } 
 <%INIT>
 my $q = RT::Queue->new($RT::SystemUser);

Modified: RT-Journal/trunk/html/Journal/User/dhandler
==============================================================================
--- RT-Journal/trunk/html/Journal/User/dhandler	(original)
+++ RT-Journal/trunk/html/Journal/User/dhandler	Sun Jun 13 00:47:31 2004
@@ -6,7 +6,7 @@
 inherit => 0
 </%flags>
 <%init>
-$m->comp('../Elements/_SetDefaults');
+#$m->comp('../Elements/_SetDefaults');
 
 my $argument = $m->dhandler_arg;
 my $username;
@@ -62,7 +62,7 @@
 $cat->LoadByNameAndQueue(Name => 'RT::Journal-Category', Queue => $q->Id);
 
 my $tix = RT::Tickets->new($guest_user);
-$tix->LimitQueue(VALUE => 'Journal');
+$tix->LimitQueue(VALUE => $RT::JournalQueue);
 $tix->OrderBy(FIELD=>'Created', ORDER => 'DESC');
 if ($username) {
 	$tix->LimitOwner(VALUE => $username);

Modified: RT-Journal/trunk/lib/RT/Journal.pm
==============================================================================
--- RT-Journal/trunk/lib/RT/Journal.pm	(original)
+++ RT-Journal/trunk/lib/RT/Journal.pm	Sun Jun 13 00:47:31 2004
@@ -2,7 +2,7 @@
 use warnings;
 
 package RT::Journal;
-our $VERSION = '0.01_01';
+our $VERSION = '0.02';
 
 1;
 


More information about the Rt-commit mailing list