From f27a31c56729cb10f3e76e59b941ea7d5a9f7e33 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 30 May 2012 01:49:17 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E5=B7=B2=E7=BB=8F=E6=94=B6=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E7=A6=BB=E7=BA=BF=E7=94=B3=E8=AF=B7=E4=B9=9F=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=BF=9B=E8=A1=8C=E9=87=8D=E7=BD=AE=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DownController.php | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index 415fdec4..56c24386 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -61,16 +61,16 @@ class Admin_DownController extends Zend_Controller_Action //对每条数据的管理员用户发送相应的邮件通知,同一用户的邮件需要合并 //需要取出对应数据的标题、uuid,以及对应的作者的email(一条数据可能有多个作者,一次申请可能有多条数据对应同一个作者) - //邮件中应提示用户可以选择是否委托给数据中心进行管理(这样以后就不接受相应的管理邮件,但用户仍然可以自主取消此选择) + //邮件中应提示用户可以选择是否委托给数据中心进行管理(这样以后就不接受相应的管理邮件,但用户仍然可以自主取消此选择) $uuid_done=""; - // 0. 处理专题数据集 - $sql="select s.admin_email as email,m.title,d.uuid,s.title as sourcetitle from dataorder d left join datasource ds on d.uuid=ds.uuid - left join source s on ds.sourceid=s.id left join metadata m on d.uuid=m.uuid - where d.offlineappid=? and s.admin_status=1 and d.uuid<>all(s.exclude_data) - order by s.admin_email,m.title"; - $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); + // 0. 处理专题数据集 + $sql="select s.admin_email as email,m.title,d.uuid,s.title as sourcetitle from dataorder d left join datasource ds on d.uuid=ds.uuid + left join source s on ds.sourceid=s.id left join metadata m on d.uuid=m.uuid + where d.offlineappid=? and s.admin_status=1 and d.uuid<>all(s.exclude_data) + order by s.admin_email,m.title"; + $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); $tmp_email=''; - $data=''; + $data=''; $source=''; foreach($rows as $row) { @@ -84,20 +84,20 @@ class Admin_DownController extends Zend_Controller_Action $mailtp=new EmailText($this->db,'offline-start-subject',array('user'=>$username,'datalist'=>$data,'source'=>$source)); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setBodyText($mailtp->getBody()); - $mail->setSubject($mailtp->getSubject()); + $mail->setSubject($mailtp->getSubject()); $mail_addrs=explode(",",substr($tmp_email,1,-1)); $mail->addTo($mail_addrs); $mail->addCc($this->view->config->service->email,'西部数据中心服务组'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf'); $mail->send(); - $data=""; + $data=""; $source=""; } - $tmp_email=$row['email']; + $tmp_email=$row['email']; $source=$row['sourcetitle']; } $data.=" 数据名称:".$row['title']."\n"; - $data.=" \t数据地址:http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n"; + $data.=" \t数据地址:http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n"; $uuid_done.="'".$row['uuid']."',"; } //发送最后一封邮件 @@ -108,19 +108,19 @@ class Admin_DownController extends Zend_Controller_Action $mailtp=new EmailText($this->db,'offline-start-author',array('user'=>$username,'datalist'=>$data,'source'=>$source)); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setBodyText($mailtp->getBody()); - $mail->setSubject($mailtp->getSubject()); + $mail->setSubject($mailtp->getSubject()); $mail_addrs=explode(",",substr($tmp_email,1,-1)); $mail->addTo($mail_addrs); $mail->addCc($this->view->config->service->email,'西部数据中心服务组'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf'); $mail->send(); - } + } // 1. 处理有数据作者且自行管理的数据并且未被0处理过的 $sql="select u.email,m.title,d.uuid,a.activation from dataorder d left join mdstatus s on d.uuid=s.uuid left join users u on s.userid=u.id - left join metadata m on m.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid - where d.offlineappid=? and s.status=6 and a.userid=s.userid "; - if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + left join metadata m on m.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid + where d.offlineappid=? and s.status=6 and a.userid=s.userid "; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; $sql.=" order by u.email,m.title"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); $tmp_email=''; @@ -150,7 +150,7 @@ class Admin_DownController extends Zend_Controller_Action $data.=" \t数据地址:http://westdc.westgis.ac.cn/data/".$row['uuid']."\n"; $data.=" \t如您不想收到此类数据申请审核的邮件,您可以将该数据委托给数据中心代为审核,委托后您也可以随时撤销此委托以便继续自行管理。\n"; $data.=" \t如想委托给数据中心,请访问此网址:http://westdc.westgis.ac.cn/author/delegate/uuid/".$row['uuid']."\n"; - $data.=" \t撤销委托方法:进入数据中心->数据作者->我的数据,在该数据条上撤销委托。\n\n"; + $data.=" \t撤销委托方法:进入数据中心->数据作者->我的数据,在该数据条上撤销委托。\n\n"; $uuid_done.="'".$row['uuid']."',"; } //发送最后一封邮件 @@ -169,17 +169,17 @@ class Admin_DownController extends Zend_Controller_Action } // 2. 处理委托数据中心进行管理的数据 - $sql="select m.title,d.uuid from dataorder d left join mdstatus s on d.uuid=s.uuid left join metadata m on m.uuid=d.uuid + $sql="select m.title,d.uuid from dataorder d left join mdstatus s on d.uuid=s.uuid left join metadata m on m.uuid=d.uuid left join datasource ds on ds.uuid=d.uuid left join source on ds.sourceid=source.id - where d.offlineappid=? and (s.status=7 or source.admin_status=2) "; - if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + where d.offlineappid=? and (s.status=7 or source.admin_status=2) "; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; $sql.=" order by m.title"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); $data=""; foreach($rows as $row) { $data.=" 数据名称:".$row['title']."\n"; - $data.=" \t数据地址:http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n"; + $data.=" \t数据地址:http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n"; $uuid_done.="'".$row['uuid']."',"; } if (!empty($data)) @@ -205,8 +205,8 @@ class Admin_DownController extends Zend_Controller_Action //发送管理邮件同时建议用户认证为数据的作者,可以有更多的管理选择,同时邮件中应该有详细的说明为什么会收到此邮件 $sql="select distinct res.email,d.uuid,m.title,role.role from dataorder d left join role on d.uuid=role.uuid left join responsible res on role.resid=res.id left join metadata m on d.uuid=m.uuid where length(res.email)>4 and d.offlineappid=? - and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author')"; - if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; + and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author')"; + if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") "; $sql.=" order by m.title,res.email"; $rows=$this->db->fetchAll($this->db->quoteInto($sql,$start)); unset($addrs); @@ -445,7 +445,7 @@ class Admin_DownController extends Zend_Controller_Action } else if($reset > 0) { - $sql="update dataorder set status='1' where status='3' and offlineappid='$reset'"; + $sql="update dataorder set status='1' where (status='3' or status='4') and offlineappid='$reset'"; if($this->db->exec($sql)>0) { $this->messenger->addMessage('已经成功对该申请重置');