增加ajax文件编辑功能
This commit is contained in:
parent
8dfd5b4159
commit
470adf6657
|
@ -8,7 +8,7 @@ class SubmitController extends Zend_Controller_Action
|
|||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->db=Zend_Registry::get('db');
|
||||
}
|
||||
|
||||
|
||||
function indexAction()
|
||||
{
|
||||
}
|
||||
|
@ -24,48 +24,48 @@ class SubmitController extends Zend_Controller_Action
|
|||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$u_id = $user->id;
|
||||
$this->view->isadmin=false;
|
||||
$u_id = $user->id;
|
||||
$this->view->isadmin=false;
|
||||
if ($user->usertype=='administrator') $this->view->isadmin=true;
|
||||
}
|
||||
|
||||
//根据已有元数据模板创建元数据
|
||||
if(empty($ac))
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
$sql="select id,(regexp_matches(data,'<resTitle>(.*)</resTitle>'))[1] as title,(owner-$u_id) as isowner from metadata where istemplate='y' and schemaid='iso19115'";
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("data"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" order by changedate desc";
|
||||
$sth = $this->wdb->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
$keywords = $this->_request->getParam('q');
|
||||
$sql="select id,(regexp_matches(data,'<resTitle>(.*)</resTitle>'))[1] as title,(owner-$u_id) as isowner from metadata where istemplate='y' and schemaid='iso19115'";
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("data"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" order by changedate desc";
|
||||
$sth = $this->wdb->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
//根据已有数据创建元数据
|
||||
else if($ac=="add")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
$sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
|
||||
left join geonetworkmetadata gn on md.uuid=gn.uuid
|
||||
WHERE gn.id is not null";
|
||||
$sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
|
||||
left join geonetworkmetadata gn on md.uuid=gn.uuid
|
||||
WHERE gn.id is not null";
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("md.title","md.description"));
|
||||
$sql.=' and '.$where;
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" order by md.ts_created desc";
|
||||
$sth = $this->db->prepare($sql);
|
||||
|
@ -79,161 +79,161 @@ class SubmitController extends Zend_Controller_Action
|
|||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
$this->_helper->viewRenderer('newdata-add');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//未提交数据列表
|
||||
function unsubmitAction()
|
||||
{
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$id = $this->_request->getParam('id');
|
||||
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$u_id = $user->id;
|
||||
}
|
||||
|
||||
//提交数据
|
||||
if($ac=="commit")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$data = "";
|
||||
try{
|
||||
$id = $this->_request->getParam('id');
|
||||
if(empty($id) || !is_numeric($id))
|
||||
{
|
||||
$data = array("error"=>"参数错误");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
$changelog = $this->_request->getParam('changelog');
|
||||
if(empty($changelog))
|
||||
{
|
||||
$data = array("error"=>$this->alertbox('warning','请输入变更信息'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. 权限认定:当前用户必须和其owner相同
|
||||
// 数据应当没有评审状态,没有作者信息
|
||||
$sql="select gn.id from geonetworkmetadata gn
|
||||
left join mdstatus s on gn.uuid=s.uuid
|
||||
left join mdauthor a on s.uuid=a.uuid
|
||||
where s.id is not null and a.id is not null and gn.id=?";
|
||||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$row=$sth->fetch();
|
||||
if (!emtpy($row))
|
||||
{
|
||||
$data = array("error"=>'错误的入口');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql="select uuid from metadata where id=? and owner=?";
|
||||
$sth=$this->wdb->prepare($sql);
|
||||
$sth->execute(array($id,$u_id));
|
||||
$row=$sth->fetch();
|
||||
if (empty($row))
|
||||
{
|
||||
$data = array("error"=>'无权限修改数据');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
// 保存数据作者信息
|
||||
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
|
||||
$sth=$this->db->query($sql,array($row['uuid'],$u_id));
|
||||
|
||||
// 2. 保存变化记录 save changelog & userid for the latest version
|
||||
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
|
||||
$this->db->query($sql,array($changelog,$u_id,$row['uuid']));
|
||||
|
||||
// 3. 保存数据评审状态
|
||||
//导入元数据
|
||||
$iso=new ISO19115();
|
||||
$iso->saveDB($this->db,$row['xml']);
|
||||
//进入评审库
|
||||
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?";
|
||||
$this->db->query($sql,array($u_id,$id));
|
||||
|
||||
//email to admin
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mailtp=new EmailText($this->db,"metadata-new-admin",array(
|
||||
'user' => $user->username,
|
||||
'uuid' => $iso->uuid,
|
||||
'email'=> $user->email,
|
||||
//元数据标题
|
||||
'title'=> $iso->resTitle,
|
||||
));
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->addTo($this->view->config->service->email);
|
||||
$mail->send();
|
||||
|
||||
unset($mail);
|
||||
unset($mailtp);
|
||||
//email to author
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mailtp=new EmailText($this->db,"metadata-new-author",array(
|
||||
'user' => $user->username,
|
||||
'uuid' => $iso->uuid,
|
||||
'email'=> $user->email,
|
||||
//元数据标题
|
||||
'title'=> $iso->resTitle,
|
||||
));
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->addTo($user->email);
|
||||
$mail->addCc($this->view->config->service->email);
|
||||
@$mail->send();
|
||||
|
||||
$data = array("commited"=>1,"error"=>$this->alertbox('ok','该版本已经成功提交,请等待数据中心进一步处理!'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}catch(Exception $e) {
|
||||
$msg = "提交失败,请确认权限后重试";
|
||||
if($this->debug>0)
|
||||
{$msg .= $e->getMessage();}
|
||||
$data = array("error"=>$this->alertbox('error',$msg));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT (regexp_matches(gn.data,'<resTitle>(.*)</resTitle>'))[1] as title,gn.id,gn.uuid FROM geonetworkmetadata gn
|
||||
WHERE gn.uuid not in (select uuid from metadata) and gn.owner=?
|
||||
order by gn.id desc
|
||||
";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(15);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
|
||||
//未提交数据列表
|
||||
function unsubmitAction()
|
||||
{
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$id = $this->_request->getParam('id');
|
||||
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$u_id = $user->id;
|
||||
}
|
||||
|
||||
//提交数据
|
||||
if($ac=="commit")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$data = "";
|
||||
try{
|
||||
$id = $this->_request->getParam('id');
|
||||
if(empty($id) || !is_numeric($id))
|
||||
{
|
||||
$data = array("error"=>"参数错误");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
$changelog = $this->_request->getParam('changelog');
|
||||
if(empty($changelog))
|
||||
{
|
||||
$data = array("error"=>$this->alertbox('warning','请输入变更信息'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. 权限认定:当前用户必须和其owner相同
|
||||
// 数据应当没有评审状态,没有作者信息
|
||||
$sql="select gn.id from geonetworkmetadata gn
|
||||
left join mdstatus s on gn.uuid=s.uuid
|
||||
left join mdauthor a on s.uuid=a.uuid
|
||||
where s.id is not null and a.id is not null and gn.id=?";
|
||||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$row=$sth->fetch();
|
||||
if (!emtpy($row))
|
||||
{
|
||||
$data = array("error"=>'错误的入口');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql="select uuid from metadata where id=? and owner=?";
|
||||
$sth=$this->wdb->prepare($sql);
|
||||
$sth->execute(array($id,$u_id));
|
||||
$row=$sth->fetch();
|
||||
if (empty($row))
|
||||
{
|
||||
$data = array("error"=>'无权限修改数据');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
// 保存数据作者信息
|
||||
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
|
||||
$sth=$this->db->query($sql,array($row['uuid'],$u_id));
|
||||
|
||||
// 2. 保存变化记录 save changelog & userid for the latest version
|
||||
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
|
||||
$this->db->query($sql,array($changelog,$u_id,$row['uuid']));
|
||||
|
||||
// 3. 保存数据评审状态
|
||||
//导入元数据
|
||||
$iso=new ISO19115();
|
||||
$iso->saveDB($this->db,$row['xml']);
|
||||
//进入评审库
|
||||
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?";
|
||||
$this->db->query($sql,array($u_id,$id));
|
||||
|
||||
//email to admin
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mailtp=new EmailText($this->db,"metadata-new-admin",array(
|
||||
'user' => $user->username,
|
||||
'uuid' => $iso->uuid,
|
||||
'email'=> $user->email,
|
||||
//元数据标题
|
||||
'title'=> $iso->resTitle,
|
||||
));
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->addTo($this->view->config->service->email);
|
||||
$mail->send();
|
||||
|
||||
unset($mail);
|
||||
unset($mailtp);
|
||||
//email to author
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mailtp=new EmailText($this->db,"metadata-new-author",array(
|
||||
'user' => $user->username,
|
||||
'uuid' => $iso->uuid,
|
||||
'email'=> $user->email,
|
||||
//元数据标题
|
||||
'title'=> $iso->resTitle,
|
||||
));
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
$mail->addTo($user->email);
|
||||
$mail->addCc($this->view->config->service->email);
|
||||
@$mail->send();
|
||||
|
||||
$data = array("commited"=>1,"error"=>$this->alertbox('ok','该版本已经成功提交,请等待数据中心进一步处理!'));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}catch(Exception $e) {
|
||||
$msg = "提交失败,请确认权限后重试";
|
||||
if($this->debug>0)
|
||||
{$msg .= $e->getMessage();}
|
||||
$data = array("error"=>$this->alertbox('error',$msg));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT (regexp_matches(gn.data,'<resTitle>(.*)</resTitle>'))[1] as title,gn.id,gn.uuid FROM geonetworkmetadata gn
|
||||
WHERE gn.uuid not in (select uuid from metadata) and gn.owner=?
|
||||
order by gn.id desc
|
||||
";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(15);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
}
|
||||
|
||||
function uploadAction()
|
||||
|
||||
function uploadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
$this->view->uuid=$uuid;
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$dataFilePath = "../data/upload/";
|
||||
$dataFilePath = "../data/datafiles/";
|
||||
|
||||
if($ac=='submit')
|
||||
{
|
||||
|
@ -374,6 +374,91 @@ class SubmitController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function filesAction(){
|
||||
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
$this->view->uuid=$uuid;
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$dataFilePath = "../data/datafiles";
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$userid = $user->id;
|
||||
}
|
||||
|
||||
if(empty($ac) || $ac=='list')
|
||||
{
|
||||
$sql = "SELECT * FROM attachments WHERE filetype='datafiles' AND userid=? ORDER BY id DESC";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($userid));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(8);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
|
||||
if($ac=="editname")
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
|
||||
$name = $this->_request->getParam('name');
|
||||
$id = $this->_request->getParam('id');
|
||||
|
||||
if(empty($name))
|
||||
{
|
||||
$data = array("error"=>'请输入文件名');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(empty($id))
|
||||
{
|
||||
$data = array("error"=>'参数错误');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
$sql = "UPDATE attachments SET realname=? WHERE id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$ex = $sth->execute(array($name,$id));
|
||||
|
||||
if($ex)
|
||||
{
|
||||
$data = array("success"=>'1');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = array("error"=>'遇到错误请重试');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
}catch(Exception $e){
|
||||
$data = array("error"=>'遇到错误请重试'.$e->getMessage());
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}//文件管理
|
||||
|
||||
|
||||
public function getFileinfo($id){
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>数据管理</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/static/css/default.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/static/css/table.css" />
|
||||
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
|
||||
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
|
||||
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
|
||||
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="wapper">
|
||||
|
||||
<table class="stylized">
|
||||
<thead>
|
||||
<tr>
|
||||
<td width='350'>数据名</td>
|
||||
<td width='200'>操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<form id="filemanager">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<?php $autoindex=0;?>
|
||||
<?php foreach ($this->paginator as $item): ?>
|
||||
<?php $autoindex++;?>
|
||||
<tr class="<?php if($autoindex%2 == 0) echo 'even'; else echo 'odd'; ?>" id="file_<?= $item['id']?>">
|
||||
<td>
|
||||
<input type="text" id="name_<?= $item['id']?>" value="<?= $item['realname']?>" readonly="readonly" />
|
||||
<button type="button" id="submit_<?= $item['id']?>" style="display:none" onclick="Submit(<?= $item['id']?>)">提交</button>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" onclick="del(<?= $item['id']?>)" id="del_<?= $item['id']?>">删除</a>
|
||||
<a href="javascript:;" onclick="edit(<?= $item['id']?>)" id="edit_<?= $item['id']?>">改名</a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
function edit(id){
|
||||
$('#submit_'+id).fadeIn();
|
||||
$('#name_'+id).removeAttr('readonly');
|
||||
}
|
||||
|
||||
function Submit(id){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/submit/files/ac/editname',
|
||||
'data':'id='+id+'&name='+$('#name_'+id).val(),
|
||||
'datatype':'json',
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{$.colorbox({'innerWidth':'50%','html':data.error});}
|
||||
if(typeof(data.success)!='undefined' && data.success==1)
|
||||
{
|
||||
$.colorbox({'innerWidth':'50%','html':'修改成功'});
|
||||
$('#submit_'+id).fadeOut();
|
||||
$('#name_'+id).attr('readonly','readonly');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){
|
||||
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
|
||||
}
|
||||
});
|
||||
}
|
||||
function del(id){
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:'/submit/upload/ac/del/id/'+id,
|
||||
data:'',
|
||||
success:function(html){
|
||||
$('#file_'+id).fadeOut();
|
||||
},
|
||||
beforeSend:function(){
|
||||
$('#del_'+id).html('<img src="/images/ajax-loading-small.gif" />');
|
||||
},
|
||||
timeout:10000,
|
||||
error:function(){
|
||||
alert('删除失败,请重试');
|
||||
}
|
||||
});
|
||||
}
|
||||
function uploadError(msg,id){
|
||||
var html = msg+'<div class="cancel"><a href="javascript:;" id="deletebtn_'+id+'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
|
||||
return html;
|
||||
}
|
||||
$('#wapper').width($('.body').width()-$('#sidebar').width()-20);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue