Changeset 4555

Show
Ignore:
Timestamp:
10/08/07 23:25:21 (2 years ago)
Author:
inureyes
Message:

#704

  • 블로그에 태그를 입력하는 UI 를 환경설정의 블로그 란에 추가
  • 글이 하나 이상 출력될 때에는 환경설정에서 지정한 블로그 태그가 keyword로 출력된다.
  • 스킨에서 써먹을 수 있도록 블로그 태그를 지원할 지 말 지 고민해야 함.
Location:
trunk
Files:
2 added
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/blog/owner/setting/blog/index.php

    r4487 r4555  
    88require ROOT . '/lib/piece/owner/contentMenu.php'; 
    99?> 
     10                        <script type="text/javascript" src="<?php echo $service['path'];?>/script/generaltag.js"></script> 
    1011                        <script type="text/javascript"> 
    1112                            //<![CDATA[ 
     
    3738                                    } 
    3839                                } 
     40                                 
     41                                function setBlogTag() { 
     42                                    var oForm = document.forms[2]; 
     43                                    var tagValue = ""; 
     44                                    try { 
     45                                        tagValue = oTag.getValues().join(","); 
     46                                    } catch (e) { 
     47                                        tagValue = oForm.blog-tag.value; 
     48                                    } 
     49                                     
     50                                    var request = new HTTPRequest("POST", "<?php echo $blogURL;?>/owner/setting/blog/tag/"); 
     51                                    request.onSuccess = function() { 
     52                                        PM.showMessage("<?php echo _t('저장되었습니다.');?>", "center", "bottom"); 
     53                                    } 
     54                                    request.onError = function() { 
     55                                        alert("<?php echo _t('대표 태그를 변경하지 못했습니다.');?>"); 
     56                                    } 
     57                                    request.send("tags=" + encodeURIComponent(tagValue)); 
     58                                } 
     59 
    3960<?php 
    4061if ($service['type'] != 'single') { 
     
    400421} 
    401422?> 
     423                                <form id="tag-form" class="section" method="post" action="<?php echo $blogURL;?>/owner/setting/blog/tag"> 
     424                                    <fieldset class="container"> 
     425                                        <legend><?php echo _t('블로그 태그');?></legend> 
     426                                         
     427                                        <dl id="blog-tag-line" class="line"> 
     428                                            <dt><label for="title"><?php echo _t('대표 태그');?></label></dt> 
     429                                            <dd id="blog-tag"></dd> 
     430                                        </dl> 
     431                                    </fieldset> 
     432                                    <script type="text/javascript"> 
     433                                        //<![CDATA[ 
     434                                            try { 
     435                                                var oTag = new Tag(document.getElementById("blog-tag"), "<?php echo $blog['language'];?>", <?php echo isset($service['disableEolinSuggestion']) && $service['disableEolinSuggestion'] ? 'true' : 'false';?>); 
     436                                                oTag.setInputClassName("input-tag"); 
     437<?php 
     438        $tags = array(); 
     439        $blogTags = getBlogTags($blogid); 
     440        if(!empty($blogTags)) { 
     441            $blogTags = explode(',',$blogTags); 
     442            foreach ($blogTags as $tag) { 
     443                array_push($tags, $tag); 
     444                echo 'oTag.setValue("' . addslashes($tag) . '");'; 
     445            } 
     446        } 
     447?> 
     448                                            } catch(e) { 
     449                                                document.getElementById("tag").innerHTML = '<input type="text" class="input-text" name="blog-tag" value="<?php echo addslashes(str_replace('"', '&quot;', implode(', ', $tags)));?>" /><br /><?php echo _t('태그 입력 스크립트를 사용할 수 없습니다. 콤마(,)로 구분된 태그를 직접 입력해 주십시오.(예: 텍스트큐브, BLOG, 테스트)');?>'; 
     450                                            } 
     451                                        //]]> 
     452                                    </script>                                    
     453                                    <div class="button-box"> 
     454                                        <input type="submit" class="save-button input-button" value="<?php echo _t('저장하기');?>" onclick="setBlogTag(); return false;" /> 
     455                                    </div> 
     456                                </form> 
    402457                            </div> 
    403458                        </div> 
  • trunk/lib/model/blog.blogSetting.php

    r4472 r4555  
    2424    clearRSS(); 
    2525    return true; 
     26} 
     27 
     28function setBlogTags($blogid, $tags) { 
     29    if(isset($tags)) { 
     30        setBlogSetting('blogTags',$tags); 
     31        return true; 
     32    } 
     33    return false; 
     34} 
     35 
     36function getBlogTags($blogid) { 
     37    if($tags = getBlogSetting('blogTags')) { 
     38        return $tags; 
     39    } 
     40    return null; 
    2641} 
    2742 
  • trunk/lib/piece/blog/end.php

    r4551 r4555  
    2828dress('taglog_link', "$blogURL/tag", $view); 
    2929dress('guestbook_link', "$blogURL/guestbook", $view); 
     30 
     31if(isset($totalTags)) { 
     32    $totalTags = array_unique($totalTags); 
     33    $totalTagsView = implode(",",$totalTags); 
     34} else { 
     35    $totalTagsView = getBlogTags($blogid); 
     36} 
     37 
     38dress('meta_http_equiv_keywords', $totalTagsView, $view); 
    3039 
    3140$searchView = $skin->search; 
  • trunk/lib/piece/blog/entries.php

    r4553 r4555  
    132132    } 
    133133    if(count($entries) > 1) { 
    134         $totalTags = array(); 
     134        unset($totalTags); 
    135135    } 
    136     array_push($totalTags, $blog['title']); 
    137     $totalTags = array_unique($totalTags); 
    138136    if(isset($cache)) { 
    139137        $cache->contents = revertTempTags(removeAllTags($entriesView)); 
     
    146144    $isKeylog = false; 
    147145} else { 
    148     $totalTagsView = implode(",",$totalTags); 
    149     dress('meta_http_equiv_keywords', $totalTagsView, $view); 
    150146    if (isset($cache->contents)) { 
    151147        dressInsertBefore('article_rep', $entriesView, $view); 
  • trunk/style/admin/default/setting.css

    r4258 r4555  
    126126{ 
    127127    margin-left                      : 3px; 
     128} 
     129 
     130#blog-tag ul li 
     131{ 
     132    background-image                 : url("./image/comma.gif"); 
     133    background-position              : right 10px; 
     134    background-repeat                : no-repeat; 
     135    display                          : inline; 
     136    margin-right                     : 5px; 
     137    padding                          : 0 4px 0 0; 
     138    vertical-align                   : middle; 
    128139} 
    129140