merge trunk to r2219.

This commit is contained in:
wlx 2012-04-12 08:21:00 +00:00
parent 2ab39c0908
commit 7d07e31ec7
50 changed files with 2690 additions and 932 deletions

View File

@ -30,7 +30,7 @@ class Admin_DataController extends Zend_Controller_Action
$thumb=$this->_request->getParam('thumb');
$list=$this->_request->getParam('list');
$adminuser=$this->_request->getParam('adminuser');
$uuid=$this->_request->getParam('uuid');
$uuid=trim($this->_request->getParam('uuid'));
if ($this->_request->isPost()) $uuid=$this->_request->getPost('uuid');
//$uuid=$this->_request->getParam('uuid');
if ($source=="geonetwork" && empty($uuid) ) {
@ -332,42 +332,77 @@ class Admin_DataController extends Zend_Controller_Action
}//编辑附件
/*
* 输出打包下载的xml文件
*
* 文件量大时可能出现超时,需要修改超时时间为无限
*/
elseif ($down) {
$zip = new ZipArchive();
$url="/tmp/xml.zip";
$opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
if( $opened !== true ){
die("cannot open {$url} for writing.");
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
//临时zip文件名
$tmpname="dataxml";
//xml文件存放的缓存目录
$dirName = '../data/import/';
$zip->addEmptyDir("xml/");
$filesToAdd = array();
$dir = dir($dirName);
while (false !== ($node = $dir->read())) {
if (($node == '..') || ($node == '.')) {
continue;
}
if (is_file($dirName.$node)) {
$zip->addFile($dirName.$node,"xml/".$node);
}
}
$zip->close();
$content=file_get_contents($url);
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
//查询需要创建的文件
$sql = "SELECT md.title,md.uuid,x.* from xml x
LEFT JOIN normalmetadata md ON md.id=x.id";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll(); //将结果储存,但不使用
//创建zip文件创建成功后再使用查询结果
$zip = new ZipArchive();
$url = tempnam($this->config->temp->path,$tmpname);//创建临时文件
if( $zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true )
{
throw new Exception("cannot open {$url} for writing.");
}
foreach($rows as $k=>$v)
{
$filename = $dirName.$v['uuid'].'.xml';
//创建xml文件
$handle = fopen($filename,"w");
fwrite($handle,$v['data']);
fclose($handle);
//添加到zip文件
//zip localname 直接使用UUID作为文件名
$zip->addFile($filename,$v['uuid'].".xml");
}
$zip->close();
//zip文件创建完成后删除服务器上的缓存文件防止发生冗余
foreach($rows as $k=>$v)
{
$filename = $dirName.$v['uuid'].'.xml';
unlink($filename);
}
//输出下载
$content=file_get_contents($url);
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="'.basename($url).'"')
->setHeader('Content-Length', strlen($content))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Type','application/zip')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
->setHeader('Content-Disposition','attachment; filename="dataxml.zip"')
->setHeader('Content-Length', strlen($content))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Type','application/zip')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
}//down
else if($search){
@ -685,7 +720,12 @@ class Admin_DataController extends Zend_Controller_Action
foreach($lines as $line)
{
$data=explode(";",$line);
$sql="insert into reference (reference) values(?)";
if (count($data)==2)
$link='';
else
$link=$data[2];
$link=$this->db->quote($link);
$sql="insert into reference (reference,link) values(?,".$link.")";
try {
$this->db->exec($this->db->quoteInto($sql,$data[1]));
} catch (Exception $e) {}
@ -1117,7 +1157,7 @@ class Admin_DataController extends Zend_Controller_Action
}// 清除元数据来源记录
elseif ($do=='sync') { //同步数据来源到metadata表
elseif ($do=='sync') { //同步数据来源到metadata表
$redirect = "/admin/data/source/";
$sql = "update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid";
if($this->db->exec($sql))
@ -1496,195 +1536,7 @@ class Admin_DataController extends Zend_Controller_Action
private function import($xml)
{
$iso=new ISO19115();
$iso->loadXML($xml);
$md=new MetadataTable();
$thumb=new ThumbnailTable();
$xmlt=new XmlTable();
$cgt=new CategoryTable();
$cgct=new CategoryCodeTable();
$keyt=new KeywordTable();
$dst=new DatasetSeriesTable();
$seriestable=new SeriesTable();
$db=$seriestable->getAdapter();
//save metadata
//先删除已有元数据,然后再插入新数据
$sql="delete from metadata where uuid=?";
$this->db->query($sql,array($iso->uuid));
//删除所有未用到的responsible数据
$sql="delete from responsible where id not in (select distinct(resid) from role)";
$this->db->query($sql);
$row=$md->createRow();
$trow=$thumb->createRow();
$row->uuid=$iso->uuid;
$row->title=$iso->resTitle;
$row->title_en=$iso->resAltTitle;
$row->description=$iso->idAbs;
$row->citation=$iso->citation;
$row->suppinfo=$iso->suppinfo;
$row->fileformat=$iso->fileformat;
$row->projection=$iso->projection;
//$row->author=$iso->author;
$row->datatype=$iso->datatype;
$row->filesize=$iso->filesize;
$row->ts_created=$iso->mdDateSt;
$row->timebegin=$iso->timebegin;
$row->timeend=$iso->timeend;
$row->west=$iso->geoBox['w'];
$row->south=$iso->geoBox['s'];
$row->north=$iso->geoBox['n'];
$row->east=$iso->geoBox['e'];
if (!empty($iso->doi)) $row->doi=$iso->doi;
//生成空白统计数据
$sql=$db->quoteInto("select * from mdstat where uuid=?",$iso->uuid);
if (!$db->fetchRow($sql))
{
$sql="insert into mdstat (uuid) values(?)";
$db->query($sql,array($iso->uuid));
}
try {
$id=$row->save();
//处理在线资源
if ($iso->onlineresource) foreach($iso->onlineresource as $resource)
{
$sql="insert into onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)";
$db->query($sql,array($iso->uuid,$resource['linkage'],$resource['protocol'],$resource['name'],$resource['description']));
}
//处理缩略图
if (!empty($iso->thumbnail)) {
$trow->id=$id;
$trow->data=$iso->thumbnail;
$trow->filetype='jpg';
$trow->save();
} elseif ($iso->graph) {
$trow->id=$id;
//$trow->data=$iso->graph['data'];
$sql="select id as gid from geonetworkmetadata where uuid=?";
$r=$this->db->fetchRow($sql,array($iso->uuid));
if ($r)
{
$trow->data=base64_encode(file_get_contents($this->view->config->geonetwork->url.'srv/cn/resources.get?access=public&id='.$r->gid.'&fname='.urlencode($iso->graph['filename'])));
}
$trow->filetype=$iso->graph['filetype'];
$trow->filedesc=$iso->graph['filedesc'];
$trow->filename=$iso->graph['filename'];
$trow->save();
}
//todo:处理关键词
//1:N relation
foreach($iso->keyword as $keytype=>$keys)
{
foreach($keys as $key)
{
$row=$keyt->createRow();
$row->id=$id;
//统一转换为大写
//不再统一转换
$row->keyword=$key;
$row->keytype=$keytype;
$row->save();
}
}
//todo:处理数据集序列
//M:N relation
if ($iso->datasetSeries) foreach($iso->datasetSeries as $ds)
{
$where=$db->quoteInto('name = ?',$ds['seriesName']);
$trow=$seriestable->fetchRow($where);
if ($trow)
$sid=$trow->id;
else {
$trow=$seriestable->createRow();
$trow->name=$ds['seriesName'];
$sid=$trow->save();
}
$row=$dst->createRow();
$row->id=$id;
$row->sid=$sid;
$row->save();
}
//处理XML入库
$row=$xmlt->createRow();
$row->id=$id;
$row->data=$xml;
$row->save();
//处理数据分类
foreach($iso->tpCat as $cat){
if (is_numeric($cat)) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=(int)$cat;
$row->save();
} else {
//是字符串geonetwork会采用这种模式
//从categorycode表中查找其对应的code
$where=$db->quoteInto('name= ?',trim($cat));
$trow=$cgct->fetchRow($where);
if ($trow) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=$trow->code;
$row->save();
}
//$db=$cgt->getAdapter();
//$sql="insert into category (id,code) values($id,(select code from categorycode where name='$cat'))";
//$db->query($sql);
}
}
//处理联系人信息
//先查询再进行处理
//若用户信息发生变化,则存在问题
//无法保证数据的更新状态
foreach($iso->author as $au)
{
$inds=explode(",",$au['individual']);
foreach($inds as $ind)
{
$sql="select id from responsible where individual=? and organisation=?";
$row=$this->db->fetchRow($sql,array(trim($ind),trim($au['organisation'])));
if (!$row)
{
$sql="insert into responsible (individual,organisation,position,delivery,phone,email,city,country,administrative,postal) values(?,?,?,?,?,?,?,?,?,?)";
$this->db->query($sql,array(trim($ind),trim($au['organisation']),trim($au['position']),trim($au['delivery']),trim($au['phone']),trim($au['email']),trim($au['city']),trim($au['country']),trim($au['administrative']),trim($au['postal'])));
} elseif (count($inds)==1) {
//deal email address
if (($au['email']) && empty($row->email))
{
$sql="update responsible set email=? where id=?";
$this->db->query($sql,array(trim($au['email']),$row->id));
}
}
$sql="select id from responsible where individual=? and organisation=?";
$row=$this->db->fetchRow($sql,array(trim($ind),trim($au['organisation'])));
if ($row->id>0)
{
$sql="insert into role (resid,uuid,role) values(?,?,?)";
$this->db->query($sql,array($row->id,$iso->uuid,trim($au['role'])));
}
}
}
//处理数据限制信息
foreach($iso->limits as $uselimit)
{
$sql="select id from uselimit where uselimit=?";
$row=$this->db->fetchRow($sql,array($uselimit));
if (!$row)
{
$sql="insert into uselimit (uselimit) values (?)";
$this->db->query($sql,array($uselimit));
}
$sql="select id from uselimit where uselimit=?";
$row=$this->db->fetchRow($sql,array($uselimit));
if ($row)
{
$sql="insert into mdlimit (uuid,lid) values(?,?)";
$this->db->query($sql,array($iso->uuid,$row->id));
}
}
$iso->save("../data/import/$iso->uuid.xml");
} catch (Exception $e) {
//数据重复插入,此处忽略所有错误
print $iso->uuid.' has error: '.$e->getMessage().'<br />';
}
$iso->saveDB($this->db,$xml);
}
}

View File

@ -7,7 +7,6 @@ class Admin_NewsController extends Zend_Controller_Action
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry');//新UI
}
function postDispatch()
{
@ -15,13 +14,43 @@ class Admin_NewsController extends Zend_Controller_Action
}
function indexAction()
{
$sql = "select n.*,c.title as catlog,u.realname as author from news_archives n
left join news_category c on n.typeid=c.id
LEFT JOIN users u ON n.userid=u.id
order by n.ts_created desc limit 10";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$this->view->news = $rows;
$sql = "SELECT count(id) as c FROM news_archives";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->totle = $row;
$sql = "SELECT count(id) as c FROM news_category";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->typec = $row;
}//indexAction 首页
function newslistAction(){
$sql = "select n.*,c.title as catlog from news_archives n left join news_catlog c on n.typeid=c.id";
$type = $this->_request->getParam('type');
if(!empty($type))
{
$sql = "select n.*,c.title as catlog,c.url,u.realname as author from news_archives n
left join news_category c on n.typeid=c.id
LEFT JOIN users u ON n.userid=u.id
WHERE n.typeid='$type' order by n.ts_created desc";
}else
{
$sql = "select n.*,c.title as catlog,c.url,u.realname as author from news_archives n
left join news_category c on n.typeid=c.id
LEFT JOIN users u ON n.userid=u.id
order by n.ts_created desc";
}
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
@ -32,6 +61,12 @@ class Admin_NewsController extends Zend_Controller_Action
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$sql="select * from news_category order by displayorder desc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$this->view->type = $type;
}//newslistAction 新闻列表
function catlogAction()
@ -46,13 +81,14 @@ class Admin_NewsController extends Zend_Controller_Action
if($add)
{
if(empty($submit))
$this->_helper->viewRenderer('catlogadd');
$this->_helper->viewRenderer('category-add');
else{
$title = $this->_request->getParam('ctitle');
$url = $this->_request->getParam('url');
$keyword = $this->_request->getParam('keyword');
$description = $this->_request->getParam('description');
$sql="insert into news_catlog (title,keyword,description) values ('$title','$keyword','$description')";
$sql="insert into news_category (title,keywords,description,url) values ('$title','$keyword','$description','$url')";
if($this->db->exec($sql) > 0)
{
$this->messenger->addMessage('提示信息:栏目添加成功!');
@ -64,7 +100,7 @@ class Admin_NewsController extends Zend_Controller_Action
}//栏目添加
if($delete>0)
{
$sql = "delete from news_catlog where id='$delete'";
$sql = "delete from news_category where id='$delete'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('提示信息:栏目删除成功!');
@ -75,11 +111,12 @@ class Admin_NewsController extends Zend_Controller_Action
if($edit>0)
{
$title = $this->_request->getParam('ctitle');
$url = $this->_request->getParam('url');
$keyword = $this->_request->getParam('keyword');
$description = $this->_request->getParam('description');
$displayorder = $this->_request->getParam('displayorder');
$sql="update news_catlog set title='$title',keyword='$keyword',description='$description',displayorder='$displayorder' where id='$edit'";
$sql="update news_category set title='$title',keywords='$keyword',description='$description',displayorder='$displayorder',url='$url' where id='$edit'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('提示信息:栏目编辑成功!');
@ -89,7 +126,7 @@ class Admin_NewsController extends Zend_Controller_Action
else
{
$sql="select * from news_catlog order by displayorder desc";
$sql="select * from news_category order by displayorder asc";
$re=$this->db->query($sql);
$catlogs=$re->fetchAll();
@ -106,13 +143,15 @@ class Admin_NewsController extends Zend_Controller_Action
$id = $this->_request->getParam('id');
if($id>0)
{
$sql = "select id,title,pubtime,typeid from news_archives where id=$id";
$sql = "SELECT arc.id,arc.title,arc.ts_published,arc.typeid,cat.url,cat.id as typeid from news_archives arc
LEFT JOIN news_category cat ON arc.typeid=cat.id
WHERE arc.id=$id";
$rs = $this->db->query($sql);
$rows = $rs->fetch();
if($rows['pubtime']>time())
if($rows['ts_published']>time())
{
$title = "{$rows['title']}》将在".date('Y-m-d H:i',$rows['pubtime'])."发布";
$title = "{$rows['title']}》将在".date('Y-m-d H:i',$rows['ts_published'])."发布";
}
else
{
@ -124,7 +163,7 @@ class Admin_NewsController extends Zend_Controller_Action
$this->_helper->viewRenderer('newsaddok');
}
$sql="select * from news_catlog order by displayorder desc";
$sql="select * from news_category order by displayorder desc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
@ -132,13 +171,26 @@ class Admin_NewsController extends Zend_Controller_Action
}//newsadd 新闻添加
function replacehtml($html)
{
$newString = htmlentities($html, ENT_QUOTES, "UTF-8");
return $newString;
}
function archivesaddAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}
$datavar = array(
'title','writer','source','image','body','typeid','pub','pubtimer','pubtime','description','keyword'
'title','source','image','body','typeid','pub','pubtimer','pubtime','description','keyword'
);
foreach($_POST as $k=>$v)
{
@ -150,10 +202,9 @@ class Admin_NewsController extends Zend_Controller_Action
$msg=array();
if(empty($title)) $msg[]="标题不能为空";
if(strlen($title)>40) $msg[]="标题长度不能超过40个字符";
if(strlen($writer)>50) $msg[]="作者长度不能超过50个字符";
if(strlen($title)>200) $msg[]="标题长度不能超过200个字符";
if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符";
if(strlen($description)>200) $msg[] = "内容描述不能超过200个字符现在输入了".strlen($description)."个字符";
if(strlen($description)>500) $msg[] = "内容描述不能超过200个字符现在输入了".strlen($description)."个字符";
if(empty($body)) $msg[]="请填写内容";
if($typeid==0) $msg[]="请选择栏目";
@ -174,40 +225,41 @@ class Admin_NewsController extends Zend_Controller_Action
{
if(!empty($pubtimer))
{
$pubtime = strtotime($pubtime);
$pubtime = date("Y-m-d H:i:s",strtotime($pubtime));
}
else
{
$pubtime = time();
$pubtime = date("Y-m-d H:i:s",time());
}
$date=array(
'title' => $title,
'writer' => $writer,
'keyword' => $keyword,
'description'=> $description,
'image' => $image,
'writetime' => time(),
'title' => $this->db->quote($this->replacehtml($title)),
'writer' => $uid,
'keyword' => $this->db->quote($this->replacehtml($keyword)),
'description'=> $this->db->quote($this->replacehtml($description)),
'image' => $image,
'pubtime' => $pubtime,
'source' => $source,
'typeid' => $typeid,
'pub' => $pub,
'body' => $body
'body' => $this->db->quote($body)
);
$sql = "INSERT INTO news_archives (title,writer,keyword,description,image,writetime,pubtime,source,typeid,pub)
VALUES ('{$date['title']}',
'{$date['writer']}',
'{$date['keyword']}',
'{$date['description']}',
$sql = "INSERT INTO news_archives (title,userid,keywords,description,image,ts_published,source,typeid,is_pub,body)
VALUES (
".$date['title'].",
".$date['writer'].",
".$date['keyword'].",
".$date['description'].",
'{$date['image']}',
'{$date['writetime']}',
'{$date['pubtime']}',
'{$date['source']}',
'{$date['typeid']}',
'{$date['pub']}')
'{$date['pub']}',
".$date['body']."
)
RETURNING id
";
@ -216,19 +268,11 @@ class Admin_NewsController extends Zend_Controller_Action
if($sth->execute())
{
$temp = $sth->fetch(PDO::FETCH_ASSOC);
$sql = "INSERT INTO news_archivesaddon (id,body) values ('{$temp['id']}','{$date['body']}')";
if($this->db->exec($sql)>0)
{
echo '<div class="box box-success">发布成功!</div><script>
setTimeout("self.location=\'/admin/news/newsadd/id/'.$temp['id'].'\'",500);
</script>';
}
else
{
$sql = "delete from news_archives where id={$temp['id']}";
$this->db->exec($sql);
echo '<div class="box box-success">发布失败!写入附加表出错,请联系管理员</div>';
}
echo '<div class="box box-success">发布成功!</div><script>
setTimeout("self.location=\'/admin/news/newsadd/id/'.$temp['id'].'\'",500);
</script>';
}else{
echo '<div class="box box-success">发布失败!请重试</div>';
}
}catch(Exception $e){
@ -238,31 +282,155 @@ class Admin_NewsController extends Zend_Controller_Action
<li>'.$e->getMessage().'</li>
</ol>
</div>';
}
}
}
/*
}// 文章发布
function newseditAction()
{
<div class="box box-info">Info box sample</div>
<div class="box box-warning">Warning box sample</div>
<div class="box box-error">Error box sample</div>
$id = $this->_request->getParam('id');
$sql = "select * from news_archives arc where arc.id=$id
";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->ev = $row;
$sql="select * from news_category order by displayorder desc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
}
function archiveseditAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_request->getParam('id');
if(empty($id))
{
echo '<div class="box box-error">发布失败:</div>
<div class="box box-error-msg">
<ol>';
echo '<li>参数错误</li>'.
'</ol>
</div>
';
}
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}
$datavar = array(
'title','source','image','body','typeid','pub','pubtimer','pubtime','description','keyword'
);
foreach($_POST as $k=>$v)
{
if(in_array($k,$datavar))
{
$$k=$v;
}
}
$msg=array();
if(empty($title)) $msg[]="标题不能为空";
if(strlen($title)>200) $msg[]="标题长度不能超过200个字符";
if(strlen($keyword)>200) $msg[] = "关键词长度不能超过200个字符现在输入了".strlen($keyword)."个字符";
if(strlen($description)>500) $msg[] = "内容描述不能超过500个字符现在输入了".strlen($description)."个字符";
if(empty($body)) $msg[]="请填写内容";
if($typeid==0) $msg[]="请选择栏目";
if(count($msg)>0)
{
echo '<div class="box box-error">发布失败:</div>
<div class="box box-error-msg">
<ol>';
foreach ($msg as $v)
{
echo '<li>'.$v.'</li>';
}
echo'</ol>
</div>
';
}
else
{
$pubtime = date("Y-m-d H:i:s",strtotime($pubtime));
$date=array(
'title' => $this->replacehtml($title),
'writer' => $uid,
'keyword' => $this->replacehtml($keyword),
'description'=> $this->replacehtml($description),
'image' => $image,
'pubtime' => $pubtime,
'source' => $this->replacehtml($source),
'typeid' => $typeid,
'pub' => $pub,
'body' => $this->db->quote($body)
);
$sql = "UPDATE news_archives SET
title='{$date['title']}',
userid='{$date['writer']}',
keywords='{$date['keyword']}',
description='{$date['description']}',
image='{$date['image']}',
ts_published='{$date['pubtime']}',
source='{$date['source']}',
typeid='{$date['typeid']}',
is_pub='{$date['pub']}',
body=".$date['body']."
WHERE id='$id'
";
try{
$sth = $this->db->prepare($sql);
if($sth->execute())
{
echo '<div class="box box-success">发布成功!</div><script>
setTimeout("self.location=\'/admin/news/newsadd/id/'.$id.'\'",500);
</script>';
}else{
echo '<div class="box box-success">发布失败!写入附加表出错,请联系管理员</div>';
}
}catch(Exception $e){
echo '<div class="box box-error">文章发布失败:</div>
<div class="box box-error-msg">
<ol>
<li>Credit card number entered is invalid</li>
<li>Credit card verification number must be a valid number</li>
<li>'.$e->getMessage().'</li>
</ol>
</div>
<div class="box box-success">Success box sample</div>
*/
</div>';
}
}
}// 文章编辑
function deleteAction(){
}
$id = $this->_request->getParam('id');
$sql = "DELETE FROM news_archives WHERE id='$id'";
$this->db->exec($sql);
$this->messenger->addMessage('提示信息:文章删除成功!');
$this->_redirect('/admin/news/newslist');
}//文章删除
}

View File

@ -7,7 +7,7 @@ class Admin_WatermdController extends Zend_Controller_Action
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->wdb=Zend_Db::factory($this->view->config->waterdb);
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
set_time_limit(0);
}
function postDispatch()

View File

@ -0,0 +1,60 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目添加');
?>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<form id="sampleform" method="post" action="#">
<fieldset>
<legend>栏目添加</legend>
<p>
<label class="required" for="ctitle">栏目标题:</label><br/>
<input type="text" id="ctitle" class="half" value="" name="ctitle"/>
</p>
<p>
<label class="required" for="ctitle">栏目URL:</label><br/>
<input type="text" id="url" class="half" value="" name="url"/>(仅小写英文字母与数字)
<small>如填写: technology 则前台访问地址为: http://westdc.westgis.ac.cn/news/technology </small>
</p>
<p>
<label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="" name="keyword"/>
<small>e.g. 高程,气象,地理</small>
</p>
<p>
<label class="required" for="discript">描述:</label><br/>
<textarea id="discript" class="medium half" name="description"></textarea>
<small>80个汉字以内不能使用折行</small>
</p>
<input type="hidden" name="submit" value="1" />
<p class="box"><input type="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</div>

View File

@ -2,83 +2,77 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目管理');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3>栏目管理</h3>
<hr/>
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">栏目名称</th>
<th width="50%">栏目管理</th>
</tr>
</thead>
<tbody>
<?php
if(is_array($this->catlogs))
{
foreach($this->catlogs as $k=>$v)
{
echo '
<tr>
<td class="title">
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>编辑栏目</b>
<form id="editform'.$v['id'].'" method="post" action="#">
<fieldset>
<style>
.listingDetails{position:absolute;width:650px;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/admin/news/catlog/add/1">添加新栏目</a></li>
</ul>
</div>
<table id="report" class="stylized full" style="width:650px;">
<thead>
<tr>
<th width="60%">栏目名称</th>
<th width="40%" style="vertical-align:top;">栏目管理</th>
</tr>
</thead>
<tbody>
<?php
if(is_array($this->catlogs))
{
foreach($this->catlogs as $k=>$v)
{
echo '
<tr>
<td>
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>编辑栏目</b> <a href="javascript:;" class="closepad" style="float:right">关闭</a>
<form id="editform'.$v['id'].'" method="post" action="#">
<fieldset>
<legend>栏目信息</legend>
<p>
<label class="required" for="ctitle">栏目标题:</label><br/>
<input type="text" id="ctitle" class="half" value="'.$v['title'].'" name="ctitle"/>
</p>
<p>
<label class="required" for="ctitle">栏目URL:</label><br/>
<input type="text" id="url" class="half" value="'.$v['url'].'" name="url"/>(仅小写英文字母与数字)
<small>如填写: technology 则前台访问地址为: http://westdc.westgis.ac.cn/news/technology </small>
</p>
<p>
<label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="'.$v['keyword'].'" name="keyword"/>
<input type="text" id="keyword" class="half" value="'.$v['keywords'].'" name="keyword"/>
<small>e.g. 高程,气象,地理</small>
</p>
@ -105,6 +99,8 @@
</div></div>
</td>
<td>
<a href="/news/'.$v['url'].'" target="_blank">浏览</a>
<a href="/admin/news/newslist/type/'.$v['id'].'">文档</a>
<a href="javascript:showpad('.$v['id'].');"><b>编辑</b></a>
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
</tr>
@ -119,29 +115,15 @@
}
?>
</tbody>
</table>
<hr/>
<a href="/admin/news/catlog/add/1" class="btn"><span class="icon icon-add">&nbsp;</span>添加新栏目</a>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
</tbody>
</table>
</div>
<script type="text/javascript">
$('#nav_news').addClass("current");
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
/* expandable rows */
Administry.expandableRows();
$('.title').bind('click', function() {
$.colorbox({'innerWidth':'50%','html':$(this).next('.listingDetails').children('.pad').html()});
});
});
function showpad(id){
$('#titlebtn'+id).click();

View File

@ -1,78 +0,0 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/jquery.wysiwyg.min.js');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3>添加栏目</h3>
<form id="sampleform" method="post" action="#">
<fieldset>
<legend>栏目信息</legend>
<p>
<label class="required" for="ctitle">栏目标题:</label><br/>
<input type="text" id="ctitle" class="half" value="" name="ctitle"/>
</p>
<p>
<label class="required" for="keyword">关键字:</label><br/>
<input type="text" id="keyword" class="half" value="" name="keyword"/>
<small>e.g. 高程,气象,地理</small>
</p>
<p>
<label class="required" for="discript">描述:</label><br/>
<textarea id="discript" class="medium half" name="discript"></textarea>
<small>80个汉字以内不能使用折行</small>
</p>
<input type="hidden" name="submit" value="1" />
<p class="box"><input type="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
<hr/>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$('#nav_news').addClass("current");
</script>

View File

@ -2,82 +2,101 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<style>
.listingDetails{position:absolute;width:650px; z-index:999;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<h3>最新发布的新闻</h3>
<hr/>
<div class="clear">&nbsp;</div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<img src="http://designerz-crew.info/start/callb.png">
<h3>最新发布的新闻</h3>
<hr/>
<table id="report" class="stylized full">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="25%">所属栏目</th>
<th width="25%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->news))
{
foreach ($this->news as $v)
{
echo '
<tr>
<td>
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b> <a href="javascript:;" class="closepad" style="float:right">关闭</a>
<p>作者:'.$v['author'].'</p>
<p>关键词:'.$v['keywords'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'</p>
<p>发布时间:'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td>'.$v['catlog'].'</td>
<td>
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td>
</tr>
';
}
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
</tbody>
</table>
<script type="text/javascript">
<h3>统计</h3>
<hr/>
<ul>
<li><?php echo $this->totle['c'];?> 条档案</li>
<li>栏目 <?php echo $this->typec['c'];?></li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
/* progress bar animations - setting initial values */
Administry.progress("#progress1", 1, 5);
Administry.progress("#progress2", 2, 5);
Administry.progress("#progress3", 2, 5);
/* flot graphs */
var sales = [{
label: 'Total Paid',
data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,900],[8,0],[9,0],[10,0],[11,0],[12,0]]
},{
label: 'Total Due',
data: [[1, 0],[2,0],[3,0],[4,0],[5,0],[6,422.10],[7,0],[8,0],[9,0],[10,0],[11,0],[12,0]]
}
];
var plot = $.plot($("#placeholder"), sales, {
bars: { show: true, lineWidth: 1 },
legend: { position: "nw" },
xaxis: { ticks: [[1, "Jan"], [2, "Feb"], [3, "Mar"], [4, "Apr"], [5, "May"], [6, "Jun"], [7, "Jul"], [8, "Aug"], [9, "Sep"], [10, "Oct"], [11, "Nov"], [12, "Dec"]] },
yaxis: { min: 0, max: 1000 },
grid: { color: "#666" },
colors: ["#0a0", "#f00"]
});
$('.title').bind('click', function() {
$('.pad').css('display','none');
$(this).next('.listingDetails').children('.pad').show();
});
$('.closepad').bind('click', function() {
$('.pad').css('display','none');
});
});
$('#nav_news').addClass("current");
function showpad(id){
$('#titlebtn'+id).click();
}
</script>

View File

@ -1,32 +1,8 @@
<div id="rightmenu">
<header>
<h3>新闻中心管理</h3>
</header>
<dl class="first">
<dt><img width="16" height="16" alt="" SRC="/static/img/90.png"></dt>
<dd><a href="/admin/news/catlog">栏目管理</a></dd>
<dd class="last">创建、编辑、删除栏目</dd>
<dt><img width="16" height="16" alt="" SRC="/static/img/27.png"></dt>
<dd><a href="/admin/news/newslist">新闻管理</a></dd>
<dd class="last">查看、编辑、搜索、删除新闻</dd>
<dt><img width="16" height="16" alt="" SRC="/static/img/21.png"></dt>
<dd><a href="/admin/news/newsadd">发布新闻</a></dd>
<dd class="last">为网站发布一篇新闻</dd>
</dl>
</div>
<div class="content-box">
<header>
<h3>Tips</h3>
</header>
<section>
<dl>
<dt>在栏目编辑中,再次点击“编辑”按钮可以关闭栏目编辑窗口</dt>
<dd><a href="/admin/news/catlog">去试试</a></dd>
<dt>新闻添加中可以直接上传图片</dt>
<dd><a href="/admin/news/newsadd">去试试</a></dd>
</dl>
</section>
</div>
<ul>
<li class="title">新闻中心</li>
<li><a href="/admin/news">新闻中心首页</a></li>
<li><a href="/admin/news/catlog">栏目管理</a></li>
<li><a href="/admin/news/catlog/add/1">栏目添加</a></li>
<li><a href="/admin/news/newslist">新闻管理</a></li>
<li><a href="/admin/news/newsadd">新闻发布</a></li>
</ul>

View File

@ -2,10 +2,16 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻添加');
?>
<?php
$auth = Zend_Auth::getInstance();
@ -16,6 +22,20 @@
$realname = $user->realname;
}
?>
<style>
.tagInput {}
.tagInputDiv {display:none;background-color:white;position:absolute;overflow:auto;border:1px solid lightgray;margin-top:-1px;}
.tagInputLine {color:black;font-weight:normal;padding:4px;}
.tagInputSel {background-color:gray;color:white;}
.tagInputLineTag {min-width:150px;display:inline-block;}
.tagInputLineFreq {min-width:50px;text-align:right;display:inline-block;float:right;}
.tagInputSuggestedTags {font-size: 11px;}
.tagInputSuggestedTags .label{display:block;background:0 none;color:#666;padding:0;margin-top:4px;}
.tagInputSuggestedTagList{}
.tagInputSuggestedTagList .tag{ padding:1px 4px;cursor:pointer;display:inline-block;margin:2px 1px;border:1px solid #bbb;}
.tagInputSuggestedTagList span.tag:hover{background-color:#bbb;color:#fff;}
.tagInputSuggestedTagList .tagUsed{border:1px solid #999;background-color:#999;color:#fff;}
</style>
<script type="text/javascript">
/* sample tags */
var tags=[
@ -23,11 +43,7 @@ var tags=[
{tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
];
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
$(document).ready(function(){
KindEditor.ready(function(K) {
editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css',
@ -51,40 +67,11 @@ $(document).ready(function(){
});
});
</script>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 “ , ”隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<section class="column width6">
<h3>发布新闻</h3>
<form name="form" id="archivesadd" method="post" action="#">
@ -96,11 +83,6 @@ $(document).ready(function(){
<input type="text" id="producttitle" class="half title" value="" name="title"/>
</p>
<p>
<label class="required" for="writer">作者</label><br/>
<input type="text" id="writer" class="half title" value="<?php echo $realname;?>" name="writer"/>
</p>
<p>
<label for="source" class="required">来源</label><br/>
<input type="text" id="source" class="half title" value="中国西部环境与生态科学数据中心" name="source"/>
@ -109,6 +91,7 @@ $(document).ready(function(){
<p>
<label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"></textarea>
<small id="enablelen"></small>
</p>
<p>
@ -161,15 +144,18 @@ $(document).ready(function(){
</fieldset>
</form>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 " , "隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
</div>
<script type="text/javascript">
$(function(){
$('#nav_news').addClass("current");
@ -208,4 +194,31 @@ function addon(){
}
});
}
$('#description').val('');
var limitNum = 200;
var pattern = '还可以输入' + limitNum + '字';
$('#enablelen').html(pattern);
$('#description').keyup(
function() {
var remain = getByteLen($(this).val());
if (remain > limitNum) {
var result = remain -limitNum;
pattern = '字数超过限制,请适当删除部分内容(超出了'+result+'字)';
}else{
var result = limitNum - remain;
pattern = '还可以输入' + result + '字';
}
$('#enablelen').html(pattern);
}
);
function getByteLen(val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
len += 2;
else
len += 1;
}
return len;
}
</script>

View File

@ -1,102 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
?>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uname=$user->username;
$realname = $user->realname;
}
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻发布');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
?>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<h3><?php echo $this->title;?></h3>
<ul>
<li><a href="/news/<?php echo $this->infos['url']; ?>/archive-<?php echo $this->infos['id']; ?>.html" target="_blank">查看文章</a></li>
<li><a href="/admin/news/newslist">返回文章列表</a></li>
<li><a href="/admin/news/newsedit/id/<?php echo $this->infos['id']; ?>">更改文章</a></li>
<li><a href="/admin/news/newsadd">发表新文章</a></li>
<li>页面将自动跳转至文章列表页</li>
</ul>
<script type="text/javascript">
/* sample tags */
var tags=[
{tag:"冻土",freq:30},{tag:"寒旱所",freq:25}, {tag:"大气",freq:10},{tag:"高原",freq:4},
{tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
];
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
KindEditor.ready(function(K) {
editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css',
uploadJson : '/plugins/upload_json.php',
fileManagerJson : '/plugins/file_manager_json.php',
allowFileManager : true
});
});
/* tag input field */
$("#keyword").tagInput({
tags:tags,
//jsonUrl:"tags.json",
sortBy:"frequency",
suggestedTags:["冻土", "寒旱所", "大气", "高原", "西部", "环境"],
tagSeparator:",",
autoFilter:true,
autoStart:false,
//suggestedTagsPlaceHolder:$("#suggested"),
boldify:true
});
});
setTimeout("self.location='/admin/news/newslist/typeid/<?php echo $this->infos['typeid'];?>'",5000);
</script>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<!-- Left column/section -->
<section class="column width6">
<h3><?php echo $this->title;?></h3>
<ul>
<li><a href="">查看文章</a></li>
<li><a href="">返回文章列表</a></li>
<li><a href="">更改文章</a></li>
<li><a href="">发表新文章</a></li>
<li>页面将自动跳转至文章列表页</li>
</ul>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<script type="text/javascript">
$(function(){
$('#nav_news').addClass("current");
});
setTimeout("self.location='/admin/news/list/typeid/<?php echo $this->view->typeid;?>'",500);
</script>
</li>

View File

@ -0,0 +1,224 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻编辑');
?>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uname=$user->username;
$realname = $user->realname;
}
?>
<style>
.tagInput {}
.tagInputDiv {display:none;background-color:white;position:absolute;overflow:auto;border:1px solid lightgray;margin-top:-1px;}
.tagInputLine {color:black;font-weight:normal;padding:4px;}
.tagInputSel {background-color:gray;color:white;}
.tagInputLineTag {min-width:150px;display:inline-block;}
.tagInputLineFreq {min-width:50px;text-align:right;display:inline-block;float:right;}
.tagInputSuggestedTags {font-size: 11px;}
.tagInputSuggestedTags .label{display:block;background:0 none;color:#666;padding:0;margin-top:4px;}
.tagInputSuggestedTagList{}
.tagInputSuggestedTagList .tag{ padding:1px 4px;cursor:pointer;display:inline-block;margin:2px 1px;border:1px solid #bbb;}
.tagInputSuggestedTagList span.tag:hover{background-color:#bbb;color:#fff;}
.tagInputSuggestedTagList .tagUsed{border:1px solid #999;background-color:#999;color:#fff;}
</style>
<script type="text/javascript">
/* sample tags */
var tags=[
{tag:"冻土",freq:30},{tag:"寒旱所",freq:25}, {tag:"大气",freq:10},{tag:"高原",freq:4},
{tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
];
$(document).ready(function(){
KindEditor.ready(function(K) {
editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css',
uploadJson : '/plugins/upload_json.php',
fileManagerJson : '/plugins/file_manager_json.php',
allowFileManager : true
});
});
/* tag input field */
$("#keyword").tagInput({
tags:tags,
//jsonUrl:"tags.json",
sortBy:"frequency",
suggestedTags:["冻土","寒旱所","大气","高原","西部","环境"],
tagSeparator:",",
autoFilter:true,
autoStart:false,
//suggestedTagsPlaceHolder:$("#suggested"),
boldify:true
});
});
</script>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<section class="column width6">
<h3>发布新闻</h3>
<form name="form" id="archivesadd" method="post" action="#">
<fieldset>
<legend>新闻信息</legend>
<input type="hidden" id="image" class="half title" value="" name="image"/>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="<?php echo $this->ev['title']; ?>" name="title"/>
</p>
<p>
<label for="source" class="required">来源</label><br/>
<input type="text" id="source" class="half title" value="<?php echo $this->ev['source']; ?>" name="source"/>
</p>
<p>
<label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"><?php echo $this->ev['description']; ?></textarea>
<small id="enablelen"></small>
</p>
<p>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"><?php echo $this->ev['body']; ?></textarea>
</p>
<div class="clearfix leading">
<div class="column width3 first">
<p>
<label for="type" class="required">新闻栏目</label><br/>
<select id="type" class="full" name="typeid">
<option value="0">请选择栏目</option>
<?php
foreach($this->types as $v)
{
if($this->ev['typeid']==$v['id'])
echo '<option value="'.$v['id'].'" selected="selected">'.$v['title'].'</option>';
else
echo '<option value="'.$v['id'].'">'.$v['title'].'</option>';
}
?>
</select>
<small>e.g. 研究成果</small>
</p>
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
<p>
<select id="pub" class="full" name="pub">
<option value="1" <?php if($this->ev['is_pub']>=1) echo 'selected="selected"'; ?>>立即发布</option>
<option value="0" <?php if($this->ev['is_pub']==0) echo 'selected="selected"'; ?>>存草稿</option>
<option value="-1" <?php if($this->ev['is_pub']<0) echo 'selected="selected"'; ?>>不发布</option>
</select>
</p>
</div>
<div class="column width3">
<p>
<input type="checkbox" id="pubtimeturn" name="pubtimer" value="1" /><label id="pubtimelable" for="productcat">定时发布?</label><br/>
<input type="text" name="pubtime" id="pubtime" value="<?php echo date("Y-m-d H:i",strtotime($this->ev['ts_published']));?>" readonly="readonly" />
<small>e.g. 2011-10-28 9:35 or 2011-10-28 21:35</small>
</p>
</div>
</div>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 " , "隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"><?php echo $this->ev['keywords']; ?></textarea></p>
</section>
</div>
<div id="return"></div>
<p class="box"><input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
</form>
</section>
</div>
<script type="text/javascript">
$(function(){
$("#pubtimeturn").click( function () {
if($(this).is(":checked"))
{
$('#pubtimelable').html('定时发布时间');
$('#pubtime').removeAttr('readonly');
}
else
{
$('#pubtimelable').html('定时发布?');
$('#pubtime').attr("readonly","readonly");
}
});
});
function addon(){
editor.sync();
var url = "/admin/news/archivesedit/id/<?php echo $this->ev['id']; ?>";
var data = $("#archivesadd").serialize()+'&keyword='+$('#keyword').val();
$.ajax({
type: "POST",
url: url,
data: data,
success: function(html){
$('#return').html(html);
},
beforeSend:function(){
$('#submit').val('正在提交...');
$('#submit').attr("disabled","disabled");
},
complete:function(){
$('#submit').val('提交');
$('#submit').removeAttr('disabled');
}
});
}
var limitNum = 200;
var pattern = '还可以输入' + (limitNum-getByteLen($('#description').val())) + '字';
$('#enablelen').html(pattern);
$('#description').keyup(
function() {
var remain = getByteLen($(this).val());
if (remain > limitNum) {
var result = remain -limitNum;
pattern = '字数超过限制,请适当删除部分内容(超出了'+result+'字)';
}else{
var result = limitNum - remain;
pattern = '还可以输入' + result + '字';
}
$('#enablelen').html(pattern);
}
);
function getByteLen(val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
len += 2;
else
len += 1;
}
return len;
}
</script>

View File

@ -2,124 +2,134 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/static/js/jquery.dataTables.min.js');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('新闻列表');
?>
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>新闻中心</h1>
<!-- Quick search box -->
<form action="" method="get"><input class="" type="text" id="q" name="q" /></form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Right column/section -->
<aside class="column width2 first">
<?= $this->partial('news/left.phtml'); ?>
</aside>
<!-- End of Right column/section -->
<style>
.listingDetails{position:absolute;width:650px;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;z-index:9999;}
</style>
<script>
$('#divFooter').css('position','absolute');
</script>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div>
<select>
<option>按栏目查看</option>
<?php
if(count($this->types))
{
foreach($this->types as $v)
{
if($this->type == $v['id'])
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'" selected="selected">'.$v['title'].'</option>';
else
echo '<option onclick="self.location=\'/admin/news/newslist/type/'.$v['id'].'\'">'.$v['title'].'</option>';
}
}
?>
</select>
&nbsp;
<a href="/admin/news/newslist">所有新闻列表</a>
</div>
<table id="report" class="stylized full" style="width:650px;">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="15%">所属栏目</th>
<th width="15%">状态</th>
<th width="20%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->paginator))
{
$list = "";
foreach ($this->paginator as $v)
{
$list .= '
<tr>
<td>
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b>
<p>作者:'.$v['author'].'</p>
<p>关键词:'.$v['keywords'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'</p>
<p>发布时间:'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td><a href="/admin/news/newslist/type/'.$v['typeid'].'">'.$v['catlog'].'</a></td>
<td>';
if($v['ts_published']<time() and $v['is_pub']>0)
{
$list.="已发布";
}
if($v['ts_published']>time() and $v['is_pub']>0)
{
$list.= date('Y-m-d H:i',$v['ts_published']) . '发布';
}
if($v['is_pub']==0)
{
$list.="草稿";
}
if($v['is_pub']<0)
{
$list.="未发布";
}
$list .= '</td>
<td>
<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" target="_blank"><b>预览</b></a>
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td>
</tr>
';
}
echo $list;
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
<!-- Left column/section -->
<section class="column width6">
<h3>新闻列表</h3>
<hr/>
<div>
<a href="/admin/news/newslist">新闻列表</a>
</div>
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<table id="report" class="stylized full" style="">
<thead>
<tr>
<th width="50%">新闻标题</th>
<th width="25%">所属栏目</th>
<th width="25%">新闻管理</th>
</tr>
</thead>
<tbody>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
echo '
<tr>
<td class="title">
<div id="paddiv'.$v['id'].'">
<a id="titlebtn'.$v['id'].'"><b>'.$v['title'].'</b></a>
<div class="listingDetails">
<div class="pad">
<b>详细信息</b>
<p>作者:'.$v['writer'].'</p>
<p>关键词:'.$v['keyword'].'</p>
<p>描述:'.$v['description'].'</p>
<p>添加时间:'.date("Y-m-d H:i",$v['writetime']).'</p>
<p>发布时间:'.date("Y-m-d H:i",$v['pubtime']).'</p>
<p>来源:'.$v['source'].'</p>
<p>点击:'.$v['click'].'</p>
</div>
</div></div>
</td>
<td>'.$v['catlog'].'</td>
<td>
<a href="javascript:showpad('.$v['id'].');"><b>编辑</b></a>
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
</tr>
';
}
}
else
{
echo '
<tr><td>暂无数据</td><td></td></tr>
';
}
?>
</tbody>
</table>
<hr/>
<div class="pagenavi"><?= $this->paginator; ?></div>
</section>
<!-- End of Left column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
</tbody>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<script type="text/javascript">
$('#nav_news').addClass("current");
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
/* expandable rows */
Administry.expandableRows();
$('.title').bind('click', function() {
$.colorbox({'innerWidth':'50%','html':$(this).next('.listingDetails').children('.pad').html()});
});
});
function showpad(id){
$('#titlebtn'+id).click();

View File

@ -65,6 +65,30 @@
<td>黑河流域气象观测站点分布图</td>
<td>专家邀请模板</td>
</tr>
<tr>
<td>{link}</td>
<td>元数据访问地址</td>
<td>http://{server}/data/49f1ced9-dcb9-431b-a14e-2e3009dd5097</td>
<td>数据作者激活</td>
</tr>
<tr>
<td>{vdcode}</td>
<td>数据作者确认验证码</td>
<td>8f4a311d74d6ddbc024f7877891d3356</td>
<td>数据作者激活</td>
</tr>
<tr>
<td>{active}</td>
<td>数据作者激活确认链接</td>
<td>http://{server}/author/accept/?ac=active&v={vdcode}</td>
<td>数据作者激活</td>
</tr>
<tr>
<td>{lock}</td>
<td>数据作者激活否认链接</td>
<td>http://{server}/author/accept/?ac=lock&v={vdcode}</td>
<td>数据作者激活</td>
</tr>
</tbody>
</table>
</p>

View File

@ -46,4 +46,22 @@ class AboutController extends Zend_Controller_Action
function backgroundAction()
{
}
function legalAction()
{
}
function supportusAction()
{
}
function copyrightAction()
{
}
function linkAction()
{
}
function honorAction()
{
}
function sponsorsAction()
{
}
}

View File

@ -979,7 +979,7 @@ class DataController extends Zend_Controller_Action
//判断FTP URL是否附带了用户名和密码
if ($p['host']=='ftp.westgis.ac.cn')
$url='ftp://'.$this->view->config->ftp->user.':'.$this->view->config->ftp->password.'@ftp.westgis.ac.cn'.$p['path'];
if (!$bigfile &&is_file($url) && file_exists($url))
/*if (!$bigfile &&is_file($url) && file_exists($url))
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
@ -995,7 +995,7 @@ class DataController extends Zend_Controller_Action
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
} else {
} else */{
//是一个FTP返回用户名称和密码说明
if ($p['host']=='ftp.westgis.ac.cn')
{
@ -1278,22 +1278,17 @@ class DataController extends Zend_Controller_Action
*/
function thumbAction()
{
$id = (int)$this->_request->getParam('id');
if ($id>0) {
$thumb=$this->db->fetchRow($this->db->quoteInto('select * from thumbnail where id=?',$id));
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
if (empty($thumb['data'])) {
header("Content-Type:image/png");
header("Content-Length: " . filesize("images/nothumb.png"));
$file=fopen("images/nothumb.png",'r');
fpassthru($file);
exit;
} else {
header("Content-Type:image/".$thumb['filetype']);
print base64_decode($thumb['data']);
}
}
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
$state=$this->db->query("select count(*) from normalmetadata");
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$this->db->select();
$select->from('normalmetadata as m','m.*')
->order('m.title desc')->limitPage($page,$this->limit);
$this->view->metadata = $this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$this->limit);
}
/*

View File

@ -0,0 +1,135 @@
<?php
class NewsController extends Zend_Controller_Action
{
private $limit=10;
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
}
function indexAction()
{
$sql="select * from news_category order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$sql = "SELECT a.*,t.title as typetitle,t.url FROM news_archives a
LEFT JOIN news_category t ON a.typeid=t.id
WHERE a.ts_published<'now()' AND is_pub>=1 ORDER BY ts_published DESC";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$page = $this->_request->getParam('page');
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
function listAction()
{
$type = strtolower($this->_request->getParam('type'));
$page = $this->_request->getParam('page');
if(preg_match("/archive\-(\d+)\.html/",$page,$matches))
{
$this->_forward('archive', 'news', null, array('archive' => $matches['1'] , 'type'=> $type));
}
else
{
if(preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$page))
{
$this->_forward('error', 'error', null, null);
}
$sql = "SELECT id,url,title FROM news_category WHERE url='$type'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
$this->_forward('error', 'error', null, null);
}
else{
$this->view->url = $row['url'];
$this->view->title = $row['title'];
$sql="select * from news_category order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$sql = "SELECT arc.*,c.url FROM news_archives arc
LEFT JOIN news_category c ON arc.typeid=c.id
WHERE arc.typeid='{$row['id']}' AND arc.ts_published<'now()' AND arc.is_pub>=1
ORDER BY arc.ts_published DESC";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
}
}
function archiveAction()
{
$type = $this->_request->getParam('type');
$archive = $this->_request->getParam('archive');
$this->view->type = $type;
if(preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$archive))
{
$this->_forward('error', 'error', null, null);
}
$sql="select * from news_category order by displayorder asc";
$re = $this->db->query($sql);
$types = $re->fetchAll();
$this->view->types=$types;
$sql = "SELECT arc.*,type.url,type.title as typename,u.realname as author FROM news_archives arc";
$sql .= " LEFT JOIN news_category type ON arc.typeid=type.id";
$sql .= " LEFT JOIN users u ON arc.userid=u.id";
$sql .= " WHERE arc.is_pub>0 AND arc.ts_published<'now()' AND arc.id=$archive";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
$this->_forward('error', 'error', null, null);
}
$this->view->infos = $row;
}
function searchAction()
{
}
}

View File

@ -114,8 +114,10 @@ class ServiceController extends Zend_Controller_Action
//$end=$this->_request->getParam('end');
$sql="select id,title,uuid,description,filesize,fileformat from metadata where east<? and west>? and north<? and south>?";
if (!empty($key)) {
$sql.= " and (title ilike ? or description ilike ?)";
$sql.= " order by title";
$search=new Search($key);
$where=$search->sql_expr(array("title","description"));
$sql.= " and ".$where;
$sql.= " order by title";
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
} else {
$sql.= " order by title";
@ -190,7 +192,7 @@ class ServiceController extends Zend_Controller_Action
//'generator' => 'Zend Framework Zend_Feed',
'entries' => array()
);
$sql="select * from metadata order by ts_created desc";
$sql="select * from normalmetadata order by ts_created desc";
$rs=$this->db->fetchAll($sql);
$feedArray['published']=strtotime($rs[0]['ts_created']);
foreach($rs as $r)
@ -235,10 +237,11 @@ class ServiceController extends Zend_Controller_Action
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$sql="select title,datatype,filesize,id from metadata";
$sql="select uuid,title,datatype,filesize,id from normalmetadata";
$md=$this->db->fetchAll($sql);
foreach($md as $m)
{
{
print $m["uuid"].",";
print $m["title"].",";
print ($m["datatype"]?"内部":"公开").",";
print ($m["filesize"]==1?" ":$m["filesize"]).",";
@ -1060,7 +1063,7 @@ class ServiceController extends Zend_Controller_Action
}
else
{
$sql .="limit $pageSize";
$sql .=" limit $pageSize";
}
$re = $this->db->query($sql,array($uuid,$uuid));
$rows = $re->fetchAll();
@ -1212,7 +1215,6 @@ class ServiceController extends Zend_Controller_Action
echo '</ul>';
echo $pagnation;
}//文档页面相关数据
function geonetworkAction()
{
$this->_helper->viewRenderer->setNoRender();
@ -1249,4 +1251,41 @@ class ServiceController extends Zend_Controller_Action
$this->getResponse()->setHeader('Content-Type', 'text/html')
->setBody($body);
}
}
/*
输出验证码
*/
public function imgcodeAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
include_once('ImgCode.php');
$imagecode=new Custom_Controller_Plugin_ImgCode();
$imagecode->image2();
}
//header output
function headerAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$header=file_get_contents('../application/default/views/scripts/header.phtml');
$content='<link rel="stylesheet" type="text/css" media="screen"
href="/css/default.css" />';
$content.=eval('?>'.$header);
$content.='<script src="/js/navi.js" type="text/javascript"></script>';
$this->getResponse()->setHeader('Content-Type', 'text/html')
->setBody($content);
}
//footer output
function footerAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$footer=file_get_contents('../application/default/views/scripts/footer.phtml');
$this->getResponse()->setHeader('Content-Type', 'text/html')
->setBody($footer);
}
}

View File

@ -1,14 +1,20 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('项目背景');
$this->headTitle($this->config->title->site);
$this->headTitle('发展历史');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/terms.css');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('项目背景');
$this->breadcrumb('发展历史');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="LeftMargin">
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>发展历史</h2>
<p>2007年12月29日国家发改委正式批复《青海湖流域生态环境保护与综合治理规划》以下简称《规划》《规划》范围为刚察、海晏、天峻、共和4县的青海湖流域面积29661平方公里。《规划》实施期为10年建设内容分为湿地保护与环境治理工程、退化土地保护与治理工程、生物多样性保护工程、农牧民生产生活条件改善工程和技术支撑与管理工程等五个工程类别。生态监测体系建设项目列在技术支撑与管理工程中由青海省环境保护厅负责生态监测体系建设项目的实施。</p>
<p>根据《青海湖流域生态环境保护与综合治理工程规划》的要求,青海湖流域生态环境监测体系建设的总体目标是:整合现有监测资源,合理布局新的监测站点,在青海湖流域建设一个时空分布合理,点面结合,可操作性强的生态环境监测体系;及时掌握各流域生态因子的动态变化,准确反映生态环境质量现状、演化规律和工程实施效果;建成生态环境监测、科研、教学和公众参与的信息平台、技术保障平台,实现基础数据和资料的系统观测、连续积累、科学存储、有效利用;对全流域生态系统和生态治理成效评估,为流域资源、环境、人口的管理和经济发展提供决策依据。</p>
<p>本项目是青海湖流域生态环境监测体系建设项目的主要建设内容之一,依托数据库、互联网和地理信息系统技术,组建基于互联网的生态环境数据共享平台,发掘生态监测数据的科学价值,辅助生态环境变化过程中的科学问题研究,充分发挥青海湖流域生态环境监测体系建设项目的投资效益。</p>

View File

@ -1,13 +1,18 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('联系我们');
$this->headTitle($this->config->title->site);
$this->headTitle('联系我们');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/contact.css');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('联系我们');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="contactUs"> 联系我们</div>
<div id="offline">
<p class="title">离线方式</p>

View File

@ -0,0 +1,21 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('联系我们');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('联系我们');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>数据与版权</h2>
整体说明
我们的理解
数据中各个角色的不同,如何定义,各自拥有什么权限
</div>

View File

@ -0,0 +1,22 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('服务成效');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('服务成效');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>服务成效</h2>
<h3>标注数据论文<h3>
<h3>数据中心发表论文<h3>
<h3>专利与著作权<h3>
<h3>奖励<h3>
</div>

View File

@ -1,10 +1,10 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('关于本站');
$this->headTitle($this->config->title->site);
$this->headTitle('关于我们');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('关于我们');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="LeftMargin">

View File

@ -0,0 +1,58 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('隐私政策');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('隐私政策');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>隐私政策</h2>
<p>
中国西部环境与生态科学数据中心感谢您关注其科学数据品和访问本网站。您可以通过多种不同的方式使用我们的服务,例如查看数据、下载数据、搜索和分享数据或者分享科学数据等。
我们很注重您的个人隐私权。保护您的个人隐私是我们特别关注的一项重要工作。
我们希望让您清楚地了解我们对信息的使用方式,以及您可采用什么方式来保护自己的隐私权。</p>
<p>同时,本网站包含到其它网站的链接,而那些网站并非属于本隐私声明的覆盖范围。</p>
<p>我们的隐私权政策解释了以下几个方面的问题:</p>
<ul><li>我们收集哪些信息,以及收集这些信息的原因。</li>
<li>我们对这些信息的使用方式。</li>
</ul>
<h3>我们收集的信息</h3>
<p>我们有两种信息收集方式:</p>
<p> 1.您向我们提供信息。我们的很多服务都要求您注册成为数据中心的用户。而在您注册数据中心用户时,
我们会要求您提供个人信息,例如您的姓名、电子邮件地址、电话号码等。
</p>
<p> 2.我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,
例如您在何时下载了某条数据。此类信息包括设备信息、日志信息等。
</p>
<h3>我们如何使用收集到的信息</h3>
<p>我们利用从所有服务中收集的信息来提供、维护、保护和改进这些服务。
</p>
<p>当我们要将信息用于本隐私权政策未载明的其它用途时,则会事先征求您的同意。</p>
<h3>访问和更新个人信息</h3>
<p>无论您在何时使用我们的服务,我们都力求让您能够访问自己的个人信息。
如果这些信息有误,我们会努力通过各种方式让您快速更新信息或删除信息(除非我们出于合法业务或法律方面的原因而必须保留这些信息)。
在更新您的个人信息时,我们可能会要求您先验证自己的身份,然后再处理您的请求。</p>
<p>
对于那些无端重复、需要过多技术投入(例如开发一个新系统或从根本上改变现行惯例)、
对他人隐私权造成风险或者非常不切实际(例如关于在备份磁带上存放信息的请求)的请求,我们可能予以拒绝。
</p>
<h3>我们分享的信息</h3>
<p> 1. 您在申请数据后,数据所有者能看到您的申请信息,包括您数据的用途、姓名、单位、电话等信息。</p>
<p> 2. 您在成功申请数据后,该数据页面可能会显示您曾经使用过该数据,页面公开的信息包括您的姓名、单位、申请用途以及申请的时间信息。</p>
<h3>信息安全</h3>
<p> 1. 用户的密码在我们的服务器上采用不可逆算法进行了加密。</p>
<p> 2. 用于FTP下载登录的密码和您在网站上登录的密码没有相关性而且也采用了不可逆算法进行了加密。</p>
<p> 3. 我们会审查数据存储、处理和备份方面的各种措施(包括物理性安全措施),以避免各系统遭到未经授权的访问。</p>
<h3>适用范围</h3>
<p>我们的隐私权政策适用于由中国西部环境与生态科学数据中心及其关联机构提供的所有服务,但不适用于由其他公司或个人提供的服务。</p>
<p>我们会定期检查隐私权政策的遵守情况。我们收到正式的书面投诉后,会与投诉人联系,以便采取进一步行动。</p>
</div>

View File

@ -0,0 +1,20 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('友情链接');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('友情链接');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>友情链接</h2>
合作站点:
科学数据相关站点:
</div>

View File

@ -0,0 +1,11 @@
<ul>
<li><a href="/about/">中心简介</a></li>
<li><a href="/about/background">发展历史</a></li>
<li><a href="/about/sponsors">支持项目</a></li>
<li><a href="/about/honor">服务成效</a></li>
<li><a href="/about/copyright">数据与版权</a></li>
<li><a href="/about/legal">隐私政策</a></li>
<li><a href="/about/supportus">支持我们</a></li>
<li><a href="/about/contact">联系我们</a></li>
<li><a href="/about/link">友情链接</a></li>
</ul>

View File

@ -0,0 +1,22 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('支持项目');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('支持项目');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>支持项目</h2>
<h3>标注数据论文<h3>
<h3>数据中心发表论文<h3>
<h3>专利与著作权<h3>
<h3>奖励<h3>
</div>

View File

@ -0,0 +1,22 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('支持我们');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/about.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/about">关于本站</a>');
$this->breadcrumb('支持我们');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('about/navi.phtml'); ?>
</div>
</div>
<div id="content">
<h2>支持我们</h2>
支持的方式:
大力参与!
共享您产生的科学数据!
我们在数据整理/共享方面有自己独到的简介,如大项目,也可合作!
</div>

View File

@ -0,0 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('我的数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<?php echo $this->info; ?>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,86 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('我的数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/accept/ac/search">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
<p><?php echo $item['description'] ?></p>
<p>
<?php
if($item['status']==1)
{
echo '';
}//已经是自己的数据
if ($item['status']==0)
{
echo '<img src="/images/list_extensions.gif" />您已经申请该数据,请到邮箱查看激活邮件(如果没有收到请 <a href="javascript:;" onclick="apply(\''.$item['uuid'].'\')">点击这里</a>)';
}
?>
<span id="data_<?php echo $item['uuid'];?>"></span>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function apply(uuid){
$.ajax({
'type':"POST",
'url':'/author/apply',
'data':'ac=apply&m=send&uuid='+uuid,
'success':function(data){
if (isObject(data))
{
if(typeof(data.error)!='undefined')
{alert(data.error);}
else{alert('请重试');}
}
else{ alert('出现错误,请稍候');}
$('#data_'+uuid).html('');
},
'beforeSend':function(){
$('#data_'+uuid).html('<img src="/images/ajax-load-small.gif" />正在处理...');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
}
});
}
function isObject(obj){if(typeof(obj)=='object'){return true;}else if(typeof(obj)!='object'){return false;}else{return false;}}
</script>

View File

@ -0,0 +1,99 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form">
<input type="text" id="keyword" name="keyword" />
<button type="button" class="btn" id="search_btn" onclick="doSearch()">搜索</button>
</form>
<div id="datalist">
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function doSearch(){
$.ajax({
'type':"POST",
'url':'/author/apply',
'data':'ac=search&q='+$('#keyword').val(),
'success':function(data){
if (isObject(data))
{
if(typeof(data.error)!='undefined')
{
alert(data.error);
}else{
var result = new Array();
for(i=0;i<data.length;i++)
{
if(data[i].status==1) var ct='<img src="/images/list_links.gif" />您是此元数据的作者';
else if (data[i].status==0) var ct='<img src="/images/list_extensions.gif" />您已经申请成为该元数据作者,请前往 <a href="/author/accept">我的数据</a> 查看<span id="data_'+data[i].uuid+'"></span>';
else var ct='<a href="javascript:;" onclick="apply(\'' +data[i].uuid+ '\')"><img src="/images/list_keys.gif" />申请成为此数据的作者</a><span id="data_'+data[i].uuid+'"></span>';
result.push('<li><a href="/data/'+data[i].uuid+'" target="_blank">'+data[i].title+'</a><p>'+data[i].description+'</p><p>'+ct+'</p></li>');
}
$('#datalist').html('<ul id="datas">'+result.join('')+'</ul>');
}
}else{
alert('无搜索结果');
}
$('#search_btn').html('搜索');
},
'beforeSend':function(){
$('#search_btn').html('<img src="/images/ajax-load-small.gif" />Searching...');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
}
});
}
function apply(uuid){
$.ajax({
'type':"POST",
'url':'/author/apply',
'data':'ac=apply&uuid='+uuid,
'success':function(data){
if (isObject(data))
{
if(typeof(data.error)!='undefined')
{alert(data.error);}
else{
alert(data.error);
}
}
else{ alert('出现错误,请稍候');}
$('#data_'+uuid).html('');
},
'beforeSend':function(){
$('#data_'+uuid).html('<img src="/images/ajax-load-small.gif" />正在处理...');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
}
});
}
function isObject(obj){if(typeof(obj)=='object'){return true;}else if(typeof(obj)!='object'){return false;}else{return false;}}
</script>

View File

@ -0,0 +1,48 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据反馈管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/author/authored">元数据反馈概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/authored/ac/listall">所有元数据反馈</a></li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p>评论者:<?php echo $item['author'] ?> <?php echo $item['email'];?>) 评论时间:<?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?></p>
<p>  <?php echo $item['content'] ?></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,49 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据反馈管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/authored">元数据反馈概况</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/authored/ac/listall">所有元数据反馈</a></li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
<p>评论者:<?php echo $item['author'] ?> <?php echo $item['email'];?>) 评论时间:<?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?></p>
<p>  <?php echo $item['content'] ?></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,48 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据反馈管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/author/authored">元数据反馈概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/authored/ac/listall">所有元数据反馈</a></li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
<p>反馈数: <a href="/author/authored/ac/view/uuid/<?php echo $item['uuid'];?>"><?php echo $item['c'];?></a> <a href="/author/authored/ac/view/uuid/<?php echo $item['uuid'];?>" class="more">查看详细</a></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,83 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据申请管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/online">在线下载记录</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/inauthor/ac/offline">离线申请记录</a></li>
</ul>
</div>
<div class="box box-info" id="head_tip" onclick="$('#head_tip').hide();" title="点击关闭提示">离线数据申请默认为同意下载</div>
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/inauthor/ac/searchoffline">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
<p>用户:<?php echo $item['username'];?> 
单位:<?php echo $item['unit'];?> 
申请时间:<?php echo date("Y-m-d H:i:s",strtotime($item['ts_created']));?></p>
<p>项目:<?php echo $item['project'];?></p>
<p><span id="ct_<?php echo $item['id'];?>">
<?php echo $item['btns'];?> </span><span id="data_<?php echo $item['id'];?>"></span></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
function confrim(uuid,oid){
doPD(uuid,"confrim",oid);
}
function objection(uuid,oid){
doPD(uuid,"objection",oid);
}
function doPD(uuid,pr,oid){
$.ajax({
'type':"POST",
'url':'/author/inauthor/ac/offline',
'data':'pr='+ pr +'&uuid='+uuid+'&oid='+oid,
'success':function(html){
$('#ct_'+oid).html(html);$('#data_'+oid).html('');
},
'beforeSend':function(){
$('#data_'+oid).html('<img src="/images/ajax-load-small.gif" />正在处理...');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+oid).html('');
}
});
}
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,59 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据申请管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/author/inauthor/ac/online">在线下载记录</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/offline">离线申请记录</a></li>
</ul>
</div>
<div class="box box-info" id="head_tip" onclick="$('#head_tip').hide();" title="点击关闭提示">这里仅显示您的数据的离线及在线数据申请。</div>
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/inauthor/ac/searchonline">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
<p>用户:<?php echo $item['username'];?> 
单位:<?php echo $item['unit'];?> 
申请时间:<?php echo date("Y-m-d H:i:s",strtotime($item['ts_created']));?></p>
<p>项目:<?php echo $item['project'];?></p>
<p><span id="data_<?php echo $item['uuid'];?>"></span></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb($this->config->title->author);
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div class="helplist">
<ul>
<li id="author_system">
<h1>数据作者系统有什么功能?</h1>
<div class="content">
<p>1、进行数据认证</p>
<p>您在数据中心发布了一条数据,若需对数据进行修改,则需要进行数据认证。</p>
</div>
</li>
<li id="help_apply">
<h1>如何成为已发布数据的作者</h1>
<div class="content">
<p>登录后,进入网站的“数据作者”→“数据认证”页面,在搜索框内输入您的数据的关键字,然后点击搜索,带列表加载后,点击数据介绍下方的“申请成为此数据的作者”即可进入申请步骤。该功能需要登录后使用(<a href="/author/apply">点击这里</a>可以进入数据认证)</p>
</div>
</li>
<li id="help_inauthor">
<h1>在线、离线数据查看与审批功能</h1>
<div class="content">
<p>1.在线数据申请记录查看:</p>
<p>点击网站主导航"数据作者",进入数据作者页面后,点击左侧导航栏的"数据申请管理"。默认进入在线数据申请记录页面,在线数据申请不需要审批,用户可直接下载。该功能需要登录后使用(<a href="/author/inauthor/ac/online">点击这里</a>可以进入在线申请记录)</p>
<p>2.离线数据申请记录查看:</p>
<p>点击网站主导航"数据作者",进入数据作者页面后,点击左侧导航栏的"数据申请管理"。然后点击右侧页面顶部的"离线申请记录"(默认选中的是"在线下载记录")。该功能需要登录后使用(<a href="/author/inauthor/ac/offline">点击这里</a>可以进入离线申请记录)</p>
<p>3.离线数据申请审批</p>
<p>进入"离线申请记录"页面后,在右侧页面可以看到离线申请列表,通过点击每条记录下面的"同意"按钮来确认同意用户的下载申请,点击"反对"来确认用户不能下载该数据。在数据送达前可以修改意见。当前数据如果已经有意见,则显示为淡蓝色背景(改类按钮表示被选中)</p>
</div>
</li>
</ul>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,26 @@
<ul>
<li><a href="/author/">介绍</a></li>
<li><a href="/author/apply">数据认证</a></li>
<li><a href="/author/accept">我的数据</a></li>
<li><a href="/author/inauthor">数据申请管理</a></li>
<li><a href="/author/authored">数据反馈管理</a></li>
<li><a href="/author/help">数据调查</a></li>
<li><a href="/author/help">数据新闻</a></li>
<li><a href="/author/help">信息统计</a></li>
</ul>
<form id="search" enctype="application/x-www-form-urlencoded" action="/author/search" method="post">
<input type="text" name="q" id="q" value="<?php echo (empty($this->key))?'回车搜索标题和摘要':$this->key; ?>" onfocus="myfocus(this);" onblur="myblur(this);">
<input type="hidden" name="submit" value="submit">
</form>
<script>
function myfocus(element) {
if (element.value == '回车搜索标题和摘要') {
element.value = '';
}
}
function myblur(element) {
if (element.value == '') {
element.value = '回车搜索标题和摘要';
}
}
</script>

View File

@ -0,0 +1,36 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('缩略图浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('缩略图浏览');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<?php echo $this->page->getNavigation(); ?>
<hr />
<div id="mdlist">
<?php foreach($this->metadata as $md) : ?>
<div class="thumb">
<div class="thumbtitle">
<a href="/data/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']); ?> </a>
</div>
<a class="colorbox" href="/service/bigthumb/id/<?php echo $md['id'];?>" title="<?php echo $this->escape($md['title']); ?>">
<img src="/service/thumb/id/<?php echo $md['id'];?>" alt="<?php echo $this->escape($md['title']);?>" title="<?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?>" />
</a>
</div>
<?php endforeach; ?>
</div>
<hr style="clear:left;"/>
<?php echo $this->page->getNavigation(); ?>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});});
</script>

