album.html
18.5 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
{template 'common/header'}
<ul class="nav nav-tabs">
<li {if $foo == 'create'}class="active"{/if}><a href="{php echo $this->createWebUrl('list', array('foo' => 'create'));}">创建相册</a></li>
<li {if $foo == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('list', array('foo' => 'display'));}">相册管理</a></li>
{if $foo == 'photo'}<li class="active"><a href="{php echo $this->createWebUrl('list', array('foo' => 'photo', 'albumid' => $id));}">添加照片</a></li>{/if}
</ul>
<style>
.album_list{overflow:hidden; list-style: none; padding:0; margin:0;}
.album_list li{border:1px #DDD solid; width:232px; float:left; margin-right:15px; margin-bottom:10px;padding:4px;}
.album_list li .album_pic{display:block; width:224px; height:130px; overflow:hidden;}
.album_list li .album_pic img{display:block; height:129px; margin:0 auto;}
.album_list li .album_main{padding:10px; overflow:hidden;}
.album_list li .album_main .album_title{font-size:16px; height:20px; width:217px; overflow:hidden;}
.album_list li .album_main .pull-left{color:#999;}
.album_manage .table th{width:120px;}
.album_manage #albums_head img{margin-right:10px; max-height:70px;}
</style>
{if $foo == 'create'}
<div class="main">
<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
<input type="hidden" name="id" value="{$item['id']}" />
<div class="panel panel-default">
<div class="panel-heading">
创建相册
</div>
<div class="panel-body">
{if !empty($item)}
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">访问地址</label>
<div class="col-xs-12 col-sm-9">
<a href="../app/index.php?c=entry&m=we7_album&do=detail&id={$item['id']}&i={$_W['uniacid']}" target="_blank">./app/index.php?c=entry&m=we7_album&do=detail&id={$item['id']}&i={$_W['uniacid']}</a>
<span class="help-block">您可以根据此地址,添加回复规则,设置访问。</span>
</div>
</div>
{/if}
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
<div class="col-xs-12 col-sm-9">
<input type="text" name="displayorder" class="form-control" value="{$item['displayorder']}" />
<span class="help-block">相册优先级,越大则越靠前</span>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">名称</label>
<div class="col-xs-12 col-sm-9">
<input type="text" class="form-control" placeholder="" name="title" value="{$item['title']}">
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">分类</label>
<div class="col-sm-4 col-xs-6">
<select class="form-control" style="margin-right:15px;" id="pcate" name="pcate" onchange="fetchChildCategory(this.options[this.selectedIndex].value)" autocomplete="off">
<option value="0">请选择一级分类</option>
{loop $category $row}
{if $row['parentid'] == 0}
<option value="{$row['id']}" {if $row['id'] == $item['pcate']} selected="selected"{/if}>{$row['name']}</option>
{/if}
{/loop}
</select>
</div>
<div class="col-sm-4 col-xs-6">
<select class="form-control" id="cate_2" name="ccate" autocomplete="off">
<option value="0">请选择二级分类</option>
{if !empty($item['ccate']) && !empty($children[$item['pcate']])}
{loop $children[$item['pcate']] $row}
<option value="{$row[0]}" {if $row[0] == $item['ccate']} selected="selected"{/if}>{$row[1]}</option>
{/loop}
{/if}
</select>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">封面</label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_image('thumb', $item['thumb'])}
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">简介</label>
<div class="col-sm-9 col-xs-12">
<textarea style="height:200px;" class="form-control" name="content" cols="70" id="reply-add-text">{$item['content']}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">相册类型</label>
<div class="col-sm-9 col-xs-12">
<label for="radio_1" class="radio-inline"><input type="radio" name="type" id="radio_1" value="0" {if empty($item) || $item['type'] == 0} checked{/if} /> 普通</label>
<label for="radio_0" class="radio-inline"><input type="radio" name="type" id="radio_0" value="1" {if !empty($item) && $item['type'] == 1} checked{/if} /> 360全景</label>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">前台是否显示</label>
<div class="col-sm-9 col-xs-12">
<label for="radio_2" class="radio-inline"><input type="radio" name="isview" id="radio_2" value="1" {if empty($item) || $item['isview'] == 1} checked{/if} /> 显示</label>
<label for="radio_3" class="radio-inline"><input type="radio" name="isview" id="radio_3" value="0" {if !empty($item) && $item['isview'] == 0} checked{/if} /> 隐藏</label>
<span class="help-block">设置隐藏后,此相册只可以通过关键字触发</span>
</div>
</div>
</div>
</div>
<div class="form-group col-sm-12 col-xs-12">
<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" onclick='return formcheck()' />
<input type="hidden" name="token" value="{$_W['token']}" />
</div>
</form>
</div>
{elseif $foo == 'display'}
<div class='main'>
<div class="panel panel-info">
<div class="panel-heading">筛选</div>
<div class="panel-body">
<form action="./index.php" method="get" class="form-horizontal" role="form">
<input type="hidden" name="c" value="site" />
<input type="hidden" name="a" value="entry" />
<input type="hidden" name="m" value="we7_album" />
<input type="hidden" name="do" value="list" />
<div class="form-group">
<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
<div class="col-sm-8 col-lg-9 col-xs-12">
<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
<div class="col-sm-8 col-lg-9 col-xs-12">
<select name="isview" class='form-control'>
<option value="" {if $_GPC['isview']==''} selected{/if}>全部</option>
<option value="1" {if $_GPC['isview']=='1'} selected{/if}>显示</option>
<option value="0" {if $_GPC['isview']=='0'} selected{/if}>隐藏</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分类</label>
<div class="col-sm-4 col-xs-6">
<select class="form-control" style="margin-right:15px;" name="cate_1" onchange="fetchChildCategory(this.options[this.selectedIndex].value)">
<option value="0">请选择一级分类</option>
{loop $category $row1}
{if $row1['parentid'] == 0}
<option value="{$row1['id']}" {if $row1['id'] == $_GPC['cate_1']} selected="selected"{/if}>{$row1['name']}</option>
{/if}
{/loop}
</select>
</div>
<div class="col-sm-4 col-xs-6">
<select class="form-control input-medium" id="cate_2" name="cate_2">
<option value="0">请选择二级分类</option>
{if !empty($_GPC['cate_1']) && !empty($children[$_GPC['cate_1']])}
{loop $children[$_GPC['cate_1']] $row2}
<option value="{$row2[0]}" {if $row2[0] == $_GPC['cate_2']} selected="selected"{/if}>{$row2[1]}</option>
{/loop}
{/if}
</select>
</div>
<div class=" col-xs-12 col-sm-2 col-lg-2">
<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
</div>
</div>
</form>
</div>
</div>
</div>
<ul class="album_list">
{loop $list $item}
<li>
<a href="{php echo $this->createWebUrl('list', array('foo' => 'photo', 'albumid' => $item['id']))}" class="album_pic">
<img src="{php echo tomedia($item[thumb]);}" onerror="this.src='./resource/images/nopic.jpg'; this.title='缩略图片未上传.'" />
</a>
<div class="album_main">
<p class="album_title">
{if !empty($category[$item['pcate']])}
<span class="text-error">[{$category[$item['pcate']]['name']}] </span>
{/if}
{if !empty($children[$item['pcate']])}
<span class="text-info">[{$children[$item['pcate']][$item['ccate']][1]}] </span>
{/if}
{$item['title']}
</p>
<p>
<span class="pull-right">
<a href="{php echo $this->createWebUrl('list', array('foo' => 'photo', 'albumid' => $item['id']))}">上传照片</a>
<a href="{php echo $this->createWebUrl('list', array('foo' => 'create', 'id' => $item['id']))}">编辑</a>
<a href="{php echo $this->createWebUrl('list', array('foo' => 'delete', 'id' => $item['id'], 'type' => 'album'))}" onclick="return confirm('此操作不可恢复,确定删除码?'); return false;">删除</a></span>
<span class="pull-left">有{$item['total']}张照片</span>
</p>
</div>
</li>
{/loop}
</ul>
{$pager}
{elseif $foo == 'photo'}
<script type="text/javascript">
{if $album['type'] == 1}
require(['jquery', 'util'], function($, util){
$(function(){
$('#selectimage').click(function(){
util.uploadMultiPictures(function(list){
for(var i=0; i<list.length; i++){
var html = '<div class="alert alert-info">' +
'<input type="hidden" name="attachment-new[]" value="' + list[i]['filename'] + '" />' +
'<span class="pull-right">' +
'<a href="javascript:;" onclick="var $this = this;if (confirm(\'删除操作不可恢复,确定码?\')){ajaxopen(\'index.php?c=site&a=entry&m=we7_album&do=delete&type=photo&attachment=' + list[i]['filename'] + '\', function(s) {$($this).parent().parent().remove();})}; return false;">删除</a>' +
'</span>' +
'<div class="photo_preview pull-left">' +
'<label class="radio inline">' +
'<img src="' + list[i]['url'] + '">' +
'<div><a href="javascript:;" onclick="ajaxopen(\'index.php?c=site&a=entry&m=we7_album&do=cover&albumid={$album['id']}&thumb=' + list[i]['filename'] + '\', function(msg){ message(msg)})">设为封面</a>' +
'</div>' +
'</label>' +
'</div>' +
'<table class="pull-left">' +
'<tr>' +
'<th>排序</th>' +
'<td>' +
'<select class="form-control" name="displayorder-new[]">' +
'<option value="0">前</option>' +
'<option value="1">右</option>' +
'<option value="2">后</option>' +
'<option value="3">左</option>' +
'<option value="4">上</option>' +
'<option value="5">下</option>' +
'</select>' +
'</td>' +
'</tr>' +
'<tr>' +
'<th>标题</th>' +
'<td>' +
'<input type="text" name="title-new[]" value="" class="form-control">' +
'</td>' +
'</tr>' +
'<tr class="hide">' +
'<th>简介</th>' +
'<td>' +
'<textarea name="description-new[]" class="form-control"></textarea>' +
'</td>' +
'</tr>' +
'</table>' +
'</div>';
$('#listimage').append(html);
}
});
});
});
});
{else}
require(['jquery', 'util'], function($, util){
$(function(){
// 对象绑定点击事件
$('#selectimage').click(function(){
util.uploadMultiPictures(function(list){
for(var i=0; i<list.length; i++){
html = '<div class="alert alert-info">' +
'<input type="hidden" name="attachment-new[]" value="' + list[i]['filename'] + '" />' +
'<span class="pull-right">' +
'<a href="javascript:;" onclick="var $this = this;if (confirm(\'删除操作不可恢复,确定码?\')){ajaxopen(\'index.php?c=site&a=entry&m=we7_album&do=delete&type=photo&attachment=' + list[i]['filename'] + '\', function(s) {$($this).parent().parent().remove();})}; return false;">删除</a>' +
'</span>' +
'<div class="photo_preview pull-left">' +
'<label class="radio inline">' +
'<img src="' + list[i]['url'] + '">' +
'<div>' +
'<a href="javascript:;" onclick="ajaxopen(\'index.php?c=site&a=entry&m=we7_album&do=cover&albumid={$album['id']}&thumb=' + list[i]['filename'] + '\', function(msg){ message(msg)})">设为封面</a>' +
'</div>' +
'</label>' +
'</div>' +
'<table class="pull-left">' +
'<tr>' +
'<th>排序</th>' +
'<td>' +
'<input type="text" name="displayorder-new[]" value="" class="form-control">' +
'</td>' +
'</tr>' +
'<tr>' +
'<th>标题</th>' +
'<td>' +
'<input type="text" name="title-new[]" value="" class="form-control">' +
'</td>' +
'</tr>' +
'<tr class="hide">' +
'<th>简介</th>' +
'<td>' +
'<textarea name="description-new[]" class="form-control"></textarea>' +
'</td>' +
'</tr>' +
'</table>' +
'</div>';
$('#listimage').append(html);
}
});
});
});
});
{/if}
</script>
<style>
.photo_list{padding:15px 0;}
.photo_list .alert{width:auto; margin-top:10px; overflow:hidden;}
.photo_list .photo_preview{width:130px;}
.photo_list .photo_preview img{width:130px; margin-bottom:5px;}
.photo_list .photo_preview label{padding:0;}
.photo_list .photo_preview input[type="radio"]{margin-left:0; margin-right:10px;}
.photo_list table{margin-left:40px;}
.photo_list table th,.photo_list table td{padding-bottom:5px;}
.photo_list table th{width:60px; font-size:14px;}
.photo_list table input,.photo_list table select{margin-bottom:0;}
</style>
<div class="main">
<div class="photo_list">
<form method="post" class="form">
<input name="token" type="hidden" value="{$_W['token']}" />
<input name="albumid" type="hidden" value="{$album['id']}" />
<span id="selectimage" class="btn btn-primary"><i class="icon-plus"></i> 上传照片</span>
<input type="submit" name="submit" id="selectimage" class="btn btn-default" value="保存" />
<span style="color:red;">上传照片后,请保存照片数据!</span>
<input type="submit" name="delete" class="btn btn-danger" value="删除全部照片" onclick="return confirm('确认删除全部的照片吗?');" />
<div style="padding:10px 0;">
相册访问地址:<a target="_blank" href="../app/index.php?c=entry&m=we7_album&do=detail&id={$album['id']}&i={$_W['uniacid']}">./app/index.php?c=entry&m=we7_album&do=detail&id={$album['id']}&i={$_W['uniacid']}</a>
</div>
{if $album['type'] == 1}
<div class="alert alert-info" style="margin-top:0;">
<i class="icon-warning-sign"></i> 请把照片按照前->右->后->左->上->下的顺序排列!
</div>
{/if}
{if $album['type'] == 0}<div id="listimage"></div>{/if}
{loop $photos $item}
<div class="alert alert-info">
<input type="hidden" value="{$item['attachment']}" name="attachment[{$item['id']}]">
<span class="pull-right"><a class="delete" onclick="return confirm('删除操作不可恢复,确定码?'); return false;" href="{php echo $this->createWebUrl('list', array('foo' => 'delete', 'type' => 'photo', 'id' => $item['id']))}">删除</a></span>
<div class="photo_preview pull-left">
<label class="radio-inline">
<img src="{$_W['attachurl']}{$item['attachment']}">
<div><a href="javascript:;" onclick="ajaxopen('{php echo $this->createWebUrl('list', array('foo' => 'cover', 'albumid' => $album['id'], 'thumb' => $item['attachment']))}')">设为封面</a></div>
</label>
</div>
<table class="pull-left">
<tr>
<th>排序</th>
<td>
{if $album['type'] == 1}
<select class="form-control" name="displayorder[{$item['id']}]">
<option value='0' {if $item['displayorder']==0}selected{/if}>前</option>
<option value='1' {if $item['displayorder']==1}selected{/if}>右</option>
<option value='2' {if $item['displayorder']==2}selected{/if}>后</option>
<option value='3' {if $item['displayorder']==3}selected{/if}>左</option>
<option value='4' {if $item['displayorder']==4}selected{/if}>上</option>
<option value='5' {if $item['displayorder']==5}selected{/if}>下</option>
</select>
{else}
<input type="text" class="form-control" value="{$item['displayorder']}" name="displayorder[{$item['id']}]">
{/if}
</td>
</tr>
<tr>
<th>标题</th>
<td><input type="text" class="form-control" value="{$item['title']}" name="title[{$item['id']}]"></td>
</tr>
<tr class="hide">
<th>简介</th>
<td><textarea class="form-control" name="description[{$item['id']}]">{$item['description']}</textarea></td>
</tr>
</table>
</div>
{/loop}
{if $album['type'] == 1}<div id="listimage"></div>{/if}
</form>
</div>
</div>
{/if}
<div id='msg' class="hide"></div>
<script language="javascript">
function ajaxopen(url) {
$.get(url+'&time='+new Date().getTime(), function(data){
$("#msg").html(data);
});
return false;
}
var category = {php echo json_encode($children)};
function fetchChildCategory(cid) {
var html = '<option value="0">请选择二级分类</option>';
if (!category || !category[cid]) {
$('#cate_2').html(html);
return false;
}
for (i in category[cid]) {
html += '<option value="'+category[cid][i][0]+'">'+category[cid][i][1]+'</option>';
}
$('#cate_2').html(html);
}
</script>
{template 'common/footer'}