웹마스터 팁

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 띵야
제목 글쓴이 날짜
(재 수정) 제로보드 XE 신버젼에 Lavalic 2 설치하기 [4] 조성우371 2009.01.16
사이트 이전팁( files 폴더) [6] 샤이니라 2009.01.28
게시판에서 사이트 관리자만 볼수있는 항목 만들기 [1] ☜ TeRy ☞ 2009.02.13
테스트용 아이디 탈퇴 막기 [1] SMaker 2009.02.26
첨부파일의 외부 무단 링크 차단하기(XE) 게시판설정 [7] file 왕초보왕따 2009.03.02
브라우저 크기에 따라 본문 가로 크기 자동 조절 [1] 개돌 2009.03.18
제로보드의 아이콘을 내 맘대로 변경하기...(2) [2] file winter548 2009.03.23
로그인 포인트 출력 위젯을 수정해보자 [花穗] 2009.03.27
특정그룹 멤버 표시 위젯에서 이름 순 정렬하기 [2] file 이재한744 2009.03.30
클릭마다 조회수 올리기 [1.4.0] [12] file 지B 2009.04.04
요청하신 모듈을 찾을 수 없습니다 문제해결 방법 [2] 반도체맨 2009.04.09
주민등록 입력 폼 1.2.0 [55] file 개돌 2009.04.10
다양한 언어로 홈페이지 서비스하기 - 무식한 방법 [4] 멀리서 2009.04.21
BNU님의 Planner XE 1.2 버젼(일정관리) [9] file 개돌 2009.04.21
내가 작성 한 글에 대한 일괄 삭제/이동/복사 권한 주기 [2] file 개돌 2009.05.15
별도 페이지 로그인방법 cornet 2009.05.21
로그인 페이지 만드는 방법 [5] 산토 2009.06.12
로그인 후 그룹별로 다른 페이지로 가기 - 업데이트판 v1.5 [19] 무대포2 2009.06.24
로그인 & 파일 첨부 문제 [3] peter99 2009.06.29
Lavalic Mp3 플레이어를 대신하는... [8] 조성우371 2009.07.13