View File

@ -0,0 +1,54 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($this->infos['title']);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/news">新闻中心</a>');
$this->breadcrumb('<a href="/news/'.$this->type.'">'.$this->infos['typename'].'</a>');
$this->breadcrumb($this->infos['title']);
$this->breadcrumb()->setSeparator(' > ');
if(!empty($this->infos['keyword'])) $keyword = $this->infos['keyword']; else $keyword = $this->infos['title'];
$this->headMeta()->appendName('keywords', $keyword);
$this->headMeta()->appendName('description', mb_substr($this->infos['description'],0,180,'utf-8'));
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">栏目导航</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear archive_body" id="archive_body">
<div class="title"><?php echo $this->infos['title'];?></div>
<div class="info">时间&nbsp;:&nbsp;<?php echo date("Y-m-d H:i",strtotime($this->infos['ts_published']));?>&nbsp;&nbsp;作者&nbsp;:&nbsp;<?php echo $this->infos['author'];?>&nbsp;&nbsp;来源&nbsp;:&nbsp;<?php echo $this->infos['source'];?></div>
<div class="archive_content">
<table width="100%">
<tr>
<td>
<?php echo $this->infos['body'];?>
</td>
</tr>
</table>
</div>
</div>
</div>
<script>
$('#archive_body').width($('#body').width()-320);
$('#archive_body .archive_content img').css("max-width",$('#archive_body').width());
</script>

