From 1b672eeb278ebf345ded01e1f730e7596f4db191 Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Wed, 25 Jul 2001 09:32:28 +0000 Subject: [PATCH] Mainly changes to make it compile and easier to debug: * Made the start of an execution start clearer in the error log. This depends on the debug level; just makes it easier to determine what is a single execution block in a 70MB error log. * Changed a stray semicolon into a comma, and fixed other misspellings or typos. * Added the default strings to the CosesEditor component. git-svn-id: svn://10.0.0.236/trunk@99910 18797224-902f-48f8-a5cc-f745e15eee43 --- .../PLIF/PLIF/DataSource/Strings/MySQL.pm | 4 +-- mozilla/webtools/PLIF/PLIF/Program.pm | 5 ++-- .../PLIF/Service/Components/CosesEditor.pm | 30 ++++++++++++++----- mozilla/webtools/PLIF/PLIF/Service/Coses.pm | 4 +-- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/mozilla/webtools/PLIF/PLIF/DataSource/Strings/MySQL.pm b/mozilla/webtools/PLIF/PLIF/DataSource/Strings/MySQL.pm index e330c619971..66206467290 100644 --- a/mozilla/webtools/PLIF/PLIF/DataSource/Strings/MySQL.pm +++ b/mozilla/webtools/PLIF/PLIF/DataSource/Strings/MySQL.pm @@ -63,8 +63,8 @@ sub getDescribedVariants { 'charset' => $variant->[5], 'language' => $variant->[6], 'description' => $variant->[7], - 'translator' => $variant->[8]; - }; + 'translator' => $variant->[8], + }; } return %result; } diff --git a/mozilla/webtools/PLIF/PLIF/Program.pm b/mozilla/webtools/PLIF/PLIF/Program.pm index 854c875a351..8010395bb19 100644 --- a/mozilla/webtools/PLIF/PLIF/Program.pm +++ b/mozilla/webtools/PLIF/PLIF/Program.pm @@ -41,9 +41,10 @@ $app->run(); # setup everything (automatically called by the constructor, above) sub init { my $self = shift; - $self->dump(10, '', '', '********************************'); - $self->dump(5, '*** Started PLIF Application ***'); + $self->dump(8, '', ''); $self->dump(10, '********************************'); + $self->dump(5, '*** Started PLIF Application ***'); + $self->dump(9, '********************************'); $self->SUPER::init(@_); $self->initInput(); } diff --git a/mozilla/webtools/PLIF/PLIF/Service/Components/CosesEditor.pm b/mozilla/webtools/PLIF/PLIF/Service/Components/CosesEditor.pm index 27f0d19ed4d..b69e6dc721e 100644 --- a/mozilla/webtools/PLIF/PLIF/Service/Components/CosesEditor.pm +++ b/mozilla/webtools/PLIF/PLIF/Service/Components/CosesEditor.pm @@ -33,6 +33,8 @@ use PLIF::Service; @ISA = qw(PLIF::Service); 1; +# XXX I need to register and require rights + sub provides { my $class = shift; my($service) = @_; @@ -114,7 +116,7 @@ sub cmdCosesStringEdit { my %strings = @{$app->getCollectingServiceList('dispatcher.output')->strings}; my $dataSource = $app->getService('dataSource.strings'); my %expectedVariants = $dataSource->getDescribedVariants(); - my %stringsVariants = $dataSource->getStringVariants($app, $id); + my %stringVariants = $dataSource->getStringVariants($app, $id); $app->output->cosesEditorString($id, $strings{$id}, \%expectedVariants, \%stringVariants); } @@ -184,7 +186,7 @@ sub cmdCosesVariantImport { }; $XML->walk($self, $XML->parse($file), $data); - # use data + # add data my $dataSource = $app->getService('dataSource.strings'); my $id = $dataSource->setVariant($app, undef, @{$data->{'variant'}}); foreach my $string (keys(%{$data->{'strings'}})) { @@ -193,7 +195,8 @@ sub cmdCosesVariantImport { # display data my %expectedStrings = @{$app->getCollectingServiceList('dispatcher.output')->strings}; - $app->output->cosesEditorVariant($id, @{$data->{'variant'}}, \%expectedStrings, $data->{'strings'}->{$string}); + my %variantStrings = $dataSource->getVariantStrings($app, $id); + $app->output->cosesEditorVariant($id, @{$data->{'variant'}}, \%expectedStrings, \%variantStrings); } # service.xml.sink @@ -217,7 +220,7 @@ sub walkElement { if (exists($attributes->{'name'})) { $data->{'string'} = $attributes->{'name'}; } else { - $self->error(1, 'invalid variant document format - missing attribute 'name' on '); + $self->error(1, 'invalid variant document format - missing attribute \'name\' on '); } } else { $self->error(1, 'invalid variant document format - not child of '); @@ -315,14 +318,25 @@ sub strings { sub getDefaultString { my $self = shift; my($app, $protocol, $string) = @_; - # XXX if ($protocol eq 'stdout') { - if ($string eq 'cosesEditor') { + if ($string eq 'cosesEditor.index') { return 'COSES Editor
'; + } elsif ($string eq 'cosesEditor.variant') { + return 'COSES Editor
Variant Editor
'; + } elsif ($string eq 'cosesEditor.string') { + return 'COSES Editor
String Editor
'; + } elsif ($string eq 'cosesEditor.export') { + return '
'; } } elsif ($protocol eq 'http') { - if ($string eq 'cosesEditor') { - return 'HTTP/1.1 200 OK
Content-Type: text/plain

COSES Editor
'; + if ($string eq 'cosesEditor.index') { + return 'HTTP/1.1 200 OK
Content-Type: text/plain

COSES Editor: Index
'; + } elsif ($string eq 'cosesEditor.variant') { + return 'HTTP/1.1 200 OK
Content-Type: text/plain

COSES Editor: Variant Editor
'; + } elsif ($string eq 'cosesEditor.string') { + return 'HTTP/1.1 200 OK
Content-Type: text/plain

COSES Editor: String Editor
'; + } elsif ($string eq 'cosesEditor.export') { + return 'HTTP/1.1 200 OK
Content-Type: text/xml

'; } } return; # nope, sorry diff --git a/mozilla/webtools/PLIF/PLIF/Service/Coses.pm b/mozilla/webtools/PLIF/PLIF/Service/Coses.pm index 99eed46e377..8b009debea1 100644 --- a/mozilla/webtools/PLIF/PLIF/Service/Coses.pm +++ b/mozilla/webtools/PLIF/PLIF/Service/Coses.pm @@ -43,7 +43,7 @@ sub expand { my $self = shift; my($app, $session, $protocol, $string, $data) = @_; my @index = (); my $index = 0; - my @stack = (); my $stack = $app->getService('service.xml')->parseString($self->getString($app, $session, $protocol, $string)); + my @stack = (); my $stack = $app->getService('service.xml')->parse($self->getString($app, $session, $protocol, $string)); my @scope = (); my $scope = {'data' => $data}; my $result = ''; if (not $scope->{'coses: skip sanitation'}) { @@ -150,7 +150,7 @@ sub expand { push(@index, $index); push(@stack, $stack); $index = 0; - $stack = $self->parseString($self->getString($app, $session, $protocol, $self->evaluateExpression($attributes->{'string'}, $scope))); + $stack = $app->getService('service.xml')->parse($self->getString($app, $session, $protocol, $self->evaluateExpression($attributes->{'string'}, $scope))); push(@scope, $superscope); next node; # skip default handling } elsif ($node eq 'else') {