View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003838 | mantisbt | webpage | public | 2004-05-14 23:12 | 2008-08-11 09:41 |
| Reporter | rainmkr | Assigned To | rainmkr | ||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Fixed in Version | 1.2.0a2 | ||||
| Summary | 0003838: HTML Beautification | ||||
| Description | An effort to make the HTML source sent to the browser pleasing to the human eye when viewed. This is the first of what should be a series of patches to make the HTML sources nicer to view when need be. | ||||
| Tags | patch | ||||
| Attached Files | beautification_01.patch (10,262 bytes)
? mantisbt.patch
Index: login_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/login_page.php,v
retrieving revision 1.36
diff -u -r1.36 login_page.php
--- login_page.php 12 Apr 2004 21:04:35 -0000 1.36
+++ login_page.php 15 May 2004 02:16:38 -0000
@@ -124,9 +124,9 @@
# Check if the admin directory is available and is readable.
$t_admin_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR;
if ( is_dir( $t_admin_dir ) && is_readable( $t_admin_dir ) ) {
- echo '<div class="warning" align="center">';
- echo '<p><font color="red"><strong>WARNING:</strong> Admin directory should be removed.</font></p>';
- echo '</div>';
+ echo '<div class="warning" align="center">', "\n";
+ echo '<p><font color="red"><strong>WARNING:</strong> Admin directory should be removed.</font></p>', "\n";
+ echo '</div>', "\n";
}
?>
Index: meta_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/meta_inc.php,v
retrieving revision 1.15
diff -u -r1.15 meta_inc.php
--- meta_inc.php 11 Jan 2004 07:16:07 -0000 1.15
+++ meta_inc.php 15 May 2004 02:16:38 -0000
@@ -12,8 +12,8 @@
# prevent caching
$t_content_expire = config_get('content_expire');
?>
-<meta http-equiv="Pragma" content="no-cache" />
-<meta http-equiv="Cache-Control" content="no-cache" />
-<meta http-equiv="Pragma-directive" content="no-cache" />
-<meta http-equiv="Cache-Directive" content="no-cache" />
-<meta http-equiv="Expires" content="<?php echo $t_content_expire ?>" />
\ No newline at end of file
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Cache-Control" content="no-cache" />
+ <meta http-equiv="Pragma-directive" content="no-cache" />
+ <meta http-equiv="Cache-Directive" content="no-cache" />
+ <meta http-equiv="Expires" content="<?php echo $t_content_expire ?>" />
Index: core/html_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v
retrieving revision 1.93
diff -u -r1.93 html_api.php
--- core/html_api.php 12 Apr 2004 21:04:36 -0000 1.93
+++ core/html_api.php 15 May 2004 02:16:38 -0000
@@ -20,10 +20,10 @@
# html_page_top1
# html_begin
# html_head_begin
- # html_content_type
- # html_title
# html_css
+ # html_content_type
# (html_meta_redirect)
+ # html_title
# html_page_top2
# html_page_top2a
# html_head_end
@@ -60,10 +60,10 @@
function html_page_top1() {
html_begin();
html_head_begin();
- html_content_type();
- html_title();
html_css();
+ html_content_type();
include( config_get( 'meta_include_file' ) );
+ html_title();
}
# --------------------
@@ -135,42 +135,42 @@
# (1) Print the document type and the opening <html> tag
function html_begin() {
# @@@ NOTE make this a configurable global.
- #PRINT '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
- #PRINT '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">';
+ #echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', "\n";
+ #echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">', "\n";
- PRINT '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
- PRINT '<html>';
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', "\n";
+ echo '<html>', "\n";
}
# --------------------
# (2) Begin the <head> section
function html_head_begin() {
- PRINT '<head>';
+ echo string_insert_display_tabs(1); echo '<head>', "\n";
}
# --------------------
# (3) Print the content-type
function html_content_type() {
- PRINT '<meta http-equiv="Content-type" content="text/html;charset=' . lang_get( 'charset' ) . '" />';
+ echo string_insert_display_tabs(1); echo '<meta http-equiv="Content-type" content="text/html;charset=', lang_get( 'charset' ), '" />', "\n";
}
# --------------------
# (4) Print the window title
function html_title() {
$t_title = config_get( 'window_title' );
- PRINT '<title>' . string_display( $t_title ) . "</title>\n";
+ echo string_insert_display_tabs(1); echo '<title>', string_display( $t_title ), '</title>', "\n";
}
# --------------------
# (5) Print the link to include the css file
function html_css() {
$t_css_url = config_get( 'css_include_file' );
- PRINT '<link rel="stylesheet" type="text/css" href="' . $t_css_url . '" />';
+ echo string_insert_display_tabs(1); echo '<link rel="stylesheet" type="text/css" href="', $t_css_url, '" />', "\n";
# fix for NS 4.x css
- PRINT '<script type="text/javascript" language="JavaScript">';
- PRINT 'if(document.layers) {document.write("<style>td{padding:0px;}<\/style>")}';
- PRINT '</script>';
+ echo string_insert_display_tabs(1); echo '<script type="text/javascript" language="JavaScript">', "\n";
+ echo string_insert_display_tabs(2); echo 'if(document.layers) {document.write("<style>td{padding:0px;}<\/style>")}', "\n";
+ echo string_insert_display_tabs(1); echo '</script>', "\n";
}
# --------------------
@@ -188,7 +188,7 @@
$p_time = config_get( 'wait_time' );
}
- PRINT "<meta http-equiv=\"Refresh\" content=\"$p_time;URL=$p_url\" />";
+ echo "<meta http-equiv=\"Refresh\" content=\"$p_time;URL=$p_url\" />\n";
return true;
}
@@ -196,20 +196,20 @@
# --------------------
# (7) End the <head> section
function html_head_end() {
- PRINT '</head>';
+ echo '</head>', "\n";
}
# --------------------
# (8) Begin the <body> section
function html_body_begin() {
- PRINT '<body>';
+ echo '<body>', "\n";
}
# --------------------
# (9) Print the title displayed at the top of the page
function html_header() {
$t_title = config_get( 'page_title' );
- PRINT '<div class="center"><span class="pagetitle">' . string_display( $t_title ) . '</span></div>';
+ echo '<div class="center"><span class="pagetitle">', string_display( $t_title ), '</span></div>', "\n";
}
# --------------------
@@ -296,13 +296,13 @@
user_update_last_visit( $t_user_id );
}
- PRINT '<br />';
- PRINT '<hr size="1" />';
+ echo string_insert_display_tabs(1); echo '<br />', "\n";
+ echo string_insert_display_tabs(1); echo '<hr size="1" />', "\n";
if ( ON == config_get( 'show_version' ) ) {
- PRINT '<span class="timer"><a href="http://www.mantisbt.org/">Mantis ' . config_get( 'mantis_version' ) . '</a></span>';
+ echo string_insert_display_tabs(1); echo '<span class="timer"><a href="http://www.mantisbt.org/">Mantis ', config_get( 'mantis_version' ), '</a></span>', "\n";
}
- PRINT '<address>Copyright © 2000 - 2004</address>';
- PRINT '<address><a href="mailto:' . config_get( 'webmaster_email' ) . '">' . config_get( 'webmaster_email' ) . '</a></address>';
+ echo string_insert_display_tabs(1); echo '<address>Copyright © 2000 - 2004</address>', "\n";
+ echo string_insert_display_tabs(1); echo '<address><a href="mailto:', config_get( 'webmaster_email' ), '">', config_get( 'webmaster_email' ), '</a></address>', "\n";
# print timings
if ( ON == config_get( 'show_timer' ) ) {
@@ -312,20 +312,20 @@
# print db queries that were run
if ( ON == config_get( 'show_queries_count' ) ) {
$t_count = count( $g_queries_array );
- PRINT $t_count.' total queries executed.<br />';
- PRINT count( array_unique ( $g_queries_array ) ).' unique queries executed.<br />';
+ echo string_insert_display_tabs(1); echo $t_count, ' total queries executed.<br />', "\n";
+ echo string_insert_display_tabs(1); echo count( array_unique ( $g_queries_array ) ).' unique queries executed.<br />', "\n";
if ( ON == config_get( 'show_queries_list' ) ) {
- PRINT '<table>';
+ echo string_insert_display_tabs(1); echo '<table>', "\n";
$t_shown_queries = array();
for ( $i = 0; $i < $t_count; $i++ ) {
if ( in_array( $g_queries_array[$i], $t_shown_queries ) ) {
- PRINT '<tr><td style="color: red">'.($i+1).'</td><td style="color: red">'.htmlspecialchars($g_queries_array[$i]).'</td></tr>';
+ echo string_insert_display_tabs(1); echo '<tr><td style="color: red">', ($i+1), '</td><td style="color: red">', htmlspecialchars($g_queries_array[$i]), '</td></tr>', "\n";
} else {
array_push( $t_shown_queries, $g_queries_array[$i] );
- PRINT '<tr><td>'.($i+1).'</td><td>'.htmlspecialchars($g_queries_array[$i]) . '</td></tr>';
+ echo string_insert_display_tabs(1); echo '<tr><td>', ($i+1), '</td><td>', htmlspecialchars($g_queries_array[$i]), '</td></tr>', "\n";
}
}
- PRINT '</table>';
+ echo string_insert_display_tabs(1); echo '</table>', "\n";
}
}
}
@@ -333,13 +333,13 @@
# --------------------
# (14) End the <body> section
function html_body_end() {
- PRINT '</body>';
+ echo '</body>', "\n";
}
# --------------------
# (15) Print the closing <html> tag
function html_end() {
- PRINT '</html>';
+ echo '</html>', "\n";
}
@@ -814,4 +814,4 @@
html_button_bug_delete( $p_bug_id );
PRINT '</td></tr></table>';
}
-?>
\ No newline at end of file
+?>
Index: core/string_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v
retrieving revision 1.46
diff -u -r1.46 string_api.php
--- core/string_api.php 8 Apr 2004 20:52:50 -0000 1.46
+++ core/string_api.php 15 May 2004 02:16:38 -0000
@@ -373,4 +373,17 @@
function string_get_bug_report_page( $p_user_id = null ) {
return string_get_bug_page( 'report', $p_user_id );
}
+
+ # --------------------
+ # return a string with requested number of tab characters, used mainly to
+ # format (nicely) the html sent to the browser.
+ function string_insert_display_tabs( $n_tabs ) {
+ $string = NULL;
+ for ( $idx = 0; $idx < $n_tabs; $idx++ ) {
+ $string .= "\t";
+ }
+ return $string;
+ }
+
+
?>
| ||||