View File

@ -0,0 +1,67 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('新闻中心');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('新闻中心');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">新闻分类</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear" id="archives_list">
<div class="archives_list">
<ul>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
$description = "";
if(empty($v['description']))
{
$description = "No description";
}else if (mb_strlen($v['description'])>160)
{
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
}else{
$description = $v['description'];
}
echo '<li>
[<a href="/news/'.$v['url'].'/" class="type">'.$v['typetitle'].'</a>]&nbsp;<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
<small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime($v['ts_published'])).'</small>
<p>'.$description.'</p>
</li>';
}
}
else
{
echo '暂无数据';
}
?>
</ul>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
$('#archives_list').width($('#body').width()-320);
</script>

View File

@ -0,0 +1,68 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('新闻中心');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/news">新闻中心</a>');
$this->breadcrumb($this->title);
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="full center clear" id="body">
<div class="w300 Lfloat clear">
<div class="tbox">
<div class="title">新闻分类</div>
<div class="content navmenu">
<ul>
<?php
if(count($this->types))
{
foreach($this->types as $k=>$v)
{
echo '<li><a href="/news/'.$v['url'].'">'.$v['title'].'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>
<div class="Rfloat clear" id="archives_list">
<div class="archives_list">
<ul>
<?php
if(count($this->paginator))
{
foreach ($this->paginator as $v)
{
$description = "";
if(empty($v['description']))
{
$description = "No description";
}else if (mb_strlen($v['description'])>160)
{
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="more">(more)</a>';
}else{
$description = $v['description'];
}
echo '<li>
<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
<small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime( $v['ts_published'] )).'</small>
<p>'.$description.'</p>
</li>';
}
}
else
{
echo '暂无数据';
}
?>
</ul>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
$('#archives_list').width($('#body').width()-320);
</script>

View File

@ -0,0 +1,11 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->review);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/news.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('News');
$this->breadcrumb()->setSeparator(' > ');
?>

View File

@ -6,6 +6,7 @@
// the action to dispatch if a user doesn't have sufficient privileges
private $_authController = array('module'=>'','controller' => 'account',
'action' => 'login');
public function __construct(Zend_Auth $auth)
{
$this->db=Zend_Registry::get('db');
@ -21,11 +22,13 @@
$this->acl->add(new Zend_Acl_Resource('water'));
$this->acl->add(new Zend_Acl_Resource('admin'));
$this->acl->add(new Zend_Acl_Resource('upload'));
$this->acl->add(new Zend_Acl_Resource('author'));
// allow access to everything for all users by default
// except for the account management and administration areas
$this->acl->allow();
$this->acl->deny(null, 'account');
$this->acl->deny(null, 'admin');
$this->acl->deny(null, 'author');
// add an exception so guests can log in or register
// in order to gain privilege
$this->acl->allow('guest', 'account', array('login',
@ -33,9 +36,12 @@
'register',
'registercomplete'));
$this->acl->deny('guest','data',array('download','order'));
$this->acl->deny('guest','water',array('download','order'));
$this->acl->deny('guest','water',array('download','order'));
// allow members access to the account management area
$this->acl->allow('guest','author',array('index'));
$this->acl->allow('member', 'account');
$this->acl->allow('member', 'author');
// allows administrators access to the admin area
$this->acl->allow('administrator', 'admin');
}

