Commit 8d4d5df5 authored by Jesse Vincent's avatar Jesse Vincent
Browse files

Folding in more localization changes

parent 654368f6
......@@ -67,6 +67,8 @@ RT_READABLE_DIR_MODE = 0755
RT_MODPERL_HANDLER = $(RT_BIN_PATH)/webmux.pl
# RT_FASTCGI_HANDLER is the mason handler script for FastCGI
RT_FASTCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.fcgi
# RT_WIN32_FASTCGI_HANDLER is the mason handler script for FastCGI
RT_WIN32_FASTCGI_HANDLER = $(RT_BIN_PATH)/mason_handler.svc
# RT's CLI
RT_CLI_BIN = $(RT_BIN_PATH)/rt
# RT's admin CLI
......@@ -356,6 +358,7 @@ bin-install:
bin/rt-mailgate \
bin/enhanced-mailgate \
bin/mason_handler.fcgi \
bin/mason_handler.svc \
bin/webmux.pl \
bin/rt-commit-handler \
$(DESTDIR)/$(RT_BIN_PATH)
......
......@@ -43,6 +43,7 @@ use RT::Interface::Email qw(CleanEnv
ParseCcAddressesFromHead
ParseSenderAddressFromHead
ParseErrorsToAddressFromHead
loc
);
......@@ -129,7 +130,7 @@ my $MessageId = $head->get('Message-Id') ||
"<no-message-id-".time.rand(2000)."\@.$RT::rtname>";
#Pull apart the subject line
$Subject = $head->get('Subject') || "[no subject]";
$Subject = $head->get('Subject') || "";
chomp $Subject;
# Get the ticket ID
......
......@@ -21,7 +21,7 @@ RT::LoadConfig();
package RT::Mason;
use HTML::Mason; # brings in subpackages: Parser, Interp, etc.
use HTML::Mason::CGIHandler;
use RT::MasonCGIHandler;
use vars qw( $CGI);
......
#!perl
# $Header: /raid/cvsroot/rt/bin/mason_handler.svc,v 1.2.2.1 2002/01/28 05:27:12 jesse Exp $
# RT is (c) 1996-2001 Jesse Vincent (jesse@fsck.com);
=head1 NAME
mason_handler.svc - Win32 IIS Service handler for RT
=head1 SYNOPSIS
perl mason_handler.svc --install # install as service
perl mason_handler.svc --deinstall # deinstall this service
perl mason_handler.svc --help # show this help
perl mason_handler.svc # launch handler from command line
=head1 DESCRIPTION
This script manages a stand-alone FastCGI server, and populates the necessary
registry settings to run it with Microsoft IIS Server 4.0 or above.
Before running it, you need to install the B<FCGI> module from CPAN, as well as
B<Win32::Daemon> from L<http://www.roth.net/perl/Daemon/> if you want to install
itself as a service.
This script will automatically create a virtual directory under the IIS root;
its name is taken from C<$WebPath> in the F<RT_Config.pm> file. Additionally,
please install the ISAPI binary from L<http://www.caraveo.com/fastcgi/> and set
up an ISAPI Script Map that maps F<.html> files to F<isapi_fcgi.dll>.
Once the service is launched (either via C<net start RTFastCGI> or by running
C<perl mason_handler.svc>), a FCGI server will start and bind to port C<8284>
(mnemonics: the ASCII value of C<R> and C<T>); the ISAPI handler's C<BindPath>
registry setting will also be automatically populated.
=cut
use strict;
use lib "!!RT_LIB_PATH!!";
use RT;
RT::LoadConfig(); # This drags in RT_Config.pm
use Cwd;
use File::Spec;
use File::Basename;
use Win32;
use Win32::Process;
use Win32::Service;
use Win32::TieRegistry;
my $ProcessObj;
BEGIN {
$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
$ENV{'SHELL'} = $ENV{'COMSPEC'} if defined $ENV{'SHELL'};
$ENV{'ENV'} = '' if defined $ENV{'ENV'};
$ENV{'IFS'} = '' if defined $ENV{'IFS'};
$ENV{'FCGI_SOCKET_PATH'} ||= ":8284"; # ord('R').ord('T')
my $runsvc = sub {
Win32::Process::Create(
$ProcessObj, $^X, "$^X $0 --run", 0, NORMAL_PRIORITY_CLASS, "."
) or do {
die Win32::FormatMessage( Win32::GetLastError() );
};
chdir File::Basename::dirname($0);
my $path = Cwd::cwd();
$path =~ s|/|\\|g;
$path =~ s|bin$|WebRT\\html|;
$Win32::TieRegistry::Registry->{
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\\'.
'W3SVC\Parameters\Virtual Roots\\'
}->{$RT::WebPath || '/'} = "$path,,205";
$Win32::TieRegistry::Registry->{
'HKEY_LOCAL_MACHINE\Software\FASTCGI\.html\\'
}->{'BindPath'} = $ENV{'FCGI_SOCKET_PATH'};
Win32::Service::StartService(Win32::NodeName, 'W3SVC');
};
if ($ARGV[0] eq '--deinstall') {
chdir File::Basename::dirname($0);
my $path = Cwd::cwd();
$path =~ s|/|\\|g;
require Win32::Daemon;
Win32::Daemon::DeleteService('RTFastCGI');
warn "Service 'RTFastCGI' successfully deleted.\n";
exit;
}
elsif ($ARGV[0] eq '--install') {
chdir File::Basename::dirname($0);
my $path = Cwd::cwd();
$path =~ s|/|\\|g;
require Win32::Daemon;
Win32::Daemon::DeleteService('RTFastCGI');
my $rv = Win32::Daemon::CreateService( {
machine => '',
name => 'RTFastCGI',
display => 'RT FastCGI Handler',
path => $^X,
user => '',
pwd => $path,
description => 'Enables port 8284 as the RT FastCGI handler.',
parameters => File::Spec->catfile(
$path, File::Basename::basename($0)
) . ' --service',
} );
if ($rv) {
warn "Service 'RTFastCGI' successfully created.\n";
}
else {
warn "Failed to add service: " . Win32::FormatMessage(
Win32::Daemon::GetLastError()
) . "\n";
}
exit;
}
elsif ($ARGV[0] eq '--service') {
require Win32::Daemon;
my $PrevState = Win32::Daemon::SERVICE_START_PENDING();
Win32::Daemon::StartService() or die $^E;
while ( 1 ) {
my $State = Win32::Daemon::State();
last if $State == Win32::Daemon::SERVICE_STOPPED();
if ( $State == Win32::Daemon::SERVICE_START_PENDING() ) {
$runsvc->();
Win32::Daemon::State( Win32::Daemon::SERVICE_RUNNING() );
$PrevState = Win32::Daemon::SERVICE_RUNNING();
}
elsif ( $State == Win32::Daemon::SERVICE_CONTINUE_PENDING() ) {
$ProcessObj->Resume;
Win32::Daemon::State( Win32::Daemon::SERVICE_RUNNING() );
$PrevState = Win32::Daemon::SERVICE_RUNNING();
}
elsif ( $State == Win32::Daemon::SERVICE_STOP_PENDING() ) {
$ProcessObj->Kill(0);
Win32::Daemon::State( Win32::Daemon::SERVICE_STOPPED() );
$PrevState = Win32::Daemon::SERVICE_STOPPED();
}
elsif ( $State == Win32::Daemon::SERVICE_RUNNING() ) {
my $Message = Win32::Daemon::QueryLastMessage(1);
if ( $Message == Win32::Daemon::SERVICE_CONTROL_INTERROGATE() ) {
Win32::Daemon::State( $PrevState );
}
elsif ( $Message == Win32::Daemon::SERVICE_CONTROL_SHUTDOWN() ) {
Win32::Daemon::State( Win32::Daemon::SERVICE_STOP_PENDING(), 15000 );
}
elsif ( $Message != Win32::Daemon::SERVICE_CONTROL_NONE() ) {
Win32::Daemon::State( $PrevState );
}
}
Win32::Sleep( 1000 );
}
Win32::Daemon::StopService();
exit;
}
elsif ($ARGV[0] eq '--help') {
system("perldoc $0");
exit;
}
elsif ($ARGV[0] ne '--run') {
$SIG{__DIE__} = sub { $ProcessObj->Kill(0) if $ProcessObj };
$runsvc->();
warn "RT FastCGI Handler launched. Press [Enter] to terminate...\n";
<STDIN>;
exit;
}
}
###############################################################################
package RT::Mason;
use HTML::Mason; # brings in subpackages: Parser, Interp, etc.
use RT::MasonCGIHandler;
use vars qw($CGI);
use Carp;
{
package HTML::Mason::Commands;
use vars qw(%session);
use RT::Tickets;
use RT::Transactions;
use RT::Users;
use RT::CurrentUser;
use RT::Templates;
use RT::Queues;
use RT::ScripActions;
use RT::ScripConditions;
use RT::Scrips;
use RT::Groups;
use RT::GroupMembers;
use RT::Watchers;
use RT::CustomFields;
use RT::CustomFieldValues;
use RT::TicketCustomFieldValues;
use RT::Interface::Web;
use MIME::Entity;
use CGI::Cookie;
use Date::Parse;
use HTML::Entities;
use Text::Wrapper;
use Apache::Session::File;
use CGI::Fast;
}
# Die if WebSessionDir doesn't exist or we can't write to it
stat($RT::MasonSessionDir);
die "Can't read and write $RT::MasonSessionDir"
unless ( ( -d _ ) and ( -r _ ) and ( -w _ ) );
RT::Init();
warn "Begin listening on $ENV{'FCGI_SOCKET_PATH'}\n";
# Response loop
while( $RT::Mason::CGI = CGI::Fast->new ) {
my $h = RT::Interface::Web::NewCGIHandler();
my $comp = $ENV{'PATH_INFO'};
$comp = $1 if ($comp =~ /^(.*)$/);
$comp =~ s|^$RT::WebPath\b||i;
$comp .= "index.html" if ($comp =~ /\/$/);
$comp =~ s/.pl$/.html/g;
warn "Serving $comp\n";
$h->handle_cgi($comp);
untie %HTML::Mason::Commands::session;
}
1;
=head1 AUTHORS
Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>
=head1 COPYRIGHT
Copyright 2002 by Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See L<http://www.perl.com/perl/misc/Artistic.html>
=cut
......@@ -12,7 +12,7 @@ package RT;
use Getopt::Long;
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent);
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
#Clean out all the nasties from the environment
CleanEnv();
......@@ -1179,75 +1179,75 @@ sub BuildListingFormat {
# {{{ attribs
my $attribs = { id => { chars => '4',
justify => 'r',
title => 'id',
title => loc('id'),
value => '$Ticket->id',
},
queue => { chars => '8',
justify => 'l',
title => 'Queue',
title => loc('Queue'),
value => '$Ticket->QueueObj->Name'
},
subject => { chars => '30',
justify => 'l',
title => 'Subject',
title => loc('Subject'),
value => '$Ticket->Subject',
},
priority => { chars => '2',
justify => 'r',
title => 'Pri',
title => loc('Pri'),
value => '$Ticket->Priority',
},
final_priority => { chars => '2',
justify => 'r',
title => 'Fin',
title => loc('Fin'),
value => '$Ticket->FinalPriority',
},
time_worked => { chars => '6',
justify => 'r',
title => 'Worked',
title => loc('Worked'),
value => '$Ticket->TimeWorked',
},
time_left => { chars => '5',
justify => 'r',
title => 'Left',
title => loc('Left'),
value => '$Ticket->TimeLeft',
},
status => { chars => '6',
justify => 'r',
title => 'Status',
title => loc('Status'),
value => '$Ticket->Status',
},
owner => { chars => '10',
justify => 'r',
title => 'Owner',
title => loc('Owner'),
value => '$Ticket->OwnerObj->Name'
},
requestor => { chars => '10',
justify => 'r',
title => 'Requestor',
title => loc('Requestor'),
value => '$Ticket->RequestorAddresses'
},
created => { chars => '12',
justify => 'r',
title => 'Created',
title => loc('Created'),
value => '$Ticket->CreatedAsString'
},
updated => { chars => '12',
justify => 'r',
title => 'Updated',
title => loc('Updated'),
value => '$Ticket->LastUpdatedAsString'
},
due => { chars => '12',
justify => 'r',
title => 'Due',
title => loc('Due'),
value => '$Ticket->DueAsString'
},
told => { chars => '12',
justify => 'r',
title => 'Told',
title => loc('Told'),
value => '$Ticket->ToldAsString'
},
......
......@@ -58,7 +58,7 @@ use MIME::Entity;
use lib "!!RT_LIB_PATH!!";
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent);
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
use vars
qw(@MAILER $TMPDIR $FILE_PREFIX $LASTDIR_FILE $HASH_FILE $VERSION_FILE $MESSAGE_FILE $MAIL_FILE $DEBUG $MAILTO $REPLYTO $id $MODULE_NAME
......
......@@ -22,6 +22,7 @@ use RT::Interface::Email qw(CleanEnv
ParseCcAddressesFromHead
ParseSenderAddressFromHead
ParseErrorsToAddressFromHead
loc
);
#Clean out all the nasties from the environment
......
......@@ -9,7 +9,7 @@ use Getopt::Long qw(:config pass_through);
use lib "!!RT_LIB_PATH!!";
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent);
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
#Clean out all the nasties from the environment
CleanEnv();
......
......@@ -78,9 +78,9 @@ CREATE TABLE Groups (
id INTEGER NOT NULL AUTO_INCREMENT,
Name varchar(16) NULL ,
Description varchar(64) NULL ,
Domain varchar(255),
Type varchar(255),
Instance varchar(255),
Domain varchar(64),
Type varchar(64),
Instance varchar(64),
PRIMARY KEY (id)
) TYPE=InnoDB;
......
......@@ -27,10 +27,10 @@ my ($order);
class="currenttab"
% }
HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$attr%>&TicketsSortOrder=<%$order%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>">
<%$col->{Header}%>
<% loc($col->{Header}) %>
</A>
% } else {
<% $col->{Header} %>
<% loc($col->{Header}) %>
% }
</TH>
%}
......
......@@ -22,12 +22,12 @@
my $Ticket = LoadTicket($id);
my $title = "Update ticket #" . $Ticket->id;
my $title = loc("Update ticket #[_1]", $Ticket->id);
$DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
Abort("No permission to view update ticket")
Abort(loc("No permission to view update ticket"))
unless ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
......
......@@ -10,8 +10,9 @@
[<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>]
<BR>
<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => "Create a new ticket"&>
<div align=right><input type=submit value="Create"></div>
<& /Elements/TitleBoxStart, contentbg => "#cccccc", title => loc("Create a new
ticket") &>
<div align=right><input type=submit value="<&|/l&>Create</&>"></div>
<TABLE border=0 cellpadding=0 cellspacing=0>
<TR><TD><&|/l&>Queue</&></TD>
<TD><% $QueueObj->Name %>
......
......@@ -75,7 +75,7 @@ if ($size) {
$size = $size ."b";
}
</%PERL>
<font size=-1><A HREF="Attachment/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename%>">Download <%$message->Filename|| '(untitled)'%></a> <% $size %></font>
<font size=-1><A HREF="Attachment/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename%>"><&|/l&>Download</&> <%$message->Filename|| '(untitled)'%></a> <% $size %></font>
% }
</TD>
</TR>
......
......@@ -78,9 +78,9 @@ my $Ticket = LoadTicket($id);
if ($DefaultStatus eq 'resolved') {
$title = "Resolve";
$title = loc("Resolve");
} else {
$title = "Update";
$title = loc("Update");
}
$title .= " ticket #" . $Ticket->id . " (" .$Ticket->Subject.")";
......
......@@ -35,8 +35,7 @@ elsif ($RT::WebExternalAuth){
$session{'CurrentUser'} = RT::CurrentUser->new();
$session{'CurrentUser'}->Load($user);
unless ($session{'CurrentUser'}->id() ) {
delete $session{'CurrentUser'};
$m->comp('/Elements/Login', %ARGS, Error=> 'You are not an authorized user');
$m->comp('/Elements/Login', %ARGS, Error=> loc('You are not an authorized user'));
$m->abort();
}
}
......@@ -48,13 +47,13 @@ elsif (defined ($user) && defined ($pass)){
$session{'CurrentUser'}->Load($user);
unless ($session{'CurrentUser'}->id() ) {
delete $session{'CurrentUser'};
$m->comp('/Elements/Login', %ARGS, Error=> 'Your username or password is incorrect');
$m->comp('/Elements/Login', %ARGS, Error=> loc('Your username or password is incorrect'));
$m->abort();
};
unless ($session{'CurrentUser'}->IsPassword($pass)) {
delete $session{'CurrentUser'};
$m->comp('/Elements/Login', Error => 'Your username or password is incorrect', %ARGS);
$m->comp('/Elements/Login', Error => loc('Your username or password is incorrect'), %ARGS);
$m->abort();
}
}
......
% my $hand = $session{'CurrentUser'}->LanguageHandle;
<%$hand->maketext($m->content, @_)%>
% my $hand = ($session{'CurrentUser'} ||= RT::CurrentUser->new)->LanguageHandle;
% $m->print($hand->maketext($m->content, @_));
% return(1);
RT/MasonCGIHandler.pm
MANIFEST
MANIFEST.SKIP
Makefile.PL
......
......@@ -31,7 +31,7 @@ sub LoadConfig {
my $config_file = "!!RT_CONFIG!!";
# We don't have a configuration file yet.
# localizing here would suck.
#require $config_file || die loc("Couldn't load RT config file '[_1]' [_2]", $config_file, $@);
#require $config_file || die $self->loc("Couldn't load RT config file '[_1]' [_2]", $config_file, $@);
require $config_file || die ("Couldn't load RT config file $config_file $@");
}
......@@ -81,7 +81,7 @@ sub InitLogging {
unless (-d $RT::LogDir && -w $RT::LogDir) {
# localizing here would be hard when we don't have a current user yet
# die loc("Log directory [_1] not found or couldn't be written.\n RT can't run.", $RT::LogDir);
# die $self->loc("Log directory [_1] not found or couldn't be written.\n RT can't run.", $RT::LogDir);
die ("Log directory $RT::LogDir not found or couldn't be written.\n RT can't run.");
}
......
......@@ -102,7 +102,7 @@ sub Type {
# {{{ sub Commit
sub Commit {
my $self = shift;
return(0,"Commit Stubbed");
return(0, $self->loc("Commit Stubbed"));
}
# }}}
......@@ -112,7 +112,7 @@ sub Commit {
# {{{ sub Describe
sub Describe {
my $self = shift;
return ("No description for " . ref $self);
return $self->loc("No description for [_1]", ref $self);
}
# }}}
......@@ -122,7 +122,7 @@ sub Describe {
# {{{ sub Prepare
sub Prepare {
my $self = shift;
return (0,"Prepare Stubbed");
return (0, $self->loc("Prepare Stubbed"));
}
# }}}
......
......@@ -12,7 +12,7 @@ require RT::Links;
# {{{ sub Describe
sub Describe {
my $self = shift;
return (ref $self . " will resolve all members of a resolved group ticket.");
return $self->loc("[_1] will resolve all members of a resolved group ticket.", ref $self);
}
# }}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment