diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php
index 56072932..10d95ea8 100755
--- a/application/default/controllers/DataController.php
+++ b/application/default/controllers/DataController.php
@@ -654,7 +654,7 @@ class DataController extends Zend_Controller_Action
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- $uuid=$this->_request->getParam('uuid');
+ $uuid=$this->_request->getParam('uuid');
if (empty($uuid)) die();
$sql="select * from comments where uuid=? order by id desc";
$comments=$this->db->fetchAll($sql,array($uuid));
@@ -669,7 +669,143 @@ class DataController extends Zend_Controller_Action
print "
";
}
}//else echo "No comments.";
- }
+ }
+
+ function creatform($datas) {
+ return '
+ 温馨提示:您需要填写以下信息才可以下载该数据
+ ';
+ }
+ /*
+ * 判断用户是否填写了申请信息
+ * @param string $uuid
+ * @param int $userid
+ */
+ function todownloadAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $uuid = $this->_request->getParam('uuid');
+ $ft = $this->_request->getParam('ft');
+
+ if (empty($uuid)) $this->_redirect('/data');
+
+ $datas = array();
+ $submited = $this->_request->getParam('submited');
+ $datas['username'] = $this->_request->getParam('username');
+ $datas['unit'] = $this->_request->getParam('unit');
+ $datas['phone'] = $this->_request->getParam('phone');
+ $datas['address'] = $this->_request->getParam('address');
+ $datas['postcode'] = $this->_request->getParam('postcode');
+ $datas['email'] = $this->_request->getParam('email');
+ $datas['project'] = $this->_request->getParam('project');
+
+ $userid=Zend_Auth::getInstance()->getIdentity()->id;
+
+ $form=$this->creatform($datas);
+
+ if (!empty($submited) && $ft==0){
+
+ foreach($datas as $k=>$v)
+ {
+ if(empty($v))
+ {
+ echo $form.'';
+ exit();
+ }
+ $datas[$k]=preg_replace("/\"/i","'",$v);
+ }
+
+ if(!is_numeric($datas['postcode']))
+ {
+ echo $form.'';
+ exit();
+ }
+
+ if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email']))
+ {
+ echo $form.'';
+ exit();
+ }
+
+ $sql="insert into onlineapp (userid,username,unit,phone,address,postcode,project,uuid,email)
+ values ('$userid','{$datas['username']}','{$datas['unit']}','{$datas['phone']}','{$datas['address']}','{$datas['postcode']}','{$datas['project']}','$uuid','{$datas['email']}')
+ ";
+
+ if($this->db->exec($sql))
+ {
+ echo "您的信息已经提交成功,可以进行下载。
+ 如果页面没有自动跳转,请点击这里进入下载页面
+ ";
+ exit();
+ }
+ else {
+ echo $form.'';
+ exit();
+ }
+
+ }else if( $ft==1 )
+ {
+ $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc";
+ $result=$this->db->query($testsql);
+ $rows = $result->fetch();
+ if (empty($rows['id']))
+ {
+ $sql="select * from users where id='$userid'";
+ $result=$this->db->query($sql);
+ $rows = $result->fetch();
+
+ $datas['username'] = $rows['realname'];
+ $datas['unit'] = $rows['unit'];
+ $datas['phone'] = $rows['phone'];
+ $datas['address'] = $rows['address'];
+ //$datas['postcode'] = $rows['postcode'];
+ $datas['email'] = $rows['email'];
+ $datas['project'] = $rows['project'];
+
+ echo $this->creatform($datas);
+ exit();
+ }
+ else
+ {
+ $datas['username'] = $rows['username'];
+ $datas['unit'] = $rows['unit'];
+ $datas['phone'] = $rows['phone'];
+ $datas['address'] = $rows['address'];
+ $datas['postcode'] = $rows['postcode'];
+ $datas['email'] = $rows['email'];
+ $datas['project'] = $rows['project'];
+
+ echo $this->creatform($datas);
+ exit();
+ }
+ }
+
+ }
+
/*
* 数据下载,根据UUID进行判断
* 一次只下载一个数据(一个元数据项)
@@ -679,6 +815,18 @@ class DataController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid');
if (empty($uuid)) $this->_redirect('/data');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
+ /*
+ * 判断用户是否浑水摸鱼的去下载
+
+ $testsql="select id from onlineapp where userid='$userid' and uuid='$uuid'";
+ $result=$this->db->query($sql,$id);
+ $rows = $result->fetch();
+ if (empty($rows['id']))
+ {
+ $this->_redirect('/data/'.$uuid);
+ }
+ */
+ // block end!
$this->view->username='westdc'.Zend_Auth::getInstance()->getIdentity()->id;
$sql=$this->db->quoteInto("select o.* from onlineresource o left join metadata m on o.uuid=m.uuid where m.datatype=0 and m.uuid=?",$uuid);
$rows=$this->db->fetchAll($sql);
diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml
index e20f5472..31af2d62 100755
--- a/application/default/views/scripts/data/view.phtml
+++ b/application/default/views/scripts/data/view.phtml
@@ -14,7 +14,7 @@
$this->headScript()->appendFile('/js/prototype.js');
$this->headScript()->appendFile('/js/OpenLayers.js');
- $this->headScript()->appendFile('/js/window.js');
+ $this->headScript()->appendFile('/js/window.js');
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
?>
metadata;if ($md):?>
@@ -97,7 +97,7 @@ else
@@ -252,30 +252,6 @@ echo '';
数据评论
-
commentForm; ?>
@@ -290,8 +266,42 @@ function reportError(request)
-
+
".($c['content'])."