From 7665772a9a2d4f94f9bf5c05a7c4f4a193b1b961 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 12 Mar 2012 03:14:50 +0000 Subject: [PATCH] =?UTF-8?q?Ticket=20#=20303=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E5=AF=B9=E7=A6=BB=E7=BA=BF=E7=94=B3=E8=AF=B7=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=9A=84=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AuthorController.php | 40 +++++++++++-------- .../scripts/author/inauthor-offline.phtml | 12 +++--- 2 files changed, 29 insertions(+), 23 deletions(-) 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(' > ');