Skip to content

Commit

Permalink
# this commit gets flat list page done
Browse files Browse the repository at this point in the history
  • Loading branch information
brian committed Apr 8, 2006
1 parent 1b02227 commit 1427e2f
Show file tree
Hide file tree
Showing 20 changed files with 249 additions and 72 deletions.
12 changes: 6 additions & 6 deletions include/index_new.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
foreach( $forums as $key=>$forum ) {
if($forum["folder_flag"] && $forum["vroot"]==$PHORUM["vroot"]){
$folders[$key]=$forum["forum_id"];
$forums[$key]["url"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );
$forums[$key]["URL"]["LIST"] = phorum_get_url( PHORUM_INDEX_URL, $forum["forum_id"] );

$sub_forums = phorum_db_get_forums( 0, $forum["forum_id"] );
foreach($sub_forums as $sub_forum){
Expand Down Expand Up @@ -88,15 +88,15 @@
$forum["last_post"] = " ";
}

$forum["message_count"] = number_format($forum["message_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["thread_count"] = number_format($forum["thread_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);

if($PHORUM["DATA"]["LOGGEDIN"] && $PHORUM["show_new_on_index"]){
list($forum["new_messages"], $forum["new_threads"]) = phorum_db_newflag_get_unread_count($forum["forum_id"]);
$forum["new_messages"] = number_format($forum["new_messages"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["new_threads"] = number_format($forum["new_threads"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
}

$forum["message_count"] = number_format($forum["message_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["new_messages"] = number_format($forum["new_messages"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["thread_count"] = number_format($forum["thread_count"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
$forum["new_threads"] = number_format($forum["new_threads"], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);

$shown_sub_forums[] = $forum;

}
Expand Down
3 changes: 2 additions & 1 deletion include/lang/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@
"of" => "of", // as in: 1 - 5 of 458
"Options" => "Options",

"Pages" => "Goto Page",
"Page" => "Page",
"Pages" => "Pages",
"Password" => "Password",
"Past180Days" => "Past 180 Days",
"Past30Days" => "Past 30 Days",
Expand Down
28 changes: 19 additions & 9 deletions list.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,25 @@
// will be zero. In that case, simply use one page.
if ($pages == 0) $pages = 1;

if($pages<=11){
$pages_shown = (isset($PHORUM["TMP"]["list_pages_shown"])) ? $PHORUM["TMP"]["list_pages_shown"] : 11;

// first $pages_shown pages
if($page - floor($pages_shown/2) <= 0){
$page_start=1;
} elseif($pages-$page<5) {
$page_start=$pages-10;
} elseif($pages>11 && $page>6){
$page_start=$page-5;

// last $pages_shown pages
} elseif($page > $pages - floor($pages_shown/2)) {
$page_start = $pages - $pages_shown + 1;

// all others
} else {
$page_start=1;
$page_start = $page - floor($pages_shown/2);
}

$pageno=1;
for($x=0;$x<11 && $x<$pages;$x++){


for($x=0;$x<$pages_shown && $x<$pages;$x++){
$pageno=$x+$page_start;
$PHORUM["DATA"]["PAGES"][] = array(
"pageno"=>$pageno,
Expand Down Expand Up @@ -163,7 +170,7 @@
if($PHORUM["count_views"]) { // show viewcount if enabled
if($PHORUM["count_views"] == 2) { // viewcount as column
$PHORUM["DATA"]["VIEWCOUNT_COLUMN"]=true;
$rows[$key]["viewcount"]=$row['viewcount'];
$rows[$key]["viewcount"] = number_format($row['viewcount'], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);
} else { // viewcount added to the subject
$rows[$key]["subject"]=$row["subject"]." ({$row['viewcount']} " . $PHORUM['DATA']['LANG']['Views_Subject'] . ")";
}
Expand Down Expand Up @@ -266,6 +273,8 @@
// default thread-count
$thread_count=$row["thread_count"];

$rows[$key]["thread_count"] = number_format($row['thread_count'], 0, $PHORUM["dec_sep"], $PHORUM["thous_sep"]);

if ($PHORUM["DATA"]["LOGGEDIN"]){

if($PHORUM["DATA"]["MODERATOR"]){
Expand Down Expand Up @@ -332,6 +341,7 @@
$rows[$key]["pages"].="<a href=\"$url\">$pageno</a>&nbsp;";
}
}

if(isset($row['meta']['recent_post'])) {
if($pages>1){
$rows[$key]["last_post_url"]=phorum_get_url(PHORUM_READ_URL, $row["thread"], $row["meta"]["recent_post"]["message_id"], "page=$pages");
Expand Down Expand Up @@ -423,7 +433,7 @@


// set up the data
$PHORUM["DATA"]["ROWS"] = $rows;
$PHORUM["DATA"]["MESSAGES"] = $rows;

$PHORUM["DATA"]["URL"]["MARKREAD"] = phorum_get_url(PHORUM_LIST_URL, $PHORUM["forum_id"], "markread");
if($PHORUM["DATA"]["MODERATOR"]) {
Expand Down
5 changes: 3 additions & 2 deletions templates/default2/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<head>
<link rel="stylesheet" type="text/css" href="templates/{TEMPLATE}/styles/main.css" media="screen,print" />
{IF URL->RSS}
<link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="{URL->RSS}" />
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{URL->RSS}" />
{/IF}
{IF URL->REDIRECT}
<meta http-equiv="refresh" content="{IF REDIRECT_TIME}{REDIRECT_TIME}{ELSE}5{/IF}; url={URL->REDIRECT}" />
Expand Down Expand Up @@ -55,12 +55,13 @@
</div>

<div id="search-area" style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/zoom.png');">
{INCLUDE paging}
<form id="header-search-form" action="{URL->SEARCH}" method="get">
<input type="hidden" name="forum_id" value="{FORUM_ID}" />
<input type="hidden" name="match_forum" value="ALL" />
<input type="hidden" name="match_dates" value="365" />
<input type="hidden" name="match_type" value="ALL" />
<input type="text" name="search" size="20" value="" /><input type="submit" value="{LANG->Search}" /> <a href="{URL->SEARCH}">{LANG->Advanced}</a>
<input type="text" name="search" size="20" value="" class="styled-text" /><input type="submit" value="{LANG->Search}" class="styled-button" /> <a href="{URL->SEARCH}">{LANG->Advanced}</a>
</form>
</div>

Binary file added templates/default2/images/arrow_join.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/bell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/comment_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/control_first.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/control_last.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/control_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/control_prev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/flag_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/default2/images/page_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 63 additions & 41 deletions templates/default2/list.tpl
Original file line number Diff line number Diff line change
@@ -1,51 +1,73 @@
{!
comment
}

<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Goto}:</span>&nbsp;{IF URL->INDEX}<a class="PhorumNavLink" href="{URL->INDEX}">{LANG->ForumList}</a>&bull;{/IF}<a class="PhorumNavLink" href="{URL->POST}">{LANG->NewTopic}</a>&bull;<a class="PhorumNavLink" href="{URL->SEARCH}">{LANG->Search}</a>&bull;{INCLUDE loginout_menu}
<div id="list-nav">
<a style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/folder.png');" href="{URL->INDEX}">{LANG->ForumList}</a>
<a style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/comment_add.png');" href="{URL->POST}">{LANG->NewTopic}</a>
{IF USER->user_id}
<a style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/tag_green.png');" href="{URL->MARK_READ}">{LANG->MarkForumRead}</a>
{/IF}
{IF URL->RSS}
<a style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/feed.png');" href="{URL->RSS}">{LANG->RSS}</a>
{/IF}
</div>
{INCLUDE paging}
<table border="0" cellspacing="0" class="PhorumStdTable">
<tr>
<th class="PhorumTableHeader" align="left">{LANG->Subject}</th>
{IF VIEWCOUNT_COLUMN}
<th class="PhorumTableHeader" align="center" width="40">{LANG->Views}</th>
<table border="0" cellspacing="0" id="messages">
<tr>
<th class="messages-subject">{LANG->Subject}</th>
{IF VIEWCOUNT_COLUMN}
<th class="messages-views">{LANG->Views}</th>
{/IF}
<th class="messages-posts" nowrap="nowrap">{LANG->Posts}</th>
<th class="messages-started-by" nowrap="nowrap">{LANG->StartedBy}</th>
<th class="messages-last-post" nowrap="nowrap">{LANG->LastPost}</th>
{IF MODERATOR true}
<th class="messages-moderate" nowrap="nowrap">{LANG->Moderate}</th>
{/IF}
</tr>

{LOOP MESSAGES}
{IF altclass ""}
{var altclass "message-alt"}
{ELSE}
{var altclass ""}
{/IF}

{IF MESSAGES->sort PHORUM_SORT_ANNOUNCEMENT}
{var icon "information"}
{ELSEIF MESSAGES->sort PHORUM_SORT_STICKY}
{var icon "bell"}
{ELSEIF MESSAGES->moved PHORUM_SORT_STICKY}
{var icon "page_go"}
{ELSEIF MESSAGES->new}
{var icon "flag_red"}
{ELSE}
{var icon "comment"}
{/IF}
<th class="PhorumTableHeader" align="center" nowrap="nowrap" width="80">{LANG->Posts}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->StartedBy}&nbsp;</th>
<th class="PhorumTableHeader" align="left" nowrap="nowrap" width="150">{LANG->LastPost}&nbsp;</th>
</tr>
<?php $rclass="Alt"; ?>
{LOOP ROWS}
<?php if($rclass=="Alt") $rclass=""; else $rclass="Alt"; ?>

{IF MESSAGES->new}
{var newclass "message-new"}
{ELSE}
{var newclass ""}
{/IF}

<tr>
<td class="PhorumTableRow<?php echo $rclass;?>">
{marker}
{IF ROWS->sort PHORUM_SORT_STICKY}<span class="PhorumListSubjPrefix">{LANG->Sticky}:</span>{/IF}
{IF ROWS->sort PHORUM_SORT_ANNOUNCEMENT}<span class="PhorumListSubjPrefix">{LANG->Announcement}:</span>{/IF}
{IF ROWS->moved}<span class="PhorumListSubjPrefix">{LANG->MovedSubject}:</span>{/IF}
<a href="{ROWS->url}">{ROWS->subject}</a>
{IF ROWS->new}&nbsp;<span class="PhorumNewFlag">{ROWS->new}</span>{/IF}
{IF ROWS->pages}<span class="PhorumListPageLink">&nbsp;&nbsp;&nbsp;{LANG->Pages}: {ROWS->pages}</span>{/IF}
{IF MODERATOR true}<br /><span class="PhorumListModLink"><a href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{ROWS->delete_url2}';">{LANG->DeleteThread}</a>{IF ROWS->move_url}&nbsp;&#8226;&nbsp;<a href="{ROWS->move_url}">{LANG->MoveThread}</a>{/IF}&nbsp;&#8226;&nbsp;<a href="{ROWS->merge_url}">{LANG->MergeThread}</a></span>{/IF}
<td class="message-subject {altclass}" style="background-image: url('{URL->BASE_URL}/templates/{TEMPLATE}/images/{icon}.png');">
<a href="{MESSAGES->url}" class="{newclass}">{MESSAGES->subject}</a>
{IF MESSAGES->pages}&nbsp;<small>&nbsp;[{LANG->Pages}: {MESSAGES->pages}]</small>{/IF}
</td>
{IF VIEWCOUNT_COLUMN}
<td class="PhorumTableRow<?php echo $rclass;?>" align="center">{ROWS->viewcount}&nbsp;</td>
<td class="message-view-count {altclass}" nowrap="nowrap">{MESSAGES->viewcount}</td>
{/IF}
<td class="PhorumTableRow<?php echo $rclass;?>" align="center" nowrap="nowrap">{ROWS->thread_count}&nbsp;</td>
<td class="PhorumTableRow<?php echo $rclass;?>" nowrap="nowrap">{ROWS->linked_author}&nbsp;</td>
<td class="PhorumTableRow<?php echo $rclass;?> PhorumSmallFont" nowrap="nowrap">
{ROWS->lastpost}&nbsp;<br />
<span class="PhorumListSubText">
<a href="{ROWS->last_post_url}">{LANG->LastPostLink}</a> {LANG->by} {ROWS->last_post_by}
</span>
<td class="message-thread-count {altclass}" nowrap="nowrap">{MESSAGES->thread_count}</td>
<td class="message-author {altclass}" nowrap="nowrap">{MESSAGES->linked_author}</td>
<td class="message-last-post {altclass}" nowrap="nowrap">{MESSAGES->lastpost}<br /><a href="{MESSAGES->last_post_url}">{LANG->LastPostLink}</a> {LANG->by} {MESSAGES->last_post_by}</td>
{IF MODERATOR true}
<td class="message-actions {altclass}" nowrap="nowrap">
<a title="{LANG->DeleteThread}" href="javascript:if(window.confirm('{LANG->ConfirmDeleteThread}')) window.location='{MESSAGES->delete_url2}';"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/delete.png" width="16" height="16" alt="{LANG->DeleteThread}" border="0" /></a>
<a title="{LANG->MoveThread}" href="{MESSAGES->move_url}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/page_go.png" width="16" height="16" alt="{LANG->MoveThread}" border="0" /></a>
<a title="{LANG->MergeThread}" href="{MESSAGES->merge_url}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/arrow_join.png" width="16" height="16" alt="{LANG->MergeThread}" border="0" /></a>
</td>
{/IF}

</tr>
{/LOOP ROWS}
{/LOOP MESSAGES}
</table>
{INCLUDE paging}
<div class="PhorumNavBlock" style="text-align: left;">
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->Options}:</span>
{IF LOGGEDIN true}&nbsp;<a class="PhorumNavLink" href="{URL->MARKREAD}">{LANG->MarkRead}</a>{/IF}
</div>

11 changes: 4 additions & 7 deletions templates/default2/paging.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<div class="PhorumNavBlock" style="text-align: left;">
{IF NOT TOTALPAGES 1}
<div style="float: right;">
<span class="PhorumNavHeading">{LANG->Pages}:</span>&nbsp;{IF URL->PREVPAGE}<a class="PhorumNavLink" href="{URL->PREVPAGE}">{LANG->PrevPage}</a>{/IF}{IF URL->FIRSTPAGE}<a class="PhorumNavLink" href="{URL->FIRSTPAGE}">{LANG->FirstPage}...</a>{/IF}{LOOP PAGES}{IF PAGES->pageno CURRENTPAGE}<span class="PhorumNavLink"><strong>{PAGES->pageno}</strong></span>{ELSE}<a class="PhorumNavLink" href="{PAGES->url}">{PAGES->pageno}</a>{/IF}{/LOOP PAGES}{IF URL->LASTPAGE}<a class="PhorumNavLink" href="{URL->LASTPAGE}">...{LANG->LastPage}</a>{/IF}{IF URL->NEXTPAGE}<a class="PhorumNavLink" href="{URL->NEXTPAGE}">{LANG->NextPage}</a>{/IF}
</div>
{/IF}
<span class="PhorumNavHeading PhorumHeadingLeft">{LANG->CurrentPage}: </span>{CURRENTPAGE} {LANG->of} {TOTALPAGES}
{IF TOTALPAGES}
<div class="paging">
{LANG->Page} {CURRENTPAGE} {LANG->of} {TOTALPAGES}&nbsp;&nbsp;&nbsp;&nbsp;<strong>{LANG->Pages}:</strong>&nbsp;{IF URL->FIRSTPAGE}<a href="{URL->FIRSTPAGE}" title="{LANG->FirstPage}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/control_first.png" width="16" height="16" border="0" alt="{LANG->FirstPage}" /></a>{/IF}{IF URL->PREVPAGE}<a href="{URL->PREVPAGE}" title="{LANG->PrevPage}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/control_prev.png" width="16" height="16" border="0" alt="{LANG->PrevPage}" /></a>{/IF}{LOOP PAGES}{IF PAGES->pageno CURRENTPAGE}<strong class="current-page">{PAGES->pageno}</strong>{ELSE}<a href="{PAGES->url}">{PAGES->pageno}</a>{/IF}{/LOOP PAGES}{IF URL->NEXTPAGE}<a href="{URL->NEXTPAGE}" title="{LANG->NextPage}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/control_next.png" width="16" height="16" border="0" alt="{LANG->NextPage}" /></a>{/IF}{IF URL->LASTPAGE}<a href="{URL->LASTPAGE}" title="{LANG->LastPage}"><img src="{URL->BASE_URL}/templates/{TEMPLATE}/images/control_last.png" width="16" height="16" border="0" alt="{LANG->LastPage}" /></a>{/IF}
</div>
{/IF}
4 changes: 4 additions & 0 deletions templates/default2/settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
{! --- This is used to load the message-bodies in the message-list for that template if set to 1 --- }
{define bodies_in_list 0}

{! --- This is used the number of page numbers shown on the list page in the paging section (eg. 1 2 3 4 5) --- }
{define list_pages_shown 5}


{! --- This is the marker for messages in the thread list --- }
{var marker <img src="templates/default/images/carat.gif" border="0" width="8" height="8" alt="" />}

Expand Down
Loading

0 comments on commit 1427e2f

Please sign in to comment.