From 3a6abc6b97a5f471606fa9b7fde73a310d1788e0 Mon Sep 17 00:00:00 2001 From: haneul Date: Mon, 10 Dec 2007 07:21:22 +0000 Subject: [PATCH] added lifepod module git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3288 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/lifepod/conf/info.xml | 11 + modules/lifepod/conf/module.xml | 26 ++ modules/lifepod/lang/en.lang.php | 15 ++ modules/lifepod/lang/ko.lang.php | 15 ++ modules/lifepod/lifepod.admin.controller.php | 245 ++++++++++++++++++ modules/lifepod/lifepod.admin.view.php | 183 +++++++++++++ modules/lifepod/lifepod.class.php | 54 ++++ modules/lifepod/lifepod.model.php | 92 +++++++ modules/lifepod/lifepod.view.php | 80 ++++++ modules/lifepod/me2dayXmlParser.class.php | 59 +++++ modules/lifepod/queries/getLifepodList.xml | 18 ++ modules/lifepod/skins/xe_official/.temp.swp | Bin 0 -> 12288 bytes .../lifepod/skins/xe_official/css/common.css | 97 +++++++ .../lifepod/skins/xe_official/js/lifepod.js | 55 ++++ .../skins/xe_official/js/xe_interface.js | 23 ++ modules/lifepod/skins/xe_official/list.html | 34 +++ .../lifepod/skins/xe_official/message.html | 7 + modules/lifepod/skins/xe_official/skin.xml | 19 ++ modules/lifepod/tpl/filter/delete_lifepod.xml | 10 + modules/lifepod/tpl/filter/insert_grant.xml | 11 + modules/lifepod/tpl/filter/insert_lifepod.xml | 32 +++ modules/lifepod/tpl/grant_list.html | 38 +++ modules/lifepod/tpl/header.html | 25 ++ modules/lifepod/tpl/index.html | 79 ++++++ modules/lifepod/tpl/js/lifepod_admin.js | 79 ++++++ modules/lifepod/tpl/js/springnote_admin.js | 79 ++++++ modules/lifepod/tpl/lifepod_delete.html | 31 +++ modules/lifepod/tpl/lifepod_info.html | 75 ++++++ modules/lifepod/tpl/lifepod_insert.html | 119 +++++++++ modules/lifepod/tpl/skin_info.html | 116 +++++++++ 30 files changed, 1727 insertions(+) create mode 100644 modules/lifepod/conf/info.xml create mode 100644 modules/lifepod/conf/module.xml create mode 100644 modules/lifepod/lang/en.lang.php create mode 100644 modules/lifepod/lang/ko.lang.php create mode 100644 modules/lifepod/lifepod.admin.controller.php create mode 100644 modules/lifepod/lifepod.admin.view.php create mode 100644 modules/lifepod/lifepod.class.php create mode 100644 modules/lifepod/lifepod.model.php create mode 100644 modules/lifepod/lifepod.view.php create mode 100644 modules/lifepod/me2dayXmlParser.class.php create mode 100644 modules/lifepod/queries/getLifepodList.xml create mode 100644 modules/lifepod/skins/xe_official/.temp.swp create mode 100644 modules/lifepod/skins/xe_official/css/common.css create mode 100644 modules/lifepod/skins/xe_official/js/lifepod.js create mode 100644 modules/lifepod/skins/xe_official/js/xe_interface.js create mode 100644 modules/lifepod/skins/xe_official/list.html create mode 100644 modules/lifepod/skins/xe_official/message.html create mode 100644 modules/lifepod/skins/xe_official/skin.xml create mode 100644 modules/lifepod/tpl/filter/delete_lifepod.xml create mode 100644 modules/lifepod/tpl/filter/insert_grant.xml create mode 100644 modules/lifepod/tpl/filter/insert_lifepod.xml create mode 100644 modules/lifepod/tpl/grant_list.html create mode 100644 modules/lifepod/tpl/header.html create mode 100644 modules/lifepod/tpl/index.html create mode 100644 modules/lifepod/tpl/js/lifepod_admin.js create mode 100644 modules/lifepod/tpl/js/springnote_admin.js create mode 100644 modules/lifepod/tpl/lifepod_delete.html create mode 100644 modules/lifepod/tpl/lifepod_info.html create mode 100644 modules/lifepod/tpl/lifepod_insert.html create mode 100644 modules/lifepod/tpl/skin_info.html diff --git a/modules/lifepod/conf/info.xml b/modules/lifepod/conf/info.xml new file mode 100644 index 000000000..390c7b35e --- /dev/null +++ b/modules/lifepod/conf/info.xml @@ -0,0 +1,11 @@ + + + 라이프팟 연동 + Lifepod + + haneul + haneul + 라이프팟의 calendar를 제로보드XE에서 연동하여 출력하는 기능을 가지고 있는 모듈입니다. + This module displays calendar from lifepod. + + diff --git a/modules/lifepod/conf/module.xml b/modules/lifepod/conf/module.xml new file mode 100644 index 000000000..f523c35bb --- /dev/null +++ b/modules/lifepod/conf/module.xml @@ -0,0 +1,26 @@ + + + + + 열람 + 查看 + 閲覧 + view + + + + + + + + + + + + + + + + + + diff --git a/modules/lifepod/lang/en.lang.php b/modules/lifepod/lang/en.lang.php new file mode 100644 index 000000000..cbb72cb83 --- /dev/null +++ b/modules/lifepod/lang/en.lang.php @@ -0,0 +1,15 @@ +lifepod = "Lifepod"; + + $lang->calendar_address = "calendar's xml address"; + $lang->cmd_lifepod_list = 'Lifepod module list'; + $lang->cmd_view_info = 'Lifepod info.'; + + $lang->about_lifepod = "Lifepod is a calendar service provided by Openmaru Studio.
Lifepod Zeroboard XE module desplays Lifepod's scalendar as an internal document."; +?> diff --git a/modules/lifepod/lang/ko.lang.php b/modules/lifepod/lang/ko.lang.php new file mode 100644 index 000000000..b25310705 --- /dev/null +++ b/modules/lifepod/lang/ko.lang.php @@ -0,0 +1,15 @@ +lifepod = "라이프팟"; + + $lang->calendar_address = "캘린더 xml주소"; + $lang->cmd_lifepod_list = '라이프팟 목록'; + $lang->cmd_view_info = '라이프팟 정보'; + + $lang->about_lifepod = "라이프팟은 오픈마루에서 제공하는 캘린더서비스입니다.
라이프팟 제로보드XE모듈은 라이프팟의 특정 캘린더들을 내부문서처럼 열람할 수 있는 모듈입니다."; +?> diff --git a/modules/lifepod/lifepod.admin.controller.php b/modules/lifepod/lifepod.admin.controller.php new file mode 100644 index 000000000..1db9b73d7 --- /dev/null +++ b/modules/lifepod/lifepod.admin.controller.php @@ -0,0 +1,245 @@ +module = 'lifepod'; + + // mid값을 직접 받지 않고 lifepod_name으로 받는 이유는 mid는 특별히 약속된 변수명이라 오동작이 발생할 수 있어서 다른 이름으로 전달을 받은후 다시 바꾸어준다. + $args->mid = $args->lifepod_name; + unset($args->lifepod_name); + + // is_default일 경우 별다른 요청이 없는 index페이지의 경우 바로 호출이 되는데 이 값을 설정을 하게 된다. + if($args->is_default!='Y') $args->is_default = 'N'; + + // 기본 값외의 것들을 정리 + $extra_var = delObjectVars(Context::getRequestVars(), $args); + unset($extra_var->act); + unset($extra_var->page); + unset($extra_var->lifepod_name); + + // module_srl이 넘어오면 원 모듈이 있는지 확인 + if($args->module_srl) { + $oModuleModel = &getModel('module'); + $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); + + // 만약 원래 모듈이 없으면 새로 입력하기 위한 처리 + if($module_info->module_srl != $args->module_srl) unset($args->module_srl); + } + + // $extra_var를 serialize + $args->extra_vars = serialize($extra_var); + + // module 모듈의 controller 객체 생성 + $oModuleController = &getController('module'); + + // is_default=='Y' 이면 + if($args->is_default=='Y') $oModuleController->clearDefaultModule(); + + /** + * module_srl값이 없다면 신규 등록으로 처리를 한다. + **/ + if(!$args->module_srl) { + // module controller를 이용하여 모듈을 생성한다. + $output = $oModuleController->insertModule($args); + $msg_code = 'success_registed'; + + // 권한의 경우 기본으로 설정을 해주는 것이 좋으며 lifepod 모듈의 경우 manager권한을 관리 그룹으로 설정을 한다. + if($output->toBool()) { + // 관리그룹을 member model객체에서 구할 수 있다. + $oMemberModel = &getModel('member'); + $admin_group = $oMemberModel->getAdminGroup(); + $admin_group_srl = $admin_group->group_srl; + + $module_srl = $output->get('module_srl'); + $grants = serialize(array('manager'=>array($admin_group_srl))); + + // module controller의 module 권한 설정 method를 이용하여 기본 권한을 적용한다. + $oModuleController->updateModuleGrant($module_srl, $grants); + } + /** + * module_srl이 있다면 모듈의 정보를 수정한다 + **/ + } else { + $output = $oModuleController->updateModule($args); + $msg_code = 'success_updated'; + } + + // 결과값에 오류가 있을 경우 그대로 객체 리턴. + if(!$output->toBool()) return $output; + + // 등록후 페이지 이동을 위해 변수 설정 및 메세지를 설정한다. + $this->add('page',Context::get('page')); + $this->add('module_srl',$output->get('module_srl')); + $this->setMessage($msg_code); + } + + /** + * @brief lifepod 삭제 + **/ + function procLifepodAdminDeleteLifepod() { + // 삭제할 대상 lifepod의 module_srl을 구한다. + $module_srl = Context::get('module_srl'); + + // 원본을 구해온다 + $oModuleController = &getController('module'); + $output = $oModuleController->deleteModule($module_srl); + + // 삭제 처리시 오류가 발생하면 결과 객체를 바로 리턴한다. + if(!$output->toBool()) return $output; + + // 등록후 페이지 이동을 위해 변수 설정 및 메세지를 설정한다. + $this->add('module','lifepod'); + $this->add('page',Context::get('page')); + $this->setMessage('success_deleted'); + } + + /** + * @brief 권한 설정 + * 생성된 lifepod에 ./conf/module.xml에 정의된 권한과 관리자가 선택한 그룹의 값을 연동하여 권한을 설정하게 된다. + **/ + function procLifepodAdminInsertGrant() { + // 대상 lifepod(모듈)의 고유값인 module_srl을 체크한다. + $module_srl = Context::get('module_srl'); + + /** + * 현 모듈의 권한 목록을 가져옴 + * xml_info 는 lifepod모듈이 요청되었다고 판단될때 ModuleObject에서 이미 세팅해 놓은 상태이다. + **/ + $grant_list = $this->xml_info->grant; + + /** + * 권한의 목록을 loop로 돌면서 권한 설정을 한다. + * zbxe의 경우 가능한 간단한 xmlrpc사용을 위해서 배열의 경우 |@|를 pipe로 하여 하나의 string으로 전달한다. + * 요청받은 권한의 대상 그룹과 권한을 배열로 한 후 serialize하여 modules테이블에 module_srl을 키로 한 rows에 데이터를 적용한다. + **/ + if(count($grant_list)) { + foreach($grant_list as $key => $val) { + $group_srls = Context::get($key); + if($group_srls) $arr_grant[$key] = explode('|@|',$group_srls); + } + $grants = serialize($arr_grant); + } + + // 권한 설정은 모듈 공통이라 module 모듈의 controller을 생성하여 저장하도록 한다. + $oModuleController = &getController('module'); + $oModuleController->updateModuleGrant($module_srl, $grants); + + // 권한 설정후 돌아갈 페이지를 위하여 module_srl값을 세팅하고 성공 메세지 역시 세팅한다. + $this->add('module_srl',Context::get('module_srl')); + $this->setMessage('success_registed'); + } + + /** + * @brief 스킨 정보 업데이트 + * 스킨 정보는 skin.xml파일의 extra_vars와 입력된 변수값을 조합하여 serialize하여 modules 테이블에 module_srl을 키로 하여 저장을 하게 된다. + **/ + function procLifepodAdminUpdateSkinInfo() { + // module_srl에 해당하는 정보들을 가져오기 + $module_srl = Context::get('module_srl'); + + // 어떤 스킨이 사용중인지 확인하기 위해서 module_srl을 이용하여 모듈의 정보를 구하고 스킨을 구한다. + $oModuleModel = &getModel('module'); + $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); + $skin = $module_info->skin; + + // 스킨의 정보르 구해옴 (extra_vars를 체크하기 위해서) + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); + + // 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰) + $obj = Context::getRequestVars(); + unset($obj->act); + unset($obj->module_srl); + unset($obj->page); + + // 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌 + if($skin_info->extra_vars) { + foreach($skin_info->extra_vars as $vars) { + if($vars->type!='image') continue; + + $image_obj = $obj->{$vars->name}; + + // 삭제 요청에 대한 변수를 구함 + $del_var = $obj->{"del_".$vars->name}; + unset($obj->{"del_".$vars->name}); + if($del_var == 'Y') { + @unlink($module_info->{$vars->name}); + continue; + } + + // 업로드 되지 않았다면 이전 데이터를 그대로 사용 + if(!$image_obj['tmp_name']) { + $obj->{$vars->name} = $module_info->{$vars->name}; + continue; + } + + // 정상적으로 업로드된 파일이 아니면 무시 + if(!is_uploaded_file($image_obj['tmp_name'])) { + unset($obj->{$vars->name}); + continue; + } + + // 이미지 파일이 아니어도 무시 + if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + unset($obj->{$vars->name}); + continue; + } + + // 경로를 정해서 업로드 + $path = sprintf("./files/attach/images/%s/", $module_srl); + + // 디렉토리 생성 + if(!FileHandler::makeDir($path)) return false; + + $filename = $path.$image_obj['name']; + + // 파일 이동 + if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { + unset($obj->{$vars->name}); + continue; + } + + // 변수를 바꿈 + unset($obj->{$vars->name}); + $obj->{$vars->name} = $filename; + } + } + + // serialize하여 저장 + $skin_vars = serialize($obj); + + // module controller객체를 생성하여 module_srl을 키로 한 rows에 serialize한 스킨 정보를 적용한다. + $oModuleController = &getController('module'); + $oModuleController->updateModuleSkinVars($module_srl, $skin_vars); + + /** + * 스킨 정보는 첨부파일때문에 xml로 전달이 되지 않고 POST로 전송이 되어 왔으므로 템플릿을 이용하여 프레임을 refresh시키도록 한다. + * 스킨 정보를 수정할때 숨어 있는 iframe을 target으로 삼기에 기본 레이아웃을 이용하면 되므로 직접 레이아웃 경로와 파일을 기본으로 지정한다. + **/ + $this->setLayoutPath('./common/tpl'); + $this->setLayoutFile('default_layout.html'); + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile("top_refresh.html"); + } + } +?> diff --git a/modules/lifepod/lifepod.admin.view.php b/modules/lifepod/lifepod.admin.view.php new file mode 100644 index 000000000..beba90305 --- /dev/null +++ b/modules/lifepod/lifepod.admin.view.php @@ -0,0 +1,183 @@ +module_srl) { + $module_srl = $this->module_srl; + Context::set('module_srl', $module_srl); + } + + // module info를 구하기 위해 module model 객체 생성 + $oModuleModel = &getModel('module'); + + // 모듈 카테고리 목록을 구함 + $module_category = $oModuleModel->getModuleCategories(); + Context::set('module_category', $module_category); + + // module_srl이 있다면 요청된 모듈의 정보를 미리 구해 놓음 + if($module_srl) { + $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); + if(!$module_info) { + Context::set('module_srl',''); + $this->act = 'list'; + } else { + $this->module_info = $module_info; + Context::set('module_info',$module_info); + } + } + + // 템플릿 경로 지정, 관리자 페이지를 위한 템플릿은 별도의 스킨 기능이 없이 ./modules/모듈/tpl/ 에 위치해 놓기에 바로 지정을 해 놓는다. + $template_path = sprintf("%stpl/",$this->module_path); + $this->setTemplatePath($template_path); + } + + /** + * @brief 생성된 calendar들의 목록을 보여줌 + * lifepod이라는 module명으로 등록된 모듈을 구하기 위해서 몇가지 설정을 한 후에 쿼리를 수행한다. + * 쿼리수행은 executeQuery(모듈명.쿼리아이디, 인자변수) 로 하게 되며 이 쿼리아이디에 해당하는 xml파일은 모듈의 queries디렉토리에 지정이 되어 있다. + * + * 이 특정 module의 목록은 module model객체에서 구할 수 있지만 검색등의 각 모듈마다 다른 조건 때문에 각 모듈별로 쿼리를 생성해 놓는다. + * 모든 모듈의 결과물(mid)는 modules 테이블에 저장이 된다. + **/ + function dispLifepodAdminContent() { + $args->sort_index = "module_srl"; ///< 정렬 순서는 모듈의 sequence값으로 하고 정렬은 역순. 즉 생성된 순으로 한다. + $args->page = Context::get('page'); ///< 현재 페이지를 설정 + $args->list_count = 40; ///< 한페이지에 40개씩 보여주기로 고정. + $args->page_count = 10; ///< 페이지의 수는 10개로 제한. + $args->s_module_category_srl = Context::get('module_category_srl'); ///< 모듈분류값을 인자로 추가 + $output = executeQuery('lifepod.getLifepodList', $args); ///< lifepod.getGuesbookList 쿼리 실행 (./modules/lifepod/query/getLifepodList.xml) + + /** + * 템플릿에 쓰기 위해서 context::set + * xml query에 navigation이 있고 list_count가 정의되어 있으면 결과 변수에 아래 5가지의 값이 세팅이 된다. + **/ + Context::set('total_count', $output->total_count); + Context::set('total_page', $output->total_page); + Context::set('page', $output->page); + Context::set('lifepod_list', $output->data); + Context::set('page_navigation', $output->page_navigation); + + // 템플릿 파일 지정 (./modules/lifepod/tpl/index.html파일이 지정이 됨) + $this->setTemplateFile('index'); + } + + /** + * @brief 선택된 모듈의 정보 출력 + **/ + function dispLifepodAdminLifepodInfo() { + // module_srl 값이 없다면 그냥 index 페이지를 보여줌 + if(!Context::get('module_srl')) return $this->dispLifepodAdminContent(); + + // 레이아웃이 정해져 있다면 레이아웃 정보를 추가해줌(layout_title, layout) + if($this->module_info->layout_srl) { + $oLayoutModel = &getModel('layout'); + $layout_info = $oLayoutModel->getLayout($this->module_info->layout_srl); + $this->module_info->layout = $layout_info->layout; + $this->module_info->layout_title = $layout_info->layout_title; + } + + // 정해진 스킨이 있으면 해당 스킨의 정보를 구함 + if($this->module_info->skin) { + $oModuleModel = &getModel('module'); + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->module_info->skin); + $this->module_info->skin_title = $skin_info->title; + } + + // 템플릿 파일 지정 + $this->setTemplateFile('lifepod_info'); + } + + /** + * @brief 모듈 설정 폼 출력 + **/ + function dispLifepodAdminInsertLifepod() { + // 스킨 목록을 구해옴 + $oModuleModel = &getModel('module'); + $skin_list = $oModuleModel->getSkins($this->module_path); + Context::set('skin_list',$skin_list); + + // 레이아웃 목록을 구해옴 + $oLayoutMode = &getModel('layout'); + $layout_list = $oLayoutMode->getLayoutList(); + Context::set('layout_list', $layout_list); + + // 템플릿 파일 지정 + $this->setTemplateFile('lifepod_insert'); + } + + /** + * @brief 모듈 삭제 화면 출력 + **/ + function dispLifepodAdminDeleteLifepod() { + if(!Context::get('module_srl')) return $this->dispLifepodAdminContent(); + + $module_info = Context::get('module_info'); + + Context::set('module_info',$module_info); + + // 템플릿 파일 지정 + $this->setTemplateFile('lifepod_delete'); + } + + /** + * @brief 스킨 정보 보여줌 + **/ + function dispLifepodAdminSkinInfo() { + + // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 + $module_info = Context::get('module_info'); + $skin = $module_info->skin; + + $oModuleModel = &getModel('module'); + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); + + // skin_info에 extra_vars 값을 지정 + if(count($skin_info->extra_vars)) { + foreach($skin_info->extra_vars as $key => $val) { + $name = $val->name; + $type = $val->type; + $value = $module_info->{$name}; + if($type=="checkbox"&&!$value) $value = array(); + $skin_info->extra_vars[$key]->value= $value; + } + } + + Context::set('skin_info', $skin_info); + $this->setTemplateFile('skin_info'); + } + + /** + * @brief 권한 목록 출력 + **/ + function dispLifepodAdminGrantInfo() { + // module_srl을 구함 + $module_srl = Context::get('module_srl'); + + // module.xml에서 권한 관련 목록을 구해옴 + $grant_list = $this->xml_info->grant; + Context::set('grant_list', $grant_list); + + // 권한 그룹의 목록을 가져온다 + $oMemberModel = &getModel('member'); + $group_list = $oMemberModel->getGroups(); + Context::set('group_list', $group_list); + + $this->setTemplateFile('grant_list'); + } + } +?> diff --git a/modules/lifepod/lifepod.class.php b/modules/lifepod/lifepod.class.php new file mode 100644 index 000000000..d2461b92f --- /dev/null +++ b/modules/lifepod/lifepod.class.php @@ -0,0 +1,54 @@ +insertActionForward('lifepod', 'view', 'dispLifepodContent'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminContent'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminLifepodInfo'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminInsertLifepod'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminDeleteLifepod'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminGrantInfo'); + $oModuleController->insertActionForward('lifepod', 'view', 'dispLifepodAdminSkinInfo'); + $oModuleController->insertActionForward('lifepod', 'controller', 'procLifepodAdminInsertLifepod'); + $oModuleController->insertActionForward('lifepod', 'controller', 'procLifepodAdminDeleteLifepod'); + $oModuleController->insertActionForward('lifepod', 'controller', 'procLifepodAdminInsertGrant'); + + return new Object(); + } + + /** + * @brief 설치가 이상이 없는지 체크하는 method + **/ + function checkUpdate() { + $oModuleModel = &getModel('module'); + if(!$oModuleModel->getActionForward('dispLifepodContent')) return true; + + return false; + } + + /** + * @brief 업데이트 실행 + **/ + function moduleUpdate() { + $this->moduleInstall(); + return new Object(0,'success_updated'); + } + + /** + * @brief 캐시 파일 재생성 + **/ + function recompileCache() { + } + } + +?> diff --git a/modules/lifepod/lifepod.model.php b/modules/lifepod/lifepod.model.php new file mode 100644 index 000000000..737df8ce1 --- /dev/null +++ b/modules/lifepod/lifepod.model.php @@ -0,0 +1,92 @@ +address = $address; + } + + /** + * @brief HTTP request 객체 생성 + **/ + function getRequest($url) { + $oReqeust = new HTTP_Request($url); + $oReqeust->addHeader('Content-Type', 'application/xml'); + $oReqeust->setMethod('GET'); + return $oReqeust; + } + + function getURL($start, $end) { + return sprintf("%s&start=%s&end=%s", $this->address, $start, $end); + } + + /** + * @brief lifepod 페이지 정보 가져오기 + * @remarks 한해씩 끊어서 페이지를 가져옵니다. 아직 50개 이상의 calendar info가 있는 경우 앞에 것만 가져오는 문제가 있습니다. + **/ + function getPage($year) { + if($year == null) + { + $year = date("Y"); + } + + $start = sprintf("%s-01-01",$year); + $end = sprintf("%s-01-01",$year+1); + + $url = $this->getURL($start, $end); + $oReqeust = $this->getRequest($url); + $oResponse = $oReqeust->sendRequest(); + + if (PEAR::isError($oResponse)) return null; + + $body = $oReqeust->getResponseBody(); + + $oXmlParser = new Me2DayXmlParser(); + $xmldoc = $oXmlParser->parse($body); + if(!$xmldoc->childNodes["feed"]->childNodes["entry"]) + { + $data = array(); + } + else + { + $data = &$xmldoc->childNodes["feed"]->childNodes["entry"]->childNodes["data"]; + } + $page->title = $xmldoc->childNodes["feed"]->childNodes["title"]->body; + if(is_array($data)) + { + $page->data = $data; + } + else + { + $page->data = array(); + $page->data[] = $data; + } + + return $page; + } + + } +?> diff --git a/modules/lifepod/lifepod.view.php b/modules/lifepod/lifepod.view.php new file mode 100644 index 000000000..5e223a1cc --- /dev/null +++ b/modules/lifepod/lifepod.view.php @@ -0,0 +1,80 @@ +module_srl) Context::set('module_srl',$this->module_srl); + + Context::set('module_info',$this->module_info); + + /** + * 모듈정보에서 넘어오는 skin값을 이용하여 최종 출력할 템플릿의 위치를 출력한다. + * $this->module_path는 ./modules/guestbook/의 값을 가지고 있다 + **/ + $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); + $this->setTemplatePath($template_path); + } + + function dateFormatChange($dates) { + $dates = str_replace( "T", " ", $dates); + $dates = str_replace( "Z", "+0", $dates); + $dates = date("Y-m-d H:i:s", strtotime($dates)); + return $dates; + } + + /** + * @brief 달력 + **/ + function dispLifepodContent() { + // 권한 체크 + if(!$this->grant->view) return $this->dispLifepodMessage('msg_not_permitted'); + + $oLifepodModel = &getModel('lifepod'); + $oLifepodModel->setInfo($this->module_info->calendar_address); + $cYear = Context::get('year'); + $cMonth = Context::get('month'); + $cDay = Context::get('day'); + + // 특정 페이지 선택시 페이지 정보 가져오기 + $page = $oLifepodModel->getPage($cYear, $cMonth, $cDay); + foreach ($page->data as $key => $val) + { + if($val->childNodes["date-start"]) + { + $val->childNodes["date-start"]->body = $this->dateFormatChange($val->childNodes["date-start"]->body); + } + if($val->childNodes["date-end"]) + { + $val->childNodes["date-end"]->body = $this->dateFormatChange($val->childNodes["date-end"]->body); + } + } + + Context::set('page', $page); + + $this->setTemplateFile('list'); + } + + /** + * @brief 메세지 출력 + **/ + function dispLifepodMessage($msg_code) { + $msg = Context::getLang($msg_code); + if(!$msg) $msg = $msg_code; + Context::set('message', $msg); + $this->setTemplateFile('message'); + } + + } +?> diff --git a/modules/lifepod/me2dayXmlParser.class.php b/modules/lifepod/me2dayXmlParser.class.php new file mode 100644 index 000000000..b836701fe --- /dev/null +++ b/modules/lifepod/me2dayXmlParser.class.php @@ -0,0 +1,59 @@ +output)) return; + $this->output = array_shift($this->output); + + return $this->output; + } + + /** + * @brief 태그 오픈 + **/ + function _tagOpen($parser, $node_name, $attrs) { + $obj->node_name = strtolower($node_name); + $obj->attrs = $attrs; + $obj->childNodes = array(); + + array_push($this->output, $obj); + } + + function _tagBody($parser, $body) { + //if(!trim($body)) return; + $this->output[count($this->output)-1]->body .= $body; + } + + /** + * @brief 태그 닫음 + **/ + function _tagClosed($parser, $node_name) { + $node_name = strtolower($node_name); + $cur_obj = array_pop($this->output); + $parent_obj = &$this->output[count($this->output)-1]; + + if($parent_obj->childNodes[$node_name]) { + $tmp_obj = $parent_obj->childNodes[$node_name]; + if(is_array($tmp_obj)) { + array_push($parent_obj->childNodes[$node_name], $cur_obj); + } else { + $parent_obj->childNodes[$node_name] = array(); + array_push($parent_obj->childNodes[$node_name], $tmp_obj); + array_push($parent_obj->childNodes[$node_name], $cur_obj); + } + } else { + $parent_obj->childNodes[$node_name] = $cur_obj; + } + } + + } +?> diff --git a/modules/lifepod/queries/getLifepodList.xml b/modules/lifepod/queries/getLifepodList.xml new file mode 100644 index 000000000..30babc720 --- /dev/null +++ b/modules/lifepod/queries/getLifepodList.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/modules/lifepod/skins/xe_official/.temp.swp b/modules/lifepod/skins/xe_official/.temp.swp new file mode 100644 index 0000000000000000000000000000000000000000..c6e28cb67893d1beb46b620f97bfe0f8a6120956 GIT binary patch literal 12288 zcmeI&Pfx-y7zXgd$%}uYUtmsSG;u5H0i&?Qlkwom;K_t^YZnS*Yt|y5(U0Pn@uHu} z19mbl27+gN-lSRfK3%u|j@!c8{mrdY_iMz~79nqI57(dX)yl^KA$r_lY0+O&f0|_1 zc>P(BszI2@sNFIBgg%8MLHijWBtp|f#zJMB>YhwB9f@`p$1;*Ep+@x8l7~PH0SGJ> z7?{{QUvHhAp49f-U1w*zwRkQP2tWV=5P$##AOHafKwu>WjH-}{-C4C96?-fO3IY&- z00bZa0SG_<0uX=z1Rwx`)e&HvkoqPecXkxt|BLqklk)s)V|Dh4oj?Er5P$##AOHaf zKmY;|fWW^MXy_=H$~b1MMAJ25WN4Q?vT4_KbRIR`jxp+j(&2FEmw%`GQReq@%9NxL zOGL_9?sv5tH0bogfH<~nbjA7M^FC*Wd4c32H8PeW_ku9v~0@U&sMDKqzX dXm2tnGSVbsPM?eEgUBqMlNOtuwT~_d`36w~gR}qu literal 0 HcmV?d00001 diff --git a/modules/lifepod/skins/xe_official/css/common.css b/modules/lifepod/skins/xe_official/css/common.css new file mode 100644 index 000000000..0946ae080 --- /dev/null +++ b/modules/lifepod/skins/xe_official/css/common.css @@ -0,0 +1,97 @@ +@charset "utf-8"; + +/* board Title */ +.boardHeader { border:1px solid #e1e1dd; border-bottom:none; background:#ffffff url(../images/common/bgH3.gif) repeat-x left bottom; overflow:hidden; _width:100%;} +.boardHeader h3 { float:left; font-size:1.2em; padding:1em 2em .7em 1.2em; background:#ffffff url(../images/common/lineH3.gif) no-repeat right bottom;} + +/* board Information */ +.boardInformation { width:100%; clear:both; margin:1em 0 .5em 0; overflow:hidden; color:#666666;} +.articleNum { float:left; padding:0 0 0 15px; } + +.CalendarViewDay +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#8888cc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarView4Day +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#8888cc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarViewWeek +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#8888cc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarView2Week +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#8888cc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarViewMonth +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#8888cc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarMoveToday +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#cccccc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarMoveNext +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#cccccc; + cursor: pointer; + margin-right: 2px; +} + +.CalendarMovePrev +{ + font-size:0.9em; + background-color:#FFFFFF; + border-style:solid; + border-width:1px; + border-color:#cccccc; + cursor: pointer; + margin-right: 2px; +} diff --git a/modules/lifepod/skins/xe_official/js/lifepod.js b/modules/lifepod/skins/xe_official/js/lifepod.js new file mode 100644 index 000000000..81e281763 --- /dev/null +++ b/modules/lifepod/skins/xe_official/js/lifepod.js @@ -0,0 +1,55 @@ +var _calendar; +var entries = new Array(); +var _year; +var _month; +var _day; + +function startLifepod() +{ + //초기화 + //Calendar.Language = 'en'; //영어버전 + //객체를 생성, 인자는 캘린더로 변할 DIV의 ID + _calendar=new Calendar('div_calendar'); + //콘트롤 추가(보기 방식, 기간 이동) + _calendar.addControl(new Calendar.Control.View); + _calendar.addControl(new Calendar.Control.Move); + //이벤트 추가 + _calendar.attachEvent('drawFinish', entryDraw); //캘린더가 그려지면 호출할 함수, 주로 엔트리 추가시 사용된다 + _calendar.attachEvent('entryMove', entryMove); // 엔트리를 이동할 때 호출할 함수 + //그리기 + _calendar.draw(); +} + +function calAdd(id, start, end, title, description, type, category, color) +{ + entries.push(new Calendar.Entry(id, category, Calendar.str2date(start), Calendar.str2date(end), type, title, description, color)); +} + +function setDate(year, month, day) +{ + _year = year; + _month = month; + _day = day; +} + +function entryDraw() { + //생성한 엔트리를 추가 + for(entry in entries) + { + _calendar.addEntry(entries[entry]); + } + + if(_year != undefined) + { + _calendar.date.setFullYear(_year); + _calendar.date.setMonth(_month-1); + _calendar.date.setDate(_day); + _year = undefined; + _calendar.draw(); + } +} + +function entryMove() { + //true를 리턴하면 엔트리가 이동이 됨, false를 리턴하면 엔트리 이동이 취소됨 + return true; +} diff --git a/modules/lifepod/skins/xe_official/js/xe_interface.js b/modules/lifepod/skins/xe_official/js/xe_interface.js new file mode 100644 index 000000000..cd8507afb --- /dev/null +++ b/modules/lifepod/skins/xe_official/js/xe_interface.js @@ -0,0 +1,23 @@ +Calendar.ControlAction=function(C){ +var curYear = _CalendarInstances[arguments[1].parentNode.objID].date.getYear(); +{switch(C) +{case"view":_CalendarInstances[arguments[1].parentNode.objID].changeView(arguments[2]); +break; +case"move":switch(arguments[2]){case"prev":_CalendarInstances[arguments[1].parentNode.objID].movePrev(); +break; +case"next":_CalendarInstances[arguments[1].parentNode.objID].moveNext(); +break; +case"today":_CalendarInstances[arguments[1].parentNode.objID].moveToday(); +break}break; +case"plugin": + if(_CalendarInstances[arguments[1].parentNode.objID].plugin[arguments[2]]&&_CalendarInstances[arguments[1].parentNode.objID].plugin[arguments[2]].controlAction) + { + var A=[]; + for(var B=3; B + + + + + + + + + + + {$module_info->header_text} + + + +
+

{$module_info->title}

+
+ +
+ +
+ + + +{$module_info->footer_text} diff --git a/modules/lifepod/skins/xe_official/message.html b/modules/lifepod/skins/xe_official/message.html new file mode 100644 index 000000000..eca9925a4 --- /dev/null +++ b/modules/lifepod/skins/xe_official/message.html @@ -0,0 +1,7 @@ +
+ {$message} +
+ + + {$lang->cmd_login} + diff --git a/modules/lifepod/skins/xe_official/skin.xml b/modules/lifepod/skins/xe_official/skin.xml new file mode 100644 index 000000000..aacfbce4d --- /dev/null +++ b/modules/lifepod/skins/xe_official/skin.xml @@ -0,0 +1,19 @@ + + + 라이프팟 연동 기본 스킨 + Lifepod Module Basic Skin + + haneul + haneul + 라이프팟 노트 연동 모듈의 기본 스킨 + Default Skin of Lifepod Module + + + + 게시판 제목 + Title of Board + 게시판의 제목을 적어주세요. + Please input the title of board. + + + diff --git a/modules/lifepod/tpl/filter/delete_lifepod.xml b/modules/lifepod/tpl/filter/delete_lifepod.xml new file mode 100644 index 000000000..81977e956 --- /dev/null +++ b/modules/lifepod/tpl/filter/delete_lifepod.xml @@ -0,0 +1,10 @@ + +
+ + + + + + + +
diff --git a/modules/lifepod/tpl/filter/insert_grant.xml b/modules/lifepod/tpl/filter/insert_grant.xml new file mode 100644 index 000000000..e4a05108f --- /dev/null +++ b/modules/lifepod/tpl/filter/insert_grant.xml @@ -0,0 +1,11 @@ + +
+ + + + + + + + +
diff --git a/modules/lifepod/tpl/filter/insert_lifepod.xml b/modules/lifepod/tpl/filter/insert_lifepod.xml new file mode 100644 index 000000000..0ef7946ad --- /dev/null +++ b/modules/lifepod/tpl/filter/insert_lifepod.xml @@ -0,0 +1,32 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/lifepod/tpl/grant_list.html b/modules/lifepod/tpl/grant_list.html new file mode 100644 index 000000000..e57483ab8 --- /dev/null +++ b/modules/lifepod/tpl/grant_list.html @@ -0,0 +1,38 @@ + + + +
{nl2br($lang->about_grant)}
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + +
{$lang->target}
{$val->title} + + grants[$key])&&in_array($v->group_srl,$module_info->grants[$key]))-->checked="checked"/> + + + {$lang->cmd_select_all}{$lang->cmd_unselect_all}
+ +
+ + diff --git a/modules/lifepod/tpl/header.html b/modules/lifepod/tpl/header.html new file mode 100644 index 000000000..5aedd5350 --- /dev/null +++ b/modules/lifepod/tpl/header.html @@ -0,0 +1,25 @@ + + +

{$lang->lifepod} {$lang->cmd_management}

+ +
{nl2br($lang->about_lifepod)}
+ + +
+ +

{$module_info->mid} ({$lang->is_default}) | View

+ + + +
+ + diff --git a/modules/lifepod/tpl/index.html b/modules/lifepod/tpl/index.html new file mode 100644 index 000000000..187304793 --- /dev/null +++ b/modules/lifepod/tpl/index.html @@ -0,0 +1,79 @@ + + + +
+ Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)} +
+ + + +++++++ + + + + + + + + + + + + + + + + + + + + + +
{$lang->no} +
+ + + + +
+
{$lang->mid} / {$lang->browser_title}{$lang->regdate}{$lang->cmd_view}{$lang->cmd_delete}
{$no} + + {$lang->not_exists} + + {$module_category[$val->module_category_srl]->title} + + + {$val->mid} - + {htmlspecialchars($val->browser_title)} + {zdate($val->regdate,"Y-m-d")}{$lang->cmd_view}{$lang->cmd_delete}
+ + + + + + diff --git a/modules/lifepod/tpl/js/lifepod_admin.js b/modules/lifepod/tpl/js/lifepod_admin.js new file mode 100644 index 000000000..1486c17f0 --- /dev/null +++ b/modules/lifepod/tpl/js/lifepod_admin.js @@ -0,0 +1,79 @@ +/** + * @file modules/lifepod/js/lifepod_admin.js + * @author haneul (haneul0318@gmail.com) + * @brief lifepod 모듈의 관리자용 javascript + **/ + +/* 모듈 생성 후 */ +function completeInsertLifepod(ret_obj) { + var error = ret_obj['error']; + var message = ret_obj['message']; + + var page = ret_obj['page']; + var module_srl = ret_obj['module_srl']; + + alert(message); + + var url = current_url.setQuery('act','dispLifepodAdminLifepodInfo'); + if(module_srl) url = url.setQuery('module_srl',module_srl); + if(page) url.setQuery('page',page); + location.href = url; +} + +/* 모듈 삭제 후 */ +function completeDeleteLifepod(ret_obj) { + var error = ret_obj['error']; + var message = ret_obj['message']; + var page = ret_obj['page']; + alert(message); + + var url = current_url.setQuery('act','dispLifepodAdminContent').setQuery('module_srl',''); + if(page) url = url.setQuery('page',page); + location.href = url; +} + +/* 권한 관련 */ +function doSelectAll(obj, key) { + var fo_obj = obj.parentNode; + while(fo_obj.nodeName != 'FORM') { + fo_obj = fo_obj.parentNode; + } + + for(var i=0;i + + + +
+ + + + + + + + + + + + + + + + + + + + +
{$lang->confirm_delete}
{$lang->module_name}{$module_info->mid}
{$lang->module}{$module_info->module}
+ {$lang->cmd_back} + +
+ +
diff --git a/modules/lifepod/tpl/lifepod_info.html b/modules/lifepod/tpl/lifepod_info.html new file mode 100644 index 000000000..a05b4f532 --- /dev/null +++ b/modules/lifepod/tpl/lifepod_info.html @@ -0,0 +1,75 @@ + + + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->module_category} + + {$lang->not_exists} + + {$module_category[$module_info->module_category_srl]->title} + +
{$lang->calendar_address}{$module_info->calendar_address} 
{$lang->layout} + + {$module_info->layout_title} ({$module_info->layout}) + + {$lang->not_exists} + +   +
{$lang->skin}{$module_info->skin_title} ({$module_info->skin})
{$lang->browser_title}{htmlspecialchars($module_info->browser_title)}
{$lang->use_category}{$lang->use}{$lang->notuse}
{$lang->list_count}{$module_info->list_count?$module_info->list_count:20}
{$lang->page_count}{$module_info->page_count?$module_info->page_count:10}
{$lang->description}{nl2br(htmlspecialchars($module_info->description))} 
{$lang->header_text}{htmlspecialchars($module_info->header_text)} 
{$lang->footer_text}{htmlspecialchars($module_info->footer_text)} 
{$lang->admin_id}{implode(",",$module_info->admin_id)} 
+ {$lang->cmd_modify} + + {$lang->cmd_lifepod_list} + +
diff --git a/modules/lifepod/tpl/lifepod_insert.html b/modules/lifepod/tpl/lifepod_insert.html new file mode 100644 index 000000000..8f732ff8d --- /dev/null +++ b/modules/lifepod/tpl/lifepod_insert.html @@ -0,0 +1,119 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->mid} + +

{$lang->about_mid}

+
{$lang->is_default} + is_default=='Y')-->checked="checked" id="fld_for_default" class="checkbox" /> + +
{$lang->module_category} + +

{$lang->about_module_category}

+
{$lang->calendar_address} + +
{$lang->browser_title} + +

{$lang->about_browser_title}

+
{$lang->layout} + +

{$lang->about_layout}

+
{$lang->skin} + +

{$lang->about_skin}

+
{$lang->description} + +

{$lang->about_description}

+
{$lang->header_text} + +

{$lang->about_header_text}

+
{$lang->footer_text} + +

{$lang->about_footer_text}

+
{$lang->admin_id} + +

{$lang->about_admin_id}

+
+ +
+ +
diff --git a/modules/lifepod/tpl/skin_info.html b/modules/lifepod/tpl/skin_info.html new file mode 100644 index 000000000..732a24cb8 --- /dev/null +++ b/modules/lifepod/tpl/skin_info.html @@ -0,0 +1,116 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->skin_default_info}
{$lang->skin}{$skin_info->title}
{$lang->skin_maker}{$skin_info->maker->name} ({$skin_info->maker->email_address})
{$lang->skin_maker_homepage}{$skin_info->maker->homepage}
{$lang->date}{$skin_info->maker->date}
{$lang->description}{nl2br($skin_info->maker->description)}
+ + + + + + + + + + + + + + + + + + + +
{$lang->extra_vars}
{$lang->colorset} + +
+ + {$val->title} + + + colorset==$val->name)-->checked="checked"/> + +
+ +
{$val->title} + + + + + + + + + + + + + value))-->checked="checked" class="checkbox" /> + + + + + + + + value)-->checked="checked"/> + + + + + + + +
+
+ + +
+ + + + + + +

{nl2br($val->description)}

+ +
+ +
+
+ +