106 lines
3.8 KiB
PHTML
106 lines
3.8 KiB
PHTML
<?php
|
|
$this->headTitle($this->config->title->site);
|
|
$this->headTitle('后台管理');
|
|
$this->headTitle()->setSeparator(' - ');
|
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
|
$this->breadcrumb('<a href="/">首页</a>');
|
|
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
|
$this->breadcrumb('数据管理');
|
|
$this->breadcrumb()->setSeparator(' > ');
|
|
$this->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css');
|
|
$this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js');
|
|
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
|
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
|
$this->headScript()->appendFile('/static/js/uploadify/swfobject.js');
|
|
$this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js');
|
|
?>
|
|
<div id="leftPanel">
|
|
<?= $this->partial('data/left.phtml'); ?>
|
|
</div>
|
|
<div id="rightPanel">
|
|
|
|
<div class="ctrlplan">
|
|
<a href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>">返回元数据附件列表</a>
|
|
<a href="/data/<?php echo $this->uuid; ?>">查看元数据</a>
|
|
</div>
|
|
|
|
<form action="#" method="POST" enctype='multipart/form-data'>
|
|
<input type="hidden" name="add" value="1" />
|
|
<input type="hidden" name="submit" value="1" />
|
|
|
|
<p>注:可选择多个文件<br />
|
|
<ul id="datalist"></ul>
|
|
<input id="file_upload" name="Filedata" type="file" />
|
|
<input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" />
|
|
</p>
|
|
|
|
</form>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#file_upload').uploadify({
|
|
'uploader' : '/static/js/uploadify/uploadify.swf',
|
|
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>'},
|
|
'script' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
|
|
'cancelImg' : '/static/js/uploadify/cancel.png',
|
|
'folder' : '/uploads',
|
|
'multi' : true,
|
|
'auto' : false,
|
|
'displayData' : 'speed',
|
|
'buttonImg' : '/static/js/uploadify/selectfile.gif',
|
|
'onComplete' : function(event, ID, fileObj, response, data) {
|
|
var obj = jQuery.parseJSON(response);
|
|
var html;
|
|
if(obj.error=='')
|
|
{html = obj.html;}else{html = obj.error;}
|
|
$('<li/>', {
|
|
"id":'uploadedItem_'+obj.attid,
|
|
"class":'uploadifyQueueItem',
|
|
"html": html
|
|
}).appendTo('#datalist');
|
|
$('#deletebtn_'+obj.attid).bind('click', function() {
|
|
deleteatt(obj.attid);
|
|
});
|
|
},
|
|
'onError' : function (event,ID,fileObj,errorObj) {
|
|
alert(errorObj.type + ' Error: ' + errorObj.info);
|
|
}
|
|
});
|
|
function deleteatt(id){
|
|
$.ajax({
|
|
'type': "POST",
|
|
'url': "/admin/data/attachments/",
|
|
'data': 'uuid=<?php echo $this->uuid?>&mdattdel='+id,
|
|
'success': function(data){
|
|
if(data==null){Alert('遇到错误,请重试');return false;}
|
|
if(data.error!=null){Alert(data.error);return false;}
|
|
if(data.status==1){$('#uploadedItem_'+id).fadeOut("slow");}
|
|
},
|
|
'beforeSend':function(){},
|
|
'complete':function(){},
|
|
'timeout': 20000,
|
|
'dataType': 'json',
|
|
'error': function(){Alert('处理中出现问题,请重试');}
|
|
});
|
|
}
|
|
|
|
$.getJSON("/admin/data/getatts/uuid/<?php echo $this->uuid;?>", function(data) {
|
|
if(data)
|
|
{
|
|
$.each(data, function(key, val) {
|
|
$('<li/>', {
|
|
"id":'uploadedItem_'+val['id'],
|
|
"class":'uploadifyQueueItem',
|
|
"html": val['html']
|
|
}).appendTo('#datalist');
|
|
$('#deletebtn_'+val['id']).bind('click', function() {
|
|
deleteatt(val['id']);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
});
|
|
function Alert(html){
|
|
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
|
|
}
|
|
</script>
|