Changeset 5107

Show
Ignore:
Timestamp:
01/22/08 03:37:11 (10 months ago)
Author:
gofeel
Message:

#703

  • 단일 블로그 모드시 제어판 안내 메세지 추가
  • 테이블 basicHTML 테이블로 변경
  • 대표 블로그 설정 기능 추가
    • 대표 블로그의 Owner는 무조건 전체 관리자이어야 함
  • 사용자 ACL관리
  • 블로그 삭제시 대표 블로그는 삭제 불가
Location:
trunk
Files:
13 added
3 removed
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/interface/owner/control/action/blog/delete/index.php

    r5079 r5107  
    1313 
    1414$items = split(",",$_GET['item']); 
     15if (in_array(getServiceSetting("defaultBlogId",1),$items)) { 
     16    $result = _t('대표 블로그는 삭제할 수 없습니다.'); 
     17    respond::PrintResult(array('error' => -1 , 'result' =>$result)); 
     18} 
     19 
    1520foreach ($items as $item) { 
    1621    $result = removeBlog($item); 
    17     if ($result===true) { 
    18     } 
    19     else { 
     22    if ($result!==true) { 
    2023        respond::PrintResult(array('error' => -1 , 'result' =>$result)); 
    2124    } 
  • trunk/interface/owner/control/blog/index.php

    r4943 r5107  
    1919$page = $_GET['page']; 
    2020 
     21if ( $service['type'] == "single" ) { 
    2122?> 
    22 <script type="text/javascript"> // <![CDATA[ 
    23  
    24 var page = <?php echo $page;?>; 
    25 function ctlRefresh() { 
    26     ctlTableObj.refreshTable(); 
     23<div class="main-explain-box"> 
     24    <p class="explain"><?php echo _t('현재 단일 블로그 모드 텍스트 큐브가 설정되어 있습니다. 단일 블로그 모드에서는 대표 블로그 만이 외부에 보여집니다.')?></p> 
     25</div>   
     26<?php 
    2727} 
    28  
    29 function deleteBlog(bid) { 
    30     if (!confirm(_t('되돌릴 수 없습니다.\t\n\n계속 진행하시겠습니까?'))) return false; 
    31     var request = new HTTPRequest(blogURL + "/owner/control/action/blog/delete/"+bid); 
    32     request.onSuccess = function() { 
    33         PM.showMessage(_t('선택된 블로그가 삭제되었습니다.'), "center", "top"); 
    34         ctlTableObj.refreshTable(); 
    35     //  showBlogList(page); 
    36     } 
    37     request.onError = function() { 
    38         alert(_t('블로그 삭제에 실패하였습니다.')); 
    39     } 
    40     request.send(); 
    41 } 
    42 // ]]> </script> 
     28?> 
    4329<h2 class="caption"><span class="main-text"><?php echo _t('새 블로그 만들기'); ?></span></h2> 
    4430<div id=container-add-blog> 
    4531<form onsubmit="return false;"> 
    4632<span class="label"><?php echo _t('소유자'); ?> : </span> 
    47 <span id="sgtOwner"></span><?php echo _t('블로그 식별자'); ?> : <input type=text name='bi-identify' id='bi-identify'> 
     33<span id="sgtOwner"><input type="text" class="bi-owner-loginid" name="location" value="<?php echo getUserEmail(1);?>" /></span><?php echo _t('블로그 식별자'); ?> : <input type=text name='bi-identify' id='bi-identify'> 
    4834<input type=submit value="<?php echo _t("새 블로그 생성");?>" onclick="sendBlogAddInfo(ctlUserSuggestObj.getValue(),document.getElementById('bi-identify').value);return false;"> 
    4935</form> 
    5036</div> 
     37<h2 class="caption"><span class="main-text">Blog List</span></h2> 
     38<div id=container-blog-list class='part'> 
     39<table class="data-inbox" id="table-blog-list" cellpadding="0" cellspacing="0"> 
     40<thead><tr><th>블로그 ID</th><th>블로그 구분자</th><th>블로그 제목</th><th>블로그 소유자</th></tr></thead> 
     41<tbody> 
     42<?php 
     43$row = 25; 
    5144 
    52 <h2 class="caption"><span class="main-text">Blog List</span></h2> 
    53 <div id=container-blog-list class='part'></div> 
     45$bloglist = POD::queryColumn("SELECT blogid,name FROM `{$database['prefix']}BlogSettings` WHERE name = 'name' ORDER BY blogid ASC LIMIT " . ($page-1)*$row . " ,$row"); 
     46$blogcount = POD::queryCount("SELECT blogid FROM `{$database['prefix']}BlogSettings` WHERE name = 'name'"); 
     47 
     48$pages = (int)(($blogcount-0.5) / $row)+1; 
     49if ($pages<$page) { 
     50    printRespond(array('error' => -2,'result' => $pages)); 
     51} 
     52if($bloglist){ 
     53    $resultString .= $blogcount."*"; 
     54    $tempString = ""; 
     55    foreach($bloglist as $bid) { 
     56        $result = POD::queryAll("SELECT * FROM `{$database['prefix']}BlogSettings` WHERE blogid = {$bid}"); 
     57        foreach($result as $row) { 
     58            $bsetting[$row['name']] = $row['value']; 
     59        } 
     60        $bsetting['owner']= POD::queryCell("SELECT userid FROM `{$database['prefix']}teamblog` WHERE acl & ".BITWISE_OWNER." != 0 AND blogid = " . $bid); 
     61        ?> 
     62 
     63<tr id="table-blog-list_<?php echo $bid?>"> 
     64    <td> 
     65        <?php echo $bid?> 
     66    </td> 
     67    <td> 
     68        <a href="<?php echo $blogURL?>/owner/control/blog/detail/<?php echo $bid?>"><?php echo $bsetting['name']?></a> 
     69    </td> 
     70    <td> 
     71        <?php echo $bsetting['title']?> 
     72    </td> 
     73    <td> 
     74        <?php echo User::getName($bsetting['owner'])."(".User::getEmail($bsetting['owner']).")";?> 
     75    </td> 
     76</tr> 
     77<?php 
     78    } 
     79} 
     80?> 
     81</tbody> 
     82</table> 
     83</div> 
     84<?php 
     85$paging = array('url' => "", 'prefix' => '?page=', 'postfix' => '', 'total' => 0, 'pages' => 0, 'page' => 0); 
     86$paging['pages'] = $pages; 
     87$paging['page'] = $page ; 
     88$pagingTemplate = '[##_paging_rep_##]'; 
     89$pagingItemTemplate = '<a [##_paging_rep_link_##]>[[##_paging_rep_link_num_##]]</a>'; 
     90?> 
     91<div id="page-navigation"> 
     92    <span id="page-list"><?php echo getPagingView($paging, $pagingTemplate, $pagingItemTemplate);?></span> 
     93    <span id="total-count"><?php echo _f('총 %1개의 블로그',$blogcount);?></span> 
     94</div> 
    5495<?php  
    5596require ROOT . '/lib/piece/owner/footer.php'; 
     
    5899//<![CDATA[ 
    59100    try { 
     101        document.getElementById("sgtOwner").innerHTML = ''; 
    60102        var ctlUserSuggestObj = new ctlUserSuggest(document.getElementById("sgtOwner"),  false); 
    61103        ctlUserSuggestObj.setInputClassName("bi-owner-loginid"); 
     
    64106        document.getElementById("sgtOwner").innerHTML = '<input type="text" class="bi-owner-loginid" name="location" value="" />'; 
    65107    } 
    66     var ctlTableObj = new ctlBlog('container-blog-list'); 
    67     ctlTableObj.setPage(page); 
    68     ctlTableObj.showTable(); 
    69108//]]> 
    70109</script>  
  • trunk/lib/model/blog.blogSetting.php

    r5065 r5107  
    493493function removeBlog($blogid) { 
    494494    global $database; 
     495    if (getServiceSetting("defaultBlogId",1) == $blogid) { 
     496        return false; 
     497    } 
    495498    $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = $blogid"); 
    496499    $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM {$database['prefix']}FeedGroupRelations WHERE blogid = $blogid"); 
     
    574577    return true; 
    575578} 
     579 
     580function setDefaultBlog( $blogid ) { 
     581    if(User::getBlogOwner($blogid) != 1) { 
     582        return false; 
     583    } 
     584    $result = setServiceSetting("defaultBlogId", $_GET['blogid']); 
     585    return $result; 
     586} 
    576587?> 
  • trunk/script/control.js

    r4808 r5107  
    353353    request.onSuccess = function() { 
    354354        PM.showMessage(_t('새로운 사용자가 추가되었습니다.'), "center", "top"); 
    355         ctlRefresh(); 
    356355    } 
    357356    request.onError = function() { 
     
    374373    request.send(); 
    375374} 
    376  
    377 //From prototype.js 
    378 function ctlExtend(destination,source) { 
    379  
    380     for(var property in source.prototype) { 
    381         destination.prototype[property] = source.prototype[property]; 
    382     } 
    383     return destination; 
    384 } 
    385  
    386 function ctlTable(containername) 
    387 { 
    388     this.init(); 
    389      
    390     this.name = "Textcube Control Panel Blog Table Object"; 
    391     this.copyright = "Tatter Network Foundation"; 
    392      
    393     this.container = document.getElementById(containername);     
    394 } 
    395  
    396 ctlTable.prototype.init = function() { 
    397     this.instance = this; 
    398     this.enablecheckbox = true; 
    399     this.enableaction = true; 
    400     this.enableinfo = true; 
    401  
    402     this.table = document.createElement("TABLE");        
    403     this.rows = 20; 
    404      
    405     this.url=""; 
    406     this.colitem = new Array(); 
    407     this.collink = new Array();  
    408      
    409 } 
    410  
    411 ctlTable.prototype.setsource = function(url,page,rows) { 
    412     this.url = url; 
    413 } 
    414  
    415 ctlTable.prototype.setColumns = function(columns) { 
    416     this.columns = columns.length; 
    417     this.colitem = columns; 
    418 } 
    419  
    420 ctlTable.prototype.refreshTable = function() 
    421 { 
    422     this.showTable(); 
    423 } 
    424 ctlTable.prototype.showTable = function() 
    425 { 
    426     this.requesturl = blogURL + this.url + "?page="+this.page+"&rows="+this.rows; 
    427     var request = new HTTPRequest(this.requesturl); 
    428     request.instance=this.instance; 
    429     request.onSuccess = function () { 
    430         var Line_id,resultResponse,resultRow; 
    431         var instance=this.instance; 
    432          
    433         resultResponse = this.getText("/response/result"); 
    434         resultRow = instance.resultRow = resultResponse.split('*'); 
    435         instance.container.innerHTML=''; 
    436         instance.table.innerHTML = ''; 
    437          
    438         if (resultRow.length == 1) 
    439             instance.table = ''; 
    440         else { 
    441             if(instance.enableinfo) { 
    442                 tempInfo = instance.printInfo(); 
    443             } 
    444             var containerThead, containerTr, tempTh, tempCheckBox,containerTbody; 
    445  
    446             containerThead = document.createElement("THEAD"); 
    447             containerTr = document.createElement("TR"); 
    448  
    449             if(instance.enablecheckbox) { 
    450                 tempTh = document.createElement("TH"); 
    451                 tempCheckBox = document.createElement("input"); 
    452                 tempCheckBox.type = "checkbox"; 
    453                 tempCheckBox.onclick = function() { instance.selectCheckBoxAll(this.checked); }; 
    454                 tempTh.appendChild(tempCheckBox); 
    455                 containerTr.appendChild(tempTh); 
    456             } 
    457             for(var i=0;i<instance.columns;i++) { 
    458                 tempTh = document.createElement("TH"); 
    459                 tempTh.innerHTML = instance.colitem[i]; 
    460                 containerTr.appendChild(tempTh); 
    461             } 
    462             tempTh = document.createElement("TH"); 
    463             tempTh.innerHTML = _t('Actions'); 
    464             containerTr.appendChild(tempTh); 
    465              
    466             containerThead.appendChild(containerTr); 
    467             instance.table.appendChild(containerThead); 
    468  
    469             containerTbody = document.createElement("TBODY"); 
    470  
    471             for (var i=0; i<instance.rows && resultRow.length > 0; i++) { 
    472                 tempRow = resultRow.shift(); 
    473                 field = tempRow.split(','); 
    474                 containerTr = document.createElement("TR"); 
    475  
    476                 var Line_id = field[0]; 
    477                 containerTr.id = instance.table.id + "_" + Line_id; 
    478                 Td_id = document.createElement("td"); 
    479  
    480                 if(instance.enablecheckbox) { 
    481                     tempCheckBox = document.createElement("input"); 
    482                     Td_checkbox = document.createElement("td"); 
    483                     tempCheckBox.id = containerTr.id+"_check"; 
    484                     tempCheckBox.type = "checkbox"; 
    485                     Td_checkbox.appendChild(tempCheckBox); 
    486                     containerTr.appendChild(Td_checkbox); 
    487                 } 
    488                 for (var j=0;j<4;j++) { 
    489                     Td_id = document.createElement("TD"); 
    490                     if (instance.collink[j]!='') { 
    491                         var tempLink = document.createElement("A"); 
    492                         tempLink.innerHTML = field[j]; 
    493                         tempLink.setAttribute("href",instance.collink[j] + Line_id); 
    494                         Td_id.appendChild(tempLink); 
    495                     } 
    496                     else { 
    497                         Td_id.innerHTML = field[j]; 
    498                     } 
    499                     containerTr.appendChild(Td_id); 
    500                 } 
    501  
    502                 if(instance.enableaction) { 
    503                     Td_action = document.createElement("TD"); 
    504                     instance.printAction(Td_action); 
    505                     containerTr.appendChild(Td_action); 
    506                 } 
    507  
    508                 containerTbody.appendChild(containerTr); 
    509                 } 
    510             this.instance.table.appendChild(containerTbody); 
    511         } 
    512         if (this.instance.table != '' ) { 
    513             this.instance.container.appendChild(this.instance.table); 
    514             if(instance.enablecheckbox) { 
    515                 tempTable = instance.printActionChecked(); 
    516                 this.instance.container.appendChild(tempTable); 
    517             } 
    518             if(instance.enableinfo) { 
    519                 this.instance.container.appendChild(tempInfo); 
    520             }    
    521         } 
    522         return true; 
    523     } 
    524     request.onError = function() { 
    525         error = this.getText("/response/error"); 
    526         if (error == -2 ) { 
    527             window.location = "?page="+ this.getText("/response/result"); 
    528         } 
    529     } 
    530     request.send(); 
    531 } 
    532  
    533 ctlTable.prototype.getChecked = function() { 
    534     var tbody = this.table.childNodes[1]; 
    535     var returnText = new Array(); 
    536     for(var i=0; i<tbody.childNodes.length; i++) { 
    537         var checkbox =  document.getElementById(tbody.childNodes[i].id+"_check"); 
    538         if (checkbox.checked) 
    539         { 
    540             returnText.push(tbody.childNodes[i].id.substr(this.table.id.length+1)); 
    541         } 
    542     } 
    543     return returnText.join(","); 
    544 } 
    545  
    546 ctlTable.prototype.selectCheckBoxAll = function(checked) { 
    547     var tbody = this.table.childNodes[1]; 
    548     for(var i=0; i<tbody.childNodes.length; i++) { 
    549         var checkbox =  document.getElementById(tbody.childNodes[i].id+"_check"); 
    550         checkbox.checked = checked; 
    551     } 
    552 }  
    553  
    554 ctlTable.prototype.reverseCheckBoxAll = function(checked) { 
    555     var tbody = this.table.childNodes[1]; 
    556     for(var i=0; i<tbody.childNodes.length; i++) { 
    557         var checkbox =  document.getElementById(tbody.childNodes[i].id+"_check"); 
    558         //checkbox.checked = checked; 
    559         checkbox.checked = !checkbox.checked; 
    560     } 
    561 } 
    562  
    563  
    564 //ctlBlog.. 
    565  
    566 ctlBlog = ctlExtend(ctlBlog, ctlTable); 
    567  
    568 function ctlBlog(containername) { 
    569     this.name = "Textcube Control Panel Blog Table Object"; 
    570     this.copyright = "Tatter Network Foundation"; 
    571  
    572     this.init(); 
    573  
    574     this.container = document.getElementById(containername); 
    575  
    576     this.table.id = "table-blog-list"; 
    577     this.table.className = "data-inbox"; 
    578     this.table.setAttribute("cellpadding", 0); 
    579     this.table.setAttribute("cellspacing", 0);               
    580      
    581     this.colitem.push(_t('블로그 ID')); 
    582     this.collink.push(''); 
    583     this.colitem.push(_t('블로그 구분자')); 
    584     this.collink.push(blogURL + "/owner/control/blog/"); 
    585     this.colitem.push(_t('블로그 제목')); 
    586     this.collink.push(''); 
    587     this.colitem.push(_t('블로그 소유자')); 
    588     this.collink.push(''); 
    589          
    590     this.url="/owner/control/action/blog/index/"; 
    591     this.rows = (typeof(rows) == "undefined") ? 20 : rows; 
    592     this.columns = this.colitem.length; 
    593 } 
    594  
    595 ctlBlog.prototype.setPage = function(page) { 
    596     this.page = page; 
    597     this.requesturl = blogURL + this.url + "?page="+this.page+"&rows="+this.rows; 
    598 } 
    599  
    600 ctlBlog.prototype.printInfo = function() { 
    601     var pagelist = this.resultRow.shift(); 
    602     var tempInfo = document.createElement("div"); 
    603     tempInfo.id = "page-navigation"; 
    604     var tempSpan = document.createElement("span"); 
    605     tempSpan.id = "page-list"; 
    606     tempSpan.innerHTML = pagelist 
    607     tempInfo.appendChild(tempSpan); 
    608     var blogs = this.resultRow.shift(); 
    609     tempSpan = document.createElement("span"); 
    610     tempSpan.id = "total-count"; 
    611     tempSpan.innerHTML = "총 " + blogs + "개의 블로그"; 
    612     tempInfo.appendChild(tempSpan); 
    613     return tempInfo; 
    614 } 
    615  
    616 ctlBlog.prototype.printAction = function(Td) { 
    617     var tempInfo = document.createElement("div"); 
    618     var tempLink = document.createElement("A"); 
    619     tempLink.className = "remove-button button"; 
    620     tempLink.id = "rb_" + field[0]; 
    621     tempLink.setAttribute("href", "#void"); 
    622     tempLink.onclick = function() { deleteBlog(this.id.substr(3)); showTable(page);return false; }; 
    623     tempLink.setAttribute("title", _t('이 블로그를 삭제합니다.')); 
    624  
    625     var tempSpan = document.createElement("SPAN"); 
    626     tempSpan.className = "text"; 
    627     tempSpan.innerHTML = _t('삭제'); 
    628  
    629     tempLink.appendChild(tempSpan); 
    630     Td.appendChild(tempLink); 
    631 } 
    632  
    633 ctlBlog.prototype.printActionChecked = function() { 
    634     var instance = this.instance; 
    635     var tempInfo = document.createElement("div"); 
    636     var tempLink = document.createElement("A"); 
    637     tempLink.className = "remove-button button"; 
    638     tempLink.id = "rb_" + field[0]; 
    639     tempLink.setAttribute("href", "#void"); 
    640     tempLink.onclick = function() { instance.deleteBlogChecked();return false; }; 
    641     tempLink.setAttribute("title", _t('선택된 블로그를 삭제합니다.')); 
    642  
    643     var tempSpan = document.createElement("SPAN"); 
    644     tempSpan.className = "text"; 
    645     tempSpan.innerHTML = _t('선택된 블로그 삭제'); 
    646      
    647     tempLink.appendChild(tempSpan); 
    648     tempInfo.appendChild(tempLink); 
    649     return tempInfo; 
    650 } 
    651  
    652 ctlBlog.prototype.deleteBlogChecked = function() { 
    653     var tbody = this.table.childNodes[1]; 
    654     var itemString = this.getChecked(); 
    655  
    656     if (!confirm(_t('되돌릴 수 없습니다.\t\n\n계속 진행하시겠습니까?'))) return false; 
    657     var request = new HTTPRequest(blogURL + "/owner/control/action/blog/delete/?item=" +itemString); 
    658     request.instance=this.instance; 
    659     request.onSuccess = function() { 
    660         PM.showMessage(_t('선택된 블로그가 삭제되었습니다.'), "center", "top"); 
    661         this.instance.showTable(); 
    662     } 
    663     request.onError = function() { 
    664         PM.showMessage(_t('삭제 도중 오류가 발생하였습니다.'), "center", "top"); 
    665     } 
    666     request.send(); 
    667 } 
    668  
    669  
    670 //ctlUser 
    671 ctlUser = ctlExtend(ctlUser, ctlTable); 
    672  
    673 function ctlUser(containername) { 
    674     this.name = "Textcube Control Panel User Table Object"; 
    675     this.copyright = "Tatter Network Foundation"; 
    676  
    677     this.init(); 
    678  
    679     this.container = document.getElementById(containername); 
    680  
    681     this.table.id = "table-user-list"; 
    682     this.table.className = "data-inbox"; 
    683     this.table.setAttribute("cellpadding", 0); 
    684     this.table.setAttribute("cellspacing", 0);               
    685      
    686     this.colitem.push(_t('ID')); 
    687     this.collink.push(''); 
    688     this.colitem.push(_t('로그인 ID')); 
    689     this.collink.push(blogURL + "/owner/control/user/"); 
    690     this.colitem.push(_t('필명')); 
    691     this.collink.push(''); 
    692     this.colitem.push(_t('최종 접속일')); 
    693     this.collink.push(''); 
    694          
    695     this.url="/owner/control/action/user/index/"; 
    696     this.rows = (typeof(rows) == "undefined") ? 20 : rows; 
    697     this.columns = this.colitem.length; 
    698 } 
    699  
    700 ctlUser.prototype.setPage = function(page) { 
    701     this.page = page; 
    702     this.requesturl = blogURL + this.url + "?page="+this.page+"&rows="+this.rows; 
    703 } 
    704  
    705 ctlUser.prototype.printInfo = function() { 
    706     var pagelist = this.resultRow.shift(); 
    707     var tempInfo = document.createElement("div"); 
    708     tempInfo.id = "page-navigation"; 
    709     var tempSpan = document.createElement("span"); 
    710     tempSpan.id = "page-list"; 
    711     tempSpan.innerHTML = pagelist 
    712     tempInfo.appendChild(tempSpan); 
    713     var blogs = this.resultRow.shift(); 
    714     tempSpan = document.createElement("span"); 
    715     tempSpan.id = "total-count"; 
    716     tempSpan.innerHTML = "총 " + blogs + "명의 사용자"; 
    717     tempInfo.appendChild(tempSpan); 
    718     return tempInfo; 
    719 } 
    720  
    721 ctlUser.prototype.printAction = function(Td) { 
    722     var tempInfo = document.createElement("div"); 
    723     var tempLink = document.createElement("A"); 
    724     tempLink.className = "remove-button button"; 
    725     tempLink.id = "rb_" + field[0]; 
    726     tempLink.setAttribute("href", "#void"); 
    727     tempLink.onclick = function() { return false; }; //TODO:미구현 
    728     tempLink.setAttribute("title", _t('이 사용자를 삭제합니다.')); 
    729  
    730     var tempSpan = document.createElement("SPAN"); 
    731     tempSpan.className = "text"; 
    732     tempSpan.innerHTML = _t('삭제'); 
    733  
    734     tempLink.appendChild(tempSpan); 
    735     Td.appendChild(tempLink); 
    736 } 
    737  
    738 ctlUser.prototype.printActionChecked = function() { 
    739     var instance = this.instance; 
    740     var tempInfo = document.createElement("div"); 
    741     var tempLink = document.createElement("A"); 
    742     tempLink.className = "remove-button button"; 
    743     tempLink.id = "rb_" + field[0]; 
    744     tempLink.setAttribute("href", "#void"); 
    745     tempLink.onclick = function() { return false; }; //TODO:미구현 
    746     tempLink.setAttribute("title", _t('선택된 사용자를 삭제합니다.')); 
    747  
    748     var tempSpan = document.createElement("SPAN"); 
    749     tempSpan.className = "text"; 
    750     tempSpan.innerHTML = _t('선택된 사용자 삭제'); 
    751      
    752     tempLink.appendChild(tempSpan); 
    753     tempInfo.appendChild(tempLink); 
    754     return tempInfo; 
    755 } 
    756  
     375function ctlRefresh() { 
     376    window.location.reload(); 
     377} 
     378