change bigthumb to colorbox js

This commit is contained in:
wlx 2011-11-07 01:52:45 +00:00
parent 1e77c79c38
commit 74e48cc25c
1 changed files with 120 additions and 53 deletions

View File

@ -11,10 +11,9 @@
$this->breadcrumb('查看元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('http://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
$this->headScript()->appendFile('/js/prototype.js');
$this->headScript()->appendFile('/js/OpenLayers.js');
$this->headScript()->appendFile('/js/window.js');
$this->headScript()->appendFile('/js/pubfunc.js');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
?>
<div id='sidebar'>
@ -159,7 +158,7 @@ endforeach;
</div>
<div id="left">
<div id="ImageViewer"><img src="/service/thumb/id/<?php echo $md->id;?>" onclick="fnCreate('<?php echo $this->thumburl; ?>')" /> </div>
<div id="ImageViewer"><a class="colorbox" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>" /></a> </div>
<div id="abstract">
<p>
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
@ -226,30 +225,6 @@ endforeach;
<h2>数据评论</h2>
<div id="allcomments">
</div>
<script type="text/javascript">
function loading()
{
$('loading').style.display = 'block';
}
function done()
{
$('loading').style.display = 'none';
}
function reportError(request)
{
alert('Sorry. There was an error.');
}
var request_pars = ''; //请求参数
var myAjax = new Ajax.Updater('allcomments', '/data/comment/uuid/<?= $md->uuid; ?>',{
method : 'get', // http 请求方法,get or post
parameters : request_pars, // 请求参数
onFailure : reportError, // 失败的时候调用 reportError 函数处理
onLoading : loading, // 加载时
onComplete : done // 读取完毕
});
</script>
<?php echo $this->commentForm; ?>
<?php endif; ?>
</div>
@ -265,13 +240,105 @@ function reportError(request)
</div>
</div>
<div id="todownload" style="display:none;">
<div class="closeox"><a href="javascript:void(0);" onclick="$('#todownload').hide()">[关闭]</a></div>
<div id="returninfo" style="">
</div>
</div>
<script type="text/javascript" charset="utf-8">
var map = new GMap2(document.getElementById("watermap"));
var plotbounds=new GLatLngBounds(new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
var zoomlevel=map.getBoundsZoomLevel(plotbounds);
zoomlevel--;
$(document).ready(function(){$(".colorbox").colorbox({photo:"true"});});
//ajax download
function todownload(ft)
{
var url = "/data/todownload/uuid/<?php echo $md->uuid;?>/ft/"+ft;
if($('#todownloadform')) var date = $('#todownloadform').serialize();
$.ajax({
type:"GET",
url:url,
data:date,
success:function(html){
$('#returninfo').html(html);
},
beforeSend:function(){
$('#returninfo').html('<img src="/images/11887177066.gif" />');
}
});
}
//ajax comment
function ajaxpage(page){
var url = "/data/comment/uuid/<?= $md->uuid; ?>";
data='page='+page;
$.ajax({
type:"GET",
url:url,
data:data,
success:function(html){$('#allcomments').html(html);},
beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />评论加载中');}
});
};ajaxpage(0);
function getFileList(){
var tw = ($(window).width() - $('#window-outter').width())/2;
$('#window-inner').css('min-height','450px');
$('#window-outter').css({'right':tw});
$('#window-outter').show();
$.getJSON("/filelist/uuid/<?php echo $md->uuid;?>", function(data) {
var items = [];
if(data.length>0)
{
$.each(data, function(key, val) {
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>');
}else{
items.push('<li id="li_' + val['id'] + '">' + val['filename'] + '</li>');
}
});
}else{
items.push('<li>暂无数据</li>');
}
$('#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;
}
$('<div/>', {
'style':'max-height:400px; overflow:scroll; overflow-x:hidden;',
'id': 'div_'+id,
"html": '<li><img src="/images/11887177066.gif" />加载中</li>'
}).appendTo('#li_'+id);
url="/filelist/sub/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth;
$.getJSON(url, function(data) {
var items = [];
$.each(data, function(key, val) {
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>');
}else{
items.push('<li id="' + key + '">' + val['filename'] + '</li>');
}
});
$("#div_"+id).html(items.join(''));
}).complete(function(){
if($("#div_"+id)){
$('#span_'+id).html('-');
}
});
}
//google map
var map = new GMap2(document.getElementById("watermap"));
var plotbounds=new GLatLngBounds(new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
var zoomlevel=map.getBoundsZoomLevel(plotbounds);
zoomlevel--;
<?php if ($md->north==$md->south) : ?>
zoomlevel=10;
zoomlevel=10;
<?php endif; ?>
if (zoomlevel>16) zoomlevel=16;
map.setCenter(new GLatLng(<?= ($md->south+$md->north)/2; ?>,<?= ($md->east+$md->west)/2; ?>), zoomlevel);