From 3df305be0fd63adac0ebe4f390a52f1d985d4dfb Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 24 Apr 2007 02:16:45 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1289 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/blog/blog.view.php | 41 +----------------------- modules/blog/conf/module.xml | 1 - modules/board/board.view.php | 42 +------------------------ modules/board/conf/module.xml | 1 - modules/rss/conf/module.xml | 4 ++- modules/rss/rss.class.php | 9 ++---- modules/rss/rss.view.php | 59 ++++++++++++++++++++--------------- 7 files changed, 42 insertions(+), 115 deletions(-) diff --git a/modules/blog/blog.view.php b/modules/blog/blog.view.php index 82220a154..55739dd64 100644 --- a/modules/blog/blog.view.php +++ b/modules/blog/blog.view.php @@ -104,7 +104,7 @@ Context::set('layout_info',$this->module_info); // rss url - if($this->module_info->open_rss != 'N') Context::set('rss_url', getUrl('','mid',$this->mid,'act','dispBoardRss')); + if($this->module_info->open_rss != 'N') Context::set('rss_url', getUrl('','mid',$this->mid,'act','dispRss')); } /** @@ -376,45 +376,6 @@ $this->setTemplateFile('message'); } - /** - * @brief RSS 출력 - **/ - function dispBlogRss() { - // 권한 체크 - if(!$this->grant->list) return $this->dispBlogMessage('msg_not_permitted'); - - // 컨텐츠 추출 - $args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = $this->list_count; ///< 한페이지에 보여줄 글 수 - $args->page_count = $this->page_count; ///< 페이지 네비게이션에 나타날 페이지의 수 - - $args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...) - $args->search_keyword = Context::get('search_keyword'); ///< 검색어 - - $args->sort_index = 'list_order'; ///< 소팅 값 - - $oDocumentModel = &getModel('document'); - $output = $oDocumentModel->getDocumentList($args); - $document_list = $output->data; - - // rss 제목 및 정보등을 추출 - $info->title = Context::getBrowserTitle(); - $info->description = $this->module_info->description; - $info->language = Context::getLangType(); - $info->date = gmdate("D, d M Y H:i:s"); - $info->link = sprintf("%s?mid=%s", Context::getRequestUri(), Context::get('mid')); - $info->total_count = $output->total_count; - - // RSS 모듈을 불러서 출력할 내용을 지정 - $oRssView = &getView('rss'); - $oRssView->dispRss($info, $document_list); - - // RSS 모듈의 tempate을 가져옴 - $this->setTemplatePath($oRssView->getTemplatePath()); - $this->setTemplateFile($oRssView->getTemplateFile()); - } - /** * @brief 댓글의 editor 를 세팅 * 댓글의 경우 수정하는 경우가 아니라면 고유값이 없음.\n diff --git a/modules/blog/conf/module.xml b/modules/blog/conf/module.xml index 5fc47fe3c..b284f57bf 100644 --- a/modules/blog/conf/module.xml +++ b/modules/blog/conf/module.xml @@ -35,7 +35,6 @@ - diff --git a/modules/board/board.view.php b/modules/board/board.view.php index 7312bbaa2..14bcd1200 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -77,7 +77,7 @@ $this->setTemplatePath($template_path); // rss url - if($this->module_info->open_rss != 'N') Context::set('rss_url', getUrl('','mid',$this->mid,'act','dispBoardRss')); + if($this->module_info->open_rss != 'N') Context::set('rss_url', getUrl('','mid',$this->mid,'act','dispRss')); } /** @@ -354,46 +354,6 @@ $this->setTemplateFile('message'); } - /** - * @brief RSS 출력 - **/ - function dispBoardRss() { - // 권한 체크 - if(!$this->grant->list) return $this->dispBoardMessage('msg_not_permitted'); - - // 컨텐츠 추출 - $args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = $this->list_count; ///< 한페이지에 보여줄 글 수 - $args->page_count = $this->page_count; ///< 페이지 네비게이션에 나타날 페이지의 수 - - $args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...) - $args->search_keyword = Context::get('search_keyword'); ///< 검색어 - if($this->module_info->use_category=='Y') $args->category_srl = Context::get('category'); ///< 카테고리 사용시 선택된 카테고리 - - $args->sort_index = 'list_order'; ///< 소팅 값 - - $oDocumentModel = &getModel('document'); - $output = $oDocumentModel->getDocumentList($args); - $document_list = $output->data; - - // rss 제목 및 정보등을 추출 - $info->title = Context::getBrowserTitle(); - $info->description = $this->module_info->description; - $info->language = Context::getLangType(); - $info->date = gmdate("D, d M Y H:i:s"); - $info->link = sprintf("%s?mid=%s", Context::getRequestUri(), Context::get('mid')); - $info->total_count = $output->total_count; - - // RSS 모듈을 불러서 출력할 내용을 지정 - $oRssView = &getView('rss'); - $oRssView->dispRss($info, $document_list); - - // RSS 모듈의 tempate을 가져옴 - $this->setTemplatePath($oRssView->getTemplatePath()); - $this->setTemplateFile($oRssView->getTemplateFile()); - } - /** * @brief 댓글의 editor 를 세팅 * 댓글의 경우 수정하는 경우가 아니라면 고유값이 없음.\n diff --git a/modules/board/conf/module.xml b/modules/board/conf/module.xml index d912d239b..b80aa0c4b 100644 --- a/modules/board/conf/module.xml +++ b/modules/board/conf/module.xml @@ -39,7 +39,6 @@ - diff --git a/modules/rss/conf/module.xml b/modules/rss/conf/module.xml index c6a5127cb..5ab21a6aa 100644 --- a/modules/rss/conf/module.xml +++ b/modules/rss/conf/module.xml @@ -1,5 +1,7 @@ - + + + diff --git a/modules/rss/rss.class.php b/modules/rss/rss.class.php index 2e950d95d..05ff7534d 100644 --- a/modules/rss/rss.class.php +++ b/modules/rss/rss.class.php @@ -7,16 +7,13 @@ class rss extends ModuleObject { - var $default_rss_type = "rss20"; - var $rss_types = array( - "rss20" => "rss 2.0", - "rss10" => "rss 1.0", - ); - /** * @brief 설치시 추가 작업이 필요할시 구현 **/ function moduleInstall() { + // action forward에 등록 + $oModuleController = &getController('module'); + $oModuleController->insertActionForward('rss', 'view', 'dispRss'); return new Object(); } diff --git a/modules/rss/rss.view.php b/modules/rss/rss.view.php index 9b8532861..ec954dd2c 100644 --- a/modules/rss/rss.view.php +++ b/modules/rss/rss.view.php @@ -16,39 +16,48 @@ function init() { } - /** - * @brief 설정 - **/ - function dispRssAdminConfig() { - // 설정 정보를 받아옴 (module model 객체를 이용) - $oModuleModel = &getModel('module'); - $config = $oModuleModel->getModuleConfig('rss'); - Context::set('config',$config); - Context::set('rss_types',$this->rss_types); - - // 템플릿 파일 지정 - $this->setTemplatePath($this->module_path.'tpl'); - $this->setTemplateFile('index'); - } - /** * @brief RSS 출력 **/ - function dispRss($info, $content) { - // 설정 정보를 받아옴 (module model 객체를 이용) + function dispRss() { + // RSS를 출력하고자 하는 mid를 구함 (없으면 오류) + $mid = Context::get('mid'); + if(!$mid) return $this->dispError(); + + // 모듈의 설정 정보를 받아옴 (module model 객체를 이용) $oModuleModel = &getModel('module'); - $config = $oModuleModel->getModuleConfig('rss'); + $module_info = $oModuleModel->getModuleInfoByMid($mid); + if(!$module_info->mid != $mid) return $this->dispError(); // RSS 비활성화 되었는지 체크하여 비활성화시 에러 출력 - if($config->rss_disable=='Y') return $this->dispError(); + if($config->open_rss == 'N') return $this->dispError(); - // RSS 출력 형식을 체크 - $rss_type = $config->rss_type; - if(!$this->rss_types[$rss_type]) $rss_type = $this->default_rss_type; + // 출력할 컨텐츠 추출 + $args->module_srl = $module_info->module_srl; + $args->page = Context::get('page'); + $args->list_count = 20; + $args->page_count = 10; - if(count($content)) { + $args->search_target = Context::get('search_target'); + $args->search_keyword = Context::get('search_keyword'); + if($module_info->use_category=='Y') $args->category_srl = Context::get('category'); + $args->sort_index = 'list_order'; + + $oDocumentModel = &getModel('document'); + $output = $oDocumentModel->getDocumentList($args); + $document_list = $output->data; + + // rss 제목 및 정보등을 추출 + $info->title = Context::getBrowserTitle(); + $info->description = $this->module_info->description; + $info->language = Context::getLangType(); + $info->date = gmdate("D, d M Y H:i:s"); + $info->link = sprintf("%s?mid=%s", Context::getRequestUri(), Context::get('mid')); + $info->total_count = $output->total_count; + + if(count($document_list)) { $idx = 0; - foreach($content as $key => $item) { + foreach($document_list as $key => $item) { $year = substr($item->regdate,0,4); $month = substr($item->regdate,4,2); $day = substr($item->regdate,6,2); @@ -74,7 +83,7 @@ // 템플릿 파일 지정 $this->setTemplatePath($this->module_path.'tpl/'); - $this->setTemplateFile($rss_type); + $this->setTemplateFile('rss20'); } /**