Skip to content

Commit

Permalink
Fix validation issues and improve html/css for main page, news add, n…
Browse files Browse the repository at this point in the history
…ews menu page, and news view page.
  • Loading branch information
Daryn Warriner committed Feb 14, 2011
1 parent 85439a6 commit 0bf520c
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 106 deletions.
47 changes: 15 additions & 32 deletions core/print_api.php
Expand Up @@ -414,40 +414,23 @@ function print_news_entry( $p_headline, $p_body, $p_poster_id, $p_view_state, $p
$t_news_css = 'news-heading-private';
} else {
$t_news_css = 'news-heading-public';
}

$output = '<div>';
$output .= '<table class="width75" cellspacing="0">';
$output .= '<tr>';
$output .= "<td class=\"$t_news_css\">";
$output .= "<span class=\"bold\">$t_headline</span> - ";
$output .= "<span class=\"italic-small\">$t_date_posted</span> - ";
echo $output;

/** @todo eventually we should replace print's with methods to construct the strings. */
print_user( $p_poster_id );
$output = '';

if( 1 == $p_announcement ) {
$output .= ' <span class="small">';
$output .= '[' . lang_get( 'announcement' ) . ']';
$output .= '</span>';
}
if( VS_PRIVATE == $p_view_state ) {
$output .= ' <span class="small">';
$output .= '[' . lang_get( 'private' ) . ']';
$output .= '</span>';
}
} ?>

$output .= '</td>';
$output .= '</tr>';
$output .= '<tr>';
$output .= "<td class=\"news-body\">$t_body</td>";
$output .= '</tr>';
$output .= '</table>';
$output .= '</div>';
<div class="news-item">
<h3 class="<?php echo $t_news_css; ?>">
<span class="news-title"><?php echo $t_headline; ?></span>
<span class="news-date-posted"><?php echo $t_date_posted; ?></span>
<span class="news-author"><?php echo prepare_user_name( $p_poster_id ); ?></span><?php

echo $output;
if( 1 == $p_announcement ) { ?>
<span class="news-announcement"><?php echo lang_get( 'announcement' ); ?></span><?php
}
if( VS_PRIVATE == $p_view_state ) { ?>
<span class="news-private"><?php echo lang_get( 'private' ); ?></span><?php
} ?>
</h3>
<p class="news-body"><?php echo $t_body; ?></p>
</div><?php
}

