모듈 선택기능 추가 (위젯의 단일/다수 위젯 선택, 첵크된 게시글 이동/복사시) 사용되며 virtualSite외의 사이트들도 검색후 선택이 가능하도록 개선

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5298 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-01-09 09:37:43 +00:00
parent 3345d21c4e
commit 906bb46d19
83 changed files with 970 additions and 543 deletions

View file

@ -8,6 +8,8 @@
<action name="dispWidgetAdminDownloadedList" type="view" standalone="true" admin_index="true" />
<action name="dispWidgetAdminAddContent" type="view" standalone="true" />
<action name="getWidgetAdminModuleList" type="model" standalone="true" />
<action name="procWidgetGenerateCode" type="controller" standalone="true" />
<action name="procWidgetAddContent" type="controller" standalone="true" />
<action name="procWidgetInsertDocument" type="controller" standalone="true" />

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = "'%s' does not exist.";
$lang->msg_widget_object_is_null = "Object of '%s' could not be created.";
$lang->msg_widget_proc_is_null = "proc() of '%s' could not be executed.";
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = 'Please input required value first, and click [Generate Code] button to generate code to add to the template file.';
$lang->about_widget_code_in_page = 'After entering the required values, click the [Add] button to insert the widget code into the page.';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = 'No existe widget %s .';
$lang->msg_widget_object_is_null = 'No puede ser creado el objeto de widget %s.';
$lang->msg_widget_proc_is_null = 'No puede ser ejecutado el proc() de widget %s.';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = 'Ingrese primero los valores requeridos, luego presiona el botón "Generar códigos" para mostrar el código en el espacio inferior para ser añadido en el archivo de los temas.';
$lang->about_widget_code_in_page = 'Luego de ingresar los valores requeridos, presiona el botón "Añadir" para insertar el código de widget dentro de la página.';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = "Le Gadget de(d') '%s' n'existe pas.";
$lang->msg_widget_object_is_null = "L'Objet de '%s' n'a pas pu être créé.";
$lang->msg_widget_proc_is_null = "proc() de '%s' n'a pas pu être exécuté.";
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = 'Entrez les valeurs qui sont requises par le gadget choisi, et puis cliquz le bouton [Générer le Code] pour générer le code. Le code à appliquer au fichier de modèl se présentera en bas.';
$lang->about_widget_code_in_page = 'Après entrer les valeurs requies, cliquez le bouton [Ajouter] pour insérer le gadjet dans la page.';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = '%s ウィジェットが見つかりません。';
$lang->msg_widget_object_is_null = '%s ウィジェットのオブジェクトが生成できません。';
$lang->msg_widget_proc_is_null = '%s ウィセットの proc() が実行できません。';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = '選択されたウィゼットで求められる下の項目の値を入力し、「コード生成」ボタンをクリックすると、<br />一番下にテンプレートファイルに適用できるコードが出力されます。';
$lang->about_widget_code_in_page = '下に必要な値を入力した後、追加ボタンをクリックするとページ内にウィジェットが挿入されます。';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = '%s 위젯을 찾을 수 없습니다';
$lang->msg_widget_object_is_null = '%s 위젯의 객체 생성을 할 수가 없습니다';
$lang->msg_widget_proc_is_null = '%s 위젯의 proc() 를 실행할 수가 없습니다';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = '선택하신 위젯에서 요구하는 아래 항목들의 값을 넣고 [코드생성]버튼을 누르시면 제일 아래 칸에 템플릿 파일에 적용할 수 있는 코드가 출력 됩니다';
$lang->about_widget_code_in_page = '아래 필요한 값들을 입력하신 후 추가 버튼을 누르시면 페이지 내에 위젯이 삽입이 됩니다';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = '%s виджет не существует.';
$lang->msg_widget_object_is_null = '%s объектов виджета не могут быть созданы.';
$lang->msg_widget_proc_is_null = 'proc() %s виджета не может быть исполнена.';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = 'Пожалуйста, сначала введите требуемые значения, и затем щелкните кнопку [Генерировать Код] для генерации кода и добавления его в файл шаблона.';
$lang->about_widget_code_in_page = 'После ввода требуемых значений, нажмите пнопку [Добавить], чтобы вставить код виджета в страницу.';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = '找不到%s控件';
$lang->msg_widget_object_is_null = '无法生成%s控件对象';
$lang->msg_widget_proc_is_null = '不能执行%s控件的 proc()';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = '输入被选控件所需要的下列各项后,按『代码生成』按钮,即可在页面下方获得可以用在布局模版代码片断。';
$lang->about_widget_code_in_page = '输入下列各项必要值后,按『生成代码』按钮,即可把控件插入到页面当中。';

