[Rt-commit] r15358 - in rt/branches/3.999-DANGEROUS: . lib/RT/Interface lib/RT/Model lib/RT/Search share/html/Admin/Elements share/html/Admin/Tools/Shredder/Elements/Object share/html/Elements share/html/Elements/RT__Model__Template share/html/Search/Elements share/html/Ticket/Elements
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Aug 22 07:24:40 EDT 2008
Author: sunnavy
Date: Fri Aug 22 07:24:38 2008
New Revision: 15358
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
rt/branches/3.999-DANGEROUS/lib/RT/Search/FromSQL.pm
rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/PickObjects
rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment
rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket
rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--User
rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/SelectObjects
rt/branches/3.999-DANGEROUS/share/html/Elements/RT__Model__Template/ColumnMap
rt/branches/3.999-DANGEROUS/share/html/Elements/SelectSortOrder
rt/branches/3.999-DANGEROUS/share/html/Search/Elements/BuildFormatString
rt/branches/3.999-DANGEROUS/share/html/Search/Elements/EditFormat
rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchObject
rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchesForObjects
rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/AddWatchers
Log:
r15963 at sunnavys-mb: sunnavy | 2008-08-22 18:13:48 +0800
merge left stuff from 3.7 to 3.8, I can't explain why I missed them except carelessness
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm Fri Aug 22 07:24:38 2008
@@ -57,8 +57,8 @@
use UNIVERSAL::require;
BEGIN {
- use Exporter ();
- use vars qw ( @ISA @EXPORT_OK);
+ use base 'Exporter';
+ use vars qw ( @EXPORT_OK);
# set the version for version checking
our $VERSION = 2.0;
@@ -148,7 +148,8 @@
my ( $From, $junk ) = parse_sender_address_from_head($head);
if ( ( $From =~ /^mailer-daemon\@/i )
- or ( $From =~ /^postmaster\@/i ) )
+ or ( $From =~ /^postmaster\@/i )
+ or ( $From eq "" ) )
{
return (1);
@@ -173,6 +174,13 @@
return (1);
}
+ # Per RFC3834, any Auto-Submitted header which is not "no" means
+ # it is auto-generated.
+ my $AutoSubmitted = $head->get("Auto-Submitted") || "";
+ if ( length $AutoSubmitted and $AutoSubmitted ne "no" ) {
+ return (1);
+ }
+
# First Class mailer uses this as a clue.
my $FCJunk = $head->get("X-FC-Machinegenerated") || "";
if ( $FCJunk =~ /^true/i ) {
@@ -197,7 +205,7 @@
=item From - sender's address, by default is 'correspond_address';
-=item To - reciepient, by default is 'OwnerEmail';
+=item To - recipient, by default is 'OwnerEmail';
=item Bcc - optional Bcc recipients;
@@ -316,7 +324,7 @@
|| $args{'entity'}->head->get('Cc')
|| $args{'entity'}->head->get('Bcc') )
{
- Jifty->log->info( $msgid . " No recipients found. Not sending.\n" );
+ Jifty->log->info( $msgid . " No recipients found. Not sending." );
return -1;
}
@@ -623,8 +631,9 @@
} else {
# XXX: what if want to forward txn of other object than ticket?
- $subject = add_subject_tag( $subject, $txn->object_id );
- $from = $txn->object->queue_obj->correspond_address
+ my $obj = $txn->object;
+ $subject = add_subject_tag( $subject, $obj );
+ $from = $obj->queue_obj->correspond_address
|| RT->config->get('CorrespondAddress');
}
$mail->head->set( subject => "Fwd: $subject" );
@@ -682,7 +691,7 @@
# if the passphrase fails, either you have a bad passphrase
# or gpg-agent has died. That should get caught in Create and
# Update, but at least throw an error here
- if ( ( $line->{'Operation'} || '' eq 'PassphraseCheck' )
+ if ( ( $line->{'Operation'} || '' ) eq 'PassphraseCheck'
&& $line->{'Status'} =~ /^(?:BAD|MISSING)$/ )
{
Jifty->log->error("$line->{'Status'} PASSPHRASE: $line->{'message'}");
@@ -895,7 +904,11 @@
return ( undef, undef );
}
- my $name = ( $AddrObj->phrase || $AddrObj->comment || $AddrObj->address );
+ my $name =
+ ( $AddrObj->name
+ || $AddrObj->phrase
+ || $AddrObj->comment
+ || $AddrObj->address );
#Lets take the from and load a user object.
my $Address = $AddrObj->address;
@@ -983,27 +996,46 @@
sub parse_ticket_id {
my $subject = shift;
- my $id;
my $rtname = RT->config->get('rtname');
my $test_name = RT->config->get('EmailsubjectTagRegex')
|| qr/\Q$rtname\E/i;
+ my $id;
if ( $subject =~ s/\[$test_name\s+\#(\d+)\s*\]//i ) {
- my $id = $1;
- Jifty->log->debug("Found a ticket ID. It's $id");
- return $id;
- } else {
- return undef;
+ $id = $1;
}
+ else {
+ foreach my $tag ( RT->system->subject_tag ) {
+ next unless $subject =~ s/\[\Q$tag\E\s+\#(\d+)\s*\]//i;
+ $id = $1;
+ last;
+ }
+ }
+ return undef unless $id;
+
+ Jifty->log->debug("Found a ticket ID. It's $id");
+ return $id;
}
sub add_subject_tag {
my $subject = shift;
- my $id = shift;
+ my $ticket = shift;
+ unless ( ref $ticket ) {
+ my $tmp = RT::Model::Ticket->new( current_user => RT->system_user);
+ $tmp->Load($ticket);
+ $ticket = $tmp;
+ }
+ my $id = $ticket->id;
+ my $queue_tag = $ticket->queue_obj->subject_tag;
my $tag_re = RT->config->get('EmailsubjectTagRegex');
unless ($tag_re) {
+ my $tag = $queue_tag || RT->config->get('rtname');
+ $tag_re = qr/\Q$tag\E/;
+ }
+ elsif ($queue_tag) {
+ $tag_re = qr/$tag_re|\Q$queue_tag\E/;
my $rtname = RT->config->get('rtname');
$tag_re = qr/\Q$rtname\E/o;
}
@@ -1011,7 +1043,9 @@
$subject =~ s/(\r\n|\n|\s)/ /gi;
chomp $subject;
- return "[" . RT->config->get('rtname') . " #$id] $subject";
+ return "["
+ . ( $queue_tag || RT->config->get('rtname') )
+ . " #$id] $subject";
}
=head2 gateway ARGSREF
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm Fri Aug 22 07:24:38 2008
@@ -186,6 +186,8 @@
disabled => 0,
lookup_type => '',
repeated => 0,
+ link_to_value => '',
+ include_content_for_value => '',
@_,
);
@@ -253,6 +255,8 @@
disabled => $args{'disabled'},
lookup_type => $args{'lookup_type'},
repeated => $args{'repeated'},
+ link_to_value => $args{'link_to_value'},
+ include_content_for_value => $args{include_content_for_value},
);
if ( exists $args{'ValuesClass'} ) {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Search/FromSQL.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Search/FromSQL.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Search/FromSQL.pm Fri Aug 22 07:24:38 2008
@@ -66,7 +66,7 @@
package RT::Search::FromSQL;
use strict;
-use base qw(RT::Search::Generic);
+use base qw(RT::Search);
=head2 describe
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/PickObjects
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/PickObjects (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/PickObjects Fri Aug 22 07:24:38 2008
@@ -55,7 +55,8 @@
% my $id = "object-".$object->id."-CF-".$id;
% if (!$read_only) {
<td valign="top">
-<input type="checkbox" id="<% $id %>" name="<% $id %>" value="1" <% $checked ? 'CHECKED' : ''%>
+<input type="checkbox" id="<% $id %>" name="<% $id %>" value="1" <% $checked ?
+'checked="checked"' : ''%>
/>
</td>
% }
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Attachment Fri Aug 22 07:24:38 2008
@@ -48,6 +48,6 @@
<%ARGS>
$object => undef
</%ARGS>
-<a href="<% RT->config->get('WebbaseURL') %>/Ticket/Attachment/<% $object->transaction_id %>/<% $object->id %>/">
+<a href="<% RT->config->get('WebURL') %>/Ticket/Attachment/<% $object->transaction_id %>/<% $object->id %>/">
Attachment(id:<% $object->id %>, Filename: <% $object->filename || '(no value)' %>)
</a>
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--Ticket Fri Aug 22 07:24:38 2008
@@ -48,6 +48,6 @@
<%ARGS>
$object => undef
</%ARGS>
-<a href="<% RT->config->get('WebbaseURL') %>/Ticket/Display.html?id=<% $object->id %>">
+<a href="<% RT->config->get('WebURL') %>/Ticket/Display.html?id=<% $object->id %>">
Ticket(id:<% $object->id %>, Subject: <% substr($object->subject, 0, 30) %>...)
</a>
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--User
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--User (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/Object/RT--User Fri Aug 22 07:24:38 2008
@@ -48,6 +48,6 @@
<%ARGS>
$object => undef
</%ARGS>
-<a href="<% RT->config->get('WebbaseURL') %>/Admin/Users/Modify.html?id=<% $object->id %>">
+<a href="<% RT->config->get('WebURL') %>/Admin/Users/Modify.html?id=<% $object->id %>">
User(id:<% $object->id %>, name: <% $object->name %>)
</a>
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/SelectObjects
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/SelectObjects (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Tools/Shredder/Elements/SelectObjects Fri Aug 22 07:24:38 2008
@@ -55,7 +55,7 @@
<div class="shredder-form">
<input id="shredder-select-all-objects-checkbox" type="checkbox" name="select_allobjects" onclick="checkAllobjects()" />
<span>click to check/uncheck all objects at once</span>
-<hr>
+<hr />
% foreach my $o( @objects ) {
<& objectCheckBox, object => $o &>
% }
Modified: rt/branches/3.999-DANGEROUS/share/html/Elements/RT__Model__Template/ColumnMap
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Elements/RT__Model__Template/ColumnMap (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Elements/RT__Model__Template/ColumnMap Fri Aug 22 07:24:38 2008
@@ -50,7 +50,7 @@
$attr => undef
</%ARGS>
<%ONCE>
-our $TEMPLATE_COLUMN_MAP = {
+our $COLUMN_MAP = {
id => {
title => '#',
attribute => 'id',
@@ -60,11 +60,11 @@
};
foreach my $col(qw(name description)) {
- $TEMPLATE_COLUMN_MAP->{ $col } = { attribute => $col, value => sub { return $_[0]->$col() } };
+ $COLUMN_MAP->{ $col } = { attribute => $col, value => sub { return $_[0]->$col() } };
}
</%ONCE>
<%INIT>
-$m->callback( COLUMN_MAP => $TEMPLATE_COLUMN_MAP, Callbackname => 'column_map', CallbackOnce => 1 );
-return get_column_map_entry( Map => $TEMPLATE_COLUMN_MAP, name => $name, Attribute => $attr );
+$m->callback( COLUMN_MAP => $COLUMN_MAP, Callbackname => 'column_map', CallbackOnce => 1 );
+return get_column_map_entry( Map => $COLUMN_MAP, name => $name, Attribute => $attr );
</%INIT>
Modified: rt/branches/3.999-DANGEROUS/share/html/Elements/SelectSortOrder
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Elements/SelectSortOrder (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Elements/SelectSortOrder Fri Aug 22 07:24:38 2008
@@ -47,7 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<select name="<%$name%>">
%foreach my $order (@orders) {
-<option value="<%$order%>" <%$order eq $default && 'SELECTED' %>>
+<option value="<%$order%>"<%$order eq $default && qq[ selected="selected"] |n %>>
<% shift @order_names %>
</option>
% }
Modified: rt/branches/3.999-DANGEROUS/share/html/Search/Elements/BuildFormatString
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Search/Elements/BuildFormatString (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Search/Elements/BuildFormatString Fri Aug 22 07:24:38 2008
@@ -85,7 +85,7 @@
depends_on depended_on_by
member_of members
parents children
- NEWLINE
+ NEWLINE Bookmark
);
$m->callback( CallbackOnce => 1, Callbackname => 'set_fields_once', Fields => \@fields );
Modified: rt/branches/3.999-DANGEROUS/share/html/Search/Elements/EditFormat
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Search/Elements/EditFormat (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Search/Elements/EditFormat Fri Aug 22 07:24:38 2008
@@ -56,7 +56,7 @@
<tr>
-<td valign="top"><select size="6" name="select_display_columns" multiple>
+<td valign="top"><select size="6" name="select_display_columns" multiple="multiple">
% foreach my $field ( @$available_columns) {
<option value="<% $field %>"><% _($field) %></option>
% }
Modified: rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchObject
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchObject (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchObject Fri Aug 22 07:24:38 2008
@@ -48,13 +48,21 @@
<%args>
@objects => undef
$name => undef
+$object => undef
</%args>
-<select name="<%$name%>">
+<%init>
+my $default_privacy = '';
+if ( $object && $object->id ) {
+ $default_privacy = ref($object).'-'.$object->id;
+}
+</%init>
+<select id="<%$name%>" name="<%$name%>">
% foreach my $object (@objects) {
+% my $privacy = ref($object).'-'.$object->id;
% if (ref($object) eq 'RT::Model::User' && $object->id == Jifty->web->current_user->id) {
-<option value="<%ref($object)%>-<%$object->id%>"><&|/l&>My saved searches</&></option>
+<option value="<%$privacy%>" <% ( $privacy eq $default_privacy ) ? "selected='selected'" : '' |n %> ><&|/l&>My saved searches</&></option>
% } else {
-<option value="<%ref($object)%>-<%$object->id%>"><&|/l, $object->name&>%1's saved searches</&></option>
+<option value="<%$privacy%>" <% ( $privacy eq $default_privacy ) ? "selected='selected'" : '' |n %> ><&|/l, $object->name&>%1's saved searches</&></option>
% }
% }
</select>
Modified: rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchesForObjects
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchesForObjects (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Search/Elements/SelectSearchesForObjects Fri Aug 22 07:24:38 2008
@@ -50,7 +50,7 @@
$name => undef
$search_type => 'Ticket',
</%args>
-<select name="<%$name%>">
+<select id="<%$name%>" name="<%$name%>">
% foreach my $object (@objects) {
% if (ref($object) eq 'RT::Model::User' && $object->id == Jifty->web->current_user->id) {
<option value=""><&|/l&>My saved searches</&></option>
Modified: rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/AddWatchers
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/AddWatchers (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/AddWatchers Fri Aug 22 07:24:38 2008
@@ -45,6 +45,9 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<br />
+<br />
+
<&|/l&>add new watchers</&>:<br />
<table>
@@ -55,7 +58,7 @@
<&|/l&>Username</&>
</td></tr>
% while (my $u = $Users->next ) {
-<tr><td><&/Elements/SelectWatcherType, name => "Ticket-AddWatcher-Principal-". $u->principal_id &></td><td><& '/Elements/ShowUser', user => $u &></td></tr>
+<tr><td><&/Elements/SelectWatcherType, name => "Ticket-AddWatcher-Principal-". $u->principal_id &></td><td><& '/Elements/ShowUser', user => $u, style=>'verbose' &></td></tr>
% }
% }
@@ -78,17 +81,17 @@
<tr><td>
<&/Elements/SelectWatcherType, name => "watcher_type_email1" &>
</td><td>
-<input name="watcher_address_email1" size="15" />
+<& /Elements/EmailInput, name => 'watcher_address_email1', size => '20' &>
</td></tr>
<tr><td>
<&/Elements/SelectWatcherType, name => "watcher_type_email2" &>
</td><td>
-<input name="watcher_address_email2" size="15" />
+<& /Elements/EmailInput, name => 'watcher_address_email2', size => '20' &>
</td></tr>
<tr><td>
<&/Elements/SelectWatcherType, name => "watcher_type_email3" &>
</td><td>
-<input name="watcher_address_email3" size="15" />
+<& /Elements/EmailInput, name => 'watcher_address_email3', size => '20' &>
</td></tr>
</table>
More information about the Rt-commit
mailing list