Skip to content

Commit

Permalink
refs #1443
Browse files Browse the repository at this point in the history
  * notice/page에 해당 부분을 명기하는 define문 추가 (현재 쓰지 않음)
  * page 출력시 카운트 지원
  * TODO
   * page list 사이드바 모듈 추가 (기본 모듈)
  • Loading branch information
inureyes committed Dec 30, 2010
1 parent b388181 commit c4bc890
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions interface/blog/notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';

define('__TEXTCUBE_NOTICE__',true);
if (isset($suri['id']) || (isset($suri['value']) && strlen($suri['value']) > 0)) {
if (!isset($suri['id']) || (Setting::getBlogSettingGlobal('useSloganOnPost',1) == 1)) {
list($entries, $paging) = getEntryWithPagingBySlogan($blogid, $suri['value'], true);
Expand Down
1 change: 1 addition & 0 deletions interface/blog/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';

define('__TEXTCUBE_PAGE__',true);
if (isset($suri['id']) || (isset($suri['value']) && strlen($suri['value']) > 0)) {
if (!isset($suri['id']) || (Setting::getBlogSettingGlobal('useSloganOnPost',1) == 1)) {
list($entries, $paging) = getEntryWithPagingBySlogan($blogid, $suri['value'], true);
Expand Down
20 changes: 14 additions & 6 deletions library/model/blog.entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ function getEntriesTotalCount($blogid) {
}

function getNoticesTotalCount($blogid) {
return getSpecialEntriesTotalCount($blogid, -2);
}

function getPagesTotalCount($blogid) {
return getSpecialEntriesTotalCount($blogid, -3);
}

function getSpecialEntriesTotalCount($blogid, $categoryId) {
$pool = DBModel::getInstance();
$pool->reset('Entries');
if (doesHaveOwnership()) $pool->setQualifier('visibility','b',0);
Expand All @@ -34,7 +42,7 @@ function getNoticesTotalCount($blogid) {
}
$pool->setQualifier('blogid','eq',$blogid);
$pool->setQualifier('draft','eq',0);
$pool->setQualifier('category','eq',-2);
$pool->setQualifier('category','eq',$categoryId);
return $pool->getCount('*');
}

Expand Down Expand Up @@ -395,7 +403,7 @@ function getEntryWithPaging($blogid, $id, $isSpecialEntry = false, $categoryId =
$entries = array();
$paging = Paging::init($folderURL, '/');
$visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0';
$visibility .= ($isNotice || doesHaveOwnership()) ? '' : ' AND (c.visibility > 1 OR e.category = 0)';
$visibility .= ($isSpecialEntry || doesHaveOwnership()) ? '' : ' AND (c.visibility > 1 OR e.category = 0)';
$visibility .= (doesHaveOwnership() && !Acl::check('group.editors')) ? ' AND (e.userid = '.getUserId().' OR e.visibility > 0)' : '';
$category = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? 'e.category = -3' : 'e.category = -2' ) : 'e.category >= 0';
if($categoryId !== false) {
Expand Down Expand Up @@ -426,7 +434,7 @@ function getEntryWithPaging($blogid, $id, $isSpecialEntry = false, $categoryId =
$paging['pages'] = $categoryId == 0 ? getEntriesTotalCount($blogid):getEntriesCountByCategory($blogid, $categoryId);
$paging['postfix'] = '?category='.$categoryId;
} else {
$paging['pages'] = ($isNotice) ? getNoticesTotalCount($blogid) : getEntriesTotalCount($blogid);
$paging['pages'] = $isSpecialEntry ? ($isSpecialEntry == 'page' ? getPagesTotalCount($blogid) : getNoticesTotalCount($blogid)) : getEntriesTotalCount($blogid);
}

for ($i = 1; $entry = POD::fetch($result); $i++) {
Expand Down Expand Up @@ -462,9 +470,9 @@ function getEntryWithPagingBySlogan($blogid, $slogan, $isSpecialEntry = false, $
requireModel('blog.category');
$entries = array();
$ctx = Model_Context::getInstance();
$paging = $isNotice ? Paging::init($ctx->getProperty('uri.blog')."/notice", '/') : Paging::init($ctx->getProperty('uri.blog')."/entry", '/');
$paging = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? Paging::init($ctx->getProperty('uri.blog')."/page", '/'): Paging::init($ctx->getProperty('uri.blog')."/notice", '/')) : Paging::init($ctx->getProperty('uri.blog')."/entry", '/');
$visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0';
$visibility .= ($isNotice || doesHaveOwnership()) ? '' : getPrivateCategoryExclusionQuery($blogid);
$visibility .= ($isSpecialEntry || doesHaveOwnership()) ? '' : getPrivateCategoryExclusionQuery($blogid);
$visibility .= (doesHaveOwnership() && !Acl::check('group.editors')) ? ' AND (e.userid = '.getUserId().' OR e.visibility > 0)' : '';
$category = $isSpecialEntry ? ( $isSpecialEntry == 'page' ? 'e.category = -3' : 'e.category = -2' ) : 'e.category >= 0';
if($categoryId !== false) {
Expand Down Expand Up @@ -497,7 +505,7 @@ function getEntryWithPagingBySlogan($blogid, $slogan, $isSpecialEntry = false, $
$paging['pages'] = $categoryId == 0 ? getEntriesTotalCount($blogid):getEntriesCountByCategory($blogid, $categoryId);
$paging['postfix'] = '?category='.$categoryId;
} else {
$paging['pages'] = ($isNotice) ? getNoticesTotalCount($blogid) : getEntriesTotalCount($blogid);
$paging['pages'] = $isSpecialEntry ? ($isSpecialEntry == 'page' ? getPagesTotalCount($blogid) : getNoticesTotalCount($blogid)) : getEntriesTotalCount($blogid);
}

for ($i = 1; $entry = POD::fetch($result); $i++) {
Expand Down

0 comments on commit c4bc890

Please # to comment.