mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
mobile addon 개선. 게시판/페이지 wap class 제작. module별 wap interface 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5283 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8486f9b132
commit
01839ccf3b
17 changed files with 507 additions and 204 deletions
|
|
@ -5,6 +5,13 @@
|
|||
**/
|
||||
class wap extends mobileXE {
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function wap() {
|
||||
parent::mobileXE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief hdml 헤더 출력
|
||||
**/
|
||||
|
|
@ -54,28 +61,28 @@
|
|||
function printBtn() {
|
||||
// 메뉴 형식
|
||||
if($this->hasChilds()) {
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->nextUrl) {
|
||||
$url = $this->nextUrl;
|
||||
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->homeUrl) {
|
||||
$url = $this->homeUrl;
|
||||
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
||||
}
|
||||
// 컨텐츠 형식
|
||||
} else {
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<a task=gosub label="%s" dest="%s">%s</a>', $url->text, $url->url, $url->text);
|
||||
}
|
||||
if($this->nextUrl) {
|
||||
$url = $this->nextUrl;
|
||||
printf('<a task=gosub label="%s" dest="%s">%s</a>', $url->text, $url->url, $url->text);
|
||||
}
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<a task=gosub label="%s" dest="%s">%s</a>', $url->text, $url->url, $url->text);
|
||||
}
|
||||
if($this->homeUrl) {
|
||||
$url = $this->homeUrl;
|
||||
printf('<a task=gosub label="%s" dest="%s">%s</a>', $url->text, $url->url, $url->text);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
**/
|
||||
class wap extends mobileXE {
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function wap() {
|
||||
parent::mobileXE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief hdml 헤더 출력
|
||||
**/
|
||||
|
|
@ -37,14 +44,14 @@
|
|||
* @brief 버튼을 출력함
|
||||
**/
|
||||
function printBtn() {
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->nextUrl) {
|
||||
$url = $this->nextUrl;
|
||||
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
|
||||
}
|
||||
if($this->upperUrl) {
|
||||
$url = $this->upperUrl;
|
||||
printf('<btn href="%s" name="%s">%s', $url->url, $url->text, "\n");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Mobile XE Library Class ver 0.1
|
||||
* @author zero <zero@zeroboard.com>
|
||||
* @brief WAP 태그 출력을 위한 라이브러리
|
||||
* @brief WAP 태그 출력을 위한 XE 라이브러리
|
||||
**/
|
||||
|
||||
class mobileXE {
|
||||
|
|
@ -24,10 +24,27 @@
|
|||
var $charset = 'euc-kr';
|
||||
var $no = 0;
|
||||
|
||||
// Deck size
|
||||
var $deckSize = 500;
|
||||
// 네비게이션 관련 변수
|
||||
var $menu = null;
|
||||
var $listed_items = null;
|
||||
var $node_list = null;
|
||||
var $index_mid = null;
|
||||
|
||||
// getInstance
|
||||
// Navigation On/ Off 상태 값
|
||||
var $navigationMode = 0;
|
||||
|
||||
// 현재 요청된 XE 모듈 정보
|
||||
var $module_info = null;
|
||||
|
||||
// 현재 실행중인 모듈의 instance
|
||||
var $oModule = null;
|
||||
|
||||
// Deck size
|
||||
var $deckSize = 1024;
|
||||
|
||||
/**
|
||||
* @brief getInstance
|
||||
**/
|
||||
function &getInstance() {
|
||||
static $instance = null;
|
||||
|
||||
|
|
@ -45,12 +62,77 @@
|
|||
|
||||
$mobilePage = (int)Context::get('mpage');
|
||||
if(!$mobilePage) $mobilePage = 1;
|
||||
|
||||
$instance->setMobilePage($mobilePage);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function mobileXE() {
|
||||
// navigation mode 체크
|
||||
if(Context::get('nm')) $this->navigationMode = 1;
|
||||
$this->cmid = (int)Context::get('cmid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief navigation mode 체크
|
||||
* navigationMode 세팅과 모듈 정보의 menu_srl이 있어야 navigation mode = true로 return
|
||||
**/
|
||||
function isNavigationMode() {
|
||||
return ($this->navigationMode && $this->module_info->menu_srl)?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 현재 요청된 모듈 정보 세팅
|
||||
**/
|
||||
function setModuleInfo(&$module_info) {
|
||||
if($this->module_info) return;
|
||||
$this->module_info = $module_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 현재 실행중인 모듈 instance 세팅
|
||||
**/
|
||||
function setModuleInstance(&$oModule) {
|
||||
if($this->oModule) return;
|
||||
|
||||
// instance 저장
|
||||
$this->oModule = $oModule;
|
||||
|
||||
// 현재 모듈의 메뉴가 설정되어 있으면 메뉴 정리
|
||||
$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl);
|
||||
if(!file_exists($menu_cache_file)) return;
|
||||
|
||||
include $menu_cache_file;
|
||||
|
||||
// 정리된 menu들을 1차원으로 변경
|
||||
$this->getListedItems($menu->list, $listed_items, $node_list);
|
||||
|
||||
$this->listed_items = $listed_items;
|
||||
$this->node_list = $node_list;
|
||||
$this->menu = $menu->list;
|
||||
|
||||
$k = array_keys($node_list);
|
||||
$v = array_values($node_list);
|
||||
$this->index_mid = $k[0];
|
||||
|
||||
// 현재 메뉴의 depth가 1이상이면 상위 버튼을 지정
|
||||
$cur_menu_item = $listed_items[$node_list[$this->module_info->mid]];
|
||||
if($cur_menu_item['parent_srl']) {
|
||||
$parent_srl = $cur_menu_item['parent_srl'];
|
||||
if($parent_srl && $node_list[$parent_srl]) {
|
||||
$parent_item = $listed_items[$node_list[$parent_srl]];
|
||||
if($parent_item) $this->setUpperUrl(getUrl('',$parent_item['mid']), Context::getLang('cmd_go_upper'));
|
||||
}
|
||||
} else {
|
||||
$this->setUpperUrl(getUrl('','mid',$this->index_mid,'nm','1','cmid',0), Context::getLang('cmd_view_sitemap'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 접속 브라우저의 헤더를 판단하여 브라우저 타입을 return
|
||||
* 모바일 브라우저가 아닐 경우 null return
|
||||
|
|
@ -61,31 +143,32 @@
|
|||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$wap_sid = $_SERVER['HTTP_X_UP_SUBNO'];
|
||||
|
||||
if(eregi("SKT11", $userAgent)) $browserType = "wml";
|
||||
elseif(eregi("skt", $browserAccept)) $browserType = "wml";
|
||||
elseif(eregi("hdml", $browserAccept)) $browserType = "hdml";
|
||||
elseif(eregi("CellPhone", $userAgent)) $browserType = "mhtml";
|
||||
else $browserType = "html";
|
||||
|
||||
// class 지정 (html일 경우 동작 하지 않도록 함)
|
||||
if($browserType == 'html') return null;
|
||||
|
||||
return $browserType;
|
||||
if(eregi("SKT11", $userAgent)) return "wml";
|
||||
elseif(eregi("skt", $browserAccept)) return "wml";
|
||||
elseif(eregi("hdml", $browserAccept)) return "hdml";
|
||||
elseif(eregi("CellPhone", $userAgent)) return "mhtml";
|
||||
return null;
|
||||
}
|
||||
|
||||
// charset 지정
|
||||
/**
|
||||
* @brief charset 지정
|
||||
**/
|
||||
function setCharSet($charset = 'euc-kr') {
|
||||
if(!$charset) $charset = 'euc-kr';
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
// 모바일 기기의 용량 제한에 다른 가상 페이지 지정
|
||||
/**
|
||||
* @brief 모바일 기기의 용량 제한에 다른 가상 페이지 지정
|
||||
**/
|
||||
function setMobilePage($page=1) {
|
||||
if(!$page) $page = 1;
|
||||
$this->mobilePage = $page;
|
||||
}
|
||||
|
||||
// 목록형 데이터 설정을 위한 child menu지정
|
||||
/**
|
||||
* @brief 목록형 데이터 설정을 위한 child menu지정
|
||||
**/
|
||||
function setChilds($childs) {
|
||||
// menu개수가 9개 이상일 경우 자체 페이징 처리
|
||||
$menu_count = count($childs);
|
||||
|
|
@ -119,36 +202,71 @@
|
|||
$this->childs = $childs;
|
||||
}
|
||||
|
||||
// menu 출력대상이 있는지 확인
|
||||
/**
|
||||
* @brief menu 출력대상이 있는지 확인
|
||||
**/
|
||||
function hasChilds() {
|
||||
return count($this->childs)?true:0;
|
||||
}
|
||||
|
||||
// child menu반환
|
||||
/**
|
||||
* @brief child menu반환
|
||||
**/
|
||||
function getChilds() {
|
||||
return $this->childs;
|
||||
}
|
||||
|
||||
// title 지정
|
||||
/**
|
||||
* @brief title 지정
|
||||
**/
|
||||
function setTitle($title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
// title 반환
|
||||
/**
|
||||
* @brief title 반환
|
||||
**/
|
||||
function getTitle() {
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
// 컨텐츠 지정
|
||||
/**
|
||||
* @brief 컨텐츠 정리
|
||||
* HTML 컨텐츠에서 텍스트와 링크만 추출하는 기능
|
||||
**/
|
||||
function setContent($content) {
|
||||
$content = str_replace(array('&','<','>','"','&nbsp;'), array('&','<','>','"',' '), strip_tags($content));
|
||||
// 링크/줄바꿈을 임의의 문자열로 변경하고 태그 모두 제거
|
||||
$content = strip_tags(preg_replace('/<(\/?)(a|br)/i','[$1$2', $content));
|
||||
|
||||
// 링크/줄바꿈을 다시 원위치
|
||||
$content = preg_replace('/\[(\/?)(a|br)/i','<$1$2', $content);
|
||||
|
||||
// 탭 여백 제거
|
||||
$content = str_replace("\t", "", $content);
|
||||
|
||||
// 2번 이상 반복되는 공백과 줄나눔을 제거
|
||||
$content = preg_replace('/( ){2,}/s', '', $content);
|
||||
$content = preg_replace("/([\r\n]+)/s", "\r\n", $content);
|
||||
$content = str_replace(array("<A","<BR","<Br","<br>","<BR>","<br />"), array("<a","<br","<br","<br/>","<br/>","<br/>"), $content);
|
||||
while(strpos($content, '<br/><br/>')) {
|
||||
$content = str_replace('<br/><br/>','<br/>',$content);
|
||||
}
|
||||
|
||||
// 모바일의 경우 한 덱에 필요한 사이즈가 적어서 내용을 모두 페이지로 나눔
|
||||
$contents = array();
|
||||
while($content) {
|
||||
$tmp = cut_str($content, $this->deckSize, '');
|
||||
$tmp = $this->cutStr($content, $this->deckSize, '');
|
||||
$contents[] = $tmp;
|
||||
$content = substr($content, strlen($tmp));
|
||||
|
||||
//$content = str_replace(array('&','<','>','"','&nbsp;'), array('&','<','>','"',' '), $content);
|
||||
|
||||
$tag_open_pos = strpos($content, '<a');
|
||||
$tag_close_pos = strpos($content, '</a>');
|
||||
if($tag_open_pos!==false && $tag_close_pos || $tag_close_pos < $tag_open_pos) {
|
||||
$contents[count($contents)-1] .= substr($content, 0, $tag_close_pos+4);
|
||||
$content = substr($content, $tag_close_pos+4);
|
||||
}
|
||||
}
|
||||
|
||||
$this->totalPage = count($contents);
|
||||
|
|
@ -169,41 +287,66 @@
|
|||
$this->content = $contents[$this->mobilePage-1];
|
||||
}
|
||||
|
||||
// 컨텐츠 반환
|
||||
/**
|
||||
* @brief byte수로 자르는 함수
|
||||
**/
|
||||
function cutStr($string, $cut_size) {
|
||||
return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 컨텐츠 반환
|
||||
**/
|
||||
function getContent() {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
// home url 지정
|
||||
/**
|
||||
* @brief home url 지정
|
||||
**/
|
||||
function setHomeUrl($url, $text) {
|
||||
if(!$url) $url = '#';
|
||||
$this->homeUrl->url = $url;
|
||||
$this->homeUrl->text = $text;
|
||||
}
|
||||
|
||||
// upper url 지정
|
||||
/**
|
||||
* @brief upper url 지정
|
||||
**/
|
||||
function setUpperUrl($url, $text) {
|
||||
if(!$url) $url = '#';
|
||||
$this->upperUrl->url = $url;
|
||||
$this->upperUrl->text = $text;
|
||||
}
|
||||
|
||||
// prev url 지정
|
||||
/**
|
||||
* @brief prev url 지정
|
||||
**/
|
||||
function setPrevUrl($url, $text) {
|
||||
if(!$url) $url = '#';
|
||||
$this->prevUrl->url = $url;
|
||||
$this->prevUrl->text = $text;
|
||||
}
|
||||
|
||||
// next url 지정
|
||||
/**
|
||||
* @brief next url 지정
|
||||
**/
|
||||
function setNextUrl($url, $text) {
|
||||
if(!$url) $url = '#';
|
||||
$this->nextUrl->url = $url;
|
||||
$this->nextUrl->text = $text;
|
||||
}
|
||||
|
||||
// display
|
||||
/**
|
||||
* @brief display
|
||||
**/
|
||||
function display() {
|
||||
// 홈버튼 지정
|
||||
$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
|
||||
|
||||
// 제목 지정
|
||||
$this->setTitle(Context::getBrowserTitle());
|
||||
|
||||
ob_start();
|
||||
|
||||
// 헤더를 출력
|
||||
|
|
@ -230,17 +373,118 @@
|
|||
exit();
|
||||
}
|
||||
|
||||
// 페이지 이동
|
||||
/**
|
||||
* @brief 페이지 이동
|
||||
**/
|
||||
function movepage($url) {
|
||||
header("location:$url");
|
||||
exit();
|
||||
}
|
||||
|
||||
// 목록등에서 일련 번호를 리턴한다
|
||||
/**
|
||||
* @brief 목록등에서 일련 번호를 리턴한다
|
||||
**/
|
||||
function getNo() {
|
||||
$this->no++;
|
||||
$str = $this->no;
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XE의 Menu 모듈이 값을 사용하기 쉽게 정리해주는 함수
|
||||
**/
|
||||
function getListedItems($menu, &$listed_items, &$node_list) {
|
||||
if(!count($menu)) return;
|
||||
foreach($menu as $node_srl => $item) {
|
||||
if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) {
|
||||
$mid = $item['mid'] = $item['url'];
|
||||
$node_list[$mid] = $node_srl;
|
||||
} else {
|
||||
$mid = $item['mid'] = null;
|
||||
}
|
||||
|
||||
$listed_items[$node_srl] = $item;
|
||||
$this->getListedItems($item['list'], $listed_items, $node_list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XE 네비게이션 출력
|
||||
**/
|
||||
function displayNavigationContent() {
|
||||
$childs = array();
|
||||
|
||||
if($this->cmid) {
|
||||
$cur_item = $this->listed_items[$this->cmid];
|
||||
$upper_srl = $cur_item['parent_srl'];;
|
||||
$list = $cur_item['list'];;
|
||||
$this->setUpperUrl(getUrl('cmid',$upper_srl), Context::getLang('cmd_go_upper'));
|
||||
if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $cur_item['url'])) {
|
||||
$obj = null;
|
||||
$obj['href'] = getUrl('','mid',$cur_item['url']);
|
||||
$obj['link'] = $obj['text'] = '['.$cur_item['text'].']';
|
||||
$childs[] = $obj;
|
||||
}
|
||||
|
||||
} else {
|
||||
$list = $this->menu;
|
||||
$upper_srl = 0;
|
||||
}
|
||||
|
||||
|
||||
if(count($list)) {
|
||||
foreach($list as $key => $val) {
|
||||
if(!$val['text']) continue;
|
||||
$obj = null;
|
||||
if(!count($val['list'])) {
|
||||
$obj['href'] = getUrl('','mid',$val['url']);
|
||||
} else {
|
||||
$obj['href'] = getUrl('cmid',$val['node_srl']);
|
||||
}
|
||||
$obj['link'] = $obj['text'] = $val['text'];
|
||||
$childs[] = $obj;
|
||||
}
|
||||
$this->setChilds($childs);
|
||||
}
|
||||
|
||||
// 출력
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈의 WAP 클래스 객체 생성하여 WAP 준비
|
||||
**/
|
||||
function displayModuleContent() {
|
||||
// 선택된 모듈의 WAP class 객체 생성
|
||||
$oModule = &getWap($this->module_info->module);
|
||||
if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
|
||||
|
||||
$vars = get_object_vars($this->oModule);
|
||||
if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val;
|
||||
|
||||
// 실행
|
||||
$oModule->procWAP($this);
|
||||
|
||||
// 출력
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief WAP 컨텐츠를 별도로 구할 수 없으면 최종 결과물을 출력
|
||||
**/
|
||||
function displayContent() {
|
||||
Context::set('layout','none');
|
||||
|
||||
// 템플릿 컴파일
|
||||
$oTemplate = new TemplateHandler();
|
||||
$oContext = &Context::getInstance();
|
||||
|
||||
$content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile());
|
||||
$content = $oContext->transContent($content);
|
||||
$this->setContent($content);
|
||||
|
||||
// 출력
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
function getListedItems($menu, &$listed_items, &$mid_list) {
|
||||
if(!count($menu)) return;
|
||||
foreach($menu as $node_srl => $item) {
|
||||
if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $item['url'])) {
|
||||
$mid = $item['mid'] = $item['url'];
|
||||
$mid_list[$node_srl] = $mid;
|
||||
} else {
|
||||
$mid = $item['mid'] = null;
|
||||
}
|
||||
|
||||
$listed_items[$mid] = $item;
|
||||
getListedItems($item['list'], $listed_items, $mid_list);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -5,6 +5,13 @@
|
|||
**/
|
||||
class wap extends mobileXE {
|
||||
|
||||
/**
|
||||
* @brief constructor
|
||||
**/
|
||||
function wap() {
|
||||
parent::mobileXE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief wml 헤더 출력
|
||||
**/
|
||||
|
|
@ -42,14 +49,14 @@
|
|||
* @brief 버튼을 출력함
|
||||
**/
|
||||
function printBtn() {
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<do type="%s" label="%s"><go href="%s"/></do>%s', $this->getNo(), $url->text, $url->url, "\n");
|
||||
}
|
||||
if($this->nextUrl) {
|
||||
$url = $this->nextUrl;
|
||||
printf('<do type="%s" label="%s"><go href="%s"/></do>%s', $this->getNo(), $url->text, $url->url, "\n");
|
||||
}
|
||||
if($this->prevUrl) {
|
||||
$url = $this->prevUrl;
|
||||
printf('<do type="%s" label="%s"><go href="%s"/></do>%s', $this->getNo(), $url->text, $url->url, "\n");
|
||||
}
|
||||
if($this->homeUrl) {
|
||||
$url = $this->homeUrl;
|
||||
printf('<do type="access" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
$lang->cmd_go_upper = 'Upper';
|
||||
$lang->cmd_go_home = 'Go Home';
|
||||
$lang->cmd_view_sitemap = 'View site map';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@
|
|||
**/
|
||||
$lang->cmd_go_upper = '上位';
|
||||
$lang->cmd_go_home = 'トップへ';
|
||||
$lang->cmd_view_sitemap = 'View site map';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
$lang->cmd_go_upper = '상위';
|
||||
$lang->cmd_go_home = '홈으로';
|
||||
$lang->cmd_view_sitemap = '사이트맵 보기';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
$lang->cmd_go_upper = '上一级';
|
||||
$lang->cmd_go_home = '首页';
|
||||
$lang->cmd_view_sitemap = 'View site map';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
$lang->cmd_go_upper = '回上頁';
|
||||
$lang->cmd_go_home = '回首頁';
|
||||
$lang->cmd_view_sitemap = 'View site map';
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,149 +7,50 @@
|
|||
* @brief 모바일XE 애드온
|
||||
*
|
||||
* 헤더정보를 가로채서 모바일에서의 접속일 경우 WAP 태그로 컨텐츠를 출력함
|
||||
*
|
||||
* 동작 시점
|
||||
*
|
||||
* before_module_proc > 모바일 처리를 위해 모듈의 일반 설정을 변경해야 할 경우 호출
|
||||
*
|
||||
* after_module_proc > 모바일 컨텐츠 출력
|
||||
* 동작 조건
|
||||
**/
|
||||
|
||||
// 재호출을 막기 위한 코드
|
||||
// 관리자 페이지는 무시
|
||||
if(Context::get('module')=='admin') return;
|
||||
|
||||
// 관련 클래스 파일을 읽음
|
||||
// 동작 시점 관리
|
||||
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
|
||||
|
||||
// 모바일 브라우저가 아니라면 무시
|
||||
require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php');
|
||||
require_once(_XE_PATH_.'addons/mobile/classes/mobile.func.php');
|
||||
|
||||
// 모바일 브라우저가 아니면 return
|
||||
if(!mobileXE::getBrowserType()) return;
|
||||
|
||||
// 관리자 페이지이거나 입출력이 XMLRPC일 경우에도 return
|
||||
if(Context::get('module')=='admin' || Context::getRequestMethod()=='XMLRPC' || Context::getResponseMethod()=='XMLRPC' ) return;
|
||||
|
||||
/**
|
||||
* 전처리
|
||||
* 게시판의 경우 목록과 내용을 제대로 보여주기 위해서 모듈 정보를 조작함
|
||||
* 게시판 외의 경우 그냥 첫페이지의 내용을 출력함
|
||||
* 게시판 이외의 모듈 결과값은 차후 적용예정
|
||||
**/
|
||||
if($called_position == 'before_module_proc' && $this->module == 'board') {
|
||||
$this->list_count = $this->module_info->list_count = 9;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 동작 조건
|
||||
* 1. called_position == after_module_proc 일 경우에만 동작
|
||||
* 2. 관리자 페이지가 아닐 경우
|
||||
* 3. Context::getRequestMethod()!=='XMLRPC' 일 경우에만
|
||||
* 4. Context::getResponseMethod()!=='XMLRPC' 일 경우에만
|
||||
**/
|
||||
if($called_position != 'after_module_proc') return;
|
||||
|
||||
// mobile instance 생성
|
||||
$oMobile = &mobileXE::getInstance();
|
||||
if(!$oMobile) return;
|
||||
|
||||
// 애드온 설정에서 지정된 charset으로 지정
|
||||
$oMobile->setCharSet($addon_info->charset);
|
||||
|
||||
// 모듈의 정보를 구함
|
||||
$module_info = $this->module_info;
|
||||
// 모듈의 정보를 세팅
|
||||
$oMobile->setModuleInfo($this->module_info);
|
||||
|
||||
// 메뉴 정보가 있는지 검사
|
||||
if($module_info->menu_srl) {
|
||||
// 현재 모듈 객체 등록
|
||||
$oMobile->setModuleInstance($this);
|
||||
|
||||
// menu php cache 파일을 호출
|
||||
$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $module_info->menu_srl);
|
||||
if(file_exists($menu_cache_file)) {
|
||||
include $menu_cache_file;
|
||||
// 네비게이트 모드이거나 WAP class가 있을 경우 미리 컨텐츠를 추출하여 출력/ 종료
|
||||
if($called_position == 'before_module_proc') {
|
||||
|
||||
// 정리된 menu들을 1차원으로 변경
|
||||
getListedItems($menu->list, $listed_items, $mid_list);
|
||||
// 네비게이트 모드이면 네비게이션 컨텐츠 출력
|
||||
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
|
||||
|
||||
// url request parameter에 mid값이 없을 경우, 즉 첫페이지 인경우 전체 목록을 구함
|
||||
if(!isset($_GET['mid'])) $childs = $menu->list;
|
||||
// mid가 명시되어 있으면 해당 mid의 childs를 구함
|
||||
else $childs = $listed_items[$module_info->mid]['list'];
|
||||
// WAP class가 있으면 WAP class를 통해 컨텐츠 출력
|
||||
else $oMobile->displayModuleContent();
|
||||
|
||||
// 현재 메뉴의 depth가 1이상이면 상위 버튼을 지정
|
||||
if($module_info->is_default != 'Y') {
|
||||
$cur_menu_item = $listed_items[$module_info->mid];
|
||||
if($cur_menu_item['parent_srl']) {
|
||||
$parent_srl = $cur_menu_item['parent_srl'];
|
||||
if($parent_srl && $mid_list[$parent_srl]) {
|
||||
$parent_item = $listed_items[$mid_list[$parent_srl]];
|
||||
if($parent_item) $oMobile->setUpperUrl(getUrl('','mid',$parent_item['mid']), Context::getLang('cmd_go_upper') );
|
||||
// 네비게이트 모드가 아니고 WAP 클래스가 아니면 모듈의 결과를 출력
|
||||
} else if($called_position == 'after_module_proc') {
|
||||
// 내용 준비
|
||||
$oMobile->displayContent();
|
||||
}
|
||||
} else {
|
||||
$oMobile->setUpperUrl(getUrl(), Context::getLang('cmd_go_upper'));
|
||||
}
|
||||
}
|
||||
|
||||
// childs 메뉴들을 지정
|
||||
$oMobile->setChilds($childs);
|
||||
}
|
||||
}
|
||||
|
||||
// 만약 childs가 없을 경우 컨텐츠 입력
|
||||
if(!$oMobile->hasChilds()) {
|
||||
|
||||
// 현재 모듈이 게시판일 경우 (다른 모듈의 경우는 차후에..)
|
||||
if($module_info->module == 'board') {
|
||||
|
||||
// 선택된 게시글이 있으면 게시글의 내용을 출력
|
||||
$oDocument = Context::get('oDocument');
|
||||
if($oDocument && $oDocument->isExists()) {
|
||||
// 내용 지정 (태그를 모두 제거한 내용을 설정)
|
||||
$content = strip_tags($oDocument->getContent(false,false,false));
|
||||
$oMobile->setContent( $content );
|
||||
|
||||
// 상위 페이지를 목록으로 돌아가기로 지정
|
||||
$oMobile->setUpperUrl( getUrl('document_srl',''), Context::getLang('cmd_list') );
|
||||
|
||||
// 선택된 게시글이 없으면 목록을 출력
|
||||
} else {
|
||||
$document_list = Context::get('document_list');
|
||||
$childs = array();
|
||||
if($document_list && count($document_list)) {
|
||||
foreach($document_list as $key => $val) {
|
||||
$href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl);
|
||||
$text = $val->getTitleText(10);
|
||||
$obj = null;
|
||||
$obj['href'] = $href;
|
||||
$obj['link'] = $obj['text'] = $text;
|
||||
$childs[] = $obj;
|
||||
}
|
||||
$oMobile->setChilds($childs);
|
||||
}
|
||||
|
||||
$page_navigation = Context::get('page_navigation');
|
||||
$totalPage = $page_navigation->last_page;
|
||||
$page = (int)Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
|
||||
// next/prevUrl 지정
|
||||
if($page>1) $oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page-1, $totalPage));
|
||||
|
||||
if($page<$totalPage) $oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page+1, $totalPage));
|
||||
|
||||
$oMobile->mobilePage = $page;
|
||||
$oMobile->totalPage = $totalPage;
|
||||
}
|
||||
// 게시판 이외의 경우
|
||||
} else {
|
||||
// 레이아웃은 사용하지 않도록 함
|
||||
Context::set('layout','none');
|
||||
|
||||
// 템플릿 컴파일
|
||||
$oTemplate = new TemplateHandler();
|
||||
$oContext = &Context::getInstance();
|
||||
|
||||
$content = $oTemplate->compile($this->getTemplatePath(), $this->getTemplateFile());
|
||||
$content = $oContext->transContent($content);
|
||||
$oMobile->setContent( $content);
|
||||
}
|
||||
}
|
||||
|
||||
// 홈버튼 지정
|
||||
$oMobile->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
|
||||
|
||||
// 제목 지정
|
||||
$oMobile->setTitle(Context::getBrowserTitle());
|
||||
|
||||
// 출력
|
||||
$oMobile->display();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -331,6 +331,10 @@
|
|||
$instance_name = sprintf("%s%s",$module,"API");
|
||||
$class_file = sprintf('%s%s%s.api.php', _XE_PATH_, $class_path, $module);
|
||||
break;
|
||||
case 'wap' :
|
||||
$instance_name = sprintf("%s%s",$module,"WAP");
|
||||
$class_file = sprintf('%s%s%s.wap.php', _XE_PATH_, $class_path, $module);
|
||||
break;
|
||||
case 'class' :
|
||||
$instance_name = $module;
|
||||
$class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module);
|
||||
|
|
|
|||
|
|
@ -147,6 +147,15 @@
|
|||
return getModule($module_name, 'api');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module의 wap 객체 생성용
|
||||
* @param module_name 모듈이름
|
||||
* @return module wap class instance
|
||||
**/
|
||||
function &getWAP($module_name) {
|
||||
return getModule($module_name, 'wap');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module의 상위 class 객체 생성용
|
||||
* @param module_name 모듈이름
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@
|
|||
/**
|
||||
* 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
|
||||
**/
|
||||
$this->dispBoardCatogoryList();
|
||||
|
||||
$this->dispBoardCategoryList();
|
||||
|
||||
/**
|
||||
* 목록이 노출될때 같이 나오는 검색 옵션을 정리하여 스킨에서 쓸 수 있도록 context set
|
||||
|
|
@ -98,7 +97,7 @@
|
|||
$this->setTemplateFile('list');
|
||||
}
|
||||
|
||||
function dispBoardCatogoryList(){
|
||||
function dispBoardCategoryList(){
|
||||
if($this->module_info->use_category=='Y') {
|
||||
$oDocumentModel = &getModel('document');
|
||||
Context::set('category_list', $oDocumentModel->getCategoryList($this->module_srl));
|
||||
|
|
@ -113,10 +112,8 @@
|
|||
$document_srl = Context::get('document_srl');
|
||||
$page = Context::get('page');
|
||||
|
||||
// document model 객체를 생성
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
// 혹시 선택된 문서가 있다면 해당 문서에 대한 객체를 생성함 (일단 빈객체를 만드는 것은 선택된 글이 없을때 스킨에서 object 오류발생하는 것을 막기 위함)
|
||||
// 혹시 선택된 문서가 있다면 해당 문서에 대한 객체를 생성함
|
||||
// (일단 빈객체를 만드는 것은 선택된 글이 없을때 스킨에서 object 오류발생하는 것을 막기 위함)
|
||||
$oDocument = $oDocumentModel->getDocument(0);
|
||||
|
||||
// document_srl이 있다면 해당 글을 구해와서 $oDocument로 세팅
|
||||
|
|
@ -210,6 +207,7 @@
|
|||
function dispBoardContentList(){
|
||||
$oDocumentModel = &getModel('document');
|
||||
$args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl
|
||||
|
||||
// 목록을 구하기 위한 대상 모듈/ 페이지 수/ 목록 수/ 페이지 목록 수에 대한 옵션 설정
|
||||
$args->page = Context::get('page');; ///< 페이지
|
||||
$args->list_count = $this->list_count; ///< 한페이지에 보여줄 글 수
|
||||
|
|
|
|||
115
modules/board/board.wap.php
Normal file
115
modules/board/board.wap.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* @class boardWAP
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief board 모듈의 WAP class
|
||||
**/
|
||||
|
||||
class boardWAP extends board {
|
||||
|
||||
/**
|
||||
* @brief wap procedure method
|
||||
**/
|
||||
function procWAP(&$oMobile) {
|
||||
// 권한 체크
|
||||
if(!$this->grant->list || $this->module_info->consultation == 'Y') return $oMobile->setContent(Context::getLang('msg_not_permitted'));
|
||||
|
||||
// document model 객체 생성
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
// 선택된 게시글이 있을 경우
|
||||
$document_srl = Context::get('document_srl');
|
||||
if($document_srl) {
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if($oDocument->isExists()) {
|
||||
// 권한 확인
|
||||
if(!$this->grant->view) return $oMobile->setContent(Context::getLang('msg_not_permitted'));
|
||||
|
||||
// 글 제목 설정
|
||||
Context::setBrowserTitle($oDocument->getTitleText());
|
||||
|
||||
// 댓글 보기 일 경우
|
||||
if($this->act=='dispBoardContentCommentList') {
|
||||
|
||||
$oCommentModel = &getModel('comment');
|
||||
$output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
|
||||
|
||||
$content = '';
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $val){
|
||||
$oComment = new commentItem();
|
||||
$oComment->setAttribute($val);
|
||||
if(!$oComment->isAccessible()) continue;
|
||||
$content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
// 내용 설정
|
||||
$oMobile->setContent( $content );
|
||||
|
||||
// 상위 페이지를 목록으로 돌아가기로 지정
|
||||
$oMobile->setUpperUrl( getUrl('act',''), Context::getLang('cmd_go_upper') );
|
||||
|
||||
// 댓글 보기가 아니면 글 보여줌
|
||||
} else {
|
||||
|
||||
// 내용 지정 (태그를 모두 제거한 내용을 설정)
|
||||
$content = strip_tags($oDocument->getContent(false,false,false));
|
||||
|
||||
|
||||
// 내용 상단에 정보 출력 (댓글 보기 링크 포함)
|
||||
$content = Context::getLang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content;
|
||||
$content = '<b>'.$oDocument->getNickName()."</b> (".$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content;
|
||||
|
||||
// 내용 설정
|
||||
$oMobile->setContent( $content );
|
||||
|
||||
// 상위 페이지를 목록으로 돌아가기로 지정
|
||||
$oMobile->setUpperUrl( getUrl('document_srl',''), Context::getLang('cmd_list') );
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 게시글 목록
|
||||
$args->module_srl = $this->module_srl;
|
||||
$args->page = Context::get('page');;
|
||||
$args->list_count = 9;
|
||||
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
|
||||
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
|
||||
$output = $oDocumentModel->getDocumentList($args, $this->except_notice);
|
||||
$document_list = $output->data;
|
||||
$page_navigation = $output->page_navigation;
|
||||
|
||||
$childs = array();
|
||||
if($document_list && count($document_list)) {
|
||||
foreach($document_list as $key => $val) {
|
||||
$href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl);
|
||||
$obj = null;
|
||||
$obj['href'] = $val->getPermanentUrl();
|
||||
|
||||
$title = $val->getTitleText();
|
||||
if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';
|
||||
$obj['link'] = $obj['text'] = $title;
|
||||
$childs[] = $obj;
|
||||
}
|
||||
$oMobile->setChilds($childs);
|
||||
}
|
||||
|
||||
$totalPage = $page_navigation->last_page;
|
||||
$page = (int)Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
|
||||
// next/prevUrl 지정
|
||||
if($page>1) $oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page-1, $totalPage));
|
||||
|
||||
if($page<$totalPage) $oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page+1, $totalPage));
|
||||
|
||||
$oMobile->mobilePage = $page;
|
||||
$oMobile->totalPage = $totalPage;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -34,6 +34,5 @@
|
|||
|
||||
$this->setTemplateFile('content');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
24
modules/page/page.wap.php
Normal file
24
modules/page/page.wap.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* @class pageWap
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief page 모듈의 wap class
|
||||
**/
|
||||
|
||||
class pageWap extends page {
|
||||
|
||||
/**
|
||||
* @brief wap procedure method
|
||||
*
|
||||
* 페이지 모듈은 형식이 정해져 있지 않기에 전체 컨텐츠를 mobile class에서 제어해서 출력함
|
||||
**/
|
||||
function procWAP(&$oMobile) {
|
||||
// 권한 체크
|
||||
if(!$this->grant->view) return $oMobile->setContent(Context::getLang('msg_not_permitted'));
|
||||
|
||||
// 위젯의 내용을 추출/ 정리해서 보여줌
|
||||
$oMobile->setContent( Context::transContent($this->module_info->content) );
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue