#18961156 #18963039 : improved removing widget (not it can be restored through go back button), added mobile class for the page module

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7545 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2010-06-23 14:12:29 +00:00
parent fe7754a608
commit e9ce46a6a6
24 changed files with 320 additions and 58 deletions

View file

@ -17,6 +17,8 @@
<action name="dispPageAdminDelete" type="view" standalone="true" />
<action name="dispPageAdminContentModify" type="view" standalone="true" />
<action name="dispPageAdminAddContent" type="view" standalone="true" />
<action name="dispPageAdminMobileContentModify" type="view" standalone="true" />
<action name="dispPageAdminMobileContent" type="view" standalone="true" />
<action name="procPageAdminRemoveWidgetCache" type="controller" standalone="true" />
<action name="procPageAdminInsert" type="controller" standalone="true" />

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = "Modify";
$lang->page_caching_interval = "Caching Time";
$lang->about_page_caching_interval = "The unit is minute, and it displays temporary saved data for assigned time.<br />It is recommended to cache for proper time if a lot of resources are needed when displaying other servers' data or information.<br />A value of 0 will not cache.";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->page_caching_interval = "Establezca el tiempo de cache";
$lang->about_page_caching_interval = "La unidad es minuto, y se muestra temporal de los datos guardados por el tiempo asignado. <br /> Se recomienda a la cache para una buena vez si una gran cantidad de recursos se necesitan otros servidores cuando se muestran los datos o la informacion. <br /> Un valor de 0 no cache.";
$lang->cmd_page_modify = "Modificar";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = "Modifier";
$lang->page_caching_interval = "Temps de antémémoire";
$lang->about_page_caching_interval = "L'unité est minute, et ça exposera des données conservées temporairement pendant le temps assigné.<br />Il est recommandé d'utiliser l'antémémoire pendant le temps convenable si beaucoup de ressource est nécessaire pour représenter les données ou l'information d'autre serveur.<br />La valeur 0 signifie de ne pas utiliser antémémoire.";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = 'ページ修正';
$lang->page_caching_interval = 'キャッシング時間設定';
$lang->about_page_caching_interval = '分単位で指定出来、設定された時間の間は、臨時保存されたデータを出力します。<br />他のサーバの情報を出力したり、データを出力する際、リソースが多く使われるため、数分単位でキャッシングすることをお勧めします。<br />「0」に指定するとキャッシングされません。';
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = '페이지 수정';
$lang->page_caching_interval = '캐싱 시간 설정';
$lang->about_page_caching_interval = '분 단위이며 정해진 시간동안은 임시 저장한 데이터를 출력합니다.<br />다른 서버의 정보를 출력하거나, 데이터 출력하는데 많은 자원이 필요한 경우, 원하시는 분 단위 시간 간격으로 캐싱하는 것을 추천합니다.<br />0 으로 하시면 캐싱을 하지 않습니다.';
$lang->about_mcontent = '모바일에서 보여질 페이지입니다. 만약 작성하지 않으면 기본 페이지 데이터를 재정렬해서 보여줍니다.';
?>

View file

@ -10,4 +10,5 @@
$lang->page_caching_interval = "Установить время кеширования";
$lang->about_page_caching_interval = "Единица измерения равна одной минуте. Это отображает временно сохраненные данные для присвоенного времени.<br />Рекомендуется устанавливать разумное время кеширования, если множество ресурсов нуждаются в показе данных с других серверов.<br />Значение 0 отключает кеширование.";
$lang->cmd_page_modify = "Изменить";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -12,4 +12,5 @@
$lang->cmd_page_modify = "Sửa đổi";
$lang->page_caching_interval = "Thời gian lưu trữ";
$lang->about_page_caching_interval = "Đơn vị được tính bằng phút, nó sẽ là thời gian lưu trữ tạm thời.<br />Đó là khuyến cáo thời gian lưu trữ tạm thời thích hợp khi cần để hiển thị.<br />Nhập 0 nếu không sử dụng tính năng này.";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = "页面编辑";
$lang->page_caching_interval = "缓冲时间设置";
$lang->about_page_caching_interval = "单位为分。缓冲时间间隔内页面将输出临时储存的数据。<br />显示外链服务器信息或数据时,如消耗资源很大,尽量把缓冲时间设置为大一点的相应值。<br />0 表示无缓冲。";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -10,4 +10,5 @@
$lang->cmd_page_modify = "頁面編輯";
$lang->page_caching_interval = "暫存時間設置";
$lang->about_page_caching_interval = "單位為分。暫存時間內頁面將輸出臨時儲存的資料。<br />輸出外部主機訊息或資料時,如消耗資源很大,盡量把暫存時間設大一點。<br />『0』表示不暫存。";
$lang->about_mcontent = 'This is the page for the mobile view. If you do not write this page, the mobile view display reoragnized PC view\'s page.';
?>

