issue 2242, added multilingual on widget style, fixed a bug that does not load css after add widget

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11057 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-08-22 08:37:28 +00:00
parent c1c0a39c72
commit 2e8412c322
4 changed files with 48 additions and 18 deletions

View file

@ -361,11 +361,11 @@ function doAddWidgetCode(widget_code) {
// css 추가 // css 추가
var tmp = widget_code; var tmp = widget_code;
while(tmp.indexOf("<!--Meta:")>-1) { while(tmp.indexOf("<!--#Meta:")>-1) {
var pos = tmp.indexOf("<!--Meta:"); var pos = tmp.indexOf("<!--#Meta:");
tmp = tmp.substr(pos); tmp = tmp.substr(pos);
var eos = tmp.indexOf("-->"); var eos = tmp.indexOf("-->");
var cssfile = tmp.substr(9,eos-9); var cssfile = tmp.substr(10,eos-10);
if(cssfile.indexOf('.js')>-1) { if(cssfile.indexOf('.js')>-1) {
tmp = tmp.substr(eos); tmp = tmp.substr(eos);
continue; continue;
@ -373,7 +373,7 @@ function doAddWidgetCode(widget_code) {
if(!cssfile) break; if(!cssfile) break;
tmp = tmp.substr(eos); tmp = tmp.substr(eos);
var cssfile = request_uri+'/'+cssfile; var cssfile = request_uri+cssfile;
if(typeof(document.createStyleSheet)=='undefined') { if(typeof(document.createStyleSheet)=='undefined') {
var css ='<link rel="stylesheet" href="'+cssfile+'" />'; var css ='<link rel="stylesheet" href="'+cssfile+'" />';
var dummy = xCreateElement("DIV"); var dummy = xCreateElement("DIV");
@ -400,7 +400,10 @@ function doAddWidgetCode(widget_code) {
script = script.replace(/^<script([^>]*)>/i,'').replace(/<\/script>$/i,''); script = script.replace(/^<script([^>]*)>/i,'').replace(/<\/script>$/i,'');
writedText = null; writedText = null;
eval(script); try{
eval(script);
}catch(e){}
widget_code = widget_code.substr(0,pos)+writedText+widget_code.substr(pos+length); widget_code = widget_code.substr(0,pos)+writedText+widget_code.substr(pos+length);
tmp = widget_code.toLowerCase(); tmp = widget_code.toLowerCase();
} }

View file

@ -22,4 +22,4 @@
<include target="widget_generate_code.filebox.html" /> <include target="widget_generate_code.filebox.html" />
<include target="widget_generate_code.multilang.html" /> <include target="widget_generate_code.multilang.html" />
<include target="widget_generate_code.multilang.textarea.html" /> <include target="widget_generate_code.multilang.textarea.html" />

View file

@ -1,9 +1,10 @@
<load target="../../admin/tpl/js/admin.js" usecdn="true" /> <load target="../../admin/tpl/js/admin.js" usecdn="true" />
<load target="../../admin/tpl/css/admin.css" usecdn="true" /> <load target="../../admin/tpl/css/admin.css" usecdn="true" />
<load cond="$lang_type='ko'" target="../../admin/tpl/css/admin_ko.css" usecdn="true" /> <load cond="$lang_type=='ko'" target="../../admin/tpl/css/admin_ko.css" usecdn="true" />
<load cond="$lang_type='en'" target="../../admin/tpl/css/admin_en.css" usecdn="true" /> <load cond="$lang_type=='en'" target="../../admin/tpl/css/admin_en.css" usecdn="true" />
<load target="css/widget.css" usecdn="true" /> <load target="css/widget.css" usecdn="true" />
<load target="js/generate_code.js" usecdn="true" /> <load target="js/generate_code.js" usecdn="true" />
<load target="js/multi_lang.js" usecdn="true" />
<!--%load_js_plugin("ui.colorpicker")--> <!--%load_js_plugin("ui.colorpicker")-->
<script> <script>
@ -63,13 +64,29 @@
</block> </block>
{@$not_first = true} {@$not_first = true}
<li> <li>
<p class="q">{$var->name}</p> <p class="q"><label for="{$id}">{$var->name}</label></p>
<p class="a"> <div class="a extra_vars">
<input cond="$var->type == 'text'" type="text" name="{$id}" /> <div cond="$var->type == 'text'" class="multiLangEdit">
{@$use_multilang = TRUE}
<input type="hidden" name="{$id}" value="" class="vLang" />
<input type="text" id="{$id}" class="vLang" />
<span class="desc"><a href="#langEdit" class="editUserLang tgAnchor">{$lang->cmd_set_multilingual}</a></span>
<script>
xe.registerApp(new xe.MultiLangManager('{$id}'));
</script>
</div>
<input cond="$var->type == 'color'" type="text" name="{$id}" class="color-indicator" /> <input cond="$var->type == 'color'" type="text" name="{$id}" class="color-indicator" />
<textarea cond="$var->type == 'textarea'" name="{$id}" rows="8" cols="42"></textarea> <div cond="$var->type == 'textarea'" class="multiLangEdit">
{@$use_multilang_textarea = TRUE}
<input type="hidden" name="{$id}" value="" class="vLang" />
<textarea id="{$id}" rows="8" cols="42"></textarea>
<span class="desc"><a href="#langEditTextarea" class="editUserLang tgAnchor">{$lang->cmd_set_multilingaul}</a></span>
<script>
xe.registerApp(new xe.MultiLangManager('{$id}'));
</script>
</div>
<select cond="$var->type == 'select'" name="{$id}"> <select cond="$var->type == 'select'" name="{$id}">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option> <option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
@ -80,7 +97,7 @@
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a> <a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
{@$use_filebox = TRUE} {@$use_filebox = TRUE}
</block> </block>
</p> </div>
<p class="desc">{$var->description}</p> <p class="desc">{$var->description}</p>
</li> </li>
</block> </block>
@ -91,6 +108,11 @@
<span class="btn small"><input type="submit" value="{$lang->cmd_setup}" /></span> <span class="btn small"><input type="submit" value="{$lang->cmd_setup}" /></span>
</div> </div>
</form> </form>
<script>
xe.current_lang = "{$lang_type}";
</script>
<include target="widget_generate_code.filebox.html" /> <include target="widget_generate_code.filebox.html" />
<include target="widget_generate_code.multilang.html" />
<include target="widget_generate_code.multilang.textarea.html" />
</div> </div>

View file

@ -68,6 +68,10 @@
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
// Wanted results // Wanted results
$widget_code = $this->execute($widget, $vars, true, false); $widget_code = $this->execute($widget, $vars, true, false);
$oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($widget_code);
$this->add('widget_code', $widget_code); $this->add('widget_code', $widget_code);
} }
@ -389,6 +393,7 @@
} }
} }
/** /**
* Widgets widgetContent/widgetBox Wanted If you are not content * Widgets widgetContent/widgetBox Wanted If you are not content
**/ **/
@ -475,7 +480,7 @@
foreach($args as $key => $val) { foreach($args as $key => $val) {
if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val)); $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val));
} }
} }
@ -509,7 +514,7 @@
if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val)); $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val));
} }
} }
@ -532,7 +537,7 @@
if(in_array($key, $allowed_key)) continue; if(in_array($key, $allowed_key)) continue;
if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val)); $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val));
} }
} }
@ -673,8 +678,8 @@
continue; continue;
} }
if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
$vars->{$key} = htmlspecialchars(Context::convertEncodingStr($val)); $vars->{$key} = Context::convertEncodingStr($val);
$attribute[] = sprintf('%s="%s"', $key, Context::convertEncodingStr($val)); $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val)));
} }
return $attribute; return $attribute;