修改高级搜索中的bug,修改相关文献和相关搜索部分

This commit is contained in:
Li Jianxuan 2013-04-15 02:34:12 +00:00
parent 4dfafbb55b
commit 1576d6f258
3 changed files with 678 additions and 703 deletions

View File

@ -135,7 +135,7 @@ function setRectangle(east,west,south,north){
google.maps.event.addListener(rectangle, 'bounds_changed', function () { google.maps.event.addListener(rectangle, 'bounds_changed', function () {
var latlng = rectangle.getBounds(); var latlng = rectangle.getBounds();
MapValueChange(latlng.ca.d,latlng.Z.d,latlng.ca.b,latlng.Z.b); MapValueChange(latlng.fa.d,latlng.Z.d,latlng.fa.b,latlng.Z.b);
//console.dir(latlng); //console.dir(latlng);
}); });

File diff suppressed because it is too large Load Diff

View File

@ -1,198 +1,166 @@
function postcomment(){ function postcomment(){
var url="/data/postcomment"; var url="/data/postcomment";
var date = $('#postcommentform').serialize(); var date = $('#postcommentform').serialize();
$.ajax({ $.ajax({
'type':"POST", 'type':"POST",
'url':url, 'url':url,
'data':date, 'data':date,
'success':function(html){ 'success':function(html){
$('#postcomment').html('提交'); $('#postcomment').html('提交');
setTimeout("$('#postcomment').removeAttr('disabled');",3000); setTimeout("$('#postcomment').removeAttr('disabled');",3000);
$('#returninfo').html(html); $('#returninfo').html(html);
ajaxpage(0); ajaxpage(0);
}, },
'beforeSend':function(){ 'beforeSend':function(){
$('#postcomment').attr('disabled','disabled'); $('#postcomment').attr('disabled','disabled');
$('#postcomment').html('<img src="/images/11887177066.gif" />正在提交...'); $('#postcomment').html('<img src="/images/11887177066.gif" />正在提交...');
} }
}); });
} }
function getSubFileList(uuid,id,depth){ function getSubFileList(uuid,id,depth){
if($("#div_"+id).length>0) if($("#div_"+id).length>0)
{ {
$('#span_'+id).html('+'); $('#span_'+id).html('+');
$("#div_"+id).remove(); $("#div_"+id).remove();
return false; return false;
} }
$('<div/>', { $('<div/>', {
'style':'overflow:auto;', 'style':'overflow:auto;',
'id': 'div_'+id, 'id': 'div_'+id,
"html": '<li><img src="/images/loading.gif" />加载中</li>' "html": '<li><img src="/images/loading.gif" />加载中</li>'
}).appendTo('#li_'+id); }).appendTo('#li_'+id);
url="/service/subfilelist/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth; url="/service/subfilelist/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth;
$.getJSON(url, function(data) { $.getJSON(url, function(data) {
var items = []; var items = [];
$.each(data, function(key, val) { $.each(data, function(key, val) {
if(val['filename'].match(/\/$/)) if(val['filename'].match(/\/$/))
{ {
items.push('<li id="li_' + val['id'] + '"><span id="span_'+val['id']+'">+</span> <a href="javascript:;" id="taget_'+val['id']+'" onclick="getSubFileList(\'' +val['uuid']+ '\',\''+val['id']+'\',\''+val['depth']+'\')">' + val['filename'] + '</a></li>'); items.push('<li id="li_' + val['id'] + '"><span id="span_'+val['id']+'">+</span> <a href="javascript:;" id="taget_'+val['id']+'" onclick="getSubFileList(\'' +val['uuid']+ '\',\''+val['id']+'\',\''+val['depth']+'\')">' + val['filename'] + '</a></li>');
}else{ }else{
items.push('<li id="' + key + '">' + val['filename'] + '</li>'); items.push('<li id="' + key + '">' + val['filename'] + '</li>');
} }
}); });
$("#div_"+id).html(items.join('')); $("#div_"+id).html(items.join(''));
}).complete(function(){ }).complete(function(){
if($("#div_"+id)){ if($("#div_"+id)){
$('#span_'+id).html('-'); $('#span_'+id).html('-');
} }
}); });
} }
function googleSearch(keyword){ function googleSearch(keyword){
$.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword, $.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword,
success:function(html){ success:function(html){
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
$.each(obj.responseData.results, function(key, val) { $.each(obj.responseData.results, function(key, val) {
var html = '<p><a href="' +val['unescapedUrl']+'">'+val['title']+'<a/></p><p><span>' var html = '<p><a href="' +val['unescapedUrl']+'">'+val['title']+'<a/></p><p><span>'
+val['url'].replace(/%(.*)/i,"") +'</span></p><p>' +val['url'].replace(/%(.*)/i,"") +'</span></p><p>'
+val['content'] +val['content']
+'</p>'; +'</p>';
items.push('<li>' + html + '</li>'); items.push('<li>' + html + '</li>');
}); });
items.push('<li class="more"><a href="'+obj.responseData.cursor.moreResultsUrl+'" target="_blank">查看更多搜索结果(约'+obj.responseData.cursor.estimatedResultCount+'条)</a></div>'); items.push('<li class="more"><a href="'+obj.responseData.cursor.moreResultsUrl+'" target="_blank">查看更多搜索结果(约'+obj.responseData.cursor.estimatedResultCount+'条)</a></div>');
$('#searchlist').html(items.join('')); $('#searchlist').html(items.join(''));
searchFinish(); searchFinish();
}, },
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}, beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');},
error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');}
}); });
} }
function scholarSearch(keyword){ function scholarSearch(keyword){
$.ajax({type:"POST",url:"/service/scholarsearch",data:'q='+keyword, $.ajax({type:"POST",url:"/service/scholarsearch",data:'q='+keyword,
success:function(html){ success:function(html){
//$('#searchlist').html(html);return false; //$('#searchlist').html(html);return false;
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
if(obj.error != '') if(obj.error != '')
{ {
items.push('<li>' + obj.error + '</li>'); items.push('<li>' + obj.error + '</li>');
}else{ }else{
$.each(obj.result, function(key, val) { $.each(obj.result, function(key, val) {
var html = val['title'] var html = val['title']
+'<p>' +'<p>'
+val['content'] +val['content']
+'</p>'; +'</p>';
items.push('<li>' + html + '</li>'); items.push('<li>' + html + '</li>');
}); });
} }
items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>'); items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>');
$('#searchlist').html(items.join('')); $('#literature-list').html(items.join(''));
searchFinish(); searchFinish();
}, },
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}, beforeSend:function(){$('#literature-list').html('<img src="/images/loading.gif" />结果加载中');},
error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} error:function(){$('#literature-list').html('');Alert('检索中发现错误,请稍后重试或直接访问');}
}); });
} }
function bingSearch(keyword){ function cnkiSearch(keyword){
$.ajax({type:"POST",url:"/service/bingsearch",data:'q='+keyword, $.ajax({type:"POST",url:"/service/cnkisearch",data:'q='+keyword,
success:function(html){ success:function(html){
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
if($.isArray(obj.SearchResponse.Web)) if(obj.error != '')
{ {
if(obj.SearchResponse.Web.Total==0) items.push('<li>' + obj.error + '</li>');
{ }else{
$('#searchlist').html("No results!"); $.each(obj.result, function(key, val) {
return false; var html = '<p><a href="' +val['url']+'" target="_blank">'+val['title']+'</a></p><p><span>'
} +val['url'].replace(/%(.*)/i,"") +'</span></p><p>'
$.each(obj.SearchResponse.Web.Results, function(key, val) { +val['content']
var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>' +'</p>';
+val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>'
+val['Description'] items.push('<li>' + html + '</li>');
+'</p>'; });
items.push('<li>' + html + '</li>'); }
}); items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>');
items.push('<li class="more"><a href="http://cn.bing.com/search?q='+encodeURIComponent(keyword)+ $('#literature-list').html(items.join(''));
'&go=&qs=n&sk=&form=QBLH" target="_blank">查看更多搜索结果(约'+obj.SearchResponse.Web.Total+'条)</a></div>'); searchFinish()
}else{ },
Alert('暂无搜索结果');$('#searchlist').html(''); beforeSend:function(){$('#literature-list').html('<img src="/images/loading.gif" />结果加载中');},
} error:function(){Alert('检索中发现错误,请稍后重试或直接访问');$('#literature-list').html('');}
$('#searchlist').html(items.join('')); });
searchFinish(); }
},
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}, function searchFinish()
error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} {
}); $('html, body').animate({scrollTop:$('#gsearch_t').offset().top}, 'slow');
} }
function cnkiSearch(keyword){ function dataVersion(uuid)
$.ajax({type:"POST",url:"/service/cnkisearch",data:'q='+keyword, {
success:function(html){ $.ajax({
var items = []; 'type':"POST",
var obj = jQuery.parseJSON(html); 'url':'/data/getversion',
if(obj.error != '') 'data':'ac=list&uuid='+uuid,
{ 'success':onDataVersionLoad,
items.push('<li>' + obj.error + '</li>'); 'timeout': 30000,
}else{ 'error': function(){Alert('处理中出现错误,请刷新页面后重试');return false;}
$.each(obj.result, function(key, val) { });
var html = '<p><a href="' +val['url']+'" target="_blank">'+val['title']+'</a></p><p><span>'
+val['url'].replace(/%(.*)/i,"") +'</span></p><p>' }
+val['content'] function onDataVersionLoad(data){
+'</p>'; if (typeof(data)=='object')
{
items.push('<li>' + html + '</li>'); if(typeof(data.error)!='undefined')
}); {Alert(data.error);return false;}
} if(typeof(data.list)!='undefined')
items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>'); {
$('#searchlist').html(items.join('')); var html = "";
searchFinish() for(v in data.list)
}, {
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}, html+='<li><p>'+data.list[v].changelog+'</p><p>'+data.list[v].ts_created+' by '+data.list[v].username+'</p></li>';
error:function(){Alert('检索中发现错误,请稍后重试或直接访问');$('#searchlist').html('');} }
}); $.colorbox({'innerWidth':'50%','innerHeight':'80%','html':'<div class="datalist"><ul>'+html+'</ul></div>'});
} }
}
function searchFinish() else{
{ Alert('出现错误,请稍后再试');return false;
$('html, body').animate({scrollTop:$('#gsearch_t').offset().top}, 'slow'); }
} }
function dataVersion(uuid) function Alert(html){
{ $.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
$.ajax({
'type':"POST",
'url':'/data/getversion',
'data':'ac=list&uuid='+uuid,
'success':onDataVersionLoad,
'timeout': 30000,
'error': function(){Alert('处理中出现错误,请刷新页面后重试');return false;}
});
}
function onDataVersionLoad(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(typeof(data.list)!='undefined')
{
var html = "";
for(v in data.list)
{
html+='<li><p>'+data.list[v].changelog+'</p><p>'+data.list[v].ts_created+' by '+data.list[v].username+'</p></li>';
}
$.colorbox({'innerWidth':'50%','innerHeight':'80%','html':'<div class="datalist"><ul>'+html+'</ul></div>'});
}
}
else{
Alert('出现错误,请稍后再试');return false;
}
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
} }