View file

@ -30,7 +30,17 @@
// module_srl이 넘어오면 원 모듈이 있는지 확인
if($args->module_srl) {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
if($module_info->module_srl != $args->module_srl) {
unset($args->module_srl);
}
else
{
foreach($args as $key=>$val)
{
$module_info->{$key} = $val;
}
$args = $module_info;
}
}
// module_srl의 값에 따라 insert/update
@ -49,6 +59,22 @@
$this->setMessage($msg_code);
}
function putDocumentsInPageToArray($target, &$array)
{
if(!$target) return;
preg_match_all('!<img src="./common/tpl/images/widget_bg.jpg" ([^>]+)!is', $target, $matches);
$pattern = '!document_srl="(\d+)"!';
foreach($matches[1] as $match)
{
$match2 = null;
preg_match($pattern, $match, $match2);
if(count($match2))
{
$array[(int)$match2[1]] = 1;
}
}
}
/**
* @brief 페이지 수정 내용 저장
**/
@ -56,13 +82,36 @@
$module_srl = Context::get('module_srl');
$content = Context::get('content');
if(!$module_srl) return new Object(-1,'msg_invalid_request');
$mcontent = Context::get('mcontent');
$type = Context::get('type');
// 페이지의 원 정보를 구해옴
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!isset($content)) $content ='';
$module_info->content = $content;
if($type == "mobile") {
$module_info->mcontent = $mcontent;
}
else {
if(!isset($content)) $content ='';
$module_info->content = $content;
}
$document_srls = array();
$this->putDocumentsInPageToArray($module_info->content, $document_srls);
$this->putDocumentsInPageToArray($module_info->mcontent, $document_srls);
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
$obj->module_srl = $module_srl;
$obj->list_count = 99999999;
$output = $oDocumentModel->getDocumentList($obj);
if(count($output->data)) {
foreach($output->data as $document)
{
if($document_srls[$document->document_srl]) continue;
$oDocumentController->deleteDocument($document->document_srl, true);
}
}
// module 모듈의 controller 객체 생성
$oModuleController = &getController('module');

View file

@ -91,6 +91,8 @@
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
Context::set('mlayout_list', $mobile_layout_list);
// 템플릿 파일 지정
$this->setTemplateFile('page_info');
@ -136,11 +138,63 @@
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
Context::set('mlayout_list', $mobile_layout_list);
// 템플릿 파일 지정
$this->setTemplateFile('page_insert');
}
function dispPageAdminMobileContent() {
if($this->module_srl) Context::set('module_srl',$this->module_srl);
// 캐시 파일 지정
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int)($this->module_info->page_caching_interval);
if($interval>0) {
if(!file_exists($cache_file)) $mtime = 0;
else $mtime = filemtime($cache_file);
if($mtime + $interval*60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController = &getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
$page_content = $this->module_info->mcontent;
}
Context::set('module_info', $this->module_info);
Context::set('page_content', $page_content);
$this->setTemplateFile('mcontent');
}
function dispPageAdminMobileContentModify() {
Context::set('module_info', $this->module_info);
// 내용을 세팅
$content = Context::get('mcontent');
if(!$content) $content = $this->module_info->mcontent;
Context::set('content', $content);
// 내용중 위젯들을 변환
$oWidgetController = &getController('widget');
$content = $oWidgetController->transWidgetCode($content, true);
Context::set('page_content', $content);
// 위젯 목록을 세팅
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
// 템플릿 파일 지정
$this->setTemplateFile('page_mobile_content_modify');
}
/**
* @brief 페이지 내용 수정
**/

View file

@ -0,0 +1,45 @@
<?php
class pageMobile extends ModuleObject {
function init() {
// 템플릿 경로 구함 (page의 경우 tpl에 관리자용 템플릿 모아놓음)
$this->setTemplatePath($this->module_path.'tpl');
}
function dispPageIndex() {
// 위젯을 1렬로 정렬
if($this->module_info->mcontent)
{
$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
$interval = (int)($this->module_info->page_caching_interval);
if($interval>0) {
if(!file_exists($cache_file)) $mtime = 0;
else $mtime = filemtime($cache_file);
if($mtime + $interval*60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController = &getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
$page_content = $this->module_info->mcontent;
}
Context::set('content', $page_content);
}
else
{
preg_match_all('!(<img)([^\>]*)(widget=)([^\>]*?)(\>)!is', $this->module_info->content, $matches);
$content = '';
for($i=0,$c=count($matches[0]);$i<$c;$i++) {
$content .= preg_replace('/ style\=\"([^\"]+)\" /i',' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ',$matches[0][$i])."\n\n";
}
Context::set('content', $content);
}
$this->setTemplateFile('mobile');
}
}
?>

View file

@ -8,5 +8,8 @@
<a href="{getUrl('act','dispPageAdminInfo','module_srl',$module_info->module_srl)}" class="button green"><span>{$lang->cmd_setup}</span></a>
<!--@end-->
<a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}" class="button red"><span>{$lang->cmd_page_modify}</span></a>
<!--@if($module_info->use_mobile =="Y")-->
<a href="{getUrl('act','dispPageAdminMobileContent','module_srl',$module_info->module_srl)}" class="button black"><span>Mobile</span></a>
<!--@end-->
</div>
<!--@end-->

View file

@ -0,0 +1,18 @@
<filter name="insert_mpage_content" module="page" act="procPageAdminInsertContent" confirm_msg_code="confirm_submit">
<form>
<node target="module_srl" required="true" />
</form>
<parameter>
<param name="module_srl" target="module_srl" />
<param name="mid" target="mid" />
<param name="mcontent" target="content" />
<parma name="type" target="type" />
</parameter>
<response callback_func="completeInsertMobilePageContent">
<tag name="error" />
<tag name="message" />
<tag name="mid" />
<tag name="module_srl" />
<tag name="page" />
</response>
</filter>

View file

@ -37,6 +37,17 @@ function completeInsertPageContent(ret_obj) {
location.href = current_url.setQuery('mid',mid).setQuery('act','');
}
function completeInsertMobilePageContent(ret_obj) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var page = ret_obj['page'];
var module_srl = ret_obj['module_srl'];
var mid = ret_obj['mid'];
location.href = current_url.setQuery('mid',mid).setQuery('act','dispPageAdminMobileContent');
}
/* 수정한 페이지 컨텐츠를 저장 */
function doSubmitPageContent(fo_obj) {
var html = getWidgetContent();
@ -44,6 +55,12 @@ function doSubmitPageContent(fo_obj) {
return procFilter(fo_obj, insert_page_content);
}
function doSubmitMPageContent(fo_obj) {
var html = getWidgetContent();
fo_obj.content.value = html;
return procFilter(fo_obj, insert_mpage_content);
}
/* 모듈 삭제 후 */
function completeDeletePage(ret_obj) {
var error = ret_obj['error'];

View file

@ -0,0 +1,14 @@
<div>{$page_content}</div>
<!--@if($grant->manager)-->
<!--%import("./js/page_admin.js")-->
<div class="tRight gap1 clear">
<a href="#" onclick="doRemoveWidgetCache({$module_info->module_srl}); return false;" class="button blue"><span>{$lang->cmd_remake_cache}</span></a>
<!--@if($logged_info->is_admin=='Y')-->
<a href="{getUrl('act','dispPageAdminInfo','module_srl',$module_info->module_srl)}" class="button green"><span>{$lang->cmd_setup}</span></a>
<!--@end-->
<a href="{getUrl('act','dispPageAdminMobileContentModify','document_srl','')}" class="button red"><span>{$lang->cmd_page_modify}</span></a>
<a href="{getUrl('act','','module_srl',$module_info->module_srl)}" class="button black"><span>PC</span></a>
<p style="color:#777">{$lang->about_mcontent}</p>
</div>
<!--@end-->

View file

@ -0,0 +1,2 @@
{$content}

View file

@ -4,7 +4,6 @@
<form action="./" method="post" onsubmit="return procFilter(this, insert_page)" enctype="multipart/form-data">
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="content" value="{htmlspecialchars($module_info->content)}" />
<table cellspacing="0" class="rowTable">
<tr>
@ -45,6 +44,25 @@
</select>
<p>{$lang->about_layout}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->mobile_view}</div></th>
<td>
<input type="checkbox" name="use_mobile" value="Y" <!--@if($module_info->use_mobile == "Y")-->checked="checked"<!--@end--> />
<p>{$lang->about_mobile_view}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->mobile_layout}</div></th>
<td>
<select name="mlayout_srl">
<option value="0">{$lang->notuse}</option>
<!--@foreach($mlayout_list as $key => $val)-->
<option value="{$val->layout_srl}" <!--@if($module_info->mlayout_srl==$val->layout_srl)-->selected="selected"<!--@end-->>{$val->title} ({$val->layout})</option>
<!--@end-->
</select>
<p>{$lang->about_layout}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->page_caching_interval}</div></th>

View file

@ -47,6 +47,25 @@
</select>
<p>{$lang->about_layout}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->mobile_view}</div></th>
<td>
<input type="checkbox" name="use_mobile" value="Y" <!--@if($module_info->use_mobile == "Y")-->checked="checked"<!--@end--> />
<p>{$lang->about_mobile_view}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->mobile_layout}</div></th>
<td>
<select name="mlayout_srl">
<option value="0">{$lang->notuse}</option>
<!--@foreach($mlayout_list as $key => $val)-->
<option value="{$val->layout_srl}" <!--@if($module_info->mlayout_srl==$val->layout_srl)-->selected="selected"<!--@end-->>{$val->title} ({$val->layout})</option>
<!--@end-->
</select>
<p>{$lang->about_layout}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->page_caching_interval}</div></th>

View file

@ -0,0 +1,62 @@
<!--%import("filter/insert_mpage_content.xml")-->
<!--%import("js/page_admin.js")-->
<!--%import("css/page.css")-->
<!--%import("../../widget/tpl/js/widget.js")-->
<!--%import("../../widget/tpl/css/widget.css")-->
<div class="clear"></div>
<div id="zonePageContent">{$page_content}</div>
<div class="clear"></div>
<div class="adminLayer">
<form action="./" method="post" id="pageFo" onsubmit="return doSubmitMPageContent(this);">
<input type="hidden" name="mid" value="{$module_info->mid}" />
<input type="hidden" name="module" value="page" />
<input type="hidden" name="act" value="dispPageAdminContentModify" />
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
<input type="hidden" name="content" value="{htmlspecialchars($content)}" />
<input type="hidden" name="type" value="mobile" />
<div class="buttonBox">
<div class="fl">
<span class="button black "><input type="button" value="{$lang->cmd_box_widget_insert}" onclick="doAddWidgetBox(); return false;" /></span>
</div>
<div class="fr">
<select name="widget_list">
<!--@foreach($widget_list as $widget)-->
<option value="{$widget->widget}" <!--@if($widget->widget=='content')-->selected="selected"<!--@end-->>{$widget->title}</option>
<!--@end-->
</select>
<span class="button blue"><input type="button" value="{$lang->cmd_insert}" onclick="doAddWidget(this.form); return false;"/></span>
<span class="button green"><input type="button" value="{$lang->cmd_content_insert}" onclick="doAddContent('{$module_info->mid}'); return false;" /></span>
</div>
<div class="buttonDiv"></div>
<div class="tRight">
<span class="button black strong"><input type="submit" value="{$lang->cmd_save}"/></span>
<span class="button red"><input type="button" value="{$lang->cmd_remove_all_widgets}" onclick="removeAllWidget();return false;"/></span>
<span class="button"><input type="button" value="{$lang->cmd_back}" onclick="location.href=current_url.setQuery('mid','{$module_info->mid}').setQuery('act','dispPageAdminMobileContent');return false;"/></span>
</div>
</div>
</form>
</div>
<div id="widgetButton" class="widgetButtons">
<div class="widgetStyle"></div>
<div class="widgetSetup"></div>
<div class="widgetCopy"></div>
<div class="widgetSize"></div>
<div class="widgetRemove"></div>
</div>
<div id="widgetBoxButton" class="widgetButtons">
<div class="widgetStyle"></div>
<div class="widgetBoxSize"></div>
<div class="widgetBoxRemove"></div>
</div>
<script type="text/javascript">
var confirm_delete_msg = "{$lang->confirm_delete}";
xAddEventListener(window,"load",function() { doStartPageModify('zonePageContent', '{$module_info->module_srl}'); jQuery('div#xeAdmin').css('background-color','transparent');});
</script>
<!--#include("../../widget/tpl/widget_layer.html")-->

