modules/widget/tpl 코드 정리 및 minify 설정 추가.

This commit is contained in:
bnu 2013-11-23 21:36:06 +09:00
parent bf85de4e26
commit 80fa661fc7
5 changed files with 1446 additions and 1226 deletions

View file

@ -44,18 +44,13 @@ module.exports = function(grunt) {
uglify: {
'common-js': {
options: {
banner: banner_xe_js,
report: 'min'
banner: banner_xe_js
},
files: {
'common/js/xe.min.js': ['common/js/xe.js']
}
},
'modules': {
options: {
banner: banner,
report: 'min'
},
files: {
// addon
'addons/captcha/captcha.min.js' : ['addons/captcha/captcha.js'],
@ -80,6 +75,10 @@ module.exports = function(grunt) {
'modules/editor/components/image_gallery/tpl/slide_gallery.min.js' : ['modules/editor/components/image_gallery/tpl/slide_gallery.js'],
// module/importer
'modules/importer/tpl/js/importer_admin.min.js': ['modules/importer/tpl/js/importer_admin.js'],
// modules/widget
'modules/widget/tpl/js/generate_code.min.js': ['modules/widget/tpl/js/generate_code.js'],
'modules/widget/tpl/js/widget.min.js': ['modules/widget/tpl/js/widget.js'],
'modules/widget/tpl/js/widget_admin.min.js': ['modules/widget/tpl/js/widget_admin.js'],
}
}
},
@ -105,12 +104,20 @@ module.exports = function(grunt) {
files: {
'modules/editor/components/multimedia_link/tpl/popup.min.css': ['modules/editor/components/multimedia_link/tpl/popup.css'],
}
},
'moudle-widget-tpl': {
files: {
'modules/widget/tpl/css/widget.min.css': ['modules/widget/tpl/css/widget.css'],
}
}
},
jshint: {
files: [
'Gruntfile.js',
'common/js/*.js', '!common/js/html5.js', '!common/js/jquery.js', '!common/js/x.js', '!common/js/xe.js',
'modules/widget/tpl/js/generate_code.js',
'modules/widget/tpl/js/widget.js',
'modules/widget/tpl/js/widget_admin.js',
'!**/*.min.js',
'!**/*-packed.js'
],

View file

@ -1,38 +1,210 @@
@charset "utf-8";
.widget_title{border:1px solid #ddd;margin:10px 5px 5px 0;padding:3px}
.widget_mid_list{margin:0 0 5px 10px}
.widget_description{color:#aaa;border-top:1px dotted #eee;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}
#colorset_area .footer{float:left}
#zonePageContent{overflow:hidden;width:100%;padding:0 !important;margin:0 !important}
.pageAddContent{width:700px}
.widgetOutput{float:left;cursor:move;z-index:998;overflow:hidden;position:relative;width:100%;min-height:24px}
.widget_title {
margin: 10px 5px 5px 0;
padding: 3px;
border: 1px solid #ddd;
}
.widget_mid_list {
margin: 0 0 5px 10px;
}
.widget_description {
margin: 5px 0 0 0;
padding: 5px 0 0 0;
border-top: 1px dotted #eee;
color: #aaa;
}
#colorset_area {
margin-top: .5em;
}
#colorset_area .header {
float: left;
margin-right: .5em;
padding-top: .2em;
}
#colorset_area .footer {
float: left;
}
#zonePageContent {
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
width: 100%;
}
.pageAddContent {
width: 700px;
}
.widgetOutput {
float: left;
z-index: 998;
position: relative;
overflow: hidden;
width: 100%;
min-height: 24px;
cursor: move;
}
.widgetOutput .widgetBorder,
.widgetOutput .widgetBoxBorder{height:100%;border:1px dashed #ccc;z-index:999;box-sizing:border-box;min-height:24px}
.widgetOutput .widgetResize {border:0;background:transparent url("../images/btn_resize.gif") no-repeat left bottom;width:12px;height:12px;position:absolute;bottom:1px;right:1px;cursor:pointer;z-index:1000}
.widgetOutput .widgetResizeLeft {border:0;background:transparent url("../images/btn_resize_left.gif") no-repeat left bottom;width:12px;height:12px;position:absolute;bottom:1px;left:1px;cursor:pointer;z-index:1000}
.widgetOutput .widgetBoxResize {border:0;background:transparent url("../images/btn_resize.gif") no-repeat left bottom;width:12px;height:12px;position:absolute;bottom:1px;right:1px;cursor:pointer;z-index:1000}
.widgetOutput .widgetBoxResizeLeft{border:0;background:transparent url("../images/btn_resize_left.gif") no-repeat left bottom;width:12px;height:12px;position:absolute;bottom:0;left:1px;cursor:pointer;z-index:1000}
.widgetButtons{z-index:1000;overflow:hidden;*zoom:1;float:left;padding:0 10px;line-height:24px;position:absolute;top:0;visibility:hidden;box-shadow:0 0 3px #333 inset}
.widgetButtons#widgetButton{background-color:#C7DBE9;left:0}
.widgetButtons#widgetBoxButton{background-color:#D2E9C7;right:0}
.widgetButtons>button{border:0;width:14px;height:14px;padding:14px 0 0 0;overflow:hidden;cursor:pointer;z-index:99;background:transparent url("../../../admin/tpl/img/glyphicons-halflings.png") no-repeat}
.widgetButtons .widgetSetup{background-position:-432px 0}
.widgetOutput .widgetBoxBorder {
z-index: 999;
box-sizing: border-box;
height: 100%;
min-height: 24px;
border: 1px dashed #ccc;
}
.widgetOutput .widgetResize {
z-index: 1000;
position: absolute;
bottom: 1px;
right: 1px;
width: 12px;
height: 12px;
border: 0;
cursor: pointer;
background: transparent url("../images/btn_resize.gif") no-repeat left bottom;
}
.widgetOutput .widgetResizeLeft {
height: 12px;
bottom: 1px;
position: absolute;
border: 0;
width: 12px;
z-index: 1000;
left: 1px;
cursor: pointer;
background: transparent url("../images/btn_resize_left.gif") no-repeat left bottom;
}
.widgetOutput .widgetBoxResize {
z-index: 1000;
position: absolute;
right: 1px;
bottom: 1px;
width: 12px;
height: 12px;
border: 0;
cursor: pointer;
background: transparent url("../images/btn_resize.gif") no-repeat left bottom;
}
.widgetOutput .widgetBoxResizeLeft {
z-index: 1000;
position: absolute;
left: 1px;
bottom: 0;
width: 12px;
height: 12px;
border: 0;
cursor: pointer;
background: transparent url("../images/btn_resize_left.gif") no-repeat left bottom;
}
.widgetButtons {
float: left;
z-index: 1000;
visibility: hidden;
position: absolute;
top: 0;
overflow: hidden;
padding: 0 10px;
line-height: 24px;
box-shadow: 0 0 3px #333 inset;
*zoom: 1;
}
.widgetButtons#widgetButton {
left: 0;
background-color: #C7DBE9;
}
.widgetButtons#widgetBoxButton {
right: 0;
background-color: #D2E9C7;
}
.widgetButtons>button {
z-index: 99;
padding: 14px 0 0 0;
overflow: hidden;
width: 14px;
height: 14px;
border: 0;
cursor: pointer;
background: transparent url("../../../admin/tpl/img/glyphicons-halflings.png") no-repeat;
}
.widgetButtons .widgetSetup {
background-position: -432px 0;
}
.widgetButtons .widgetSize,
.widgetButtons .widgetBoxSize{background-position:-96px -120px}
.widgetButtons .widgetStyle{background-position:-456px -144px}
.widgetButtons .widgetBoxSize {
background-position: -96px -120px;
}
.widgetButtons .widgetStyle {
background-position: -456px -144px;
}
.widgetButtons .widgetCopy,
.widgetButtons .widgetBoxCopy{background-position:0 -96px}
.widgetButtons .widgetBoxCopy {
background-position: 0 -96px;
}
.widgetButtons .widgetRemove,
.widgetButtons .widgetBoxRemove{background-position:-456px 0}
.help{padding:5px 0;background-color:#EFEFEF;border-top:1px solid #ccc}
ul.midCommand{float:left;margin:0 0 0 10px;;padding:0;*zoom:1}
ul.midCommand li{display:block;margin-bottom:5px;list-style:none}
a.widgetStyle{display:inline-block;margin:0 10px 10px 0;border:1px solid #fff;overflow:hidden;*zoom:1;width:96px;height:96px;position:relative;text-decoration:none}
a.widgetStyle:hover{border:1px dashed #ccc}
a.widgetStyle:hover span{display:none}
a.widgetStyle.selected{border:1px dashed #999}
a.widgetStyle img {width:96px;height:96px;margin:1px}
a.widgetStyle span{position:absolute;left:0;bottom:0;display:block;width:96px;background-color:#888;color:#fff;padding:4px 3px 3px 3px;opacity:.8;filter:alpha(opacity=80);text-align:center;font-family:tahoma}
#zonePageContent .widgetContainer{min-height:20px}
.widgetButtons .widgetBoxRemove {
background-position: -456px 0;
}
.help {
padding: 5px 0;
border-top: 1px solid #ccc;
background-color: #EFEFEF;
}
ul.midCommand {
float: left;
margin: 0 0 0 10px;
padding: 0;
*zoom: 1;
}
ul.midCommand li {
display: block;
margin-bottom: 5px;
list-style: none;
}
a.widgetStyle {
display: inline-block;
position: relative;
margin: 0 10px 10px 0;
overflow: hidden;
width: 96px;
height: 96px;
border: 1px solid #fff;
text-decoration: none;
*zoom: 1;
}
a.widgetStyle:hover {
border: 1px dashed #ccc;
}
a.widgetStyle:hover span {
display: none;
}
a.widgetStyle.selected {
border: 1px dashed #999;
}
a.widgetStyle img {
margin: 1px;
width: 96px;
height: 96px;
}
a.widgetStyle span {
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 96px;
padding: 4px 3px 3px 3px;
text-align: center;
font-family: tahoma;
color: #fff;
filter: alpha(opacity=80);
opacity: .8;
background-color: #888;
}
#zonePageContent .widgetContainer {
min-height: 20px;
}

View file

@ -8,14 +8,15 @@ function doDisplaySkinColorset(colorset)
function completeGetSkinColorset(ret_obj)
{
/*jshint -W004*/
var sel = jQuery("select[name=colorset]").get(0);
var length = sel.options.length;
var selected_colorset = colorset;
for(var i = 0; i < length; i++) sel.remove(0);
if(!ret_obj["colorset_list"]) return;
if(!ret_obj.colorset_list) return;
var colorset_list = ret_obj["colorset_list"].split("\n");
var colorset_list = ret_obj.colorset_list.split("\n");
var selected_index = 0;
for(var i = 0; i < colorset_list.length; i++) {
var tmp = colorset_list[i].split("|@|");
@ -29,12 +30,12 @@ function doDisplaySkinColorset(colorset)
doShowSkinColorset();
}
var params = new Array();
params["selected_widget"] = jQuery('input[name=selected_widget]').val();
params["skin"] = skin;
params["colorset"] = colorset;
var params = [];
params.selected_widget = jQuery('input[name=selected_widget]').val();
params.skin = skin;
params.colorset = colorset;
var response_tags = new Array("error","message","colorset_list");
var response_tags = ["error", "message", "colorset_list"];
exec_xml("widget", "procWidgetGetColorsetList", params, completeGetSkinColorset, response_tags, params);
}
@ -94,31 +95,40 @@ function doFillWidgetVars() {
for(i = 0; i < attrs.length ; i++){
var name = attrs[i].name;
var value = jQuery(selected_node).attr(name);
if(value == 'Array') continue;
if(jQuery("[name="+name+"]", fo_widget).size() > 0 || !value) continue;
if(name.indexOf('sizcache') == 0) continue;
if(name.indexOf('sizcache') === 0) continue;
if(jQuery.inArray(name, attrFilters) > -1) continue;
var dummy = jQuery('<input type="hidden" name="'+name+'" />').val(value).appendTo("#fo_widget").get(0);
}
// 위젯의 속성 설정
var obj_list = new Array();
var obj_list = [];
jQuery('input,select,textarea','#fo_widget').each(function() {
obj_list.push(this);
});
for(var j = 0; j < obj_list.length; j++) {
/*jshint -W004*/
var node = obj_list[j];
if(node.name.indexOf('_')==0) continue;
if(node.name.indexOf('_') === 0) continue;
if(node.name == 'widgetstyle') continue;
if(node.type == 'button') continue;
if(node.name == '') continue;
if(node.name === '') continue;
var length = node.length;
var type = node.type;
if((typeof(type)=='undefined'||!type) && typeof(length)!='undefined' && typeof(node[0])!='undefined' && length>0) type = node[0].type;
else length = 0;
if((typeof(type) == 'undefined' || !type) && typeof(length) != 'undefined' && typeof(node[0]) != 'undefined' && length > 0) {
type = node[0].type;
}
else {
length = 0;
}
var name = node.name;
switch(type) {
@ -126,19 +136,25 @@ function doFillWidgetVars() {
case "text" :
case "textarea" :
var val = selected_node.getAttribute(name);
if(!val) continue;
var unescaped_val = unescape(val);
if(!unescaped_val) node.value = val;
else node.value = unescaped_val;
jQuery('#'+name).val(node.value);
break;
case "radio" :
case "checkbox" :
if(selected_node.getAttribute(name)) {
var val = selected_node.getAttribute(name).split(',');
if(fo_obj[name].length) {
for(var i = 0; i < fo_obj[name].length; i++) {
var v = fo_obj[name][i].value;
for(var k = 0; k <val.length; k++) {
if(v == val[k]) {
fo_obj[name][i].checked = true;
@ -155,7 +171,9 @@ function doFillWidgetVars() {
case "select-one" :
var val = selected_node.getAttribute(name);
var sel = fo_obj[name];
if(!val) break;
for(var i = 0; i < sel.options.length; i++) {
if(sel.options[i].value == val) sel.options[i].selected = true;
else sel.options[i].selected = false;
@ -166,7 +184,7 @@ function doFillWidgetVars() {
}
var style = selected_node.getAttribute("style");
if(typeof(style)=="object") style = style["cssText"];
if(typeof(style) == "object") style = style.cssText;
fo_obj.style.value = style;
fo_obj.widget_padding_left.value = selected_node.getAttribute("widget_padding_left");
@ -194,7 +212,7 @@ function doFillWidgetVars() {
var src = $this.siblings('input').eq(0).val().split(',');
if(src) $this.trigger('filebox.selected', [src]);
})
});
}
var $current_filebox;
@ -218,20 +236,22 @@ jQuery(document).ready(function($){
.remove();
var htmlCode = "";
if(src instanceof Object ) {
/*jshint -W004*/
for(var i = 0; i < src.length; i++){
if(src[i].id) {
htmlCode += '<img src="'+src[i].id+'" alt="" style="border:1px solid #ccc;padding:5px;max-height:200px;max-width:200px"> <button type="button" class="filebox_del x_icon-remove">'+xe.lang.cmd_delete+'</button> ';
if(i==0) $(this).siblings('input').val(src[i].id);
else {
if(i === 0) {
$(this).siblings('input').val(src[i].id);
} else {
var aux = $(this).siblings('input').val();
$(this).siblings('input').val(aux+","+src[i].id);
}
}
else {
} else {
if(src[i]) {
htmlCode += '<img src="'+src[i]+'" alt="" style="border:1px solid #ccc;padding:5px;max-height:200px;max-width:200px"> <button type="button" class="filebox_del x_icon-remove">'+xe.lang.cmd_delete+'</button> ';
if(i==0) $(this).siblings('input').val(src[i]);
else {
if(i === 0) {
$(this).siblings('input').val(src[i]);
} else {
var aux = $(this).siblings('input').val();
$(this).siblings('input').val(aux+","+src[i]);
}
@ -244,12 +264,11 @@ jQuery(document).ready(function($){
}
$(this).before(htmlCode);
$('.filebox_del').bind('click', function(){
var filename = $(this).prev('img').attr("src");
var files = $(this).siblings('input').val().split(",");
var newInput = "";
for(var i = 0; i < files.length; i++){
if(files[i] != filename) {
if(!newInput.length) newInput = files[i];
@ -274,6 +293,7 @@ jQuery(document).ready(function($){
$iframe.attr('src', '#');
$iframe.attr('name', 'iframeTarget');
$iframe.load(function() {
/*jshint -W061*/
var data = eval('(' + $(window.iframeTarget.document.getElementsByTagName("body")[0]).html() + ')');
if(data.error) {
@ -302,13 +322,20 @@ jQuery(document).ready(function($){
}
var datas = $(this).serializeArray();
var params = new Object();
var params = {};
for(var i in datas) {
var data = datas[i];
if(/\[\]$/.test(data.name)) data.name = data.name.replace(/\[\]$/, '');
if(params[data.name]) params[data.name] += '|@|' + data.value;
else params[data.name] = data.value;
if(/\[\]$/.test(data.name)) {
data.name = data.name.replace(/\[\]$/, '');
}
if(params[data.name]) {
params[data.name] += '|@|' + data.value;
} else {
params[data.name] = data.value;
}
}
$.exec_json('widget.procWidgetGenerateCode', params, on_complete);
@ -318,22 +345,28 @@ jQuery(document).ready(function($){
$('#fo_widget').bind('submit', function(){
function on_complete(data){
if (data['error'] != '0'){
alert(data['message']);
if(data.error != '0'){
alert(data.message);
return;
}
completeGenerateCodeInPage(data['widget_code']);
completeGenerateCodeInPage(data.widget_code);
}
var datas = $(this).serializeArray();
var params = new Object();
var params = {};
for(var i in datas) {
var data = datas[i];
if(/\[\]$/.test(data.name)) data.name = data.name.replace(/\[\]$/, '');
if(params[data.name]) params[data.name] += '|@|' + data.value;
else params[data.name] = data.value;
if(/\[\]$/.test(data.name)) {
data.name = data.name.replace(/\[\]$/, '');
}
if(params[data.name]) {
params[data.name] += '|@|' + data.value;
} else {
params[data.name] = data.value;
}
}
exec_xml('widget', 'procWidgetGenerateCodeInPage', params, on_complete, ['error', 'message', 'widget_code']);

View file

@ -12,7 +12,7 @@ function getStyle(obj) {
{
style = obj.style;
}
if(typeof(style)=="object") style = style["cssText"];
if(typeof(style)=="object") style = style.cssText;
style = style.replace(/\burl\s*\(\s*"(.*?)"\s*\)/i, "url('$1')");
return style;
}
@ -28,7 +28,7 @@ function setFloat(obj, fl) {
// padding값을 구하는 함수 (없을 경우 0으로 세팅), zbxe의 위젯에서만 사용
function getPadding(obj, direct) {
var padding = obj.getAttribute("widget_padding_"+direct);
if(!padding || padding == null) padding = 0;
if(!padding || padding === null) padding = 0;
return padding;
}
@ -194,8 +194,9 @@ function doSyncPageContent() {
var obj = sel_obj.firstChild;
while(obj && obj.className != "widgetContent") obj = obj.nextSibling;
if(obj && obj.className == "widgetContent") {
if(!fo_obj.document_srl || fo_obj.document_srl.value == 0) {
if(!fo_obj.document_srl || fo_obj.document_srl.value == '0') {
try {
var content = Base64.decode(xInnerHtml(obj));
content = editorReplacePath(content);
@ -326,7 +327,7 @@ window.document.write = window.document.writeln = function(str){
while ( nodes.length ) {
pos.parentNode.appendChild( nodes[0] );
}
}
};
// 위젯 추가
function doAddWidgetCode(widget_code) {
@ -346,7 +347,7 @@ function doAddWidgetCode(widget_code) {
if(!cssfile) break;
tmp = tmp.substr(eos);
var cssfile = request_uri+cssfile;
cssfile = request_uri+cssfile;
if(typeof(document.createStyleSheet)=='undefined') {
var css ='<link rel="stylesheet" href="'+cssfile+'" />';
var dummy = xCreateElement("DIV");
@ -361,9 +362,9 @@ function doAddWidgetCode(widget_code) {
checkDocumentWrite = true; ///< document.write(ln)등의 함수값을 바로 사용하기 위한 check flag
// widget_code의 javascript 부분 수정
var tmp = widget_code.toLowerCase();
tmp = widget_code.toLowerCase();
while(tmp.indexOf("<script")>-1) {
/*jshint -W004, -W061*/
var pos = tmp.indexOf("<script");
tmp = tmp.substr(pos);
@ -392,8 +393,8 @@ function doAddWidgetCode(widget_code) {
var o = jQuery('div.widget_inner',selectedWidget);
var n = jQuery('div.widget_inner',obj);
if(n.size()==0) n = jQuery('div.nullWidget',obj);
if(o.size()==0) o = jQuery('div.nullWidget',selectedWidget);
if(n.size() === 0) n = jQuery('div.nullWidget',obj);
if(o.size() === 0) o = jQuery('div.nullWidget',selectedWidget);
n.html(o.html());
@ -433,6 +434,7 @@ function doCheckWidget(e) {
// 위젯 스타일
} else if(obj.className == 'widgetStyle') {
/*jshint -W004*/
var p_obj = obj.parentNode.parentNode;
var widget = p_obj.getAttribute("widget");
var widgetstyle = p_obj.getAttribute("widgetstyle");
@ -443,13 +445,14 @@ function doCheckWidget(e) {
// 위젯 복사
} else if(obj.className == 'widgetCopy' && obj.parentNode.parentNode.className == 'widgetOutput') {
p_obj = obj.parentNode.parentNode;
/*jshint -W004*/
var p_obj = obj.parentNode.parentNode;
restoreWidgetButtons();
if(p_obj.getAttribute('widget')=='widgetContent' && p_obj.getAttribute('document_srl') ) {
var response_tags = new Array('error','message','document_srl');
var params = new Array();
params['document_srl'] =p_obj.getAttribute('document_srl');
var params = [];
params.document_srl =p_obj.getAttribute('document_srl');
exec_xml('widget','procWidgetCopyDocument', params, completeCopyWidgetContent, response_tags, params, p_obj);
return;
} else {
@ -470,7 +473,7 @@ function doCheckWidget(e) {
dummy.setAttribute(name, value);
}
if(xIE4Up) dummy.style["cssText"] = p_obj.style["cssText"];
if(xIE4Up) dummy.style.cssText = p_obj.style.cssText;
p_obj.parentNode.insertBefore(dummy, p_obj);
}
return;
@ -511,7 +514,7 @@ function doCheckWidget(e) {
// content widget 복사
function completeCopyWidgetContent(ret_obj, response_tags, params, p_obj) {
var document_srl = ret_obj['document_srl'];
var document_srl = ret_obj.document_srl;
var dummy = xCreateElement("DIV");
xInnerHtml(dummy,xInnerHtml(p_obj));
@ -531,7 +534,7 @@ function completeCopyWidgetContent(ret_obj, response_tags, params, p_obj) {
}
p_obj.setAttribute('document_srl', document_srl);
if(xIE4Up) dummy.style["cssText"] = p_obj.getAttribute("style")["cssText"];
if(xIE4Up) dummy.style.cssText = p_obj.getAttribute("style").cssText;
p_obj.parentNode.insertBefore(dummy, p_obj);
}
@ -566,13 +569,15 @@ function doCheckWidgetDrag(e) {
function _getInt(val) {
if(!val || val == "null") return 0;
if(parseInt(val,10)==NaN) return 0;
if(isNaN(parseInt(val, 10))) return 0;
return parseInt(val,10);
}
// 위젯 크기 조절 레이어를 보여줌
var selectedSizeWidget = null;
function doShowWidgetSizeSetup(px, py, obj) {
/*jshint -W004*/
var layer = jQuery('#pageSizeLayer');
var form = layer.find('>form:first');
var obj = jQuery(obj);
@ -676,12 +681,13 @@ function doShowWidgetSizeSetup(px, py, obj) {
}
});
try { form[0].elements[0].focus() } catch(e) {};
try { form[0].elements[0].focus(); } catch(e) {}
}
function doHideWidgetSizeSetup() {
jQuery('#pageSizeLayer, .x_modal-backdrop, .jPicker.Container').hide();
}
jQuery(function($){
$(document).keydown(function(e){
var $jpicker = $('.jPicker.Container:visible');
@ -832,7 +838,8 @@ function doApplyWidgetSize(fo_obj) {
selectedSizeWidget = null;
var widget = selectedWidget.getAttribute("widget");
var params = new Array();
var params = [];
/*jshint -W004*/
for(var i=0;i<selectedWidget.attributes.length;i++) {
if(!selectedWidget.attributes[i].nodeName || !selectedWidget.attributes[i].nodeValue) continue;
var name = selectedWidget.attributes[i].nodeName.toLowerCase();
@ -841,16 +848,17 @@ function doApplyWidgetSize(fo_obj) {
if(!value || value == "Array") continue;
params[name] = value;
}
params["style"] = getStyle(selectedWidget);
params["selected_widget"] = widget;
params["module_srl"] = get_by_id("pageFo").module_srl.value;
exec_xml('widget','procWidgetGenerateCodeInPage',params,function(ret_obj) { doAddWidgetCode(ret_obj["widget_code"]); },new Array('error','message','widget_code','tpl','css_header'));
params.style = getStyle(selectedWidget);
params.selected_widget = widget;
params.module_srl = get_by_id("pageFo").module_srl.value;
exec_xml('widget','procWidgetGenerateCodeInPage',params,function(ret_obj) { doAddWidgetCode(ret_obj.widget_code); }, ['error','message','widget_code','tpl','css_header']);
}
doHideWidgetSizeSetup();
}
var hideElements = new Array();
var hideElements = [];
function restoreWidgetButtons() {
var widgetButton = get_by_id('widgetButton');
var boxWidgetButton = get_by_id('widgetBoxButton');
@ -865,7 +873,7 @@ function restoreWidgetButtons() {
var obj = hideElements[0];
obj.style.paddingTop = 0;
}
hideElements = new Array();
hideElements = [];
}
function showWidgetButton(name, obj) {
@ -884,7 +892,7 @@ function widgetSetup(evt) {
var o = jQuery(obj).parents('.widgetOutput');
if(o.size() == 0){
if(o.size() === 0){
restoreWidgetButtons();
return;
}
@ -915,8 +923,8 @@ function widgetSetup(evt) {
/* 위젯 드래그 */
// 드래그 중이라는 상황을 간직할 변수
var widgetDragManager = {obj:null, isDrag:false}
var widgetTmpObject = new Array();
var widgetDragManager = {obj:null, isDrag:false};
var widgetTmpObject = [];
var widgetDisappear = 0;
function widgetCreateTmpObject(obj) {
@ -1003,7 +1011,6 @@ function widgetDrag(tobj, dx, dy) {
if(tobj.className == 'widgetResize' || tobj.className == 'widgetBoxResize') {
if(nx < sx+minWidth) nx = sx+minWidth;
if(nx > zoneRight) nx = zoneRight;
if(cssFloat == 'right') nx = sx + pWidth;
var new_width = nx - sx;
@ -1011,7 +1018,6 @@ function widgetDrag(tobj, dx, dy) {
var new_height = ny - sy;
if(new_height < minHeight) new_height = minHeight;
if(zoneRight < sx+new_width) new_width = zoneRight - sx;
xWidth(tobj.parentNode, new_width);
@ -1019,9 +1025,8 @@ function widgetDrag(tobj, dx, dy) {
// 위젯 리사이즈 (좌측)
} else if(tobj.className == 'widgetResizeLeft' || tobj.className == 'widgetBoxResizeLeft') {
/*jshint -W004*/
if(nx < zoneLeft) nx = zoneLeft;
if(cssFloat == 'left') nx = sx;
var new_width = pWidth + (sx - nx);
@ -1107,7 +1112,7 @@ function widgetDrag(tobj, dx, dy) {
var wb_ws = jQuery('div.widget_inner',jQuery(target_obj));
//박스 위젯에 위젯스타일이 적용 안된경우
if(wb_ws.size() == 0){
if(wb_ws.size() === 0){
target_obj.appendChild(tobj);
//박스 위젯에 위젯스타일이 적용된경우 또는 박스안에 위젯이 위젯스타일이 적용된겅우

View file

@ -6,7 +6,7 @@
/* 생성된 코드를 textarea에 출력 */
function completeGenerateCode(ret_obj) {
var widget_code = ret_obj["widget_code"];
var widget_code = ret_obj.widget_code;
widget_code = widget_code.replace(/&/g, "&amp;");
widget_code = widget_code.replace(/\'/g, "&apos;");
var zone = get_by_id("widget_code");
@ -15,7 +15,7 @@ function completeGenerateCode(ret_obj) {
/* 생성된 코드를 페이지 zone에 출력 */
function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
var widget_code = ret_obj["widget_code"];
var widget_code = ret_obj.widget_code;
if(!opener || !widget_code) {
window.close();
return;
@ -34,10 +34,10 @@ function doDisplaySkinColorset(sel, colorset) {
return;
}
var params = new Array();
params["selected_widget"] = get_by_id("fo_widget").selected_widget.value;
params["skin"] = skin;
params["colorset"] = colorset;
var params = [];
params.selected_widget = get_by_id("fo_widget").selected_widget.value;
params.skin = skin;
params.colorset = colorset;
var response_tags = new Array("error","message","colorset_list");
@ -46,14 +46,15 @@ function doDisplaySkinColorset(sel, colorset) {
/* 서버에서 받아온 컬러셋을 표시 */
function completeGetSkinColorset(ret_obj, response_tags, params, fo_obj) {
/*jshint -W004*/
var sel = jQuery("#fo_widget")[0].widget_colorset;
var length = sel.options.length;
var selected_colorset = params["colorset"];
var selected_colorset = params.colorset;
for(var i=0;i<length;i++) sel.remove(0);
if(!ret_obj["colorset_list"]) return;
if(!ret_obj.colorset_list) return;
var colorset_list = ret_obj["colorset_list"].split("\n");
var colorset_list = ret_obj.colorset_list.split("\n");
var selected_index = 0;
for(var i=0;i<colorset_list.length;i++) {
var tmp = colorset_list[i].split("|@|");
@ -108,14 +109,15 @@ function doFillWidgetVars() {
}
// 위젯의 속성 설정
var obj_list = new Array();
var obj_list = [];
jQuery('input,select,textarea','#fo_widget').each( function() {
obj_list.push(this);
});
for(var j=0;j<obj_list.length;j++) {
/*jshint -W004*/
var node = obj_list[j];
if(node.name.indexOf('_')==0) continue;
if(node.name.indexOf('_') === 0) continue;
if(node.name == 'widgetstyle') continue;
var length = node.length;
@ -167,7 +169,7 @@ function doFillWidgetVars() {
}
var style = selected_node.getAttribute("style");
if(typeof(style)=="object") style = style["cssText"];
if(typeof(style)=="object") style = style.cssText;
fo_obj.style.value = style;
fo_obj.widget_padding_left.value = selected_node.getAttribute("widget_padding_left");
@ -278,21 +280,21 @@ function getModuleSrlList(id) {
if(!obj[0] || !obj.val()) return;
var params = [];
params["module_srls"] = obj.val();
params["id"] = id;
params.module_srls = obj.val();
params.id = id;
var response_tags = ["error","message","module_list","id"];
exec_xml("module", "getModuleAdminModuleList", params, completeGetModuleSrlList, response_tags, params);
}
function completeGetModuleSrlList(ret_obj, response_tags) {
var id = ret_obj['id'];
var id = ret_obj.id;
var sel_obj = jQuery('#_'+id);
if(!sel_obj[0]) return;
var module_list = ret_obj['module_list'];
var module_list = ret_obj.module_list;
if(!module_list) return;
var item = module_list['item'];
var item = module_list.item;
if(typeof(item.length)=='undefined' || item.length<1) item = [item];
for(var i=0;i<item.length;i++) {
@ -308,30 +310,30 @@ function getModuleSrl(id) {
var obj = get_by_id(id);
if(!obj.value) return;
var value = obj.value;
var params = new Array();
params["module_srls"] = obj.value;
params["id"] = id;
var params = [];
params.module_srls = obj.value;
params.id = id;
var response_tags = new Array("error","message","module_list","id");
exec_xml("module", "getModuleAdminModuleList", params, completeGetModuleSrl, response_tags, params);
}
function completeGetModuleSrl(ret_obj, response_tags) {
var id = ret_obj['id'];
var id = ret_obj.id;
var obj = get_by_id('_'+id);
var sObj = get_by_id(id);
if(!sObj || !obj) return;
var module_list = ret_obj['module_list'];
var module_list = ret_obj.module_list;
if(!module_list) return;
var item = module_list['item'];
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+')';
}
var windowLoadEventLoader = new Array();
var windowLoadEventLoader = [];
function doAddWindowLoadEventLoader(func) {
windowLoadEventLoader.push(func);
}
@ -457,6 +459,7 @@ function initMultiOrder(id){
}
}
}else{
/*jshint -W004*/
var arr_init_value = init_value.split(',');
for(i=0;i<arr_init_value.length;i++){
if(arr_init_value[i].length>0){