[Rt-commit] [svn] r1058 - in RT-Journal: . trunk/html/Journal
trunk/html/Journal/Elements
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Sat Jun 12 20:10:08 EDT 2004
Author: jesse
Date: Sat Jun 12 20:10:07 2004
New Revision: 1058
Modified:
RT-Journal/ (props changed)
RT-Journal/trunk/html/Journal/Elements/AsRss
RT-Journal/trunk/html/Journal/Elements/Attr
RT-Journal/trunk/html/Journal/Elements/Entry
RT-Journal/trunk/html/Journal/Prefs.html
RT-Journal/trunk/html/Journal/Show.html
Log:
----------------------------------------------------------------------
r1792 at debian: jesse | 2004-06-13T09:12:11.261804Z
working on a port to 3.1
----------------------------------------------------------------------
Modified: RT-Journal/trunk/html/Journal/Elements/AsRss
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/AsRss (original)
+++ RT-Journal/trunk/html/Journal/Elements/AsRss Sat Jun 12 20:10:07 2004
@@ -7,7 +7,7 @@
<%INIT>
my @Query;
-push ( @Query, "Queue = '__Journal')");
+push ( @Query, "Queue = '$RT::JournalQueue')");
push ( @Query, "Creator = '$User'" ) if ($User);
push ( @Query, "Created >= '$After'" ) if ($After);
push ( @Query, "Created <= '$Before'" ) if ($Before);
Modified: RT-Journal/trunk/html/Journal/Elements/Attr
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/Attr (original)
+++ RT-Journal/trunk/html/Journal/Elements/Attr Sat Jun 12 20:10:07 2004
@@ -3,15 +3,10 @@
$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);
+my @attr = $User->Attributes->Named('RT::Journal-'.$Name);
+if( UNIVERSAL::can($attr[0], 'Value') {
+ $m->out($attr[0]->Value);
+}
return();
</%init>
Modified: RT-Journal/trunk/html/Journal/Elements/Entry
==============================================================================
--- RT-Journal/trunk/html/Journal/Elements/Entry (original)
+++ RT-Journal/trunk/html/Journal/Elements/Entry Sat Jun 12 20:10:07 2004
@@ -1,7 +1,7 @@
<html>
<head>
<title><%$post->Subject%></title>
-<link rel="stylesheet" href="http://rt3.fsck.com/Journal/clean.css" type="text/css" />
+<link rel="stylesheet" href="<%$RT::WebURL%>/Journal/clean.css" type="text/css" />
</head>
<body>
@@ -62,7 +62,7 @@
<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 <sendmespam at example.com>)<br>
+Name: <input size="40" name="From"> (ex: Bob Dobbs <sendmespam at example.com>)<br>
<textarea name="comment" rows=10 cols=70></textarea>
<input type="submit">
</form>
@@ -72,8 +72,8 @@
</html>
<%INIT>
-my $guest = RT::CurrentUser->new('guest');
-my $post = RT::Ticket->new( $guest );
+my $guest = RT::CurrentUser->new('RT::Journal-Guest');
+my $post = RT::Ticket->new( $session{'CurrentUser'} || $guest );
$post->Load($id);
unless ($post->id) {
$m->comp("Abort", Message => "Invalid post id" );
@@ -88,6 +88,7 @@
# comment on the ticket
my $entity = MIME::Entity->build(Subject => $args->{'Subject'},
From => $args->{'From'},
+ X-IP-Address => $ENV{'REMOTE_ADDR'},
Data => $args->{'comment'});
$post->Comment(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 Sat Jun 12 20:10:07 2004
@@ -2,42 +2,29 @@
-
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;
+
+ my @attrs =$session{'CurrentUser'}->Attributes->Named('RT::Journal-'.$param);
+ if ($attr[0]) {
+ $default = $attr[0]->Value;
}
+
if ( $value ) {
- if ( $link->{$param}->id ) {
- $link->{$param}->SetTarget( $value );
- }
- else {
- $link->{$param}->Create(
- Base => $url_base,
- Type => 'RefersTo',
- Target => $value
- );
+ if ($attr[0]) { $attr[0]->SetValue($value); }
+ else { $session->{'CurrentUser'}->AddAttribute( Name => $param, Value => $value ) }
}
}
-}
</%init>
-<& Elements/Header, User => $session{'CurrentUser'}&>
+<& 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>
% }
<&/Elements/Submit&>
</form>
-<& Elements/Footer, User => $session{'CurrentUser'}, %ARGS &>
Modified: RT-Journal/trunk/html/Journal/Show.html
==============================================================================
--- RT-Journal/trunk/html/Journal/Show.html (original)
+++ RT-Journal/trunk/html/Journal/Show.html Sat Jun 12 20:10:07 2004
@@ -1,11 +1,11 @@
<& Elements/Tabs &>
<h1><&|/l,$session{'CurrentUser'}->UserObj->Name&>Journal of [_1]</&></h1>
%while( my $post = $tix->Next) {
-% my $my_category = $post->FirstCustomFieldValue('Category');
+% my $my_category = $post->FirstCustomFieldValue('RT::Journal-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/^-- (.*)$//gism; # kill all signatures
% $content =~ s/\n/<br>/gi;
<%$content|n%>
% my $refto = $post->RefersTo;
@@ -14,49 +14,35 @@
<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');
+% $comments->Limit(FIELD => 'Type', VALUE => 'Correspond');
[<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> |
+% if ($page > 1) {
<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($RT::JournalQueue);
my $cat = RT::CustomField->new($RT::SystemUser);
-$cat->LoadByNameAndQueue(Name => 'Category', Queue => $q->Id);
+$cat->LoadByNameAndQueue( Name => 'RT::Journal-Category', Queue => $q->Id );
-my $tix = RT::Tickets->new($session{'CurrentUser'});
-$tix->LimitQueue(VALUE => $RT::JournalQueue);
-$tix->OrderBy(FIELD=>'Created', ORDER => 'DESC');
+my $tix = RT::Tickets->new( $session{'CurrentUser'} );
+$tix->LimitQueue( VALUE => $RT::JournalQueue );
+$tix->OrderBy( FIELD => 'Created', ORDER => 'DESC' );
if ($user) {
- $tix->LimitOwner(VALUE => $user);
+ $tix->LimitOwner( VALUE => $user );
}
if ($category) {
-# $tix->LimitCustomField(CUSTOMFIELD => $cat->Id, OPERATOR => 'LIKE', VALUE => $category."%");
+ $tix->LimitCustomField(
+ CUSTOMFIELD => $cat->Id,
+ OPERATOR => 'LIKE',
+ VALUE => $category . "%"
+ );
}
$tix->RowsPerPage($count);
$tix->FirstRow($first);
More information about the Rt-commit
mailing list