View file

@ -18,9 +18,8 @@
<action name="procWidgetDeleteDocument" type="controller" standalone="true" />
<action name="procWidgetGenerateCodeInPage" type="controller" standalone="true" />
<action name="procWidgetGetColorsetList" type="controller" standalone="true" />
<action name="procWidgetRemoveContents" type="controller" standalone="true" />
<action name="procWidgetStyleExtraImageUpload" type="controller" standalone="true" />
<action name="procWidgetStyleGenerateCodeInPage" type="controller" standalone="true" />
</actions>
</module>
</module>

View file

@ -64,10 +64,8 @@ function doStartPageModify(zoneID, module_srl) {
// 내용 모두 삭제
function removeAllWidget() {
if(!confirm(confirm_delete_msg)) return;
var response_tags = new Array('error','message');
var params = new Array();
params['module_srl'] = xGetElementById('pageFo').module_srl.value;
exec_xml('widget',"procWidgetRemoveContents",params,function() { restoreWidgetButtons(); xInnerHtml(zonePageObj,'') });
restoreWidgetButtons();
xInnerHtml(zonePageObj,'');
}
/**
@ -557,16 +555,7 @@ function doCheckWidget(e) {
var widget = p_obj.getAttribute("widget");
if(confirm(confirm_delete_msg)) {
restoreWidgetButtons();
if(p_obj.getAttribute('widget')=='widgetContent') {
var response_tags = new Array('error','message','document_srl');
var params = new Array();
params['document_srl'] =p_obj.getAttribute('document_srl');
exec_xml('widget','procWidgetDeleteDocument', params, completeDeleteWidgetContent, response_tags, params, p_obj);
return;
} else {
p_obj.parentNode.removeChild(p_obj);
}
p_obj.parentNode.removeChild(p_obj);
}
return;
}

View file

@ -223,44 +223,6 @@
if(!$output->toBool()) return $output;
}
/**
* @brief 내용 지우기
**/
function procWidgetRemoveContents() {
$module_srl = Context::get('module_srl');
if(!$module_srl) return new Object(-1,'msg_invalid_request');
// 대상 페이지 모듈 정보 구함
$oModuleModel = &getModel('module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request');
// 권한 체크
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
$user_group = $logged_info->group_list;
$is_admin = false;
if(count($user_group)&&count($page_info->grants['manager'])) {
$manager_group = $page_info->grants['manager'];
foreach($user_group as $group_srl => $group_info) {
if(in_array($group_srl, $manager_group)) $is_admin = true;
}
}
if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_infoi->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted');
// 등록된 글 목록 구함
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
$obj->module_srl = $module_srl;
$obj->list_count = 99999999;
$output = $oDocumentModel->getDocumentList($obj);
if(!$output->total_count) return new Object();
for($i=0;$i<$output->data;$i++) {
$oDocumentController->deleteDocument($output->data[$i]->document_srl, true);
}
return new Object();
}
/**
* @brief 위젯 코드를 Javascript로 수정/드래그등을 하기 위한 Javascript 수정 모드로 변환
**/