mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix warnings in widget editor and support default values in info.xml
This commit is contained in:
parent
18b0e28a76
commit
34840508f7
6 changed files with 68 additions and 44 deletions
|
|
@ -37,15 +37,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{@$suggestion_id = 0}
|
||||
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||
<block loop="$widget_info->extra_var => $id, $var">
|
||||
{@$suggestion_id++}
|
||||
{@ $suggestion_id++; }
|
||||
<block cond="!$not_first && !$var->group"><section class="extra_vars section"></block>
|
||||
<block cond="$group != $var->group">
|
||||
<block cond="$not_first"></section></block>
|
||||
<section class="extra_vars section">
|
||||
<h1>{$var->group}</h1>
|
||||
{@$group = $var->group}
|
||||
{@ $group = $var->group; }
|
||||
</block>
|
||||
|
||||
{@$not_first = true}
|
||||
|
|
@ -53,21 +53,21 @@
|
|||
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
|
||||
<div class="x_controls">
|
||||
<block cond="$var->type == 'text'">
|
||||
<input type="text" name="{$id}" />
|
||||
<input type="text" name="{$id}" value="{$var->default}" />
|
||||
</block>
|
||||
<block cond="$var->type == 'color'">
|
||||
<input type="text" name="{$id}" value="" id="{$id}" class="rx-spectrum" style="width:178px" />
|
||||
</block>
|
||||
<block cond="$var->type == 'textarea'">
|
||||
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42"></textarea>
|
||||
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42">{$var->default}</textarea>
|
||||
</block>
|
||||
<block cond="$var->type == 'select'">
|
||||
<select name="{$id}" id="{$id}">
|
||||
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" value="{$key}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
|
||||
</select>
|
||||
</block>
|
||||
<block cond="$var->type == 'select-multi-order'">
|
||||
<!--@if($var->init_options && is_array($var->init_options))-->
|
||||
<!--@if(isset($var->init_options) && is_array($var->init_options))-->
|
||||
{@$inits = array_keys($var->init_options)}
|
||||
<input type="hidden" name="{$id}" value="{implode(',', $inits)}" />
|
||||
<!--@else-->
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<div style="display:inline-block;padding-top:3px">
|
||||
<label>{$lang->display_no}</label>
|
||||
<select class="multiorder_show" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
||||
<option loop="$var->options => $key, $val" cond="!$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" cond="empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
|
||||
</select>
|
||||
<br>
|
||||
<button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button>
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
<div style="display:inline-block;padding-top:3px">
|
||||
<label>{$lang->display_yes}</label>
|
||||
<select class="multiorder_selected" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
||||
<option loop="$var->options => $key, $val" cond="$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" cond="!empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
|
||||
</select>
|
||||
<br>
|
||||
<button type="button" class="x_btn multiorder_up" style="margin:0 -5px 0 0;border-radius:2px 0 0 2px">{$lang->cmd_move_up}</button>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
<div id="content" class="x_modal-body">
|
||||
<p>{$widget_info->description} {$lang->about_widget_code_in_page}</p>
|
||||
<form cond="$type=='faceoff'" class="x_form-horizontal">
|
||||
<form cond="isset($type) && $type === 'faceoff'" class="x_form-horizontal">
|
||||
<input type="hidden" name="module" value="widget" />
|
||||
<input type="hidden" name="type" value="faceoff" />
|
||||
<input type="hidden" name="act" value="dispWidgetGenerateCodeInPage" />
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
</div>
|
||||
<div class="x_modal-body x_form-horizontal">
|
||||
<a href="{getUrl('widgetstyle','none')}" class="widgetStyle"><img src="images/widgetstyle_none.gif" title="{$lang->notuse}" /></a>
|
||||
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle==$widgetstyle)-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
|
||||
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle == ($widgetstyle ?? ''))-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
|
||||
<block cond="$widgetstyle_info">
|
||||
|
||||
|
||||
<h2>{$widgetstyle_info->title} ver {$widgetstyle_info->version}</h2>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->description}</label>
|
||||
|
|
@ -52,45 +52,46 @@
|
|||
{zdate($widgetstyle_info->date,'Y-m-d')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||
<block loop="$widgetstyle_info->extra_var => $id, $var">
|
||||
{@$suggestion_id++}
|
||||
{@ $suggestion_id++; }
|
||||
<block cond="!$not_first && !$var->group"><section class="section"></block>
|
||||
<block cond="$group != $var->group">
|
||||
<block cond="$not_first"></section></block>
|
||||
<h1>{$var->group}</h1>
|
||||
<section class="section">
|
||||
{@$group = $var->group}
|
||||
{@ $group = $var->group; }
|
||||
</block>
|
||||
{@$not_first = true}
|
||||
{@ $not_first = true; }
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="{$id}"|cond="$var->type!='text'&&$var->type!='textarea'" for="lang_{$id}"|cond="$var->type=='text'||$var->type=='textarea'">{$var->name}</label>
|
||||
<div class="x_controls extra_vars">
|
||||
<div cond="$var->type == 'text'">
|
||||
<input type="text" name="{$id}" value="" class="lang_code" />
|
||||
<input type="text" name="{$id}" value="{$var->default}" class="lang_code" />
|
||||
</div>
|
||||
|
||||
<input cond="$var->type == 'color'" type="text" name="{$id}" class="rx-spectrum" />
|
||||
|
||||
|
||||
<input cond="$var->type == 'color'" type="text" name="{$id}" value="{$var->default}" class="rx-spectrum" />
|
||||
|
||||
<div cond="$var->type == 'textarea'">
|
||||
<textarea name="{$id}" rows="8" cols="42" class="lang_code"></textarea>
|
||||
<textarea name="{$id}" rows="8" cols="42" class="lang_code">{$var->default}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<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}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
|
||||
</select>
|
||||
|
||||
|
||||
<block cond="$var->type == 'filebox'">
|
||||
<input type="hidden" name="{$id}" />
|
||||
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
|
||||
{@$use_filebox = TRUE}
|
||||
</block>
|
||||
|
||||
<label loop="$var->options => $key, $val" cond="$var->type == 'radio'">
|
||||
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'radio'">
|
||||
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||
</label>
|
||||
|
||||
<label loop="$var->options => $key, $val" cond="$var->type == 'checkbox'">
|
||||
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'checkbox'">
|
||||
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||
</label>
|
||||
<span class="x_help-block">{$var->description}</span>
|
||||
|
|
|
|||
|
|
@ -600,25 +600,30 @@ class WidgetController extends Widget
|
|||
{
|
||||
foreach($args as $key => $val)
|
||||
{
|
||||
$val = (string)$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(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
|
||||
$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
|
||||
}
|
||||
}
|
||||
|
||||
$oWidgetController = getController('widget');
|
||||
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="rhymix_content xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
|
||||
$widget_content_header = vsprintf(
|
||||
'<div class="rhymix_content xe_content widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">'.
|
||||
'<div style="%s">',$args->widgetstyle,
|
||||
'<div style="%s">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
|
||||
$args->widget_padding_left,
|
||||
$args->widget_padding_right,
|
||||
$args->widget_padding_top,
|
||||
$args->widget_padding_bottom,
|
||||
$args->document_srl,
|
||||
implode(' ',$attribute),
|
||||
$inner_style);
|
||||
implode(' ', $attribute),
|
||||
$inner_style,
|
||||
]);
|
||||
|
||||
$widget_content_body = $body;
|
||||
$widget_content_footer = sprintf('</div>'.
|
||||
|
|
@ -642,11 +647,21 @@ class WidgetController extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
|
||||
$widget_content_header = vsprintf(
|
||||
'<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
|
||||
'<div class="widgetBoxResize"></div>'.
|
||||
'<div class="widgetBoxResizeLeft"></div>'.
|
||||
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style);
|
||||
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$widget_padding_top,
|
||||
$widget_padding_right,
|
||||
$widget_padding_bottom,
|
||||
$widget_padding_left,
|
||||
implode(' ', $attribute),
|
||||
$inner_style,
|
||||
]);
|
||||
|
||||
$widget_content_body = $widgetbox_content;
|
||||
|
||||
|
|
@ -667,12 +682,20 @@ class WidgetController extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
$widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
$widget_content_header = vsprintf('<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">',$args->widgetstyle,$style,
|
||||
$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
|
||||
$widget, implode(' ',$attribute));
|
||||
'<div class="widgetBorder">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$widget_padding_top,
|
||||
$widget_padding_right,
|
||||
$widget_padding_bottom,
|
||||
$widget_padding_left,
|
||||
$widget,
|
||||
implode(' ', $attribute),
|
||||
]);
|
||||
|
||||
$widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content);
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class WidgetModel extends Widget
|
|||
public static function getWidgetStyleInfo($widgetStyle)
|
||||
{
|
||||
// Check the widget style path.
|
||||
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', $widgetStyle);
|
||||
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', (string)$widgetStyle);
|
||||
$widgetStyle_path = self::getWidgetStylePath($widgetStyle);
|
||||
if (!$widgetStyle_path)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue