This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

185
app/admin/view/sysconfig/add.html Executable file
View File

@@ -0,0 +1,185 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
新增配置
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/sysconfig/lists');?>"> 系统设置</a></li>
<li class="active"> 网站配置</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#tabconfig0">新增配置</a>
</li>
<li class="pull-right"><a href="" class="text-muted"><i class="fa fa-refresh"></i></a></li>
</ul>
<div class="tab-content">
<!-- /.tab-pane -->
<div class="tab-pane active" id="tabconfig0">
<form class="form-horizontal" action="<?php echo url('/admin/sysconfig/create');?>" method="post">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">配置标识</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="name" placeholder="Identifier">
</div>
<div class="col-sm-5">
<span class="help-block">(*用于Config类函数调用只能使用英文且不能重复)</span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">配置标题</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="title">
</div>
<div class="col-sm-5">
<span class="help-block">(*用于后台显示的配置标题)</span>
</div>
</div>
<div class="form-group">
<label for="sort" class="col-sm-2 control-label">配置排序<em style="color:red;">*</em></label>
<div class="col-sm-5">
<input type="text" class="form-control" name="sort" value="0">
</div>
<div class="col-sm-5">
<span class="help-block">(用于分组显示的顺序)</span>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">配置类型</label>
<div class="col-sm-5">
<select class="form-control" name="type">
<?php foreach($typeList as $ka=>$val):?>
<option value="<?php echo $ka; ?>"><?php echo $val;?></option>
<?php endforeach;?>
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*系统会根据不同类型解析配置值)</span>
</div>
</div>
<div class="form-group">
<label for="group" class="col-sm-2 control-label">配置分组</label>
<div class="col-sm-5">
<select class="form-control" name="group">
<?php foreach($groupList as $ka=>$val):?>
<option value="<?php echo $ka; ?>"><?php echo $val;?></option>
<?php endforeach;?>
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置分组,不分组则不显示在系统设置中)</span>
</div>
</div>
<div class="form-group">
<label for="value" class="col-sm-2 control-label">配置值</label>
<div class="col-sm-5" id="config_value">
<textarea class="form-control" name="value"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置所赋予的值)</span>
</div>
</div>
<div class="form-group">
<label for="extra" class="col-sm-2 control-label">配置项</label>
<div class="col-sm-5">
<textarea class="form-control" name="extra"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(如果是枚举型 需要配置该项)</span>
</div>
</div>
<div class="form-group">
<label for="remark" class="col-sm-2 control-label">配置说明</label>
<div class="col-sm-5">
<textarea class="form-control" name="remark"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置详细说明)</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="agree"> 确认添加
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="reset" class="btn btn-warning">重置</button>
<button type="submit" class="btn btn-danger">提交</button>
</div>
</div>
</form>
</div>
<!-- /.tab-pane -->
</div>
<!-- /.tab-content -->
</div>
<!-- /.nav-tabs-custom -->
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
$(document).ready(function() {
$('select[name="type"]').change(function() {
//console.log(this);
//console.log(this.options[this.selectedIndex].value);
if (this.options[this.selectedIndex].value == 'image') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><a tabindex="0" role="button" data-toggle="popover-image" data-image="/uploads/nopic.jpg"><i class="fa fa-fw fa-image"></i></a></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="/uploads/nopic.jpg">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'image\', \'img_call_back\')">选择图片</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
$('#webuploader_file_value').prev('.input-group-addon').find("[data-toggle='popover-image']").popover({content:'<img src="/uploads/nopic.jpg"/>',placement: 'auto bottom', trigger: 'hover focus', html: true, delay: {show: 5, hide: 10}});
} else if(this.options[this.selectedIndex].value == 'file') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><i class="fa fa-fw fa-file"></i></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="/uploads/nopic.jpg">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'file\', \'file_call_back\')">选择文件</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
} else{
$('#config_value').html('<textarea class="form-control" name="value"></textarea>');
}
});
//$('select[name="type"]').trigger('change');
});
</script>
<script type="text/javascript">
$(function() {
$("form.form-horizontal").submit(function(e) {
var agree = $("input[name='agree']", this).prop('checked');
if (agree) {
//alert("Submitted");
//e.preventDefault();
} else {
e.preventDefault();
alert("请勾选确认");
}
});
});
</script>

View File

@@ -0,0 +1,202 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
编辑配置
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/sysconfig/lists');?>"> 系统设置</a></li>
<li class="active"> 网站配置</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#tabconfig0">编辑配置</a>
</li>
<li class="pull-right"><a href="" class="text-muted"><i class="fa fa-refresh"></i></a></li>
</ul>
<div class="tab-content">
<!-- /.tab-pane -->
<div class="tab-pane active" id="tabconfig0">
<form class="form-horizontal" action="<?php echo url('/admin/sysconfig/update');?>" method="post">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">配置标识</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="name" value="<?php echo $config['name'];?>" <?php if(!$administrator):?>readonly<?php endif;?>>
</div>
<div class="col-sm-5">
<span class="help-block">(*用于Config类函数调用只能使用英文且不能重复)</span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">配置标题</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="title" value="<?php echo $config['title'];?>">
</div>
<div class="col-sm-5">
<span class="help-block">(*用于后台显示的配置标题)</span>
</div>
</div>
<div class="form-group">
<label for="sort" class="col-sm-2 control-label">配置排序<em style="color:red;">*</em></label>
<div class="col-sm-5">
<input type="text" class="form-control" name="sort" value="<?php echo $config['sort'];?>">
</div>
<div class="col-sm-5">
<span class="help-block">(用于分组显示的顺序)</span>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">配置类型</label>
<div class="col-sm-5">
<select class="form-control" name="type">
<?php foreach($typeList as $ka=>$val):?>
<option value="<?php echo $ka; ?>" <?php if($config['type']==$ka):?>selected<?php endif;?>><?php echo $val;?></option>
<?php endforeach;?>
<!--<option value="number">数字</option>
<option value="char">字符</option>
<option value="text">文本</option>
<option value="array">数组</option>
<option value="enum">枚举</option>
<option value="multienum">多维枚举</option>-->
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*系统会根据不同类型解析配置值)</span>
</div>
</div>
<div class="form-group">
<label for="group" class="col-sm-2 control-label">配置分组</label>
<div class="col-sm-5">
<select class="form-control" name="group">
<option value="0">未分组</option>
<?php foreach($groupList as $ka=>$val):?>
<option value="<?php echo $ka; ?>" <?php if($config['group']==$ka):?>selected<?php endif;?>><?php echo $val;?></option>
<?php endforeach;?>
<!--<option value="0">不显示</option>
<option value="1">配置组1</option>
<option value="2">配置组2</option>
<option value="3">配置组3</option>
<option value="4">配置组4</option>
<option value="5">配置组5</option>
<option value="6">配置组6</option>-->
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置分组,不分组则不显示在系统设置中)</span>
</div>
</div>
<div class="form-group">
<label for="value" class="col-sm-2 control-label">配置值</label>
<div class="col-sm-5" id="config_value">
<textarea class="form-control" name="value"><?php echo $config['value'];?></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置所赋予的值)</span>
</div>
</div>
<div class="form-group">
<label for="extra" class="col-sm-2 control-label">配置项</label>
<div class="col-sm-5">
<textarea class="form-control" name="extra"><?php echo $config['extra'];?></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(如果是枚举型 需要配置该项)</span>
</div>
</div>
<div class="form-group">
<label for="remark" class="col-sm-2 control-label">配置说明</label>
<div class="col-sm-5">
<textarea class="form-control" name="remark"><?php echo $config['remark'];?></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置详细说明)</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="agree"> 确认更新
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="id" value="<?php echo $config['id'];?>">
<button type="reset" class="btn btn-warning">重置</button>
<button type="submit" class="btn btn-danger">提交</button>
</div>
</div>
</form>
</div>
<!-- /.tab-pane -->
</div>
<!-- /.tab-content -->
</div>
<!-- /.nav-tabs-custom -->
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
$(document).ready(function() {
$('select[name="type"]').change(function() {
var value = "<?php echo $config['value'];?>";
//console.log(this);
//console.log(this.options[this.selectedIndex].value);
if (this.options[this.selectedIndex].value == 'image') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><a tabindex="0" role="button" data-toggle="popover-image" data-image="' + value + '"><i class="fa fa-fw fa-image"></i></a></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="' + value + '">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'image\', \'img_call_back\')">选择图片</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
$('#webuploader_file_value').prev('.input-group-addon').find("[data-toggle='popover-image']").popover({content: '<img src="' + value + '"/>', placement: 'auto bottom', trigger: 'hover focus', html: true, delay: {show: 5, hide: 10}});
} else if (this.options[this.selectedIndex].value == 'file') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><i class="fa fa-fw fa-file"></i></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="' + value + '">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'file\', \'file_call_back\')">选择文件</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
} else {
$('#config_value').html('<textarea class="form-control" name="value">' + value + '</textarea>');
}
});
$('select[name="type"]').trigger('change');
});
</script>
<script type="text/javascript">
$(function() {
$("form.form-horizontal").submit(function(e) {
var agree = $("input[name='agree']", this).prop('checked');
if (agree) {
//alert("Submitted");
//e.preventDefault();
} else {
e.preventDefault();
alert("提交被阻止,需要勾选确认后才能提交");
}
});
});
</script>

