diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php
index 17564d7a..87b05020 100644
--- a/application/default/controllers/AuthorController.php
+++ b/application/default/controllers/AuthorController.php
@@ -2070,38 +2070,58 @@ class AuthorController extends Zend_Controller_Action
{
$this->_helper->viewRenderer('newdata-import');
}
- //从模板新建元数据
- else if($ac=="add")
- {
- $keywords = $this->_request->getParam('q');
+ //从模板新建元数据
+ else if($ac=="add-by-template")
+ {
+ $keywords = $this->_request->getParam('q');
+ $sql="select id,(regexp_matches(data,'(.*)'))[1] as title,(owner-$u_id) as isowner from metadata where istemplate='y' and schemaid='iso19115'";
if(!empty($keywords))
- {
- $this->view->q = $keywords;
- $sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
- left join geonetworkmetadata gn on md.uuid=gn.uuid
- WHERE gn.id is not null";
- $search=new Search($keywords);
- $where=$search->sql_expr(array("md.title","md.description"));
+ {
+ $this->view->q = $keywords;
+ $search=new Search($keywords);
+ $where=$search->sql_expr(array("data"));
$sql.=' and '.$where;
- $sql.=" order by md.ts_created desc";
- $sth = $this->db->prepare($sql);
- $sth->execute();
- $rows = $sth->fetchAll();
-
- $paginator = Zend_Paginator::factory($rows);
- $paginator->setCurrentPageNumber($this->_getParam('page'));
- $paginator->setItemCountPerPage(10);
- $paginator->setView($this->view);
- Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
- $this->view->paginator=$paginator;
}
- $sql="select id,(regexp_matches(data,'(.*)'))[1] as title from metadata where istemplate='y' and schemaid='iso19115'";
- $sth=$this->wdb->prepare($sql);
+ $sql.=" order by changedate desc";
+ $sth = $this->wdb->prepare($sql);
$sth->execute();
- $this->view->templates=$sth->fetchAll();
+ $rows = $sth->fetchAll();
+
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
$this->_helper->viewRenderer('newdata-add');
- }
-
+ }
+
+ else if($ac=="add-by-data")
+ {
+ $keywords = $this->_request->getParam('q');
+ $sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
+ left join geonetworkmetadata gn on md.uuid=gn.uuid
+ WHERE gn.id is not null";
+ if(!empty($keywords))
+ {
+ $this->view->q = $keywords;
+ $search=new Search($keywords);
+ $where=$search->sql_expr(array("md.title","md.description"));
+ $sql.=' and '.$where;
+ }
+ $sql.=" order by md.ts_created desc";
+ $sth = $this->db->prepare($sql);
+ $sth->execute();
+ $rows = $sth->fetchAll();
+
+ $paginator = Zend_Paginator::factory($rows);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+ $paginator->setItemCountPerPage(10);
+ $paginator->setView($this->view);
+ Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
+ $this->view->paginator=$paginator;
+ $this->_helper->viewRenderer('newdata-add-bydata');
+ }
//提交数据
else if($ac=="commit")
{
diff --git a/application/default/views/scripts/author/newdata-add-bydata.phtml b/application/default/views/scripts/author/newdata-add-bydata.phtml
new file mode 100644
index 00000000..43215354
--- /dev/null
+++ b/application/default/views/scripts/author/newdata-add-bydata.phtml
@@ -0,0 +1,63 @@
+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->headScript()->appendFile('/js/jquery.colorbox-min.js');
+$this->headLink()->appendStylesheet('/css/colorbox.css');
+$this->breadcrumb('首页');
+$this->breadcrumb('数据作者');
+$this->breadcrumb('新建数据');
+$this->breadcrumb()->setSeparator(' > ');
+?>
+
+
+
+
+
+
+
+
+
+
根据已有数据创建元数据
+
+ paginator)):
+ echo "
";
+ $autoindex=0;
+ foreach ($this->paginator as $item):
+ $autoindex++;
+ ?>
+ -
+
+ 【以此为模板新建
+ | 查看数据】
+ 400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
+
+ ";
+ endif; ?>
+
+
= $this->paginator; ?>
+
+
+
\ No newline at end of file
diff --git a/application/default/views/scripts/author/newdata-add.phtml b/application/default/views/scripts/author/newdata-add.phtml
index cfb51d57..d7da4abc 100644
--- a/application/default/views/scripts/author/newdata-add.phtml
+++ b/application/default/views/scripts/author/newdata-add.phtml
@@ -25,21 +25,14 @@ $this->breadcrumb()->setSeparator(' > ');
-templates) : ?>
根据预制元数据模板创建数据
-
-templates as $item) : ?>
-
-
-
-
-
根据已有元数据来创建数据
-
@@ -49,12 +42,15 @@ $this->breadcrumb()->setSeparator(' > ');
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;
- ?>
-
+ ?>
+
- 【以此为模板新建
- | 查看数据】
- 400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
+ 【以此为模板新建
+ isadmin || $item['isowner']==0) : ?>
+ | 修改此模板
+ | 查看此模板
+
+ 】