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

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Thu May 27 17:46:38 EDT 2004


Author: jesse
Date: Thu May 27 17:46:37 2004
New Revision: 955

Added:
   RT-Journal/trunk/META.yml
   RT-Journal/trunk/Makefile.PL
   RT-Journal/trunk/html/
   RT-Journal/trunk/html/Callbacks/
   RT-Journal/trunk/html/Callbacks/Journal/
   RT-Journal/trunk/html/Callbacks/Journal/Elements/
   RT-Journal/trunk/html/Callbacks/Journal/Elements/Tabs/
   RT-Journal/trunk/html/Callbacks/Journal/Elements/Tabs/Default   (contents, props changed)
   RT-Journal/trunk/html/Edit.html   (contents, props changed)
   RT-Journal/trunk/html/Elements/
   RT-Journal/trunk/html/Elements/Abort
   RT-Journal/trunk/html/Elements/Attr
   RT-Journal/trunk/html/Elements/BlogAsHTML   (contents, props changed)
   RT-Journal/trunk/html/Elements/BlogAsRSS   (contents, props changed)
   RT-Journal/trunk/html/Elements/Entry   (contents, props changed)
   RT-Journal/trunk/html/Elements/Footer   (contents, props changed)
   RT-Journal/trunk/html/Elements/Header   (contents, props changed)
   RT-Journal/trunk/html/Elements/Search   (contents, props changed)
   RT-Journal/trunk/html/Elements/SelectCategory
   RT-Journal/trunk/html/Elements/Sidebar
   RT-Journal/trunk/html/Elements/Tabs   (contents, props changed)
   RT-Journal/trunk/html/Login.html
   RT-Journal/trunk/html/Post.html   (contents, props changed)
   RT-Journal/trunk/html/Prefs.html
   RT-Journal/trunk/html/Show.html   (contents, props changed)
   RT-Journal/trunk/html/User/
   RT-Journal/trunk/html/User/dhandler
   RT-Journal/trunk/html/clean.css
   RT-Journal/trunk/html/index.html   (contents, props changed)
   RT-Journal/trunk/lib/
   RT-Journal/trunk/lib/RT/
   RT-Journal/trunk/lib/RT/Journal.pm
Log:
First cut RT-Journal. This is the old code that was running on rt3.fsck.com

Added: RT-Journal/trunk/META.yml
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/META.yml	Thu May 27 17:46:37 2004
@@ -0,0 +1,11 @@
+name: RT-Journal
+version: 0.01_01
+abstract: RT Journal Extension
+author: Jesse Vincent <jesse at bestpractical.com>
+license: GPLv2
+distribution_type: module
+no_index:
+  directory:
+    - html
+    - inc
+generated_by: Module::Install version 0.33

Added: RT-Journal/trunk/Makefile.PL
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/Makefile.PL	Thu May 27 17:46:37 2004
@@ -0,0 +1,6 @@
+use inc::Module::Install;
+
+RTx('RT-Journal');
+author('Jesse Vincent <jesse at bestpractical.com>');
+license('GPLv2');
+&WriteAll;

Added: RT-Journal/trunk/html/Callbacks/Journal/Elements/Tabs/Default
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Callbacks/Journal/Elements/Tabs/Default	Thu May 27 17:46:37 2004
@@ -0,0 +1,6 @@
+%# $File: //depot/RT/rt/local/html/Callbacks/Journal/Elements/Tabs/Default $ $Author: autrijus $
+%# $Revision: #2 $ $Change: 6418 $ $DateTime: 2003/06/10 05:54:47 $
+% $toptabs->{D_Journal} = { title => loc('Journal'), path => 'Journal/index.html' };
+<%ARGS>
+$toptabs
+</%ARGS>

Added: RT-Journal/trunk/html/Edit.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Edit.html	Thu May 27 17:46:37 2004
@@ -0,0 +1,34 @@
+<& Elements/Tabs &>
+<%$msg && '<h2>'.$msg.'</h2>'|n%>
+<%$content_msg && '<h2>'.$content_msg.'</h2>'|n%>
+<form action="Edit.html" method="post">
+<input type="hidden" name="id" value="<%$ticket->Id%>">
+
+Category: <input name="Category" value="<%$ticket->FirstCustomFieldValue('Category')%>"><br>
+
+<textarea rows=20 cols=80 name="Content"><%$attachment->Content%></textarea>
+<input type=submit>
+</form>
+
+<%INIT>
+my ($msg, $val, $content_msg, $content_val);
+my $ticket = LoadTicket($id);
+my $cf = RT::CustomField->new($session{'CurrentUser'});
+$cf->LoadByNameAndQueue(Queue => $ticket->QueueObj->id, Name => 'Category');
+my $txn = $ticket->Transactions->First;
+my $attachment = $txn->Attachments->First;
+if ($ARGS{'Category'} && $ticket->FirstCustomFieldValue('Category') ne $ARGS{'Category'}) {
+	($val, $msg) = $ticket->AddCustomFieldValue(Field => $cf, Value => $ARGS{'Category'});
+}
+if ($ARGS{'Content'} ) {
+        # this is an egregious hack and should never exist. 
+        # We need an "Alter ticket content right"
+        # it should be "permission denied, not 'immutable'
+        ($content_val,$content_msg) = $attachment->_Set( Field =>'Content', Value => $ARGS{'Content'});
+}
+
+
+</%INIT>
+<%ARGS>
+$id => undef
+</%ARGS>

Added: RT-Journal/trunk/html/Elements/Abort
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Abort	Thu May 27 17:46:37 2004
@@ -0,0 +1,8 @@
+<html>
+<body>
+<%$Message%>
+</body>
+</html>
+<%args>
+$Message => undef
+</%args>

Added: RT-Journal/trunk/html/Elements/Attr
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Attr	Thu May 27 17:46:37 2004
@@ -0,0 +1,17 @@
+<%args>
+$Name => undef
+$User => undef
+</%args>
+<%init>
+my $link            = {};
+my $pref_base = "fsck.com://RT/User/" . $User->id . "/Journal/";
+my $url_base = $pref_base.$Name;
+my    $attr = RT::Link->new( $session{'CurrentUser'}||$RT::SystemUser );
+    $attr->LoadByCols( Base => $url_base, Type => 'RefersTo' );
+
+	my $value = $attr->Target;
+	$value =~ s/^text://i;
+
+$m->out($value);
+return();
+</%init>

Added: RT-Journal/trunk/html/Elements/BlogAsHTML
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/BlogAsHTML	Thu May 27 17:46:37 2004
@@ -0,0 +1,53 @@
+<& Header, User => $User &>
+<div class="blog">
+%while( my $post =  $EntriesObj->Next) {
+% my $my_category =  $post->FirstCustomFieldValue('Category');
+<div class="blog-header">
+<h2 class="date"><%$post->CreatedObj->AsString%></h2><br>
+<h3 class="title"><%$post->Subject|| loc('Untitled')%></h3>
+</div>
+<br>
+% my $content = $post->Transactions->First->Content;
+% $content =~ s/-- (.*)$//gism;
+% $content =~ s/\n/<br>/gi;
+<div class="blogbody">
+<%$content|n%>
+</div>
+% my $refto = $post->RefersTo;
+<div align="right">
+% while( my $link = $refto->Next ) {
+<A href="<%$link->TargetURI->Resolver->HREF%>"><%$link->TargetURI->Resolver->HREF%></a><br>
+% }
+</div>
+% if ( $session{'CurrentUser'} && $session{'CurrentUser'}->Id == $post->OwnerObj->Id ) {
+[<a href="Edit.html?id=<%$post->Id%>"><&|/l&>Edit</&></a>]
+% }
+% my $comments = $post->Transactions;
+% $comments->Limit(FIELD => 'Type', VALUE => 'Comment', 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>
+<%$my_category%>
+</div>
+<br />
+% }
+
+<br>
+% if ($Page > 1) {
+<a href="?Page=<%$Page-1%>">Previous page</a> |
+% }
+<a href="?Page=<%$Page+1%>">Next page</a>
+
+</div>
+<& Footer, %ARGS &>
+
+<%ARGS>
+$Page => undef
+$show => undef
+$User	=> undef
+$EntriesObj	=> undef
+</%ARGS>
+<%init>
+#return if ($m->cache_self([expires_in => '1 hour']));
+my $guest = RT::CurrentUser->new('guest');
+</%init>

Added: RT-Journal/trunk/html/Elements/BlogAsRSS
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/BlogAsRSS	Thu May 27 17:46:37 2004
@@ -0,0 +1,47 @@
+<%flags>
+inherit => undef
+</%flags>
+<%init>
+#return if ($m->cache_self([expires_in => '1 hour']));
+</%init>
+<?xml version="1.0"?>
+<rss version="0.92" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
+ 	<channel>
+<title><&|/l,$user&>Journal of [_1]</&></title>
+					<link><&Attr, Name=>'BaseURL', User=> $User&></link>
+							<description><&Attr, Name=>'Name', User=> $User&></description>
+
+
+%while( my $post =  $EntriesObj->Next) {
+% my $my_category =  $post->FirstCustomFieldValue('Category');
+<item>
+<link><&Attr, Name=>'BaseURL', User=> $User&>/Entry/<%$post->id%></link>
+<title><%$post->Subject|| loc('Untitled')%></title>
+<description>
+<![CDATA[
+% my $content = $post->Transactions->First->Content;
+% $content =~ s/-- (.*)$//gism;
+%# $content =~ s/\</&lt;/gism;
+%# $content =~ s/\>/&gt;/gism;
+% $content =~ s/\n/<br \/>/gi;
+<%$content|n%>
+% my $refto = $post->RefersTo;
+<ul>
+% while( my $link = $refto->Next ) {
+<li><A href="<%$link->TargetURI->Resolver->HREF%>"><%$link->TargetURI->Resolver->HREF%></a>
+% }
+</ul>
+<hr>
+[<a href="<& Attr, User => $User, Name=>'BaseURL'&>/Entry/<%$post->Id%>">Comments</a>]
+
+Category: <a href="/Category<%$my_category%>"><%$my_category%></a>
+]]></description>
+</item>
+% }
+</channel>
+</rss>
+<%ARGS>
+$User => undef
+$user	=> undef
+$EntriesObj => undef
+</%ARGS>

Added: RT-Journal/trunk/html/Elements/Entry
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Entry	Thu May 27 17:46:37 2004
@@ -0,0 +1,102 @@
+<html>
+<head>
+<title><%$post->Subject%></title>
+<link rel="stylesheet" href="http://rt3.fsck.com/Journal/clean.css" type="text/css" />
+
+</head>
+<body>
+<div id="banner"><&Attr, Name=>'Title', User=> $User&><br />
+<span class="description"></span>
+</div>
+
+<div id="container">
+
+<div class="blog">
+
+<div id="menu"><a href="<&Attr, Name=>'BaseURL', User=> $User&>"><&Attr, Name=>'Title', User=> $User&></a>
+</div>
+</div>
+
+<div class="blog">
+
+<div class="date"><%$post->CreatedObj->AsString%></div><br>
+
+<span class"title"><%$post->Subject%></span><br />
+<%$post->FirstCustomFieldValue('Category')%>
+% my $content;
+% $post->Transactions->First && ($content = $post->Transactions->First->Content);
+% $content =~ s/-- (.*)$//gism;
+% $content =~ s/\n/<br>/gi;
+<div class="blogbody">
+<%$content|n%>
+% my $refto = $post->RefersTo;
+<div align="right">
+% while( my $link = $refto->Next ) {
+<A href="<%$link->TargetURI->Resolver->HREF%>"><%$link->TargetURI->Resolver->HREF%></a><br>
+% }
+</div>
+% if ($session{'CurrentUser'} && $session{'CurrentUser'}->Id == $post->OwnerObj->Id) {
+[<a href="<&Attr, Name=>'BaseURL', User=> $User&>/Entry/<%$post->id%>/Edit">Edit</a>]
+% }
+<hr>
+% my $history = $post->Transactions();
+% while (my $comment = $history->Next) {
+% next unless ($comment->Type eq 'Comment');
+% my $attach = $comment->Attachments;
+% my $header = $comment->Attachments->First->Headers;
+% my ($subject, $sender);
+% if ($header =~ /^From: (.*?)$/m) {  $sender = $1};
+% if ($header =~ /^Subject: (.*?)$/m) {  $subject = $1};
+<div class="comments-head"><%$subject||loc( 'no subject')%></div>
+<span class="comments-post">Posted by <%$sender%> at <%$comment->CreatedObj->AsString%></span><br />
+<div class="comments-body">
+<%$comment->Content%>
+</div>
+%# $attach->Limit(FIELD => 'ContentType', OPERATOR => 'LIKE', VALUE => 'image/jpeg');
+% while (my $file = $attach->Next) {
+Found :<%$file->id%> / <%$file->Filename%>
+% }
+<hr>
+% }
+<hr>
+<form action="<&Attr, Name=>'BaseURL', User=> $User&>/Entry/<%$post->id%>" method="post">
+<input type=hidden name="id" value="<%$post->id%>">
+Subject: <input size="60" name="Subject"><br>
+Name: <input size="40" name="From"> (ex: Jesse Vincent &lt;sendmespam at example.com&gt;)<br>
+<textarea name="comment" rows=10 cols=70></textarea>
+<input type="submit">
+</form>
+</div>
+</div>
+</body>
+</html>
+
+<%INIT>
+my $guest = RT::CurrentUser->new('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 );
+}
+	my $args = $m->request_args;
+if ($args->{'comment'}) {
+	# comment on the ticket 
+	my $entity = MIME::Entity->build(Subject => $args->{'Subject'},
+				         From => $args->{'From'},
+					 Data => $args->{'comment'});
+
+	$post->Comment(MIMEObj => $entity);
+
+}
+
+
+</%INIT>
+<%ARGS>
+$id	    => undef
+$User 	=> undef
+</%ARGS>

Added: RT-Journal/trunk/html/Elements/Footer
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Footer	Thu May 27 17:46:37 2004
@@ -0,0 +1,14 @@
+</div>
+<div class="menu">
+<& Sidebar, %ARGS &>
+</div>
+<div class="powered">
+Powered by<br /><a href="http://bestpractical.com/rt">RT 3.0 Journals (beta)</a><br />    
+(And a skin from movabletype.org)
+</div>
+</body>
+</html>
+<%ARGS>
+$User	=> undef
+</%ARGS>
+</%init>

Added: RT-Journal/trunk/html/Elements/Header
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Header	Thu May 27 17:46:37 2004
@@ -0,0 +1,21 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
+
+<title><&Attr, Name=>'Title', User=> $User&></title>
+<link rel="stylesheet" href="http://rt3.fsck.com/Journal/clean.css" type="text/css" />
+<link rel="alternate" type="application/rss+xml" title="RSS" href="<&Attr, Name=>'BaseURL', User=> $User&>/RSS" />
+
+</head>
+<body>
+<div id="banner">
+<&Attr, Name=>'Title', User=> $User&>
+<br />
+<span class="description"></span>
+</div>
+
+<div id="content">
+<%ARGS>
+$User	=> undef
+</%ARGS>
+</%init>

Added: RT-Journal/trunk/html/Elements/Search
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Search	Thu May 27 17:46:37 2004
@@ -0,0 +1 @@
+<form action="<%$RT::WebPath%>/Journal/index.html" method="post"><input size=12 name="quicksearch"> <input type=submit value="<%loc('Search Journals')%>"></form>

Added: RT-Journal/trunk/html/Elements/SelectCategory
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/SelectCategory	Thu May 27 17:46:37 2004
@@ -0,0 +1 @@
+<input size="30" name="Category">

Added: RT-Journal/trunk/html/Elements/Sidebar
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Sidebar	Thu May 27 17:46:37 2004
@@ -0,0 +1,8 @@
+<a href="<& Attr, User => $User, Name=>'BaseURL'&>"><& Attr, User => $User, Name => 'Title'&></a><br>
+<a href="<%$RT::WebBaseURL%>Journal/Prefs.html"><&|/l&>Preferences</&> (<&|/l&>Requires login</&>)</a><br>
+% if ($session{'CurrentUser'} && $session{'CurrentUser'}->Id) {
+<a href="<%$RT::WebBaseURL%>NoAuth/Logout.html?URL=<& Attr, User => $User, Name=>'BaseURL'&>"><&|/l&>Logout</&></a><br>
+% }
+<%ARGS>
+$User
+</%ARGS>

Added: RT-Journal/trunk/html/Elements/Tabs
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Elements/Tabs	Thu May 27 17:46:37 2004
@@ -0,0 +1,78 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%#  Copyright (c) 2002-2003 Jesse Vincent <jesse at bestpractical.com>
+%#  
+%#  This program is free software; you can redistribute it and/or modify
+%#  it under the terms of version 2 of the GNU General Public License 
+%#  as published by the Free Software Foundation.
+%# 
+%#  A copy of that license should have arrived with this
+%#  software, but in any event can be snarfed from www.gnu.org.
+%# 
+%#  This program 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.
+%# 
+%# END LICENSE BLOCK
+
+<& /Elements/Header, Title => $Title &>
+<& /Elements/PageLayout,
+    current_toptab => 'Journal/index.html',
+    current_tab => $current_toptab,
+    current_subtab => $current_tab,
+    toptabs => $toptabs,
+    tabs => $second_tabs,
+    topactions => $topactions,
+    actions => $actions,
+    subactions => $subactions,
+    title => $Title
+&>
+<%INIT>
+my $action;
+
+
+my $toptabs = { a => { title => loc('RT'),
+                       path  => '', },
+                aab => { title   => loc('Journals'),
+                         path    => 'Journal/index.html'}
+                };
+
+my $second_tabs = { 'aab' => { title => loc('My Journal'),
+                                               path  => 'Journal/Show.html?user='.$session{'CurrentUser'}->Name },
+                                       post => { title => loc('Post'),
+                                                 path => 'Journal/Post.html' },
+#                                      'articles' => { title => loc('Friends'),
+#                                              path => 'Journal/Show.html?who=friends' },
+#                                      'articles2' => { title => loc('Workgroup'),
+#                                              path => 'Journal/Show.html?who=workgroup' },
+#                                      'search' => { title => loc('Search'),
+#                                              path => 'Journal/Search.html' },
+#                                      'd' => { title => loc('Configuration'),
+#                                               path  => 'Journal/Admin.html' } 
+                                 };
+
+my $topactions = {
+        B => { html => $m->scomp('/Journal/Elements/Search') }
+        };
+
+                    
+  # Now let callbacks add their extra tabs
+  $m->comp('/Elements/Callback', topactions => $topactions, toptabs => $toptabs, %ARGS);
+
+  foreach my $tab (sort keys %{$second_tabs}) {
+    if ($second_tabs->{$tab}->{'path'} eq $current_toptab) {
+      $second_tabs->{$tab}->{"subtabs"} = $tabs;
+      $second_tabs->{$tab}->{"current_subtab"} = $current_tab;
+    }
+        
+  }
+</%INIT>
+<%ARGS>
+$current_toptab => undef
+$current_tab => undef
+$tabs => undef
+$actions => undef
+$subactions => undef
+$Title => undef
+</%ARGS>

Added: RT-Journal/trunk/html/Login.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Login.html	Thu May 27 17:46:37 2004
@@ -0,0 +1 @@
+$m->comp('/autohandler', %ARGS);

Added: RT-Journal/trunk/html/Post.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Post.html	Thu May 27 17:46:37 2004
@@ -0,0 +1,40 @@
+<& Elements/Tabs, Title => loc("Post Journal") &>
+<br><br>
+<&|/l&>Add this to the bookmarks bar to blog urls you find interesting:</&>
+<A href="javascript:void(window.open('<%$RT::WebURL%>Journal/Post.html?new-RefersTo='+escape(window.location)+'&Content='+escape(document.selection)+'&Subject='+escape(document.title),'webloglet','scrollbars=yes,status=yes,location=yes,toolbar=yes'));"><&|/l&>RT Journal Bookmarklet</&></a><BR>
+
+<FORM ACTION="Article.html" METHOD="POST" ENCTYPE="multipart/form-data">
+<INPUT TYPE=HIDDEN Name="id" VALUE="new">
+<A NAME="top"></a>
+
+<BR>
+<&|/l&>Subject</&>:
+<INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="<%$ARGS{Subject} || ''%>"><br>
+<&|/l&>Category</&>:<& Elements/SelectCategory &><br>
+<&|/l&>Attach:</&>: <INPUT TYPE=FILE NAME="Attach"><br>
+<&|/l&>Content</&>:<br>
+
+<& /Elements/MessageBox, Default => $ARGS{Content} &>
+
+<BR>
+
+<&|/l&>Refers to</&><input size=100 name="new-RefersTo" VALUE="<%$ARGS{'new-RefersTo'} %>">
+<BR><&|/l&>Referred to by</&><input size=100 name="RefersTo-new"<% $ARGS{'RefersTo-new'} && " VALUE=\"$ARGS{'RefersTo-new'}\"" %>>
+
+<BR>
+
+<& /Elements/Submit, Label => loc("Create") &>
+</FORM>
+
+<%INIT>
+
+my $q = RT::Queue->new($session{'CurrentUser'});
+$q->Load('Journal');
+$ARGS{'Queue'} = $q->Name;
+$ARGS{'Owner'} = $session{'CurrentUser'}->id;
+$ARGS{'Status'}  = 'new';
+
+my $cat = RT::CustomField->new($session{'CurrentUser'});
+$cat->LoadByNameAndQueue(Queue => $q->Id, Name => 'Category');
+
+</%INIT>

Added: RT-Journal/trunk/html/Prefs.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Prefs.html	Thu May 27 17:46:37 2004
@@ -0,0 +1,43 @@
+<%init>
+
+
+
+
+my $link            = {};
+my $pref_base =
+  "fsck.com://RT/User/" . $session{'CurrentUser'}->id . "/Journal/";
+
+foreach my $param qw(BaseURL Title StyleURL) {
+
+    my $url_base = $pref_base . $param;
+
+    $link->{$param} = RT::Link->new( $session{'CurrentUser'} );
+    $link->{$param}->LoadByCols( Base => $url_base, Type => 'RefersTo' );
+
+	my $value = $ARGS{$param};
+	next unless($value);
+	unless($value =~ /^(\w+):/) {
+		$value="text:".$value;
+	}
+    if ( $value ) {
+        if ( $link->{$param}->id ) {
+            $link->{$param}->SetTarget( $value );
+        }
+        else {
+            $link->{$param}->Create(
+                Base   => $url_base,
+                Type   => 'RefersTo',
+                Target => $value
+            );
+        }
+    }
+}
+</%init>
+<& Elements/Header, User => $session{'CurrentUser'}&>
+<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>
+% }
+<&/Elements/Submit&>
+</form>
+<& Elements/Footer, User => $session{'CurrentUser'}, %ARGS &>

