issue 2226 modified a error that the image not show in list gallery.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11009 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-08-09 04:40:53 +00:00
parent 942e525a77
commit 5ce19ccbcb
4 changed files with 16 additions and 8 deletions

View file

@ -22,6 +22,13 @@ var listShow = xe.createPlugin('list', {
w1 = im.$obj.prop('width');
h1 = im.$obj.prop('height');
if (w1 == 0){
w1 = im.$obj.attr('width');
}
if(h1 ==0){
h1 = im.$obj.attr('height');
}
if(w1 > width - 25) {
w2 = width - 25;
scale = w2 / w1;

View file

@ -3,4 +3,5 @@
* @brief List-type image gallery
* @author NHN (developers@xpressengine.com)
**/
(function(k){var h=xe.createPlugin("list",{API_SHOW_LIST:function(i,h){var c=h[0],d,e,j,b,a,g,f;d=this.cast("GET_IMAGES",[c]);if(d.length){c=k("#zone_list_gallery_"+c).empty();width=c.innerWidth();e=0;for(j=d.length;e<j;e++)b=d[e],a=b.$obj.prop("width"),f=b.$obj.prop("height"),a>width-25&&(g=width-25,a=g/a,f=Math.floor(f*a),a=g,b.$obj.attr("rel","xe_gallery")),c.append(b.$obj),b.$obj.css({width:a+"px",height:f,margin:"0 10px",display:"block"})}}}),i=xe.getApp("Gallery")[0];i&&i.registerPlugin(new h)})(jQuery);
(function(k){var h=xe.createPlugin("list",{API_SHOW_LIST:function(i,h){var d=h[0],e,f,j,b,a,g,c;e=this.cast("GET_IMAGES",[d]);if(e.length){d=k("#zone_list_gallery_"+d).empty();width=d.innerWidth();f=0;for(j=e.length;f<j;f++)b=e[f],a=b.$obj.prop("width"),c=b.$obj.prop("height"),0==a&&(a=b.$obj.attr("width")),0==c&&(c=b.$obj.attr("height")),a>width-25&&(g=width-25,a=g/a,c=Math.floor(c*a),a=g,b.$obj.attr("rel","xe_gallery")),d.append(b.$obj),b.$obj.css({width:a+"px",height:c,margin:"0 10px",display:"block"})}}}),
i=xe.getApp("Gallery")[0];i&&i.registerPlugin(new h)})(jQuery);

View file

@ -1,10 +1,10 @@
var selected_node=null;
function getSlideShow(){var c,b,d="",e,a,f,g;if(typeof opener!="undefined"){c=opener.editorPrevNode;b=jQuery(c);if(b.is("img"))selected_node=c,d=$(c).width()-4,c=b.attr("gallery_style"),e=b.attr("gallery_align")||"center",a=b.attr("border_color"),f=b.attr("bg_color"),g=b.attr("border_thickness")||1,get_by_id("width").value=d,get_by_id("gallery_style").selectedIndex=c=="list"?1:0,get_by_id("gallery_align").selectedIndex=e=="left"?1:e=="right"?2:0,get_by_id("border_thickness").value=g,get_by_id("border_color_input").value=
a,manual_select_color("border",get_by_id("border_color_input")),get_by_id("bg_color_input").value=f,manual_select_color("bg",get_by_id("bg_color_input")),d=b.attr("images_list");b=get_by_id("fo").editor_sequence.value;if(b=opener.get_by_id("uploaded_file_list_"+b)){c=get_by_id("image_list");for(e=0;e<b.length;e++){a=b.options[e];f=a.value;if(!f)break;f=opener.uploadedFiles[f].download_url.replace(request_uri,"");/(jpg|jpeg|gif|png)$/i.test(f)&&(g=!1,d.indexOf(f)!=-1&&(g=!0),a=new Option(a.text,a.value,
!1,g),c.options.add(a))}}}}
function insertSlideShow(){if(typeof opener!="undefined"){for(var c=[],b=get_by_id("image_list"),d=0;d<b.length;d++){var e=b.options[d];e.selected&&(e=opener.uploadedFiles[e.value].download_url.replace(request_uri,""),c[c.length]=e)}if(c.length){for(var b=get_by_id("width").value,e=get_by_id("gallery_style").options[get_by_id("gallery_style").selectedIndex].value,a=get_by_id("gallery_align").options[get_by_id("gallery_align").selectedIndex].value,f=get_by_id("border_thickness").value,g=get_by_id("border_color_input").value,
function getSlideShow(){var c,b,d="",e,a,f,g;if("undefined"!=typeof opener&&(c=opener.editorPrevNode,b=jQuery(c),b.is("img")&&(selected_node=c,d=$(c).width()-4,c=b.attr("gallery_style"),e=b.attr("gallery_align")||"center",a=b.attr("border_color"),f=b.attr("bg_color"),g=b.attr("border_thickness")||1,get_by_id("width").value=d,get_by_id("gallery_style").selectedIndex="list"==c?1:0,get_by_id("gallery_align").selectedIndex="left"==e?1:"right"==e?2:0,get_by_id("border_thickness").value=g,get_by_id("border_color_input").value=
a,manual_select_color("border",get_by_id("border_color_input")),get_by_id("bg_color_input").value=f,manual_select_color("bg",get_by_id("bg_color_input")),d=b.attr("images_list")),b=get_by_id("fo").editor_sequence.value,b=opener.get_by_id("uploaded_file_list_"+b))){c=get_by_id("image_list");for(e=0;e<b.length;e++){a=b.options[e];f=a.value;if(!f)break;f=opener.uploadedFiles[f].download_url.replace(request_uri,"");/(jpg|jpeg|gif|png)$/i.test(f)&&(g=!1,-1!=d.indexOf(f)&&(g=!0),a=new Option(a.text,a.value,
!1,g),c.options.add(a))}}}
function insertSlideShow(){if("undefined"!=typeof opener){for(var c=[],b=get_by_id("image_list"),d=0;d<b.length;d++){var e=b.options[d];e.selected&&(e=opener.uploadedFiles[e.value].download_url.replace(request_uri,""),c[c.length]=e)}if(c.length){for(var b=get_by_id("width").value,e=get_by_id("gallery_style").options[get_by_id("gallery_style").selectedIndex].value,a=get_by_id("gallery_align").options[get_by_id("gallery_align").selectedIndex].value,f=get_by_id("border_thickness").value,g=get_by_id("border_color_input").value,
i=get_by_id("bg_color_input").value,h="",d=0;d<c.length;d++)h+=c[d].trim()+" ";selected_node?(selected_node.setAttribute("width",b),selected_node.setAttribute("gallery_style",e),selected_node.setAttribute("align",a),selected_node.setAttribute("gallery_align",a),selected_node.setAttribute("border_thickness",f),selected_node.setAttribute("border_color",g),selected_node.setAttribute("bg_color",i),selected_node.setAttribute("images_list",h),selected_node.style.width=b+"px"):(c='<img src="../../../../common/img/blank.gif" editor_component="image_gallery" width="'+
b+'" gallery_style="'+e+'" align="'+a+'" gallery_align="'+a+'" border_thickness="'+f+'" border_color="'+g+'" bg_color="'+i+'" style="width:'+b+'px;border:2px dotted #4371B9;background:url(./modules/editor/components/image_gallery/tpl/image_gallery_component.gif) no-repeat center;" images_list="'+h+'" />',opener.editorFocus(opener.editorPrevSrl),d=opener.editorGetIFrame(opener.editorPrevSrl),opener.editorReplaceHTML(d,c));opener.editorFocus(opener.editorPrevSrl)}window.close()}}
function select_color(c,b){get_by_id(c+"_preview_color").style.backgroundColor="#"+b;get_by_id(c+"_color_input").value=b}function manual_select_color(c,b){if(b.value.length==6)code=b.value,get_by_id(c+"_preview_color").style.backgroundColor="#"+code}
function printColor(c,b){for(var d=["22","44","66","88","AA","CC","EE"],e="",a=0;a<8;a+=1)e+=printColorBlock(c,a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16),b);for(a=0;a<d.length;a+=3)for(var f=0;f<d.length;f+=2)for(var g=0;g<d.length;g++)e+=printColorBlock(c,d[a]+d[f]+d[g],b);for(a=8;a<16;a+=1)e+=printColorBlock(c,a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16),b);document.write(e)}
function select_color(c,b){get_by_id(c+"_preview_color").style.backgroundColor="#"+b;get_by_id(c+"_color_input").value=b}function manual_select_color(c,b){6==b.value.length&&(code=b.value,get_by_id(c+"_preview_color").style.backgroundColor="#"+code)}
function printColor(c,b){for(var d="22 44 66 88 AA CC EE".split(" "),e="",a=0;8>a;a+=1)e+=printColorBlock(c,a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16),b);for(a=0;a<d.length;a+=3)for(var f=0;f<d.length;f+=2)for(var g=0;g<d.length;g++)e+=printColorBlock(c,d[a]+d[f]+d[g],b);for(a=8;16>a;a+=1)e+=printColorBlock(c,a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16)+a.toString(16),b);document.write(e)}
function printColorBlock(c,b,d){return'<div style="float:left;background-color:#'+b+'"><img src="'+d+'" class="color_icon" onmouseover="this.className=\'color_icon_over\'" onmouseout="this.className=\'color_icon\'" onclick="select_color(\''+c+"','"+b+'\')" alt="color" /></div>'}jQuery(function(){getSlideShow()});

View file

@ -5,5 +5,5 @@
**/
(function(k){var m=xe.createPlugin("slideShow",{_holders:{},_thumbs:{},_current:{},init:function(){this._holders={};this._thumbs={};this._current={}},API_SHOW_SLIDE:function(g,f){var b=this,a=f[0],c="@"+a,d,e,j,i,h,l;d=this.cast("GET_IMAGES",[a]);if(d.length){e=k("#zone_slide_gallery_"+a);i=e.find(".slide_gallery_placeholder").css("overflow","hidden");e.find(".slide_gallery_loading_text").remove();j=e.find(".slide_gallery_thumbnail_image_box").show();h=0;for(l=d.length;h<l;h++)d[h].$obj.clone().css({cursor:"pointer",
width:"60px",height:"60px",margin:"5px",opacity:0.5}).click({idx:h},function(c){b.cast("SET_SLIDE",[a,c.data.idx])}).appendTo(j);k("#zone_gallery_navigator_status_"+a).click(function(){j.toggle()});e.find(".__prev").click(function(){b.cast("PREV_SLIDE",[a]);return!1}).end().find(".__next").click(function(){b.cast("NEXT_SLIDE",[a]);return!1});this._holders[c]=i;this._thumbs[c]=j;this._current[c]=0;this.cast("SET_SLIDE",[a,0])}},_showSideSlide:function(g,f){var b,a;b=this.cast("GET_IMAGES",[g]);b.length&&
(a=this._current["@"+g]+f,0>a?a=b.length-1:a>=b.length&&(a=0),this.cast("SET_SLIDE",[g,a]))},API_NEXT_SLIDE:function(g,f){this._showSideSlide(f[0],1)},API_PREV_SLIDE:function(g,f){this._showSideSlide(f[0],-1)},API_SET_SLIDE:function(g,f){var b=f[0],a=f[1],c,d,e;c=this.cast("GET_IMAGES",[b]);if(c.length&&is_def(d=c[a]))this._current["@"+b]=a,k("#zone_gallery_navigator_status_"+b).text(a+1+"/"+c.length),this._thumbs["@"+b].find("img").eq(a).animate({opacity:1}).end().not(":eq("+a+")").animate({opacity:0.5}),
(a=this._current["@"+g],a+=f,0>a?a=b.length-1:a>=b.length&&(a=0),this.cast("SET_SLIDE",[g,a]))},API_NEXT_SLIDE:function(g,f){this._showSideSlide(f[0],1)},API_PREV_SLIDE:function(g,f){this._showSideSlide(f[0],-1)},API_SET_SLIDE:function(g,f){var b=f[0],a=f[1],c,d,e;c=this.cast("GET_IMAGES",[b]);if(c.length&&is_def(d=c[a]))this._current["@"+b]=a,k("#zone_gallery_navigator_status_"+b).text(a+1+"/"+c.length),this._thumbs["@"+b].find("img").eq(a).animate({opacity:1}).end().not(":eq("+a+")").animate({opacity:0.5}),
b=this._holders["@"+b],c=b.parent().innerWidth(),a=d.$obj.prop("width"),e=d.$obj.prop("height"),0==a&&(a=d.$obj.attr("width")),0==e&&(e=d.$obj.attr("height")),a>c-20&&(c-=20,e=Math.floor(e*(c/a)),a=c,d.$obj.css("cursor","pointer"),d.$obj.attr("rel","xe_gallery")),d.$obj.css({width:a,height:e,margin:"0 10px"}),b.empty().append(d.$obj)}}),i=xe.getApp("Gallery")[0];i&&i.registerPlugin(new m)})(jQuery);