﻿
        
/**  populate the vidoes list in the table format **/
function populateVideoView(videoList)
 {
    var rowCount = videoList.length;       
 
    var tableHtml = "";
    
    tableHtml += "<table width=\"400\" cellspacing=\"0\" cellpadding=\"6\" border=\"0\">";
    tableHtml += "<tr>";
    
    tableHtml += "<table cellspacing=\"0\" cellpadding=\"6\" border=\"0\" width=\"400\" >"; 
    tableHtml += "<tr>";
        
    
    for(idx=0;idx<rowCount;idx++)
    {               
       tableHtml += "<td width=\"110\">";
       
       tableHtml += "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">";
    
       tableHtml += populateVideoImageSection(videoList[idx].VideoName,videoList[idx].VideoUrl,videoList[idx].ThumbUrl);
       tableHtml += populateTitleSection(videoList[idx].VideoUrl,videoList[idx].VideoName);
       tableHtml += populateUsernameSection(videoList[idx].UserId,videoList[idx].CreatedBy);
       tableHtml += populateViewSection(videoList[idx].ViewCount);       
       
       tableHtml += "</table>";
       
       tableHtml += "</td>";
    }
    
    tableHtml += "</tr>";        
    tableHtml+="</table>";    

    tableHtml += "</tr>";
    tableHtml += "</table>";
    
            
    $("#recentVideosDiv").append(tableHtml);        
 }
 
 
 /** create the view section and append to the table **/
function populateViewSection(viewCount)
{
    var viewsHtml = "<tr>"+
                        "<td width=\"110\" style=\"font-size: 10px; line-height: 10px;\" scope=\"col\" class=\"ChnlLink\">"+
                                              viewCount + " Views"+
                        "</td>"+
                     "</tr>"; 
    return viewsHtml;                            
} 

/** create the username section and append to the table **/
function populateUsernameSection(userId,username)
{
   var usernameHtml = "<tr>"+
                        "<td width=\"110\" style=\"font-size: 10px; line-height: 10px;\" scope=\"col\">"+
                         "<a target=\"_top\" href=\"UserInner.aspx?UserId="+userId+"\" border=\"0\" class=\"user\">"+username+"</a>"+
                        "</td>"+
                      "</tr>";
      return usernameHtml;                      
}

/** create the title section and append to the table **/
function populateTitleSection(fileName,videoName)
{
   var titleHtml = "<tr>"+
                     "<td width=\"110\" style=\"font-size: 13px; line-height: 10px;\" scope=\"col\" class=\"head\">"+
                       "<a target=\"_top\" href=\"Inner.aspx?FileName="+fileName+"\" border=\"0\" class=\"head1\">"+videoName+"</a>"+
                     "</td>"+
                    "</tr>";
                    
    return titleHtml;                    
}
 

/** create the video image section and append to the table **/
function populateVideoImageSection(title, fileName,thumbUrl)
{
  var imageHtml = "<tr>"+
                     "<td width=\"110\" scope=\"col\">"+
                       "<a target=\"_top\" href=\"Inner.aspx?FileName="+fileName+"\" border=\"0\">"+
                        "<img width=\"110\" height=\"70\" border=\"0\" title=\""+title+"\" src=\"files/"+thumbUrl+"\" /></a>"+
                     "</td>"+
                     "<td></td>"+
                    "</tr>";
                    
    return imageHtml;                    
}


 

