웹마스터 팁
내가 작성 한 글에 대한 일괄 삭제/이동/복사 권한 주기
2009.05.15 14:11
XE 게시판에 작성된 글 목록을 관라자의 경우 일괄적으로 선택하여 이동/복사/삭제가 가능합니다.
하지만 일반 유저의 경우 게시물을 작성 후 다른 게시판으로 옮기려면 내용을 복사해서 다른 게시판에 다시 글을 쓰고 원래 있던 글을 삭제 해야 되던가 동일한 내용을 여러 게시판에 올릴때는 계속 복사 -> 붙여넣기 -> 확인 작업을 해야겠죠.
삭제 할때도 마찬가지로 게시글을 하나 하나 클릭하여 삭제...
이를 좀더 쉽게 할 수 있도록 게시판 리스트 페이지에서 자신이 작성한 글에 한해 "게시글관리" 기능을 사용할 수 있도록 해주는 겁니다.
우선 이 기능을 생각한 첫번째 이유는
팁 공유 게시판에 올라오는 질문 글들을 이런 기능이 있으면 "혹시라도" 쉽게 질문 게시판으로 옮기지 않을까? 라는 생각을 하다가 한번 해보자 라는 생각에 적용을 해봤습니다.
1. /xe/modules/board/skins/xe_board/style.list.html
- line 7, 9삭제
<!--@if($grant->manager)-->
<th scope="col" class="no_line"><input type="checkbox" /></th>
<!--@end-->
- line 85, 87삭제
<!--@if($grant->manager)-->
<td class="checkbox"><input type="checkbox" name="cart" value="{$document->document_srl}" <isCarted())-->checked="checked"checked="checked"checked="checked" ">!--@else-->
<!--@end-->
</td>
관리자 이거나 . 글 작성자의 아이디와 현재 로그인한 유저의 아이디가 동일한 게시물에 대해 체크박스를 보여줍니다.
2. /xe/modules/board/skins/xe_board/list.html
- line 28, 30 삭제
<!--@if($grant->manager)-->
<a href="./{getUrl(",'module','document'+
','act','dispDocumentManageDocument')}" class="button {$btn_class}"><span>{$lang->cmd_manage_document}</span></a>
<!--@end-->
역시 마찬가지로 관리자일 경우에 대한 체크 부분을 삭제하여 일반 유저도 관리 버튼이 표시 되도록 합니다.
이 경우 선택된 게시물이 없으면 해당 버튼을 클릭해도 별다른 기능을 하지 않으므로 관리에 대한 문제가 없다고 봅니다.
게시물이 선택된 경우 그 게시물에 대한 권한이 있는 것이고 그 부분을 작업 중인 것이니 그 또한 문제가 없는 거겠죠
3. /xe/modules/document/document.view.php
- line 71 수정
function dispDocumentManageDocument() {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
// 선택한 목록을 세션에서 가져옴
$flag_list = $_SESSION['document_management'];
if(count($flag_list)) {
foreach($flag_list as $key => $val) {
if(!is_bool($val)) continue;
$document_srl_list[] = $key;
}
}
if(count($document_srl_list)) {
$oDocumentModel = &getModel('document');
//$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
$document_list = $oDocumentModel->getDocuments($document_srl_list);
Context::set('document_list', $document_list);
}
$oModuleModel = &getModel('module');
// 모듈 카테고리 목록과 모듈 목록의 조합
if(count($module_list)>1) Context::set('module_list', $module_categories);
// 팝업 레이아웃 선택
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('checked_list');
}
어드민에게만 허용된 권한을 모두에게로 오픈 하였습니다. 주석 처리된 라인은 그냥 삭제 처리해도 됩니다.
4. /xe/modules/document/document.controller.php
- line 1526 ~ 1527
/**
* @brief 관리자가 글 선택시 세션에 담음
**/
function procDocumentAddCart() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
// 게시글 번호 구함
$srls = explode(',',Context::get('srls'));
for($i=0;$i<count($srls);$i++) {
$srl = trim($srls[$i]);
if(!$srl) continue;
$document_srls[] = $srl;
}
if(!count($document_srls)) return;
// 게시글들의 모듈 번호를 구함
$args->list_count = count($document_srls);
$args->document_srls = implode(',',$document_srls);
$args->order_type = 'asc';
$output = executeQueryArray('document.getDocuments', $args);
if(!$output->data) return new Object();
unset($document_srls);
foreach($output->data as $key => $val) {
$document_srls[$val->module_srl][] = $val->document_srl;
}
if(!$document_srls || !count($document_srls)) return new Object();
// 각 문서들의 모듈 관리자 여부 확인
$oModuleModel = &getModel('module');
$module_srls = array_keys($document_srls);
for($i=0;$i<count($module_srls);$i++) {
$module_srl = $module_srls[$i];
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) {
unset($document_srls[$module_srl]);
continue;
}
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) {
//unset($document_srls[$module_srl]);
//continue;
}
}
if(!count($document_srls)) return new Object();
foreach($document_srls as $module_srl => $documents) {
$cnt = count($documents);
for($i=0;$i<$cnt;$i++) {
$document_srl = (int)trim($documents[$i]);
if(!$document_srls) continue;
if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
else $_SESSION['document_management'][$document_srl] = true;
}
}
}
이 부분은 체크 박스에 체크 할때 세션으로 담는 부분에서 관리자가 아닌 경우 세션을 저장하지 않도록 된 부분을 주석 처리 한 것입니다.
사내 정보라 다른 게시물들은 필터링 처리 했습니다.
보시다 시피 테스트용으로만든 계정에서 입력한 게시물에만 체크 박스가 나오며 하단의 게시글 관리 버튼이 활성화 되어있습니다.
일반적인 게시판에서의 활용도는 어떨지 모르겠습니다만 위 기능을 이용하면 저희 같은 사내 업무에서는 많은 도움이 될 것 같네요.
덤으로 왼쪽에 보이는 내용은 몇일전 추가한 서버의 드라이브 정보 표시 기능!!
파일 업로드 시 경각심을 불러 일으키기 위해 1Gb 이하로 용량이 남으면 빨간색으로 표시!!!
이번주에 커스터 마이징 한것만 세개 ㅠ.ㅠ
버젼 업그레이드가 제일 무서워요 ~~ ㅠ.ㅠ
댓글 2
-
느까끼
2009.05.15 22:55
-
Gnee
2010.02.11 14:44
정말 좋은 아이디어를 서슴지 않고 팁공유해주셔서 너무 감사드립니다.^^
혹시 다음에 더 좋은 팁이 나올지도 몰라 기능개선을 위한 조언 몇자 적습니다.
1. 옮길 수 있는 게시판 제한하기 기능
2. 무분별한 도배 방지 및 도배시 게시글 이동권한 해제
제목 | 글쓴이 | 날짜 |
---|---|---|
관리자모드에서 메뉴 항상 펼치기 [1] | 아드레날린 | 2009.06.09 |
회원가입시 닉네임 특수문자 제한하기 [10] | 절망린 | 2009.06.06 |
BGM 가로스크롤바 없애는 방법.. | 청개굴이 | 2009.06.03 |
BGM 쓰시는분 게시판 에서 첨부파일 다운받을때 끊어지시죠?ㅎㅎ [4] | 우리아기 | 2009.05.23 |
[허접팁] 파일첨부가 안됩니다 [1] | 클럽다이 | 2009.05.23 |
에디터에 관리자멘트 넣기 [총정리] [17] | 된장맛껌 | 2009.05.23 |
별도 페이지 로그인방법 | cornet | 2009.05.21 |
스프링노트 연동문제 [2] | nonoboy | 2009.05.21 |
맞춤형 검색창 만들기 [9] | thejeon | 2009.05.19 |
게시판에서 헤더와 풋부분을 붙이면 이미지 출력이 되지 않아요.. [2] | 율이★ | 2009.05.19 |
까페 아이디 삭제후 동일 아이디로 생성하는 방법 | 키스메리 | 2009.05.15 |
내가 작성 한 글에 대한 일괄 삭제/이동/복사 권한 주기 [2] | 개돌 | 2009.05.15 |
XE에 맞춤법 검사기를 링크해보자! [2] | 개돌 | 2009.05.14 |
XpressEngine 1.2.2용 배경음악 틀 [4] | 마빈박사359 | 2009.05.10 |
그룹아이콘이 표시 될 때, 레벨 아이콘 표시 안하기 [2] | Hide_D | 2009.05.08 |
게시판 스킨에서 확장 변수에 값이 없을 경우 해당 항목 표시하지 않기 [6] | SMaker | 2009.05.04 |
1.2.2 XE에디터에서 글쓸때 <p> <br> 자동 변환 단축키 [14] | 샤릉해 | 2009.05.02 |
위지윅 에디터의 관리의 활성 비활성이 안될 경우 해결책 [2] | 김유중345 | 2009.05.01 |
1.2.2 업데이트 이후 위젯이 출력안되시는 분들 [1] [1] | 반도체맨 | 2009.05.01 |
사랑비BGM 플레이기 설치하고 제어하기 [2] | 스유군 | 2009.04.28 |
와!! 굿 아이디어입니다.^^
그러나 옮길 수 있는 게시판은 제한 되어야 할 것 같습니다.
그 제한 권한은 역시 관리자가 주어야겠지요.