public HTML5VideoPickerEntity GetEntity(HTML5VideoDataSet.HTML5VideosRow dr) { // No datarow provided if (dr == null) { return(null); } // Create new picker HTML5VideoPickerEntity entity = new HTML5VideoPickerEntity(); entity.Key = dr.Src; entity.DisplayText = dr.Src; entity.Alt = dr.Alt; entity.Src = dr.Src; entity.Height = dr.Height; entity.Width = dr.Width; entity.Description = dr.Alt; entity.Web = dr.Web; entity.List = dr.List; entity.Preview = dr.Preview; entity.IsResolved = true; entity.ItemId = dr.VideoId; return(entity); }
protected void RenderRowColumn(HTML5VideoDataSet.HTML5VideosRow row, int iColumn, Control parent) { string str = string.Empty; TableCell child = new TableCell { CssClass = "ms-pb" }; child.Attributes.Add("nowrap", "true"); child.Attributes.Add("UNSELECTABLE", "on"); child.Width = new Unit(10); Literal literal = new Literal(); //video if ((iColumn == 0)) { string str2 = "false"; str = "<a class=\"thumbnail\" href='javascript:' onfocus='PickerResultsNameOnFocus(this, event, " + str2 + " );' onkeydown='PickerResultsNameOnKeyDown(this, event," + str2 + ");' onclick='" + this.selectOnName + "' id='resultTable_" + parent.ID + "_Link'>"; str += "<img width=\"48\" height=\"48\" border='0' src=\"" + row.Preview + "\" alt=\"" + row.Alt + "\"/>"; str += "<span><img src=\"" + row.Preview + "\" alt=\"" + row.Alt + "\"/></span>"; str += "</a>"; } //Name if ((iColumn == 1)) { str = row.Name; } //Dimension if ((iColumn == 2)) { str = row.Height.ToString() + " x " + row.Width.ToString(); } //Alt if ((iColumn == 3)) { str = row.Alt; } //Keywords if ((iColumn == 4)) { str = row.Keywords; } //Web if ((iColumn == 5)) { str = row.Web; } //List if ((iColumn == 6)) { str = row.List; } literal.Text = str; child.Controls.Add(literal); parent.Controls.Add(child); }
private void GetVideosForWeb(Guid guid, string search, string groupname) { if (site == null) { site = SPContext.Current.Site; } SPWeb web = site.RootWeb; if (guid != Guid.Empty) { web = site.OpenWeb(guid); } bool rootweb = web.IsRootWeb; foreach (SPList list in web.Lists) { if (list.IsSiteAssetsLibrary || ContainsVideoTypes(list)) { SPField searchField = list.Fields[new Guid(groupname)]; SPListItemCollection items = null; if (!string.IsNullOrEmpty(search)) { SPQuery query = new SPQuery(); string valueType = searchField.TypeAsString; if (searchField.Type == SPFieldType.Calculated) { valueType = "Text"; } query.ViewAttributes = "Scope=\"Recursive\""; query.Query = string.Format("<Where><{0}><FieldRef ID=\"{1}\"/><Value Type=\"{2}\">{3}</Value></{0}></Where>" , searchOperator ?? "Contains" , searchField.Id.ToString() , valueType , search); items = list.GetItems(query); //Select the videos based upon search. foreach (SPListItem item in items) { try { if (item.ContentTypeId == ContentTypeId.Video || item.ContentTypeId.Parent == ContentTypeId.Video) { HTML5VideoDataSet.HTML5VideosRow row = dataset.HTML5Videos.NewHTML5VideosRow(); row.VideoId = item.UniqueId; row.Name = item.Title; row.Preview = Convert.ToString(item["ows_EncodedAbsUrl"]); row.Keywords = Convert.ToString(item["ows_Keywords"]); row.Width = Convert.ToInt32(item[BuildFieldId.Content_Width]); row.Height = Convert.ToInt32(item[BuildFieldId.Content_Height]); row.Alt = "";// Convert.ToString(item["ows_Description"]); row.Web = item.Web.Title; row.List = item.ParentList.Title; if (rootweb) { row.Src = item.File.ParentFolder.ServerRelativeUrl; } else { row.Src = Path.Combine("/" + item.Web.ServerRelativeUrl, item.File.ParentFolder.Url); } dataset.HTML5Videos.AddHTML5VideosRow(row); row.AcceptChanges(); } } catch (Exception ex) { ex.ToString(); } } } } } if (!web.IsRootWeb) { GetVideosForWeb(web.ParentWeb.ID, search, groupname); } }