添加后台邮件模板删除功能。

This commit is contained in:
Li Heng 2014-03-21 06:24:33 +00:00
parent a14d2319d9
commit fa9e604755
1 changed files with 81 additions and 70 deletions

View File

@ -1,4 +1,6 @@
<?php <?php
use Helpers\View as view;
class Admin_SysController extends Zend_Controller_Action class Admin_SysController extends Zend_Controller_Action
{ {
function preDispatch() function preDispatch()
@ -86,6 +88,15 @@ class Admin_SysController extends Zend_Controller_Action
}//模板编辑 }//模板编辑
else if($ac=='del'&& !empty($id))
{
$sql="delete from emailtext where id='$id' ";
$rs = $this->db->query($sql);
view::Post($this,'模板已删除',-1);
return;
}
else if($ac=='test'&& !empty($id)) else if($ac=='test'&& !empty($id))
{ {
if(!empty($submit)) if(!empty($submit))
@ -424,10 +435,10 @@ class Admin_SysController extends Zend_Controller_Action
if ($ac=='' || $ac=='online') if ($ac=='' || $ac=='online')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn' where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn'
ORDER BY m.id DESC"; ORDER BY m.id DESC";
@ -440,15 +451,15 @@ class Admin_SysController extends Zend_Controller_Action
$paginator->setItemCountPerPage($pages); $paginator->setItemCountPerPage($pages);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$ac='online'; $ac='online';
} else if ($ac=='heihe') } else if ($ac=='heihe')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
left join datasource on datasource.uuid=m.uuid left join datasource on datasource.uuid=m.uuid
left join source on datasource.sourceid=source.id left join source on datasource.sourceid=source.id
@ -466,15 +477,15 @@ class Admin_SysController extends Zend_Controller_Action
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} else if ($ac=='water') } else if ($ac=='water')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
left join datasource on datasource.uuid=m.uuid left join datasource on datasource.uuid=m.uuid
left join source on datasource.sourceid=source.id left join source on datasource.sourceid=source.id
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water' where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water'
ORDER BY m.title DESC"; ORDER BY m.title DESC";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -489,7 +500,7 @@ class Admin_SysController extends Zend_Controller_Action
} else if ($ac=='heihe1') } else if ($ac=='heihe1')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
@ -511,11 +522,11 @@ class Admin_SysController extends Zend_Controller_Action
} else if ($ac=='hiwater') } else if ($ac=='hiwater')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
left join datasource on datasource.uuid=m.uuid left join datasource on datasource.uuid=m.uuid
left join source on datasource.sourceid=source.id left join source on datasource.sourceid=source.id
where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater' where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater'
@ -533,10 +544,10 @@ class Admin_SysController extends Zend_Controller_Action
}else if ($ac=='westee') }else if ($ac=='westee')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd) where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd)
ORDER BY m.title DESC"; ORDER BY m.title DESC";
@ -553,10 +564,10 @@ class Admin_SysController extends Zend_Controller_Action
}else if ($ac=='other') }else if ($ac=='other')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(t.filesize/1024/1024*100)/100 as filesize, floor(t.filesize/1024/1024*100)/100 as filesize,
t.filecount from metadata m t.filecount from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd) where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd)
ORDER BY m.title DESC"; ORDER BY m.title DESC";
@ -573,7 +584,7 @@ class Admin_SysController extends Zend_Controller_Action
} }
$this->view->activeID="btn-".$ac; $this->view->activeID="btn-".$ac;
} }
function problemAction() function problemAction()
{ {
$pages=20; $pages=20;
@ -581,7 +592,7 @@ class Admin_SysController extends Zend_Controller_Action
if ($ac=='' || $ac=='ref') if ($ac=='' || $ac=='ref')
{ {
$sql = "SELECT m.title,m.uuid,m.citation,g.id as gid from metadata m $sql = "SELECT m.title,m.uuid,m.citation,g.id as gid from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
left join geonetworkmetadata g on g.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid
where s.status>4 and m.citation like '%??%' where s.status>4 and m.citation like '%??%'
ORDER BY m.id DESC"; ORDER BY m.id DESC";
@ -594,16 +605,16 @@ class Admin_SysController extends Zend_Controller_Action
$paginator->setItemCountPerPage($pages); $paginator->setItemCountPerPage($pages);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->_helper->viewRenderer('problem-ref'); $this->_helper->viewRenderer('problem-ref');
$ac='ref'; $ac='ref';
} else if ($ac=='file') } else if ($ac=='file')
{ {
$sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m $sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
where s.status>4 and ds.id not in (select distinct dsid from datafile) where s.status>4 and ds.id not in (select distinct dsid from datafile)
group by m.title,m.uuid,ds.host,ds.path,m.filesize group by m.title,m.uuid,ds.host,ds.path,m.filesize
ORDER BY m.title DESC;"; ORDER BY m.title DESC;";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -617,18 +628,18 @@ class Admin_SysController extends Zend_Controller_Action
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} else if ($ac=='tiny') } else if ($ac=='tiny')
{ {
$sql = "SELECT m.title,m.uuid,ds.host,ds.path, $sql = "SELECT m.title,m.uuid,ds.host,ds.path,
floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize, floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize,
count(datafile.id) as filecount count(datafile.id) as filecount
from metadata m from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
LEFT JOIN dataset ds ON m.uuid=ds.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid
left join datasource on datasource.uuid=m.uuid left join datasource on datasource.uuid=m.uuid
left join datafile on ds.id=datafile.dsid left join datafile on ds.id=datafile.dsid
left join source on datasource.sourceid=source.id left join source on datasource.sourceid=source.id
where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t
where t.filesize<1024*5) where t.filesize<1024*5)
group by m.title,m.uuid,ds.host,ds.path group by m.title,m.uuid,ds.host,ds.path
ORDER BY m.title DESC;"; ORDER BY m.title DESC;";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -642,14 +653,14 @@ where t.filesize<1024*5)
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
} else if ($ac=='heihefund') } else if ($ac=='heihefund')
{ {
$sql = "SELECT m.title,m.uuid,g.id as gid $sql = "SELECT m.title,m.uuid,g.id as gid
from metadata m from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
left join datasource on datasource.uuid=m.uuid left join datasource on datasource.uuid=m.uuid
left join source on datasource.sourceid=source.id left join source on datasource.sourceid=source.id
left join mdfund mf on mf.uuid=m.uuid left join mdfund mf on mf.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid left join geonetworkmetadata g on m.uuid=g.uuid
where s.status>4 and source.code='heihe' and mf.fid is null where s.status>4 and source.code='heihe' and mf.fid is null
ORDER BY m.title DESC;"; ORDER BY m.title DESC;";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -660,19 +671,19 @@ left join geonetworkmetadata g on m.uuid=g.uuid
$paginator->setItemCountPerPage($pages); $paginator->setItemCountPerPage($pages);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->_helper->viewRenderer('problem-md'); $this->_helper->viewRenderer('problem-md');
} else if ($ac=='noemail') } else if ($ac=='noemail')
{ {
$sql = "SELECT distinct m.title,m.uuid,g.id as gid $sql = "SELECT distinct m.title,m.uuid,g.id as gid
from metadata m from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
left join role on role.uuid=m.uuid left join role on role.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid left join geonetworkmetadata g on m.uuid=g.uuid
where m.datatype=1 and s.status>4 and m.uuid not in ( where m.datatype=1 and s.status>4 and m.uuid not in (
select role.uuid from role left join responsible res on role.resid=res.id select role.uuid from role left join responsible res on role.resid=res.id
where res.email is not null and role.role in ('resourceProvider','owner','pointOfContact','custodian') where res.email is not null and role.role in ('resourceProvider','owner','pointOfContact','custodian')
) )
ORDER BY m.title DESC;"; ORDER BY m.title DESC;";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -683,16 +694,16 @@ where res.email is not null and role.role in ('resourceProvider','owner','pointO
$paginator->setItemCountPerPage($pages); $paginator->setItemCountPerPage($pages);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->_helper->viewRenderer('problem-md'); $this->_helper->viewRenderer('problem-md');
} else if ($ac=='unmoved') } else if ($ac=='unmoved')
{ {
$sql = "SELECT distinct m.title,m.uuid,g.id as gid $sql = "SELECT distinct m.title,m.uuid,g.id as gid
from metadata m from metadata m
LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN mdstatus s ON m.uuid=s.uuid
left join geonetworkmetadata g on m.uuid=g.uuid left join geonetworkmetadata g on m.uuid=g.uuid
left join dataset ds on ds.uuid=m.uuid left join dataset ds on ds.uuid=m.uuid
where s.status>4 and ds.path like '%upload%' where s.status>4 and ds.path like '%upload%'
ORDER BY m.title DESC;"; ORDER BY m.title DESC;";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
@ -703,7 +714,7 @@ left join dataset ds on ds.uuid=m.uuid
$paginator->setItemCountPerPage($pages); $paginator->setItemCountPerPage($pages);
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
$this->_helper->viewRenderer('problem-md'); $this->_helper->viewRenderer('problem-md');
} }
$this->view->activeID="btn-".$ac; $this->view->activeID="btn-".$ac;