diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 401fdc8b..a5f38665 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -108,6 +108,7 @@ class AuthorController extends Zend_Controller_Action if($ac == "offline") { $pr = $this->_request->getParam('pr'); + $oid = $this->_request->getParam('oid'); if(!empty($pr)) { @@ -116,20 +117,22 @@ class AuthorController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $uuid = $this->_request->getParam('uuid'); + if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) { echo "参数有误!";exit(); } + //如果用户已经下载过了,就无法在更改对数据申请的意见 $sql = "select md.title,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o left join dataorder d on o.id=d.offlineappid left join metadata md on md.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid - where o.ts_approved is null and o.pdflink is not null and d.uuid=? and a.userid=? + where o.ts_approved is null and o.pdflink is not null and d.uuid=? and a.userid=? and d.offlineappid=? order by o.ts_created desc"; $sth = $this->db->prepare($sql); - $sth->execute(array($uuid,$u_id)); + $sth->execute(array($uuid,$u_id,$oid)); $row = $sth->fetch(); if($row['datastatus']>4) @@ -138,13 +141,14 @@ class AuthorController extends Zend_Controller_Action exit(); } + //同意用户下载 if($pr=="confrim") { - $sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=?"; + $sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=? AND offlineappid=?"; $sth = $this->db->prepare($sql); - if($sth->execute(array($uuid))) + if($sth->execute(array($uuid,$oid))) { - $btn = $this->createOfflineCtBtn($uuid,'c'); + $btn = $this->createOfflineCtBtn($uuid,'c',$oid); echo ''.$btn.''; exit(); }else{ @@ -152,13 +156,15 @@ class AuthorController extends Zend_Controller_Action exit(); } } + + //反对用户下载 if($pr == "objection") { - $sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=?"; + $sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=? AND offlineappid=?"; $sth = $this->db->prepare($sql); - if($sth->execute(array($uuid))) + if($sth->execute(array($uuid,$oid))) { - $btn = $this->createOfflineCtBtn($uuid,'o'); + $btn = $this->createOfflineCtBtn($uuid,'o',$oid); echo ''.$btn.''; exit(); }else{ @@ -190,11 +196,11 @@ class AuthorController extends Zend_Controller_Action foreach ($rows as $k=>$v) { if($v['authorpermitted']==0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);} if($v['authorpermitted']>0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);} if($v['authorpermitted']<0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);} } $paginator = Zend_Paginator::factory($rows); @@ -231,11 +237,11 @@ class AuthorController extends Zend_Controller_Action foreach ($rows as $k=>$v) { if($v['authorpermitted']==0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);} if($v['authorpermitted']>0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);} if($v['authorpermitted']<0) - {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o');} + {$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);} } $paginator = Zend_Paginator::factory($rows); @@ -253,16 +259,16 @@ class AuthorController extends Zend_Controller_Action * createOfflineCtBtn() 创建离线申请记录的操作按钮 * */ - function createOfflineCtBtn($uuid, $type=""){ + function createOfflineCtBtn($uuid, $type="",$oid){ $urlHref = 'href="javascript:;"'; $baseStyle = "offline-ct-btns box-shadow"; $selectedStyle = "offline-select"; $confrimText = "同意"; - $confrimFunc = 'onclick="confrim(\''.$uuid.'\')"'; + $confrimFunc = 'onclick="confrim(\''.$uuid.'\',\''.$oid.'\')"'; $objectionText = "反对"; - $objectionFunc = 'onclick="objection(\''.$uuid.'\')"'; + $objectionFunc = 'onclick="objection(\''.$uuid.'\',\''.$oid.'\')"'; $btns=''; if(empty($type)) diff --git a/application/default/views/scripts/author/inauthor-offline.phtml b/application/default/views/scripts/author/inauthor-offline.phtml index a39088cf..c68930eb 100644 --- a/application/default/views/scripts/author/inauthor-offline.phtml +++ b/application/default/views/scripts/author/inauthor-offline.phtml @@ -55,17 +55,17 @@ $this->breadcrumb()->setSeparator(' > ');