웹마스터 팁

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"&nbsp">!--@else-->&nbsp;
    <!--@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;
                }
            }
        }

이 부분은 체크 박스에 체크 할때 세션으로 담는 부분에서 관리자가 아닌 경우 세션을 저장하지 않도록 된 부분을 주석 처리 한 것입니다.

 

manager.JPG

사내 정보라 다른 게시물들은 필터링 처리 했습니다.

보시다 시피 테스트용으로만든 계정에서 입력한  게시물에만 체크 박스가 나오며 하단의 게시글 관리  버튼이 활성화 되어있습니다.

 

일반적인 게시판에서의 활용도는 어떨지 모르겠습니다만 위 기능을 이용하면 저희 같은 사내 업무에서는 많은 도움이 될 것 같네요.

 

덤으로 왼쪽에 보이는 내용은 몇일전 추가한 서버의 드라이브 정보 표시 기능!!
파일 업로드 시 경각심을 불러 일으키기 위해 1Gb 이하로 용량이 남으면 빨간색으로 표시!!!

 

이번주에 커스터 마이징 한것만 세개 ㅠ.ㅠ
버젼 업그레이드가 제일 무서워요 ~~ ㅠ.ㅠ

제목 글쓴이 날짜
[주옥시리즈] 타이틀 제어 애드온 socialskyo 2013.09.09
외부페이지에서 로그인 폼 구현하기 컴퓨터매니아 2013.09.09
[주옥 시리즈]지식인XE 모바일에서도 답변보기 socialskyo 2013.09.08
[주옥시리즈]글 목록을 조회수 별로 색상 지정하기 [9] socialskyo 2013.09.06
댓글 새로고침 수정 [22] Lansi 2013.09.06
댓글 작성, 추천후 다운로드 받을수 있게 하기. [6] socialskyo 2013.09.06
위젯 페이지에서 첨부파일 100%로 파일이 업로드되지 않을 때 이온디 2013.09.04
내가 작성한 글 에서 해당 글의 댓글 수 출력하는 방법 [1] sejin7940 2013.09.03
메일링 가입 인증 폼 부터 ..가입인증 메일 제목 가입인증 메일 코드 부분의 에러로 , msg_confirm_account_title 메일 주소가 이렇게 표기되어 오던 [3] file 애드바이러스 2013.09.02
SSL 환경에서 메시지톡 쪽지 보내기, 친구 찾기, 메시지 삭제 등 안될 때 [2] Arisae 2013.09.02
모든 페이지에 공통된 내용을 적용하기. [3] 컴퓨터매니아 2013.09.01
회원가입확장 모듈 - 가입절차중 오류 발생시 처음으로 돌아가는 현상 [1] 김개발 2013.08.30
IE8에서 이미지 자동 리사이징 높이 고정 문제 해결법 GGobugi 2013.08.29
장포크님의 더보기 팁 - 소스 줄임 낭만구미호 2013.08.26
네이버 SMTP로 인증메일 보내기 [12] Neder 2013.08.26
XE 기본 메시지창에서 '로그인' 대신 '돌아가기' 나오도록 하기 [2] file 컴퓨터매니아 2013.08.25
scm player 팝업 제외하기 [1] 귀머거리하늘 2013.08.25
계정 정지된 회원에게 정지 사유 표시하기. [24] file 컴퓨터매니아 2013.08.24
카페XE를 Domain 접속으로 설정 후 관리페이지 접속 불가할때 [1] 라르게덴 2013.08.24
나름 강력할 것 같은 스팸방지 팁 [16] 꿈섬 2013.08.23