public override void PartCommunicationConnect(string interfaceName, Microsoft.SharePoint.WebPartPages.WebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt) { roxority_FilterWebPart wp = connectedPart as roxority_FilterWebPart; if ((wp != null) && !wp.CamlFilters) { wp.additionalWarningsErrors.Add(wp ["CqwpCaml"]); } }
public override void PartCommunicationConnect(string interfaceName, Microsoft.SharePoint.WebPartPages.WebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt) { roxority_FilterWebPart part = connectedPart as roxority_FilterWebPart; if ((part != null) && !part.CamlFilters) { part.additionalWarningsErrors.Add(part["CqwpCaml", new object[0]]); } }
public SPWebPartInstance(ObjectInstance prototype, WebPart webPart) : this(prototype) { if (webPart == null) { throw new ArgumentNullException("webPart"); } m_webPart = webPart; }
public override void PartCommunicationConnect(string interfaceName, Microsoft.SharePoint.WebPartPages.WebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt) { if (interfaceName == "roxorityConsumeCell") { this._cellConnected = true; } if (interfaceName == "roxorityProvideRow") { this._rowConnected = true; } }
internal void InitWebPart(SystemWebPart webPart) { TahoeWebPart twp = webPart as TahoeWebPart; webPart.ChromeType = PartChromeType.None; webPart.AllowClose = webPart.AllowConnect = webPart.AllowEdit = webPart.AllowHide = webPart.AllowMinimize = webPart.AllowZoneChange = false; if (twp != null) { twp.UseDefaultStyles = true; } }
public string GetRollupClickScript(IDictionary inst, string webPageUrl, TahoeWebPart webPart, List <object []> filters, List <string> andFilters, Dictionary <string, string> oobFilterPairs) { string pageUrl = string.Empty, query = string.Empty, jop = "&rpzopt=' + encodeURI(JSON.stringify(roxLastOps['" + webPart.ID + "'][1]))"; SortedDictionary <string, string> qs = new SortedDictionary <string, string> (); qs ["rule"] = inst ["id"] + string.Empty; qs ["exportlist"] = webPart.ID; qs ["View"] = HttpUtility.UrlEncode(webPageUrl); qs ["t"] = HttpUtility.UrlEncode(webPart.Title); qs ["r"] = DateTime.Now.Ticks.ToString(); foreach (KeyValuePair <string, string> kvp in qs) { query += ((string.IsNullOrEmpty(query) ? "?" : "&") + kvp.Key + "=" + kvp.Value); } pageUrl = SPContext.Current.Web.Url.TrimEnd('/') + "/_layouts/" + ProductPage.AssemblyName + "/expo.aspx" + query; return((IsLic(2) ? 2 : 0) + "location.href='" + pageUrl + jop + ";"); }
public override void PartCommunicationConnect(string interfaceName, WssWebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt) { }
/// <summary> /// Adds a List View Web Part to the specified page. /// </summary> /// <param name="pageUrl">The page URL.</param> /// <param name="listUrl">The list URL.</param> /// <param name="title">The title.</param> /// <param name="viewTitle">Title of the view.</param> /// <param name="zoneId">The zone ID.</param> /// <param name="zoneIndex">Index within the zone.</param> /// <param name="linkTitle">if set to <c>true</c> [link title].</param> /// <param name="chromeType">Type of the chrome.</param> /// <param name="publish">if set to <c>true</c> [publish].</param> /// <returns></returns> public static Microsoft.SharePoint.WebPartPages.WebPart Add(string pageUrl, string listUrl, string title, string viewTitle, string zoneId, int zoneIndex, bool linkTitle, string jsLink, PartChromeType chromeType, bool publish) { using (SPSite site = new SPSite(pageUrl)) using (SPWeb web = site.OpenWeb()) // The url contains a filename so AllWebs[] will not work unless we want to try and parse which we don't { SPFile file = web.GetFile(pageUrl); // file.Item will throw "The object specified does not belong to a list." if the url passed // does not correspond to a file in a list. SPList list = Utilities.GetListFromViewUrl(listUrl); if (list == null) { throw new ArgumentException("List not found."); } SPView view = null; if (!string.IsNullOrEmpty(viewTitle)) { view = list.Views.Cast <SPView>().FirstOrDefault(v => v.Title == viewTitle); if (view == null) { throw new ArgumentException("The specified view was not found."); } } bool checkBackIn = false; if (file.InDocumentLibrary) { if (!Utilities.IsCheckedOut(file.Item) || !Utilities.IsCheckedOutByCurrentUser(file.Item)) { checkBackIn = true; file.CheckOut(); } // If it's checked out by another user then this will throw an informative exception so let it do so. } string displayTitle = string.Empty; Microsoft.SharePoint.WebPartPages.WebPart lvw = null; SPLimitedWebPartManager manager = null; try { manager = web.GetLimitedWebPartManager(pageUrl, PersonalizationScope.Shared); lvw = new XsltListViewWebPart(); if (list.BaseTemplate == SPListTemplateType.Events) { lvw = new ListViewWebPart(); } if (lvw is ListViewWebPart) { ((ListViewWebPart)lvw).ListName = list.ID.ToString("B").ToUpperInvariant(); ((ListViewWebPart)lvw).WebId = list.ParentWeb.ID; if (view != null) { ((ListViewWebPart)lvw).ViewGuid = view.ID.ToString("B").ToUpperInvariant(); } } else { ((XsltListViewWebPart)lvw).ListName = list.ID.ToString("B").ToUpperInvariant(); #if !SP2010 if (!string.IsNullOrEmpty(jsLink)) { ((XsltListViewWebPart)lvw).JSLink = jsLink; } #endif ((XsltListViewWebPart)lvw).WebId = list.ParentWeb.ID; if (view != null) { ((XsltListViewWebPart)lvw).ViewGuid = view.ID.ToString("B").ToUpperInvariant(); } } if (linkTitle) { if (view != null) { lvw.TitleUrl = view.Url; } else { lvw.TitleUrl = list.DefaultViewUrl; } } if (!string.IsNullOrEmpty(title)) { lvw.Title = title; } lvw.ChromeType = chromeType; displayTitle = lvw.DisplayTitle; manager.AddWebPart(lvw, zoneId, zoneIndex); } finally { if (manager != null) { manager.Web.Dispose(); manager.Dispose(); } if (lvw != null) { lvw.Dispose(); } if (file.InDocumentLibrary && Utilities.IsCheckedOut(file.Item) && (checkBackIn || publish)) { file.CheckIn("Checking in changes to page due to new web part being added: " + displayTitle); } if (publish && file.InDocumentLibrary) { file.Publish("Publishing changes to page due to new web part being added: " + displayTitle); if (file.Item.ModerationInformation != null) { file.Approve("Approving changes to page due to new web part being added: " + displayTitle); } } } return(lvw); } }
public string GetPeopleClickScript(IDictionary inst, string webPageUrl, TahoeWebPart webPart, List <object []> filters, List <string> andFilters, Dictionary <string, string> oobFilterPairs) { return(GetRollupClickScript(inst, webPageUrl, webPart, filters, andFilters, oobFilterPairs)); }
public List <WebPartToDisplay> GetAllWebPartsOnPage(SPWeb web, string pageUrl, bool includeSharePointWebParts, bool includeCustomWebParts) { if (web == null) { return(new List <WebPartToDisplay>()); } if (string.IsNullOrEmpty(pageUrl)) { return(new List <WebPartToDisplay>()); } bool isContextNull = false; if (HttpContext.Current == null) { isContextNull = true; HttpRequest request = new HttpRequest(string.Empty, web.Url, string.Empty); HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter())); HttpContext.Current.Items["HttpHandlerSPWeb"] = web; } List <WebPartToDisplay> allWebParts = new List <WebPartToDisplay>(); using (SPLimitedWebPartManager webpartManager = web.GetFile(pageUrl).GetLimitedWebPartManager(PersonalizationScope.Shared)) { foreach (object webpartObject in webpartManager.WebParts) { try { WebPartToDisplay webpartToDisplay = new WebPartToDisplay(); if (webpartObject is Microsoft.SharePoint.WebPartPages.WebPart) { // This is a SharePoint web part Microsoft.SharePoint.WebPartPages.WebPart sharepointWebPart = webpartObject as Microsoft.SharePoint.WebPartPages.WebPart; webpartToDisplay.Title = sharepointWebPart.Title; webpartToDisplay.Description = sharepointWebPart.Description; webpartToDisplay.Type = sharepointWebPart.GetType().ToString(); webpartToDisplay.Zone = sharepointWebPart.ZoneID; webpartToDisplay.PageUrl = web.Url + "/" + pageUrl; webpartToDisplay.Visible = sharepointWebPart.Visible; webpartToDisplay.Category = GetWebPartCategory(webpartToDisplay.Type); } else if (webpartObject is System.Web.UI.WebControls.WebParts.WebPart) { // This is a ASP.NET web part System.Web.UI.WebControls.WebParts.WebPart aspnetWebPart = webpartObject as System.Web.UI.WebControls.WebParts.WebPart; webpartToDisplay.Title = aspnetWebPart.Title; webpartToDisplay.Description = aspnetWebPart.Description; webpartToDisplay.Type = aspnetWebPart.GetType().ToString(); webpartToDisplay.Zone = webpartManager.GetZoneID(aspnetWebPart); webpartToDisplay.PageUrl = web.Url + "/" + pageUrl; webpartToDisplay.Visible = aspnetWebPart.Visible; webpartToDisplay.Category = GetWebPartCategory(webpartToDisplay.Type); } if (webpartToDisplay.Category == WebPartCategory.SharePoint && !includeSharePointWebParts) { continue; } if (webpartToDisplay.Category == WebPartCategory.Custom && !includeCustomWebParts) { continue; } allWebParts.Add(webpartToDisplay); } catch (Exception) { throw; } finally { if (isContextNull) { HttpContext.Current = null; } } } webpartManager.Dispose(); } if (isContextNull) { HttpContext.Current = null; } return(allWebParts); }
public override void PartCommunicationConnect(string interfaceName, Microsoft.SharePoint.WebPartPages.WebPart connectedPart, string connectedInterfaceName, ConnectionRunAt runAt) { }
public static string GetRollupClickScriptStatic(IDictionary inst, string webPageUrl, TahoeWebPart webPart, List <object []> filters, List <string> andFilters, Dictionary <string, string> oobFilterPairs) { string pageUrl = string.Empty, query = string.Empty, jop = "&roxDlgShow=" + (JsonSchemaManager.Bool(inst ["dp"], true) ? "1" : "0") + "&rpzopt=' + (JSON.stringify(roxLastOps['" + webPart.ID + "'][1]))"; SortedDictionary <string, string> qs = new SortedDictionary <string, string> (); qs ["a"] = inst ["id"] + string.Empty; qs ["l"] = webPart.ID; qs ["View"] = HttpUtility.UrlEncode(webPageUrl); qs ["r"] = DateTime.Now.Ticks.ToString(); qs ["t"] = HttpUtility.UrlEncode(webPart.Title); foreach (KeyValuePair <string, string> kvp in qs) { query += ((string.IsNullOrEmpty(query) ? "?" : "&") + kvp.Key + "=" + kvp.Value); } pageUrl = SPContext.Current.Web.Url.TrimEnd('/') + "/_layouts/" + ProductPage.AssemblyName + "/prnt.aspx" + query; if (ProductPage.Is14 && "o".Equals(inst ["t"])) { return((IsLic(2) ? 2 : 0) + "OpenPopUpPage('" + pageUrl + jop + " + '&roxDlg=1');"); } if (!"w".Equals(inst ["t"])) { return((IsLic(2) ? 2 : 0) + "window.open('" + pageUrl + jop + ", '" + webPart.ID + "', '" + SPEncode.ScriptEncode(ProductPage.Config(ProductPage.GetContext(), "Popup")) + "');"); } return((IsLic(2) ? 2 : 0) + "location.href='" + pageUrl + jop + ";"); }