css 및 js 호출순서 조정기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5785 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2009-03-06 05:33:56 +00:00
parent 4f380d9c48
commit 61851f1dfe
2149 changed files with 109090 additions and 18689 deletions

View file

@ -1,23 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants>
<grant name="list" default="guest">
<title xml:lang="ko">목록</title>
<title xml:lang="es">Lista</title>
<title xml:lang="ru">список</title>
<title xml:lang="zh-CN">目录</title>
<title xml:lang="jp">リスト</title>
<title xml:lang="en">list</title>
<title xml:lang="zh-TW">列表</title>
</grant>
<grant name="view" default="guest">
<title xml:lang="ko">열람</title>
<title xml:lang="es">Opinión</title>
<title xml:lang="ru">мнение</title>
<title xml:lang="zh-CN">查看</title>
<title xml:lang="es">Opinión</title>
<title xml:lang="ru">мнение</title>
<title xml:lang="zh-CN">查看</title>
<title xml:lang="jp">閲覧</title>
<title xml:lang="en">view</title>
<title xml:lang="zh-TW">檢視</title>
<title xml:lang="zh-TW">檢視</title>
</grant>
</grants>
<actions>
@ -33,6 +24,5 @@
<action name="procSpringnoteAdminInsertSpringnote" type="controller" standalone="true" />
<action name="procSpringnoteAdminDeleteSpringnote" type="controller" standalone="true" />
<action name="procSpringnoteAdminInsertGrant" type="controller" standalone="true" />
<action name="procSpringnoteAdminUpdateSkinInfo" type="controller" standalone="true" />
</actions>
</module>

View file

@ -5,24 +5,24 @@
* @brief 스프링노트(springnote) 모듈의 기본 언어팩
**/
$lang->springnote = "스프링노트";
$lang->springnote_openid = "오픈아이디";
$lang->springnote_userkey = "사용자 Key";
$lang->springnote_pageid = "페이지 번호";
$lang->springnote = '스프링노트';
$lang->springnote_openid = '오픈아이디';
$lang->springnote_userkey = '사용자 Key';
$lang->springnote_pageid = '페이지 번호';
$lang->springnote_pageid_setup = '페이지 번호 설정';
$lang->springnote_pageid_option_only = '지정된 페이지만 보여주기 (목록 보이지 않음)';
$lang->springnote_pageid_option_list = '지정된 페이지부터 보이기 (목록 보임)';
$lang->springnote_domain = "도메인 지정";
$lang->springnote_domain = '도메인 지정';
$lang->page_url = "원본 URL";
$lang->page_modified = "최종 수정";
$lang->page_modifier = "최종 수정자";
$lang->page_url = '원본 URL';
$lang->page_modified = '최종 수정';
$lang->page_modifier = '최종 수정자';
$lang->cmd_springnote_list = '스프링노트 목록';
$lang->cmd_view_info = '스프링노트 정보';
$lang->about_springnote = "스프링노트는 오픈마루에서 제공하는 위키서비스입니다.<br />스프링노트 XE모듈은 스프링노트의 특정 페이지들을 내부문서처럼 열람할 수 있는 모듈입니다.";
$lang->about_springnote_openid = "스프링노트에서 페이지를 제작한 오픈아이디를 입력해주세요";
$lang->about_springnote = '스프링노트는 오픈마루에서 제공하는 위키서비스입니다.<br />스프링노트 XE모듈은 스프링노트의 특정 페이지들을 내부문서처럼 열람할 수 있는 모듈입니다.';
$lang->about_springnote_openid = '스프링노트에서 페이지를 제작한 오픈아이디를 입력해주세요';
$lang->about_springnote_userkey = '스프링노트 연동을 위한 사용자 Key값을 입력해주셔야 합니다.<br />[<a href="https://api.openmaru.com/delegate_key/springnote?app_id=www.zeroboard.com&openid=" onclick="window.open(this.href);return false;">사용자 키 받기</a>] 를 클릭하셔서 오픈아이디를 입력하시고 생성되는 키값을 입력해주세요.';
$lang->about_springnote_pageid = '사용하시려는 스프링노트 중 특정 페이지를 먼저 출력하고자 하실때 pageid값을 입력해주세요';
$lang->about_springnote_pageid_setup = '페이지 번호 지정시 해당 페이지만 보이기(목록 비포함), 해당 페이지부터 보이기(목록 포함)등을 지정할 수 있습니다';

View file

@ -1,8 +1,8 @@
<?php
/**
* @file zh-CN.lang.php
* @author zero (zero@nzeo.com)
* @brief Springnote模块语言包
* @author zero (zero@nzeo.com) 翻译guny
* @brief Springnote模块简体中文语言包
**/
$lang->springnote = "Springnote";

View file

@ -19,67 +19,27 @@
* springnote_name은 mid의 값이 되고 나머지 모듈 공통 값을 받아서 저장을 하게 된다.
**/
function procSpringnoteAdminInsertSpringnote($args = null) {
// 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리
if(!$args) $args = Context::gets('module_srl','module_category_srl','springnote_name','layout_srl','skin','browser_title','description','is_default','header_text','footer_text','admin_id','open_rss');
// module 모듈의 model/controller 객체 생성
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
// springnote모듈임을 명시적으로 지정한다.
// 게시판 모듈의 정보 설정
$args = Context::getRequestVars();
$args->module = 'springnote';
// mid값을 직접 받지 않고 springnote_name으로 받는 이유는 mid는 특별히 약속된 변수명이라 오동작이 발생할 수 있어서 다른 이름으로 전달을 받은후 다시 바꾸어준다.
$args->mid = $args->springnote_name;
unset($args->springnote_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->springnote_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값이 없다면 신규 등록으로 처리를 한다.
**/
// module_srl의 값에 따라 insert/update
if(!$args->module_srl) {
// module controller를 이용하여 모듈을 생성한다.
$output = $oModuleController->insertModule($args);
$msg_code = 'success_registed';
// 권한의 경우 기본으로 설정을 해주는 것이 좋으며 방명록 모듈의 경우 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';
@ -114,132 +74,6 @@
$this->setMessage('success_deleted');
}
/**
* @brief 권한 설정
* 생성된 방명록에 ./conf/module.xml에 정의된 권한과 관리자가 선택한 그룹의 값을 연동하여 권한을 설정하게 된다.
**/
function procSpringnoteAdminInsertGrant() {
// 대상 방명록(모듈)의 고유값인 module_srl을 체크한다.
$module_srl = Context::get('module_srl');
/**
* 모듈의 권한 목록을 가져옴
* xml_info springnote모듈이 요청되었다고 판단될때 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 procSpringnoteAdminUpdateSkinInfo() {
// 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') {
FileHandler::removeFile($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(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $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");
}
}
?>

View file

@ -139,26 +139,11 @@
* @brief 스킨 정보 보여줌
**/
function dispSpringnoteAdminSkinInfo() {
// 공통 모듈 권한 설정 페이지 호출
$oModuleAdminModel = &getAdminModel('module');
$skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
Context::set('skin_content', $skin_content);
// 현재 선택된 모듈의 스킨의 정보 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');
}
@ -166,17 +151,10 @@
* @brief 권한 목록 출력
**/
function dispSpringnoteAdminGrantInfo() {
// 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);
// 공통 모듈 권한 설정 페이지 호출
$oModuleAdminModel = &getAdminModel('module');
$grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
Context::set('grant_content', $grant_content);
$this->setTemplateFile('grant_list');
}

View file

@ -10,19 +10,6 @@
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController = &getController('module');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteContent');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminContent');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminSpringnoteInfo');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminInsertSpringnote');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminDeleteSpringnote');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminGrantInfo');
$oModuleController->insertActionForward('springnote', 'view', 'dispSpringnoteAdminSkinInfo');
$oModuleController->insertActionForward('springnote', 'controller', 'procSpringnoteAdminInsertSpringnote');
$oModuleController->insertActionForward('springnote', 'controller', 'procSpringnoteAdminDeleteSpringnote');
$oModuleController->insertActionForward('springnote', 'controller', 'procSpringnoteAdminInsertGrant');
return new Object();
}
@ -30,9 +17,6 @@
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
$oModuleModel = &getModel('module');
if(!$oModuleModel->getActionForward('dispSpringnoteContent')) return true;
return false;
}

View file

@ -1,214 +1,215 @@
<?php
/**
* @class springnoteModel
* @author zero (zero@nzeo.com)
* @brief springnote모듈의 model 클래스
**/
set_include_path("./libs/PEAR");
require_once('PEAR.php');
require_once('HTTP/Request.php');
class springnoteModel extends springnote {
var $userid = '';
var $userkey = '';
var $appkey = '82dee99105c92c166bb8586415d47283b9a54cd2';
var $server = 'api.springnote.com';
var $port = 80;
var $domain = '';
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 스프링노트 페이지를 가져오기 위한 기본 설정
**/
function setInfo($userid, $userkey, $domain = '') {
$this->userid = $userid;
$this->userkey = $userkey;
$this->domain = $domain;
}
/**
* @brief url 생성
**/
function getUrl($pageid = null) {
return sprintf('http://%s:%s/pages%s.xml%s', $this->server, $this->port, $pageid?'/'.$pageid:'', $this->domain?'?domain='.$this->domain:'');
}
/**
* @brief userid 생성
**/
function getUserID() {
return htmlentities($this->userid, ENT_QUOTES, 'UTF-8');
}
/**
* @brief password 생성
**/
function getPassword() {
return $this->userkey.'.'.$this->appkey;
}
/**
* @brief HTTP request 객체 생성
**/
function getRequest($url) {
$oReqeust = new HTTP_Request($url);
$oReqeust->addHeader('Content-Type', 'application/xml');
$oReqeust->setMethod('GET');
$oReqeust->setBasicAuth($this->getUserID(), $this->getPassword());
return $oReqeust;
}
/**
* @brief springnote 페이지 정보 가져오기
**/
function getPage($pageid) {
$url = $this->getUrl($pageid);
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();
if (PEAR::isError($oResponse)) return null;
$body = $oReqeust->getResponseBody();
$oXmlParser = new XmlParser();
$xmldoc = $oXmlParser->parse($body);
$page->identifier = $xmldoc->page->identifier->body;
$page->title = $xmldoc->page->title->body;
$page->relation_is_part_of = $xmldoc->page->relation_is_part_of->body;
$page->date_modified = $xmldoc->page->date_modified->body;
$page->uri = $xmldoc->page->uri->body;
$page->date_created = $xmldoc->page->date_created->body;
$page->rights = $xmldoc->page->rights->body;
$page->creator = $xmldoc->page->creator->body;
$page->contributor_modified = $xmldoc->page->contributor_modified->body;
$page->version = $xmldoc->page->version->body;
$page->tags = $xmldoc->page->tags->body;
$page->body = trim($xmldoc->page->body);
$page->source = trim($xmldoc->page->source->body);
// source에서 /pages/숫자로 되어 있는 url의 수정
$page->source = preg_replace('/="\/pages\/([0-9]+)(#[^"]+)?"/is','="./?mid='.Context::get('mid').'&pageid=\\1\\2"', $page->source);
// 첨부파일의 경로를 변경
$page->source = preg_replace('/="\/pages\/([0-9]+)\/attachments\/([0-9]+)"/is','="'.$page->uri.'/attachments/\\2"', $page->source);
// Change path of the template images
$page->source = preg_replace('/="\/images\/template\/([^"]+)"/is','="http://zbxe.springnote.com/images/template/\\1"', $page->source);
$uri = preg_replace('/pages(.*)$/i','',$page->uri);
$page->css_files = array(
sprintf('%sstylesheets/xhtmlContent.css?%d', $uri, time()),
sprintf('%sstylesheets/template.css?%d', $uri, time()),
);
return $page;
}
/**
* @brief springnote 페이지 목록 가져오기
**/
function getPages($query = null, $fulltext = true, $p_pageid = 0) {
if($query) {
if($this->domain) $url = sprintf('%s&q=%s&fulltext=%d', $this->getUrl(), urlencode($query), $fulltext?1:0);
else $url = sprintf('%s?q=%s&fulltext=%d', $this->getUrl(), urlencode($query), $fulltext?1:0);
} else {
$url = $this->getUrl();
}
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();
if (PEAR::isError($oResponse)) return array();
$body = $oReqeust->getResponseBody();
$oXmlParser = new XmlParser();
$xmldoc = $oXmlParser->parse($body);
// 페이지 목록 정리
$output = array();
$pages = array();
$root = null;
if(count($xmldoc->pages->page)) {
// 일단 서버에서 보내주는 대로 목록을 받음
foreach($xmldoc->pages->page as $val) {
$obj = null;
$obj->pageid = $val->identifier->body;
$obj->title = $val->title->body;
$obj->relation_is_part_of = $val->relation_is_part_of->body;
$obj->date_modified = $val->date_modified->body;
$obj->uri = $val->uri->body;
$obj->source = trim($val->source->body);
if($query && !$obj->source) continue;
$pages[$obj->pageid] = $obj;
}
// parent/chlid관계로 묶음
foreach($pages as $pageid => $page) {
if($page->relation_is_part_of) $pages[$page->relation_is_part_of]->child[] = &$pages[$pageid];
else $root->child[] = &$pages[$pageid];
}
if($p_pageid) $this->getNodes($root->child, $p_pageid, $root);
$pages = array();
$prev_pageid = 0;
$this->arrangePages($pages, $root->child, 0, $prev_pageid);
}
return $pages;
}
/**
* @brief 특정 노드아래만 검색을 하기 위할때 해당 노드의 page_id를 받아서 해당 노드tree만 리턴
**/
function getNodes($list, $p_pageid, &$root) {
if(!count($list)) return;
foreach($list as $key => $val) {
if($val->pageid == $p_pageid) {
$root = $val;
return;
}
if($val->child) $this->getNodes($val->child, $p_pageid, $root);
}
}
/**
* @brief 스프링노트 서버에서 보내준 페이지를 정렬
**/
function arrangePages(&$pages, $list, $depth, &$prev_pageid) {
if(!count($list)) return;
foreach($list as $key => $val) {
$child = $val->child;
unset($val->child);
$val->depth = $depth;
$pages[$val->pageid] = $val;
if($prev_pageid) {
$pages[$prev_pageid]->next->pageid = $pages[$val->pageid]->pageid;
$pages[$prev_pageid]->next->title = $pages[$val->pageid]->title;
$pages[$val->pageid]->prev->pageid = $pages[$prev_pageid]->pageid;
$pages[$val->pageid]->prev->title = $pages[$prev_pageid]->title;
}
$prev_pageid = $val->pageid;
if($child) $this->arrangePages($pages, $child,$depth+1, $prev_pageid);
}
}
}
?>
<?php
/**
* @class springnoteModel
* @author zero (zero@nzeo.com)
* @brief springnote모듈의 model 클래스
**/
set_include_path("./libs/PEAR");
require_once('PEAR.php');
require_once('HTTP/Request.php');
class springnoteModel extends springnote {
var $userid = '';
var $userkey = '';
var $appkey = '82dee99105c92c166bb8586415d47283b9a54cd2';
var $server = 'api.springnote.com';
var $port = 80;
var $domain = '';
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 스프링노트 페이지를 가져오기 위한 기본 설정
**/
function setInfo($userid, $userkey, $domain = '') {
$this->userid = $userid;
$this->userkey = $userkey;
$this->domain = $domain;
}
/**
* @brief url 생성
**/
function getUrl($pageid = null) {
return sprintf('http://%s:%s/pages%s.xml%s', $this->server, $this->port, $pageid?'/'.$pageid:'', $this->domain?'?domain='.$this->domain:'');
}
/**
* @brief userid 생성
**/
function getUserID() {
return htmlentities($this->userid, ENT_QUOTES, 'UTF-8');
}
/**
* @brief password 생성
**/
function getPassword() {
return $this->userkey.'.'.$this->appkey;
}
/**
* @brief HTTP request 객체 생성
**/
function getRequest($url) {
$oReqeust = new HTTP_Request($url);
$oReqeust->addHeader('Content-Type', 'application/xml');
$oReqeust->setMethod('GET');
$oReqeust->setBasicAuth($this->getUserID(), $this->getPassword());
return $oReqeust;
}
/**
* @brief springnote 페이지 정보 가져오기
**/
function getPage($pageid) {
$url = $this->getUrl($pageid);
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();
if (PEAR::isError($oResponse)) return null;
$body = $oReqeust->getResponseBody();
$oXmlParser = new XmlParser();
$xmldoc = $oXmlParser->parse($body);
$page->identifier = $xmldoc->page->identifier->body;
$page->title = $xmldoc->page->title->body;
$page->relation_is_part_of = $xmldoc->page->relation_is_part_of->body;
$page->date_modified = $xmldoc->page->date_modified->body;
$page->uri = $xmldoc->page->uri->body;
$page->date_created = $xmldoc->page->date_created->body;
$page->rights = $xmldoc->page->rights->body;
$page->creator = $xmldoc->page->creator->body;
$page->contributor_modified = $xmldoc->page->contributor_modified->body;
$page->version = $xmldoc->page->version->body;
$page->tags = $xmldoc->page->tags->body;
$page->body = trim($xmldoc->page->body);
$page->source = trim($xmldoc->page->source->body);
// source에서 /pages/숫자로 되어 있는 url의 수정
$page->source = preg_replace('/="\/pages\/([0-9]+)(#[^"]+)?"/is','="./?mid='.Context::get('mid').'&pageid=\\1\\2"', $page->source);
// 첨부파일의 경로를 변경
$page->source = preg_replace('/="\/pages\/([0-9]+)\/attachments\/([0-9]+)"/is','="'.$page->uri.'/attachments/\\2"', $page->source);
// Change path of the template images
$page->source = preg_replace('/="\/images\/template\/([^"]+)"/is','="http://zbxe.springnote.com/images/template/\\1"', $page->source);
$uri = preg_replace('/pages(.*)$/i','',$page->uri);
$page->css_files = array(
sprintf('%sstylesheets/xhtmlContent.css?%d', $uri, time()),
sprintf('%sstylesheets/template.css?%d', $uri, time()),
"http://static2.springnote.com/stylesheets/readonly_30102.css"
);
return $page;
}
/**
* @brief springnote 페이지 목록 가져오기
**/
function getPages($query = null, $fulltext = true, $p_pageid = 0) {
if($query) {
if($this->domain) $url = sprintf('%s&q=%s&fulltext=%d', $this->getUrl(), urlencode($query), $fulltext?1:0);
else $url = sprintf('%s?q=%s&fulltext=%d', $this->getUrl(), urlencode($query), $fulltext?1:0);
} else {
$url = $this->getUrl();
}
$oReqeust = $this->getRequest($url);
$oResponse = $oReqeust->sendRequest();
if (PEAR::isError($oResponse)) return array();
$body = $oReqeust->getResponseBody();
$oXmlParser = new XmlParser();
$xmldoc = $oXmlParser->parse($body);
// 페이지 목록 정리
$output = array();
$pages = array();
$root = null;
if(count($xmldoc->pages->page)) {
// 일단 서버에서 보내주는 대로 목록을 받음
foreach($xmldoc->pages->page as $val) {
$obj = null;
$obj->pageid = $val->identifier->body;
$obj->title = $val->title->body;
$obj->relation_is_part_of = $val->relation_is_part_of->body;
$obj->date_modified = $val->date_modified->body;
$obj->uri = $val->uri->body;
$obj->source = trim($val->source->body);
if($query && !$obj->source) continue;
$pages[$obj->pageid] = $obj;
}
// parent/chlid관계로 묶음
foreach($pages as $pageid => $page) {
if($page->relation_is_part_of) $pages[$page->relation_is_part_of]->child[] = &$pages[$pageid];
else $root->child[] = &$pages[$pageid];
}
if($p_pageid) $this->getNodes($root->child, $p_pageid, $root);
$pages = array();
$prev_pageid = 0;
$this->arrangePages($pages, $root->child, 0, $prev_pageid);
}
return $pages;
}
/**
* @brief 특정 노드아래만 검색을 하기 위할때 해당 노드의 page_id를 받아서 해당 노드tree만 리턴
**/
function getNodes($list, $p_pageid, &$root) {
if(!count($list)) return;
foreach($list as $key => $val) {
if($val->pageid == $p_pageid) {
$root = $val;
return;
}
if($val->child) $this->getNodes($val->child, $p_pageid, $root);
}
}
/**
* @brief 스프링노트 서버에서 보내준 페이지를 정렬
**/
function arrangePages(&$pages, $list, $depth, &$prev_pageid) {
if(!count($list)) return;
foreach($list as $key => $val) {
$child = $val->child;
unset($val->child);
$val->depth = $depth;
$pages[$val->pageid] = $val;
if($prev_pageid) {
$pages[$prev_pageid]->next->pageid = $pages[$val->pageid]->pageid;
$pages[$prev_pageid]->next->title = $pages[$val->pageid]->title;
$pages[$val->pageid]->prev->pageid = $pages[$prev_pageid]->pageid;
$pages[$val->pageid]->prev->title = $pages[$prev_pageid]->title;
}
$prev_pageid = $val->pageid;
if($child) $this->arrangePages($pages, $child,$depth+1, $prev_pageid);
}
}
}
?>

View file

@ -35,7 +35,7 @@
**/
function dispSpringnoteContent() {
// 권한 체크
if(!$this->grant->list) return $this->dispSpringnoteMessage('msg_not_permitted');
if(!$this->grant->access) return $this->dispSpringnoteMessage('msg_not_permitted');
$pageid = (int)Context::get('pageid');
if($this->module_info->pageid && $this->module_info->pageid_option != 'list') $pageid = $this->module_info->pageid;

View file

@ -1,11 +0,0 @@
<filter name="insert_grant" module="springnote" act="procSpringnoteAdminInsertGrant" confirm_msg_code="confirm_submit">
<form>
<node target="module_srl" required="true" filter="number" />
</form>
<response callback_func="completeInsertGrant">
<tag name="error" />
<tag name="message" />
<tag name="page" />
<tag name="module_srl" />
</response>
</filter>

View file

@ -25,7 +25,6 @@
<param name="description" target="description" />
<param name="header_text" target="header_text" />
<param name="footer_text" target="footer_text" />
<param name="admin_id" target="admin_id" />
<param name="open_rss" target="open_rss" />
</parameter>
<response callback_func="completeInsertSpringnote">

View file

@ -1,39 +1,3 @@
<!--#include("./header.html")-->
<!--%import("filter/insert_grant.xml")-->
<form action="./" method="post" onsubmit="return procFilter(this, insert_grant)">
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<table cellspacing="0" class="adminTable">
<caption>{$lang->about_grant}</caption>
<thead>
<tr>
<th><div>{$lang->target}</div></th>
<th class="wide"><div>{$lang->group}</div></th>
<th colspan="2"><div>&nbsp;</div></th>
</tr>
</thead>
<tbody>
<!--@foreach($grant_list as $key => $val)-->
<tr class="row{$cycle_idx}">
<td class="center">{$val->title}</td>
<td>
<!--@foreach($group_list as $k => $v)-->
<input type="checkbox" class="checkbox" name="{$key}" value="{$v->group_srl}" id="grant_{$key}_{$v->group_srl}" <!--@if(is_array($module_info->grants[$key])&&in_array($v->group_srl,$module_info->grants[$key]))-->checked="checked"<!--@end-->/>
<label for="grant_{$key}_{$v->group_srl}">{$v->title}</label>
<!--@end-->
</td>
<td class="center selectAll"><a href="#" onclick="XE.checkboxToggleAll('{$key}', { checked:true }); return false;" class="blue">{$lang->cmd_select_all}</a></td>
<td class="center deSelectAll"><a href="#" onclick="XE.checkboxToggleAll('{$key}', { checked:false }); return false;" class="red">{$lang->cmd_unselect_all}</a></td>
</tr>
<!--@end-->
<tr>
<td colspan="4" class="right">
<span class="button"><input type="submit" value="{$lang->cmd_save}" accesskey="s" /></span>
</td>
</tr>
</tbody>
</table>
</form>
{$grant_content}

View file

@ -1,12 +1,12 @@
<!--%import("js/springnote_admin.js")-->
<h3>{$lang->springnote} <span class="gray">{$lang->cmd_management}</span></h3>
<h3 class="xeAdmin">{$lang->springnote} <span class="gray">{$lang->cmd_management}</span></h3>
<div class="infoText">{nl2br($lang->about_springnote)}</div>
<!--@if($module_info)-->
<!--@if($module_info->mid)-->
<h4>{$module_info->mid} <!--@if($module_info->is_default=='Y')--><span class="bracket">({$lang->is_default})</span><!--@end--> <span class="vr">|</span> <a href="{getUrl('','mid',$module_info->mid)}" onclick="window.open(this.href); return false;" class="view">View</a></h4>
<h4 class="xeAdmin">{$module_info->mid} <!--@if($module_info->is_default=='Y')--><span class="bracket">({$lang->is_default})</span><!--@end--> <span class="vr">|</span> <a href="{getUrl('','mid',$module_info->mid)}" onclick="window.open(this.href); return false;" class="view">View</a></h4>
<!--@end-->
<ul class="localNavigation">

View file

@ -1,18 +1,16 @@
<!--#include("header.html")-->
<!-- 정보 -->
<div class="summary">
<strong>Total</strong> <em>{number_format($total_count)}</em>, Page <strong>{number_format($page)}</strong>/{number_format($total_page)}
</div>
<form action="./" method="get" onsubmit="return doChangeCategory(this);" id="fo_list">
<!-- 목록 -->
<table cellspacing="0" class="adminTable">
<table cellspacing="0" class="rowTable">
<caption>Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)}</caption>
<thead>
<tr>
<th scope="col"><div>{$lang->no}</div></th>
<th scope="col"><div><input type="checkbox" onclick="XE.checkboxToggleAll(); return false;" /></div></th>
<th scope="col">
<div>
<form action="./" method="get" onsubmit="return doChangeCategory(this);">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<select name="module_category_srl" class="w120">
@ -24,20 +22,19 @@
<option value="-1">{$lang->cmd_management}</option>
</select>
<input type="submit" name="go_button" id="go_button" value="GO" class="buttonTypeGo" />
</form>
</div>
</th>
<th scope="col" class="half_wide"><div>{$lang->mid}</div>
<th scope="col" class="half_wide"><div>{$lang->browser_title}</div></th>
<th scope="col"><div>{$lang->regdate}</div></th>
<th scope="col"><div>{$lang->cmd_view}</div></th>
<th scope="col"><div>{$lang->cmd_delete}</div></th>
<th scope="col" colspan="2"><div>&nbsp;</div></th>
</tr>
</thead>
<tbody>
<!--@foreach($springnote_list as $no => $val)-->
<tr class="row{$cycle_idx}">
<td class="number center">{$no}</td>
<td class="center"><input type="checkbox" name="cart" value="{$val->module_srl}" /></td>
<td>
<!--@if(!$val->module_category_srl)-->
{$lang->not_exists}
@ -45,21 +42,29 @@
{$module_category[$val->module_category_srl]->title}
<!--@end-->
</td>
<td><a href="{getUrl('act','dispSpringnoteAdminSpringnoteInfo','module_srl',$val->module_srl)}">{htmlspecialchars($val->mid)}</a></td>
<td><a href="{getUrl('act','dispSpringnoteAdminSpringnoteInfo','module_srl',$val->module_srl)}">{htmlspecialchars($val->browser_title)}</a></td>
<td class="date center nowrap">{zdate($val->regdate,"Y-m-d")}</td>
<td class="view center"><a href="{getUrl('','mid',$val->mid)}" onclick="window.open(this.href); return false;">{$lang->cmd_view}</a></td>
<td class="delete center"><!--@if($val->is_default!='Y')--><a href="{getUrl('act','dispSpringnoteAdminDeleteSpringnote','module_srl', $val->module_srl)}">{$lang->cmd_delete}</a><!--@end--></td>
<td>{htmlspecialchars($val->mid)}</td>
<td><a href="{getUrl('','mid',$val->mid)}" onclick="window.open(this.href); return false;">{htmlspecialchars($val->browser_title)}</a></td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
<td><a href="{getUrl('act','dispSpringnoteAdminSpringnoteInfo','module_srl',$val->module_srl)}" class="buttonSet buttonSetting"><span>{$lang->cmd_setup}</span></a></td>
<td><!--@if($val->is_default!='Y')--><a href="{getUrl('act','dispSpringnoteAdminDeleteSpringnote','module_srl', $val->module_srl)}" class="buttonSet buttonDelete"><span>{$lang->cmd_delete}</a><!--@else-->&nbsp;<!--@end--></td>
</tr>
<!--@end-->
<tr>
<td colspan="7" class="right">
<a href="{getUrl('act','dispSpringnoteAdminInsertSpringnote','module_srl','')}" class="button"><span>{$lang->cmd_make}</span></a>
</td>
</tr>
</tbody>
</table>
<!-- 버튼 -->
<div class="clear">
<div class="fl">
<a href="{getUrl('','module','module','act','dispModuleAdminModuleSetup')}" onclick="doCartSetup(this.href); return false;" class="button green"><span>{$lang->cmd_setup}</span></a>
<a href="{getUrl('','module','module','act','dispModuleAdminModuleGrantSetup')}" onclick="doCartSetup(this.href); return false;" class="button blue"><span>{$lang->cmd_manage_grant}</span></a>
</div>
<div class="fr">
<a href="{getUrl('act','dispSpringnoteAdminInsertSpringnote','module_srl','')}" class="button black strong"><span>{$lang->cmd_make}</span></a>
</div>
</div>
</form>
<!-- 페이지 네비게이션 -->
<div class="pagination a1">
<a href="{getUrl('page','','module_srl','')}" class="prevEnd">{$lang->first_page}</a>

View file

@ -53,3 +53,16 @@ function doChangeCategory(fo_obj) {
}
return true;
}
/* 일괄 설정 */
function doCartSetup(url) {
var module_srl = new Array();
jQuery('#fo_list input[name=cart]:checked').each(function() {
module_srl[module_srl.length] = jQuery(this).val();
});
if(module_srl.length<1) return;
url += "&module_srls="+module_srl.join(',');
popopen(url,'modulesSetup');
}

View file

@ -1,147 +1,3 @@
<!--#include("./header.html")-->
<form action="{Context::getRequestUri()}" method="post" enctype="multipart/form-data" target="hidden_iframe">
<input type="hidden" name="module" value="{$module_info->module}" />
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="act" value="procSpringnoteAdminUpdateSkinInfo" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="page" value="{$page}" />
<table cellspacing="0" class="adminTable">
<caption>{$lang->skin_default_info}</caption>
<tr class="row2">
<th scope="row"><div>{$lang->skin}</div></th>
<td>{$skin_info->title}</td>
</tr>
<tr>
<th scope="row"><div>{$lang->skin_author}</div></th>
<td>
<!--@foreach($skin_info->author as $author)-->
{$author->name} (<a href="{$author->homepage}" onclick="window.open(this.href);return false;">{$author->homepage}</a>, <a href="mailto:{$author->email_address}">{$author->email_address}</a>)<br />
<!--@endforeach-->
</td>
</tr>
<tr class="row2">
<th scope="row"><div>{$lang->homepage}</div></th>
<td><a href="{$skin_info->homepage}" onclick="window.open(this.href);return false;">{$skin_info->homepage}</a>&nbsp;</td>
</tr>
<tr>
<th scope="row"><div>{$lang->date}</div></th>
<td>{zdate($skin_info->date, 'Y-m-d')}</td>
</tr>
<tr class="row2">
<th scope="row"><div>{$lang->skin_license}</div></th>
<td>
{nl2br(trim($skin_info->license))}
<!--@if($skin_info->license_link)-->
<p><a href="{$skin_info->license_link}" onclick="window.close(); return false;">{$skin_info->license_link}</a></p>
<!--@end-->
&nbsp;
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->description}</div></th>
<td>{nl2br($skin_info->description)}</td>
</tr>
</table>
<table cellspacing="0" class="adminTable">
<caption>{$lang->extra_vars}</caption>
<tr class="row2">valign="top">
<th scope="row"><div>{$lang->colorset}</div></th>
<td>
<!--@foreach($skin_info->colorset as $key => $val)-->
<!--@if($val->screenshot)-->
{@ $_img_info = getImageSize($val->screenshot); $_height = $_img_info[1]+40; $_width = $_img_info[0]+20; $_talign = "center"; }
<!--@else-->
{@ $_width = 200; $_height = 20; $_talign = "left"; }
<!--@end-->
<div style="float:left;text-align:{$_talign};margin-bottom:1em;width:{$_width}px;height:{$_height}px;margin-right:10px;">
<input type="radio" name="colorset" value="{$val->name}" id="colorset_{$key}" <!--@if($module_info->colorset==$val->name)-->checked="checked"<!--@end-->/>
<label for="colorset_{$key}">{$val->title}</label>
<!--@if($val->screenshot)-->
<br />
<img src="{$val->screenshot}" alt="{$val->title}" style="border:1px solid #888888;padding:2px;margin:2px;"/>
<!--@end-->
</div>
<!--@end-->
</td>
</tr>
<!--@foreach($skin_info->extra_vars as $key => $val)-->
<!--@if($val->group && ((!$group) || $group != $val->group))-->
{@$group = $val->group}
</table>
<table cellspacing="0" class="adminTable">
<col width="150" />
<col />
<caption>{$group}</caption>
<!--@end-->
<tr>
<th scope="row"><div>{$val->title}</div></th>
<td>
<!--@if($val->type=="text")-->
<input type="text" name="{$val->name}" value="{htmlspecialchars($val->value)}" class="inputTypeText w400" />
<!--@elseif($val->type=="textarea")-->
<textarea name="{$val->name}" class="inputTypeTextArea w400">{htmlspecialchars($val->value)}</textarea>
<!--@elseif($val->type=="select")-->
<select name="{$val->name}">
<!--@foreach($val->options as $k=>$v)-->
<option value="{$v->value}" <!--@if($v->value == $val->value)-->selected="selected"<!--@end-->>{$v->title}</option>
<!--@end-->
</select>
<!--@elseif($val->type=="checkbox")-->
<!--@foreach($val->default as $k=>$v)-->
<span>
<input type="checkbox" name="{$val->name}[]" value="{$v}" id="ch_{$key}_{$k}" <!--@if(in_array($v, $val->value))-->checked="checked"<!--@end--> class="checkbox" />
<label for="ch_{$key}_{$k}">{$v}</label>
</span>
<!--@end-->
<!--@elseif($val->type=="radio")-->
<!--@foreach($val->default as $k=>$v)-->
<span>
<input type="radio" name="{$val->name}" value="{$v}" id="ch_{$key}_{$k}" <!--@if($v==$val->value)-->checked="checked"<!--@end-->/>
<label for="ch_{$key}_{$k}">{$v}</label>
</span>
<!--@end-->
<!--@elseif($val->type=="image")-->
<!--@if($val->value)-->
<div>
<img src="{$val->value}" /><br />
<input type="checkbox" name="del_{$val->name}" value="Y" id="del_{$val->name}" class="checkbox" />
<label for="del_{$val->name}">{$lang->cmd_delete}</label>
</div>
<!--@end-->
<input type="file" name="{$val->name}" value="" />
<!--@end-->
<!--@if($val->description)-->
<p>{nl2br(trim($val->description))}</p>
<!--@end-->
</td>
</tr>
<!--@end-->
<!--@if($group)-->
</table>
<table cellspacing="0" class="adminTable">
<!--@end-->
<tr class="row2">
<td colspan="2" class="right">
<span class="button"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
</td>
</tr>
</table>
</form>
<iframe name="hidden_iframe" frameborder="0" style="display:none"></iframe>
{$skin_content}

View file

@ -6,24 +6,20 @@
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
<table cellspacing="0" class="adminTable">
<col width="150" />
<col />
<h3 class="xeAdmin">{$lang->confirm_delete}</h3>
<table cellspacing="0" class="rowTable">
<tr>
<th scope="row" colspan="2">{$lang->confirm_delete}</th>
<th scope="row"><div>{$lang->module_name}</div></th>
<td class="wide">{$module_info->mid}</td>
</tr>
<tr>
<th scope="row">{$lang->module_name}</th>
<td>{$module_info->mid}</td>
</tr>
<tr>
<th scope="row">{$lang->module}</th>
<th scope="row"><div>{$lang->module}</div></th>
<td>{$module_info->module}</td>
</tr>
<tr>
<th scope="row" colspan="2" class="button">
<span class="button black strong"><input type="submit" value="{$lang->cmd_delete}" /></span>
<a href="{getUrl('act','dispSpringnoteAdminContent')}" class="button"><span>{$lang->cmd_back}</span></a>
<span class="button"><input type="submit" value="{$lang->cmd_delete}" /></span>
</th>
</tr>
</table>

View file

@ -1,9 +1,9 @@
<!--#include("header.html")-->
<table cellspacing="0" class="adminTable">
<table cellspacing="0" class="rowTable">
<tr>
<th scope="row"><div>{$lang->module_category}</div></th>
<td>
<td class="wide">
<!--@if(!$module_info->module_category_srl)-->
{$lang->not_exists}
<!--@else-->
@ -74,16 +74,12 @@
<th scope="row"><div>{$lang->footer_text}</div></th>
<td>{htmlspecialchars($module_info->footer_text)}&nbsp;</td>
</tr>
<tr class="row2">
<th scope="row"><div>{$lang->admin_id}</div></th>
<td>{implode(",",$module_info->admin_id)}&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="right">
<a href="{getUrl('act','dispSpringnoteAdminInsertSpringnote')}" class="button"><span>{$lang->cmd_modify}</span></a>
<th colspan="2" class="button">
<a href="{getUrl('act','dispSpringnoteAdminInsertSpringnote')}" class="button black strong"><span>{$lang->cmd_modify}</span></a>
<!--@if($module=="admin")-->
<a href="{getUrl('act','dispSpringnoteAdminContent','module_srl','')}" class="button"><span>{$lang->cmd_springnote_list}</span></a>
<!--@end-->
</td>
</th>
</tr>
</table>

View file

@ -11,11 +11,11 @@
<!--@end-->
<input type="hidden" name="use_category" value="N" />
<table cellspacing="0" class="adminTable">
<table cellspacing="0" class="rowTable">
<tr class="row2">
<th scope="row"><div>{$lang->mid}</div></th>
<td>
<td class="wide">
<input type="text" name="mid" value="{$module_info->mid}" class="inputTypeText w200" />
<p>{$lang->about_mid}</p>
</td>
@ -82,7 +82,8 @@
<tr class="row2">
<th scope="row"><div>{$lang->browser_title}</div></th>
<td>
<input type="text" name="browser_title" value="{htmlspecialchars($module_info->browser_title)}" class="inputTypeText w300" />
<input type="text" name="browser_title" value="{htmlspecialchars($module_info->browser_title)}" class="inputTypeText w400" id="browser_title"/>
<a href="{getUrl('','module','module','act','dispModuleAdminLangcode','target','browser_title')}" onclick="popopen(this.href);return false;" class="buttonSet buttonSetting"><span>{$lang->cmd_find_langcode}</span></a>
<p>{$lang->about_browser_title}</p>
</td>
</tr>
@ -130,17 +131,10 @@
<p>{$lang->about_footer_text}</p>
</td>
</tr>
<tr class="row2">
<th scope="row"><div>{$lang->admin_id}</div></th>
<td>
<textarea name="admin_id" class="inputTypeTextArea w400"><!--@if($module_info->admin_id)-->{implode(",",$module_info->admin_id)}<!--@end--></textarea>
<p>{$lang->about_admin_id}</p>
</td>
</tr>
<tr>
<td colspan="2" class="right">
<span class="button"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
</td>
<th colspan="2" class="button">
<span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
</th>
</tr>
</table>