# --------------------
Expand Down
26 changes: 21 additions & 5 deletions css/default.css
Expand Up @@ -179,6 +179,21 @@ td.news-heading-public { background-color: #c8c8e8; color: #000000; text-align:
td.news-heading-private { background-color: #d8d8d8; color: #000000; text-align: left; border-bottom: 1px solid #000000; }
td.news-body { background-color: #ffffff; color: #000000; padding: 16px; }

div#news-items { clear: both; }
div.news-item { border: 1px solid #000; padding: 0em; width: 75%; margin: 2em auto; }
div#news-items div:first-child { margin-top: 3em; }
h3.news-heading-public { background-color: #c8c8e8; color: #000000; text-align: left; border-bottom: 1px solid #000000; margin: 0em; padding: .25em; }
h3.news-heading-private { background-color: #d8d8d8; color: #000000; text-align: left; border-bottom: 1px solid #000000; margin: 0em; padding: .25em; }
p.news-body { background-color: #ffffff; color: #000000; margin: 0em; padding: 1em; }
.news-date-posted { font-style: italic; font-size: .8em; font-weight: normal; }
.news-author { font-weight: normal; }
.news-announcement, .news-private { font-weight: normal; font-size: .7em; }
.news-title:after, .news-date-posted:after, .news-headline:after { content: ' - '; font-weight: normal; }
.news-announcement:before, .news-private:before { content: '['; font-weight: normal; }
.news-announcement:after, .news-private:after { content: ']'; font-weight: normal; }
#news-menu { clear: both; margin: 0em auto; width: 75%; text-align: center; }
.news-headline { font-weight: bold; }

img {}
img.icon { width: 11px; height: 11px; }
img.delete-icon { position: relative; top: 5px; border: 0; }
Expand Down Expand Up @@ -525,10 +540,16 @@ div.form-container .input,
div.form-container .display-value {
width: 65%;
}
div.success-msg,
div.important-msg {
display: block;
width: 60%;
margin: 2em auto;
}
div.success-msg {
text-align: center;
}
div.important-msg {
color: red;
border: 1px solid red;
background-color: #fceded;
Expand All @@ -541,11 +562,6 @@ div.important-msg ul li {
margin-left: 2em;
background-color: #fceded;
}
div.success-msg {
display: block;
width: 60%;
margin: 1em auto;
}
.continue-link {
clear: both;
display: block;
Expand Down
37 changes: 17 additions & 20 deletions main_page.php
Expand Up @@ -89,30 +89,28 @@
echo '</div>';
}

echo '<br />';
echo '<br />';

if ( news_is_enabled() ) {
echo '<br />';

$t_news_rows = news_get_limited_rows( $f_offset, $t_project_id );
$t_news_count = count( $t_news_rows );

# Loop through results
for ( $i = 0; $i < $t_news_count; $i++ ) {
$t_row = $t_news_rows[$i];

# only show VS_PRIVATE posts to configured threshold and above
if ( ( VS_PRIVATE == $t_row[ 'view_state' ] ) &&
!access_has_project_level( config_get( 'private_news_threshold' ) ) ) {
continue;
}

print_news_entry_from_row( $t_row );
echo '<br />';
} # end for loop
if( $t_news_count ) {
echo '<div id="news-items">';
# Loop through results
for ( $i = 0; $i < $t_news_count; $i++ ) {
$t_row = $t_news_rows[$i];

# only show VS_PRIVATE posts to configured threshold and above
if ( ( VS_PRIVATE == $t_row[ 'view_state' ] ) &&
!access_has_project_level( config_get( 'private_news_threshold' ) ) ) {
continue;
}

print_news_entry_from_row( $t_row );
} # end for loop
echo '</div>';
}

echo '<div>';
echo '<div id="news-menu">';

print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) );
$t_news_view_limit = config_get( 'news_view_limit' );
Expand All @@ -135,4 +133,3 @@
}

html_page_bottom();

14 changes: 4 additions & 10 deletions news_add.php
Expand Up @@ -68,17 +68,11 @@
html_page_top();
?>

<br />
<div>
<?php
echo lang_get( 'operation_successful' ) . '<br />';
print_bracket_link( 'news_menu_page.php', lang_get( 'proceed' ) );

echo '<br /><br />';
<div class="success-msg"><?php
echo lang_get( 'operation_successful' ) . '<br />';
print_bracket_link( 'news_menu_page.php', lang_get( 'proceed' ) ); ?>
</div><?php

print_news_entry_from_row( $t_news_row );
?>
</div>

<?php
html_page_bottom();
58 changes: 24 additions & 34 deletions news_list_page.php
Expand Up @@ -59,41 +59,31 @@
$rows = news_get_rows( helper_get_current_project() );
$t_count = count( $rows );

if ( $t_count > 0 ) {
echo '<ul>';
}

# Loop through results
for ( $i=0 ; $i < $t_count ; $i++ ) {
extract( $rows[$i], EXTR_PREFIX_ALL, 'v' );
if ( VS_PRIVATE == $v_view_state &&
! access_has_project_level( config_get( 'private_news_threshold' ), $v_project_id ) ) {
continue;
}

$v_headline = string_display( $v_headline );
$v_date_posted = date( config_get( 'complete_date_format' ), $v_date_posted );

$t_notes = array();
$t_note_string = '';
if ( 1 == $v_announcement ) {
array_push( $t_notes, lang_get( 'announcement' ) );
}
if ( VS_PRIVATE == $v_view_state ) {
array_push( $t_notes, lang_get( 'private' ) );
}
if ( count( $t_notes ) > 0 ) {
$t_note_string = '['.implode( ' ', $t_notes ).']';
}

echo "<li><span class=\"italic-small\">$v_date_posted</span> - <span class=\"bold\"><a href=\"news_view_page.php?news_id=$v_id\">$v_headline</a></span> <span class=\"small\"> ";
print_user( $v_poster_id );
echo ' ' . $t_note_string;
echo "</span></li>";
} # end for loop
if ( $t_count > 0 ) { ?>
<ul><?php
# Loop through results
for ( $i=0 ; $i < $t_count ; $i++ ) {
extract( $rows[$i], EXTR_PREFIX_ALL, 'v' );
if ( VS_PRIVATE == $v_view_state &&
! access_has_project_level( config_get( 'private_news_threshold' ), $v_project_id ) ) {
continue;
}

if ( $t_count > 0 ) {
echo '</ul>';
$v_headline = string_display( $v_headline );
$v_date_posted = date( config_get( 'complete_date_format' ), $v_date_posted ); ?>
<li>
<span class="news-date-posted"><?php echo $v_date_posted; ?></span>
<span class="news-headline"><a href="news_view_page.php?news_id=<?php echo $v_id; ?>"><?php echo $v_headline; ?></a></span>
<span class="news-author"><?php echo prepare_user_name( $v_poster_id ); ?></span><?php
if( 1 == $v_announcement ) { ?>
<span class="news-announcement"><?php echo lang_get( 'announcement' ); ?></span><?php
}
if( VS_PRIVATE == $v_view_state ) { ?>
<span class="news-private"><?php echo lang_get( 'private' ); ?></span><?php
} ?>
</li><?php
} # end for loop ?>
</ul><?php
}

html_page_bottom();
4 changes: 2 additions & 2 deletions news_menu_page.php
Expand Up @@ -54,8 +54,8 @@
?>

<div id="news-add-div" class="form-container">
<form id="news-add-form" method="post" action="news_add.php" class="has-required">
<fieldset>
<form id="news-add-form" method="post" action="news_add.php">
<fieldset class="has-required">
<legend><span><?php echo lang_get( 'add_news_title' ) ?></span></legend>
<?php echo form_security_field( 'news_add' ); ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
Expand Down
4 changes: 1 addition & 3 deletions news_view_page.php
Expand Up @@ -50,7 +50,6 @@

html_page_top();
?>
<br />

<?php
if ( $f_news_id !== null ) {
Expand All @@ -66,8 +65,7 @@
}
?>

<br />
<div>
<div id="news-menu">
<?php print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) ); ?>
</div>

Expand Down

0 comments on commit 0bf520c

Please sign in to comment.