From 343d9c2b8123ed93ab3aef040876567cf411fa58 Mon Sep 17 00:00:00 2001 Message-Id: <343d9c2b8123ed93ab3aef040876567cf411fa58.1715075971.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 17 May 2008 16:41:05 +0100 Subject: [PATCH] First iteration of login page translation Organization: Straylight/Edgeware From: Richard Kettlewell --- server/macros-disorder.c | 19 ++++++- templates/login.tmpl | 105 +++++++++++++++++++-------------------- 2 files changed, 69 insertions(+), 55 deletions(-) diff --git a/server/macros-disorder.c b/server/macros-disorder.c index c2ac8b0..f8e7fe1 100644 --- a/server/macros-disorder.c +++ b/server/macros-disorder.c @@ -26,6 +26,9 @@ /** @brief For error template */ char *dcgi_error_string; +/** @brief For login template */ +char *dcgi_status_string; + /** @brief Return @p i as a string */ static const char *make_index(int i) { char *s; @@ -755,7 +758,20 @@ static int exp_error(int attribute((unused)) nargs, char attribute((unused)) **args, struct sink *output, void attribute((unused)) *u) { - return sink_writes(output, dcgi_error_string) < 0 ? -1 : 0; + return sink_writes(output, dcgi_error_string ? dcgi_error_string : "") + < 0 ? -1 : 0; +} + +/* @error + * + * Expands to the latest status string. + */ +static int exp_status(int attribute((unused)) nargs, + char attribute((unused)) **args, + struct sink *output, + void attribute((unused)) *u) { + return sink_writes(output, dcgi_status_string ? dcgi_status_string : "") + < 0 ? -1 : 0; } /* @image{NAME} @@ -972,6 +988,7 @@ void dcgi_expansions(void) { mx_register("resolve", 1, 1, exp_resolve); mx_register("server-version", 0, 0, exp_server_version); mx_register("state", 1, 1, exp_state); + mx_register("status", 0, 0, exp_status); mx_register("thisurl", 0, 0, exp_thisurl); mx_register("trackstate", 1, 1, exp_trackstate); mx_register("transform", 2, 3, exp_transform); diff --git a/templates/login.tmpl b/templates/login.tmpl index 7c45438..24b26be 100644 --- a/templates/login.tmpl +++ b/templates/login.tmpl @@ -24,40 +24,38 @@ USA @stdmenu{login} -

@label:login.title@

- - @if{@ne{@label:error@}{error}@}{ - @#{error reporting from some earlier operation}@ -
-

@label{error.@label:error@}@

-
- }@ - - @if{@ne{@label:status@}{status}@}{ - @#{some action succeeded}@ -
-

@label{login.@label:status@}@

-
- }@ - - @if{@eq{@user@}{guest}@}{ - @#{guest user, allow login and registration}@ +

@label{login.title}

+ +@if{@ne{@error}{}} + {@# Error reporting from some earlier operation +
+

@label{error.@error}

+
} + +@if{@ne{@status}{}} + {@# Some action succeeded +
+

@label{login.@status}

+
} + +@if{@eq{@user}{guest}} + {@# Guest user, allow login and registration

Existing users

If you have a username, use this form to log in.

-

If you've forgotten your password, use this form to request an @@ -80,20 +78,20 @@ USA your email address, and if a reminder has been sent too recently then it won't be possible to send one.

-
- + @@ -109,61 +107,60 @@ USA which you must visit to activate your login before you can use it.

-

- + - + - + - + - + - + - + - +
@label:login.username@@label{login.username} @label:login.registerusernameextra@@label{login.registerusernameextra}
@label:login.email@@label{login.email} @label:login.registeremailextra@@label{login.registeremailextra}
@label:login.password1@@label{login.password1} @label:login.registerpassword1extra@@label{login.registerpassword1extra}
@label:login.password2@@label{login.password2} @label:login.registerpassword2extra@@label{login.registerpassword2extra}
-
}@ - }{ - @#{not the guest user, allow change of details and logout}@ + } + }{@# not the guest user, allow change of details and logout -

Logged in as @user@

+

Logged in as @user

-
@@ -171,37 +168,37 @@ USA

Use this form to change your email address and/or password.

- - + - + - + - + - + - + @@ -209,7 +206,7 @@ USA - }@ + } @credits -- [mdw]
@label:login.email@@label{login.email} + value="@userinfo{email}"> @label:login.edituseremailextra@@label{login.edituseremailextra}
@label:login.newpassword@@label{login.newpassword} @label:login.edituserpassword1extra@@label{login.edituserpassword1extra}
@label:login.newpassword@@label{login.newpassword} @label:login.edituserpassword2extra@@label{login.edituserpassword2extra}