2012-03-06 08:06:54 +00:00
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/author.css');
2013-03-27 09:06:23 +00:00
$this->theme->AppendPlus($this,'colorbox');
2012-03-06 08:06:54 +00:00
$this->breadcrumb('< a href = "/" > 首页< / a > ');
$this->breadcrumb('< a href = "/author" > 数据作者< / a > ');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
?>
2013-03-27 09:06:23 +00:00
< div class = "row" >
< div class = "span3" >
<? = $this -> partial ( 'author/navi.phtml' ); ?>
2012-03-06 08:06:54 +00:00
< / div >
2013-03-27 09:06:23 +00:00
< 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 >
2012-03-06 08:06:54 +00:00
< / div >
< / div >
< script >
2013-05-29 07:36:44 +00:00
$(document).ready(function(e) {
$.ajax({
'type':"POST",
'url':'/author/apply',
'data':'ac=mydata',
'success':function(data){
datareceive(data);
},
'beforeSend':function(){
$('#search_btn').html('Searching...');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
}
});
});
2012-03-06 08:06:54 +00:00
function doSearch(){
$.ajax({
'type':"POST",
'url':'/author/apply',
'data':'ac=search& q='+$('#keyword').val(),
'success':function(data){
2013-05-29 07:36:44 +00:00
datareceive(data);
2012-03-06 08:06:54 +00:00
},
'beforeSend':function(){
2013-03-27 09:06:23 +00:00
$('#search_btn').html('Searching...');
2012-03-07 03:48:40 +00:00
},
2012-03-07 04:00:23 +00:00
'timeout': 20000,
2012-03-07 03:48:40 +00:00
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
2013-05-29 07:36:44 +00:00
}
});
}
function datareceive(data){
if (isObject(data))
{
if(typeof(data.error)!='undefined')
{
alert(data.error);
}else{
var result = new Array();
for(i=0;i< data.length ; i + + )
{
2013-06-09 04:26:41 +00:00
if(data[i].status==1 && data[i].userid==<?php echo $this -> id ; ?> ) var ct='< img src = "/images/list_links.gif" /> 您是此元数据的作者';
else if (data[i].status==0 && data[i].userid==<?php echo $this -> id ; ?> ) var ct='< img src = "/images/list_extensions.gif" /> 您已经申请成为该元数据作者,请前往 < a href = "/author/accept" > 我的数据</ a > 查看< span id = "data_'+data[i].uuid+'" ></ span > ';
2013-05-29 07:36:44 +00:00
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('搜索');
2012-03-06 08:06:54 +00:00
}
2013-05-29 07:36:44 +00:00
2012-03-06 08:06:54 +00:00
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" / > 正在处理...');
2012-03-07 03:48:40 +00:00
},
2012-03-21 03:02:26 +00:00
'timeout': 30000,
2012-03-07 03:48:40 +00:00
'error': function(){
alert('处理中出现问题,请重试');
$('#data_'+uuid).html('');
}
2012-03-06 08:06:54 +00:00
});
}
function isObject(obj){if(typeof(obj)=='object'){return true;}else if(typeof(obj)!='object'){return false;}else{return false;}}
2012-03-22 09:53:35 +00:00
$('#datasearch').bind('submit',function(){
return false;
});
$("#keyword").die().live("keydown",function(event){
if(event.keyCode==13){
$('#search_btn').click();
}
});
2013-03-27 09:06:23 +00:00
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
2012-03-06 08:06:54 +00:00
< / script >