웹마스터 팁

BNU님의 Planner가 pl8 이후 더 이상 개발을 하지 않으신다는 안타까운 소식을 접했습니다.

사실 XE 1.2로 업그레이드 하고 여러가지고 신경이 많이 쓰였던 부분입니다.
일정관리가 필요하긴 한데.. 사용은 불가능 하고..
결국 그냥 직접 수정 해보기로 했습니다.
이거 하느라고 하루를 몽땅 날려먹었네요 ㅠ.ㅠ

우선 관리자 페이지의 변경된 확장변수 입력 방식을 수정합니다.

1. /xe/modules/planner/tpl/module_insert.html   // 관리자 페이지의 플래너 추가 화면
 - line 140 ~ 201 제거  // 확장 변수 입력 폼 삭제
 - line 139   "</tr>" 누락 된거 추가.
  // 플래너 추가 화면에 확장 변수가 표시 되지 않습니다.

2. /xe/modules/planner/tpl/header.html    // 확장변수 탭 추가
- line 20  추가


<li <!--@if($act=='dispPlannerAdminExtraVars')-->class="on"<!--@end-->><a href="{getUrl('act','+ '+ 'dispPlannerAdminExtraVars')}">{$lang->extra_vars}</a></li>


3. /xe/modules/planner/conf/module.xml
 - line 36 추가  //확장 변수 탭으로 이동하는 액션 추가


<action name="dispPlannerAdminExtraVars" type="view" standalone="true" />


4. /xe/modules/planner/planner.admin.view.php   // 확장 변수 페이지 표시 함수
 - line 151 ~ 160 추가

/**
     * @brief 확장변수 설정
     **/
    function dispPlannerAdminExtraVars() {
        $oDocumentAdminModel = &getModel('document');
        $extra_vars_content = $oDocumentAdminModel->getExtraVarsHTML($this->module_info->module_srl);
        Context::set('extra_vars_content', $extra_vars_content);

        $this->setTemplateFile('extra_vars');
    }


5. 확장변수 출력 페이지 생성
 - /xe/modules/board/tpl/extra_vars.html 을
 -> /xe/modules/planner/tpl/로 복사

6. 관리자 페이지 -> 서비스관리 -> 플래너 -> 플래너 생성 -> 확장 변수 추가
 - 이미 플래너가 있는 경우 확장 변수만 추가

- 시작일 (날짜형식),
- 종료일 (날짜형식),
- 종일 (체크박스),
- 비밀글 (체크박스)   // 정확한 기능을 몰라 is_secret 소스를 보고 그냥 비밀글이라고 이름을 지엇습니다. BNU님의 도움이 필요ㅠ.ㅠ

7./xe/modules/planner/planner.view.php
 - line 132  // 글 쓰기 버튼 누른 경우 

 /**
     * @brief 글 작성 출력화면
     **/
    function dispPlannerWrite() {
        if(!$this->grant->write_document) return $this->dispPlannerMessage('msg_not_permitted');

        $oDocumentModel = &getModel('document');

        /**
         * 카테고리를 사용하는지 확인 후 사용시 카테고리 목록을 구해와서 Context에 셋팅, 권한도 함께 체크
         **/
        if($this->module_info->use_category=='Y') {

            // 로그인한 사용자의 그룹 정보를 구함
            if(Context::get('is_logged')) {
                $logged_info = Context::get('logged_info');
                $group_srls = array_keys($logged_info->group_list);
            } else {
                $group_srls = array();
            }
            $group_srls_count = count($group_srls);

            // 카테고리 목록을 구하고 권한을 체크
            $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl);
            if(count($normal_category_list)) {
                foreach($normal_category_list as $category_srl => $category) {
                    $is_granted = true;
                    if($category->group_srls) {
                        $category_group_srls = explode(',', $category->group_srls);
                        $is_granted = false;
                        if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = true;

                    }
                    if($is_granted) $category_list[$category_srl] = $category;
                }
            }

            $oPlannerModel = &getModel('planner');
            $categories_color = $oPlannerModel->getCategoriesColor($this->module_srl);

            Context::set('category_list', $category_list);
            Context::set('categories_color', $categories_color);
        }

        // GET parameter에서 document_srl을 가져옴
        $document_srl = Context::get('document_srl');
        $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager);
        $oDocument->setDocument($document_srl);

        if(!$oDocument->isExists()) {
            $document_srl = getNextSequence();
            Context::set('document_srl',$document_srl);
        }

        // 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력 화면으로
        if($oDocument->isExists()&&!$oDocument->isGranted()) return $this->setTemplateFile('+ 'input_password_form');


        $oMemberModel = &getModel('member');
        $group_list = $oMemberModel->getGroups();
        Context::set('group_list', $group_list);

        Context::set('document_srl',$document_srl);
        Context::set('oDocument', $oDocument);

        // 확장 변수처리를 위해 xml_js_filter를 직접 header에 적용
        $oDocumentController = &getController('document');
        $oDocumentController->addXmlJsFilter($this->module_info->modules_srl);

        $this->setTemplateFile('write_form');
    }