View file

@ -37,6 +37,7 @@
$lang->msg_widget_is_not_exists = '找不到%s控件';
$lang->msg_widget_object_is_null = '無法建立%s控件目標';
$lang->msg_widget_proc_is_null = '無法執行%s控件的 proc()';
$lang->msg_widget_skin_is_null = '위젯의 스킨을 선택해 주셔야 정상적으로 동작할 수 있습니다';
$lang->about_widget_code = '輸入所選控件所需要的各項資料後,按『建立原始碼』按鈕,即可在頁面下方獲得運用在版面設計中的部分原始碼。';
$lang->about_widget_code_in_page = '輸入下列各項必要資料後,按『建立原始碼』按鈕,即可把控件插入到頁面當中。';

View file

@ -3,7 +3,6 @@
.widget_title { border:1px solid #DDDDDD; margin:10px 5px 5px 0; padding:3px; }
.widget_mid_list { margin:0 0 5px 10px; }
.widget_description { color:#AAAAAA; border-top:1px dotted #EEEEEE; margin:5px 0 0 0; padding:5px 0 0 0; }
#colorset_area { margin-top:.5em; }
#colorset_area .header { float:left; margin-right:.5em; padding-top:.2em;}
@ -52,3 +51,6 @@
div.editor { width:700px; }
.help { padding:5px 0; background-color:#EFEFEF; border-top:1px solid #CCCCCC; }
ul.midCommand { float:left; margin:0 0 0 10px;; padding:0;}
ul.midCommand li { display:block; margin-bottom:5px; list-style:none;}

View file

@ -90,6 +90,7 @@ function doFillWidgetVars() {
fo_obj.widget_padding_top.value = selected_node.getAttribute("widget_padding_top");
for(var name in fo_obj) {
if(name.indexOf('_')==0) continue;
var node = fo_obj[name];
if(!node || typeof(node)=="undefined") continue;
@ -99,6 +100,7 @@ function doFillWidgetVars() {
else length = 0;
switch(type) {
case "hidden" :
case "text" :
case "textarea" :
var val = selected_node.getAttribute(name);
@ -165,3 +167,140 @@ function checkFixType(obj) {
if(width>100) fo_obj.widget_width.value = 100;
}
}
// 위젯의 대상 모듈 입력기 (단일 선택)
function insertSelectedModule(id, module_srl, mid, browser_title) {
var obj= xGetElementById('_'+id);
var sObj = xGetElementById(id);
sObj.value = module_srl;
obj.value = browser_title+' ('+mid+')';
}
// 위젯의 대상 모듈 입력기 (다중 선택)
function insertSelectedModules(id, module_srl, mid, browser_title) {
var sel_obj = xGetElementById('_'+id);
for(var i=0;i<sel_obj.options.length;i++) if(sel_obj.options[i].value==module_srl) return;
var opt = new Option(browser_title+' ('+mid+')', module_srl, false, false);
sel_obj.options[sel_obj.options.length] = opt;
if(sel_obj.options.length>8) sel_obj.size = sel_obj.options.length;
syncMid(id);
}
function midMoveUp(id) {
var sel_obj = xGetElementById('_'+id);
if(sel_obj.selectedIndex<0) return;
var idx = sel_obj.selectedIndex;
if(idx < 1) return;
var s_obj = sel_obj.options[idx];
var t_obj = sel_obj.options[idx-1];
var value = s_obj.value;
var text = s_obj.text;
s_obj.value = t_obj.value;
s_obj.text = t_obj.text;
t_obj.value = value;
t_obj.text = text;
sel_obj.selectedIndex = idx-1;
syncMid(id);
}
function midMoveDown(id) {
var sel_obj = xGetElementById('_'+id);
if(sel_obj.selectedIndex<0) return;
var idx = sel_obj.selectedIndex;
if(idx == sel_obj.options.length-1) return;
var s_obj = sel_obj.options[idx];
var t_obj = sel_obj.options[idx+1];
var value = s_obj.value;
var text = s_obj.text;
s_obj.value = t_obj.value;
s_obj.text = t_obj.text;
t_obj.value = value;
t_obj.text = text;
sel_obj.selectedIndex = idx+1;
syncMid(id);
}
function midRemove(id) {
var sel_obj = xGetElementById('_'+id);
if(sel_obj.selectedIndex<0) return;
var idx = sel_obj.selectedIndex;
sel_obj.remove(idx);
idx = idx-1;
if(idx < 0) idx = 0;
if(sel_obj.options.length) sel_obj.selectedIndex = idx;
syncMid(id);
}
function syncMid(id) {
var sel_obj = xGetElementById('_'+id);
var valueArray = new Array();
for(var i=0;i<sel_obj.options.length;i++) valueArray[valueArray.length] = sel_obj.options[i].value;
xGetElementById(id).value = valueArray.join(',');
}
function getModuleSrlList(id) {
var obj = xGetElementById(id);
if(!obj.value) return;
var value = obj.value;
var params = new Array();
params["module_srls"] = obj.value;
params["id"] = id;
var response_tags = new Array("error","message","module_list","id");
exec_xml("widget", "getWidgetAdminModuleList", params, completeGetModuleSrlList, response_tags, params);
}
function completeGetModuleSrlList(ret_obj, response_tags) {
var id = ret_obj['id'];
var sel_obj = xGetElementById('_'+id);
if(!sel_obj) return;
var module_list = ret_obj['module_list'];
if(!module_list) return;
var item = module_list['item'];
if(typeof(item.length)=='undefined' || item.length<1) item = new Array(item);
for(var i=0;i<item.length;i++) {
var module_srl = item[i].module_srl;
var mid = item[i].mid;
var browser_title = item[i].browser_title;
var opt = new Option(browser_title+' ('+mid+')', module_srl);
sel_obj.options.add(opt);
}
}
function getModuleSrl(id) {
var obj = xGetElementById(id);
if(!obj.value) return;
var value = obj.value;
var params = new Array();
params["module_srls"] = obj.value;
params["id"] = id;
var response_tags = new Array("error","message","module_list","id");
exec_xml("widget", "getWidgetAdminModuleList", params, completeGetModuleSrl, response_tags, params);
}
function completeGetModuleSrl(ret_obj, response_tags) {
var id = ret_obj['id'];
var obj = xGetElementById('_'+id);
var sObj = xGetElementById(id);
if(!sObj || !obj) return;
var module_list = ret_obj['module_list'];
if(!module_list) return;
var item = module_list['item'];
if(typeof(item.length)=='undefined' || item.length<1) item = new Array(item);
sObj.value = item[0].module_srl;
obj.value = item[0].browser_title+' ('+item[0].mid+')';
}

View file

@ -11,117 +11,11 @@
</div>
<div id="popBody">
<table cellspacing="0" class="adminTable">
<caption>{nl2br($lang->about_widget_code)}</caption>
<tr>
<th scope="row"><div>{$lang->widget}</div></th>
<td>{$widget_info->title} ver {$widget_info->version}</td>
</tr>
<!--@if(count($skin_list))-->
<tr>
<th scope="row"><div>{$lang->skin}</div></th>
<td>
<select name="skin" onchange="doDisplaySkinColorset(this);return false;">
<option value="">&nbsp;</option>
<!--@foreach($skin_list as $key => $val)-->
<option value="{$key}">{$val->title} ({$key})</option>
<!--@end-->
</select>
<div id="colorset_area" style="display:none">
<div class="header">{$lang->colorset}</div>
<div class="footer">
<select name="colorset" id="widget_colorset">
</select>
</div>
</div>
</td>
</tr>
<!--@end-->
<tr>
<th scope="row"><div>{$lang->widget_cache}</div></th>
<td>
<input type="text" name="widget_cache" value="0" class="inputTypeText" size="2" />{$lang->unit_min}
<p>{$lang->about_widget_cache}</p>
</td>
</tr>
<!--@foreach($widget_info->extra_var as $id => $var)-->
<!--@if($var->group && ((!$group) || $group != $var->group))-->
{@$group = $var->group}
</table>
<table cellspacing="0" class="adminTable">
<caption>{$group}</caption>
<!--@end-->
<tr class="row{$cycle_idx}">
<th scope="row"><div>
{$var->name}
<!--@if($var->type == "mid_list")-->
<input type="checkbox" onclick="XE.checkboxToggleAll('{$id}'); return false;" />
<!--@end-->
</div></th>
<td>
<!--@if($var->type == "text")-->
<input type="text" name="{$id}" value="" class="inputTypeText w400" />
<!--@elseif($var->type == "textarea")-->
<textarea name="{$id}" class="inputTypeTextArea w200"></textarea>
<!--@elseif($var->type == "select")-->
<select name="{$id}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}">{$val}</option>
<!--@end-->
</select>
<!--@elseif($var->type == "mid_list")-->
<!--@foreach($mid_list as $module_category_srl => $modules)-->
<!--@if($modules->title)-->
<div class="widget_title">{$modules->title}</div>
<!--@else-->
<div class="widget_title">{$lang->none_category}</div>
<!--@end-->
<!--@foreach($modules->list as $key => $val)-->
<div class="widget_mid_list">
<input type="checkbox" value="{$key}" name="{$id}" id="chk_mid_list_{$key}" />
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<!--@elseif($var->type == "mid")-->
<select name="{$id}">
<!--@foreach($mid_list as $module_category_srl => $modules)-->
<!--@if($modules->title)-->
<option disabled="disabled">{$modules->title}</option>
<!--@else-->
<option disabled="disabled">{$lang->none_category}</option>
<!--@end-->
<!--@foreach($modules->list as $key => $val)-->
<option value="{$key}">&nbsp; {$key} ({$val->browser_title})</option>
<!--@end-->
<!--@end-->
</select>
<!--@end-->
<p class="clear">{nl2br($var->description)}</p>
</td>
</tr>
<!--@end-->
<!--@if($group)-->
</table>
{@ $_caption = $lang->about_widget_code}
<!--#include("widget_generate_code.include.html")-->
<table cellspacing="0" class="adminTable">
<col width="100" />
<col width="*" />
<!--@end-->
<tr>
<th><div>{$lang->widget_code}</div></th>
<td><textarea readonly="true" id="widget_code" class="inputTypeTextArea w400"></textarea></td>
@ -130,8 +24,8 @@
</div>
<div id="popFooter" class="tCenter gap1">
<span class="button"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
<span class="button green"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button red"><span>{$lang->cmd_close}</span></a>
</div>
</form>

View file

@ -0,0 +1,116 @@
<table cellspacing="0" class="adminTable">
<caption>{nl2br($_caption)}</caption>
<tr>
<th scope="row"><div>{$lang->widget}</div></th>
<td>
{$widget_info->title} ver {$widget_info->version}
<!--@if($widget_info->author->description)-->
<div class="widget_description">{nl2br(trim($widget_info->author->description))}</div>
<!--@end-->
</td>
</tr>
<!--@if(count($skin_list))-->
<tr>
<th scope="row"><div>{$lang->skin}</div></th>
<td>
<select name="skin" onchange="doDisplaySkinColorset(this);return false;" id="widget_skin">
<option value="">&nbsp;</option>
<!--@foreach($skin_list as $key => $val)-->
<option value="{$key}">{$val->title} ({$key})</option>
<!--@end-->
</select>
<div id="colorset_area" style="display:none">
<div class="header">{$lang->colorset}</div>
<div class="footer">
<select name="colorset" id="widget_colorset">
</select>
</div>
</div>
</td>
</tr>
<!--@end-->
<tr>
<th scope="row"><div>{$lang->widget_cache}</div></th>
<td>
<input type="text" name="widget_cache" value="0" class="inputTypeText" size="2" />{$lang->unit_min}
<p>{$lang->about_widget_cache}</p>
</td>
</tr>
<!--@foreach($widget_info->extra_var as $id => $var)-->
<!--@if($var->group && ((!$group) || $group != $var->group))-->
{@$group = $var->group}
</table>
<table cellspacing="0" class="adminTable">
<caption>{$group}</caption>
<!--@end-->
<tr class="row{$cycle_idx}">
<th scope="row">
<div>
{$var->name}
<!--@if($var->type == "mid_list")-->
<input type="checkbox" onclick="XE.checkboxToggleAll('{$id}'); return false;" />
<!--@end-->
</div>
</th>
<td>
<!--@if($var->type == "text")-->
<input type="text" name="{$id}" value="" class="inputTypeText w400" />
<!--@elseif($var->type == "textarea")-->
<textarea name="{$id}" class="inputTypeTextArea w400"></textarea>
<!--@elseif($var->type == "select")-->
<select name="{$id}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}">{$val}</option>
<!--@end-->
</select>
<!--@elseif($var->type == "mid_list")-->
<!--@foreach($mid_list as $module_category_srl => $modules)-->
<!--@if($modules->title)-->
<div class="widget_title">{$modules->title}</div>
<!--@else-->
<div class="widget_title">{$lang->none_category}</div>
<!--@end-->
<!--@foreach($modules->list as $key => $val)-->
<div class="widget_mid_list">
<input type="checkbox" value="{$key}" name="{$id}" id="chk_mid_list_{$key}" />
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<!--@elseif($var->type == "module_srl_list")-->
<input type="hidden" name="{$id}" id="{$id}" value="" />
<select name="_{$id}" id="_{$id}" size="8" class="w300 fl"></select>
<ul class="midCommand">
<li><a href="{getUrl('','module','module','act','dispModuleAdminSelectList','id',$id)}" onclick="popopen(this.href, 'ModuleSelect');return false;" class="button blue"><span>{$lang->cmd_insert}</span></a></li>
<li><a href="#" onclick="midMoveUp('{$id}');return false;" class="button black"><span>{$lang->cmd_move_up}</span></a></li>
<li><a href="#" onclick="midMoveDown('{$id}');return false;" class="button black"><span>{$lang->cmd_move_down}</span></a></li>
<li><a href="#" onclick="midRemove('{$id}');return false;" class="button red"><span>{$lang->cmd_delete}</span></a></li>
</ul>
<script type="text/javascript">
if(typeof(getModuleSrlList)!=='undefined') {
xAddEventListener(window,'load',function() { getModuleSrlList('{$id}'); });
}
</script>
<!--@elseif($var->type == "mid")-->
<input type="hidden" name="{$id}" id="{$id}" value="" />
<input type="text" name="_{$id}" id="_{$id}" value="" class="inputTypeText w300" readonly="readonly"/><a href="{getUrl('','module','module','act','dispModuleAdminSelectList','id',$id,'type','single')}" onclick="popopen(this.href, 'ModuleSelect');return false;" class="button blue"><span>{$lang->cmd_select}</span></a>
<script type="text/javascript">
if(typeof(getModuleSrlList)!=='undefined') {
xAddEventListener(window,'load',function() { getModuleSrl('{$id}'); });
}
</script>
<!--@end-->
<p class="clear">{nl2br($var->description)}</p>
</td>
</tr>
<!--@end-->
</table>

View file

@ -3,6 +3,10 @@
<!--%import("css/widget.css")-->
<!--%import("../../admin/tpl/css/admin.css")-->
<script type="text/javascript">
xAddEventListener(window, "load", doFillWidgetVars);
</script>
<form action="./" method="get" onsubmit="return procFilter(this, generate_code_in_page);" id="fo_widget">
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
@ -18,122 +22,11 @@
</div>
<div id="popBody">
<table cellspacing="0" class="adminTable">
<caption>{nl2br($lang->about_widget_code_in_page)}</caption>
<tr>
<th scope="row"><div>{$lang->widget}</div></th>
<td>
{$widget_info->title} ver {$widget_info->version}
<!--@if($widget_info->author->description)-->
<div class="widget_description">{nl2br(trim($widget_info->author->description))}</div>
<!--@end-->
</td>
</tr>
<!--@if(count($skin_list))-->
<tr>
<th scope="row"><div>{$lang->skin}</div></th>
<td>
<select name="skin" onchange="doDisplaySkinColorset(this);return false;" id="widget_skin">
<option value="">&nbsp;</option>
<!--@foreach($skin_list as $key => $val)-->
<option value="{$key}">{$val->title} ({$key})</option>
<!--@end-->
</select>
<div id="colorset_area" style="display:none">
<div class="header">{$lang->colorset}</div>
<div class="footer">
<select name="colorset" id="widget_colorset">
</select>
</div>
</div>
</td>
</tr>
<!--@end-->
<tr>
<th scope="row"><div>{$lang->widget_cache}</div></th>
<td>
<input type="text" name="widget_cache" value="0" class="inputTypeText" size="2" />{$lang->unit_min}
<p>{$lang->about_widget_cache}</p>
</td>
</tr>
<!--@foreach($widget_info->extra_var as $id => $var)-->
<!--@if($var->group && ((!$group) || $group != $var->group))-->
{@$group = $var->group}
</table>
<table cellspacing="0" class="adminTable">
<caption>{$group}</caption>
<!--@end-->
<tr class="row{$cycle_idx}">
<th scope="row"><div>
{$var->name}
<!--@if($var->type == "mid_list")-->
<input type="checkbox" onclick="XE.checkboxToggleAll('{$id}'); return false;" />
<!--@end-->
</div></th>
<td>
<!--@if($var->type == "text")-->
<input type="text" name="{$id}" value="" class="inputTypeText w400" />
<!--@elseif($var->type == "textarea")-->
<textarea name="{$id}" class="inputTypeTextArea w100"></textarea>
<!--@elseif($var->type == "select")-->
<select name="{$id}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}">{$val}</option>
<!--@end-->
</select>
<!--@elseif($var->type == "mid_list")-->
<!--@foreach($mid_list as $module_category_srl => $modules)-->
<!--@if($modules->title)-->
<div class="widget_title">{$modules->title}</div>
<!--@else-->
<div class="widget_title">{$lang->none_category}</div>
<!--@end-->
<!--@foreach($modules->list as $key => $val)-->
<div class="widget_mid_list">
<input type="checkbox" value="{$key}" name="{$id}" id="chk_mid_list_{$key}" />
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<!--@elseif($var->type == "mid")-->
<select name="{$id}">
<!--@foreach($mid_list as $module_category_srl => $modules)-->
<!--@if($modules->title)-->
<option disabled="disabled">{$modules->title}</option>
<!--@else-->
<option disabled="disabled">{$lang->none_category}</option>
<!--@end-->
<!--@foreach($modules->list as $key => $val)-->
<option value="{$key}">&nbsp; {$key} ({$val->browser_title})</option>
<!--@end-->
<!--@end-->
</select>
<!--@end-->
<p class="clear">{nl2br($var->description)}</p>
</td>
</tr>
<!--@end-->
</table>
{@ $_caption = $lang->about_widget_code_in_page}
<!--#include("widget_generate_code.include.html")-->
</div>
<div id="popFooter" class="tCenter gap1">
<span class="button"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
<span class="button green"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button red"><span>{$lang->cmd_close}</span></a>
</div>
</form>
<script type="text/javascript">
xAddEventListener(window, "load", doFillWidgetVars);
</script>

View file

@ -0,0 +1,37 @@
<?php
/**
* @class widgetAdminModel
* @author zero (zero@nzeo.com)
* @version 0.1
* @brief widget 모듈의 AdminModel class
**/
class widgetAdminModel extends widget {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 위젯의 경로를 구함
**/
function getWidgetAdminModuleList() {
$args->module_srls = Context::get('module_srls');
$output = executeQueryArray('module.getModulesInfo', $args);
if(!$output->toBool() || !$output->data) return new Object();
foreach($output->data as $key => $val) {
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title);
}
$modules = explode(',',$args->module_srls);
for($i=0;$i<count($modules);$i++) {
$module_list[$modules[$i]] = $list[$modules[$i]];
}
$this->add('id', Context::get('id'));
$this->add('module_list', $module_list);
}
}
?>

View file

@ -50,6 +50,22 @@
FileHandler::removeFilesInDir("./files/cache/widget_cache");
}
/**
* @brief Action중 Admin이 들어갔을 경우 권한 체크
**/
function checkAdminActionGrant() {
if(!Context::get('is_logged')) return false;
$logged_info = Context::get('logged_info');
if($logged_info->is_admin=='Y') return true;
$oModuleModel = &getModel('module');
if($oModuleModel->isSiteAdmin()) return true;
return false;
}
/**
* @brief 권한 체크를 실행하는 method
* 모듈 객체가 생성된 경우는 직접 권한을 체크하지만 기능성 모듈등 스스로 객체를 생성하지 않는 모듈들의 경우에는

View file

@ -14,19 +14,27 @@
}
/**
* @brief 위젯의 생성된 코드를 return
* @brief request 변수와 위젯 정보를 통해 변수 정렬
**/
function procWidgetGenerateCode() {
// 변수 정리
$vars = Context::getRequestVars();
function arrangeWidgetVars($widget, $request_vars, &$vars) {
$oWidgetModel = &getModel('widget');
$widget_info = $oWidgetModel->getWidgetInfo($widget);
$widget = $vars->selected_widget;
$blank_img_path = Context::getRequestUri()."common/tpl/images/widget_bg.jpg";
unset($vars->module);
unset($vars->act);
unset($vars->selected_widget);
unset($vars->body);
$vars->skin = trim($request_vars->skin);
$vars->colorset = trim($request_vars->colorset);
$vars->widget_sequence = (int)($request_vars->widget_sequence);
$vars->widget_cache = (int)($request_vars->widget_cache);
$vars->style = trim($request_vars->style);
$vars->widget_padding_left = trim($request_vars->widget_padding_left);
$vars->widget_padding_right = trim($request_vars->widget_padding_right);
$vars->widget_padding_top = trim($request_vars->widget_padding_top);
$vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
if(count($widget_info->extra_var)) {
foreach($widget_info->extra_var as $key=>$val) {
$vars->{$key} = trim($request_vars->{$key});
}
}
if($vars->widget_sequence) {
$cache_path = './files/cache/widget_cache/';
@ -37,20 +45,30 @@
if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
$attribute = array();
if($vars) {
foreach($vars as $key => $val) {
if(!$val) continue;
if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
$val = htmlspecialchars($val);
$attribute[] = sprintf('%s="%s"', $key, $val);
foreach($vars as $key => $val) {
if(!$val) {
unset($vars->{$key});
continue;
}
if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
$vars->{$key} = htmlspecialchars($val);
$attribute[] = sprintf('%s="%s"', $key, $val);
}
$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
return $attribute;
}
$cache_path = './files/cache/widget_cache/';
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
FileHandler::removeFile($cache_file);
/**
* @brief 위젯의 생성된 코드를 return
**/
function procWidgetGenerateCode() {
$widget = Context::get('selected_widget');
if(!$widget) return new Object(-1,'msg_invalid_request');
if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null'));
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
// 코드 출력
$this->add('widget_code', $widget_code);
@ -60,38 +78,11 @@
* @brief 페이지 수정시 위젯 코드의 생성 요청
**/
function procWidgetGenerateCodeInPage() {
// 먼저 정상적인 widget 코드를 구함
$this->procWidgetGenerateCode();
$widget_code = $this->get('widget_code');
$widget = Context::get('selected_widget');
if(!$widget) return new Object(-1,'msg_invalid_request');
if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null'));
// 변수 정리
$vars = Context::getRequestVars();
$widget = $vars->selected_widget;
unset($vars->module);
unset($vars->act);
unset($vars->body);
unset($vars->selected_widget);
if($vars->widget_sequence) {
$cache_path = './files/cache/widget_cache/';
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
FileHandler::removeFile($cache_file);
}
if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
// args 정리
$attribute = array();
if($vars) {
foreach($vars as $key => $val) {
if(!$val) continue;
if(strpos($val,'|@|')>0) {
$val = str_replace('|@|',',',$val);
$vars->{$key} = $val;
}
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val));
}
}
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
// 결과물을 구함
$oWidgetHandler = new WidgetHandler();

View file

@ -52,7 +52,7 @@
// module_category와 module의 조합
if($module_categories) {
foreach($mid_list as $module_srl => $module) {
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
}
} else {
$module_categories[0]->list = $mid_list;