westdc-zf1/application/default/views/scripts/author/apply.phtml

107 lines
3.5 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/author.css');
$this->theme->AppendPlus($this,'colorbox');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<h3>请输入元数据标题关键字进行搜索</h3>
<div class="input-append">
<form id="datasearch" class="search_form">
<input class="span2" type="text" id="keyword" name="q" value="">
<button class="btn" type="button" id="search_btn" onclick="doSearch()">搜索</button>
</form>
</div>
<div id="searchlist">
</div>
</div>
</div>
<script>
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 class="well"><h4><a href="/data/'+data[i].uuid+'" target="_blank" class="title">'+data[i].title+'</a></h4><p>'+data[i].description+'</p><p>'+ct+'</p></li>');
}
$('#searchlist').html('<ul class="unstyled">'+result.join('')+'</ul>');
}
}else{
alert('无搜索结果');
}
$('#search_btn').html('搜索');
},
'beforeSend':function(){
$('#search_btn').html('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': 30000,
'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;}}
$('#datasearch').bind('submit',function(){
return false;
});
$("#keyword").die().live("keydown",function(event){
if(event.keyCode==13){
$('#search_btn').click();
}
});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
</script>