Re: how i get all categories name with folder path

  •  10-28-2010, 10:22 PM

    Re: how i get all categories name with folder path

    Hi raneamey,.
     
    Please try this way.
     
    1. Open file "\CuteSoft_Client\Gallery\Layout\SlideShow\Code.js" and delete all the code in this file.
     
    2. Add the code below into the file above
     
    1. function GalleryLayout(gb)  
    2. {  
    3.     this.Browser=gb;  
    4.       
    5.     this.TOOLBARHEIGHT=30;  
    6.     // unknown bug , do not use this.dng_toolbar.offsetHeight  
    7.       
    8.     this.dng_container=this.Browser.FindElement("dng_container");  
    9.       
    10.     this.dng_topinfo=this.Browser.FindElement("dng_topinfo");  
    11.     this.dng_topinfoname=this.Browser.FindElement("dng_topinfoname");  
    12.     this.dng_topinfoindex=this.Browser.FindElement("dng_topinfoindex");  
    13.       
    14.     this.dng_photo1=this.Browser.FindElement("dng_photo1");  
    15.     this.dng_photo2=this.Browser.FindElement("dng_photo2");  
    16.     this.dng_tabcontainer=this.Browser.FindElement("dng_tabcontainer");  
    17.       
    18.     this.dng_toolbar=this.Browser.FindElement("dng_toolbar");  
    19.       
    20.     this.dng_btn_config=this.Browser.FindElement("dng_btn_config");  
    21.     this.dng_btn_prev=this.Browser.FindElement("dng_btn_prev");  
    22.     this.dng_btn_next=this.Browser.FindElement("dng_btn_next");  
    23.     this.dng_btn_play=this.Browser.FindElement("dng_btn_play");  
    24.     this.dng_btn_slider=this.Browser.FindElement("dng_btn_slider");  
    25.       
    26.       
    27.     this.dng_btn_config.src=this.Browser.GetTheme("Images/standard-config.png");  
    28.     this.dng_btn_prev.src=this.Browser.GetTheme("Images/standard-pageprev.png");  
    29.     this.dng_btn_next.src=this.Browser.GetTheme("Images/standard-pagenext.png");  
    30.     this.dng_btn_play.src=this.Browser.GetTheme("Images/standard-slider-play.png");  
    31.     this.dng_btn_slider.src=this.Browser.GetTheme("Images/standard-slider.png");  
    32.       
    33.     //so the ToggleFullPage could be override.  
    34.     this.dng_btn_slider.onclick=ToDelegate(this,function(){ this.ToggleFullPage(); });  
    35.       
    36.     this.dng_btn_config.onclick=ToDelegate(this,this.ShowConfig);  
    37.     this.dng_btn_play.onclick=ToDelegate(this,this.TogglePlay);  
    38.       
    39.     this.dng_toolbar.onmouseover=ToDelegate(this,this.ToolbarMouseOver)  
    40.     this.dng_toolbar.onmouseout=ToDelegate(this,this.ToolbarMouseOut)  
    41.     this.dng_toolbar.onclick=function(e)  
    42.     {  
    43.         e=window.event||e;  
    44.         e.cancelBubble=true;  
    45.     }  
    46.       
    47.     this.dng_container.onclick=ToDelegate(this,this.LayoutClick);  
    48.     this.dng_container.onmousemove=ToDelegate(this,this.LayoutMouseMove);  
    49.     this.dng_container.onmouseout=ToDelegate(this,this.LayoutMouseOut);  
    50.   
    51.     var uploadercontainer=this.Browser.GetUploaderContainer();  
    52.     if(uploadercontainer)  
    53.     {  
    54.         uploadercontainer.style.display="none";  
    55.     }  
    56.       
    57.     this.playing=false;  
    58.     this._speed=5.0;  
    59.   
    60.     this._categories=this.Browser.GetCategories();  
    61.       
    62.   
    63.     function IsNotVisible(n)  
    64.     {  
    65.         if(window.getComputedStyle)  
    66.         {  
    67.             var s=window.getComputedStyle(n,null);  
    68.             if(s.getPropertyValue("display")=="none")  
    69.                 return true;  
    70.             if(s.getPropertyValue("visibility")=="hidden")  
    71.                 return true;  
    72.         }  
    73.         else  
    74.         {  
    75.             var s=n.currentStyle||n.style;  
    76.             if(s.display=="none")  
    77.                 return true;  
    78.             if(s.visibility=="hidden")  
    79.                 return true;  
    80.         }  
    81.         return false;  
    82.     }  
    83.       
    84.     var initfunc=ToDelegate(this,function(){  
    85.       
    86.         for(var vn=this.dng_container;vn&&vn.style;vn=vn.parentNode)  
    87.             if(IsNotVisible(vn))  
    88.                 return setTimeout(initfunc,100);  
    89.           
    90.         this.DrawUI();  
    91.       
    92.         var photos=[];  
    93.           
    94.     if(this._categories.length<GetCategoryNum()||isNaN(GetCategoryNum())||GetCategoryNum()<=0)  
    95.     {  
    96.     photos=photos.concat(this._categories[1].Photos);  
    97.     }  
    98.     else{  
    99.       
    100.      photos=photos.concat(this._categories[GetCategoryNum()].Photos);  
    101.     }  
    102.         if(photos.length>0)  
    103.         {  
    104.             this.TogglePlay();  
    105.               
    106.             this.ShowPhoto(photos[0]);  
    107.         }  
    108.           
    109.         var thisAdjustLayout=ToDelegate(this,this.AdjustLayout);  
    110.         function onwindowresize()  
    111.         {  
    112.             //need adjust twice..  
    113.             thisAdjustLayout();  
    114.             setTimeout(thisAdjustLayout,100);  
    115.         }  
    116.           
    117.         if(window.attachEvent)  
    118.         {  
    119.             window.attachEvent("onresize",onwindowresize);  
    120.             document.attachEvent("onkeydown",ToDelegate(this,this.HandleKeyDown));  
    121.         }  
    122.         else  
    123.         {  
    124.             window.addEventListener("resize",onwindowresize,false);  
    125.             document.addEventListener("keydown",ToDelegate(this,this.HandleKeyDown),false);  
    126.         }  
    127.           
    128.         this.AdjustLayout();  
    129.           
    130.     })  
    131.       
    132.     setTimeout(initfunc,100);  
    133. }  
    134. function GetCategoryNum()  
    135. {  
    136.   
    137.   var urlString = document.location.search;  
    138.     if(urlString != null)  
    139.  {  
    140.           var typeQu ="Category=";  
    141.           var urlEnd = urlString.indexOf(typeQu);  
    142.           
    143.             if(urlEnd != -1)  
    144.        {  
    145.                var paramsUrl = urlString.substring(urlEnd+typeQu.length);  
    146.                var isEnd =  paramsUrl.indexOf('&');  
    147.                if(isEnd != -1)  
    148.             {  
    149.                    return paramsUrl.substring(0, isEnd);  
    150.                                     
    151.             }  
    152.                 else  
    153.             {  
    154.                     return paramsUrl;  
    155.                   
    156.                 }  
    157.          }  
    158.          else   
    159.             
    160.              return 0;  
    161.     }  
    162.     else  
    163.         
    164.         return 0;  
    165. }  
    166. GalleryLayout.prototype.DrawUI=function _GalleryLayout_DrawUI()  
    167. {  
    168.     this.dng_tabcontainer.innerHTML="";  
    169.   
    170.     var div=document.createElement("DIV");  
    171.       
    172.     this._wheeldiv=div;  
    173.   
    174.     div.className="GalleryPhotoList";  
    175.     div.style.position="relative";  
    176.     div.style.overflow="hidden";  
    177.     div.style.width=this.dng_tabcontainer.offsetWidth-6+"px";  
    178.     div.style.height=this.dng_tabcontainer.offsetHeight-6+"px";  
    179.     //div.style.height="24px";  
    180.   
    181.     var photos=[];  
    182.   
    183.     if(this._categories.length<GetCategoryNum()||isNaN(GetCategoryNum())||GetCategoryNum()<=0)  
    184.     {  
    185.      
    186.     photos=photos.concat(this._categories[1].Photos);  
    187.     }  
    188.     else{  
    189.   
    190.      photos=photos.concat(this._categories[GetCategoryNum()].Photos);  
    191.     }  
    192.     var nobr=document.createElement("NOBR");  
    193.     nobr.style.display="block";  
    194.     nobr.style.width=photos.length*40+"px";  
    195.     nobr.style.height="24px";  
    196.     div.appendChild(nobr);  
    197.   
    198.     this.items=[];  
    199.       
    200.     for(var i=0;i<photos.length;i++)  
    201.     {  
    202.         var photo=photos[i];  
    203.           
    204.         var item=document.createElement("DIV");  
    205.         item.dngphoto=photo;  
    206.   
    207.         item.style.height="24px";  
    208.         item.style.display="inline-block";  
    209.         item.style.verticalAlign="top";  
    210.           
    211.         //var scale = Math.min(48/photo.Width, 24/photo.Height);  
    212.         //var imgwidth=Math.floor(photo.Width * scale);  
    213.         //var imgheight=Math.floor(photo.Height * scale);  
    214.         var imgwidth=32;  
    215.         var imgheight=24;  
    216.           
    217.         var img=this.CreateItemThumb(photo.Thumbnail,imgwidth,imgheight);  
    218.           
    219.         item.style.paddingLeft="2px";  
    220.         item.style.paddingRight="2px";  
    221.         item.style.width=imgwidth+4+"px";  
    222.           
    223.         //if(imgheight<24)  
    224.         //{  
    225.         //  img.style.marginTop=Math.floor(12-imgheight/2)+"px";  
    226.         //}  
    227.         item.style.display="inline-block";  
    228.         item.style.position="relative";  
    229.         item.style.styleFloat="left";  
    230.         item.style["float"]="right";  
    231.           
    232.         item.appendChild(img);  
    233.           
    234.         this.AttachItemEvent(item);  
    235.           
    236.         nobr.appendChild(item);  
    237.           
    238.         this.items.push(item);  
    239.     }  
    240.       
    241.     this.dng_tabcontainer.appendChild(div);  
    242.       
    243.     if(div.scrollWidth > div.offsetWidth)  
    244.     {  
    245.         var widthfixer=document.createElement("DIV");  
    246.         widthfixer.style.position="absolute";  
    247.         widthfixer.style.top=widthfixer.style.width=widthfixer.style.height="1px";  
    248.         widthfixer.style.left=div.offsetWidth*Math.ceil(photos.length*40/div.offsetWidth)-4+"px";  
    249.         div.appendChild(widthfixer);  
    250.           
    251.         var scrollbar=document.createElement("DIV");  
    252.         this.scrollbar=scrollbar;  
    253.         scrollbar.style.position="absolute";  
    254.         scrollbar.style.height="1px";  
    255.         var sbimg=scrollbar.appendChild(document.createElement("IMG"));  
    256.         sbimg.style.display="none";  
    257.         sbimg.style.height="1px";  
    258.         scrollbar.style.width=Math.floor(div.offsetWidth*div.offsetWidth/div.scrollWidth)-4+"px";  
    259.         this.dng_tabcontainer.appendChild(scrollbar);  
    260.         var sbpos=CalcPosition(scrollbar,div);  
    261.         sbpos.top+=div.offsetHeight+3;  
    262.         scrollbar.style.top=sbpos.top+"px";  
    263.         scrollbar.style.left=sbpos.left+2+"px";  
    264.         scrollbar.className="BlackSliderScrollbar";  
    265.         this.SetScrollBarPos=ToDelegate(this,SetScrollBarPos);  
    266.     }  
    267.       
    268.     function SetScrollBarPos()  
    269.     {  
    270.         if(!scrollbar)return;  
    271.         if(this._isfullpage)  
    272.         {  
    273.             scrollbar.style.display="none";  
    274.             return;  
    275.         }  
    276.   
    277.         var sbpos=CalcPosition(scrollbar,div);  
    278.           
    279.         scrollbar.style.display="";  
    280.         sbpos.top+=div.offsetHeight+3;  
    281.         sbpos.left+=Math.floor(div.scrollLeft*div.offsetWidth/div.scrollWidth);  
    282.         scrollbar.style.top=sbpos.top+"px";  
    283.         scrollbar.style.left=sbpos.left+2+"px";  
    284.     }  
    285.       
    286.     if(this.nextScrollLeft)  
    287.     {  
    288.         div.scrollLeft=this.nextScrollLeft;  
    289.         SetScrollBarPos();  
    290.     }  
    291.           
    292.     this.nextScrollLeft=div.scrollLeft;  
    293.       
    294.     div.onmousewheel=ToDelegate(this,function(event)  
    295.     {  
    296.         event=window.event||event;  
    297.           
    298.         this.HandleWheel(event.wheelDelta*2);  
    299.           
    300.         if(event.preventDefault)event.preventDefault();  
    301.         return event.returnValue=false;  
    302.     });  
    303.     this.dng_btn_prev.onclick=ToDelegate(this,function(){  
    304.         this.HandleWheel(div.offsetWidth);  
    305.     });  
    306.     this.dng_btn_next.onclick=ToDelegate(this,function(){  
    307.         this.HandleWheel(-div.offsetWidth);  
    308.     });  
    309.   
    310.     clearTimeout(this.wheelTimerid);  
    311.       
    312. }  
    313. GalleryLayout.prototype.HandleWheel=function _GalleryLayout_HandleWheel(delta)  
    314. {  
    315.   
    316.     this.nextScrollLeft-=delta||0;  
    317.   
    318.     this.nextScrollLeft=Math.max(this.nextScrollLeft,0);  
    319.     this.nextScrollLeft=Math.min(this.nextScrollLeft,this._wheeldiv.scrollWidth-this._wheeldiv.offsetWidth);  
    320.   
    321.     //find the nearest item:  
    322.     if(this.items)  
    323.     {  
    324.         var nearLeft=-1;  
    325.         for(var i=0;i<this.items.length;i++)  
    326.         {  
    327.             var left=this.items[i].offsetLeft;  
    328.             if( Math.abs(left-this.nextScrollLeft) < Math.abs(nearLeft-this.nextScrollLeft) )  
    329.                 nearLeft=left;  
    330.         }  
    331.         if(nearLeft!=-1)  
    332.             this.nextScrollLeft=nearLeft;  
    333.     }  
    334.       
    335.     var ContinueMove=ToDelegate(this,function()  
    336.     {  
    337.         var miss=this.nextScrollLeft-this._wheeldiv.scrollLeft  
    338.         miss=Math.floor(miss*5/6-(miss>0?1:-1));  
    339.           
    340.         clearTimeout(this.wheelTimerid);  
    341.   
    342.         if(Math.abs(miss)<2)  
    343.         {  
    344.             this._wheeldiv.scrollLeft=this.nextScrollLeft;  
    345.         }  
    346.         else  
    347.         {  
    348.             this._wheeldiv.scrollLeft=this.nextScrollLeft-miss;  
    349.               
    350.             this.wheelTimerid=setTimeout(ContinueMove,50);  
    351.         }  
    352.         if(this.SetScrollBarPos)this.SetScrollBarPos();  
    353.     });  
    354.       
    355.     ContinueMove();  
    356.       
    357. }  
    358. GalleryLayout.prototype.CreateItemThumb=function(url,width,height)  
    359. {  
    360.     // return this.Browser.CreateThumbnail(url,width,height);  
    361.     var thumb=GalleryCreateThumbnail(url,width-2,height-2);  
    362.     thumb.style.margin="1px";  
    363.     var div=document.createElement("DIV");  
    364.     div.style.width=width+"px";  
    365.     div.style.height=height+"px";  
    366.     div.style.display="inline-block";  
    367.     div.style.position="relative";  
    368.     div.className="GalleryScrollItem";  
    369.     var tick=document.createElement("DIV");  
    370.     tick.className="GalleryScrollItemTick";  
    371.     tick.style.position="absolute";  
    372.     tick.style.width=width+"px";  
    373.     tick.style.height=height+"px";  
    374.     div.appendChild(tick);  
    375.     div.appendChild(thumb);  
    376.     return div;  
    377. }  
    378. GalleryLayout.prototype.CreateNewTooltip=function _GalleryLayout_CreateNewTooltip(item,delay)  
    379. {  
    380.     var tt={};  
    381.     var closed=false;  
    382.     var photo=item.dngphoto;  
    383.     var div=document.createElement("DIV");  
    384.       
    385.     var scale = Math.min(128/photo.Width, 128/photo.Height);  
    386.     var width=Math.floor(photo.Width * scale);  
    387.     var height=Math.floor(photo.Height * scale)  
    388.     var thumb=this.Browser.CreateThumbnail(photo.Thumbnail,width,height);  
    389.       
    390.     div.style.width=width+"px";  
    391.     div.style.height=height+3+"px";  
    392.       
    393.     div.appendChild(thumb);  
    394.       
    395.     div.className="ZINDEXTOOLTIP";  
    396.     div.style.position="absolute";  
    397.     div.style.display="none";  
    398.       
    399.     InsertToBody(div);  
    400.       
    401.     var pos=CalcPosition(div,item);  
    402.   
    403.     pos.top-=height+3;  
    404.     pos.left-=Math.floor((width-item.offsetWidth)/2);  
    405.       
    406.     div.style.top=pos.top+"px";  
    407.     div.style.left=pos.left+"px";  
    408.       
    409.     var itemisover=true;  
    410.     var divisover=false;  
    411.     var checkid;  
    412.     var outtime;  
    413.       
    414.           
    415.     setTimeout(ToDelegate(this,function(){  
    416.         if(closed)return;  
    417.         if(!itemisover)  
    418.         {  
    419.             tt.Close();  
    420.             return;  
    421.         }  
    422.           
    423.         div.style.display="";  
    424.           
    425.         for(var i=0;i<6;i++)  
    426.         {  
    427.             var line=document.createElement("DIV");  
    428.             line.style.position="absolute";  
    429.             line.style.backgroundColor="#CCCCCC";  
    430.             line.style.height="1px";  
    431.             line.style.width=i*2+1+"px";  
    432.             line.style.top=div.offsetHeight-i+"px";  
    433.             line.style.left=div.offsetWidth/2-i+"px";  
    434.             line.innerHTML="<img style='display:none;width:1px;height:1px;'/>";  
    435.             div.appendChild(line);  
    436.         }  
    437.           
    438.         checkid=setTimeout(ToDelegate(this,CheckState),100);  
    439.           
    440.     }),delay||600);  
    441.       
    442.     function CheckState()  
    443.     {  
    444.         checkid=setTimeout(ToDelegate(this,CheckState),10);  
    445.         if(itemisover||divisover)  
    446.         {  
    447.             outtime=null;  
    448.             return;  
    449.         }  
    450.           
    451.         if(!outtime)  
    452.         {  
    453.             outtime=new Date().getTime();  
    454.             return;  
    455.         }  
    456.           
    457.         if(new Date().getTime()-outtime>300)  
    458.         {  
    459.             tt.Close();  
    460.         }  
    461.     }  
    462.   
    463.       
    464.     div.onmouseover=function()  
    465.     {  
    466.         divisover=true;  
    467.     }  
    468.     div.onmouseout=function()  
    469.     {  
    470.         divisover=false;  
    471.     }  
    472.     div.style.cursor="hand";  
    473.     div.onclick=ToDelegate(this,function()  
    474.     {  
    475.         //this.ShowPhoto(photo);  
    476.         this.Browser.ShowViewer(photo);  
    477.         tt.Close();  
    478.     })  
    479.       
    480.     tt.Close=ToDelegate(this,function()  
    481.     {  
    482.         if(closed)return;  
    483.         closed=true;  
    484.           
    485.         clearTimeout(checkid);  
    486.           
    487.         document.body.removeChild(div);  
    488.           
    489.         this._currentTooltip=null;  
    490.     })  
    491.       
    492.     tt.OnItemOver=ToDelegate(this,function(anotheritem)  
    493.     {  
    494.         itemisover=true;  
    495.         if(anotheritem!=item)  
    496.         {  
    497.             tt.Close();  
    498.             this.CreateNewTooltip(anotheritem,10);  
    499.         }  
    500.     })  
    501.     tt.OnItemOut=ToDelegate(this,function(anotheritem)  
    502.     {  
    503.         itemisover=false;  
    504.     })  
    505.       
    506.       
    507.     this._currentTooltip=tt;  
    508. }  
    509.   
    510. GalleryLayout.prototype.AttachItemEvent=function _GalleryLayout_AttachItemEvent(div)  
    511. {  
    512.     div.onmouseover=ToDelegate(this,function()  
    513.     {  
    514.         if(this._currentTooltip)  
    515.             this._currentTooltip.OnItemOver(div);  
    516.         else  
    517.             this.CreateNewTooltip(div);  
    518.     });  
    519.     div.onmouseout=ToDelegate(this,function()  
    520.     {  
    521.         if(this._currentTooltip)  
    522.             this._currentTooltip.OnItemOut(div);  
    523.     });  
    524.     div.onmousedown=ToDelegate(this,function()  
    525.     {  
    526.         this.ShowPhoto(div.dngphoto);  
    527.     });  
    528.     div.oncontextmenu=ToDelegate(this,function(event)  
    529.     {  
    530.         event=event||window.event;  
    531.         this.Browser.ShowPhotoMenu(div.dngphoto,div,event,this);  
    532.         if(event.preventDefault)event.preventDefault();  
    533.         event.cancelBubble=true;  
    534.         return event.returnValue=false;  
    535.     });  
    536. }  
    537.   
    538.   
    539. GalleryLayout.prototype.SetPlayTimeout=function _GalleryLayout_SetTimeout(func,timeout,type)  
    540. {  
    541.     clearTimeout(this.playtimerid);  
    542.     this.playtimerid=setTimeout(ToDelegate(this,func),timeout);  
    543.     if(type)this.playtimertype=type;  
    544. }  
    545.   
    546.   
    547. GalleryLayout.prototype.TogglePlay=function _GalleryLayout_TogglePlay()  
    548. {  
    549.     if(this.playing)  
    550.     {  
    551.         this.playing=false;  
    552.         this.dng_btn_play.src=this.Browser.GetTheme("Images/standard-slider-play.png");  
    553.     }  
    554.     else  
    555.     {  
    556.         this.playing=true;  
    557.         this.SetPlayTimeout(this.PlayOnTimer,this._speed*1000,"PlayOnTimer");  
    558.         this.dng_btn_play.src=this.Browser.GetTheme("Images/standard-slider-pause.png");  
    559.     }  
    560. }  
    561.   
    562. GalleryLayout.prototype.GetPrevPhoto=function _GalleryLayout_GetPrevPhoto(photo)  
    563. {  
    564.     return this.GetNextPhoto(photo,true);  
    565. }  
    566. GalleryLayout.prototype.GetNextPhoto=function _GalleryLayout_GetNextPhoto(photo,backward)  
    567. {  
    568.     var photos=[];  
    569.     if(this._categories.length<GetCategoryNum()||isNaN(GetCategoryNum())||GetCategoryNum()<=0)  
    570.     {  
    571.     photos=photos.concat(this._categories[1].Photos);  
    572.     }  
    573.     else{  
    574.       
    575.      photos=photos.concat(this._categories[GetCategoryNum()].Photos);  
    576.     }  
    577.       
    578.     if(photos.length==0)  
    579.         return null;  
    580.       
    581.     var nextphoto;  
    582.     for(var i=0;i<photos.length;i++)  
    583.     {  
    584.         var p=photos[i];  
    585.         if(p.CategoryID==photo.CategoryID&&p.PhotoID==photo.PhotoID)  
    586.         {  
    587.             if(backward)  
    588.                 nextphoto=photos[i-1];  
    589.             else  
    590.                 nextphoto=photos[i+1];  
    591.             break;  
    592.         }  
    593.     }  
    594.     if(nextphoto)  
    595.         return nextphoto;  
    596.     if(backward)  
    597.         return photos[photos.length-1];  
    598.     return photos[0];  
    599. }  
    600.   
    601. GalleryLayout.prototype.PlayOnTimer=function _GalleryLayout_PlayOnTimer()  
    602. {  
    603.     if(!this.playing)return;  
    604.       
    605.     var floatingobj=GalleryHasFloatObject();  
    606.     if(floatingobj && floatingobj!=this )  
    607.     {  
    608.         this.SetPlayTimeout(this.PlayOnTimer,this._speed*1000);  
    609.         return;  
    610.     }  
    611.       
    612.     var nextphoto=this.GetNextPhoto(this._showingphoto);  
    613.       
    614.     if(nextphoto)  
    615.     {  
    616.         this.ShowPhoto(nextphoto,true);  
    617.     }  
    618.     else  
    619.     {  
    620.         this.TogglePlay();  
    621.     }  
    622. }  
    623.   
    624. GalleryLayout.prototype.FindItemOfPhoto=function _GalleryLayout_FindItemOfPhoto(photo)  
    625. {  
    626.     if(!photo)return null;  
    627.     if(!this.items)return null;  
    628.     for(var i=0;i<this.items.length;i++)  
    629.     {  
    630.         var item=this.items[i];  
    631.         var p=item.dngphoto;  
    632.         if(p.CategoryID==photo.CategoryID&&p.PhotoID==photo.PhotoID)  
    633.             return item;  
    634.     }  
    635. }  
    636.   
    637.   
    638. GalleryLayout.prototype.ShowPhoto=function _GalleryLayout_ShowPhoto(photo,animation)  
    639. {  
    640.     var previtem;  
    641.     var nextitem;  
    642.       
    643.     if(this.items)  
    644.     {  
    645.         for(var i=0;i<this.items.length;i++)  
    646.         {  
    647.             var item=this.items[i];  
    648.             var p=item.dngphoto;  
    649.             if(p.CategoryID==photo.CategoryID&&p.PhotoID==photo.PhotoID)  
    650.             {  
    651.                 nextitem=item;  
    652.                   
    653.                 this.dng_topinfoname.innerHTML=HtmlEncode(photo.Title +" ("+photo.Width+"x"+photo.Height+") "+(photo.Comment||""))  
    654.                 this.dng_topinfoindex.innerHTML=HtmlEncode("Image "+(i+1)+ " of "this.items.length)  
    655.             }  
    656.             if(this._showingphoto)  
    657.             {  
    658.                 if(p.CategoryID==this._showingphoto.CategoryID&&p.PhotoID==this._showingphoto.PhotoID)  
    659.                 {  
    660.                     previtem=item;  
    661.                 }  
    662.             }  
    663.         }  
    664.           
    665.   
    666.     }  
    667.       
    668.     this._showingphoto=photo;  
    669.       
    670.     if(previtem)  
    671.     {  
    672.         previtem.className="";  
    673.     }  
    674.   
    675.     if(nextitem)  
    676.     {  
    677.         nextitem.className="GallerySelectedItem";  
    678.           
    679.         if(previtem)  
    680.         {  
    681.             var rightpos=this.nextScrollLeft+this._wheeldiv.offsetWidth-20;  
    682.               
    683.             if(nextitem.offsetLeft>this.nextScrollLeft&&nextitem.offsetLeft<rightpos)  
    684.             {  
    685.                 //item is in the view..  
    686.             }  
    687.             else if(nextitem.offsetLeft>previtem.offsetLeft)  
    688.             {  
    689.                 if(previtem.offsetLeft <= rightpos && nextitem.offsetLeft >= rightpos)  
    690.                 {  
    691.                     this.HandleWheel(-this._wheeldiv.offsetWidth);  
    692.                 }  
    693.                   
    694.                 if(nextitem.offsetLeft-previtem.offsetLeft>this._wheeldiv.offsetWidth)  
    695.                 {  
    696.                     this.HandleWheel(-this._wheeldiv.scrollWidth);  
    697.                 }  
    698.             }  
    699.             else  
    700.             {  
    701.                 if(previtem.offsetLeft >= this.nextScrollLeft && nextitem.offsetLeft <= this.nextScrollLeft)  
    702.                 {  
    703.                     this.HandleWheel(this._wheeldiv.offsetWidth);  
    704.                 }  
    705.                   
    706.                 if(nextitem.offsetLeft<this.nextScrollLeft)  
    707.                 {  
    708.                     this.HandleWheel(this.nextScrollLeft);  
    709.                 }  
    710.             }  
    711.         }  
    712.     }  
    713.       
    714.     if(this.dng_photo2.style.display=="none")  
    715.     {  
    716.         this.dng_photo2.style.display="";  
    717.         this._showingdiv=this.dng_photo2;  
    718.         this.currentpdivbg=this.dng_photo1;  
    719.     }  
    720.     else  
    721.     {  
    722.         this.dng_photo1.style.display="";  
    723.         this._showingdiv=this.dng_photo1;  
    724.         this.currentpdivbg=this.dng_photo2;  
    725.     }  
    726.       
    727.     if(this._isfullpage)  
    728.     {  
    729.         var br=GetBodyRect();  
    730.         var cw=br.width;  
    731.         var ch=br.height;  
    732.     }  
    733.     else  
    734.     {  
    735.         var cw=this.Browser.Control.offsetWidth;  
    736.         var ch=this.dng_container.offsetHeight-this.TOOLBARHEIGHT;  
    737.     }  
    738.       
    739.     var scale=Math.min( cw / photo.Width , ch / photo.Height );  
    740.       
    741.     if(this._autoexpend)  
    742.     {  
    743.     }  
    744.     else  
    745.     {  
    746.         if(scale>1)  
    747.             scale=1;  
    748.     }  
    749.       
    750.     var imgwidth=Math.floor(scale*photo.Width);  
    751.     var imgheight=Math.floor(scale*photo.Height);  
    752.   
    753.     this._showingimg=this.Browser.CreatePhoto(photo.Url,imgwidth,imgheight);  
    754.   
    755.     this._showingdiv.innerHTML="";  
    756.       
    757.     this.prevbtn=document.createElement("DIV");  
    758.     this.prevbtn.className="SlideShowPrevBtn";  
    759.     this.prevbtn.style.display="none";  
    760.     this._showingdiv.appendChild(this.prevbtn);  
    761.       
    762.     this.nextbtn=document.createElement("DIV");  
    763.     this.nextbtn.className="SlideShowNextBtn";  
    764.     this.nextbtn.style.display="none";  
    765.     this._showingdiv.appendChild(this.nextbtn);  
    766.   
    767.   
    768.     var alpha=0;  
    769.   
    770.     ToDelegate(this,PlayAlpha)();  
    771.       
    772.     this._showingdiv.style.zIndex=0;  
    773.     this.currentpdivbg.style.zIndex=-1;  
    774.     this.currentpdivbg.style.display="none";  
    775.       
    776.     this._showingdiv.appendChild(this._showingimg);  
    777.     this._showingdiv.style.display="";  
    778.       
    779.     function PlayAlpha()  
    780.     {  
    781.         alpha+=10;  
    782.           
    783.         GallerySetOpacity(this._showingdiv,alpha);  
    784.   
    785.         if(alpha<100)  
    786.         {  
    787.             this.SetPlayTimeout(PlayAlpha,100,"PlayAlpha");  
    788.         }  
    789.         else  
    790.         {  
    791.             this.currentpdivbg.style.display="none";  
    792.               
    793.             if(this.playing)  
    794.             {  
    795.                 this.SetPlayTimeout(this.PlayOnTimer,this._speed*1000,"PlayOnTimer");  
    796.             }  
    797.         }  
    798.     }  
    799.   
    800.     this.AdjustLayout();  
    801.       
    802.       
    803.           
    804.     var nextphoto=this.GetNextPhoto(photo);  
    805.     if(nextphoto)  
    806.     {  
    807.         var nextimg=document.createElement("IMG");  
    808.         nextimg.style.position="absolute";  
    809.         nextimg.style.width="1px";  
    810.         nextimg.style.height="1px";  
    811.         nextimg.style.right="0px";  
    812.         nextimg.style.bottom="0px";  
    813.         nextimg.onload=function()  
    814.         {  
    815.             document.body.removeChild(nextimg);  
    816.         }  
    817.         nextimg.error=function()  
    818.         {  
    819.             document.body.removeChild(nextimg);  
    820.         }  
    821.         InsertToBody(nextimg);  
    822.         setTimeout(function(){  
    823.             nextimg.src=nextphoto.Url;  
    824.         },1000);  
    825.     }  
    826.       
    827. }  
    828.   
    829. GalleryLayout.prototype.LayoutMouseMove=function _GalleryLayout_LayoutMouseMove(e)  
    830. {  
    831.     e=window.event||e;  
    832.   
    833.     if(this.lastmoveclientx==e.clientX&&this.lastmoveclienty==e.clientY)return;  
    834.     this.lastmoveclientx=e.clientX;  
    835.     this.lastmoveclienty=e.clientY;  
    836.   
    837.     if(this.playing&&this.playtimertype=="PlayOnTimer")  
    838.     {  
    839.         this.SetPlayTimeout(this.PlayOnTimer,this._speed*1000,"PlayOnTimer");  
    840.     }  
    841.   
    842.     if(this.nextbtn)this.nextbtn.style.display="none";  
    843.     if(this.prevbtn)this.prevbtn.style.display="none";  
    844.   
    845.     var x=e.clientX-GetClientPosition(this._showingdiv).left;  
    846.     var y=e.clientY-GetClientPosition(this._showingdiv).top;  
    847.               
    848.     this.ActiveTopBottomInfo(y);  
    849.   
    850.     var cursor="hand";  
    851.     var cw=this.dng_container.clientWidth;  
    852.     if(x<cw*2/7)  
    853.     {  
    854.         this.divcursortype="Prev";  
    855.         if(this.prevbtn)this.prevbtn.style.display="";  
    856.         cursor="url("+this.Browser.Param.Folder+"Layout/"+this.Browser.Param.Layout+"/Images/showprev.cur)";  
    857.     }  
    858.     else if(x>cw*5/7)  
    859.     {  
    860.         this.divcursortype="Next";  
    861.         if(!this._isfullpage)  
    862.         {  
    863.             if(this.nextbtn)this.nextbtn.style.display="";  
    864.             cursor="url("+this.Browser.Param.Folder+"Layout/"+this.Browser.Param.Layout+"/Images/shownext.cur)";  
    865.         }  
    866.     }  
    867.     else  
    868.     {  
    869.         this.divcursortype="None";  
    870.         cursor="hand";  
    871.     }  
    872.     try  
    873.     {  
    874.         if(window.XMLHttpRequest)  
    875.         {  
    876.             img.style.cursor=cursor;  
    877.             this._showingdiv.style.cursor=cursor;  
    878.             this.currentpdivbg.style.cursor=cursor;  
    879.         }  
    880.     }  
    881.     catch(x)  
    882.     {  
    883.     }  
    884. }  
    885. GalleryLayout.prototype.LayoutClick=function _GalleryLayout_LayoutClick(e)  
    886. {  
    887.     this.LayoutMouseMove(e);  
    888.     switch(this.divcursortype)  
    889.     {  
    890.         case "Next":  
    891.             clearTimeout(this.playtimerid);  
    892.             this.ShowPhoto(this.GetNextPhoto(this._showingphoto));  
    893.             break;  
    894.         case "Prev":  
    895.             clearTimeout(this.playtimerid);  
    896.             this.ShowPhoto(this.GetPrevPhoto(this._showingphoto));  
    897.             break;  
    898.         case "Open":  
    899.         default:  
    900.             if(!this._isfullpage)  
    901.             {  
    902.                 this.Browser.ShowViewer(this._showingphoto);  
    903.             }  
    904.             else  
    905.             {  
    906.                 clearTimeout(this.playtimerid);  
    907.                 this.ShowPhoto(this.GetNextPhoto(this._showingphoto));  
    908.             }  
    909.             break;  
    910.     }  
    911. }  
    912. GalleryLayout.prototype.LayoutMouseOut=function _GalleryLayout_LayoutMouseOut(e)  
    913. {  
    914.     if(this.nextbtn)this.nextbtn.style.display="none";  
    915.     if(this.prevbtn)this.prevbtn.style.display="none";  
    916.       
    917.     clearTimeout(this.hidetopinfotimerid);  
    918.     this.hidetopinfotimerid=setTimeout(ToDelegate(this,this._ContinueHideTopInfo),100);  
    919. }  
    920.   
    921.   
    922.   
    923. GalleryLayout.prototype.SetSpeed=function _GalleryLayout_SetSpeed(spd)  
    924. {  
    925.     this._speed=spd;  
    926.     if(this.playtimertype=="PlayOnTimer"&&this.playing)  
    927.     {  
    928.         this.SetPlayTimeout(this.PlayOnTimer,this._speed*1000,"PlayOnTimer");  
    929.     }  
    930. }  
    931.   
    932. GalleryLayout.prototype.ShowConfig=function _GalleryLayout_ShowConfig()  
    933. {  
    934.     //this.dng_btn_config  
    935.       
    936.     GalleryHideTooltip();  
    937.       
    938.     var menu=CreateGalleryMenu(this.Browser.ThemeFolder);  
    939.       
    940.     var selimg=this.Browser.GetTheme("Images/standard-selected.png");  
    941.   
    942.     if(this.Browser.Param.AllowEdit)  
    943.     {  
    944.         menu.Add(1,GalleryLocalize.CLICK_SHOWEDITOR,null,ToDelegate(this,function Edit(){  
    945.             this.Browser.ShowEditor();  
    946.         }));  
    947.   
    948.         menu.AddSpliter();  
    949.     }  
    950.       
    951.     menu.Add(1,GalleryLocalize.CLICK_SHOWSLIDER,null,ToDelegate(this,function Slider(){  
    952.         this.Browser.ShowSlider()  
    953.         //this.ToggleFullPage();  
    954.     }));  
    955.   
    956.     menu.AddSpliter();  
    957.       
    958.       
    959.     menu.Add(1,"Faster",this._speed==2.0?selimg:null,ToDelegate(this,function(){  
    960.         this.SetSpeed(2.0);  
    961.     }));  
    962.     menu.Add(1,"Medium",this._speed==5.0?selimg:null,ToDelegate(this,function(){  
    963.         this.SetSpeed(5.0);  
    964.     }));  
    965.     menu.Add(1,"Slower",this._speed==8.0?selimg:null,ToDelegate(this,function(){  
    966.         this.SetSpeed(8.0);  
    967.     }));  
    968.       
    969.     menu.AddSpliter();  
    970.           
    971.     menu.Add(1,GalleryLocalize.TODO("Auto Expend"),this._autoexpend?selimg:null,ToDelegate(this,function Slider(){  
    972.         this._autoexpend=!this._autoexpend;  
    973.         if(this._showingphoto)  
    974.         {  
    975.             this.ShowPhoto(this._showingphoto);  
    976.         }  
    977.     }));  
    978.   
    979.     var pos=GetScrollPosition(this.dng_btn_config);  
    980.     menu.Show(this.dng_btn_config,0,this.dng_btn_config.offsetHeight,this.dng_btn_config);  
    981.       
    982. }  
    983.   
    984.   
    985. GalleryLayout.prototype.HandleKeyDown=function _GalleryLayout_HandleKeyDown(event)  
    986. {  
    987.     event=event||window.event;  
    988.       
    989.     if(event.keyCode==27)   //ESC  
    990.     {  
    991.         if(this._isfullpage)  
    992.         {  
    993.             this.ToggleFullPage();  
    994.         }  
    995.     }  
    996.     else if(event.keyCode==122) //F11  
    997.     {  
    998.         var br=GetBodyRect();  
    999.           
    1000.         var oldcwch=br.width+br.height;  
    1001.           
    1002.         var CheckFunc=ToDelegate(this,function(){  
    1003.             var br=GetBodyRect();  
    1004.               
    1005.             var newcwch=br.width+br.height;  
    1006.               
    1007.             if(newcwch-oldcwch>60)  
    1008.             {  
    1009.                 if(!this._isfullpage)  
    1010.                     this.ToggleFullPage();  
    1011.             }  
    1012.             else if(oldcwch-newcwch>60)  
    1013.             {  
    1014.                 if(this._isfullpage)  
    1015.                     this.ToggleFullPage();  
    1016.             }  
    1017.         });  
    1018.           
    1019.         setTimeout(CheckFunc,200)  
    1020.     }  
    1021. }  
    1022.   
    1023. GalleryLayout.prototype.ToolbarMouseOver=function _GalleryLayout_ToolbarMouseOver()  
    1024. {  
    1025.     this.toolbarisover=true;  
    1026.     clearTimeout(this.hidetoolbartimerid);  
    1027. }  
    1028. GalleryLayout.prototype.ToolbarMouseOut=function _GalleryLayout_ToolbarMouseOut()  
    1029. {  
    1030.     this.toolbarisover=false;  
    1031. }  
    1032.   
    1033. GalleryLayout.prototype._ContinueHideTopInfo=function _GalleryLayout_ContinueHideTopInfo()  
    1034. {  
    1035.     this.topinfoopacity-=10;  
    1036.     if(this.topinfoopacity<=0)  
    1037.     {  
    1038.         this.dng_topinfo.style.display="none";  
    1039.     }  
    1040.     else  
    1041.     {  
    1042.         GallerySetOpacity(this.dng_topinfo,this.topinfoopacity);  
    1043.         this.hidetopinfotimerid=setTimeout(ToDelegate(this,this._ContinueHideTopInfo),100);  
    1044.     }  
    1045. }  
    1046.   
    1047. GalleryLayout.prototype._ContinueHideToolbar=function _GalleryLayout_ContinueHideToolbar()  
    1048. {  
    1049.     if(!this._isfullpage)return;  
    1050.               
    1051.     this.toolbaropacity-=10;  
    1052.     if(this.toolbaropacity<=0)  
    1053.     {  
    1054.         this.dng_toolbar.style.display="none";  
    1055.     }  
    1056.     else  
    1057.     {  
    1058.         GallerySetOpacity(this.dng_toolbar,this.toolbaropacity);  
    1059.         this.hidetoolbartimerid=setTimeout(ToDelegate(this,this._ContinueHideToolbar),100);  
    1060.     }  
    1061. }  
    1062.   
    1063. GalleryLayout.prototype.ActiveTopBottomInfo=function _GalleryLayout_ActiveTopBottomInfo(offsetY)  
    1064. {  
    1065.     if(offsetY<this.dng_container.offsetHeight/3)  
    1066.     {  
    1067.         this.dng_topinfo.style.display="";  
    1068.         this.topinfoopacity=80;  
    1069.         GallerySetOpacity(this.dng_topinfo,this.topinfoopacity);  
    1070.         clearTimeout(this.hidetopinfotimerid);  
    1071.         this.hidetopinfotimerid=setTimeout(ToDelegate(this,this._ContinueHideTopInfo),this._speed*1000+2000);  
    1072.     }  
    1073.       
    1074.     if(this._isfullpage)  
    1075.     {  
    1076.         this.dng_toolbar.style.display="";  
    1077.         this.toolbaropacity=100;  
    1078.         GallerySetOpacity(this.dng_toolbar,this.toolbaropacity);  
    1079.         clearTimeout(this.hidetoolbartimerid);  
    1080.         this.hidetoolbartimerid=setTimeout(ToDelegate(this,this._ContinueHideToolbar),1000);  
    1081.     }  
    1082. }  
    1083.   
    1084. GalleryLayout.prototype.AdjustLayout=function _GalleryLayout_AdjustLayout()  
    1085. {  
    1086.     //TODO:improve this logic, should check the size of the this.Browser.Control  
    1087.     var br=GetBodyRect();  
    1088.   
    1089.     if(this._isfullpage)  
    1090.     {  
    1091.         var pos=CalcPosition(this.dng_container,document.body,true);  
    1092.         var style=this.dng_container.style;  
    1093.         if(style.position=="absolute")  
    1094.         {  
    1095.             style.left=br.left+pos.left+"px";  
    1096.             style.top=br.top+pos.top+"px";  
    1097.         }  
    1098.         else    //IE7  
    1099.         {  
    1100.             pos=GetScrollPosition(this.Browser.Control);  
    1101.             document.documentElement.scrollTop=pos.top;  
    1102.             document.documentElement.scrollLeft=pos.left;  
    1103.             this.Browser.Control.runtimeStyle.width=br.width+"px";  
    1104.             this.Browser.Control.runtimeStyle.height=br.height+"px";  
    1105.         }  
    1106.           
    1107.         style.width=br.width+"px";  
    1108.         style.height=br.height+"px";  
    1109.     }  
    1110.   
    1111.     if(this._isfullpage)  
    1112.     {  
    1113.         var cw=br.width;  
    1114.         var ch=br.height;  
    1115.   
    1116.         this.dng_toolbar.style.top=ch-this.TOOLBARHEIGHT+"px";  
    1117.     }  
    1118.     else  
    1119.     {  
    1120.         var cw=this.Browser.Control.offsetWidth;  
    1121.         var ch=this.Browser.Control.offsetHeight-this.TOOLBARHEIGHT;  
    1122.   
    1123.         this.dng_toolbar.style.top=ch+"px";  
    1124.     }  
    1125.       
    1126.     this.dng_toolbar.style.width=cw+"px";  
    1127.       
    1128.     this.dng_photo1.style.width=this.dng_photo2.style.width=cw+"px";  
    1129.     this.dng_photo1.style.height=this.dng_photo2.style.height=ch+"px";  
    1130.   
    1131.     if(this._showingimg)  
    1132.     {  
    1133.         var imgwidth=parseInt(this._showingimg.style.width)  
    1134.         var imgheight=parseInt(this._showingimg.style.height)  
    1135.         //this._showingdiv.style.paddingTop=Math.max(0,Math.floor(ch/2-imgheight/2))+"px";  
    1136.           
    1137.         this._showingimg.style.position="absolute";  
    1138.         this._showingimg.style.zIndex="-1";  
    1139.         this._showingimg.style.top=Math.max(0,Math.floor(ch/2-imgheight/2))+"px";  
    1140.         this._showingimg.style.left=Math.max(0,Math.floor(cw/2-imgwidth/2))+"px";  
    1141.           
    1142.         if(this.prevbtn)this.prevbtn.style.left=Math.max(0,Math.floor(cw/2-imgwidth/2))+"px";  
    1143.         if(this.prevbtn)this.nextbtn.style.right=Math.max(0,Math.floor(cw/2-imgwidth/2))+"px";  
    1144.     }  
    1145.   
    1146.   
    1147.     if(this.SetScrollBarPos)  
    1148.     {  
    1149.         this.SetScrollBarPos();  
    1150.     }  
    1151.   
    1152.     if(this.dng_tabcontainer.offsetWidth<10||!this._wheeldiv)  
    1153.         return;  
    1154.       
    1155.     if(  
    1156.         this._lastpw!=this.dng_photo1.offsetWidth  
    1157.         ||  
    1158.         Math.abs(this._wheeldiv.offsetWidth-this.dng_tabcontainer.offsetWidth)>10  
    1159.     ){  
    1160.         this._wheeldiv.style.width="1px";  
    1161.         this._wheeldiv.style.width=this.dng_tabcontainer.offsetWidth-6+"px";  
    1162.     }  
    1163.       
    1164.     this._lastpw=this.dng_photo1.offsetWidth;  
    1165.       
    1166. }  
    1167.   
    1168.   
    1169. GalleryLayout.prototype.ToggleFullPage=function _GalleryLayout_ToggleFullPage()  
    1170. {  
    1171.     var br=GetBodyRect();  
    1172.       
    1173.     var isie7=navigator.userAgent.indexOf("MSIE 7.")>-1;  
    1174.       
    1175.     if(!this._isfullpage)  
    1176.     {  
    1177.         this.save_autoexpend=this._autoexpend;  
    1178.         this._autoexpend=true;  
    1179.           
    1180.         this.bodyoverflow=document.body.style.overflow;  
    1181.         document.body.style.overflow="hidden";  
    1182.         document.documentElement.style.overflow="hidden";  
    1183.           
    1184.         if(isie7)  
    1185.         {  
    1186.         }  
    1187.         else  
    1188.         {  
    1189.             this.dng_container.style.position="absolute";  
    1190.         }  
    1191.   
    1192.         this.dng_container.className="ZINDEXSLIDER";  
    1193.         this.dng_container.style.borderWidth="0px";  
    1194.         this._isfullpage=true;  
    1195.           
    1196.         this.Browser.ShowF11KeyMessage();  
    1197.     }  
    1198.     else  
    1199.     {  
    1200.         this._autoexpend=this.save_autoexpend;  
    1201.           
    1202.         document.body.style.overflow=this.bodyoverflow||"";  
    1203.         document.documentElement.style.overflow="";  
    1204.           
    1205.         if(isie7)  
    1206.         {  
    1207.             this.Browser.Control.runtimeStyle.cssText="";  
    1208.         }  
    1209.         else  
    1210.         {  
    1211.             this.dng_container.style.position="relative";  
    1212.         }  
    1213.           
    1214.         this.dng_container.style.left="";  
    1215.         this.dng_container.style.top="";  
    1216.         this.dng_container.style.width="100%";  
    1217.         this.dng_container.style.height="100%";  
    1218.         this.dng_container.style.borderWidth="";  
    1219.         this.dng_container.className="";  
    1220.         this.dng_toolbar.style.display="";  
    1221.         GallerySetOpacity(this.dng_toolbar,100);  
    1222.         this._isfullpage=false;  
    1223.     }  
    1224.       
    1225.     if(this._showingphoto)  
    1226.     {  
    1227.         this.ShowPhoto(this._showingphoto);  
    1228.     }  
    1229.     else  
    1230.     {  
    1231.         this.AdjustLayout();  
    1232.     }  
    1233. }  
    1234.   
    1235.   
    1236. GalleryLayout.prototype.Ajax_Result=function _GalleryLayout_Ajax_Result(ret,param,method)  
    1237. {  
    1238.     if(method=="GetAllCategoryData"||method=="GetCategoryData")  
    1239.     {  
    1240.         this._categories=this.Browser.GetCategories();  
    1241.         this.DrawUI();  
    1242.     }  

     
     
    3. Create an example page like below and test it.
     
    Note:  In the code below have a url http://localhost:52608/Gallery/test.aspx, you need to change it to the url of the page below on your site
     
    1. <%@ Page Language="c#" AutoEventWireup="false" %>  
    2.   
    3. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>  
    4.   
    5. <script runat="server">  
    6.     protected override void OnInit(EventArgs e)  
    7.     {  
    8.         base.OnInit(e);  
    9.   
    10.         GalleryBrowser1.Layout = "SlideShow";  
    11.   
    12.         //  if(Context.User.Identity.Name=="Admin")  
    13.         //  {  
    14.         GalleryBrowser1.AllowEdit = true;  
    15.         GalleryBrowser1.AllowPostComment = true;  
    16.         GalleryBrowser1.AllowShowComment = true;  
    17.         //  }  
    18.   
    19.         HyperLink hl;  
    20.         using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))  
    21.         {  
    22.             string[] categoryArray = provider.GetCategoryArray();  
    23.             for (int i = 0; i < categoryArray.Length; i++)  
    24.             {  
    25.                 //category title  
    26.                 string title;  
    27.                 //category description  
    28.                 string description;  
    29.                 //category properties  
    30.                 string properties;  
    31.                 if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))  
    32.                 {  
    33.                 }  
    34.                 //add the category link into panel1  
    35.                 hl = new HyperLink();  
    36.                 hl.ID = hl + i.ToString();  
    37.                 hl.Text = title;  
    38.                 //change the url to the page in your site  
    39.                 hl.NavigateUrl = "http://localhost:52608/Gallery/test.aspx?Category=" + (i+1).ToString();  
    40.                 hl.Style.Value = "margin-right:30px";  
    41.                 panel1.Controls.Add(hl);  
    42.             }  
    43.   
    44.         }  
    45.   
    46.     }  
    47. </script>  
    48.   
    49. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    50. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
    51. <head>  
    52.     <title>SlideShow Layout - DotNetGallery</title>  
    53. </head>  
    54. <body>  
    55.     <form id="form1" runat="server">  
    56.         <div id="Common">  
    57.             <div id="CommonBody" align="center">  
    58.                 <asp:Label ID="label1" runat="server" Text="change category here"></asp:Label><br />  
    59.                 <asp:Panel ID="panel1" runat="server" Style="border: solid 1px red; margin: 30px;  
    60.                     padding: 30px">  
    61.                 </asp:Panel>  
    62.                 <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a><br />  
    63.                 <DotNetGallery:GalleryBrowser runat="server" ID="GalleryBrowser1" Width="720" Height="400" />  
    64.             </div>  
    65.         </div>  
    66.     </form>  
    67. </body>  
    68. </html> 
     
     
    Regards,
     
    ken
View Complete Thread