Changeset 5587

Show
Ignore:
Timestamp:
03/10/08 22:12:20 (6 months ago)
Author:
inureyes
Message:

#874

  • 보낸 트랙백 목록 지원
  • 글 - 트랙백 에서 트랙백 목록 탭이 등장합니다.
  • 용어 수정은 언어팩으로.
Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/interface/owner/entry/index.php

    r5579 r5587  
    119119$countResult = POD::queryExistence("SELECT `id`  
    120120        FROM `{$database['prefix']}Entries`  
    121         WHERE `blogid` = ".getBlogId()." AND `visibility` = 3"); 
     121        WHERE `blogid` = ".getBlogId()." AND `visibility` = 3 LIMIT 1"); 
    122122 
    123123require ROOT . '/lib/piece/owner/header.php'; 
  • trunk/interface/owner/entry/trackback/index.php

    r5285 r5587  
    1111if (isset($_GET['withSearch'])) $_POST['withSearch'] = $_GET['withSearch']; 
    1212if (isset($_GET['search'])) $_POST['search'] = $_GET['search']; 
     13if (isset($_GET['status'])) $_POST['status'] = $_GET['status']; 
    1314 
    1415$IV = array( 
     
    2425        'withSearch' => array(array('on'), 'mandatory' => false), 
    2526        'search' => array('string', 'default' => ''), 
    26         'perPage' => array('int', 1, 'mandatory' => false) 
     27        'perPage' => array('int', 1, 'mandatory' => false), 
     28        'status' => array('string', 'mandatory' => false) 
    2729    ) 
    2830);   
     
    4143    setBlogSetting('rowsPerPage', $_POST['perPage']); 
    4244} 
    43 list($trackbacks, $paging) = getTrackbacksWithPagingForOwner($blogid, $categoryId, $site, $ip, $search, $suri['page'], $perPage); 
     45 
     46$tabsClass = array(); 
     47if (isset($_POST['status'])) { 
     48    if($_POST['status']=='received') { 
     49        $tabsClass['received'] = true; 
     50        $visibilityText = _t('걸린 글'); 
     51    } else if($_POST['status']=='sent') { 
     52        $tabsClass['sent'] = true; 
     53        $visibilityText = _t('건 글'); 
     54    } 
     55} else { 
     56    $tabsClass['received'] = true; 
     57    $visibilityText = _t('걸린 글'); 
     58} 
     59if($tabsClass['received'] == true) { 
     60    list($trackbacks, $paging) = getTrackbacksWithPagingForOwner($blogid, $categoryId, $site, $ip, $search, $suri['page'], $perPage); 
     61} else { 
     62    list($trackbacks, $paging) = getTrackbackLogsWithPagingForOwner($blogid, $categoryId, $site, $ip, $search, $suri['page'], $perPage); 
     63} 
     64 
    4465require ROOT . '/lib/piece/owner/header.php'; 
    4566require ROOT . '/lib/piece/owner/contentMenu.php'; 
     67 
    4668?> 
    4769                        <script type="text/javascript"> 
    4870                            //<![CDATA[ 
    49                                 function changeState(caller, value, mode) { 
     71<?php 
     72if($tabsClass['received'] == true) { 
     73?> 
     74                            function changeState(caller, value, mode) { 
    5075                                    try {            
    5176                                        if (caller.className == 'block-icon bullet') { 
     
    120145                                    } 
    121146                                } 
     147<?php 
     148} else { 
     149?> 
     150                                function removeTrackbackLog(id) { 
     151                                    if (confirm("선택된 글걸기 기록을 지웁니다. 계속 하시겠습니까?")) { 
     152                                        var request = new HTTPRequest("<?php echo $blogURL;?>/owner/entry/trackback/log/remove/" + id); 
     153                                        request.onSuccess = function () { 
     154                                            document.getElementById('list-form').submit(); 
     155                                        } 
     156                                        request.onError = function () { 
     157                                            alert("글걸기 기록을 지우지 못했습니다."); 
     158                                        } 
     159                                        request.send(); 
     160                                    } 
     161                                } 
     162                                 
     163                                function trashTrackbacks() { 
     164                                    try { 
     165                                        if (!confirm("<?php echo _t('선택된 걸린글 기록을 지웁니다. 계속 하시겠습니까?');?>")) 
     166                                            return false; 
     167                                        var oElement; 
     168                                            var targets = new Array(); 
     169                                        for (i = 0; document.getElementById('list-form').elements[i]; i ++) { 
     170                                            oElement = document.getElementById('list-form').elements[i]; 
     171                                            if ((oElement.name == "entry") && oElement.checked) 
     172                                                targets[targets.length] = oElement.value; 
     173                                        } 
     174                                        var request = new HTTPRequest("POST", "<?php echo $blogURL;?>/owner/entry/trackback/log/remove/"); 
     175                                        request.onSuccess = function() { 
     176                                            document.getElementById('list-form').submit(); 
     177                                        } 
     178                                        alert(targets.join(",")); 
     179                                        request.send("targets=" + targets.join(",")); 
     180                                    } catch(e) { 
     181                                        alert(e.message); 
     182                                    } 
     183                                } 
     184<?php 
     185} 
     186?> 
    122187                                 
    123188                                function checkAll(checked) { 
     
    169234?> 
    170235                            </h2> 
    171                              
     236                            <ul id="entry-tabs-box" class="tabs-box"> 
     237                                <!-- TODO : $tab['postfix'] 버그 --> 
     238                                <li<?php echo isset($tabsClass['received']) ? ' class="selected"' : NULL;?>><a href="<?php echo $blogURL;?>/owner/entry/trackback?page=1<?php echo $tab['postfix'];?>&amp;status=received"><?php echo _t('걸린 글');?></a></li> 
     239                                <li<?php echo isset($tabsClass['sent']) ? ' class="selected"' : NULL;?>><a href="<?php echo $blogURL;?>/owner/entry/trackback?page=1<?php echo $tab['postfix'];?>&amp;status=sent"><?php echo _t('건 글');?></a></li> 
     240                            </ul> 
     241 
    172242                            <form id="category-form" class="category-box" method="post" action="<?php echo $blogURL;?>/owner/entry/trackback"> 
    173243                                <div class="section"> 
    174244                                    <input type="hidden" name="page" value="<?php echo $suri['page'];?>" /> 
    175                                      
     245<?php 
     246    if(!isset($tabsClass['received'])) { 
     247?> 
     248                                    <input type="hidden" name="status" value="sent" /> 
     249<?php } ?> 
    176250                                    <select id="category" name="category" onchange="document.getElementById('category-form').page.value=1; document.getElementById('category-form').submit()"> 
    177251                                        <option value="0"><?php echo _t('전체');?></option> 
     
    192266                                </div> 
    193267                            </form> 
    194                              
     268 
    195269                            <form id="list-form" method="post" action="<?php echo $blogURL;?>/owner/entry/trackback"> 
     270<?php 
     271    if(!isset($tabsClass['received'])) { 
     272?> 
     273                                <input type="hidden" name="status" value="sent" /> 
     274<?php } ?> 
    196275                                <table class="data-inbox" cellspacing="0" cellpadding="0"> 
    197276                                    <thead> 
     
    199278                                            <th class="selection"><input type="checkbox" id="allChecked" class="checkbox" onclick="checkAll(this.checked);" disabled="disabled" /></th> 
    200279                                            <th class="date"><span class="text"><?php echo _t('등록일자');?></span></th> 
    201                                             <th class="site"><span class="text"><?php echo _t('사이트명');?></span></th> 
     280                                            <th class="site"><span class="text"><?php echo (isset($tabsClass['received']) ? _t('사이트 이름') : _t('보낸 주소'));?></span></th> 
    202281                                            <th class="category"><span class="text"><?php echo _t('분류');?></span></th> 
    203                                             <th class="title"><span class="text"><?php echo _t('제목');?></span></th> 
     282                                            <th class="title"><span class="text"><?php echo (isset($tabsClass['received']) ? _t('받은 글 제목') : _t('보낸 글 제목'));?></span></th> 
     283<?php if(isset($tabsClass['received'])) { 
     284?> 
    204285                                            <th class="ip"><acronym title="Internet Protocol">ip</acronym></th> 
     286<?php } ?> 
    205287                                            <th class="delete"><span class="text"><?php echo _t('삭제');?></span></th> 
    206288                                        </tr> 
     
    211293for ($i=0; $i<sizeof($trackbacks); $i++) { 
    212294    $trackback = $trackbacks[$i]; 
    213      
    214295    requireComponent('Textcube.Data.Filter'); 
    215296    $isFilterURL = Filter::isFiltered('url', $trackback['url']); 
     
    238319                                            <td class="site"> 
    239320<?php 
    240     if ($isFilterURL) { 
     321    if(isset($tabsClass['received'])) { 
     322        if ($isFilterURL) { 
    241323?> 
    242324                                                <a id="urlFilter<?php echo $currentSite;?>-<?php echo $i;?>" class="block-icon bullet" href="<?php echo $blogURL;?>/owner/setting/filter/change/?value=<?php echo urlencode($filteredURL);?>&amp;mode=url&amp;command=unblock" onclick="changeState(this,'<?php echo $filteredURL;?>','url'); return false;" title="<?php echo _t('이 사이트는 차단되었습니다. 클릭하시면 차단을 해제합니다.');?>"><span class="text"><?php echo _t('[차단됨]');?></span></a> 
    243325<?php 
    244     } else { 
     326        } else { 
    245327?> 
    246328                                                <a id="urlFilter<?php echo $currentSite;?>-<?php echo $i;?>" class="unblock-icon bullet" href="<?php echo $blogURL;?>/owner/setting/filter/change/?value=<?php echo urlencode($filteredURL);?>&amp;mode=url&amp;command=block" onclick="changeState(this,'<?php echo $filteredURL;?>','url'); return false;" title="<?php echo _t('이 사이트는 차단되지 않았습니다. 클릭하시면 차단합니다.');?>"><span class="text"><?php echo _t('[허용됨]');?></span></a> 
    247329<?php 
    248     } 
     330        } 
    249331?> 
    250332                                                <a href="?site=<?php echo urlencode(escapeJSInAttribute($trackback['site']));?>" title="<?php echo _t('이 사이트에서 건 글 목록을 보여줍니다.');?>"><?php echo htmlspecialchars($trackback['site']);?></a> 
     333<?php 
     334    } else { 
     335?> 
     336                                                <a href="<?php echo htmlspecialchars($trackback['url']);?>"><?php echo link_cut(htmlspecialchars($trackback['url']),30);?></a> 
     337<?php 
     338    } 
     339?> 
    251340                                            </td> 
    252341                                            <td class="category"> 
     
    266355                                                <a href="<?php echo $trackback['url'];?>" onclick="window.open(this.href); return false;" title="<?php echo _t('글을 건 글을 보여줍니다.');?>"><?php echo htmlspecialchars($trackback['subject']);?></a> 
    267356                                            </td> 
     357<?php 
     358    if(isset($tabsClass['received'])) { 
     359?> 
    268360                                            <td class="ip"> 
    269361<?php 
    270     if ($isIpFiltered) { 
     362        if ($isIpFiltered) { 
    271363?> 
    272364                                                <a id="ipFilter<?php echo urlencode($trackback['ip']);?>-<?php echo $i;?>" class="block-icon bullet" href="<?php echo $blogURL;?>/owner/setting/filter/change/?value=<?php echo urlencode($trackback['ip']);?>&amp;mode=ip&amp;command=unblock" onclick="changeState(this,'<?php echo urlencode($trackback['ip']);?>', 'ip'); return false;" title="<?php echo _t('이 IP는 차단되었습니다. 클릭하시면 차단을 해제합니다.');?>"><span class="text"><?php echo _t('[차단됨]');?></span></a> 
    273365<?php 
    274     } else { 
     366        } else { 
    275367?> 
    276368                                                <a id="ipFilter<?php echo urlencode($trackback['ip']);?>-<?php echo $i;?>" class="unblock-icon bullet" href="<?php echo $blogURL;?>/owner/setting/filter/change/?value=<?php echo urlencode($trackback['ip']);?>&amp;mode=ip&amp;command=block" onclick="changeState(this,'<?php echo urlencode($trackback['ip']);?>', 'ip'); return false;" title="<?php echo _t('이 IP는 차단되지 않았습니다. 클릭하시면 차단합니다.');?>"><span class="text"><?php echo _t('[허용됨]');?></span></a> 
    277369<?php 
    278     } 
     370        } 
    279371?> 
    280372 
    281373                                                <a href="?ip=<?php echo urlencode(escapeJSInAttribute($trackback['ip']));?>" title="<?php echo _t('이 IP로 등록된 걸린글 목록을 보여줍니다.');?>"><?php echo $trackback['ip'];?></a> 
    282374                                            </td> 
     375<?php 
     376    } 
     377?> 
    283378                                            <td class="delete"> 
     379<?php 
     380    if(isset($tabsClass['received'])) { 
     381?> 
    284382                                                <a class="delete-button button" href="<?php echo $blogURL;?>/owner/entry/trackback/delete/<?php echo $trackback['id'];?>" onclick="trashTrackback(<?php echo $trackback['id'];?>); return false;" title="<?php echo _t('이 걸린글을 삭제합니다.');?>"><span class="text"><?php echo _t('삭제');?></span></a> 
     383<?php 
     384    } else { 
     385?> 
     386                                                <a class="delete-button button" href="<?php echo $blogURL;?>/owner/entry/trackback/log/remove/<?php echo $trackback['id'];?>" onclick="removeTrackbackLog(<?php echo $trackback['id'];?>); return false;" title="<?php echo _t('이 글걸기 기록을 삭제합니다.');?>"><span class="text"><?php echo _t('삭제');?></span></a> 
     387<?php 
     388    } 
     389?> 
    285390                                            </td> 
    286391                                        </tr> 
     
    350455                                    <input type="text" id="search" class="input-text" name="search" value="<?php echo htmlspecialchars($search);?>" onkeydown="if (event.keyCode == '13') { document.getElementById('search-form').withSearch.value = 'on'; document.getElementById('search-form').submit(); }" /> 
    351456                                    <input type="hidden" name="withSearch" value="" /> 
     457<?php 
     458if(!isset($tabsClass['received'])) { 
     459    ?> 
     460                                    <input type="hidden" name="status" value="sent" /> 
     461<?php } ?> 
    352462                                    <input type="submit" class="search-button input-button" value="<?php echo _t('검색');?>" onclick="document.getElementById('search-form').withSearch.value = 'on'; document.getElementById('search-form').submit();" /> 
    353463                                </div> 
  • trunk/interface/owner/entry/trackback/log/remove/index.php

    r5285 r5587  
    33/// All rights reserved. Licensed under the GPL. 
    44/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT) 
     5$IV = array( 
     6    'POST' => array( 
     7        'targets' => array('list', 'default' => '') 
     8    ) 
     9); 
     10 
    511require ROOT . '/lib/includeForBlogOwner.php'; 
    612requireModel("blog.trackback"); 
     
    814 
    915requireStrictRoute(); 
    10 if (deleteTrackbackLog($blogid, $suri['id']) !== false) 
     16if(isset($suri['id'])) { 
     17    if (deleteTrackbackLog($blogid, $suri['id']) !== false) 
     18        respond::ResultPage(0); 
     19    else 
     20        respond::ResultPage(-1); 
     21} else if(!empty($_POST['targets'])) { 
     22    foreach(explode(',', $_POST['targets']) as $target) 
     23        deleteTrackbackLog($blogid, $target); 
    1124    respond::ResultPage(0); 
    12 else 
    13     respond::ResultPage( - 1); 
     25} 
     26respond::ResultPage(-1); 
    1427?>  
  • trunk/lib/model/blog.trackback.php

    r5532 r5587  
    3131        $search = escapeSearchString($search); 
    3232        $sql .= " AND (t.site LIKE '%$search%' OR t.subject LIKE '%$search%' OR t.excerpt LIKE '%$search%')"; 
     33        $postfix .= '&search=' . rawurlencode($search); 
     34    } 
     35    $sql .= ' ORDER BY t.written DESC'; 
     36    list($trackbacks, $paging) = fetchWithPaging($sql, $page, $count); 
     37    if (strlen($postfix) > 0) { 
     38        $paging['postfix'] .= $postfix . '&withSearch=on'; 
     39    } 
     40    return array($trackbacks, $paging); 
     41} 
     42 
     43function getTrackbackLogsWithPagingForOwner($blogid, $category, $site, $ip, $search, $page, $count) { 
     44    global $database; 
     45     
     46    $postfix = ''; 
     47    $sql = "SELECT t.*, e.title as subject, c.name categoryName  
     48        FROM {$database['prefix']}TrackbackLogs t  
     49        LEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id AND e.draft = 0  
     50        LEFT JOIN {$database['prefix']}Categories c ON t.blogid = c.blogid AND e.category = c.id  
     51        WHERE t.blogid = $blogid"; 
     52    if ($category > 0) { 
     53        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = $blogid AND parent = $category"); 
     54        array_push($categories, $category); 
     55        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')'; 
     56        $postfix .= '&category=' . rawurlencode($category); 
     57    } else 
     58        $sql .= ' AND e.category >= 0'; 
     59    if (!empty($search)) { 
     60        $search = escapeSearchString($search); 
     61        $sql .= " AND (e.title LIKE '%$search%' OR e.content LIKE '%$search%')"; 
    3362        $postfix .= '&search=' . rawurlencode($search); 
    3463    } 
  • trunk/style/admin/whitedream/basic.css

    r5555 r5587  
    289289    background-repeat                : repeat-x; 
    290290    height                           : 36px; 
    291     font-weight                      : bold; 
    292291} 
    293292