// $this->module_info 가 $this->module_info->modules_srl   로 변경됨

8. /xe/modules/planner/skins/lifepod/write_form.html
 - line 23 ~ 27   //extra_vars11 = extra_vars1로  extra_vars12 = extra_vars@

<!--@if(!$oDocument->getExtraValue(1))-->
    {@ $oDocument->variables['extra_vars1'] = date('YmdH00')}
    {@ $plus_h = sprintf('%02d', date('H') + 1)}
    {@ $oDocument->variables['extra_vars2'] = date('Ymd'.$plus_h.'00')}
<!--@end-->

-line 69 ~ 70   수정


<!--@if(!$oDocument->getExtraValue(1))-->{zdate($oDocument->get('extra_vars1'+ '), 'Y/m/d H:i')}<!--@else-->{zdate($oDocument->getExtraValue(1), 'Y/m/d H:i')}<!--@end-->"> ~
            <input type="text" name="end_date" class="inputTypeText w100" readonly="readonly" value="<!--@if(!$oDocument->getExtraValue(2))-->{zdate($oDocument->get('extra_vars2'), 'Y/m/d H:i')}<!--@else-->{zdate($oDocument->getExtraValue(2), 'Y/m/d H:i')}<!--@end-->">

- line 136 제거


 <!--@if($key >= 11) continue; //-->

9. /xe/modules/planner/planner.controller.php    // 확장변수를 일정에 등록
 - line 29 ~ 33  // extra_vars11, 12, 13, 14 를 1,2,3,4

/**
     * @brief 문서 입력
     **/
    function procPlannerInsertEntry() {
        if(!$this->grant->write_document) return new Object(-1, 'msg_not_permitted');

        $obj = Context::getRequestVars();
        $obj->module_srl = $this->module_srl;       
        if($obj->is_notice!='+ 'Y'||!$this->grant->manager) $obj->is_notice = 'N';

        if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');

        if(!$this->grant->manager) {
            unset($obj->title_color);
            unset($obj->title_bold);
        }
       
        // 모듈에서 사용하는 extra_vars11~ 확장변수에 대입
        if($obj->start_date) $obj->{'extra_vars1'} = str_replace(array('/',':',' '), '', $obj->start_date);
        if($obj->end_date) $obj->{'extra_vars2'} = str_replace(array('/',':',' '), '', $obj->end_date);
        $obj->{'extra_vars3'} = ($obj->is_daylong == 'Y') ? 'daylong' : 'schedule';
        if(!$obj->is_secret && $obj->open_group) $obj->{'extra_vars4'} = $obj->open_group;
        else $obj->{'extra_vars4'} = '';

        $oDocumentModel = &getModel('document');
        $oDocumentController = &getController('document');

        $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);

        if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
            $output = $oDocumentController->updateDocument($oDocument, $obj);
            $msg_code = 'success_updated';

        } else {
            $output = $oDocumentController->insertDocument($obj);
            $msg_code = 'success_registed';
            $obj->document_srl = $output->get('document_srl');
        }

        if(!$output->toBool()) return $output;

        $this->add('mid', Context::get('mid'));
        $this->add('document_srl', $output->get('document_srl'));

        $this->setMessage($msg_code);
    }

10. /xe/modules/planner/skins/lifepod/index.html
 - line 15 수정
http://www.lifepod.co.kr/api/calendar.js 를  lifepod.js로 첨부 하였습니다.

{@ Context::addHtmlHeader('<script type="text/javascript" src="./modules/planner/skins/lifepod/js/lifepod.js'.$param.'"></script>')}

11. /xe/modules/planner/planner.model.php
 - line 17 ~ 51  삭제 // getPlannerEntries() 함수를  통합

/**
     * 엔트리를 Ajax로 가져옴
     */
    function getPlannerEntriesXml() {
        if(!$this->grant->list) return;
        $oModuleModel = &getModel('module');
        $logged_info = Context::get('logged_info');
        $module_srl = Context::get('module_srl');
        $year = Context::get('year');
        $month = sprintf('%02d',Context::get('month'));
        $cur_date = $year.$month;
       
        $args->module_srl = $module_srl;
        $args->cur_date = date('Ym', ztime($cur_date));
        $var_idx[] = array();
        $var_idx[1] = 1;
        $var_idx[2] = 2;
        $args->var_idx = $var_idx;
        $args->sort_index = 'value';
        $output = executeQueryArray('planner.getEntry', $args);
        $oDocumentModel = &getModel('document');

        if($output->toBool() && $output->data) {
            foreach($output->data as $key => $val) {
                if(!$val->document_srl) continue;
                $document = $oDocumentModel->getDocument($val->document_srl);
                if($args->module_srl==$document->get('module_srl')){
                    $start_date = str_replace(' ', '', $document->getExtraValue(1));
                    $end_date = str_replace(' ', '', $document->getExtraValue(2));

                    $icons = $document->getExtraImages(60 * 60 * $module_info->duration_new);
                    if($icons) {
                        $icon_list = null;
                        foreach($icons as $no => $icon) {
                            $icon_list[$no] = $icon;
                        }
                    } else { $icon_list = null; }

                    $icon_path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
                    $description = str_replace('&nbsp;', ' ', $document->getSummary(50));

                    // 엔트리 JSON 배열 포맷으로
                    $entries[$key]->id = $document->document_srl;
                    $entries[$key]->module_srl = $document->get('module_srl');
                    $entries[$key]->start = zdate($document->getExtraValue(1), 'Y-m-d H:i:s'+ ', false).$timezone;
                    $entries[$key]->end = zdate($document->getExtraValue(2), 'Y-m-d H:i:s', false).$timezone;
                    $entries[$key]->title = $document->get('title');
                    $entries[$key]->description = $description;
                    $entries[$key]->type = $document->getExtraValue(3);
                    $entries[$key]->category = $this->category_list[$document->get('category_srl')]->title;
                    $entries[$key]->color = $categories_color[$document->get('category_srl')];
                    $entries[$key]->bg = null;
                    $entries[$key]->icon = null;
                    $entries[$key]->allowTag = 1;
                    $entries[$key]->comment = $document->get('comment_count');
                    $entries[$key]->icons = $icon_list;
                }
            }
        }


        if($entries) {
            $json = new JSON;
            $entries = $json->serialize($entries);
            //$entries = '{['.implode(',', $entries).']}';
            $this->add('entries'+ ', $entries);
        }
        $this->add('iconpath', $icon_path);
    }

12. /xe/modules/planner/queries/getEntry.xml
 -  게시물 가져오는 쿼리 수정

<query action="select">
    <tables>
        <table name="document_extra_vars" />
    </tables>
    <columns>
        <column name="distinct(document_srl)" />
    </columns>
    <conditions>
        <condition operation="in" column="module_srl" var="module_srl" />
        <condition operation="in" column="var_idx" var="var_idx" pipe="and" />
        <group pipe="and">
            <condition operation="like_prefix" column="value" var="cur_date" />
        </group>
    </conditions>
    <navigation>
        <index var="sort_index" default="value" order="asc" />
    </navigation>
</query>


// 기존의 documents 테이블에서 document_extra_vars 테이블로 수정
// 필드는  document_srl만 가져옴
// var_idx가 1,2 인 것 중 날짜가 일치하는 것을 날짜순으로 정렬하여 가져옴

13. /xe/modules/planner/skins/lifepod/view_document.html
 - line 63

<div>{zdate($oDocument->getExtraValue(1), 'Y.m.d H:i', false)} ~ {zdate($oDocument->getExtraValue(2), 'Y.m.d H:i', false)}</div>

lifepod.js 는 보기 좋게 줄바꿈 처리를 다 해둔 상태입니다.
-line 3097 ~3390 주석을 해제하면 휴일이 표시됩니다. (어떤분 위젯에서 퍼왔는데 기억이 안나네요 ㅠ.ㅠ)


BNU님께서 더 확실하게 수정해 주시면 좋겠지만.
제 실력이 부족하여 이정도까지밖에 수정이 안되네요.
그냥 돌아는 갑니다.. ^^;;;

위 내용 수정된 파일 첨부합니다.  (xe 1.2 사용자분들에게 도움이 되시길 바랍니다 ^^)


// 누락된 부분이 있어 누락부분과 오타 부분 수정하여 다시 올립니다.

// 첨부 파일에서 write_form.html 은 수정이 안되어 있으니 참고 바랍니다.(추가 수정 누락)

태그 연관 글
  1. [2009/06/15] 묻고답하기 플래너 1.2.2용 질문드립니다. by B.G.M^^ *2
  2. [2009/06/04] 묻고답하기 플래너 등록된 글 표시 박스 색깔 변경 by GP짱 *1
  3. [2009/01/23] 묻고답하기 BNU 님의 미니달력을 찾습니다. by dusskapark *4
  4. [2008/05/06] 묻고답하기 BNU님의 플래너에서 이번 달 일정만 뽑을 수 있는지... by 띵야
제목 글쓴이 날짜
[초보팁] 최근게시물 위젯에 확장변수 표시하기 [23] 오뎅궁물 2010.01.29
확장변수로 북마크 게시판 만들기 [2] 레디오빠 2010.01.31
게시판확장변수를 이미지로 나타내게 게시판스킨 수정법 [3] file 팔공산 2010.03.10
확장변수 사용 (전화번호) 사용 예제 - 참고용 [2] 무대포2 2010.03.17
특정 카테고리의 최근 이미지 출력 위젯 [3] file 앙띠2 2010.04.28
게시판에 사전질문 넣기 특히 확장 변수 없는 지식in 게시판 - 초보자용 [3] file THEOTHERS 2010.08.07
확장변수(textarea)에서 html 사용하기 [3] 하늘종 2010.11.01
XE 공식 게시판에 (다운로드) 같은 '임의목록' 집어 넣기 (확장변수x) [1] file 999 2010.12.30
확장변수 - 주소입력 받을 시 안내문구 출력 [2] 반디소리 2011.02.24
게시판에 회원확장변수정보 받아서 표시하기 [3] burster 2011.03.26
계시판 확장변수에 대하여 여쭤봅니다. [1] 마지막드론 2011.08.14
특정 확장변수를 로그인한 회원에게만 보이게 하기 [3] 비밀얌 2011.09.17
관리툴 회원관리에서 확장변수로 검색 시 숫자 이외 검색불가 해결 방법 카리브 2011.10.10
Xe 1.5.1로 사이트 꾸미기 part 1 [25] file 황비 2011.12.04
코어 1.5.1에서 회원정보에 성별아이콘 쓰기 file 늘푸른이 2011.12.10
코어 1.5.1에서 회원목록에 성별아이콘 쓰기(수정) 늘푸른이 2011.12.10
확정변수 로 프린트 페이지 꾸미기(/print_page.html) 세상의지배자 2011.12.26
XE 1.5 에서 확장변수 검색이 안 되시는 경우 해결책 [5] sejin7940 2012.01.24
확장변수이용시 숫자 일경우 정렬하기 팁 푸하라 2012.02.02
확장변수 중 전화번호 양식으로 write_form.html 에서 script로 제어시 sejin7940 2012.02.16