View File

@ -6,10 +6,10 @@ class EmailText{
protected $tmpinfo;
function __construct($db,$id,$replace)
{
$this->db=$db;
$this->tmpid=$id;
$this->data=$replace;
{
$this->db=$db;
$this->tmpid=$id;
$this->data=$replace;
$this->load();
}
@ -18,7 +18,7 @@ class EmailText{
if(is_numeric($this->tmpid))
$sql = "select * from emailtext where id='".$this->tmpid."'";
else
$sql = "select * from emailtext where template='".$this->tmpid."'";
$sql = "select * from emailtext where template='".$this->tmpid."'";
$t=$this->db->getFetchMode();
$this->db->setFetchMode(Zend_Db::FETCH_ASSOC);
$rs = $this->db->query($sql);
@ -33,10 +33,15 @@ class EmailText{
{
return false;
}else{
if (empty($body))
{
$this->getinfo();
$body=$this->tmpinfo['body'];
if (empty($body))
{
$this->getinfo();
$body=$this->tmpinfo['body'];
}
if (empty($this->tmpinfo['subject']))
{
$this->getinfo();
}
if(!empty($body))
@ -56,7 +61,8 @@ class EmailText{
}
ksort($patterns);
ksort($replacements);
$this->tmpinfo['body']=preg_replace($patterns, $replacements, $body);
$this->tmpinfo['body'] = preg_replace($patterns, $replacements, $body);
$this->tmpinfo['subject'] = preg_replace($patterns, $replacements, $this->tmpinfo['subject']);
return true;
}//count($this->data)
}
@ -65,11 +71,11 @@ class EmailText{
return false;
}
}//empty($this->tmpid)
}//function loadtmp
public function getBody() {
return $this->tmpinfo['body'];
}
public function getSubject() {
return $this->tmpinfo['subject'];
}//function loadtmp
public function getBody() {
return $this->tmpinfo['body'];
}
public function getSubject() {
return $this->tmpinfo['subject'];
}
}

View File

@ -80,7 +80,7 @@ class ISO19115
public $mdContact;
public $uuid;
public $doi;
public $doi='';
/**
* 数据集标题
* 字符串
@ -163,8 +163,154 @@ class ISO19115
function loadUUID($uuid)
{
}
function saveDB()
function saveDB($db,$xml)
{
$this->loadXML($xml);
//先删除已有元数据,然后再插入新数据
$sql="delete from metadata where uuid=?";
$db->query($sql,array($this->uuid));
//删除所有未用到的responsible数据
$sql="delete from responsible where id not in (select distinct(resid) from role)";
$db->query($sql);
//if (!empty($this->doi)) $row->doi=$this->doi;
//生成空白统计数据可以转移到数据库端处理todo
try
{
$sql="insert into mdstat (uuid) values(?)";
$db->query($sql,array($this->uuid));
} catch (Exception $e) {
//do nothing.
//说明数据库中已存在该信息
}
//save metadata into database
try {
$sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created,
timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat,
$this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'],
$this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi));
$id=$db->lastInsertId('metadata','id');
//处理在线资源
if ($this->onlineresource) foreach($this->onlineresource as $resource)
{
$sql="insert into onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)";
$db->query($sql,array($this->uuid,$resource['linkage'],$resource['protocol'],$resource['name'],$resource['description']));
}
//处理缩略图
if (!empty($this->thumbnail)) {
$sql="insert into thumbnail (id,data,filetype) values(?,?,?)";
$db->query($sql,array($id,$this->thumbnail,'jpg'));
} elseif ($this->graph) {
//$trow->data=$this->graph['data'];
$sql="select id as gid from geonetworkmetadata where uuid=?";
$r=$db->fetchRow($sql,array($this->uuid));
if ($r)
{
$thumb=base64_encode(file_get_contents($this->view->config->geonetwork->url.'srv/cn/resources.get?access=public&id='.$r->gid.'&fname='.urlencode($this->graph['filename'])));
$sql="insert into thumbnail (id,data,filetype,filedesc,filename) values(?,?,?,?,?)";
$db->query($sql,array($id,$thumb,$this->graph['filetype'],$this->graph['filedesc'],$this->graph['filename']));
}
}
//处理关键词
//1:N relation
foreach($this->keyword as $keytype=>$keys)
{
foreach($keys as $key)
{
$sql="insert into keyword (id,keyword,keytype) values(?,?,?)";
$db->query($sql,array($id,$key,$keytype));
}
}
//处理数据集序列
//M:N relation
if ($this->datasetSeries) foreach($this->datasetSeries as $ds)
{
$sql="select id from series where name=?";
$sth=$db->prepare($sql);
$sth->execute(array($ds['seriesName']));
$trow=$sth->fetch();
if ($trow)
$sid=$trow->id;
else {
$sql="insert into series (name) values(?)";
$db->query($sql,array($ds['seriesName']));
$sid=$db->lastInsertId('series','id');
}
$sql="insert into dataseries (id,sid) values(?,?)";
$db->query($sql,array($id,$sid));
}
//处理XML入库
$sql="insert into xml (id,data) values(?,?)";
$db->query($sql,array($id,$xml));
//处理数据分类
foreach($this->tpCat as $cat){
if (is_numeric($cat)) {
$sql="insert into category (id,code) values(?,?)";
$db->query($sql,array($id,(int)$cat));
} else {
//是字符串geonetwork会采用这种模式
//从categorycode表中查找其对应的code
$sql="insert into category (id,code) select ?,code from categorycode where name=?";
$db->query($sql,array($id, trim($cat)));
}
}
//处理联系人信息
//先查询再进行处理
//若用户信息发生变化,则存在问题
//无法保证数据的更新状态
foreach($this->author as $au)
{
$inds=explode(";",$au['individual']);
foreach($inds as $ind)
{
$sql="select id from responsible where individual=? and organisation=?";
$row=$db->fetchRow($sql,array(trim($ind),trim($au['organisation'])));
if (!$row)
{
$sql="insert into responsible (individual,organisation,position,delivery,phone,email,city,country,administrative,postal) values(?,?,?,?,?,?,?,?,?,?)";
$db->query($sql,array(trim($ind),trim($au['organisation']),trim($au['position']),trim($au['delivery']),trim($au['phone']),trim($au['email']),trim($au['city']),trim($au['country']),trim($au['administrative']),trim($au['postal'])));
} elseif (count($inds)==1) {
//deal email address
if (($au['email']) && empty($row->email))
{
$sql="update responsible set email=? where id=?";
$db->query($sql,array(trim($au['email']),$row->id));
}
}
$sql="select id from responsible where individual=? and organisation=?";
$row=$db->fetchRow($sql,array(trim($ind),trim($au['organisation'])));
if ($row->id>0)
{
$sql="insert into role (resid,uuid,role) values(?,?,?)";
$db->query($sql,array($row->id,$this->uuid,trim($au['role'])));
}
}
}
//处理数据限制信息
foreach($this->limits as $uselimit)
{
$sql="select id from uselimit where uselimit=?";
$row=$db->fetchRow($sql,array($uselimit));
if (!$row)
{
$sql="insert into uselimit (uselimit) values (?)";
$db->query($sql,array($uselimit));
}
$sql="select id from uselimit where uselimit=?";
$row=$db->fetchRow($sql,array($uselimit));
if ($row)
{
$sql="insert into mdlimit (uuid,lid) values(?,?)";
$db->query($sql,array($this->uuid,$row->id));
}
}
$this->save("../data/import/$this->uuid.xml");
} catch (Exception $e) {
//数据重复插入,此处忽略所有错误
print $this->uuid.' has error: '.$e->getMessage().'<br />';
}
}
function parse()

View File

@ -0,0 +1,176 @@
<?php
/**
* 生成图像验证码
*
* 代码来自 ThinkPHP Lib/ORG/Util/Image.class.php 文件,特此对 ThinkPHP 团队表示感谢 :)
*
* Custom
*
* LICENSE:
*
* @category Custom
* @package Custom
* @subpackage Controller
* @copyright Copyright (c) KenJi
* @license
* @version
*/
/**
* Zend_Controller_Plugin_Abstract
*/
//require_once 'Zend/Controller/Plugin/Abstract.php';
//require_once 'Zend/Session/Namespace.php';
class Custom_Controller_Plugin_ImgCode extends Zend_Controller_Plugin_Abstract
{
/**
+----------------------------------------------------------
* 生成图像验证码
+----------------------------------------------------------
* @static
* @access public
+----------------------------------------------------------
* @param string $length 位数
* @param string $mode 类型 0 字母 1:数字2大写字母 3:小写字母 4:以上混合形式
* @param string $type 图像格式
* @param string $width 宽度
* @param string $height 高度
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
function image2($length=4,$mode=4,$type='png',$width=50,$height=25)
{
$randval = $this->rand_string($length,$mode);//生成随机数
//$authCode = new Zend_Session_Namespace('Auth_Code');
//$authCode->imagecode = $randval;//生成session
$_SESSION['vdcodes'] = strtolower($randval);
$width = ($length*9+10)>$width?$length*9+10:$width;
if ( $type!='gif' && function_exists('imagecreatetruecolor')) {
$im = @imagecreatetruecolor($width,$height);
}else {
$im = @imagecreate($width,$height);
}
$r = Array(225,255,255,223);
$g = Array(225,236,237,255);
$b = Array(225,236,166,125);
$key = mt_rand(0,3);
$backColor = imagecolorallocate($im, $r[$key],$g[$key],$b[$key]); //背景色(随机)
$borderColor = imagecolorallocate($im, 100, 100, 100); //边框色
$pointColor = imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255)); //点颜色
@imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);
@imagerectangle($im, 0, 0, $width-1, $height-1, $borderColor);
$stringColor = imagecolorallocate($im,mt_rand(0,200),mt_rand(0,120),mt_rand(0,120));
// 干扰
for($i=0;$i<10;$i++){
$fontcolor=imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagearc($im,mt_rand(-10,$width),mt_rand(-10,$height),mt_rand(30,300),mt_rand(20,200),55,44,$fontcolor);
}
for($i=0;$i<25;$i++){
$fontcolor=imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$pointColor);
}
@imagestring($im, 5, 5, 3, $randval, $stringColor);
$this->output($im,$type);
}
// 更复杂的验证码
function image3($length=4,$type='png',$width=50,$height=60,$fontface='fpnf.ttf',$verifyName='verify') {
$code = $this->rand_string($length,4);
$width = ($length*25)>$width?$length*25:$width;
$authCode = new Zend_Session_Namespace('Auth_Code');
$authCode->imagecode = $randval;
$im=imagecreatetruecolor($width,$height);
$borderColor = imagecolorallocate($im, 100, 100, 100); //边框色
$bkcolor=imagecolorallocate($im,250,250,250);
imagefill($im,0,0,$bkcolor);
@imagerectangle($im, 0, 0, $width-1, $height-1, $borderColor);
// 干扰
for($i=0;$i<15;$i++){
$fontcolor=imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagearc($im,mt_rand(-10,$width),mt_rand(-10,$height),mt_rand(30,300),mt_rand(20,200),55,44,$fontcolor);
}
for($i=0;$i<255;$i++){
$fontcolor=imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$fontcolor);
}
if(!is_file($fontface)) {
$fontface = dirname(__FILE__)."/".$fontface;
}
for($i=0;$i<$length;$i++){
$fontcolor=imagecolorallocate($im,mt_rand(0,120),mt_rand(0,120),mt_rand(0,120)); //这样保证随机出来的颜色较深。
$codex= substr($code,$i,1);
imagettftext($im,mt_rand(16,20),mt_rand(-60,60),40*$i+20,mt_rand(30,35),$fontcolor,$fontface,$codex);
}
$this->output($im,$type);
}
function output($im,$type='png')
{
header("Content-type: image/".$type);
$ImageFun='Image'.$type;
$ImageFun($im);
imagedestroy($im);
}
/**
+----------------------------------------------------------
* 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合
+----------------------------------------------------------
* @param string $len 长度
* @param string $type 字串类型
* 0 字母 1 数字 其它 混合
* @param string $addChars 额外字符
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
function rand_string($len=6,$type='',$addChars='') {
$str ='';
switch($type) {
case 0:
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.$addChars;
break;
case 1:
$chars= str_repeat('0123456789',3);
break;
case 2:
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ'.$addChars;
break;
case 3:
$chars='abcdefghijklmnopqrstuvwxyz'.$addChars;
break;
default :
// 默认去掉了容易混淆的字符oOLl和数字01要添加请使用addChars参数
$chars='ABCDEFGHIJKMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'.$addChars;
break;
}
if($len>10 ) {//位数过长重复字符串一定次数
$chars= $type==1? str_repeat($chars,$len) : str_repeat($chars,5);
}
if($type!=4) {
$chars = str_shuffle($chars);
$str = substr($chars,0,$len);
}else{
// 中文随机字
for($i=0;$i<$len;$i++){
$str.= substr($chars, floor(mt_rand(0,mb_strlen($chars,'utf-8')-1)),1);
}
}
return $str;
}
}

View File

@ -1,50 +1,82 @@
<?php
class LoginForm extends Zend_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('login');
$username = new Zend_Form_Element_Text('username');
$username->setLabel('用户名')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$password=new Zend_Form_Element_Password('password');
$password->setLabel('密码')->setRequired(true);
$remember=new Zend_Form_Element_Checkbox('remember');
$remember->setLabel('记住我');
$id = new Zend_Form_Element_Hidden('id');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('登录');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $username, $password, $remember, $submit));
$this->clearDecorators();
$this->addDecorator('FormElements')
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'loginform'))
->addDecorator('Form');
$this->setElementDecorators(array(
array('ViewHelper'),
array('Errors'),
array('Description'),
array('Label', array('separator'=>' ')),
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
));
// buttons do not need labels
$submit->setDecorators(array(
array('ViewHelper'),
array('Description'),
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
));
}
}
<?php
class LoginForm extends Zend_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('login');
$username = new Zend_Form_Element_Text('username');
$username->setLabel('用户名')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$password=new Zend_Form_Element_Password('password');
$password->setLabel('密码')->setRequired(true);
$remember=new Zend_Form_Element_Checkbox('remember');
$remember->setLabel('记住我');
$id = new Zend_Form_Element_Hidden('id');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('登录');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $username, $password, $remember));
$this->clearDecorators();
$this->addDecorator('FormElements')
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'loginform'))
->addDecorator('Form');
/*
$this->setElementDecorators(array(
array('ViewHelper'),
array('Errors'),
array('Description'),
array('Label', array('separator'=>' ')),
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
));
*/
$captcha = $this->addElement('captcha', 'captcha', array(
'captcha' => array(
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 4,
'fontsize'=>16,
'width' => 100,
'height' => 38,
'dotNoiseLevel'=>2,
'lineNoiseLevel'=>1,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => '../data/fonts/ggbi.ttf',
// Where to put the image
'imgDir' => 'vdimg/',
// URL to the images
// This was bogus, here's how it should be... Sorry again :S
'imgUrl' => '/vdimg',
),
'label' => '验证码'
));
/*
// buttons do not need labels
$submit->setDecorators(array(
array('ViewHelper'),
array('Description'),
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
));
*/
$this->addElements(array($submit));
}
}

View File

@ -37,11 +37,12 @@ class Proftp
$sql="update ftpuser set pwd=?,ts_created=now(),ts_invalid=?,datacount=1 where userid=?";
$this->db->query($sql,array($user->password,$user->time,$user->id));
return true;
} elseif (strtotime($u['ts_invalid'])>time() && $u['datacount']<$user->maxdata) {
} elseif (strtotime($u['ts_invalid'])>time()/* && $u['datacount']<$user->maxdata*/) {
//更新数据计数
//use the old password
$sql="update ftpuser set ts_invalid=?,datacount=datacount+? where userid=?";
$this->db->query($sql,array($user->time,$user->datacount,$user->id));
//同步ftpuser和proftpusers用户密码
$sql="update ftpuser set ts_invalid=?,datacount=datacount+?,pwd=proftpusers.passwd
from proftpusers where ftpuser.userid=? and proftpusers.userid=?";
$this->db->query($sql,array($user->time,$user->datacount,$user->id,$user->username));
$sql="select pwd,ts_invalid from ftpuser where userid=?";
$u=$this->db->fetchRow($sql,array($user->id));
$this->pwd=$u['pwd'];

View File

@ -41,6 +41,7 @@ class member
else{
$sql = "select username,password from users where username='$uname'";
$rs = $this->db->query($sql);
$rs->setFetchMode(Zend_Db::FETCH_ASSOC);
$row = $rs->fetch();
$scr = $this->makescr($row['username'],$row['password']);