git-svn-id: http://xe-core.googlecode.com/svn/trunk@157 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-02-22 06:00:07 +00:00
parent 8788afbd5f
commit bbecc3b9e1
12 changed files with 154 additions and 103 deletions

View file

@ -154,8 +154,8 @@
$tmp_str = substr($code,8);
$tmp_arr = explode(' ', $tmp_str);
$var_name = $tmp_arr[0];
if(substr($var_name,0,1)=='$') $prefix = sprintf('if(is_array($__Context->%s)) ', substr($var_name,1));
else $prefix = sprintf('if(is_array(%s)) ', $var_name);
if(substr($var_name,0,1)=='$') $prefix = sprintf('if(count($__Context->%s)) ', substr($var_name,1));
else $prefix = sprintf('if(count(%s)) ', $var_name);
}
$output = preg_replace('/\$([a-zA-Z0-9\_\-]+)/i','$__Context->\\1', $code).'{';
break;

View file

@ -7,5 +7,28 @@
class admin extends ModuleObject {
/**
* @brief MVC 에서 공통으로 사용되는 설정등을 모아 놓은것..
**/
function init() {
// 관리자용 레이아웃으로 변경
$this->setLayoutPath($this->getTemplatePath());
$this->setLayoutFile('layout.html');
// template path 지정
$this->setTemplatePath($this->module_path.'tpl');
// 메뉴 아이템 지정
$menu_item->module->title = Context::getLang('item_module');
$menu_item->module->act = 'dispModuleList';
$menu_item->addon->title = Context::getLang('item_addon');
$menu_item->addon->act = 'dispAddonList';
$menu_item->plugin->title = Context::getLang('item_plugin');
$menu_item->plugin->act = 'dispPluginList';
$menu_item->layout->title = Context::getLang('item_layout');
$menu_item->layout->act = 'dispLayoutList';
Context::set('menu_item', $menu_item);
}
}
?>

View file

@ -13,5 +13,53 @@
function init() {
}
/**
* @brief 모듈의 종류와 정보를 구함
**/
function getModuleList() {
// module model 객체 생성
$oModuleModel = &getModel('module');
// DB 객체 생성
$oDB = &DB::getInstance();
// 다운받은 모듈과 설치된 모듈의 목록을 구함
$downloaded_list = FileHandler::readDir('./files/modules');
$installed_list = FileHandler::readDir('./modules');
$searched_list = array_merge($downloaded_list, $installed_list);
if(!count($searched_list)) return;
for($i=0;$i<count($searched_list);$i++) {
// 모듈의 이름
$module_name = $searched_list[$i];
// 모듈의 경로 (files/modules가 우선)
$path = ModuleHandler::getModulePath($module_name);
// schemas내의 테이블 생성 xml파일수를 구함
$tmp_files = FileHandler::readDir($path."schemas");
$table_count = count($tmp_files);
// 테이블이 설치되어 있는지 체크
$created_table_count = 0;
for($j=0;$j<count($tmp_files);$j++) {
list($table_name) = explode(".",$tmp_files[$j]);
if($oDB->isTableExists($table_name)) $created_table_count ++;
}
// 해당 모듈의 정보를 구함
$info = $oModuleModel->loadModuleXml($path);
unset($obj);
$info->module = $module_name;
$info->created_table_count = $created_table_count;
$info->table_count = $table_count;
$info->path = $path;
$list[] = $info;
}
return $list;
}
}
?>

View file

@ -11,8 +11,8 @@
* @brief 초기화
**/
function init() {
// template path 지정
$this->setTemplatePath($this->module_path.'tpl');
// admin class의 init
parent::init();
// 접속 사용자에 대한 체크
$oMemberModel = &getModel('member');
@ -23,47 +23,32 @@
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') return $this->stop('msg_is_not_administrator');
// 관리자 모듈 목록을 세팅
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
Context::set('module_list', $module_list);
// 관리자용 레이아웃으로 변경
$this->setLayoutPath($this->getTemplatePath());
$this->setLayoutFile('layout.html');
}
/**
* @brief 관리자 메인 페이지 출력
**/
function dispAdminIndex() {
// 선택된 모듈이 있는지 확인
$sid = Context::get('sid');
$act = Context::get('act');
function dispIndex() {
$this->setTemplateFile('index');
}
// 있다면 해당 모듈의 xml_info를 구함
if($sid) {
$oModuleHandler = new ModuleHandler($sid, $act);
$oModule = &$oModuleHandler->procModule();
/**
* @brief 모듈의 목록을 보여줌
**/
function dispModuleList() {
// 관리자 모듈 목록을 세팅
$oAdminModel = &getModel('admin');
$module_list = $oAdminModel->getModuleList();
Context::set('module_list', $module_list);
// 내용을 요청받은 모듈의 것으로 변경
if($oModule) {
$this->setTemplatePath($oModule->getTemplatePath());
$this->setTemplateFile($oModule->getTemplateFile());
}
// 없으면 관리자 메인 페이지 출력
} else {
$this->setTemplateFile('index');
}
$this->setTemplateFile('module_list');
}
/**
* @brief 관리자 로그인 페이지 출력
**/
function dispLogin() {
if(Context::get('is_logged')) return $this->dispAdminIndex();
if(Context::get('is_logged')) return $this->dispIndex();
$this->setTemplateFile('login_form');
}
@ -71,7 +56,7 @@
* @brief 관리자 로그아웃 페이지 출력
**/
function dispLogout() {
if(!Context::get('is_logged')) return $this->dispAdminIndex();
if(!Context::get('is_logged')) return $this->dispIndex();
$this->setTemplateFile('logout');
}
}

