Commit e4cc62f2 authored by Jesse Vincent's avatar Jesse Vincent
Browse files

(empty commit message)

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/3.8-TESTING@13085 e417ac7c-1bcc-0310-8ffa-8f5827389a85
parent 9b147e7d
......@@ -94,7 +94,7 @@ sub DEBUG { warn @_ if $config{debug} >= shift }
# (XXX: Ask Autrijus how i18n changes these definitions.)
my $name = '[\w.-]+';
my $field = '(?:[a-zA-Z](?:[a-zA-Z0-9_-]|\s+)*)';
my $field = '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-(?:[a-z0-9_ :()/-]|\s)+)';
my $label = '[a-zA-Z0-9@_.+-]+';
my $labels = "(?:$label,)*$label";
my $idlist = '(?:(?:\d+-)?\d+,)*(?:\d+-)?\d+';
......@@ -455,7 +455,7 @@ sub edit {
whine "What type of object do you want to create?";
$bad = 1;
}
@objects = ("$type/new");
@objects = ("$type/new") if defined($type);
}
#return help($action, $type) if $bad;
return suggest_help($action, $type) if $bad;
......
This diff is collapsed.
......@@ -109,7 +109,7 @@ our %META = (
},
},
DefaultSummaryRows => {
Section => 'RT at a glance',
Section => 'RT at a glance', #loc
Overridable => 1,
Widget => '/Widgets/Form/Integer',
WidgetArguments => {
......@@ -187,7 +187,7 @@ our %META = (
Overridable => 1,
Widget => '/Widgets/Form/Select',
WidgetArguments => {
Description => 'Default queue',
Description => 'Default queue', #loc
Callback => sub {
my $ret = { Values => [], ValuesLabel => {}};
my $q = new RT::Queues($HTML::Mason::Commands::session{'CurrentUser'});
......@@ -207,12 +207,12 @@ our %META = (
Default => 'Individual messages',
Widget => '/Widgets/Form/Select',
WidgetArguments => {
Description => 'Email delivery',
Description => 'Email delivery', #loc
Values => [
'Individual messages',
'Daily digest',
'Weekly digest',
'Suspended'
'Individual messages', #loc
'Daily digest', #loc
'Weekly digest', #loc
'Suspended' #loc
]
}
},
......
......@@ -5002,7 +5002,7 @@ msgstr "Choisir la file"
#: share/html/Prefs/Quicksearch.html:55
msgid "Select queues to be displayed on the \"RT at a glance\" page"
msgstr "Sélectionnez les files à afficher dans la page \"RT en un coup d'œil\" page"
msgstr "Sélectionnez les files à afficher dans la page \"RT en un coup d'œil\""
#: share/html/Admin/Global/Scrip.html:61 share/html/Admin/Global/Scrips.html:59 share/html/Admin/Queues/Scrip.html:69 share/html/Admin/Queues/Scrips.html:75
msgid "Select scrip"
......
......@@ -63,7 +63,7 @@ BEGIN {
@EXPORT = qw(expand_list form_parse form_compose vpush vsplit);
}
my $field = '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-(?:[a-z0-9_ -]|\s)+)';
sub field_spec { '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-(?:[a-z0-9_ :()/-]|\s)+)' }
# WARN: this code is duplicated in bin/rt.in,
# change both functions at once
......@@ -96,6 +96,7 @@ sub form_parse {
my @forms = ();
my @lines = split /\n/, $_[0];
my ($c, $o, $k, $e) = ("", [], {}, "");
my $field = __PACKAGE__->field_spec;
LINE:
while (@lines) {
......
......@@ -344,6 +344,27 @@ sub load_or_create_queue {
return $obj;
}
=head2 load_or_create_custom_field
=cut
sub load_or_create_custom_field {
my $self = shift;
my %args = ( Disabled => 0, @_ );
my $obj = RT::CustomField->new( $RT::SystemUser );
if ( $args{'Name'} ) {
$obj->LoadByName( Name => $args{'Name'}, Queue => $args{'Queue'} );
} else {
die "Name is required";
}
unless ( $obj->id ) {
my ($val, $msg) = $obj->Create( %args );
die "$msg" unless $val;
}
return $obj;
}
sub store_rights {
my $self = shift;
......
......@@ -121,6 +121,7 @@ sub extract_strings_from_code {
my $line = 1;
while (m!\G.*?<&\|/l(.*?)&>(.*?)</&>!sg) {
my ( $vars, $str ) = ( $1, $2 );
$vars =~ s/[\n\r]//g;
$line += ( () = ( $& =~ /\n/g ) ); # cryptocontext!
$str =~ s/\\'/\'/g;
#print "STR IS $str\n";
......
......@@ -45,61 +45,13 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<table border="0" cellspacing="0" cellpadding="1" width="100%" class="collection">
% if ( $ShowHeader ) {
<& /Elements/CollectionAsTable/Header,
%ARGS,
Class => $Class,
Format => \@Format,
FormatString => $Format,
Order => \@Order,
OrderBy => \@OrderBy,
Rows => $Rows,
Page => $Page,
AllowSorting => $AllowSorting,
BaseURL => $BaseURL,
maxitems => $maxitems,
&>
% }
<%PERL>
my ($i, $column_map) = (0, {});
while ( my $record = $Collection->Next ) {
# Every ten rows, flush the buffer and put something on the page.
$m->flush_buffer unless ++$i % 10;
$m->comp('/Elements/CollectionAsTable/Row',
i => $i,
Format => \@Format,
record => $record,
maxitems => $maxitems,
ColumnMap => $column_map,
Class => $Class,
);
}
</%PERL>
</table>
% if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) {
<hr />
% my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
<&|/l, $Page, int($TotalFound/$Rows)+$oddRows&>Page [_1] of [_2]</&>
<%PERL>
my %query_args = map { $_ => $ARGS{$_} } @PassArguments;
my $prev = $m->comp( '/Elements/QueryString', %query_args, Page => $Page - 1 );
my $next = $m->comp( '/Elements/QueryString', %query_args, Page => $Page + 1 );
</%PERL>
% if ( $Page > 1 ) {
<a href="<% $BaseURL %><% $prev %>"><&|/l&>Previous Page</&></a>
% }
% if ( ($Page * $Rows) < $TotalFound ) {
<a href="<% $BaseURL %><% $next %>"><&|/l&>Next Page</&></a>
% }
% }
<%INIT>
my $TotalFound = $Collection->CountAll;
if (!$Collection && $Class eq 'RT::Tickets') {
$Collection = RT::Tickets->new( $session{'CurrentUser'} );
$Collection->FromSQL($Query);
}
my $TotalFound = $Collection->CountAll();
return '' if !$TotalFound && !$ShowEmpty;
if ( @OrderBy ) {
......@@ -114,6 +66,8 @@ if ( @OrderBy ) {
}
$Collection->RowsPerPage( $Rows ) if $Rows;
$Page = 1
unless $Page && $Page > 0; # workaround problems with Page = '' or undef
$Collection->GotoPage( $Page - 1 ); # SB uses page 0 as the first page
# DisplayFormat lets us use a "temporary" format for display, while
......@@ -140,29 +94,84 @@ foreach my $col (@Format) {
}
}
my $Class = ref $Collection;
$Class ||= ref $Collection;
$Class =~ s/s$//;
$Class =~ s/:/_/g;
$m->out('<table border="0" cellspacing="0" cellpadding="1"' .
' width="100%" class="' .
($Collection->isa('RT::Tickets') ? 'ticket-list' : 'collection') . '>');
if ( $ShowHeader ) {
$m->comp('/Elements/CollectionAsTable/Header',
%ARGS,
Class => $Class,
Format => \@Format,
FormatString => $Format,
Order => \@Order,
OrderBy => \@OrderBy,
Rows => $Rows,
Page => $Page,
AllowSorting => $AllowSorting,
BaseURL => $BaseURL,
maxitems => $maxitems,
);
}
my ($i, $column_map) = (0, {});
while ( my $record = $Collection->Next ) {
# Every ten rows, flush the buffer and put something on the page.
$m->flush_buffer unless ++$i % 10;
$m->comp('/Elements/CollectionAsTable/Row',
i => $i,
Format => \@Format,
record => $record,
maxitems => $maxitems,
ColumnMap => $column_map,
Class => $Class,
);
}
$m->out('</table>');
if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) {
$m->out('<hr />');
my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
my $pages = int( $TotalFound / $Rows ) + $oddRows;
$pages = 1 if $pages < 1;
my %query_args = map { $_ => $ARGS{$_} } @PassArguments;
$m->comp(
'/Elements/CollectionListPaging',
BaseURL => $BaseURL,
Rows => $Rows,
TotalFound => $TotalFound,
CurrentPage => $Page,
Pages => $pages,
URLParams => \%query_args
);
}
</%INIT>
<%ARGS>
$Class => ''
$Collection => undef
$Format => undef
$DisplayFormat => undef
@Order => ()
@OrderBy => ()
$Rows => undef
$Rows => 1
$Page => 1
$Title => loc('Ticket Search')
$BaseURL => RT->Config->Get('WebPath') . $m->request_comp->path .'?'
@PassArguments => qw(Query Format Rows Page Order OrderBy)
@PassArguments => qw( Query Format Rows Page Order OrderBy)
$AllowSorting => 0
$ShowNavigation => 1
$ShowHeader => 1
$ShowEmpty => 0
$IsTicket => 0
$Query => 0
</%ARGS>
......@@ -8,11 +8,14 @@ $URLParams => undef
</%ARGS>
<%INIT>
if ($Pages == 1) {
$m->out(loc('Page 1 of 1'));
}
else{
$m->out(loc('Page') . ' ');
my $prev = $m->comp(
'/Elements/QueryString',
@$URLParams,
%$URLParams,
Page => ( $CurrentPage - 1 )
);
my %show;
......@@ -23,7 +26,7 @@ my $dots;
for my $number (1..$Pages){
if ($show{$number}){
$dots = undef;
my $qs = $m->comp('/Elements/QueryString', @$URLParams, Page => $number);
my $qs = $m->comp('/Elements/QueryString', %$URLParams, Page => $number);
$m->out( qq{<a href="$BaseURL$qs">}
. (($number == $CurrentPage) ? "<em>$number</em>" : $number)
. qq{</a> });
......@@ -36,13 +39,14 @@ for my $number (1..$Pages){
my $next = $m->comp(
'/Elements/QueryString',
@$URLParams,
%$URLParams,
Page => ( $CurrentPage + 1 )
);
if ($CurrentPage > 1) {
$m->out(qq{<a href="$BaseURL$prev">}.loc('Previous ').qq{</a>});
}
if (($CurrentPage * $Rows) < $TotalFound) {
$m->out(qq{<a href="$BaseURL$next">}.loc('Next').qq{</a>});
}
}
</%INIT>
% if ($CurrentPage > 1) {
<a href="<%$BaseURL%><%$prev%>"><&|/l&>Previous</&></a>
% }
% if (($CurrentPage * $Rows) < $TotalFound) {
<a href="<%$BaseURL%><%$next%>"><&|/l&>Next</&></a>
% }
......@@ -45,164 +45,23 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<table border="0" cellspacing="0" cellpadding="1" width="100%" class="ticket-list">
% if ($ShowHeader) {
<& /Elements/CollectionAsTable/Header,
Format => \@Format,
FormatString => $Format,
AllowSorting => $AllowSorting,
Order => $Order,
Query => $Query,
Rows => $Rows,
Page => $Page,
OrderBy => $OrderBy ,
BaseURL => $BaseURL,
maxitems => $maxitems &>
% }
<%PERL>
my ($i, $column_map) = (0, {});
while ( my $record = $Collection->Next ) {
$i++;
# Every ten rows, flush the buffer and put something on the page.
$m->flush_buffer unless $i % 10;
$m->comp('/Elements/CollectionAsTable/Row',
i => $i,
Format => \@Format,
record => $record,
maxitems => $maxitems,
ColumnMap => $column_map,
);
}
</%PERL>
</table>
%if ($Rows && $ShowNavigation) {
<hr />
% my $oddRows = ($TotalFound && $TotalFound % $Rows == 0 )? 0 : 1;
% my $pages = int($TotalFound/$Rows)+$oddRows;
% $pages = 1 if $pages < 1;
<&|/l, $Page, $pages &>Page </&>
<%perl>
my $prev = $m->comp(
'/Elements/QueryString',
Query => $Query,
Format => $Format,
Rows => $Rows,
OrderBy => $OrderBy,
Order => $Order,
Page => ( $Page - 1 )
);
my %show;
$show{1} = 1;
$show{$_} = 1 for (($Page - 2)..($Page + 2));
$show{$pages} = 1;
my $dots;
for my $number (1..$pages){
if ($show{$number}){
$dots = undef;
if ($number == $Page){
$number = ("<em>$number </em>");
}
my $num = $m->comp(
'/Elements/QueryString',
Query => $Query,
Format => $Format,
Rows => $Rows,
OrderBy => $OrderBy,
Order => $Order,
Page => $number
);
$m->out("<a href=\"$BaseURL$num\">$number </a>");
}
elsif (not $dots){
$dots = 1;
$m->out(" ... ");
}
}
my $next = $m->comp(
'/Elements/QueryString',
Query => $Query,
Format => $Format,
Rows => $Rows,
OrderBy => $OrderBy,
Order => $Order,
Page => ( $Page + 1 )
);
</%perl>
% if ($Page > 1) {
<a href="<%$BaseURL%><%$prev%>"><&|/l&>Previous</&></a>
% }
% if (($Page * $Rows) < $TotalFound) {
<a href="<%$BaseURL%><%$next%>"><&|/l&>Next</&></a>
% }
% }
<%INIT>
unless ($Collection) {
$Collection = RT::Tickets->new( $session{'CurrentUser'} );
$Collection->FromSQL( $Query );
}
my $TotalFound = $Collection->CountAll();
return '' if !$TotalFound && !$ShowEmpty;
if ($OrderBy =~ /\|/) {
# Multiple Sorts
my @OrderBy = split /\|/,$OrderBy;
my @Order = split /\|/,$Order;
$Collection->OrderByCols(
map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
( 0 .. $#OrderBy )
);
} else {
$Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order);
}
$Collection->RowsPerPage( $Rows ) if $Rows;
$Page = 1 unless $Page && $Page > 0; # workaround problems with Page = '' or undef
$Collection->GotoPage( $Page - 1 ); # SB uses page 0 as the first page
# DisplayFormat lets us use a "temporary" format for display, while
# still using our original format for next/prev page links.
# bulk update uses this feature to add checkboxes
$DisplayFormat ||= $Format;
# Scrub the html of the format string to remove any potential nasties.
$Format = $m->comp('/Elements/ScrubHTML', Content => $Format);
$DisplayFormat = $m->comp('/Elements/ScrubHTML', Content => $DisplayFormat);
my @Format = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $DisplayFormat);
# Find the maximum number of items in any row, so we can pad the table.
my ($maxitems, $item) = (0, 0);
foreach my $col (@Format) {
$item++;
if ( $col->{title} && ($col->{title} eq 'NEWLINE') ) {
$item = 0;
}
else {
$maxitems = $item if $item > $maxitems;
}
}
$m->comp(
'/Elements/CollectionList',
%ARGS,
Class => 'RT::Tickets'
);
</%INIT>
<%ARGS>
$Collection => undef
$Query => undef
$Format => RT->Config->Get('DefaultSearchResultFormat')
$DisplayFormat => undef
$Order => undef
$OrderBy => undef
$Rows => 50
$Page => 1
$Title => 'Ticket Search'
$Title => loc('Ticket Search')
$BaseURL => undef
$AllowSorting => undef
$ShowNavigation => 1
......
......@@ -49,6 +49,14 @@
<& /Elements/ListActions, actions => \@results &>
% if ( @notes ) {
<ul>
% for ( @notes ) {
<li><% $_ %></li>
% }
</ul>
% }
<form method="post">
<& /Widgets/BulkEdit, Types => \@Types,Meta => $RT::Installer->{Meta},
CurrentValue => RT::Installer->CurrentValues(@Types) &>
......@@ -60,8 +68,12 @@
</&>
<%init>
my @results;
my @notes = (
'OwnerEmail is the address of a human who manages RT.',
'Correspond Address and Comment Address are the default addresses that will be listed in From: and Reply-To: headers of correspondence and comment mail.',
);
my @Types = qw/MaxAttachmentSize OwnerEmail CommentAddress CorrespondAddress/;
my @Types = qw/OwnerEmail CommentAddress CorrespondAddress/;
if ( $Run ) {
......@@ -74,12 +86,6 @@ if ( $Run ) {
'Install/Basics.html');
}
for ( qw/MaxAttachmentSize/ ) {
if ( $ARGS{$_} && $ARGS{$_} !~ /^\d+$/ ) {
push @results, "Invalid $_: it should be a number";
}
}
unless ( @results ) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
'Install/Sendmail.html');
......
......@@ -49,10 +49,6 @@
<& /Elements/ListActions, actions => \@results &>
<div>
Options below 'Mail command' only take effect if Mail command is 'sendmail' or 'sendmailpipe'
</div>
<hr />
<form method="post">
<& /Widgets/BulkEdit, Types => \@Types,Meta => $RT::Installer->{Meta},
CurrentValue => RT::Installer->CurrentValues(@Types) &>
......@@ -60,13 +56,13 @@ Options below 'Mail command' only take effect if Mail command is 'sendmail' or '
<input type="hidden" name="Run" value="1">
<& /Elements/Submit, Label => $RT::Installer->{DatabaseAction} eq 'none' ?
loc('Next: Finish') : loc('Next: Initialize Database'), Back => 1,
BackLabel => loc('Back: Customize Emails') &>
BackLabel => loc('Back: Customize Email Addresses') &>
</form>
</&>
<%init>
my @results;
my @Types = qw/SendmailArguments SendmailBounceArguments SendmailPath/;
my @Types = qw/MaxAttachmentSize SendmailArguments SendmailBounceArguments SendmailPath/;
if ( $Run ) {
......@@ -79,6 +75,12 @@ if ( $Run ) {
'Install/Emails.html');
}
for ( qw/MaxAttachmentSize/ ) {
if ( $ARGS{$_} && $ARGS{$_} !~ /^\d+$/ ) {
push @results, "Invalid $_: it should be a number";
}
}
unless ( @results ) {
my ( $status, $msg ) = RT::Installer->SaveConfig;
......
......@@ -70,7 +70,7 @@
% if ( RT->Config->Get('GnuPG')->{'Enable'} ) {
<&|/Widgets/TitleBox, title => loc( 'Cryptography' ) &>
Preferred key: <& /Elements/GnuPG/SelectKeyForEncryption, EmailAddress => $UserObj->EmailAddress, Default => $UserObj->PreferredKey &>
<&|/l&>Preferred key</&>: <& /Elements/GnuPG/SelectKeyForEncryption, EmailAddress => $UserObj->EmailAddress, Default => $UserObj->PreferredKey &>
</&>
% }
......
......@@ -63,7 +63,7 @@ my $object = $m->dhandler_arg;
my $name = qr{[\w.-]+};
my $list = '(?:(?:\d+-)?\d+,)*(?:\d+-)?\d+';
my $label = '[a-zA-Z0-9@_.+-]+';
my $field = '[a-zA-Z](?:[a-zA-Z0-9_-]|\s+)*';
my $field = RT::Interface::REST->field_spec;
my $labels = "(?:$label,)*$label";
# We must handle requests such as the following:
......
......@@ -54,12 +54,13 @@ $orderby => undef
$fields => undef
</%ARGS>
<%INIT>
use RT::Interface::REST;
my $output = "";
my $status = "200 Ok";
my $tickets = new RT::Tickets $session{CurrentUser};
# Parse and validate any field specifications.
my $field = '[a-zA-Z](?:[a-zA-Z0-9_-]|\s+)*';
my $field = RT::Interface::REST->field_spec;
my (%fields, @fields);
if ($fields) {
$format ||= "l";
......
......@@ -58,6 +58,10 @@ foreach my $id (keys %cfqueues) {
# XXX TODO: This ancient code dates from a former developer
# we have no idea what it means or why cfqueues are so encoded.
$id =~ s/^.'*(.*).'*$/$1/;
# unescape internal quotes
$id =~ s/(\\(.))/$2 eq "'" ? "'" : $1/eg;
$queue->Load($id);
}
$CustomFields->LimitToQueue($queue->Id);
......