Hi narendrababu,
Please open file "CuteSoft_Client\Gallery\Layout\Classic\Code.js", clean all the code then use the new code below.
The first line "var GRIDSHOW_PAGESIZE=5;" use to set how many images to show in 1 page.
- var GRIDSHOW_PAGESIZE=5;
- function GalleryLayout(gb)
- {
- this.Browser=gb;
-
- this.dng_photolist=this.Browser.FindElement("dng_photolist");
-
-
-
- this.Browser.Control.style.minHeight=this.Browser.Control.style.height;
- this.Browser.Control.style.height="";
-
- var uploadercontainer=this.Browser.GetUploaderContainer();
- if(uploadercontainer)
- {
- this.Browser.FindElement("dng_uploaderholder").appendChild(uploadercontainer);
- }
- else
- {
-
- }
-
- this._categories=this.Browser.GetCategories();
-
- this.DrawUI();
- }
-
- GalleryLayout.prototype.DrawUI=function _GalleryLayout_DrawUI()
- {
- clearTimeout(this._animationTimerid);
-
- this.dng_photolist.innerHTML="";
-
- var photos=[];
- for(var i=0;i<this._categories.length;i++)
- {
- photos=photos.concat(this._categories[i].Photos);
- }
- var page=this._page||1;
- var size=GRIDSHOW_PAGESIZE;
- var start=(page-1)*size;
- for(var i=0;i<size;i++)
- {
- var photo=photos[start+i];
- if(!photo)
- break;
- var div=this.CreatePhotoDiv(photo);
- this.AttachItemEvent(div);
- this.dng_photolist.appendChild(div);
- }
- var pagecount=Math.ceil(photos.length/size);
- if(pagecount==0)
- return;
- if(pagecount==1&&page==1)
- return;
-
- var pager=document.createElement("DIV");
- pager.style.textAlign="left";
- pager.style.clear="both";
- this.dng_photolist.appendChild(pager);
- var layout=this;
- function SetupButton(btn,btnpage)
- {
- if(page==btnpage)
- {
- btn.style.fontWeight="bold";
- }
- btn.innerHTML="["+btnpage+"]";
- btn.href="#";
- btn.onclick=ToDelegate(layout,function()
- {
- this._page=btnpage;
- this.DrawUI();
- return false;
- });
- }
-
- for(var i=0;i<pagecount;i++)
- {
- var btn=document.createElement("A");
- SetupButton(btn,i+1);
- pager.appendChild(btn);
- pager.appendChild(document.createTextNode(" "));
- }
-
- }
-
- GalleryLayout.prototype.CreatePhotoDiv=function _GalleryLayout_CreateItemDiv(photo)
- {
- var div=document.createElement("DIV");
- div.className="GalleryPhotoItem";
- div.dngphoto=photo;
- var t=document.createElement("TABLE");
- t.style.width="100%";
- t.style.height="100%";
- t.border=0;
- t.cellSpacing=0;
- t.cellPadding=0;
- var c1=t.insertRow(-1).insertCell(-1);
- var c2=t.insertRow(-1).insertCell(-1);
- c1.className="GalleryItemImageCell";
- c1.onselectstart=new Function("","return false");
- c2.style.textAlign="center";
- var scale = Math.min(128/photo.Width, 96/photo.Height);
- var img=this.Browser.CreateThumbnail(photo.Thumbnail,Math.floor(photo.Width * scale),Math.floor(photo.Height * scale));
- c1.appendChild(img);
- img.style.cursor="hand";
- img.onclick=ToDelegate(this,function()
- {
- this.Browser.ShowViewer(div.dngphoto);
- });
-
- c2.innerHTML="<span class='GalleryItemText'></span>";
- var titltText=photo.Title;
- if(titltText&&titltText.length>30)titltText=titltText.substring(0,30)+"..";
- c2.firstChild.appendChild(document.createTextNode(titltText));
-
- if(this.Browser.Param.AllowShowComment)
- {
- var cs=photo.Comments;
- if(cs&&cs.length)
- {
- c2.innerHTML+="<br/><span class='GalleryItemNumComments'>"+cs.length+" "+GalleryLocalize.NUMCOMMENTS+"<span>";
- }
- }
-
- div.appendChild(t);
- return div;
- }
-
- GalleryLayout.prototype.AttachItemEvent=function _GalleryLayout_AttachItemEvent(div)
- {
- function SetDivClass(div)
- {
- var clsname;
- if(div.dngselected&&div.dnghover)
- clsname=" GalleryItemHoverSelected";
- else if(div.dngselected)
- clsname=" GalleryItemSelected";
- else if(div.dnghover)
- clsname=" GalleryItemHover";
- else
- clsname="";
- div.className="GalleryPhotoItem "+clsname;
- }
- div.onmouseover=ToDelegate(this,function()
- {
- div.dnghover=true;
- SetDivClass(div);
- this.Browser.ShowPhotoTooltip(div.dngphoto,div,this);
- });
- div.onmouseout=ToDelegate(this,function()
- {
- div.dnghover=false;
- SetDivClass(div);
- });
- div.ondblclick=ToDelegate(this,function()
- {
- this.Browser.ShowViewer(div.dngphoto);
- });
- div.oncontextmenu=ToDelegate(this,function(event)
- {
- event=event||window.event;
- this.Browser.ShowPhotoMenu(div.dngphoto,div,event,this);
- if(event.preventDefault)event.preventDefault();
- event.cancelBubble=true;
- return event.returnValue=false;
- });
- }
-
- GalleryLayout.prototype.Ajax_Result=function _GalleryLayout_Ajax_Result(ret,param,method)
- {
- if(method=="GetAllCategoryData"||method=="GetCategoryData")
- {
- this._categories=this.Browser.GetCategories();
- this.DrawUI();
- }
- }
Regards,
Ken