Added: RT-Journal/trunk/html/Show.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/Show.html	Thu May 27 17:46:37 2004
@@ -0,0 +1,70 @@
+<& Elements/Tabs &>
+<h1><&|/l,$session{'CurrentUser'}->UserObj->Name&>Journal of [_1]</&></h1>
+%while( my $post =  $tix->Next) {
+% my $my_category =  $post->FirstCustomFieldValue('Category');
+<%$post->CreatedObj->AsString%><br>
+<h2><a href="Article.html?id=<%$post->id%>"><%$post->Transactions->First->Subject|| loc('Untitled')%></a></h2>
+% my $content = $post->Transactions->First->Content;
+% $content =~ s/-- (.*)$//gism;
+% $content =~ s/\n/<br>/gi;
+<%$content|n%>
+% my $refto = $post->RefersTo;
+<div align="right">
+% while( my $link = $refto->Next ) {
+<A href="<%$link->TargetURI->Resolver->HREF%>"><%$link->TargetURI->Resolver->HREF%></a><br>
+% }
+</div>
+% if ($show =~/comments/) {
+<hr>
+% my $history = $post->Transactions();
+% $history->Limit(FIELD => 'Type', VALUE => 'Comment');
+% while (my $comment = $history->Next) {
+<blockquote><%$comment->CreatorObj->Name%> - (<%$post->CreatedObj->AsString%>)<br>
+<%$comment->Content%>
+</blockquote>
+<hr>
+% }
+% }
+% if ($session{'CurrentUser'}->Id == $post->OwnerObj->Id ) {
+[<a href="Edit.html?id=<%$post->Id%>"><&|/l&>Edit</&></a>]
+% }
+% my $comments = $post->Transactions;
+% $comments->Limit(FIELD => 'Type', VALUE => 'Comment');
+[<a href="Article.html?id=<%$post->Id%>"><&|/l,$comments->Count&>[_1] Comments</&></a>]
+<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> |
+<a href="Show.html?show=<%$ARGS{'show'}%>&user=<%$user%>&category=<%$category%>&first=<%$first-1%>"><&|/l&>Previous page</&></a> |
+% if ($show =~ /comments/) {
+<a href="Show.html?show=article&user=<%$user%>&category=<%$category%>&first=<%$first%>">Hide comments</a>
+% } else {
+<a href="Show.html?show=article|comments&user=<%$user%>&category=<%$category%>&first=<%$first%>">Show comments</a>
+% }
+<hr>
+<%INIT>
+my $q = RT::Queue->new($RT::SystemUser);
+$q->Load('Journal');
+
+my $cat = RT::CustomField->new($RT::SystemUser);
+$cat->LoadByNameAndQueue(Name => 'Category', Queue => $q->Id);
+
+my $tix = RT::Tickets->new($session{'CurrentUser'});
+$tix->LimitQueue(VALUE => 'Journal');
+$tix->OrderBy(FIELD=>'Created', ORDER => 'DESC');
+if ($user) {
+$tix->LimitOwner(VALUE => $user);
+}
+if ($category) {
+$tix->LimitCustomField(CUSTOMFIELD => $cat->Id, OPERATOR => 'LIKE', VALUE => $category."%");
+}
+$tix->RowsPerPage($count);
+$tix->FirstRow($first);
+</%INIT>
+<%ARGS>
+$user	=> undef
+$first	=> undef
+$category => undef
+$show => 'article'
+$count	=> 25
+</%ARGS>

Added: RT-Journal/trunk/html/User/dhandler
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/User/dhandler	Thu May 27 17:46:37 2004
@@ -0,0 +1,87 @@
+<%args>
+$Count => 25
+$Page => 1
+</%args>
+<%flags>
+inherit => 0
+</%flags>
+<%init>
+my $argument = $m->dhandler_arg;
+my $username;
+my $category;
+my $mode;
+my $entry;
+if ($argument =~ /^(.*?)\/Logout/) {
+ 	tied(%session)->delete;
+	$username = $1;
+}
+if ($argument =~ /^(.*?)\/RSS$/) {
+	$username = $1;
+	$category = 'RSS';
+} elsif ($argument =~ /^(.*?)\/Prefs/) {
+	$username = $1;
+	$mode = 'prefs';
+} elsif ($argument =~ /^(.*?)\/Category\/(.*)$/) {
+	$username = $1;
+	$category = $2;
+} elsif ($argument =~ /^(.*?)\/Entry\/(.*)$/) {
+	$username = $1;
+	$entry = $2;
+} else {
+	$username = $argument;	
+}
+
+if ($category =~ qr{^(.*)RSS$}i) {
+	$category = $1;
+	$mode = 'rss';
+}
+$category =~ s#/$##;
+
+$username ='jesse';
+my $user = RT::User->new($RT::SystemUser);
+$user->Load($username);
+unless($user->Id) {
+	$m->comp("../Elements/Abort", Message =>"User not found");
+	
+}
+
+
+if ($mode eq 'prefs') {
+	 $m->comp('/Journal/Prefs.html');
+	$m->abort();
+
+}
+
+my $guest_user = RT::CurrentUser->new('guest');
+my $q = RT::Queue->new($RT::SystemUser);
+$q->Load('Journal');
+
+my $cat = RT::CustomField->new($RT::SystemUser);
+$cat->LoadByNameAndQueue(Name => 'Category', Queue => $q->Id);
+
+my $tix = RT::Tickets->new($guest_user);
+$tix->LimitQueue(VALUE => 'Journal');
+$tix->OrderBy(FIELD=>'Created', ORDER => 'DESC');
+if ($username) {
+	$tix->LimitOwner(VALUE => $username);
+}
+if ($category) {
+	$tix->LimitCustomField(CUSTOMFIELD => $cat->Id, OPERATOR => 'LIKE', VALUE => $category."%");
+}
+
+
+
+if ($entry) { 
+	$m->comp("../Elements/Entry", id => $entry, User => $user);
+
+}
+elsif ($mode eq 'rss') {
+	$tix->RowsPerPage(10);
+	$m->comp("../Elements/BlogAsRSS", EntriesObj => $tix, user => $username, User => $user);
+} else {
+	$tix->RowsPerPage($Count);
+	$tix->GotoPage($ARGS{'Page'});
+	$m->comp("../Elements/BlogAsHTML", EntriesObj => $tix, user => $username, User => $user, Page => $Page);
+
+} 
+</%init>

Added: RT-Journal/trunk/html/clean.css
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/clean.css	Thu May 27 17:46:37 2004
@@ -0,0 +1,268 @@
+<%flags>
+inherit => 0
+</%flags>
+
+	body {
+		margin:0px 0px 10px 0px;
+		background:#FFFFFF;		
+		}
+	A 			{ color: #999966; text-decoration: none; font-weight:bold; } 
+	A:link		{ color: #999966; text-decoration: none; } 
+	A:visited	{ color: #999966; text-decoration: none; } 
+	A:active	{ color: #99CC66;  } 
+	A:hover		{ color: #99CC66;  }
+	
+	h1, h2, h3 {
+		margin: 0px;
+		padding: 0px;
+	}
+
+	#banner {
+		font-family:verdana, arial, sans-serif;
+		color:#FFF;
+		font-size:x-large;
+		font-weight:normal;
+		border-bottom:1px dotted #FFF;
+		border-top:3px solid #99CCFF;
+  		background:#336699;
+  		padding:15px; 
+  		text-transform:uppercase;
+		letter-spacing: .2em; 		
+		}
+	
+	#banner a,
+        #banner a:link,
+        #banner a:visited,
+        #banner a:active,
+        #banner a:hover {
+		font-family:verdana, arial, sans-serif;
+		font-size: x-large;
+		color: #FFF;
+		text-decoration: none;
+		}
+
+	.description {
+		font-family:verdana, arial, sans-serif;
+		color:#99CCFF;
+		font-size:x-small;
+		font-weight:bold;
+  		background:#336699;	
+  		text-transform:none;	
+		letter-spacing: none; 		
+		}	
+				
+	#content {
+		float:left;
+		width:65%;
+		background:#fff;
+		border-right:1px dotted #999;
+		margin-right:15px;
+		padding-bottom:20px;
+		}
+
+	#links {
+		background:#fff;
+		padding-right:15px;				
+		}
+		
+	.blog {
+  		padding-left:15px;
+  		padding-top:15px;
+  		padding-right:15px;			
+		}	
+	
+	.blogbody {
+		font-family:georgia, verdana, arial, sans-serif;
+		color:#333;
+		font-size:small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding-left:10px;	
+  		padding-right:10px;
+  		padding-top:10px;			
+		}
+
+
+	.blogbody a,
+	.blogbody a:link,
+	.blogbody a:visited,
+	.blogbody a:active,
+	.blogbody a:hover {
+		font-weight: normal;
+		text-decoration: underline;
+	}
+	
+	.title	{ 
+		font-family: verdana, arial; 
+		font-size: small; 
+		color: #003366; 
+		text-transform: uppercase;
+		font-weight:bold;	
+		}			
+		
+	#menu {
+  		margin-bottom:15px;
+		background:#FFF;  							
+		}	
+		
+	.date	{ 
+		font-family:georgia, verdana, arial, sans-serif; 
+		font-size: small; 
+		color: #666; 
+		border:1px solid #999;
+		padding:5px;
+		margin-bottom:10px;
+		font-weight:normal;
+		}			
+		
+	.posted	{ 
+		font-family:verdana, arial, sans-serif; 
+		font-size: x-small; 
+		color: #003366;
+		margin-bottom:15px; 
+		}
+		
+		
+	.calendar {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:x-small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:2px;
+  		text-align:center;	
+		}
+	
+	.calendarhead {	
+		font-family:verdana, arial, sans-serif;
+		color:#003366;
+		font-size:x-small;
+		font-weight:bold;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:2px;				
+		}	
+	
+	.side {
+		font-family:verdana, arial, sans-serif;
+		color:#333;
+		font-size:x-small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:2px;				
+		}	
+		
+	.sidetitle {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:x-small;
+		font-weight:bold;
+  		background:#EEE;
+  		line-height:140%;
+  		padding:2px;
+  		margin-top:10px;
+  		text-align:center;
+  		text-transform:uppercase;
+		letter-spacing: .2em;  					
+		}		
+	
+	.syndicate {
+		font-family:verdana, arial, sans-serif;
+		font-size:xx-small;
+		font-weight:bold;		
+  		line-height:140%;
+  		padding:2px;
+  		margin-top:10px;
+  		text-align:center;
+  		background:#EEE;  		
+ 		}	
+		
+	.powered {
+		font-family:verdana, arial, sans-serif;
+		color:#003366;
+		font-size:xx-small;
+		font-weight:bold;
+		border-top:1px solid #CCC;
+		border-bottom:1px solid #CCC;		
+		line-height:140%;
+		text-transform:uppercase; 
+		padding:2px;
+		margin-top:10px;
+		text-align:center;
+		letter-spacing: .2em  					
+		}	
+		
+	
+	.comments-body {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:10px;			
+		}		
+
+	.comments-post {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:x-small;
+		font-weight:normal;
+  		background:#FFF;			
+		}	
+
+	.trackback-body {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:10px;			
+		}		
+
+	.trackback-url {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:small;
+		font-weight:normal;
+  		background:#FFF;
+  		line-height:140%;
+  		padding:10px;
+  		border:1px dashed #CCC;			
+		}
+
+	.trackback-post {
+		font-family:verdana, arial, sans-serif;
+		color:#666;
+		font-size:x-small;
+		font-weight:normal;
+  		background:#FFF;			
+		}
+
+		
+	.comments-head	{ 
+		font-family: georgia, verdana, arial, sans-serif; 
+		font-size: small; 
+		color: #666; 
+		border:1px solid #999;
+		padding:5px;
+		font-weight:normal;
+		margin-top:10px;		
+		}		
+
+	#banner-commentspop {
+		font-family:georgia, verdana, arial, sans-serif;
+		color:#FFF;
+		font-size:large;
+		font-weight:bold;
+		border-bottom:1px dotted #FFF;
+		border-top:3px solid #99CCFF;
+  		background:#336699;
+  		padding:15px; 
+		}
+
+

Added: RT-Journal/trunk/html/index.html
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/html/index.html	Thu May 27 17:46:37 2004
@@ -0,0 +1,22 @@
+<& Elements/Tabs &>
+<%INIT>
+my $QueueName		= 'Journals';
+my $QueueDescription	= 'Personal Journal'; # loc
+
+my $queue = RT::Queue->new($session{'CurrentUser'});
+
+my ($ok, $msg) = $queue->Load($QueueName);
+
+unless ($ok) {
+    my $new_entry = RT::Queue->new($RT::SystemUser);
+    my ( $return, $msg ) = $new_entry->Create(
+	Name		=> $QueueName,
+	Description	=> $QueueDescription,
+	Disabled	=> 1,
+    );
+
+    $queue->Load($QueueName);
+
+    # XXX - set up ACL
+}
+</%INIT>

Added: RT-Journal/trunk/lib/RT/Journal.pm
==============================================================================
--- (empty file)
+++ RT-Journal/trunk/lib/RT/Journal.pm	Thu May 27 17:46:37 2004
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+
+package RT::Journal;
+our $VERSION = '0.01_01';
+
+1;
+


More information about the Rt-commit mailing list