git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-12 03:59:52 +00:00
commit 8326004cb2
2773 changed files with 91485 additions and 0 deletions

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">문서</title>
<title xml:lang="en">Document</title>
<title xml:lang="es">Documento</title>
<title xml:lang="zh-CN">主题</title>
<title xml:lang="jp">コンテンツ</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="en">Zero</name>
<name xml:lang="es">zero</name>
<name xml:lang="zh-CN">zero</name>
<name xml:lang="jp">Zero</name>
<description xml:lang="ko">게시판, 블로그등의 모듈에서 사용되는 문서를 관리하는 모듈입니다. </description>
<description xml:lang="en">Module for managing documents used in board, blog, etc.</description>
<description xml:lang="es">Es el módulo para manejar documentos en blog y boletínes.</description>
<description xml:lang="zh-CN">管理版面,博客等处主题的模块。 </description>
<description xml:lang="jp">掲示板、ブログなどのモジュルで使用されるドキュメント(書き込み)を管理するモジュルです。</description>
</author>
</module>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<actions>
<action name="dispDocumentPrint" type="view" standalone="true" />
<action name="dispDocumentPreview" type="view" standalone="true" />
<action name="dispDocumentAdminList" type="view" admin_index="true" standalone="true" />
<action name="procDocumentAdminDeleteChecked" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,255 @@
<?php
/**
* @class documentAdminController
* @author zero (zero@nzeo.com)
* @brief document 모듈의 admin controller 클래스
**/
class documentAdminController extends document {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 관리자 페이지에서 선택된 문서들 삭제
**/
function procDocumentAdminDeleteChecked() {
// 선택된 글이 없으면 오류 표시
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$document_srl_list= explode('|@|', $cart);
$document_count = count($document_srl_list);
if(!$document_count) return $this->stop('msg_cart_is_null');
// 글삭제
$oDocumentController = &getController('document');
for($i=0;$i<$document_count;$i++) {
$document_srl = trim($document_srl_list[$i]);
if(!$document_srl) continue;
$oDocumentController->deleteDocument($document_srl, true);
}
$this->setMessage( sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
}
/**
* @brief 특정 게시물들의 소속 모듈 변경 (게시글 이동시에 사용)
**/
function moveDocumentModule($document_srl_list, $module_srl, $source_module_srl) {
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
$oDB = &DB::getInstance();
$oDB->begin();
// 게시물의 이동
$output = executeQuery('document.updateDocumentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 댓글의 이동
$output = executeQuery('comment.updateCommentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 엮인글의 이동
$output = executeQuery('trackback.updateTrackbackModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 태그
$output = executeQuery('tag.updateTagModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 첨부파일의 이동 (다운로드나 본문 첨부의 문제로 인하여 첨부파일은 이동하지 않기로 결정. 차후에 다시 고민)
/*
$image_dir = sprintf('./files/attach/images/%s/%s/', $source_module_srl, $document_srl);
$binary_dir = sprintf('./files/attach/binaries/%s/%s/', $source_module_srl, $document_srl);
$target_image_dir = sprintf('./files/attach/images/%s/%s/', $module_srl, $document_srl);
$target_binary_dir = sprintf('./files/attach/binaries/%s/%s/', $module_srl, $document_srl);
if(is_dir($image_dir)) {
FileHandler::moveDir($image_dir, $target_image_dir);
if(!is_dir($target_image_dir)) {
$oDB->rollback();
return new Object(-1,'fail');
}
}
if(is_dir($binary_dir)) {
FileHandler::moveDir($binary_dir, $target_binary_dir);
if(!is_dir($target_binary_dir)) {
$oDB->rollback();
return new Object(-1,'fail');
}
}
*/
$oDB->commit();
return new Object();
}
/**
* @brief 특정 모듈의 전체 문서 삭제
**/
function deleteModuleDocument($module_srl) {
$args->module_srl = $module_srl;
$output = executeQuery('document.deleteModuleDocument', $args);
return $output;
}
/**
* @brief 카테고리 추가
**/
function insertCategory($module_srl, $title, $category_srl = 0) {
if(!$category_srl) $args->list_order = $args->category_srl = getNextSequence();
else $args->list_order = $args->category_srl = $category_srl;
$args->module_srl = $module_srl;
$args->title = $title;
$args->document_count = 0;
$output = executeQuery('document.insertCategory', $args);
if($output->toBool()) $output->add('category_srl', $args->category_srl);
return $output;
}
/**
* @brief 카테고리 정보 수정
**/
function updateCategory($args) {
return executeQuery('document.updateCategory', $args);
}
/**
* @brief 카테고리 삭제
**/
function deleteCategory($category_srl) {
$args->category_srl = $category_srl;
// 카테고리 정보를 삭제
$output = executeQuery('document.deleteCategory', $args);
if(!$output->toBool()) return $output;
// 현 카테고리 값을 가지는 문서들의 category_srl을 0 으로 세팅
unset($args);
$args->target_category_srl = 0;
$args->source_category_srl = $category_srl;
$output = executeQuery('document.updateDocumentCategory', $args);
return $output;
}
/**
* @brief 특정 모듈의 카테고리를 모두 삭제
**/
function deleteModuleCategory($module_srl) {
$args->module_srl = $module_srl;
$output = executeQuery('document.deleteModuleCategory', $args);
return $output;
}
/**
* @brief 카테고리를 상단으로 이동
**/
function moveCategoryUp($category_srl) {
$oDocumentModel = &getModel('document');
// 선택된 카테고리의 정보를 구한다
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args);
$category = $output->data;
$list_order = $category->list_order;
$module_srl = $category->module_srl;
// 전체 카테고리 목록을 구한다
$category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object();
$prev_category = NULL;
foreach($category_list as $key => $val) {
if($key==$category_srl) break;
$prev_category = $val;
}
// 이전 카테고리가 없으면 그냥 return
if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
// 선택한 카테고리가 가장 위의 카테고리이면 그냥 return
if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
// 선택한 카테고리의 정보
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $prev_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// 대상 카테고리의 정보
$prev_args->category_srl = $prev_category->category_srl;
$prev_args->list_order = $list_order;
$prev_args->title = $prev_category->title;
$this->updateCategory($prev_args);
return new Object();
}
/**
* @brief 카테고리를 아래로 이동
**/
function moveCategoryDown($category_srl) {
$oDocumentModel = &getModel('document');
// 선택된 카테고리의 정보를 구한다
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args);
$category = $output->data;
$list_order = $category->list_order;
$module_srl = $category->module_srl;
// 전체 카테고리 목록을 구한다
$category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object();
for($i=0;$i<count($category_srl_list);$i++) {
if($category_srl_list[$i]==$category_srl) break;
}
$next_category_srl = $category_srl_list[$i+1];
if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
$next_category = $category_list[$next_category_srl];
// 선택한 카테고리의 정보
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $next_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// 대상 카테고리의 정보
$next_args->category_srl = $next_category->category_srl;
$next_args->list_order = $list_order;
$next_args->title = $next_category->title;
$this->updateCategory($next_args);
return new Object();
}
}
?>

View file

@ -0,0 +1,81 @@
<?php
/**
* @class documentAdminView
* @author zero (zero@nzeo.com)
* @brief document 모듈의 admin view 클래스
**/
class documentAdminView extends document {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 목록 출력 (관리자용)
**/
function dispDocumentAdminList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 50; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
$args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...)
$args->search_keyword = Context::get('search_keyword'); ///< 검색어
$args->sort_index = 'list_order'; ///< 소팅 값
$args->module_srl = Context::get('module_srl');
// mid목록을 구함
$oModuleModel = &getModel('module');
$mid_list = $oModuleModel->getMidList();
Context::set('mid_list', $mid_list);
// 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
$oDocumentModel = &getModel('document');
$output = $oDocumentModel->getDocumentList($args);
// 목록의 loop를 돌면서 mid를 구하기 위한 module_srl값을 구함
$document_count = count($output->data);
$module_srl_list = array();
if($document_count) {
foreach($output->data as $key => $val) {
$module_srl = $val->module_srl;
if(!in_array($module_srl, $module_srl_list)) $module_srl_list[] = $module_srl;
}
if(count($module_srl_list)) {
$args->module_srls = implode(',',$module_srl_list);
$mid_output = executeQuery('module.getModuleInfoByModuleSrl', $args);
if($mid_output->data && !is_array($mid_output->data)) $mid_output->data = array($mid_output->data);
for($i=0;$i<count($mid_output->data);$i++) {
$mid_info = $mid_output->data[$i];
$module_list[$mid_info->module_srl] = $mid_info;
}
}
}
// 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('document_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('module_list', $module_list);
// 템플릿에서 사용할 검색옵션 세팅
$count_search_option = count($this->search_option);
for($i=0;$i<$count_search_option;$i++) {
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
}
Context::set('search_option', $search_option);
// 템플릿 지정
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_list');
}
}
?>

View file

@ -0,0 +1,76 @@
<?php
/**
* @class document
* @author zero (zero@nzeo.com)
* @brief document 모듈의 high 클래스
**/
require_once('./modules/document/document.item.php');
class document extends ModuleObject {
// 공지사항용 값
var $notice_list_order = -2100000000;
// 관리자페이지에서 사용할 검색 옵션
var $search_option = array('title','content','title_content','user_name',); ///< 검색 옵션
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController = &getController('module');
$oModuleController->insertActionForward('document', 'view', 'dispDocumentAdminList');
$oModuleController->insertActionForward('document', 'view', 'dispDocumentPrint');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
$oDB = &DB::getInstance();
/**
* 2007. 7. 23 : 확장변수(extra_vars1~20까지 추가)
**/
if(!$oDB->isColumnExists("documents","extra_vars20")) return true;
/**
* 2007. 7. 25 : 알림 필드(notify_message) 추가
**/
if(!$oDB->isColumnExists("documents","notify_message")) return true;
return false;
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
/**
* 2007. 7. 23 : 확장변수(extra_vars1~20까지 추가)
**/
if(!$oDB->isColumnExists("documents","extra_vars20")) {
for($i=1;$i<=20;$i++) {
$column_name = "extra_vars".$i;
$oDB->addColumn('documents',$column_name,'text');
}
}
/**
* 2007. 7. 25 : 알림 필드(notify_message) 추가
**/
if(!$oDB->isColumnExists("documents","notify_message")) {
$oDB->addColumn('documents',"notify_message","char",1);
}
return new Object(0,'success_updated');
}
}
?>

View file

@ -0,0 +1,440 @@
<?php
/**
* @class documentController
* @author zero (zero@nzeo.com)
* @brief document 모듈의 controller 클래스
**/
class documentController extends document {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 문서의 권한 부여
* 세션값으로 접속상태에서만 사용 가능
**/
function addGrant($document_srl) {
$_SESSION['own_document'][$document_srl] = true;
}
/**
* @brief 문서 입력
**/
function insertDocument($obj, $manual_inserted = false) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 기본 변수들 정리
if($obj->is_secret!='Y') $obj->is_secret = 'N';
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
if($obj->lock_comment!='Y') $obj->lock_comment = 'N';
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
if($obj->notify_message != "Y") $obj->notify_message = "N";
// 내용의 경우 javascript, iframe제거
$obj->content = removeHackTag($obj->content);
// 자동저장용 필드 제거
unset($obj->_saved_doc_srl);
unset($obj->_saved_doc_title);
unset($obj->_saved_doc_content);
unset($obj->_saved_doc_message);
// file의 Model객체 생성
$oFileModel = &getModel('file');
// 첨부 파일의 갯수를 구함
$obj->uploaded_count = $oFileModel->getFilesCount($obj->document_srl);
// 카테고리가 있나 검사하여 없는 카테고리면 0으로 세팅
if($obj->category_srl) {
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
}
// 태그 처리
$oTagController = &getController('tag');
$obj->tags = $oTagController->insertTag($obj->module_srl, $obj->document_srl, $obj->tags);
// 글 입력
if(!$obj->readed_count) $obj->readed_count = 0;
$obj->update_order = $obj->list_order = $obj->document_srl * -1;
if($obj->password && !$obj->password_is_hashed) $obj->password = md5($obj->password);
// 공지사항일 경우 list_order에 무지막지한 값;;을 입력
if($obj->is_notice=='Y') $obj->list_order = $this->notice_list_order;
// 로그인 된 회원일 경우 회원의 정보를 입력
if(Context::get('is_logged')&&!$manual_inserted) {
$logged_info = Context::get('logged_info');
$obj->member_srl = $logged_info->member_srl;
$obj->user_id = $logged_info->user_id;
$obj->user_name = $logged_info->user_name;
$obj->nick_name = $logged_info->nick_name;
$obj->email_address = $logged_info->email_address;
$obj->homepage = $logged_info->homepage;
}
// DB에 입력
$output = executeQuery('document.insertDocument', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($obj->category_srl) $this->updateCategoryCount($obj->category_srl);
// 첨부 파일이 있었을 경우 해당 첨부파일들의 valid값을 Y로 변경
if($obj->uploaded_count) {
$oFileController = &getController('file');
$oFileController->setFilesValid($obj->document_srl);
}
// commit
$oDB->commit();
// 자동 저장 문서 삭제
if(!$manual_inserted) {
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc();
}
// return
$this->addGrant($obj->document_srl);
$output->add('document_srl',$obj->document_srl);
$output->add('category_srl',$obj->category_srl);
return $output;
}
/**
* @brief 문서 수정
**/
function updateDocument($source_obj, $obj) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 기본 변수들 정리
if($obj->is_secret!='Y') $obj->is_secret = 'N';
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
if($obj->lock_comment!='Y') $obj->lock_comment = 'N';
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
if($obj->notify_message != "Y") $obj->notify_message = "N";
$obj->content = removeHackTag($obj->content);
// 자동저장용 필드 제거
unset($obj->_saved_doc_srl);
unset($obj->_saved_doc_title);
unset($obj->_saved_doc_content);
unset($obj->_saved_doc_message);
// file의 Model객체 생성
$oFileModel = &getModel('file');
// 첨부 파일의 갯수를 구함
$obj->uploaded_count = $oFileModel->getFilesCount($obj->document_srl);
// 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅
if($source_obj->get('category_srl')!=$obj->category_srl) {
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
}
// 태그 처리
if($source_obj->get('tags') != $obj->tags) {
$oTagController = &getController('tag');
$obj->tags = $oTagController->insertTag($obj->module_srl, $obj->document_srl, $obj->tags);
}
// 수정
$obj->update_order = getNextSequence() * -1;
// 공지사항일 경우 list_order에 무지막지한 값을, 그렇지 않으면 document_srl*-1값을
if($obj->is_notice=='Y') $obj->list_order = $this->notice_list_order;
else $obj->list_order = $obj->document_srl*-1;
if($obj->password) $obj->password = md5($obj->password);
// 원본 작성인과 수정하려는 수정인이 동일할 시에 로그인 회원의 정보를 입력
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
if($source_obj->get('member_srl')==$logged_info->member_srl) {
$obj->member_srl = $logged_info->member_srl;
$obj->user_name = $logged_info->user_name;
$obj->nick_name = $logged_info->nick_name;
$obj->email_address = $logged_info->email_address;
$obj->homepage = $logged_info->homepage;
}
}
// 로그인한 유저가 작성한 글인데 nick_name이 없을 경우
if($source_obj->get('member_srl')&& !$obj->nick_name) {
$obj->member_srl = $source_obj->get('member_srl');
$obj->user_name = $source_obj->get('user_name');
$obj->nick_name = $source_obj->get('nick_name');
$obj->email_address = $source_obj->get('email_address');
$obj->homepage = $source_obj->get('homepage');
}
// DB에 입력
$output = executeQuery('document.updateDocument', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($source_obj->get('category_srl')!=$obj->category_srl) {
if($source_obj->get('category_srl')) $this->updateCategoryCount($source_obj->get('category_srl'));
if($obj->category_srl) $this->updateCategoryCount($obj->category_srl);
}
// 첨부 파일이 있었을 경우 해당 첨부파일들의 valid값을 Y로 변경
if($obj->uploaded_count) {
$oFileController = &getController('file');
$oFileController->setFilesValid($obj->document_srl);
}
// 자동 저장 문서 삭제
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc();
// commit
$oDB->commit();
$output->add('document_srl',$obj->document_srl);
return $output;
}
/**
* @brief 문서 삭제
**/
function deleteDocument($document_srl, $is_admin = false) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// document의 model 객체 생성
$oDocumentModel = &getModel('document');
// 기존 문서가 있는지 확인
$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
// 권한이 있는지 확인
if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
// 글 삭제
$args->document_srl = $document_srl;
$output = executeQuery('document.deleteDocument', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 댓글 삭제
$oCommentController = &getController('comment');
$output = $oCommentController->deleteComments($document_srl, $is_admin);
// 엮인글 삭제
$oTrackbackController = &getController('trackback');
$output = $oTrackbackController->deleteTrackbacks($document_srl, $is_admin);
// 태그 삭제
$oTagController = &getController('tag');
$oTagController->deleteTag($document_srl, $is_admin);
// 첨부 파일 삭제
if($oDocument->hasUploadedFiles()) {
$oFileController = &getController('file');
$oFileController->deleteFiles($document_srl);
}
// 카테고리가 있으면 카테고리 정보 변경
if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('category_srl'));
// commit
$oDB->commit();
return $output;
}
/**
* @brief 해당 document의 조회수 증가
**/
function updateReadedCount($oDocument) {
$document_srl = $oDocument->document_srl;
$member_srl = $oDocument->get('member_srl');
$logged_info = Context::get('logged_info');
// session에 정보로 조회수를 증가하였다고 생각하면 패스
if($_SESSION['readed_document'][$document_srl]) return false;
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
if($document->ipaddress == $_SERVER['REMOTE_ADDR']) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
// document의 작성자가 회원일때 조사
if($member_srl) {
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
if($member_srl && $logged_info->member_srl == $member_srl) {
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
}
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
if($logged_info->member_srl) {
$args->member_srl = $logged_info->member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
// 로그 정보에 조회 로그가 있으면 세션 등록후 패스
if($output->data->count) return $_SESSION['readed_document'][$document_srl] = true;
// 조회수 업데이트
$output = executeQuery('document.updateReadedCount', $args);
// 로그 남기기
$output = executeQuery('document.insertDocumentReadedLog', $args);
// 세션 정보에 남김
return $_SESSION['readed_document'][$document_srl] = true;
}
/**
* @brief 해당 document의 추천수 증가
**/
function updateVotedCount($document_srl) {
// 세션 정보에 추천 정보가 있으면 중단
if($_SESSION['voted_document'][$document_srl]) return new Object(-1, 'failed_voted');
// 문서 원본을 가져옴
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
$_SESSION['voted_document'][$document_srl] = true;
return new Object(-1, 'failed_voted');
}
// document의 작성자가 회원일때 조사
if($oDocument->get('member_srl')) {
// member model 객체 생성
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
if($member_srl && $member_srl == $oDocument->get('member_srl')) {
$_SESSION['voted_document'][$document_srl] = true;
return new Object(-1, 'failed_voted');
}
}
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
if($member_srl) {
$args->member_srl = $member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
// 로그 정보에 추천 로그가 있으면 세션 등록후 패스
if($output->data->count) {
$_SESSION['voted_document'][$document_srl] = true;
return new Object(-1, 'failed_voted');
}
// 추천수 업데이트
$output = executeQuery('document.updateVotedCount', $args);
// 로그 남기기
$output = executeQuery('document.insertDocumentVotedLog', $args);
// 세션 정보에 남김
$_SESSION['voted_document'][$document_srl] = true;
// 결과 리턴
return new Object(0, 'success_voted');
}
/**
* @brief 해당 document의 댓글 증가
**/
function updateCommentCount($document_srl, $comment_count, $comment_inserted = false) {
$args->document_srl = $document_srl;
$args->comment_count = $comment_count;
if($comment_inserted) $args->update_order = -1*getNextSequence();
return executeQuery('document.updateCommentCount', $args);
}
/**
* @brief 해당 document의 엮인글 수증가
**/
function updateTrackbackCount($document_srl, $trackback_count) {
$args->document_srl = $document_srl;
$args->trackback_count = $trackback_count;
return executeQuery('document.updateTrackbackCount', $args);
}
/**
* @brief 카테고리에 문서의 숫자를 변경
**/
function updateCategoryCount($category_srl, $document_count = 0) {
// document model 객체 생성
$oDocumentModel = &getModel('document');
if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($category_srl);
$args->category_srl = $category_srl;
$args->document_count = $document_count;
return executeQuery('document.updateCategoryCount', $args);
}
/**
* @brief document의 20 확장변수를 xml js filter 적용을 위해 직접 적용
* 모듈정보를 받아서 20개의 확장변수를 체크하여 type, required등의 값을 체크하여 header에 javascript 코드 추가
**/
function addXmlJsFilter($module_info) {
$extra_vars = $module_info->extra_vars;
if(!$extra_vars) return;
$js_code = "";
foreach($extra_vars as $key => $val) {
$js_code .= sprintf('alertMsg["extra_vars%d"] = "%s";', $key, $val->name);
$js_code .= sprintf('extra_vars[extra_vars.length] = "extra_vars%d";', $key);
$js_code .= sprintf('target_type_list["extra_vars%d"] = "%s";', $key, $val->type);
if($val->is_required == 'Y') $js_code .= sprintf('notnull_list[notnull_list.length] = "extra_vars%s";',$key);
}
$js_code = "<script type=\"text/javascript\">//<![CDATA[\n".$js_code."\n//]]></script>";
Context::addHtmlHeader($js_code);
}
}
?>

View file

@ -0,0 +1,349 @@
<?php
/**
* @class documentItem
* @author zero (zero@nzeo.com)
* @brief document 객체
**/
class documentItem extends Object {
var $document_srl = 0;
function documentItem($document_srl = 0) {
$this->document_srl = $document_srl;
$this->_loadFromDB();
}
function setDocument($document_srl) {
$this->document_srl = $document_srl;
$this->_loadFromDB();
}
function _loadFromDB() {
if(!$this->document_srl) return;
$args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocument', $args);
$this->setAttribute($output->data);
}
function setAttribute($attribute) {
if(!$attribute->document_srl || !$attribute->content) {
$this->document_srl = null;
return;
}
$this->document_srl = $attribute->document_srl;
$this->adds($attribute);
// 태그 정리
if($this->get('tags')) {
$tags = explode(',',$this->get('tags'));
$tag_count = count($tags);
for($i=0;$i<$tag_count;$i++) if(trim($tags[$i])) $tag_list[] = trim($tags[$i]);
$this->add('tag_list', $tag_list);
}
}
function isExists() {
return $this->document_srl ? true : false;
}
function isGranted() {
if($_SESSION['own_document'][$this->document_srl]) return true;
if(!Context::get('is_logged')) return false;
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y') return true;
if($this->get('member_srl') && $this->get('member_srl') == $logged_info->member_srl) return true;
return false;
}
function setGrant() {
$_SESSION['own_document'][$this->document_srl] = true;
}
function isAccessible() {
return $_SESSION['accessible'][$this->document_srl]==true?true:false;
}
function allowComment() {
return $this->get('allow_comment') == 'Y' || !$this->isExists() ? true : false;
}
function allowTrackback() {
return $this->get('allow_trackback') == 'Y' || !$this->isExists() ? true : false;
}
function isLocked() {
return $this->get('lock_comment') == 'Y' ? true : false;
}
function isEditable() {
if($this->isGranted() || !$this->get('member_srl')) return true;
return false;
}
function isSecret() {
return $this->get('is_secret') == 'Y' ? true : false;
}
function isNotice() {
return $this->get('is_notice') == 'Y' ? true : false;
}
function useNotify() {
return $this->get('notify_message')=='Y' ? true : false;
}
function notify($type, $content) {
// useNotify가 아니면 return
if(!$this->useNotify()) return;
// 글쓴이가 로그인 유저가 아니면 패스~
if(!$this->get('member_srl')) return;
// 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return
$logged_info = Context::get('logged_info');
if($logged_info->member_srl == $this->get('member_srl')) return;
// 변수 정리
if($type) $title = "[".$type."] ";
$title .= cut_str(strip_tags($content), 10, '...');
$content = sprintf('%s<br /><br />from : <a href="%s" onclick="window.open(this.href);return false;">%s</a>',$content, $this->getPermanentUrl(), $this->getPermanentUrl());
$receiver_srl = $this->get('member_srl');
$sender_member_srl = $logged_info->member_srl;
// 쪽지 발송
$oMemberController = &getController('member');
$oMemberController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
}
function getUserID() {
return htmlspecialchars($this->get('user_id'));
}
function getUserName() {
return htmlspecialchars($this->get('user_name'));
}
function getNickName() {
return htmlspecialchars($this->get('nick_name'));
}
function getTitleText($cut_size = 0, $tail='...') {
return htmlspecialchars($this->getTitle($cut_size, $tail));
}
function getTitle($cut_size = 0, $tail='...') {
if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret');
if($cut_size) return cut_str($this->get('title'), $cut_size, $tail);
return $this->get('title');
}
function getContentText($strlen = 0) {
if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret');
$_SESSION['accessible'][$this->document_srl] = true;
$content = $this->get('content');
if($strlen) return cut_str(strip_tags($content),$strlen,'...');
return htmlspecialchars($content);
}
function getContent($add_document_info = true) {
if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret');
$_SESSION['accessible'][$this->document_srl] = true;
$content = $this->get('content');
if($add_document_info) return sprintf('<!--BeforeDocument(%d,%d)-->%s<!--AfterDocument(%d,%d)-->', $this->document_srl, $this->get('member_srl'), $content, $this->document_srl, $this->get('member_srl'));
return $content;
}
function getSummary($str_size = 50) {
$content = htmlspecialchars(strip_tags($this->get('content')));
return cut_str($content, $str_size, '...');
}
function getRegdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('regdate'), $format);
}
function getRegdateTime() {
$year = substr($this->get('regdate'),0,4);
$month = substr($this->get('regdate'),4,2);
$day = substr($this->get('regdate'),6,2);
$hour = substr($this->get('regdate'),8,2);
$min = substr($this->get('regdate'),10,2);
$sec = substr($this->get('regdate'),12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getRegdateGM() {
return gmdate("D, d M Y H:i:s", $this->getRegdateTime());
}
function getUpdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('last_update'), $format);
}
function getUpdateTime() {
$year = substr($this->get('last_update'),0,4);
$month = substr($this->get('last_update'),4,2);
$day = substr($this->get('last_update'),6,2);
$hour = substr($this->get('last_update'),8,2);
$min = substr($this->get('last_update'),10,2);
$sec = substr($this->get('last_update'),12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getUpdateGM() {
return gmdate("D, d M Y H:i:s", $this->getUpdateTime());
}
function getPermanentUrl() {
return getUrl('','document_srl',$this->document_srl);
}
function getTrackbackUrl() {
return getUrl('','document_srl',$this->document_srl,'act','trackback');
}
function updateReadedCount() {
$oDocumentController = &getController('document');
if($oDocumentController->updateReadedCount($this)) {
$readed_count = $this->get('readed_count');
$readed_count++;
$this->add('readed_count', $readed_count);
}
}
function isExtraVarsExists() {
for($i=1;$i<=20;$i++) {
if($this->get('extra_vars'.$i)) return true;
}
return false;
}
function getExtraValue($key) {
$val = $this->get('extra_vars'.$key);
if(strpos($val,'|@|')!==false) $val = explode('|@|', $val);
return $val;
}
function getCommentCount() {
if(!$this->isGranted() && $this->isSecret()) return 0;
return $this->get('comment_count');
}
function getComments() {
if(!$this->allowComment() || !$this->get('comment_count')) return;
if(!$this->isGranted() && $this->isSecret()) return;
$oCommentModel = &getModel('comment');
return $oCommentModel->getCommentList($this->document_srl, $is_admin);
}
function getTrackbackCount() {
return $this->get('trackback_count');
}
function getTrackbacks() {
if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
$oTrackbackModel = &getModel('trackback');
return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
}
function thumbnailExists($width) {
if(!$this->getThumbnail($width)) return false;
return true;
}
function getThumbnail($width = 80) {
// 문서의 이미지 첨부파일 위치를 구함
$document_path = sprintf('./files/attach/images/%d/%d/',$this->get('module_srl'), $this->get('document_srl'));
if(!is_dir($document_path)) FileHandler::makeDir($document_path);
// 썸네일 임시 파일명을 구함
$thumbnail_file = sprintf('%sthumbnail_%d.jpg', $document_path, $width);
// 썸네일이 있더라도 글의 수정시간과 비교해서 다르면 다시 생성함
if(file_exists($thumbnail_file)) {
$file_created_time = date("YmdHis",filectime($thumbnail_file));
$modified_time = $this->get('last_update');
if($modified_time > $file_created_time) @unlink($thumbnail_file);
}
if(file_exists($thumbnail_file)&&filesize($thumbnail_file)<1) return;
// 썸네일 파일이 있으면 url return
if(file_exists($thumbnail_file)) return Context::getRequestUri().$thumbnail_file;
// 생성 시작
FileHandler::writeFile($thumbnail_file, '', 'w');
// 첨부파일이 있는지 확인하고 있으면 썸네일 만듬
$file_list = FileHandler::readDir($document_path);
if(count($file_list)) {
foreach($file_list as $key => $val) {
if(eregi("^thumbnail_([0-9]+)\.(jpg|gif)$",$val)) continue;
if(!eregi("\.(jpg|gif|png|jpeg)$", $val)) continue;
$filename = sprintf("%s%s",$document_path,$val);
if(file_exists($filename)) {
FileHandler::createImageFile($filename, $thumbnail_file, $width, $width, 'jpg');
if(file_exists($thumbnail_file)) return Context::getRequestUri().$thumbnail_file;
}
}
}
// 첨부파일이 없으면 내용에서 추출
$content = $this->get('content');
preg_match_all("!http:\/\/([^ ^\"^']*?)\.(jpg|png|gif|jpeg)!is", $content, $matches, PREG_SET_ORDER);
for($i=0;$i<count($matches);$i++) {
$src = $matches[$i][0];
if(strpos($src,"/common/tpl")!==false || strpos($src,"/modules")!==false) continue;
break;
}
$tmp_file = sprintf('%sthumbnail_%d.tmp.jpg', $document_path, $width);
if($src) FileHandler::getRemoteFile($src, $tmp_file);
else {
FileHandler::writeFile($thumbnail_file,'');
return;
}
FileHandler::createImageFile($tmp_file, $thumbnail_file, $width, $width, 'jpg');
@unlink($tmp_file);
return Context::getRequestUri().$thumbnail_file;
}
function hasUploadedFiles() {
if($this->isSecret() && !$this->isGranted()) return false;
return $this->get('uploaded_count')? true : false;
}
function getUploadedFiles() {
if($this->isSecret() && !$this->isGranted()) return;
if(!$this->get('uploaded_count')) return;
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($this->document_srl, $is_admin);
return $file_list;
}
}
?>

View file

@ -0,0 +1,316 @@
<?php
/**
* @class documentModel
* @author zero (zero@nzeo.com)
* @brief document 모듈의 model 클래스
**/
class documentModel extends document {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief document에 대한 권한을 세션값으로 체크
**/
function isGranted($document_srl) {
return $_SESSION['own_document'][$document_srl];
}
/**
* @brief 문서 가져오기
**/
function getDocument($document_srl, $is_admin = false) {
$oDocument = new documentItem($document_srl);
if($is_admin) $oDocument->setGrant();
return $oDocument;
}
/**
* @brief 여러개의 문서들을 가져옴 (페이징 아님)
**/
function getDocuments($document_srls, $is_admin = false) {
if(is_array($document_srls)) $document_srls = implode(',',$document_srls);
// DB에서 가져옴
$args->document_srls = $document_srls;
$output = executeQuery('document.getDocuments', $args);
$document_list = $output->data;
if(!$document_list) return;
if(!is_array($document_list)) $document_list = array($document_list);
$document_count = count($document_list);
foreach($document_list as $key => $attribute) {
if(!$attribute->document_srl) continue;
$oDocument = null;
$oDocument = new documentItem();
$oDocument->setAttribute($attribute);
if($is_admin) $oDocument->setGrant();
$result[$attribute->document_srl] = $oDocument;
}
return $result;
}
/**
* @brief module_srl값을 가지는 문서의 목록을 가져옴
**/
function getDocumentList($obj) {
// 정렬 대상과 순서 체크
if(!in_array($obj->sort_index, array('list_order','regdate','last_update','update_order','readed_count','voted_count'))) $obj->sort_index = 'list_order';
if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
if($obj->mid) {
$oModuleModel = &getModel('module');
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
// 변수 체크
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
$args->sort_index = $obj->sort_index;
$args->order_type = $obj->order_type;
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->start_date = $obj->start_date?$obj->start_date:null;
$args->end_date = $obj->end_date?$obj->end_date:null;
$query_id = 'document.getDocumentList';
// 검색 옵션 정리
$search_target = $obj->search_target;
$search_keyword = $obj->search_keyword;
if($search_target && $search_keyword) {
switch($search_target) {
case 'title' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_title = $search_keyword;
break;
case 'content' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_content = $search_keyword;
break;
case 'title_content' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_title = $search_keyword;
$args->s_content = $search_keyword;
break;
case 'user_id' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_user_id = $search_keyword;
$args->sort_index = 'documents.'.$args->sort_index;
break;
case 'member_srl' :
$args->s_member_srl = (int)$search_keyword;
break;
case 'user_name' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_user_name = $search_keyword;
break;
case 'nick_name' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_nick_name = $search_keyword;
break;
case 'email_address' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_email_address = $search_keyword;
break;
case 'homepage' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_homepage = $search_keyword;
break;
case 'is_notice' :
if($search_keyword=='Y') $args->s_is_notice = 'Y';
else $args->s_is_notice = '';
break;
case 'is_secret' :
if($search_keyword=='Y') $args->s_is_secret = 'Y';
else $args->s_is_secret = '';
break;
case 'tag' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_tags = $search_keyword;
break;
case 'readed_count' :
$args->s_readed_count = (int)$search_keyword;
break;
case 'voted_count' :
$args->s_voted_count = (int)$search_keyword;
break;
case 'comment_count' :
$args->s_comment_count = (int)$search_keyword;
break;
case 'trackback_count' :
$args->s_trackback_count = (int)$search_keyword;
break;
case 'uploaded_count' :
$args->s_uploaded_count = (int)$search_keyword;
break;
case 'regdate' :
$args->s_regdate = $search_keyword;
break;
case 'last_update' :
$args->s_last_upate = $search_keyword;
break;
case 'ipaddress' :
$args->s_ipaddress= $search_keyword;
break;
default :
preg_match('/^extra_vars([0-9]+)$/',$search_target,$matches);
if($matches[1]) {
$args->{"s_extra_vars".$matches[1]} = $search_keyword;
}
break;
}
}
// document.getDocumentList 쿼리 실행
$output = executeQuery($query_id, $args);
// 결과가 없거나 오류 발생시 그냥 return
if(!$output->toBool()||!count($output->data)) return $output;
foreach($output->data as $key => $attribute) {
$document_srl = $attribute->document_srl;
$oDocument = null;
$oDocument = new documentItem();
$oDocument->setAttribute($attribute);
if($is_admin) $oDocument->setGrant();
$output->data[$key] = $oDocument;
}
return $output;
}
/**
* @brief module_srl에 해당하는 문서의 전체 갯수를 가져옴
**/
function getDocumentCount($module_srl, $search_obj = NULL) {
// 검색 옵션 추가
$args->module_srl = $module_srl;
$args->s_title = $search_obj->s_title;
$args->s_content = $search_obj->s_content;
$args->s_user_name = $search_obj->s_user_name;
$args->s_member_srl = $search_obj->s_member_srl;
$args->s_ipaddress = $search_obj->s_ipaddress;
$args->s_regdate = $search_obj->s_regdate;
$args->category_srl = $search_obj->category_srl;
$output = executeQuery('document.getDocumentCount', $args);
// 전체 갯수를 return
$total_count = $output->data->count;
return (int)$total_count;
}
/**
* @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서..
**/
function getDocumentPage($document_srl, $module_srl=0, $list_count) {
// 변수 설정
$args->document_srl = $document_srl;
$args->module_srl = $module_srl;
// 전체 갯수를 구한후 해당 글의 페이지를 검색
$output = executeQuery('document.getDocumentPage', $args);
$count = $output->data->count;
$page = (int)(($count-1)/$list_count)+1;
return $page;
}
/**
* @brief 카테고리의 정보를 가져옴
**/
function getCategory($category_srl) {
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args);
return $output->data;
}
/**
* @brief 특정 모듈의 카테고리 목록을 가져옴
**/
function getCategoryList($module_srl) {
$args->module_srl = $module_srl;
$args->sort_index = 'list_order';
$output = executeQuery('document.getCategoryList', $args);
$category_list = $output->data;
if(!$category_list) return NULL;
if(!is_array($category_list)) $category_list = array($category_list);
$category_count = count($category_list);
for($i=0;$i<$category_count;$i++) {
$category_srl = $category_list[$i]->category_srl;
$list[$category_srl] = $category_list[$i];
}
return $list;
}
/**
* @brief 카테고리에 속한 문서의 갯수를 구함
**/
function getCategoryDocumentCount($category_srl) {
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategoryDocumentCount', $args);
return (int)$output->data->count;
}
/**
* @brief 월별 보관현황을 가져옴
**/
function getMonthlyArchivedList($obj) {
if($obj->mid) {
$oModuleModel = &getModel('module');
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
$output = executeQuery('document.getMonthlyArchivedList', $args);
if(!$output->toBool()||!$output->data) return $output;
if(!is_array($output->data)) $output->data = array($output->data);
return $output;
}
/**
* @brief 특정달의 일별 현황을 가져옴
**/
function getDailyArchivedList($obj) {
if($obj->mid) {
$oModuleModel = &getModel('module');
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
$args->regdate = $obj->regdate;
$output = executeQuery('document.getDailyArchivedList', $args);
if(!$output->toBool()) return $output;
if(!is_array($output->data)) $output->data = array($output->data);
return $output;
}
}
?>

View file

@ -0,0 +1,56 @@
<?php
/**
* @class documentView
* @author zero (zero@nzeo.com)
* @brief document 모듈의 View class
**/
class documentView extends document {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 문서 인쇄 기능
* 해당 글만 찾아서 그냥 출력해버린다;;
**/
function dispDocumentPrint() {
// 목록 구현에 필요한 변수들을 가져온다
$document_srl = Context::get('document_srl');
// document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;
$oDocumentModel = &getModel('document');
// 선택된 문서 표시를 위한 객체 생성
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
// 권한 체크
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
// 브라우저 타이틀 설정
Context::setBrowserTitle($oDocument->getTitleText());
Context::set('oDocument', $oDocument);
Context::set('layout','none');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('print_page');
}
/**
* @brief 미리 보기
**/
function dispDocumentPreview() {
Context::set('layout','none');
$content = Context::get('content');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('preview_page');
}
}
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file modules/document/lang/en.lang.php
* @author zero <zero@nzeo.com>
* @brief Document module's basic language pack
**/
$lang->cmd_delete_checked_document = 'Delete selected';
$lang->msg_cart_is_null = 'Select the articles you wish to delete';
$lang->msg_category_not_moved = 'Unabled to move';
$lang->msg_is_secret = 'This article is secret';
$lang->msg_checked_document_is_deleted = 'Total of %d articles has been deleted';
// Search targets in admin page
$lang->search_target_list = array(
'title' => 'Subject',
'content' => 'Content',
'user_id' => 'User ID',
'member_srl' => 'Member No.',
'user_name' => 'Content',
'nick_name' => 'Content',
'email_address' => 'Email',
'homepage' => 'Homepage',
'is_notice' => 'Notice',
'is_secret' => 'Secret',
'tags' => 'Tag',
'readed_count' => 'Number of Views (Above)',
'voted_count' => 'Number of Votes (Above)',
'comment_count ' => 'Number of Comments (Above)',
'trackback_count ' => 'Number of trackbacks (Above)',
'uploaded_count ' => 'Number of Attachments (Above)',
'regdate' => 'Date',
'last_update' => 'Last Revised',
'ipaddress' => 'IP Address',
);
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file modules/document/lang/es.lang.php
* @author zero <zero@nzeo.com>
* @brief Paquete lingual de módulo documento
**/
$lang->cmd_delete_checked_document = 'Eliminar selección';
$lang->msg_cart_is_null = 'Por favor selecciona documento para eliminar';
$lang->msg_category_not_moved = 'No puede mover';
$lang->msg_is_secret = 'es secreto';
$lang->msg_checked_document_is_deleted = 'Eliminado %d documentos';
// Artículo de busqueda en la pantalla de administración
$lang->search_target_list = array(
'title' => 'Título',
'content' => 'Contenido',
'user_id' => 'ID',
'member_srl' => 'Numero de miembro',
'user_name' => 'Nombre de usuario',
'nick_name' => 'Apodo',
'email_address' => 'Correo Electrónico',
'homepage' => 'Pagina de web',
'is_notice' => 'Noticia',
'is_secret' => 'Secreto',
'tags' => 'Etiqueta',
'readed_count' => 'Leido',
'voted_count' => 'Votado',
'comment_count ' => 'Commentarios',
'trackback_count ' => 'Trackback',
'uploaded_count ' => 'Subido',
'regdate' => 'Registrado',
'last_update' => 'Ultimo actualizado',
'ipaddress' => 'Dirección IP',
);
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file modules/document/lang/jp.lang.php
* @author zero <zero@nzeo.com> 翻訳RisaPapa
* @brief ドキュメントdocumentモジュルの基本言語パッケージ
**/
$lang->cmd_delete_checked_document = '選択項目削除';
$lang->msg_cart_is_null = '削除する書き込みを選択してください。';
$lang->msg_category_not_moved = '移動することができません。';
$lang->msg_is_secret = '非公開設定の書き込みです。';
$lang->msg_checked_document_is_deleted = '%d個の書き込みが削除されました。';
// 管理者ページで検索する内容
$lang->search_target_list = array(
'title' => 'タイトル',
'content' => '内容',
'user_id' => 'ユーザID',
'member_srl' => '会員番号',
'user_name' => 'ユーザ名',
'nick_name' => 'ニックネーム',
'email_address' => 'メールアドレス',
'homepage' => 'ホームページ',
'is_notice' => 'お知らせ',
'is_secret' => '非公開書き込み',
'tags' => 'タグ',
'readed_count' => '照合数(以上)',
'voted_count' => '推薦数(以上)',
'comment_count ' => 'コメント数(以上)',
'trackback_count ' => 'トラックバック数(以上)',
'uploaded_count ' => '添付ファイル数(以上)',
'regdate' => '登録日',
'last_update' => '最近修正日',
'ipaddress' => 'IPアドレス',
);
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file modules/document/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 문서(document) 모듈의 기본 언어팩
**/
$lang->cmd_delete_checked_document = '선택항목 삭제';
$lang->msg_cart_is_null = '삭제할 글을 선택해주세요';
$lang->msg_category_not_moved = '이동할 수가 없습니다';
$lang->msg_is_secret = '비밀글입니다';
$lang->msg_checked_document_is_deleted = '%d개의 글이 삭제되었습니다';
// 관리자 페이지에서 검색할 대상
$lang->search_target_list = array(
'title' => '제목',
'content' => '내용',
'user_id' => '아이디',
'member_srl' => '회원번호',
'user_name' => '내용',
'nick_name' => '내용',
'email_address' => '이메일',
'homepage' => '홈페이지',
'is_notice' => '공지사항',
'is_secret' => '비밀글',
'tags' => '태그',
'readed_count' => '조회수 (이상)',
'voted_count' => '추천수 (이상)',
'comment_count ' => '코멘트수 (이상)',
'trackback_count ' => '트랙백수 (이상)',
'uploaded_count ' => '첨부파일수 (이상)',
'regdate' => '등록일',
'last_update' => '최근수정일',
'ipaddress' => 'IP 주소',
);
?>

View file

@ -0,0 +1,37 @@
<?php
/**
* @file modules/document/lang/zh-CN.lang.php
* @author zero <zero@nzeo.com>
* @brief 文章(document)模块语言包
**/
$lang->cmd_delete_checked_document = '删除所选项目';
$lang->msg_cart_is_null = '请选择要删除的文章。';
$lang->msg_category_not_moved = '不能移动!';
$lang->msg_is_secret = '这是密帖!';
$lang->msg_checked_document_is_deleted = '删除了%d个文章。';
// 管理页面查找的对象
$lang->search_target_list = array(
'title' => '标题',
'content' => '内容',
'user_id' => 'I D',
'member_srl' => '会员编号',
'user_name' => '姓名',
'nick_name' => '昵称',
'email_address' => '电子邮件',
'homepage' => '主页',
'is_notice' => '公告',
'is_secret' => '密帖',
'tags' => '标签',
'readed_count' => '查看数(以上)',
'voted_count' => '推荐数(以上)',
'comment_count ' => '评论数(以上)',
'trackback_count ' => '引用数(以上)',
'uploaded_count ' => '上传附件数(以上)',
'regdate' => '登录日期',
'last_update' => '最近更新日期',
'ipaddress' => 'IP 地址',
);
?>

View file

@ -0,0 +1,8 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="document_categories" />
</tables>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteDocument" action="delete">
<tables>
<table name="documents" />
</tables>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="document_categories" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteModuleDocument" action="delete">
<tables>
<table name="documents" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="getCategory" action="select">
<tables>
<table name="document_categories" />
</tables>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getCategoryDocumentCount" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getCategoryList" action="select">
<tables>
<table name="document_categories" />
</tables>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" default="list_order" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,16 @@
<query id="getMonthlyArchivedList" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="substr(regdate,1,8)" alias="month"/>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="like_prefix" column="regdate" var="regdate" pipe="and" />
</conditions>
<groups>
<group column="substr(regdate,1,8)" />
</groups>
</query>

View file

@ -0,0 +1,11 @@
<query id="getDocument" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,20 @@
<query id="getDocumentCount" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="category_srl" var="category_srl" />
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="and" />
<condition operation="like" column="user_name" var="s_user_name" pipe="and" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="and" />
<condition operation="like_prefix" column="ipaddress" var="s_ipaddress" pipe="and" />
<condition operation="like_prefix" column="regdate" var="s_regdate" pipe="and" />
</group>
</conditions>
</query>

View file

@ -0,0 +1,63 @@
<query id="getDocumentList" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="equal" column="category_srl" var="category_srl" pipe="and" />
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_addres" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />
<condition operation="equal" column="is_notice" var="s_is_notice" pipe="or" />
<condition operation="equal" column="is_secret" var="s_is_secret" pipe="or" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="or" />
<condition operation="more" column="readed_count" var="s_readed_count" pipe="or" />
<condition operation="more" column="voted_count" var="s_voted_count" pipe="or" />
<condition operation="more" column="comment_count" var="s_comment_count" pipe="or" />
<condition operation="more" column="trackback_count" var="s_trackback_count" pipe="or" />
<condition operation="more" column="uploaded_count" var="s_uploaded_count" pipe="or" />
<condition operation="like_prefix" column="regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="last_update" var="s_last_update" pipe="or" />
<condition operation="like_prefix" column="ipaddress" var="s_ipaddress" pipe="or" />
<condition operation="like" column="extra_vars1" var="s_extra_vars1" pipe="or" />
<condition operation="like" column="extra_vars2" var="s_extra_vars2" pipe="or" />
<condition operation="like" column="extra_vars3" var="s_extra_vars3" pipe="or" />
<condition operation="like" column="extra_vars4" var="s_extra_vars4" pipe="or" />
<condition operation="like" column="extra_vars5" var="s_extra_vars5" pipe="or" />
<condition operation="like" column="extra_vars6" var="s_extra_vars6" pipe="or" />
<condition operation="like" column="extra_vars7" var="s_extra_vars7" pipe="or" />
<condition operation="like" column="extra_vars8" var="s_extra_vars8" pipe="or" />
<condition operation="like" column="extra_vars9" var="s_extra_vars9" pipe="or" />
<condition operation="like" column="extra_vars10" var="s_extra_vars10" pipe="or" />
<condition operation="like" column="extra_vars11" var="s_extra_vars11" pipe="or" />
<condition operation="like" column="extra_vars12" var="s_extra_vars12" pipe="or" />
<condition operation="like" column="extra_vars13" var="s_extra_vars13" pipe="or" />
<condition operation="like" column="extra_vars14" var="s_extra_vars14" pipe="or" />
<condition operation="like" column="extra_vars15" var="s_extra_vars15" pipe="or" />
<condition operation="like" column="extra_vars16" var="s_extra_vars16" pipe="or" />
<condition operation="like" column="extra_vars17" var="s_extra_vars17" pipe="or" />
<condition operation="like" column="extra_vars18" var="s_extra_vars18" pipe="or" />
<condition operation="like" column="extra_vars19" var="s_extra_vars19" pipe="or" />
<condition operation="like" column="extra_vars20" var="s_extra_vars20" pipe="or" />
</group>
<group pipe="and">
<condition operation="more" column="last_update" var="start_date" pipe="and" />
<condition operation="less" column="last_update" var="end_date" pipe="and" />
</group>
</conditions>
<navigation>
<index var="sort_index" default="list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,39 @@
<query id="getDocumentListWithinMember" action="select">
<tables>
<table name="documents" alias="documents" />
<table name="member" alias="member"/>
</tables>
<columns />
<conditions>
<condition operation="like" column="member.user_id" var="s_user_id" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member.member_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.category_srl" var="category_srl" pipe="and" />
<group pipe="and">
<condition operation="like" column="documents.title" var="s_title" />
<condition operation="like" column="documents.content" var="s_content" pipe="or" />
<condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="documents.email_address" var="s_email_addres" pipe="or" />
<condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="documents.tags" var="s_tags" pipe="or" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="or" />
<condition operation="equal" column="documents.is_secret" var="s_is_secret" pipe="or" />
<condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" />
<condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" />
<condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" />
<condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" />
<condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" />
<condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" />
<condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" />
<condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" />
</group>
</conditions>
<navigation>
<index var="sort_index" default="documents.list_order" order="asc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,12 @@
<query id="getDocumentPage" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="more" column="document_srl" var="document_srl" filter="number" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,15 @@
<query id="getDocumentReadedLogInfo" action="select">
<tables>
<table name="document_readed_log" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
<group pipe="and">
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
</group>
</conditions>
</query>

View file

@ -0,0 +1,15 @@
<query id="getDocumentVotedLogInfo" action="select">
<tables>
<table name="document_voted_log" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
<group pipe="and">
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
</group>
</conditions>
</query>

View file

@ -0,0 +1,14 @@
<query id="getDocuments" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
<navigation>
<index var="list_order" default="list_order" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,15 @@
<query id="getMonthlyArchivedList" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="substr(regdate,1,6)" alias="month"/>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
</conditions>
<groups>
<group column="substr(regdate,1,6)" />
</groups>
</query>

View file

@ -0,0 +1,14 @@
<query id="insertCategory" action="insert">
<tables>
<table name="document_categories" />
</tables>
<columns>
<column name="category_srl" var="category_srl" filter="number" notnull="notnull" />
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
<column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" />
<column name="document_count" var="document_count" default="0" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="list_order" var="list_order" default="0" />
</columns>
</query>

View file

@ -0,0 +1,56 @@
<query id="insertDocument" action="insert">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="document_srl" var="document_srl" filter="number" notnull="notnull" />
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
<column name="is_notice" var="is_notice" notnull="notnull" default="N" />
<column name="is_secret" var="is_secret" notnull="notnull" default="N" />
<column name="title" var="title" notnull="notnull" minlength="1" maxlength="250" />
<column name="content" var="content" notnull="notnull" />
<column name="readed_count" var="readed_count" default="0" />
<column name="voted_count" var="voted_count" default="0" />
<column name="comment_count" var="comment_count" default="0" />
<column name="trackback_count" var="trackback_count" default="0" />
<column name="uploaded_count" var="uploaded_count" default="0" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="nick_name" var="nick_name" notnull="notnull" minlength="1" maxlength="40" />
<column name="member_srl" var="member_srl" default="0" filter="number" />
<column name="user_id" var="user_id" default="" />
<column name="user_name" var="user_name" default="" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="tags" var="tags" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" default="0" />
<column name="update_order" var="update_order" default="0" />
<column name="allow_comment" var="allow_comment" default="Y" />
<column name="lock_comment" var="lock_comment" default="N" />
<column name="allow_trackback" var="allow_trackback" default="Y" />
<column name="notify_message" var="notify_message" default="N" />
<column name="extra_vars1" var="extra_vars1" />
<column name="extra_vars2" var="extra_vars2" />
<column name="extra_vars3" var="extra_vars3" />
<column name="extra_vars4" var="extra_vars4" />
<column name="extra_vars5" var="extra_vars5" />
<column name="extra_vars6" var="extra_vars6" />
<column name="extra_vars7" var="extra_vars7" />
<column name="extra_vars8" var="extra_vars8" />
<column name="extra_vars9" var="extra_vars9" />
<column name="extra_vars10" var="extra_vars10" />
<column name="extra_vars11" var="extra_vars11" />
<column name="extra_vars12" var="extra_vars12" />
<column name="extra_vars13" var="extra_vars13" />
<column name="extra_vars14" var="extra_vars14" />
<column name="extra_vars15" var="extra_vars15" />
<column name="extra_vars16" var="extra_vars16" />
<column name="extra_vars17" var="extra_vars17" />
<column name="extra_vars18" var="extra_vars18" />
<column name="extra_vars19" var="extra_vars19" />
<column name="extra_vars20" var="extra_vars20" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="insertDocumentReadedLog" action="insert">
<tables>
<table name="document_readed_log" />
</tables>
<columns>
<column name="document_srl" var="document_srl" filter="number" default="0" notnull="notnull" />
<column name="member_srl" var="member_srl" filter="number" default="0" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="insertDocumentVotedLog" action="insert">
<tables>
<table name="document_voted_log" />
</tables>
<columns>
<column name="document_srl" var="document_srl" filter="number" default="0" notnull="notnull" />
<column name="member_srl" var="member_srl" filter="number" default="0" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,13 @@
<query id="updateCategory" action="update">
<tables>
<table name="document_categories" />
</tables>
<columns>
<column name="title" var="title" />
<column name="list_order" var="list_order" />
<column name="last_update" var="last_update" default="curdate()" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="updateCategory" action="update">
<tables>
<table name="document_categories" />
</tables>
<columns>
<column name="document_count" var="document_count" />
<column name="last_update" var="last_update" default="curdate()" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="updateCommentCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="comment_count" var="comment_count" notnull="notnull" />
<column name="update_order" var="update_order" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,52 @@
<query id="updateDocument" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
<column name="is_notice" var="is_notice" notnull="notnull" default="N" />
<column name="is_secret" var="is_secret" notnull="notnull" default="N" />
<column name="title" var="title" notnull="notnull" minlength="2" maxlength="250" />
<column name="content" var="content" notnull="notnull" />
<column name="uploaded_count" var="uploaded_count" default="0" />
<column name="password" var="password" minlength="2" maxlength="60" />
<column name="nick_name" var="nick_name" minlength="1" maxlength="40" />
<column name="member_srl" var="member_srl" default="0" filter="number" />
<column name="user_name" var="user_name" default="" />
<column name="email_address" var="email_address" filter="email" maxlength="250" />
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
<column name="tags" var="tags" />
<column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" />
<column name="update_order" var="update_order" default="0" />
<column name="allow_comment" var="allow_comment" default="Y" />
<column name="lock_comment" var="lock_comment" default="N" />
<column name="allow_trackback" var="allow_trackback" default="Y" />
<column name="notify_message" var="notify_message" default="N" />
<column name="extra_vars1" var="extra_vars1" />
<column name="extra_vars2" var="extra_vars2" />
<column name="extra_vars3" var="extra_vars3" />
<column name="extra_vars4" var="extra_vars4" />
<column name="extra_vars5" var="extra_vars5" />
<column name="extra_vars6" var="extra_vars6" />
<column name="extra_vars7" var="extra_vars7" />
<column name="extra_vars8" var="extra_vars8" />
<column name="extra_vars9" var="extra_vars9" />
<column name="extra_vars10" var="extra_vars10" />
<column name="extra_vars11" var="extra_vars11" />
<column name="extra_vars12" var="extra_vars12" />
<column name="extra_vars13" var="extra_vars13" />
<column name="extra_vars14" var="extra_vars14" />
<column name="extra_vars15" var="extra_vars15" />
<column name="extra_vars16" var="extra_vars16" />
<column name="extra_vars17" var="extra_vars17" />
<column name="extra_vars18" var="extra_vars18" />
<column name="extra_vars19" var="extra_vars19" />
<column name="extra_vars20" var="extra_vars20" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateCategoryDocument" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="category_srl" var="target_category_srl" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="source_category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateDocumentModule" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateReadedCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="readed_count" var="readed_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateTrackbackCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="trackback_count" var="trackback_count" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateVotedCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="voted_count" var="voted_count" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,9 @@
<table name="document_categories">
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" primary_key="primary_key" />
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
<column name="title" type="varchar" size="250" />
<column name="document_count" type="number" size="11" default="0" notnull="notnull" />
<column name="regdate" type="date" index="idx_regdate" />
<column name="last_update" type="date" />
<column name="list_order" type="number" size="11" notnull="notnull" />
</table>

View file

@ -0,0 +1,6 @@
<table name="document_readed_log">
<column name="document_srl" type="number" size="11" notnull="notnull" index="idx_document_srl" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
<column name="regdate" type="date" index="idx_regdate" />
</table>

View file

@ -0,0 +1,6 @@
<table name="document_voted_log">
<column name="document_srl" type="number" size="11" notnull="notnull" index="idx_document_srl" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
<column name="regdate" type="date" index="idx_regdate" />
</table>

View file

@ -0,0 +1,55 @@
<table name="documents">
<column name="document_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="module_srl" type="number" size="11" default="0" notnull="notnull" index="idx_module_srl" />
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" index="idx_category_srl" />
<column name="is_notice" type="char" size="1" default="N" notnull="notnull" index="idx_is_notice" />
<column name="is_secret" type="char" size="1" default="N" notnull="notnull" index="idx_is_secret" />
<column name="title" type="varchar" size="250" />
<column name="title_bold" type="char" size="1" default="N" notnull="notnull" />
<column name="title_color" type="char" size="7" />
<column name="content" type="bigtext" notnull="notnull" />
<column name="readed_count" type="number" size="11" default="0" notnull="notnull" index="idx_readed_count" />
<column name="voted_count" type="number" size="11" default="0" notnull="notnull" index="idx_voted_count" />
<column name="comment_count" type="number" size="11" default="0" notnull="notnull" index="idx_comment_count" />
<column name="trackback_count" type="number" size="11" default="0" notnull="notnull" index="idx_trackback_count" />
<column name="uploaded_count" type="number" size="11" default="0" notnull="notnull" index="idx_uploaded_count" />
<column name="password" type="varchar" size="60" />
<column name="user_id" type="varchar" size="80" />
<column name="user_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="email_address" type="varchar" size="250" notnull="notnull" />
<column name="homepage" type="varchar" size="250" notnull="notnull" />
<column name="tags" type="text" />
<column name="extra_vars" type="text" />
<column name="regdate" type="date" index="idx_regdate " />
<column name="last_update" type="date" index="idx_last_update" />
<column name="last_updater" type="varchar" size="80" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
<column name="list_order" type="number" size="11" notnull="notnull" index="idx_list_order" />
<column name="update_order" type="number" size="11" notnull="notnull" index="idx_update_order" />
<column name="allow_comment" type="char" size="1" default="Y" notnull="notnull" />
<column name="lock_comment" type="char" size="1" default="N" notnull="notnull" />
<column name="allow_trackback" type="char" size="1" default="Y" notnull="notnull" />
<column name="notify_message" type="char" size="1" default="N" notnull="notnull" />
<column name="extra_vars1" type="text" />
<column name="extra_vars2" type="text" />
<column name="extra_vars3" type="text" />
<column name="extra_vars4" type="text" />
<column name="extra_vars5" type="text" />
<column name="extra_vars6" type="text" />
<column name="extra_vars7" type="text" />
<column name="extra_vars8" type="text" />
<column name="extra_vars9" type="text" />
<column name="extra_vars10" type="text" />
<column name="extra_vars11" type="text" />
<column name="extra_vars12" type="text" />
<column name="extra_vars13" type="text" />
<column name="extra_vars14" type="text" />
<column name="extra_vars15" type="text" />
<column name="extra_vars16" type="text" />
<column name="extra_vars17" type="text" />
<column name="extra_vars18" type="text" />
<column name="extra_vars19" type="text" />
<column name="extra_vars20" type="text" />
</table>

View file

@ -0,0 +1 @@
body { margin:10px; font-size:.75em; font-family:sans-serif;}

View file

@ -0,0 +1,100 @@
<!--%import("filter/delete_checked.xml")-->
<!--%import("js/document_admin.js")-->
<h3>{$lang->document} <span class="gray">{$lang->cmd_management}</span></h3>
<!-- 정보 -->
<div class="tableSummaryType1">
Total <strong>{number_format($total_count)}</strong>, Page <strong>{number_format($page)}</strong>/{number_format($total_page)}
</div>
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
<input type="hidden" name="page" value="{$page}" />
<!-- 목록 -->
<table cellspacing="0" class="tableType4">
<thead>
<tr>
<th scope="col">{$lang->no}</th>
<th scope="col"><input type="checkbox" onclick="doCheckAll(); return false;" /></th>
<th scope="col">
<div class="nowrap">
<select name="module_srl" class="mid_list" id="module_srl">
<option value="">{$lang->module}</option>
<!--@foreach($mid_list as $key => $val)-->
<option value="{$val->module_srl}" <!--@if($module_srl == $val->module_srl)-->selected="selected"<!--@end-->>{$val->browser_title}</option>
<!--@end-->
</select><a href="#" onclick="location.href=current_url.setQuery('module_srl',xGetElementById('module_srl').options[xGetElementById('module_srl').selectedIndex].value);return false;" class="button"><span>GO</span></a>
</div>
</th>
<th scope="col">{$lang->title}</th>
<th scope="col">{$lang->user_name}</th>
<th scope="col">{$lang->readed_count}</th>
<th scope="col">{$lang->voted_count}</th>
<th scope="col">{$lang->date}</th>
</tr>
</thead>
<tbody>
<!--@foreach($document_list as $no => $oDocument)-->
<tr>
<td class="tahoma">{$no}</td>
<td><input type="checkbox" name="cart" value="{$oDocument->document_srl}" /></td>
<td class="blue"><a href="{getUrl('','mid',$module_list[$oDocument->get('module_srl')]->mid)}" onclick="window.open(this.href);return false">{htmlspecialchars($module_list[$oDocument->get('module_srl')]->browser_title)}</a></td>
<td>
<a href="{getUrl('','document_srl',$oDocument->document_srl)}" onclick="window.open(this.href);return false">{$oDocument->getTitleText()}</a>
<!--@if($oDocument->getCommentCount())-->
[{$oDocument->getCommentCount()}]
<!--@end-->
<!--@if($oDocument->getTrackbackCount())-->
[{$oDocument->getTrackbackCount()}]
<!--@end-->
</td>
<td><div class="member_{$oDocument->get('member_srl')}">{$oDocument->getNickName()}</div></td>
<td class="tahoma">{$oDocument->get('readed_count')}</td>
<td class="tahoma">{$oDocument->get('voted_count')}</td>
<td class="tahoma">{$oDocument->getRegdate("Y-m-d")}</td>
</tr>
<!--@end-->
</tbody>
</table>
<!-- 버튼 -->
<div class="fr gap1">
<span class="button"><input type="submit" value="{$lang->cmd_delete_checked_document}" /></span>
</div>
</form>
<!-- 페이지 네비게이션 -->
<div class="pageNavigation">
<a href="{getUrl('page','','module_srl','')}" class="goToFirst"><img src="../../admin/tpl/images/bottomGotoFirst.gif" alt="{$lang->first_page}" width="7" height="5" /></a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<span class="current">{$page_no}</span>
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl','')}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="goToLast"><img src="../../admin/tpl/images/bottomGotoLast.gif" alt="{$lang->last_page}" width="7" height="5" /></a>
</div>
<!-- 검색 -->
<form action="./" method="get" class="adminSearch">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<fieldset>
<select name="search_target">
<option value="">{$lang->search_target}</option>
<!--@foreach($lang->search_target_list as $key => $val)-->
<option value="{$key}" <!--@if($search_target==$key)-->selected="selected"<!--@end-->>{$val}</option>
<!--@end-->
</select>
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="inputTypeText" />
<span class="button"><input type="submit" value="{$lang->cmd_search}" /></span>
<a href="{getUrl('','module',$module,'act',$act)}" class="button"><span>{$lang->cmd_cancel}</span></a>
</fieldset>
</form>

View file

@ -0,0 +1,12 @@
<filter name="delete_checked" module="document" act="procDocumentAdminDeleteChecked" confirm_msg_code="confirm_delete">
<form>
<node target="cart" required="true" />
</form>
<parameter>
<param name="cart" target="cart" />
</parameter>
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -0,0 +1,6 @@
function doCheckAll() {
var fo_obj = xGetElementById('fo_list');
for(var i=0;i<fo_obj.length;i++) {
if(fo_obj[i].name == 'cart') fo_obj[i].checked = true;
}
}

View file

@ -0,0 +1,5 @@
<!--%import("./js/document_admin.js")-->
<!--%import("./css/document.css")-->
<div class="fr"><a href="#" onclick="window.close();return false;" class="button"><span>{$lang->cmd_close}</span></a></div>
{$content}

View file

@ -0,0 +1,18 @@
<!--%import("./js/document_admin.js")-->
<!--%import("./css/document.css")-->
<div><h1>{$oDocument->getTitleText()}</h1></div>
<div class="member_{$oDocument->get('member_srl')} gap1 fl">{$oDocument->get('nick_name')}</div>
<div class="gap1 fr">{$oDocument->getRegdate()}</div>
<div class="clear"></div>
<div class="gap1">{$oDocument->getContent()}</div>
<script type="text/javascript">//<![CDATA[
xAddEventListener(window,'load',function() { window.print(); } );
//]]></script>