From 56e5dcc0cc38d229e9e847094118b0f5dfc61958 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 10 Apr 2013 09:44:56 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84js=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/views/scripts/data/view.phtml | 241 +----------------- .../default/views/scripts/heihe/view.phtml | 205 ++------------- .../default/views/scripts/water/view.phtml | 236 +---------------- htdocs/js/metadata-view.js | 230 +++++++++++++++++ 4 files changed, 267 insertions(+), 645 deletions(-) create mode 100644 htdocs/js/metadata-view.js diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index 48a553ca..d40429cb 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -116,7 +116,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?> @@ -132,8 +132,7 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?>
  • Google学术搜索
  • CNKI学术搜索
  • - +
    downhistory) : ?> @@ -247,6 +246,7 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> if($v['keytype'] == "category"){ $title = "类别"; }else if($v['keytype'] == "discipline"){$title = "学科"; }else if($v['keytype'] == "place"){$title = "地点"; + }else if($v['keytype'] == "temporal"){$title = "时间"; }else if($v['keytype'] == "theme"){ $title = "主题"; } $keys[$title][] = $v['keyword']; @@ -401,20 +401,9 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?>
    - - + diff --git a/application/default/views/scripts/heihe/view.phtml b/application/default/views/scripts/heihe/view.phtml index 2c77600f..e6054fff 100755 --- a/application/default/views/scripts/heihe/view.phtml +++ b/application/default/views/scripts/heihe/view.phtml @@ -404,49 +404,9 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> - - - - + diff --git a/application/default/views/scripts/water/view.phtml b/application/default/views/scripts/water/view.phtml index 1201d0c7..fb0e7460 100755 --- a/application/default/views/scripts/water/view.phtml +++ b/application/default/views/scripts/water/view.phtml @@ -379,7 +379,7 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?>
  • 元数据更新时间:ts_created)); ?> 查看XML源文件Word doc格式
  • version->c>0):?> -
  • 版本历史:version->c ?> 个
  • +
  • 版本历史:version->c ?> 个
  • @@ -403,30 +403,9 @@ if ($md->title_en) echo '
    '.$this->escape($md->title_en);?> - - - - + diff --git a/htdocs/js/metadata-view.js b/htdocs/js/metadata-view.js new file mode 100644 index 00000000..515d94ea --- /dev/null +++ b/htdocs/js/metadata-view.js @@ -0,0 +1,230 @@ +function postcomment(){ + var url="/data/postcomment"; + var date = $('#postcommentform').serialize(); + $.ajax({ + 'type':"POST", + 'url':url, + 'data':date, + 'success':function(html){ + $('#postcomment').html('提交'); + setTimeout("$('#postcomment').removeAttr('disabled');",3000); + $('#returninfo').html(html); + ajaxpage(0); + }, + 'beforeSend':function(){ + $('#postcomment').attr('disabled','disabled'); + $('#postcomment').html('正在提交...'); + } + }); +} + +function getFileList(){ + html ='
    ' + + '
    ' + + '
    ' + + '
    加载中...
    ' + + '
      ' + + '
    ' + + '
    ' + + '
    ' + +'
    '; + $.colorbox({width:"80%",height:"80%",html:html}); + $.getJSON("/service/filelist/uuid/uuid;?>", function(data) { + var items = []; + if(data.length>0) + { + $.each(data, function(key, val) { + if(val['filename'].match(/\/$/)) + { + items.push('
  • + ' + val['filename'] + '
  • '); + }else{ + items.push('
  • ' + val['filename'] + '
  • '); + } + }); + }else{ + items.push('
  • 暂无数据
  • '); + } + $('#file-list').html(items.join('')); + }) + .complete(function() { + $('#window-loading').hide(); + }); +} +function getSubFileList(uuid,id,depth){ + if($("#div_"+id).length>0) + { + $('#span_'+id).html('+'); + $("#div_"+id).remove(); + return false; + } + $('
    ', { + 'style':'overflow:auto;', + 'id': 'div_'+id, + "html": '
  • 加载中
  • ' + }).appendTo('#li_'+id); + url="/service/subfilelist/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth; + $.getJSON(url, function(data) { + var items = []; + $.each(data, function(key, val) { + if(val['filename'].match(/\/$/)) + { + items.push('
  • + ' + val['filename'] + '
  • '); + }else{ + items.push('
  • ' + val['filename'] + '
  • '); + } + }); + $("#div_"+id).html(items.join('')); + }).complete(function(){ + if($("#div_"+id)){ + $('#span_'+id).html('-'); + } + }); +} + +function googleSearch(keyword){ + $.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword, + success:function(html){ + var items = []; + var obj = jQuery.parseJSON(html); + $.each(obj.responseData.results, function(key, val) { + var html = '

    '+val['title']+'

    ' + +val['url'].replace(/%(.*)/i,"") +'

    ' + +val['content'] + +'

    '; + items.push('
  • ' + html + '
  • '); + }); + items.push('
  • 查看更多搜索结果(约'+obj.responseData.cursor.estimatedResultCount+'条)
  • '); + $('#searchlist').html(items.join('')); + searchFinish(); + }, + beforeSend:function(){$('#searchlist').html('结果加载中');}, + error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} + }); +} + +function scholarSearch(keyword){ + $.ajax({type:"POST",url:"/service/scholarsearch",data:'q='+keyword, + success:function(html){ + //$('#searchlist').html(html);return false; + var items = []; + var obj = jQuery.parseJSON(html); + if(obj.error != '') + { + items.push('
  • ' + obj.error + '
  • '); + }else{ + $.each(obj.result, function(key, val) { + var html = val['title'] + +'

    ' + +val['content'] + +'

    '; + items.push('
  • ' + html + '
  • '); + }); + } + items.push('
  • 查看更多搜索结果'); + $('#searchlist').html(items.join('')); + searchFinish(); + }, + beforeSend:function(){$('#searchlist').html('结果加载中');}, + error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} + }); +} + +function bingSearch(keyword){ + $.ajax({type:"POST",url:"/service/bingsearch",data:'q='+keyword, + success:function(html){ + var items = []; + var obj = jQuery.parseJSON(html); + if($.isArray(obj.SearchResponse.Web)) + { + if(obj.SearchResponse.Web.Total==0) + { + $('#searchlist').html("No results!"); + return false; + } + $.each(obj.SearchResponse.Web.Results, function(key, val) { + var html = '

    '+val['Title']+'

    ' + +val['DisplayUrl'].replace(/%(.*)/i,"") +'

    ' + +val['Description'] + +'

    '; + items.push('
  • ' + html + '
  • '); + }); + items.push('
  • 查看更多搜索结果(约'+obj.SearchResponse.Web.Total+'条)'); + }else{ + Alert('暂无搜索结果');$('#searchlist').html(''); + } + $('#searchlist').html(items.join('')); + searchFinish(); + }, + beforeSend:function(){$('#searchlist').html('结果加载中');}, + error:function(){$('#searchlist').html('');Alert('检索中发现错误,请稍后重试或直接访问');} + }); +} + +function cnkiSearch(keyword){ + $.ajax({type:"POST",url:"/service/cnkisearch",data:'q='+keyword, + success:function(html){ + var items = []; + var obj = jQuery.parseJSON(html); + if(obj.error != '') + { + items.push('
  • ' + obj.error + '
  • '); + }else{ + $.each(obj.result, function(key, val) { + var html = '

    '+val['title']+'

    ' + +val['url'].replace(/%(.*)/i,"") +'

    ' + +val['content'] + +'

    '; + + items.push('
  • ' + html + '
  • '); + }); + } + items.push('
  • 查看更多搜索结果'); + $('#searchlist').html(items.join('')); + searchFinish() + }, + beforeSend:function(){$('#searchlist').html('结果加载中');}, + error:function(){Alert('检索中发现错误,请稍后重试或直接访问');$('#searchlist').html('');} + }); +} + +function searchFinish() +{ + $('html, body').animate({scrollTop:$('#gsearch_t').offset().top}, 'slow'); +} + +function dataVersion(uuid) +{ + $.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+='
  • '+data.list[v].changelog+'

    '+data.list[v].ts_created+' by '+data.list[v].username+'

  • '; + } + $.colorbox({'innerWidth':'50%','innerHeight':'80%','html':'
    '}); + } + } + else{ + Alert('出现错误,请稍后再试');return false; + } +} + +function Alert(html){ + $.colorbox({'innerWidth':'50%','html':'

    '+html+'

    '}); +} \ No newline at end of file