theme_config.html
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{echo:JS::import('form');}
{echo:JS::import('dialog?skin=brief');}
{echo:JS::import('dialogtools');}
<div style="padding: 10px;">
<h2 class="page_title">
主题参数设置
</h2>
<div class="form2" id="obj_form">
<form action="{url:/admin/theme_config_save}" method="post">
<input name="theme" type="hidden" value="{$theme}">
<div id="expand">
</div>
<div style="text-align:center;" class="mt10">
<input class="button" type="submit" value="提交">
<input class="button" type="reset" value="重置"/>
</input>
</div>
</input>
</form>
</div>
</div>
<script type="text/javascript">
function initFileds() {
var appConfig = {echo: JSON::encode($config)};
var str = '';
for(i in appConfig){
if(appConfig[i]['type']=='text' || appConfig[i]['type']=='textarea'){
var pattern_str = ' ';
var alt = '';
var info = ''
if(undefined != appConfig[i]['alt'])alt = appConfig[i]['alt'];
if(undefined != appConfig[i]['info'])info = appConfig[i]['info'];
if(undefined != appConfig[i]['pattern']) pattern_str = 'pattern ="'+ appConfig[i]['pattern']+'" ';
if(appConfig[i]['type'] == 'textarea'){
str += '<dl class="lineD"> <dt>'+appConfig[i]['caption']+':</dt> <dd> <textarea name="theme_'+appConfig[i]['field']+'" type="text" empty '+pattern_str+' alt="'+alt+'"></textarea> <label>'+info+'</label> </dd> </dl>';
}else{
str += '<dl class="lineD"> <dt>'+appConfig[i]['caption']+':</dt> <dd> <input name="theme_'+appConfig[i]['field']+'" empty type="text" '+pattern_str+' alt="'+alt+'"> <label>'+info+'</label> </dd> </dl>';
}
}else{
var options = appConfig[i]['options'];
options = options.split(',');
var option_str = '';
if(appConfig[i]['type']=='select'){
for(o in options){
var option = options[o];
var item = option.split(':');
option_str +='<option value="'+item[0]+'">'+item[1]+'</option>';
}
option_str = '<select name="theme_'+appConfig[i]['field']+'">'+option_str+'</select>';
}else if(appConfig[i]['type']=='checkbox'){
for(o in options){
var option = options[o];
var item = option.split(':');
option_str +='<input type="checkbox" name="theme_'+appConfig[i]['field']+'[]" value="'+item[0]+'"><label>'+item[1]+'</label>';
}
}else if(appConfig[i]['type']=='radio'){
for(o in options){
var option = options[o];
var item = option.split(':');
option_str +='<input type="radio" name="theme_'+appConfig[i]['field']+'" value="'+item[0]+'"><label>'+item[1]+'</label>';
}
}
str += '<dl class="lineD"> <dt>'+appConfig[i]['caption']+':</dt> <dd>'+option_str+' </dd> </dl>';
}
}
$("#expand").html(str);
}
initFileds();
var form = new Form();
form.init({!=JSON::encode($config_values)});
{if:Req::args('opstatus')=='success'}
art.dialog.tips("<p class='success' >保存成功!</p>");
{/if}
</script>