View File

@@ -0,0 +1,116 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
系统设置
<small>配置列表</small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/sysconfig/lists');?>"> 系统设置</a></li>
<li class="active"> 网站配置</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">配置</h3>
<div class="box-tools pull-right">
<div class="input-group input-group-sm">
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="<?php echo $search['skeyword'];?>">
<div class="input-group-btn">
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body no-padding">
<?php if(!empty($list)):?>
<div class="table-responsive lists-table">
<table class="table table-hover table-striped">
<tbody>
<tr>
<th>&nbsp;</th>
<th>ID</th>
<th>配置标识</th>
<th>配置标题</th>
<th>分组</th>
<th>排序</th>
<th>类型</th>
<th>操作</th>
</tr>
<?php foreach($list as $k=>$config):?>
<tr>
<td><input type="checkbox" name="ids[]" value="<?php echo $config['id'];?>"></td>
<td class="config-star"><a href="#"><i class="fa fa-star text-yellow"></i></a></td>
<td><a href="<?php echo url('/admin/sysconfig/edit',['id'=>$config['id']]);?>"><?php echo $config['name'];?></a></td>
<td><?php echo $config['title'];?></td>
<td><?php echo array_switch($groupList,$config['group'],'配置组'.$config['group']);?></td>
<td><?php echo $config['sort'];?></td>
<td><?php echo array_switch($typeList,$config['type'],'类型'.$config['type']);?></td>
<td>
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/sysconfig/edit',['id'=>$config['id']]);?>">编辑</a>
<a class="btn btn-xs btn-info" data-id="<?php echo $config['id'];?>" data-url="<?php echo url('/admin/sysconfig/delete');?>" data-cod="dowarn">删除</a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!-- /.table -->
</div>
<?php endif;?>
<!-- /.lists-table -->
</div>
<!-- /.box-body -->
<div class="box-footer no-padding">
<div class="mailbox-controls">
<!-- Check all button -->
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/sysconfig/deletes');?>" data-cod="batch">删除</button>
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
</div>
<!-- /.btn-group -->
<a href="<?php echo url('/admin/sysconfig/add');?>" class="btn btn-default btn-sm">添加</a>
<div class="pull-right">
<?php if($page):?>
<?php echo $page;?>
<?php endif;?>
</div>
<!-- /.pull-right -->
</div>
</div>
</div>
<!-- /.box -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Page Script -->
<script type="text/javascript">
$(function() {
//Handle starring for glyphicon and font awesome
$(".config-star").click(function(e) {
e.preventDefault();
//detect type
var $this = $(this).find("a > i");
var glyph = $this.hasClass("glyphicon");
var fa = $this.hasClass("fa");
//Switch states
if (glyph) {
$this.toggleClass("glyphicon-star");
$this.toggleClass("glyphicon-star-empty");
}
if (fa) {
$this.toggleClass("fa-star");
$this.toggleClass("fa-star-o");
}
});
});
</script>

View File

@@ -0,0 +1,432 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
系统设置
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/sysconfig/lists');?>"> 系统设置</a></li>
<li class="active"> 网站配置</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<?php
foreach ($groupList as $gid => $groupname):
if($gid==0||$gid==7)continue;
?>
<li <?php if ($gid == 1): ?>class="active"<?php endif; ?>>
<a data-toggle="tab" href="#tabconfig<?php echo $gid; ?>"><?php echo $groupname; ?></a>
</li>
<?php endforeach; ?>
<li>
<a data-toggle="tab" href="#tabconfig7"><?php echo '水印配置'; ?></a>
</li>
<li>
<a data-toggle="tab" href="#tabconfig0"><?php echo '新增配置'; ?></a>
</li>
<li class="pull-right"><a href="" class="text-muted"><i class="fa fa-refresh"></i></a></li>
</ul>
<div class="tab-content">
<?php
foreach ($configs as $gid => $config):
if($gid==0||$gid==7)continue;
?>
<div id="tabconfig<?php echo $gid; ?>" class="tab-pane<?php if ($gid == 1): ?> active<?php endif; ?>">
<form class="form-horizontal" action="<?php echo url('/admin/sysconfig/updategrp');?>" method="post">
<?php foreach ($config as $k => $value): ?>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $value['title']; ?></label>
<div class="col-sm-5">
<?php
switch ($value['type']):
case 'number':
case 'text':
?>
<input class="form-control" type="text" name="config[<?php echo $value['name']; ?>]" value ="<?php echo $value['value']; ?>"/>
<?php
break;
case 'textarea':
case 'array':
?>
<textarea class="form-control" name="config[<?php echo $value['name']; ?>]"><?php echo $value['value']; ?></textarea>
<?php
break;
case 'enum':
case 'radio':
?>
<?php $extravals=parse_config_attr($value['extra']);
if($extravals):
foreach($extravals as $ka=>$val):?>
<label class="radio-inline">
<input name="config[<?php echo $value['name']; ?>]" type="radio" value="<?php echo $ka; ?>" <?php if($value['value']==$ka):?>checked<?php endif;?>><?php echo $val;?>
</label>
<?php endforeach;
endif;?>
<?php
break;
case 'select':
?>
<select class="form-control" name="config[<?php echo $value['name']; ?>]">
<?php $extravals=parse_config_attr($value['extra']);
if($extravals):
foreach($extravals as $ka=>$val):?>
<option value="<?php echo $ka; ?>" <?php if($value['value']==$ka):?>selected<?php endif;?>><?php echo $val;?></option>
<?php endforeach;
endif;?>
</select>
<?php
break;
case 'image':
?>
<div class="input-group">
<span class="input-group-addon"><a tabindex="0" role="button" data-toggle="popover-image" data-image="<?php echo $value['value']; ?>"><i class="fa fa-fw fa-image"></i></a></span>
<input type="text" class="form-control" name="config[<?php echo $value['name']; ?>]" id="webuploader_file_<?php echo $value['name']; ?>" value="<?php echo $value['value']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="webuploader_modal('webuploader_file_<?php echo $value['name']; ?>', '', 'default', 'image', 'img_call_back');">选择图片</button>
</span>
</div>
<?php
break;
case 'file':
?>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-fw fa-file"></i></span>
<input type="text" class="form-control" name="config[<?php echo $value['name']; ?>]" id="webuploader_file_<?php echo $value['name']; ?>" value="<?php echo $value['value']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="webuploader_modal('webuploader_file_<?php echo $value['name']; ?>', '', 'default', 'file', 'file_call_back')">选择文件</button>
</span>
</div>
<?php
default:
?>
<input class="form-control" type="text" name="config[<?php echo $value['name']; ?>]" value ="<?php echo $value['value']; ?>"/>
<?php endswitch;?>
</div>
<div class="col-sm-5">
<span class="help-block"><?php echo $value['remark']; ?></span>
<span class="help-block"><?php echo $value['name']; ?></span>
</div>
</div>
<?php endforeach; ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="agree"> 确认
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="group" value="<?php echo $gid; ?>">
<button type="reset" class="btn btn-warning">重置</button>
<button type="submit" class="btn btn-danger">提交</button>
</div>
</div>
</form>
</div>
<?php endforeach; ?>
<!-- /.tab-pane -->
<?php $gid=7;
if(isset($configs[$gid])):
$config=$configs[$gid];?>
<div id="tabconfig<?php echo $gid; ?>" class="tab-pane">
<form class="form-horizontal" action="<?php echo url('/admin/sysconfig/updategrp');?>" method="post">
<?php foreach ($config as $k => $value): ?>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $value['title']; ?></label>
<div class="col-sm-5">
<?php
switch ($value['type']):
case 'number':
case 'text':
?>
<input class="form-control" type="text" name="config[<?php echo $value['name']; ?>]" value ="<?php echo $value['value']; ?>"/>
<?php
break;
case 'textarea':
case 'array':
?>
<textarea class="form-control" name="config[<?php echo $value['name']; ?>]"><?php echo $value['value']; ?></textarea>
<?php
break;
case 'enum':
case 'radio':
?>
<?php $extravals=parse_config_attr($value['extra']);
if($extravals):
foreach($extravals as $ka=>$val):?>
<label class="radio-inline">
<input name="config[<?php echo $value['name']; ?>]" type="radio" value="<?php echo $ka; ?>" <?php if($value['value']==$ka):?>checked<?php endif;?>><?php echo $val;?>
</label>
<?php endforeach;
endif;?>
<?php
break;
case 'select':
?>
<select class="form-control" name="config[<?php echo $value['name']; ?>]">
<?php $extravals=parse_config_attr($value['extra']);
if($extravals):
foreach($extravals as $ka=>$val):?>
<option value="<?php echo $ka; ?>" <?php if($value['value']==$ka):?>selected<?php endif;?>><?php echo $val;?></option>
<?php endforeach;
endif;?>
</select>
<?php
break;
case 'image':
?>
<div class="input-group">
<span class="input-group-addon"><a tabindex="0" role="button" data-toggle="popover-image" data-image="<?php echo $value['value']; ?>"><i class="fa fa-fw fa-image"></i></a></span>
<input type="text" class="form-control" name="config[<?php echo $value['name']; ?>]" id="webuploader_file_<?php echo $value['name']; ?>" value="<?php echo $value['value']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="webuploader_modal('webuploader_file_<?php echo $value['name']; ?>', '', 'default', 'image', 'img_call_back');">选择图片</button>
</span>
</div>
<?php
break;
case 'file':
?>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-fw fa-file"></i></span>
<input type="text" class="form-control" name="config[<?php echo $value['name']; ?>]" id="webuploader_file_<?php echo $value['name']; ?>" value="<?php echo $value['value']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="webuploader_modal('webuploader_file_<?php echo $value['name']; ?>', '', 'default', 'file', 'file_call_back')">选择文件</button>
</span>
</div>
<?php
default:
?>
<input class="form-control" type="text" name="config[<?php echo $value['name']; ?>]" value ="<?php echo $value['value']; ?>"/>
<?php endswitch;?>
</div>
<div class="col-sm-5">
<span class="help-block"><?php echo $value['remark']; ?></span>
<span class="help-block"><?php echo $value['name']; ?></span>
</div>
</div>
<?php endforeach; ?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="agree"> 确认
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="group" value="<?php echo $gid; ?>">
<button type="reset" class="btn btn-warning">重置</button>
<button type="submit" class="btn btn-danger">提交</button>
</div>
</div>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('input[name="config[mark_type]"]').change(function() {
if (this.value == 'image') {
$('input[name="config[mark_text]"]').closest('.form-group').hide();
$('input[name="config[mark_text_color]"]').closest('.form-group').hide();
$('input[name="config[mark_image]"]').closest('.form-group').show();
$('textarea[name="config[mark_width_height]"]').closest('.form-group').show();
//$("[data-toggle='mark-popover-image']").popover('destroy');
$('#webuploader_file_mark_image').prev('.input-group-addon').find("[data-toggle='popover-image']").popover({
content: function() {
return '<img src="' + $('#webuploader_file_mark_image').prev('.input-group-addon').find("[data-toggle='popover-image']").attr('data-image') + '" style="max-width:200px;"/>';
},
placement: 'auto bottom',
trigger: 'hover focus',
html: true,
delay: {show: 5, hide: 10}
});
} else {
$('input[name="config[mark_text]"]').closest('.form-group').show();
$('input[name="config[mark_text_color]"]').closest('.form-group').show();
$('input[name="config[mark_image]"]').closest('.form-group').hide();
$('textarea[name="config[mark_width_height]"]').closest('.form-group').hide();
}
});
$('input[checked][name="config[mark_type]"]').trigger('change');
});
</script>
<?php else:?>
<div id="tabconfig<?php echo $gid; ?>" class="tab-pane">
</div>
<?php endif;?>
<!-- /.tab-pane -->
<div class="tab-pane" id="tabconfig0">
<form class="form-horizontal" action="<?php echo url('/admin/sysconfig/create');?>" method="post">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">配置标识</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="name" placeholder="Identifier">
</div>
<div class="col-sm-5">
<span class="help-block">(*用于Config类函数调用只能使用英文且不能重复)</span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">配置标题</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="title">
</div>
<div class="col-sm-5">
<span class="help-block">(*用于后台显示的配置标题)</span>
</div>
</div>
<div class="form-group">
<label for="sort" class="col-sm-2 control-label">配置排序<em style="color:red;">*</em></label>
<div class="col-sm-5">
<input type="text" class="form-control" name="sort" value="0">
</div>
<div class="col-sm-5">
<span class="help-block">(用于分组显示的顺序)</span>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">配置类型</label>
<div class="col-sm-5">
<select class="form-control" name="type">
<?php foreach($typeList as $ka=>$val):?>
<option value="<?php echo $ka; ?>"><?php echo $val;?></option>
<?php endforeach;?>
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*系统会根据不同类型解析配置值)</span>
</div>
</div>
<div class="form-group">
<label for="group" class="col-sm-2 control-label">配置分组</label>
<div class="col-sm-5">
<select class="form-control" name="group">
<?php foreach($groupList as $ka=>$val):?>
<option value="<?php echo $ka; ?>"><?php echo $val;?></option>
<?php endforeach;?>
</select>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置分组,不分组则不显示在系统设置中)</span>
</div>
</div>
<div class="form-group">
<label for="value" class="col-sm-2 control-label">配置值</label>
<div class="col-sm-5" id="config_value">
<textarea class="form-control" name="value"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置所赋予的值)</span>
</div>
</div>
<div class="form-group">
<label for="extra" class="col-sm-2 control-label">配置项</label>
<div class="col-sm-5">
<textarea class="form-control" name="extra"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(如果是枚举型 需要配置该项)</span>
</div>
</div>
<div class="form-group">
<label for="remark" class="col-sm-2 control-label">配置说明</label>
<div class="col-sm-5">
<textarea class="form-control" name="remark"></textarea>
</div>
<div class="col-sm-5">
<span class="help-block">(*配置详细说明)</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="agree"> 确认添加
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="reset" class="btn btn-warning">重置</button>
<button type="submit" class="btn btn-danger">提交</button>
</div>
</div>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('select[name="type"]').change(function() {
//console.log(this);
//console.log(this.options[this.selectedIndex].value);
if (this.options[this.selectedIndex].value == 'image') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><a tabindex="0" role="button" data-toggle="popover-image" data-image="/uploads/nopic.jpg"><i class="fa fa-fw fa-image"></i></a></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="/uploads/nopic.jpg">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'image\', \'img_call_back\')">选择图片</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
$('#webuploader_file_value').prev('.input-group-addon').find("[data-toggle='popover-image']").popover({content: '<img src="/uploads/nopic.jpg"/>', placement: 'auto bottom', trigger: 'hover focus', html: true, delay: {show: 5, hide: 10}});
} else if (this.options[this.selectedIndex].value == 'file') {
var valuehtml = '';
valuehtml += '<div class="input-group">';
valuehtml += '<span class="input-group-addon"><i class="fa fa-fw fa-file"></i></span>';
valuehtml += '<input type="text" class="form-control" name="value" id="webuploader_file_value" value="/uploads/nopic.jpg">';
valuehtml += '<span class="input-group-btn">';
valuehtml += '<button class="btn btn-primary" type="button" onclick="webuploader_modal(\'webuploader_file_value\', \'\', \'default\', \'file\', \'file_call_back\')">选择文件</button>';
valuehtml += '</span>';
valuehtml += '</div>';
$('#config_value').html(valuehtml);
} else {
$('#config_value').html('<textarea class="form-control" name="value"></textarea>');
}
});
//$('select[name="type"]').trigger('change');
});
</script>
<!-- /.tab-pane -->
</div>
<!-- /.tab-content -->
</div>
<!-- /.nav-tabs-custom -->
</div>
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
$(function() {
$("form.form-horizontal").submit(function(e) {
var agree = $("input[name='agree']", this).prop('checked');
if (agree) {
if (confirm("确定要提交数据吗?")) {
} else {
alert("Submitted");
//e.preventDefault();
}
} else {
e.preventDefault();
alert("请勾选确认");
}
});
});
</script>