Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Issue #11826 - Remove all inline JavaScript from MantisBT (use extern…
…al scripts instead)

Issue #11995 - Add CSS IDs to html elements for styling and javascript access.
  • Loading branch information
Daryn Warriner committed Aug 27, 2010
1 parent 02aac88 commit 7ec1d49
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 34 deletions.
62 changes: 31 additions & 31 deletions core/html_api.php
Expand Up @@ -517,30 +517,31 @@ function html_login_info() {
$t_now = date( config_get( 'complete_date_format' ) );
$t_realname = current_user_get_field( 'realname' );

echo '<table class="hide" id="login-info">';
echo '<tr>';
echo '<td class="login-info-left">';
echo '<div id="login-info">';
if( current_user_is_anonymous() ) {
$t_return_page = $_SERVER['SCRIPT_NAME'];
if( isset( $_SERVER['QUERY_STRING'] ) ) {
$t_return_page .= '?' . $_SERVER['QUERY_STRING'];
}

$t_return_page = string_url( $t_return_page );
echo lang_get( 'anonymous' ) . ' | <a href="' . helper_mantis_url( 'login_page.php?return=' . $t_return_page ) . '">' . lang_get( 'login_link' ) . '</a>';

echo '<span id="logged-anon-label">' . lang_get( 'anonymous' ) . '</span>';
echo '<span id="login-link"><a href="' . helper_mantis_url( 'login_page.php?return=' . $t_return_page ) . '">' . lang_get( 'login_link' ) . '</a></span>';
if( config_get_global( 'allow_signup' ) == ON ) {
echo ' | <a href="' . helper_mantis_url( 'signup_page.php' ) . '">' . lang_get( 'signup_link' ) . '</a>';
echo '<span id="signup-link"><a href="' . helper_mantis_url( 'signup_page.php' ) . '">' . lang_get( 'signup_link' ) . '</a></span>';
}
} else {
echo lang_get( 'logged_in_as' ), ": <span class=\"italic\">", string_html_specialchars( $t_username ), "</span> <span class=\"small\">";
echo is_blank( $t_realname ) ? "($t_access_level)" : "(" . string_html_specialchars( $t_realname ) . " - $t_access_level)";
echo "</span>";
echo '<span id="logged-in-label">' . lang_get( 'logged_in_as' ) . '</span>';
echo '<span id="logged-in-user">' . string_html_specialchars( $t_username ) . '</span>';
echo '<span id="logged-in">';
echo !is_blank( $t_realname ) ? '<span id="logged-in-realname">' . string_html_specialchars( $t_realname ) . '</span>' : '';
echo '<span id="logged-in-accesslevel" class="' . $t_access_level . '">' . $t_access_level . '</span>';
echo '</span>';
}
echo '</td>';
echo '<td class="login-info-middle">';
echo "<span class=\"italic\">$t_now</span>";
echo '</td>';
echo '<td class="login-info-right">';
echo '</div>';


$t_show_project_selector = true;
if( count( current_user_get_accessible_projects() ) == 1 ) {

Expand All @@ -552,32 +553,31 @@ function html_login_info() {
}
}

if( OFF != config_get( 'rss_enabled' ) ) {
echo '<div id="rss-feed">';
# Link to RSS issues feed for the selected project, including authentication details.
echo '<a href="' . htmlspecialchars( rss_get_issues_feed_url() ) . '">';
echo '<img src="' . helper_mantis_url( 'images/rss.png' ) . '" alt="' . lang_get( 'rss' ) . '" title="' . lang_get( 'rss' ) . '" />';
echo '</a>';
echo '</div>';
}

if( $t_show_project_selector ) {
echo '<div id="project-selector">';
echo '<form method="post" name="form_set_project" action="' . helper_mantis_url( 'set_project.php' ) . '">';
# CSRF protection not required here - form does not result in modifications

echo lang_get( 'email_project' ), ': ';
if( ON == config_get( 'use_javascript' ) ) {
echo '<select name="project_id" class="small" onchange="document.forms.form_set_project.submit();">';
} else {
echo '<select name="project_id" class="small">';
}
echo '<label for="form-set-project-id">' . lang_get( 'email_project' ) . '</label>';
echo '<select id="form-set-project-id" name="project_id">';
print_project_option_list( join( ';', helper_get_current_project_trace() ), true, null, true );
echo '</select> ';
echo '<input type="submit" class="button-small" value="' . lang_get( 'switch' ) . '" />';
echo '<input type="submit" class="button" value="' . lang_get( 'switch' ) . '" />';
echo '</form>';
echo '</div>';
echo '<div id="current-time">' . $t_now . '</div>';
} else {
echo '<div id="current-time-centered">' . $t_now . '</div>';
}
if( OFF != config_get( 'rss_enabled' ) ) {

# Link to RSS issues feed for the selected project, including authentication details.
echo '<a href="' . htmlspecialchars( rss_get_issues_feed_url() ) . '">';
echo '<img src="' . helper_mantis_url( 'images/rss.png' ) . '" alt="' . lang_get( 'rss' ) . '" style="border-style: none; margin: 5px; vertical-align: middle;" />';
echo '</a>';
}

echo '</td>';
echo '</tr>';
echo '</table>';
}

