Re: Komments (guest)

  •  06-07-2013, 12:26 PM

    Re: Komments (guest)

    Hi kjell.ek,

     

    Please open file  E"\CuteSoft_Client\Gallery\Share\Popup\Dialogs\comments.htm" and delete all the content of it. Then use the code below.

     

    1. <div id="dng_showarea" style='overflow:auto;padding:6px;'>  
    2. </div>  
    3. <div id="dng_postarea" style='overflow:auto;height:120px;'>  
    4.     <table border='0' cellspacing='0' cellpadding='4' ID="Table1">  
    5.         <tr>  
    6.             <td>Name:</td>  
    7.             <td></span><input id="input_name" /></td>  
    8.         </tr>  
    9.         <tr>  
    10.             <td>Text:</td>  
    11.             <td>  
    12.                 <textarea id="dng_content" style="height:48px;" NAME="dng_content"></textarea>  
    13.             </td>  
    14.         </tr>  
    15.         <tr>  
    16.             <td> </td>  
    17.             <td>  
    18.                 <button id="dng_sendbtn">Post Comment</button>  
    19.             </td>  
    20.         </tr>  
    21.     </table>  
    22. </div>  
    23. <span id='dng_name' style="visibility:hidden">  
    24. <script>  
    25.   
    26. //see GalleryPopup.prototype.ShowComments  
    27. var item=Param.arg_item;  
    28.   
    29. var browser=Browser;  
    30.   
    31. var singlearea=null;  
    32. if(!browser.Param.AllowShowComment)  
    33. {  
    34.     dng_showarea.style.display="none";  
    35.     singlearea=dng_postarea;  
    36. }  
    37. if(!browser.Param.AllowPostComment)  
    38. {  
    39.     dng_postarea.style.display="none";  
    40.     singlearea=dng_showarea;  
    41. }  
    42.   
    43. var content=getcontent();  
    44. content.style.overflow="hidden";  
    45.   
    46. dng_name.appendChild(document.createTextNode(browser.Param.LogonUserName||GalleryLocalize.DEFAULTSENDERNAME));  
    47.   
    48. function onresizedialog()  
    49. {  
    50.     var w=content.offsetWidth-12;  
    51.     var h=content.offsetHeight;  
    52.     if(singlearea)  
    53.     {  
    54.         singlearea.style.width=w+"px";  
    55.         singlearea.style.height=h+"px";  
    56.     }  
    57.     else  
    58.     {  
    59.         dng_postarea.style.width=w+"px";  
    60.         dng_postarea.style.height="130px";  
    61.         dng_showarea.style.width=w+"px";  
    62.         dng_showarea.style.height=h-130+"px";  
    63.     }  
    64.     dng_content.style.width=w-100+"px";  
    65. }  
    66.   
    67. dng_sendbtn.onclick=function()  
    68. {  
    69.     var text=dng_content.value;  
    70.       
    71.     if(text.replace(/\s/g,"").length==0)  
    72.     {  
    73.         dng_content.focus();  
    74.         return;  
    75.     }  
    76.       
    77.     var p={};  
    78.     p.GuestName=document.getElementById("input_name").value;  
    79.     p.PhotoID=item.PhotoID;  
    80.     p.CategoryID=item.CategoryID;  
    81.     p.Content=text;  
    82.     p.Callback=function(ret)  
    83.     {  
    84.         if(browser.HandleError(ret))return true;  
    85.         alert("Comment Added");  
    86.         closedialog();  
    87.         showComments();  
    88.     }  
    89.     if(item.PhotoID)  
    90.         browser.AsyncAddPhotoComment(p);  
    91.     else  
    92.         browser.AsyncAddCategoryComment(p);  
    93.     return false;  
    94. }  
    95.   
    96. showComments();  
    97.   
    98. function showComments()  
    99. {  
    100.     var container=dng_showarea;  
    101.       
    102.     container.innerHTML="";  
    103.   
    104.     if(item.Thumbnail)  
    105.     {  
    106.         var scale = Math.min(128/item.Width, 128/item.Height);  
    107.         var width=Math.floor(item.Width * scale);  
    108.         var height=Math.floor(item.Height * scale)  
    109.         var thumb=Browser.CreateThumbnail(item.Thumbnail,width,height);  
    110.         var d=document.createElement("DIV");  
    111.         d.style.styleFloat="right";  
    112.         d.style["float"]="right";  
    113.         d.style.padding="12px";  
    114.         d.appendChild(thumb);  
    115.         container.appendChild(d);  
    116.     }  
    117.       
    118.     var cs=item.Comments;  
    119.       
    120.     var d=document.createElement("DIV");  
    121.   
    122.     d.appendChild(document.createTextNode(item.Title||GalleryLocalize.DEFAULTCATEGORYNAME));  
    123.     d.innerHTML+=" - <span class='GalleryTooltipNumComments'>"+(cs?cs.length:0)+" "+GalleryLocalize.NUMCOMMENTS+"<span>";  
    124.     container.appendChild(d);  
    125.                   
    126.     if(cs&&cs.length>0)  
    127.     {  
    128.         for(var i=0;i<cs.length;i++)  
    129.         {  
    130.             var comment=cs[i];  
    131.             d=document.createElement("DIV");  
    132.             d.className="GalleryComment";  
    133.             var s0=document.createElement("SPAN");  
    134.             s0.innerHTML=GalleryFormatTimeHTML(comment.Time);  
    135.             s0.className="GalleryCommentTime";  
    136.             d.appendChild(s0);  
    137.             var s1=document.createElement("SPAN");  
    138.             s1.appendChild(document.createTextNode(comment.SenderName||GalleryLocalize.DEFAULTSENDERNAME));  
    139.             s1.className="GalleryCommentUser";  
    140.             d.appendChild(s1);  
    141.             d.appendChild(document.createTextNode(" : "));  
    142.             var s2=document.createElement("SPAN");  
    143.             s2.appendChild(document.createTextNode(comment.Content));  
    144.             s2.className="GalleryCommentText";  
    145.             d.appendChild(s2);  
    146.             container.appendChild(d);  
    147.         }  
    148.     }  
    149. }  
    150.   
    151. </script>  
     

    Regards,

     

    Ken 

View Complete Thread