зеркало из https://github.com/mozilla/gecko-dev.git
* Enabled Taint mode.
* Added the HTTP Logout module, integer user fields, and the user prefs module to the test app. * Changed unknownCommand to noCommand. Unknown commands now cause errors. * Changed the arbitrary default command to some other arbitrary default command and made the login command consistent with it. * Filled in the stylesheet a little. * Added an error page. * Reworked the hello page. * Moved some stuff into the common footer. * Added a request login page. * Did some other minor fixups. * Added some incomplete userPrefs pages.
This commit is contained in:
Родитель
530363a93e
Коммит
b451ec0af9
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -wT
|
||||||
# -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; -*-
|
# -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||||
#
|
#
|
||||||
# This file is MPL/GPL dual-licensed under the following terms:
|
# This file is MPL/GPL dual-licensed under the following terms:
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
# under either the MPL or the GPL.
|
# under either the MPL or the GPL.
|
||||||
|
|
||||||
use strict; # enable stricter Perl syntax rules
|
use strict; # enable stricter Perl syntax rules
|
||||||
use diagnostics; # enable fuller diagnostics
|
|
||||||
use lib "."; # this is required to use the app's modules
|
use lib "."; # this is required to use the app's modules
|
||||||
use lib "../../PLIF"; # this is required to use PLIF
|
use lib "../../PLIF"; # this is required to use PLIF
|
||||||
use vars qw(@ISA);
|
use vars qw(@ISA);
|
||||||
|
@ -59,29 +58,40 @@ sub registerServices {
|
||||||
PLIF::Service::User
|
PLIF::Service::User
|
||||||
PLIF::Service::Passwords
|
PLIF::Service::Passwords
|
||||||
PLIF::Service::UserField::String
|
PLIF::Service::UserField::String
|
||||||
|
PLIF::Service::UserField::Integer
|
||||||
PLIF::Service::UserFieldFactory
|
PLIF::Service::UserFieldFactory
|
||||||
PLIF::Service::Components::AdminCommands
|
PLIF::Service::Components::AdminCommands
|
||||||
PLIF::Service::Components::Login
|
PLIF::Service::Components::Login
|
||||||
PLIF::Service::Components::CosesEditor
|
PLIF::Service::Components::CosesEditor
|
||||||
|
PLIF::Service::Components::UserPrefs
|
||||||
PLIF::Service::ContactMethod::Email
|
PLIF::Service::ContactMethod::Email
|
||||||
PLIF::Service::ContactMethod::AIM
|
PLIF::Service::ContactMethod::AIM
|
||||||
|
PLIF::ProtocolHelper::Logout::HTTP
|
||||||
Output
|
Output
|
||||||
Configuration
|
Configuration
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub unknownCommand {
|
sub noCommand {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->output->hello({});
|
my $user = $self->getObject('user');
|
||||||
|
if (defined($user)) {
|
||||||
|
my %strings = @{$self->getCollectingServiceList('dispatcher.output')->strings};
|
||||||
|
$self->output->hello(\%strings);
|
||||||
|
} else {
|
||||||
|
$self->output->hello();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cmdLogin {
|
sub cmdLogin {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $user = $self->getService('user.login')->hasRight($self, 'hello');
|
my $user = $self->getObject('user');
|
||||||
if (defined($user)) {
|
if (defined($user)) {
|
||||||
my %strings = @{$self->getCollectingServiceList('dispatcher.output')->strings};
|
my %strings = @{$self->getCollectingServiceList('dispatcher.output')->strings};
|
||||||
$self->output->hello(\%strings);
|
$self->output->hello(\%strings);
|
||||||
} # else, user has been notified
|
} else {
|
||||||
|
$self->getService('user.login')->requireLogin($self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub name {
|
sub name {
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
COSES
|
||||||
|
1
|
||||||
|
|
||||||
|
<text xml:space="default" xmlns="http://bugzilla.mozilla.org/coses">
|
||||||
|
|
||||||
|
<set variable="title" value="Internal Error">
|
||||||
|
<set variable="response" value="500 Server Error">
|
||||||
|
<include href="template.html.header"/>
|
||||||
|
</set></set>
|
||||||
|
|
||||||
|
<![CDATA[
|
||||||
|
<p>An internal error occured. Please <a
|
||||||
|
href="http://bugzilla.mozilla.org/">report this bug</a>, including the
|
||||||
|
date and time of the error along with the information included
|
||||||
|
below:</p>
|
||||||
|
|
||||||
|
<pre>]]><text escape="html" value="(data.error)"/><![CDATA[</pre>
|
||||||
|
]]>
|
||||||
|
|
||||||
|
<include href="template.html.footer"/>
|
||||||
|
|
||||||
|
</text>
|
|
@ -7,20 +7,19 @@ COSES
|
||||||
<include href="template.html.header"/>
|
<include href="template.html.header"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
<text><![CDATA[
|
<text><![CDATA[ <p>Welcome to the Main PLIF Test Application</p>]]></text><br/>
|
||||||
<p>This is the main page of the test PLIF project. It is being generated from an XML text file!</p>
|
|
||||||
<p>From here you may: <a href="nph-Main?command=login">Say Hello</a> or <a href="nph-Main?command=cosesEditor">Edit The Strings</a>.</p>
|
|
||||||
<p>If prompted for a username/password, use "open"/"sesame".</p>
|
|
||||||
<pre>
|
|
||||||
]]></text>
|
|
||||||
|
|
||||||
<text escape="html">
|
<if lvalue="(data.session)" condition="is" rvalue="hash"><![CDATA[
|
||||||
<include href="debug.dumpVars"/>
|
<p>You have logged in! You may <a href="nph-Main?command=loginLogout">log out</a>.</p>
|
||||||
</text>
|
<p>See also:</p>
|
||||||
|
<ul>
|
||||||
<text><![CDATA[
|
<li><a href="nph-Main?command=cosesEditor">Edit the strings</a></li>
|
||||||
</pre>
|
<li><a href="nph-Main?command=userPrefs">Edit user preferences</a></li>
|
||||||
]]></text>
|
</ul>
|
||||||
|
]]></if><else><![CDATA[
|
||||||
|
<p>If you have already registered you may <a href="nph-Main?command=login">log in</a>.</p>
|
||||||
|
<p>Otherwise you may <a href="nph-Main?command=loginRequestAccount">create an account</a>.</p>
|
||||||
|
]]></else>
|
||||||
|
|
||||||
<include href="template.html.footer"/>
|
<include href="template.html.footer"/>
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,5 @@ COSES
|
||||||
</p>
|
</p>
|
||||||
]]></text>
|
]]></text>
|
||||||
|
|
||||||
<text><![CDATA[ <pre>]]><br/></text>
|
|
||||||
<text escape="html"><include href="debug.dumpVars"/><br/></text>
|
|
||||||
<text><![CDATA[ </pre>]]></text>
|
|
||||||
|
|
||||||
<include href="template.html.footer"/>
|
<include href="template.html.footer"/>
|
||||||
</text>
|
</text>
|
|
@ -16,9 +16,5 @@ COSES
|
||||||
</p>
|
</p>
|
||||||
]]></text>
|
]]></text>
|
||||||
|
|
||||||
<text><![CDATA[ <pre>]]><br/></text>
|
|
||||||
<text escape="html"><include href="debug.dumpVars"/><br/></text>
|
|
||||||
<text><![CDATA[ </pre>]]></text>
|
|
||||||
|
|
||||||
<include href="template.html.footer"/>
|
<include href="template.html.footer"/>
|
||||||
</text>
|
</text>
|
|
@ -23,7 +23,7 @@ contact: </text>
|
||||||
<text><![CDATA[
|
<text><![CDATA[
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="hidden" name="command" value="SendPassword">
|
<input type="hidden" name="command" value="loginSendPassword">
|
||||||
<select name="protocol">]]>
|
<select name="protocol">]]>
|
||||||
<set variable="protocol" value="(data.contacts)" order="case insensitive lexical" source="values">
|
<set variable="protocol" value="(data.contacts)" order="case insensitive lexical" source="values">
|
||||||
<br/><text value=" <option name="(protocol)">(protocol)</option>"/>
|
<br/><text value=" <option name="(protocol)">(protocol)</option>"/>
|
||||||
|
@ -44,9 +44,5 @@ contact: </text>
|
||||||
</form>
|
</form>
|
||||||
]]><br/></text>
|
]]><br/></text>
|
||||||
|
|
||||||
<text><![CDATA[ <pre>]]><br/></text>
|
|
||||||
<text escape="html"><include href="debug.dumpVars"/><br/></text>
|
|
||||||
<text><![CDATA[ </pre>]]></text>
|
|
||||||
|
|
||||||
<include href="template.html.footer"/>
|
<include href="template.html.footer"/>
|
||||||
</text>
|
</text>
|
|
@ -0,0 +1,36 @@
|
||||||
|
COSES
|
||||||
|
1
|
||||||
|
|
||||||
|
<text xml:space="default" xmlns="http://bugzilla.mozilla.org/coses">
|
||||||
|
|
||||||
|
<set variable="title" value="Create Account">
|
||||||
|
<include href="template.html.header"/>
|
||||||
|
</set>
|
||||||
|
|
||||||
|
<text><![CDATA[
|
||||||
|
<form action="nph-Main" method="GET"> <!-- XXX POST -->
|
||||||
|
<p>
|
||||||
|
]]></text>
|
||||||
|
|
||||||
|
<text> To create a new account fill in your e-mail address or other
|
||||||
|
means of contact in the form below and hit the submit button: </text>
|
||||||
|
|
||||||
|
<text><![CDATA[
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="hidden" name="command" value="loginSendPassword">
|
||||||
|
<select name="protocol">]]>
|
||||||
|
<set variable="protocol" value="(data.contacts)" order="case insensitive lexical" source="values">
|
||||||
|
<br/><text value=" <option name="(protocol)">(protocol)</option>"/>
|
||||||
|
</set>
|
||||||
|
<![CDATA[
|
||||||
|
</select>
|
||||||
|
<input type="text" name="address" value="">
|
||||||
|
<input type="hidden" name="pendingCommands" value="">
|
||||||
|
<input type="submit" value="Submit">
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
]]><br/></text>
|
||||||
|
|
||||||
|
<include href="template.html.footer"/>
|
||||||
|
</text>
|
|
@ -8,7 +8,32 @@ COSES
|
||||||
+ - - - - - - - -->
|
+ - - - - - - - -->
|
||||||
|
|
||||||
<!-- End of HTML Document -->
|
<!-- End of HTML Document -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- debug:
|
||||||
|
<text><![CDATA[
|
||||||
|
<hr>
|
||||||
|
<pre>
|
||||||
|
]]><text escape="html"><include href="debug.dumpVars"/></text><![CDATA[
|
||||||
|
</pre>
|
||||||
|
<hr>
|
||||||
|
]]></text>
|
||||||
|
-->
|
||||||
|
|
||||||
<text xml:space="preserve"><![CDATA[
|
<text xml:space="preserve"><![CDATA[
|
||||||
|
<div class="footer">
|
||||||
|
<p>
|
||||||
|
<a href="nph-Main">Index</a> -
|
||||||
|
]]><if lvalue="(data.session)" condition="is" rvalue="hash"><![CDATA[
|
||||||
|
<a href="nph-Main?command=loginLogout">Log Out</a> -
|
||||||
|
<a href="nph-Main?command=cosesEditor">Edit Strings</a> -
|
||||||
|
<a href="nph-Main?command=userPrefs">Preferences</a>
|
||||||
|
]]></if><else><![CDATA[
|
||||||
|
<a href="nph-Main?command=login">Log In</a> -
|
||||||
|
<a href="nph-Main?command=loginRequestAccount">Create Account</a>
|
||||||
|
]]></else><![CDATA[
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
]]></text>
|
]]></text>
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
COSES
|
||||||
|
1
|
||||||
|
|
||||||
|
<text xml:space="default" xmlns="http://bugzilla.mozilla.org/coses">
|
||||||
|
|
||||||
|
<set variable="title" value="User Preferences">
|
||||||
|
<include href="template.html.header"/>
|
||||||
|
</set>
|
||||||
|
|
||||||
|
<text><![CDATA[<p>Incomplete</p>]]></text>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<set variable="user" value="(data.userIDs)" source="values">
|
||||||
|
<![CDATA[<h2></h2>]]>
|
||||||
|
<set variable="name" value="(data.metaData.contact)" source="keys">
|
||||||
|
<text value="(data.metaData.contact.(name).fieldID)"/>: <text value="(data.userData.(user).fields.contact.(name))"/> <br/>
|
||||||
|
</set>
|
||||||
|
<set variable="name" value="(data.metaData.personal)" source="keys">
|
||||||
|
<text value="(data.metaData.personal.(name).fieldID)"/>: <text value="(data.userData.(user).fields.personal.(name))"/> <br/>
|
||||||
|
</set>
|
||||||
|
<set variable="name" value="(data.metaData.setting)" source="keys">
|
||||||
|
<text value="(data.metaData.setting.(name).fieldID)"/>: <text value="(data.userData.(user).fields.setting.(name))"/> <br/>
|
||||||
|
</set>
|
||||||
|
|
||||||
|
Set data.metaData.personal.(name).fieldID - prefill from data.userData.(user).fields.personal.(name)
|
||||||
|
set data.metaData.settings.(name).fieldID - prefill from data.userData.(user).fields.settings.(name)
|
||||||
|
set data.userData.(user).groups.(group)
|
||||||
|
data.userData.(user).adminMessage
|
||||||
|
data.userData.(user).mode
|
||||||
|
|
||||||
|
with
|
||||||
|
data.userData.(user).editingUserIsTargetUser
|
||||||
|
userPrefs.editOthers.adminMessage
|
||||||
|
userPrefs.editOthers.passwords
|
||||||
|
userPrefs.editOthers.mode
|
||||||
|
userPrefs.editOthers.contactMethods
|
||||||
|
userPrefs.editOthers.personalDetails
|
||||||
|
userPrefs.editOthers.settings
|
||||||
|
userPrefs.editOthers.groups
|
||||||
|
|
||||||
|
|
||||||
|
<text value=" (user)"/>
|
||||||
|
|
||||||
|
variables:
|
||||||
|
data.userData.(user).editingUserIsTargetUser
|
||||||
|
data.userData.(user).fields.contact.(name)
|
||||||
|
data.userData.(user).fields.personal.(name)
|
||||||
|
data.userData.(user).fields.settings.(name)
|
||||||
|
data.userData.(user).groups.(group) 0|1|2
|
||||||
|
data.userData.(user).adminMessage
|
||||||
|
data.userData.(user).mode
|
||||||
|
|
||||||
|
|
||||||
|
metaData:
|
||||||
|
data.metaData.contact.(name)
|
||||||
|
data.metaData.personal.(name)
|
||||||
|
data.metaData.settings.(name)
|
||||||
|
|
||||||
|
|
||||||
|
rights:
|
||||||
|
userPrefs.editOthers.adminMessage
|
||||||
|
userPrefs.editOthers.passwords
|
||||||
|
userPrefs.editOthers.mode
|
||||||
|
userPrefs.editOthers.contactMethods
|
||||||
|
userPrefs.editOthers.personalDetails
|
||||||
|
userPrefs.editOthers.settings
|
||||||
|
userPrefs.editOthers.groups
|
||||||
|
|
||||||
|
</set>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<include href="template.html.footer"/>
|
||||||
|
|
||||||
|
</text>
|
|
@ -0,0 +1,14 @@
|
||||||
|
COSES
|
||||||
|
1
|
||||||
|
|
||||||
|
<text xml:space="default" xmlns="http://bugzilla.mozilla.org/coses">
|
||||||
|
|
||||||
|
<set variable="title" value="User Preferences">
|
||||||
|
<include href="template.html.header"/>
|
||||||
|
</set>
|
||||||
|
|
||||||
|
<text><![CDATA[]]></text>
|
||||||
|
|
||||||
|
<include href="template.html.footer"/>
|
||||||
|
|
||||||
|
</text>
|
|
@ -0,0 +1,14 @@
|
||||||
|
COSES
|
||||||
|
1
|
||||||
|
|
||||||
|
<text xml:space="default" xmlns="http://bugzilla.mozilla.org/coses">
|
||||||
|
|
||||||
|
<set variable="title" value="User Preferences">
|
||||||
|
<include href="template.html.header"/>
|
||||||
|
</set>
|
||||||
|
|
||||||
|
<text><![CDATA[]]></text>
|
||||||
|
|
||||||
|
<include href="template.html.footer"/>
|
||||||
|
|
||||||
|
</text>
|
|
@ -1 +1,6 @@
|
||||||
/* plif.css */
|
/* plif.css */
|
||||||
|
|
||||||
|
h1 { font: 900 2em Verdana, sans-serif; border-bottom: solid; margin: 0; }
|
||||||
|
div.footer { border-top: solid; }
|
||||||
|
div.footer p { margin: 0.75em; font-size: 0.75em; }
|
||||||
|
body { border-bottom: solid; }
|
Загрузка…
Ссылка в новой задаче