/**
Expand Down
33 changes: 30 additions & 3 deletions css/default.css
Expand Up @@ -87,11 +87,37 @@ tr.bugnote .time-tracked,
.time-tracking-total .time-tracked { font-size: larger; font-weight:bold; margin: 0 0 1em; padding:0; }
.time-tracking-total { text-align:right; }

#login-info { clear: both; position: relative; display: block; float: left; padding: .5em 0; z-index: 100; line-height: 1em; }

#logged-anon-label, #login-link, #signup-link { float: left; margin: .25; padding: 0; font-size: 1em; }
#logged-anon-label { padding: 0 .5em; }
#login-link a, #signup-link a { padding: 0 .5em; }
#login-link:before, #signup-link:before { content: '|'; }

#logged-in-label { float: left; }
#logged-in-label:after { content: ':'; }
#logged-in-user { float: left; margin: 0 .5em; font-style: italic; font-size: 1em; }
#logged-in-realname, #logged-in-accesslevel { font-size: 1em; margin: 0; padding: 0; z-index: 100; }
#logged-in{ display: block; float: left; font-size: .8em; margin: 0; padding: 0; line-height: 1.3em; }
#logged-in:before { content: '(' ; }
#logged-in:after { content: ')' ; }
#logged-in-realname:after { content: ' - ' ; }

#current-time-centered{ position: absolute; width: 100%; text-align: center; }
#current-time{ margin-right: -2em; float: right; text-align: center; width: 17%; padding: .5em .25em; z-index: 0; line-height: 1em; }
#project-selector { float: right; z-index: 100; width: 42%; text-align: right; font-size: small; padding: .1em 0 .05em 0; line-height: 1em; margin: 0 .5em 0 1em; }
#project-selector label { padding: .5em; }
#project-selector label:after { content: ':' }
#project-selector select{ font-size: small; line-height: 1em; }
#project-selector select{ font-size: small; line-height: 1em; }
#project-selector .button { font-size: small; line-height: 1em; padding: 0; margin: 0; }
#rss-feed { float: right; width: 16px; z-index: 0; padding: .5em 0; margin: 0; }

td.login-info-left { width: 33%; padding: 0px; text-align: left; }
td.login-info-middle { width: 33%; padding: 0px; text-align: center; }
td.login-info-right { width: 33%; padding: 0px; text-align: right; white-space: nowrap; }

.bug-jump { display:block; float: right; padding: .25em; margin: 0; position: relative; top: .3em; z-index: 100; }
.bug-jump { clear: both; display:block; float: right; padding: .25em; margin: 0; position: relative; top: .3em; z-index: 100; }
.main-menu { float: right; width:100%; margin: 0; padding: 0; overflow: hidden; font-size: 1em; position: relative; top: -2em; border: 1px solid #999; background-color: #e8e8e8; z-index: 99; }
.main-menu div { width: 93.75%; }
.main-menu ul { clear: left; float: left; list-style: none; position: relative; left: 50%; margin: 0 0 0 -3.75em; padding: .25em; width: 90%; }
Expand Down Expand Up @@ -127,7 +153,7 @@ span.switch-view:before { content: "[" }
span.permalink:after,
span.switch-view:after { content: "]" }

#content { position: relative; top: 0; margin: 0; padding: .5em; }
#content { clear: both; position: relative; top: 0; margin: 0; padding: .5em; }
.recently-visited { position: relative; top: -2.5em; float: right; text-align: right; font-size: x-small; }

br { clear:both; }
Expand Down Expand Up @@ -263,10 +289,11 @@ select.tainted { background-color: #ffffff; color: red; }
.submit-query{ float: left; position: relative; padding: 0 .5em; margin: 0; }
.other-forms { float: right; position: relative; padding: 0; margin: 0; }
.filter-links { float: left; position: relative; padding: 0 .5em; margin: 0; line-height: 2.25em; }
.stored-queries { float: left; padding: 0 .5em; margin: 0; line-height: 2.25em; }
.stored-queries { float: left; padding: 0 .5em; margin: 0; line-height: 2.25em; z-index: 100; }
.reset-query { float: left; padding: 0; margin: 0; line-height: 2.25em; }
.save-query { float: left; padding: 0 .5em; margin: 0; line-height: 2.25em; }

#filter_open { position: relative; }
#filter_open .search-box,
#filter_open .submit-query { top: -.9em; }
#filter_open .other-forms { top: -1.1em; }
Expand Down
4 changes: 4 additions & 0 deletions javascript/common.js
Expand Up @@ -166,6 +166,10 @@ $(document).ready( function() {
$('[name=source_query_id]').change( function() {
$(this).parent().submit();
});
$('[name=form_set_project]').children('[name=project_id]').change( function() {
$(this).parent().submit();
});
$('[name=form_set_project]').children('.button').hide();
setBugLabel();
});

Expand Down
4 changes: 4 additions & 0 deletions javascript/dev/common.js
Expand Up @@ -170,6 +170,10 @@ $(document).ready( function() {
$('[name=source_query_id]').change( function() {
$(this).parent().submit();
});
$('[name=form_set_project]').children('[name=project_id]').change( function() {
$(this).parent().submit();
});
$('[name=form_set_project]').children('.button').hide();
setBugLabel();
});

Expand Down

0 comments on commit 7ec1d49

Please sign in to comment.