Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
e7cb77c3
Commit
e7cb77c3
authored
Jul 27, 2002
by
gerv%gerv.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 106640 - allow translation of system messages. Patch by gerv; r=burnus.
parent
b9469415
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
13 deletions
+77
-13
CGI.pl
CGI.pl
+12
-9
code-error.html.tmpl
template/en/default/global/code-error.html.tmpl
+34
-2
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+31
-2
No files found.
CGI.pl
View file @
e7cb77c3
...
@@ -865,7 +865,6 @@ sub PutFooter {
...
@@ -865,7 +865,6 @@ sub PutFooter {
# ThrowTemplateError instead.
# ThrowTemplateError instead.
sub
DisplayError
{
sub
DisplayError
{
(
$vars
->
{
'error'
},
$vars
->
{
'title'
})
=
(
@_
);
(
$vars
->
{
'error'
},
$vars
->
{
'title'
})
=
(
@_
);
$vars
->
{
'title'
}
||=
"Error"
;
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
$template
->
process
(
"global/user-error.html.tmpl"
,
$vars
)
$template
->
process
(
"global/user-error.html.tmpl"
,
$vars
)
...
@@ -878,11 +877,10 @@ sub DisplayError {
...
@@ -878,11 +877,10 @@ sub DisplayError {
# $vars->{'variables'} is a reference to a hash of useful debugging info.
# $vars->{'variables'} is a reference to a hash of useful debugging info.
sub
ThrowCodeError
{
sub
ThrowCodeError
{
(
$vars
->
{
'error'
},
$vars
->
{
'variables'
},
my
$unlock_tables
)
=
(
@_
);
(
$vars
->
{
'error'
},
$vars
->
{
'variables'
},
my
$unlock_tables
)
=
(
@_
);
$vars
->
{
'title'
}
=
"Code Error"
;
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
# We may o
ptionall
y log something to file here.
# We may o
ne da
y log something to file here.
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
$template
->
process
(
"global/code-error.html.tmpl"
,
$vars
)
$template
->
process
(
"global/code-error.html.tmpl"
,
$vars
)
...
@@ -892,9 +890,12 @@ sub ThrowCodeError {
...
@@ -892,9 +890,12 @@ sub ThrowCodeError {
}
}
# For errors made by the user.
# For errors made by the user.
# The correct use of this function is to pass an error tag, defined in
# user-error.html.tmpl, as the first parameter, and then, optionally,
# undef as the second parameter and $unlock_tables as the third.
# The second parameter will eventually go away.
sub
ThrowUserError
{
sub
ThrowUserError
{
(
$vars
->
{
'error'
},
$vars
->
{
'title'
},
my
$unlock_tables
)
=
(
@_
);
(
$vars
->
{
'error'
},
$vars
->
{
'title'
},
my
$unlock_tables
)
=
(
@_
);
$vars
->
{
'title'
}
||=
"Error"
;
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
...
@@ -905,18 +906,20 @@ sub ThrowUserError {
...
@@ -905,18 +906,20 @@ sub ThrowUserError {
exit
;
exit
;
}
}
# If the template system isn't working, we can't use a template.
# This function should only be called if a template->process() fails.
# This should only be called if a template->process() fails.
# It tries another template first, because often one template being
# broken or missing doesn't mean that they all are. But it falls back on
# a print statement.
# The Content-Type will already have been printed.
# The Content-Type will already have been printed.
sub
ThrowTemplateError
{
sub
ThrowTemplateError
{
(
$vars
->
{
'
error
'
})
=
(
@_
);
(
$vars
->
{
'
template_error_msg
'
})
=
(
@_
);
$vars
->
{
'
title'
}
=
"Template E
rror"
;
$vars
->
{
'
error'
}
=
"template_e
rror"
;
# Try a template first; but if this one fails too, fall back
# Try a template first; but if this one fails too, fall back
# on plain old print statements.
# on plain old print statements.
if
(
!
$template
->
process
(
"global/code-error.html.tmpl"
,
$vars
))
{
if
(
!
$template
->
process
(
"global/code-error.html.tmpl"
,
$vars
))
{
my
$maintainer
=
Param
(
'maintainer'
);
my
$maintainer
=
Param
(
'maintainer'
);
my
$error
=
html_quote
(
$vars
->
{
'
error
'
});
my
$error
=
html_quote
(
$vars
->
{
'
template_error_msg
'
});
my
$error2
=
html_quote
(
$template
->
error
());
my
$error2
=
html_quote
(
$template
->
error
());
print
<<END;
print
<<END;
<tt>
<tt>
...
...
template/en/default/global/code-error.html.tmpl
View file @
e7cb77c3
...
@@ -21,11 +21,43 @@
...
@@ -21,11 +21,43 @@
[%# INTERFACE:
[%# INTERFACE:
# header_done: boolean. True if the header has already been printed.
# header_done: boolean. True if the header has already been printed.
# error: string. The error message to be printed. May contain HTML.
# error: string. The tag of the error, or the error message to be displayed
# (deprecated). May contain HTML if it's an error message.
# title: string. If error is an error message, the title (deprecated.)
# variables: hash. Useful data about the problem. The keys are the variable
# variables: hash. Useful data about the problem. The keys are the variable
# names, and the values the variable values.
# names, and the values the variable values.
#%]
#%]
[%# This is a list of all the possible code errors. Please keep them in
# alphabetical order by error tag, and leave a blank line between errors.
#%]
[% DEFAULT title = "Internal Error" %]
[% error_message = BLOCK %]
[% IF error == "aaa_example_error_tag" %]
[% title = "Example Error" %]
This is an example error. The title is set above. This text is the body
of the error. It can contain arbitrary <b>HTML</b>, and also references
to any [% parameters %] which you may have set before calling
ThrowCodeError.
[% ELSIF error == "another_error_tag" %]
This is another sample error, without a special title. This
should be the usual usage for this file. This sample can be removed.
[% ELSIF error == "template_error" %]
[% template_error_msg %]
[% ELSE %]
[%# Cope with legacy calling convention, where "error" was the string
# to print.
#%]
[% error %]
[% END %]
[% END %]
[% UNLESS header_done %]
[% UNLESS header_done %]
[% PROCESS global/header.html.tmpl %]
[% PROCESS global/header.html.tmpl %]
[% END %]
[% END %]
...
@@ -46,7 +78,7 @@
...
@@ -46,7 +78,7 @@
<tr>
<tr>
<td bgcolor="#ff0000">
<td bgcolor="#ff0000">
<font size="+2">
<font size="+2">
[% error %]
[% error
_message
%]
</font>
</font>
</td>
</td>
</tr>
</tr>
...
...
template/en/default/global/user-error.html.tmpl
View file @
e7cb77c3
...
@@ -21,9 +21,38 @@
...
@@ -21,9 +21,38 @@
[%# INTERFACE:
[%# INTERFACE:
# header_done: boolean. True if the header has already been printed.
# header_done: boolean. True if the header has already been printed.
# error: string. The error message to be displayed. May contain HTML.
# error: string. The tag of the error, or the error message to be displayed
# (deprecated). May contain HTML if it's an error message.
# title: string. If error is an error message, the title (deprecated.)
#%]
#%]
[%# This is a list of all the possible user errors. Please keep them in
# alphabetical order by error tag, and leave a blank line between errors.
#%]
[% DEFAULT title = "Error" %]
[% error_message = BLOCK %]
[% IF error == "aaa_example_error_tag" %]
[% title = "Example Error" %]
This is an example error. The title is set above. This text is the body
of the error. It can contain arbitrary <b>HTML</b>, and also references
to any [% parameters %] which you may have set before calling
ThrowUserError.
[% ELSIF error == "another_error_tag" %]
[% title = "Another Error" %]
This is another sample error. It can be removed.
[% ELSE %]
[%# Cope with legacy calling convention, where "error" was the string
# to print.
#%]
[% error %]
[% END %]
[% END %]
[% UNLESS header_done %]
[% UNLESS header_done %]
[% PROCESS global/header.html.tmpl %]
[% PROCESS global/header.html.tmpl %]
[% END %]
[% END %]
...
@@ -32,7 +61,7 @@
...
@@ -32,7 +61,7 @@
<tr>
<tr>
<td bgcolor="#ff0000">
<td bgcolor="#ff0000">
<font size="+2">
<font size="+2">
[% error %]
[% error
_message
%]
</font>
</font>
</td>
</td>
</tr>
</tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment