RedJini Blog

뒤로 검색

Textcube 카테고리 목록 출력시 등록된 글의 공개/비공개/발행 여부를 출력하기

2014/01/06 23:47

interface/common/blog/list.php 파일 수정

 
foreach ($list['items'] as $item) {    
    //== ACEPRO ================================================================
    $visible = _t('visible etc');
    if (isset($item['visibility'])) {
        if($item['visibility']==0){
            $visible = _t('visible private'   );
        }else
        if($item['visibility']==1){
            $visible = _t('visible protected' );
        }else
        if($item['visibility']==2){
            $visible = _t('visible public'    );
        }else
        if($item['visibility']==3){
            $visible = _t('visible syndicated');
        }
    }
    //== ACEPRO ================================================================

    $author        = User::getName($item['userid']);
    $itemsView .= str_replace(
        array(
            '[##_list_rep_regdate_##]',
            '[##_list_rep_name_##]',
            '[##_list_rep_author_##]',
            '[##_list_rep_link_##]',
            '[##_list_rep_title_##]',
            '[##_list_rep_rp_cnt_##]',
            '[##_list_rep_visible_##]'
        ),
        array(
            fireEvent('ViewListDate', Timestamp::formatDate($item['published']), $item['published']),
            fireEvent('ViewListName', htmlspecialchars($author)),
            fireEvent('ViewListName', htmlspecialchars($author)),
            ((!empty($skinSetting['showListWithTotalEntries'])) ? "#entry_".$item['id'] :
            "$blogURL/" . ($blog['useSloganOnPost'] ? 'entry/' . URL::encode($item['slogan'],$service['useEncodedURL']) : $item['id'])).(isset($list['category']) ? '?category='.$list['category'] : ''),
            fireEvent('ViewListTitle', htmlspecialchars($item['title'])),
            ($item['comments'] > 0) ? "({$item['comments']})" : '',
            $visible
        ),
        $skin->listItem
    );
}

library/model/blog.entry.php 수정

SQL에 문에 e.visibility 항목 추가

function getEntryListWithPagingByCategory($blogid, $category, $page, $count) {
    global $database, $suri, $folderURL, $blog;
    if ($category === null)
        return array();
    if (!doesHaveOwnership() && getCategoryVisibility($blogid, $category) < 2 && $category != 0)
        return array();
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = $blogid AND parent = $category");
        array_push($categories, $category);
        if(!doesHaveOwnership()) 
            $categories = array_diff($categories, getCategoryVisibilityList($blogid, 'private'));
        $cond = 'AND e.category IN (' . implode(', ', $categories) . ')';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0';
    } else {
        $cond = 'AND e.category >= 0';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0'.getPrivateCategoryExclusionQuery($blogid);
    }
    $visibility .= (doesHaveOwnership() && !Acl::check('group.editors')) ? ' AND (e.userid = '.getUserId().' OR e.visibility > 0)' : '';

    $sql = "SELECT e.blogid,e.userid,e.id,e.title,e.comments,e.slogan,e.published,e.visibility
            FROM {$database['prefix']}Entries e 
            WHERE e.blogid = $blogid AND e.draft = 0 $visibility $cond 
            ORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, "$folderURL/".((!getBlogSetting('useSloganOnCategory',true) && isset($suri['id'])) ? $suri['id'] : $suri['value']));
}

