* finish task #5932.

This commit is contained in:
wangyidong
2019-07-11 09:45:20 +08:00
parent bf9f78d040
commit d55f0d9407
2 changed files with 27 additions and 2 deletions
+11 -2
View File
@@ -1,9 +1,14 @@
$(function()
{
var blockTitle = '';
var preValue = '';
$(document).on('change', '#blockParams #paramstype', function()
{
$('#blockParams').find('#title').val(blockTitle + ' - ' + $(this).find('option:selected').html());
console.log(preValue);
$title = $('#blockParams').find('#title');
var value = $(this).find('option:selected').html();
if($title.val().indexOf(blockTitle + ' - ' + preValue) >= 0) $title.val(blockTitle + ' - ' + value);
preValue = value;
});
var $form = $('#blockAdminForm');
@@ -24,7 +29,11 @@ $(function()
if($blockParams.find('#actionLink').size() > 0) $form.attr('action', $blockParams.find('#actionLink').val());
blockTitle = $blockParams.find('#title').val();
if($('#blockParams #paramstype').length > 0) $blockParams.find('#title').val(blockTitle + ' - ' + $('#blockParams #paramstype').find('option:selected').html());
if($('#blockParams #paramstype').length > 0)
{
preValue = $('#blockParams #paramstype').find('option:selected').html();
$blockParams.find('#title').val(blockTitle + ' - ' + preValue);
}
};
// 获取 html 和 rss 区块参数
+16
View File
@@ -15,6 +15,22 @@ $webRoot = $config->webRoot;
$jsRoot = $webRoot . "js/";
$themeRoot = $webRoot . "theme/";
?>
<?php if(!empty($params) && is_array($params) && isset($params['type'])):?>
<?php $param = $params['type'];?>
<div class='form-group'>
<label for='type' class='col-sm-3'><?php echo $param['name']?></label>
<div class='col-sm-7'>
<?php
$control = $param['control'];
$attr = empty($param['attr']) ? '' : $param['attr'];
$default = $block ? (isset($block->params->$key) ? $block->params->$key : '') : (isset($param['default']) ? $param['default'] : '');
$options = isset($param['options']) ? $param['options'] : array();
echo html::$control("params[type]", $options, $default, "class='form-control chosen' $attr");
?>
</div>
</div>
<?php unset($params['type']);?>
<?php endif;?>
<?php include './publicform.html.php'?>
<?php echo html::hidden('actionLink', $this->createLink('block', 'set', "id=$id&type=$type&source=$source"));?>
<?php if(!empty($params) && is_array($params)):?>