添加冰川数据子集选择功能

This commit is contained in:
Li Jianxuan 2014-05-15 09:27:41 +00:00
parent df1f6d3a22
commit 9b83ce6a8c
6 changed files with 273 additions and 32 deletions

View File

@ -1068,7 +1068,6 @@ class DataController extends Zend_Controller_Action
$dataservice = new \data\DataService();
$info = $dataservice->get($uuid);
//暂时只有wsn
{
$this->_helper->layout->disableLayout();
@ -1103,6 +1102,40 @@ class DataController extends Zend_Controller_Action
}
public function glacierAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->_getParam("uuid");
$basin = $this->getParam("basin");
$mountain = $this->getParam("mountain");
if(empty($basin) && empty($mountain))
{
$this->jsonexit(array("error"=>'please select sub dataset'));
return true;
}
$selections = array(
'basin' => $basin,
'mountain' => $mountain
);
$order = new Order();
$state = $order->addOrder($uuid,$selections);
if($state !== true)
{
$this->jsonexit(array("error"=>$state));
return true;
}else{
$this->jsonexit(array('success'=>'Success! You can add more dataset or submit your application.'));
return true;
//$this->view->msg = view::Msg('alert-success',"Success! You can add more dataset or submit your application.");
}
}
public function wsnAction()
{
$this->_helper->layout->disableLayout();
@ -2191,6 +2224,7 @@ class DataController extends Zend_Controller_Action
$wsn = $this->_request->getParam('wsn');
$pdf = $this->_request->getParam('pdf');
$selections = $this->_request->getParam('data');
//if (empty($uuid)) $this->_redirect('/data');
$userid = view::User('id');

View File

@ -500,8 +500,8 @@ var bound = {
<div class="modal-body">
<h4>按流域</h4>
<p>
<a href="" class="btn btn-default">黄河流域</a>
<a href="" class="btn btn-default">长江流域</a>
<a href="/data/todownload/?uuid=" class="btn btn-default">黄河流域</a>
<a href="/data/todownload/?uuid=<?= $md->uuid?>" class="btn btn-default">长江流域</a>
<a href="" class="btn btn-default">黑河流域</a>
<a href="" class="btn btn-default">塔里木河流域</a>
</p>

View File

@ -0,0 +1,192 @@
<!-- Modal -->
<div id="selectDataWindow" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Select sub dataset</h3>
</div>
<div class="modal-body">
<form id="dataservice-glacier-form" method="post">
<table class="table table-bordered table-striped">
<colgroup>
<col class="span1">
<col class="span7">
</colgroup>
<thead>
<tr>
<th><button class="btn btn-success" type="button" id="creattp">By basin</button>&nbsp;<button type="button" class="btn btn-primary" id="primary">By mountain</button></th>
</tr>
</thead>
<tbody id="creat">
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="basin[]" value="Ili River">
Ili River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox2" name="basin[]" value="Ertix River">
Ertix River </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox3" name="basin[]" value="Hotan River">
Hotan River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox4" name="basin[]" value="Indus River">
Indus River </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox5" name="basin[]" value="Ganges Rive">
Ganges Rive </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox6" name="basin[]" value="Hobodo River">
Hobodo River </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox7" name="basin[]" value="Kaxgar River">
Kaxgar River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox8" name="basin[]" value="Yellow River">
Yellow River </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox9" name="basin[]" value="Yangtze River">
Yangtze River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox10" name="basin[]" value="Yarkant River">
Yarkant River </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox11" name="basin[]" value="Qaidam Inland Basins">
Qaidam Inland Basins </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox12" name="basin[]" value="Junggar Inland Basins">
Junggar Inland Basins </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox13" name="basin[]" value="Lantsang (Mekong) River">
Lantsang (Mekong) River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox15" name="basin[]" value="Turpan-Hami Inland Basins">
Turpan-Hami Inland Basins </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox16" name="basin[]" value="Hexi Corridor Inland Basins">
Hexi Corridor Inland Basins </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox17" name="basin[]" value="Northern Tarim Inland Basins">
Northern Tarim Inland Basins </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox18" name="basin[]" value="Southern Tarim Inland Basins">
Southern Tarim Inland Basins </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox19" name="basin[]" value="Central Tibetan Plateau Inland Basins">
Central Tibetan Plateau Inland Basins </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox20" name="basin[]" value="Eastern Tibetan Plateau Inland Basins">
Eastern Tibetan Plateau Inland Basins </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox21" name="basin[]" value="Western Tibetan Plateau Inland Basins">
Western Tibetan Plateau Inland Basins </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox22" name="basin[]" value="Upstream Basins of Yarlung Zangbo (Brahmaputra) River">
Upstream Basins of Yarlung Zangbo (Brahmaputra) River </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox23" name="basin[]" value="Downstream Basins of Yarlung Zangbo (Brahmaputra) River">
Downstream Basins of Yarlung Zangbo (Brahmaputra) River </label></td>
</tr>
</tbody>
<tbody id="tp-role" class="hidden">
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="mountain[]" value="Altai Mountain">
Altai Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox2" name="mountain[]" value="Altun Mountain">
Altun Mountain </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox3" name="mountain[]" value="Gangdise Mountain ">
Gangdise Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox4" name="mountain[]" value="Hengduan Mountain">
Hengduan Mountain </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox5" name="mountain[]" value="Himalaya Mountain">
Himalaya Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox6" name="mountain[]" value="Karakoram Mountain">
Karakoram Mountain </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox7" name="mountain[]" value="Kunlun Mountain">
Kunlun Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox8" name="mountain[]" value="Muztau Range">
Muztau Range </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox9" name="mountain[]" value="Nyainqêntanglha Mountain">
Nyainqêntanglha Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox10" name="mountain[]" value="Pamir">
Pamir </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox11" name="mountain[]" value="Qangtang Plateau">
Qangtang Plateau </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox12" name="mountain[]" value="Qilian Mountain">
Qilian Mountain </label></td>
</tr>
<tr>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox13" name="mountain[]" value="Tanggula Mountain">
Tanggula Mountain </label></td>
<td><label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox14" name="mountain[]" value="Tienshan Mountain">
Tienshan Mountain </label></td>
</tr>
</tbody>
</table>
<input type="hidden" name="uuid" value="<?= $this->uuid ?>"/>
</form>
</div>
<div class="modal-footer">
<button type="button" onclick="westdc.dataservice.geoData()" class="btn btn-success">Apply</button>
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<script>
$(document).ready(function(){
$("#creattp").click(function(){
$("#creat").removeClass("hidden");
$("#tp-role").addClass("hidden");
});
$("#primary").click(function(){
$("#tp-role").removeClass("hidden");
$("#creat").addClass("hidden");
});
});
</script>

View File

@ -478,45 +478,20 @@ var bound = {
<?php else: ?>
<p>Cannot find the metadata.</p>
<?php endif;?>
<?php if(!empty($this->dataService)) { ?>
<?php if($this->dataService['service_type'] == 2) { ?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<script src="/js/lib/custom/models/dataservice.js"></script>
<?php }else if($this->dataService['service_type'] == 3) {?>
<?php $this->theme->AppendPlus($this,'datepicker'); ?>
<!-- <script src="/js/lib/custom/models/dataservice.geodata.js"></script> -->
<script src="/js/lib/custom/models/dataservice.geodata.js"></script>
<?php } ?>
<?php } ?>
<?php if(!empty($this->dataService)) { ?>
<?php if($this->dataService['service_type'] == 2) { ?>
<?php }else if($this->dataService['service_type'] == 3) {?>
<!-- Modal -->
<div id="selectDataWindow" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">选择数据范围</h3>
</div>
<div class="modal-body">
<h4>按流域</h4>
<p>
<a href="" class="btn btn-default">黄河流域</a>
<a href="" class="btn btn-default">长江流域</a>
<a href="" class="btn btn-default">黑河流域</a>
<a href="" class="btn btn-default">塔里木河流域</a>
</p>
<hr />
<h4>按山脉</h4>
<p>
<a href="" class="btn btn-default">祁连山脉</a>
<a href="" class="btn btn-default">天山山脉</a>
<a href="" class="btn btn-default">昆仑山脉</a>
<a href="" class="btn btn-default">横断山山脉</a>
</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
<?= $this->partial('glacier/view-glacier-selection.phtml',array('uuid'=>$md->uuid)); ?>
<?php } ?>
<?php } ?>

View File

@ -124,7 +124,12 @@ class Order
$rs = $this->db->query($sql,array($uuid,$uid,1));
}else{
$sql="insert into dataorder (uuid,ts_created,userid,status,selection) values(?,now(),?,?,?)";
$rs = $this->db->query($sql,array($uuid,$uid,1,$selection));
if(!is_array($selection))
{
$rs = $this->db->query($sql,array($uuid,$uid,1,$selection));
}else{
$rs = $this->db->query($sql,array($uuid,$uid,1,json_encode($selection,JSON_NUMERIC_CHECK)));
}
}
if($rs)

View File

@ -0,0 +1,35 @@
westdc.dataservice = {
geoData : function()
{
$.ajax({
'type':"POST",
'url':'/data/glacier/',
'data':$('#dataservice-glacier-form').serialize(),
'success':function(data){
if(typeof(data) == 'undefined')
{
alert("data source error ,please contact administrator");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
if(!$.isEmptyObject(data.success))
{
window.location = '/data/order/ac/offline1';
return true;
}else{
alert('An error occurred,please try agian');
return false;
}
},
'timeout': 30000,
'error': function(){
alert('出现错误,请刷新后重试');
}
});
},
}