add.html
8.65 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE html>
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加|后台管理系统</title>
<link rel="stylesheet" type="text/css" href="__PUB__style/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__PUB__style/pp.css">
<link rel="stylesheet" type="text/css" href="__PUB__style/bootstrap-responsive.min.css">
<script type="text/javascript" src="__PUB__js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUB__js/jquery.min.js"></script>
<script type="text/javascript" src="__PUB__js/common.js"></script>
<link rel="stylesheet" href="__ROOTPUB__kindeditor/themes/default/default.css" />
<script charset="utf-8" src="__ROOTPUB__kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="__ROOTPUB__kindeditor/lang/zh_CN.js"></script>
<script>
KindEditor.ready(function(K) {
var editor = K.create('textarea[name="content"]', {
uploadJson : "<{:U('Kind/upload_json')}>",
fileManagerJson : "<{:U('Kind/file_manager_json')}>",
allowFileManager : true
});
var editor1 = K.editor({
uploadJson : "<{:U('Kind/upload_json')}>",
fileManagerJson : "<{:U('Kind/file_manager_json')}>",
allowFileManager : true
});
K('#uploadid').click(function() {
editor1.loadPlugin('image', function() {
editor1.plugin.imageDialog({
imageUrl : K('#picid').val(),
clickFn : function(url, title, width, height, border, align) {
K('#picid').val(url);
document.getElementById('picida').src=url;
editor1.hideDialog();
}
});
});
});
K('#uploadfid').click(function(){
editor1.loadPlugin('insertfile', function(){
editor1.plugin.fileDialog({
fileUrl : K('#fileid').val(),
clickFn : function(url, title) {
K('#fileid').val(url);
editor1.hideDialog();
}
});
});
});
K('#J_selectImage').click(function() {
editor1.loadPlugin('multiimage', function() {
editor1.plugin.multiImageDialog({
clickFn : function(urlList) {
var div = K('#img');
// div.html('');
K.each(urlList, function(i, data) {
div.append('<p><img src="' + data.url + '" /><input type="hidden" name="img[]" value="' + data.url + '" /></p>');
});
editor1.hideDialog();
}
});
});
});
});
$(document).ready(function(){
$("#tid").click(function(){
var vvv=$(this).children('option:selected').attr('upid');
var shangid=$(this).children('option:selected').val();
$(this).attr('gupid',vvv);
$(this).attr('shangid',shangid);
}).change(function(){
var val=$(this).children('option:selected').val();
var is=$(this).children('option:selected').attr('is');
var upid=$(this).children('option:selected').attr('upid');
var upupid=$(this).attr('gupid');
if(is!=1){
alert('该栏目不允许添加文章!');
$(this).val($(this).attr('shangid'));
//location.reload();
}else{
if(upupid!=upid){
window.location.href="<{:U('add',array(),'')}><{:C('URL_PATHINFO_DEPR')}>tid<{:C('URL_PATHINFO_DEPR')}>"+val;
}
//picnum附件类型判断
$.get("<{:U('getPicnum')}>", {tid:val}, function(data){
for(var k=1; k<=3; k++)
{
checkPicnum(data,k);
}
});
}
});
//删除图片
$("#img").delegate("p","click",function(){
if(window.confirm('你确定要删除此图片吗?')){
var p=$(this);
var f=p.children('img').attr('src');
var validate={
file:f
};
$.get("<{:U('delFile')}>", validate, function(data){
if(data == 'yes')
{
p.remove();
}
else
{
alert('删除失败');
}
});
}
});
});
function checkPicnum(data,num)
{
if(data.indexOf(num)!= -1)
{
$(".picnum_"+num).removeClass('display_none');
}
else
{
$(".picnum_"+num).addClass('display_none');
}
}
//获取单图、多图尺寸
$(function(){
var val=$('#tid').children('option:selected').val();
$.get('<{:U('getchicun','','')}>',{'tid':val},function(data){
$('#uploadid + span').text('(尺寸:'+data.img_size+')'); //单图
$('#J_selectImage + span').text('(尺寸:'+data.imgs_size+')'); //多图
},'json');
});
</script>
<style>
#tid {
font-family: "宋体";
}
</style>
</head>
<body style="margin: 10px 0px;">
<div style="margin: 0px auto; width: 98%;">
<form name="form1" action="" method="post" style="">
<table class="table table-condensed table-bordered table-hover" style="">
<tbody style="">
<tr>
<td colspan="4">
<div style="float:left">
<b>添加</b>
</div>
<div style="float:right">
[<a href="<{:U('index',array('tid'=>I('tid'),'p'=>I('p')))}>"><u>返回列表</u></a>]
</div>
</td>
</tr>
<tr>
<td class="text_right_wid_90"><font color="red">所属栏目:</font></td>
<td colspan="3">
<span id="typeidct">
<select name="tid" id="tid">
<volist name="cat_list" id="vo">
<option value="<{$vo.id}>" upid="<{$vo.upid}>" is="<{$vo.type}>" <neq name="vo.type" value="1">style="background:#CCC; color:#888;"</neq> <if condition="$vo.id eq $_GET['tid']">selected</if> >
<{$vo.tname}>
</option>
</volist>
</select>
</span>
(<font color="red">注:红色字为必填项</font>)
</td>
</tr>
<tr>
<td class="text_right_wid_90"><font color="red">标题:</font></td>
<td colspan="3">
<input name="title" type="text" id="title" class="txt_title" value=""> (<font color="red">注:红色字为必填项</font>)
</td>
</tr>
<tr>
<td class="text_right_wid_90">作者:</td>
<td class="width_430">
<input name="editor" type="text" id="writer" value="">
</td>
<td class="text_right_wid_90">来源:</td>
<td>
<input type="text" name="source" id="sourceid" value="">
</td>
</tr>
<tr>
<td class="text_right_wid_90">状态:</td>
<td>
<input name="isshow" type="radio" value="0" > 待审核 <input name="isshow" type="radio" value="1" checked>审核
</td>
<td class="text_right_wid_90">
关联属性:
</td>
<td>
<!-- <input id="flag" class="np" type="checkbox" value="h" name="flag[]">热门(h) --><input id="flag" class="np" type="checkbox" value="r" name="flag[]">推荐(r)
</td>
</tr>
<tr class="picnum_1 <if condition="!strstr($picnum,'1')">display_none</if>">
<td class="text_right_wid_90">缩 略 图:</td>
<td>
<input name="thumb" type="text" id="picid" value=""><input type="button" value="上传图片" style="cursor:pointer;" id="uploadid"> <span style="color:#ccc;"></span>
</td>
<td colspan="2">
<img src="<{$data.thumb|Thumb}>" id="picida" style=" max-height:60px; max-width:100px;">
</td>
</tr>
<tr class="picnum_2 <if condition="!strstr($picnum,'2')">display_none</if>">
<td class="text_right_wid_90">内容页多图:</td>
<td colspan="3">
<input type="button" id="J_selectImage" value="批量上传" /> <span style="color:#ccc;"></span>
</td>
</tr>
<tr class="picnum_2 <if condition="!strstr($picnum,'2')">display_none</if>">
<td colspan="4" id="img"></td>
</tr>
<tr class="picnum_3 <if condition="!strstr($picnum,'3')">display_none</if>">
<td class="text_right_wid_90">附 件:</td>
<td colspan="3">
<input name="file" type="text" id="fileid" value=""><input type="button" value="上传附件" style="cursor:pointer;" id="uploadfid">
</td>
</tr>
<tr>
<td class="text_right_wid_90">排序:</td>
<td colspan="3">
<input class="width_120" name="sort" id="orderid" value="<{$maxsort}>" type="text">
</td>
</tr>
<tr>
<td class="text_right_wid_90">价格:</td>
<td colspan="3"><input class="width_120" type="text" name="price" id="price" value=""></td>
</tr>
<tr>
<td style="text-align:right; vertical-align:middle">关 键 字:</td>
<td colspan="3"><input type="text" name="keywords" id="keywordid" value="" style="width:50%"> (注:多个用","分开)</td>
</tr>
<tr>
<td style="text-align:right; vertical-align:middle">内容摘要:</td>
<td colspan="3"><textarea name="description" rows="2" id="descriptionid" style="width:98%;"></textarea></td>
</tr>
<tr style="">
<td style="text-align:right; vertical-align:middle"><font color="red">内容:</font></td>
<td colspan="3" style=""><textarea name="content" id="content" style="width: 99%; height:500px; display: none;"></textarea></td>
</tr>
<tr>
<td></td>
<td colspan="3">
<button class="btn btn-large btn-info" type="submit" style="cursor:pointer;">保存</button>
<button class="btn btn-large btn-info" type="reset" onclick="location.reload();" style="cursor:pointer;">重置</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</body>
</html>