View file

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<module default_action="dispAdminIndex">
<module default_action="dispIndex">
<actions>
<action name="dispAdminIndex" type="view" standalone="true" />
<action name="dispIndex" type="view" standalone="true" />
<action name="dispModuleList" type="view" standalone="true" />
<action name="dispLogin" type="view" standalone="true" />
<action name="dispLogout" type="view" standalone="true" />
<action name="procLogin" type="controller" standalone="true" />
<action name="procLogout" type="controller" standalone="true" />
</actions>

View file

@ -5,5 +5,17 @@
* @brief 한국어 언어팩 (기본적인 내용만 수록)
**/
$lang->item_module = "모듈";
$lang->item_addon = "애드온";
$lang->item_plugin = "플러그인";
$lang->item_layout = "레이아웃";
$lang->module_name = "모듈 이름";
$lang->module_version = "버전";
$lang->module_author = "제작자";
$lang->module_table_count = "테이블수";
$lang->module_date = "제작일";
$lang->module_installed_path = "설치경로";
$lang->msg_is_not_administrator = '관리자만 접속이 가능합니다';
?>

View file

@ -1,4 +1,5 @@
#admin_title {
font-size:20pt;
font-weight:bold;
float:left;
height:30px;
@ -9,14 +10,15 @@
height:30px;
}
#admin_module_list {
#admin_main_menu {
clear:both;
float:left;
text-align:right;
}
#admin_module_content {
position:relative;
margin-left:150px;
left:0px;
top:30px;
#admin_main_menu .selected {
font-weight:bold;
}
#admin_content {
clear:both;
}

View file

@ -1 +1 @@
{$tetete}
haha

View file

@ -3,20 +3,23 @@
<!--#include("./common/tpl/common_header.html")-->
<div id="admin_title"><a href="./?module=admin">zeroboard5</a></div>
<div id="admin_title">
<a href="./?module=admin">zeroboard5</a>
</div>
<div id="admin_info">
<a href="{getUrl('act','dispLogout')}">{$lang->cmd_logout}</a>
</div>
<div id="admin_module_list">
<!--@foreach($module_list as $module_item)-->
<!--@if($module_item->module != $module)-->
<div <!--@if($module_item->module==$sid)-->style="font-weight:bold;"<!--@end-->>
<a href="{getUrl('sid',$module_item->module,'act','','module_srl','','page','')}">{$module_item->title}</a>
</div>
<!--@end-->
<div id="admin_main_menu">
<!--@foreach($menu_item as $key => $val)-->
<span <!--@if($act==$val->act)-->class="selected"<!--@end-->>
<a href="#" onclick="location.href='{getUrl('act',$val->act)}'">{$val->title}</a>
</span>
<!--@end-->
</div>
<div id="admin_module_content">
<div id="admin_content">
{$content}
</div>

View file

@ -0,0 +1,26 @@
<table border="1" width="100%">
<tr>
<td>{$lang->module_name}</td>
<td>{$lang->module_version}</td>
<td>{$lang->module_author}</td>
<td>{$lang->module_table_count}</td>
<td>{$lang->module_installed_path}</td>
<td>{$lang->cmd_management}</td>
</tr>
<!--@foreach($module_list as $key => $val)-->
<tr>
<td rowspan="2">{$val->title} <br /> ({$val->module})</td>
<td>{$val->version}</td>
<td><a href="#" onclick="window.open('{$val->homepage}')">{$val->author}</a></td>
<td>{$val->created_table_count}/{$val->table_count}</td>
<td>{$val->path}</td>
<td rowspan="2">{$lang->cmd_management}</td>
</tr>
<tr>
<td colspan="4">
{$val->author->date}
{nl2br($val->author->description)}
</td>
</tr>
<!--@end-->
</table>

View file

@ -4,10 +4,4 @@
* @author zero (zero@nzeo.com)
* @brief 한국어 언어팩
**/
$lang->module_name = "모듈 이름";
$lang->module_table_count = "테이블수";
$lang->module_date = "제작일";
$lang->module_installed_path = "설치경로";
$lang->module_version = "버전";
?>

View file

@ -68,51 +68,6 @@
}
/**
* @brief 모듈의 종류와 정보를 구함
**/
function getModuleList() {
// DB 객체 생성
$oDB = &DB::getInstance();
// 다운받은 모듈과 설치된 모듈의 목록을 구함
$downloaded_list = FileHandler::readDir('./files/modules');
$installed_list = FileHandler::readDir('./modules');
$searched_list = array_merge($downloaded_list, $installed_list);
if(!count($searched_list)) return;
for($i=0;$i<count($searched_list);$i++) {
// 모듈의 이름
$module_name = $searched_list[$i];
// 모듈의 경로 (files/modules가 우선)
$path = ModuleHandler::getModulePath($module_name);
// schemas내의 테이블 생성 xml파일수를 구함
$tmp_files = FileHandler::readDir($path."schemas");
$table_count = count($tmp_files);
// 테이블이 설치되어 있는지 체크
$created_table_count = 0;
for($j=0;$j<count($tmp_files);$j++) {
list($table_name) = explode(".",$tmp_files[$j]);
if($oDB->isTableExists($table_name)) $created_table_count ++;
}
// 해당 모듈의 정보를 구함
$info = $this->loadModuleXml($path);
unset($obj);
$info->module = $module_name;
$info->created_table_count = $created_table_count;
$info->table_count = $table_count;
$info->path = $path;
$list[] = $info;
}
return $list;
}
/**
* @brief document_srl로 모듈의 정보르 구함
**/