interface/common/blog/entries.php 수정

            if (doesHaveOwnership() && ($entry['userid'] == getUserId() || Acl::check('group.editors')===true)) {
                $managementView = $skin->management;
                $useEncodedURL = false;
                if( isset($service['useEncodedURL'])) {
                    $useEncodedURL = $service['useEncodedURL'];
                }
                dress('s_ad_m_link', "$blogURL/owner/entry/edit/{$entry['id']}?returnURL=" . ($useEncodedURL ? $permalink : str_replace('%2F', '/', rawurlencode($permalink))), $managementView);
                dress('s_ad_m_onclick', "editEntry({$entry['id']},'".($useEncodedURL ? $permalink : str_replace('%2F', '/', rawurlencode($permalink)))."'); return false;", $managementView);
                dress('s_ad_s1_label', getEntryVisibilityName($entry['visibility']), $managementView);
                if ($entry['visibility'] < 2) {
                    dress('s_ad_s2_label', _text('공개로 변경합니다'), $managementView);
                    dress('s_ad_s2_onclick', "changeVisibility({$entry['id']}, 2); return false;", $managementView);
                } else {
                    dress('s_ad_s2_label', _text('비공개로 변경합니다'), $managementView);
                    dress('s_ad_s2_onclick', "changeVisibility({$entry['id']}, 0); return false;", $managementView);
                }
                dress('s_ad_t_onclick', "sendTrackback({$entry['id']}); return false;", $managementView);
                dress('s_ad_d_onclick', "deleteEntry({$entry['id']}); return false;", $managementView);
                
                //== ACEPRO ===============================================
                if($entry['visibility']==0){
                    dress('s_ad_m_visible', "visible private"    , $managementView);
                }else
                if($entry['visibility']==1){
                    dress('s_ad_m_visible', "visible protected"    , $managementView);
                }else
                if($entry['visibility']==2){
                    dress('s_ad_m_visible', "visible public"    , $managementView);
                }else
                if($entry['visibility']==3){
                    dress('s_ad_m_visible', "visible syndicated", $managementView);
                }
                //== ACEPRO ===============================================
                dress('ad_div', $managementView, $entryView);
            }
            $author = User::getName($entry['userid']);
            dress('article_rep_author', fireEvent('ViewPostAuthor', $author, $entry['id']), $entryView);
            dress('article_rep_author_link', $blogURL."/author/".rawurlencode($author), $entryView);
            dress('article_rep_id', $entry['id'], $entryView);
            dress('article_rep_link', $permalink, $entryView);
            dress('article_rep_rp_rssurl', $defaultURL.'/rss/comment/'.$entry['id'], $entryView);
            dress('article_rep_tb_rssurl', $defaultURL.'/rss/trackback/'.$entry['id'], $entryView);
            dress('article_rep_response_rssurl', $defaultURL.'/rss/response/'.$entry['id'], $entryView);
            dress('article_rep_rp_atomurl', $defaultURL.'/atom/comment/'.$entry['id'], $entryView);
            dress('article_rep_tb_atomurl', $defaultURL.'/atom/trackback/'.$entry['id'], $entryView);
            dress('article_rep_response_atomurl', $defaultURL.'/atom/response/'.$entry['id'], $entryView);
            dress('article_rep_category_body_id',getCategoryBodyIdById($blogid,$entry['category']) ? getCategoryBodyIdById($blogid,$entry['category']) : 'tt-body-category',$entryView);
            dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView);
            // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치.
            $contentContainer["article_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
            dress('article_rep_desc', setTempTag("article_{$entry['id']}"), $entryView);
            dress('article_rep_category', htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['categoryLabel'], $entry['id']), $entryView);
            dress('article_rep_category_link', "$blogURL/category/".(empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'],$service['useEncodedURL']) : $entry['category'])),$entryView);
            dress('article_rep_category_rssurl', "$defaultURL/rss/category/".(empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'],$service['useEncodedURL']) : $entry['category'])),$entryView);
            dress('article_rep_category_atomurl', "$defaultURL/atom/category/".(empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'],$service['useEncodedURL']) : $entry['category'])),$entryView);
            dress('article_rep_microformat_published', Timestamp::getISO8601($entry['published']), $entryView);
            dress('article_rep_microformat_updated', Timestamp::getISO8601($entry['modified']), $entryView);
            dress('article_rep_date', fireEvent('ViewPostDate', Timestamp::format5($entry['published']), $entry['published']), $entryView);
            dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView);
            dress('entry_archive_link', "$blogURL/archive/" . Timestamp::getDate($entry['published']), $entryView);
            //== ACEPRO ===============================================
            dress('article_rep_category_id', empty($entry['category']) ? "" : $entry['category'],$entryView);
            //== ACEPRO ===============================================

skin.html 파일 수정

<s_list> <!-- 글검색(Content) -->
    <div id="searchList">
        <h1>'[##_list_conform_##]'에 관한 글 [##_list_count_##]개</h1>
        <ul>
            <s_list_rep>
                <li>
                    <span class="date [##_list_rep_visible_##]">[##_list_rep_regdate_##]</span>
                    <a href="[##_list_rep_link_##]">[##_list_rep_title_##]</a>
                    <span class="cnt">[##_list_rep_rp_cnt_##]</span>
                </li>
            </s_list_rep>
        </ul>
    </div>
</s_list> 

style.css 파일 수정

아이콘 이미지 파일은 skin/admin/whitedream/image에 있는 아이콘 파일을 이용.

#searchList .date.visible{
    display: inline-block;
    width  : 65px;
    padding-left       : 22px;
    background-repeat  : no-repeat;
}
#searchList .date.public{
    background-image : url("/resources/image/icon/icon_public.gif");
}
#searchList .date.private{
    background-image : url("/resources/image/icon/icon_private.gif");
    background-position: left bottom;
}
#searchList .date.protected{
    background-image : url("/resources/image/icon/icon_protected.gif");
}
#searchList .date.syndicated{
    background-image : url("/resources/image/icon/icon_syndicated.gif");
}

적용결과

Tags

Textcube, 블로그, 텍스트큐브
이 페이지는 Textcube 1.9.3 : poco a poco 로 구동됩니다 데스크탑 화면