웹마스터 팁

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 띵야
제목 글쓴이 날짜
[PHP]간단한 로그인페이지 만들기 [15] ZipShin 2002.07.09
MYSQL에 접속하기..^^ [9] ZipShin 2002.05.20
[OsE=] Session을 배워보자~ [#1] OsE= 2002.03.02
파일시스템에서 비밀번호 생성/수정/인증 [7] 두기두바 2002.01.10
[추천 소스] phpMyAdmin 다중사용자용... [5] WOWpc 2001.11.29
대화방을 만들어보쟈~ [20] 해그리드짱!!! 2001.06.03
PHP 인증 페이지를 만들자! - Lesson 3 수정본 #1 [3] ☺[폐]허접-_- 2002.01.24
쿠키(cookie)의 활용 [44] zero 2000.03.06
{로그인}관리자 로그인 폼 간단함 [2] 김민환 2006.10.10
상위 셀렉트박스 값 변경시 하위셀렉트박스(다수)제어하기. [2] Xian 2005.02.19
특정위치에 떠있는 레이어 (슬라이딩 애드콘) - 노프레임홈에서의 문제해결 [8] 검미르 2004.05.03
[초간단 자바스크립트!] 자바로 로그인폼 만들기 [3] ∑Ztxy 2004.01.26
[초간단 자바스크립트!] 홈페이지에 FTP 폼 넣기?! [10] ∑Ztxy 2003.09.29
크롬리스(Chromless) 웹어플리케이션 -5 [3] sundew 2003.05.28
다음 로그인 폼 입니다... 로그인후 원하는 곳으로!! [3] 정성교 2003.03.05
로그인과 로그아웃을 체크하는 방법입니다. [3] 이영호 2003.01.24
텍스트 폼에 커서가 미리 깜빡이도록... [8] 카리 2003.01.22
[re] 아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [2] Mahican 2002.12.02
[자작] select 폼 태그 html로 허접하게나마 꾸며보기 [18] zero 2002.11.05
자바스크립트로 여러개 아이디 로그인 하기 [5] ZipShin 2002.09.17