Files
2024-10-29 14:04:59 +08:00

432 lines
30 KiB
HTML
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 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>