private void ProcessDialog(WebPartContainerInfo webPartContainer, bool closeOnSave) { WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, CMSContext.CurrentSite); string selector = QueryHelper.GetString("selectorid", string.Empty); if (string.IsNullOrEmpty(selector)) { return; } // Selects newly created container in the UniSelector string script = string.Format(@"var wopener = window.top.opener ? window.top.opener : window.top.dialogArguments if (wopener) {{ wopener.US_SelectNewValue_{0}('{1}'); }}", selector, webPartContainer.ContainerName); // Redirects to edit window or simply closes the current window if (closeOnSave) { script += "window.close();"; } else { script += string.Format(@"window.name = {0}; window.open('Container_Edit_General.aspx?name={1}&saved=1&editonlycode=true&selectorid='+{0}+'&hash={2}',window.name);", ScriptHelper.GetString(selector), webPartContainer.ContainerName, QueryHelper.GetHash("?editonlycode=true")); } ScriptHelper.RegisterStartupScript(this, GetType(), "UpdateSelector", script, true); }
private void ProcessPage(WebPartContainerInfo webPartContainer) { if (chkAssign.Visible && chkAssign.Checked) { WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, CMSContext.CurrentSite); } URLHelper.Redirect(string.Format("Container_Edit_Frameset.aspx?containerid={0}&saved=1&hash={1}", webPartContainer.ContainerID, QueryHelper.GetHash(string.Empty))); }
private void ProcessDialog(WebPartContainerInfo webPartContainer, bool closeOnSave) { WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, CMSContext.CurrentSite); string selector = QueryHelper.GetString("selectorid", string.Empty); if (string.IsNullOrEmpty(selector)) { return; } ScriptHelper.RegisterWOpenerScript(this); // Selects newly created container in the UniSelector string script = string.Format(@"if (wopener) {{ wopener.US_SelectNewValue_{0}('{1}'); }}", selector, webPartContainer.ContainerName); // Redirects to edit window or simply closes the current window if (closeOnSave) { script += "CloseDialog();"; } else { String previewSuffix = String.Empty; string aliasPath = QueryHelper.GetString("aliaspath", String.Empty); Guid instanceGUID = QueryHelper.GetGuid("instanceguid", Guid.Empty); if (aliasPath != String.Empty) { previewSuffix = "&aliaspath=" + aliasPath; } if (instanceGUID != Guid.Empty) { previewSuffix += "&instanceguid=" + instanceGUID; } script += string.Format(@"window.name = {0}; window.open('Container_Edit_General.aspx?name={1}&saved=1&editonlycode=true&selectorid='+{0}+'&hash={2}{3}',window.name);", ScriptHelper.GetString(selector), webPartContainer.ContainerName, QueryHelper.GetHash("?editonlycode=true"), previewSuffix ); } ScriptHelper.RegisterStartupScript(this, GetType(), "UpdateSelector", script, true); }
private void ProcessPage(WebPartContainerInfo webPartContainer) { if (chkAssign.Visible && chkAssign.Checked) { WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, SiteContext.CurrentSite); } UIElementInfo ui = UIElementInfoProvider.GetUIElementInfo("cms.Design", "EditWebPartContainer"); if (ui != null) { String url = UIContextHelper.GetElementUrl(ui, false); url = URLHelper.AddParameterToUrl(url, "objectID", webPartContainer.ContainerID.ToString()); URLHelper.Redirect(url); } }
/// <summary> /// Adds web part container to site. Called when the "Add container to site" button is pressed. /// Expects the CreateWebPartContainer method to be run first. /// </summary> private bool AddWebPartContainerToSite() { // Get the web part container WebPartContainerInfo container = WebPartContainerInfoProvider.GetWebPartContainerInfo("MyNewContainer"); if (container != null) { int containerId = container.ContainerID; int siteId = CMSContext.CurrentSiteID; // Save the binding WebPartContainerSiteInfoProvider.AddContainerToSite(containerId, siteId); return(true); } return(false); }
protected void SaveSites() { // Remove old items string newValues = ValidationHelper.GetString(usSites.Value, null); string items = DataHelper.GetNewItemsInList(newValues, currentValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items to site foreach (string item in newItems) { int siteId = ValidationHelper.GetInteger(item, 0); // Remove WebPartContainerSiteInfoProvider.RemoveContainerFromSite(containerId, siteId); } } } // Add new items items = DataHelper.GetNewItemsInList(currentValues, newValues); if (!String.IsNullOrEmpty(items)) { string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Add all new items to site foreach (string item in newItems) { int siteId = ValidationHelper.GetInteger(item, 0); // Add WebPartContainerSiteInfoProvider.AddContainerToSite(containerId, siteId); } } } lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); }
private void ProcessDialog(WebPartContainerInfo webPartContainer, bool closeOnSave) { WebPartContainerSiteInfoProvider.AddContainerToSite(webPartContainer, SiteContext.CurrentSite); ScriptHelper.RegisterWOpenerScript(this); string returnHandler = ScriptHelper.GetString(QueryHelper.GetString("returnhandler", String.Empty), false); string script = "if (wopener && wopener." + returnHandler + ") { wopener." + returnHandler + "('" + webPartContainer.ContainerName + "'); }"; // Redirects to edit window or simply closes the current window if (closeOnSave) { script += "CloseDialog();"; } else { UIElementInfo ui = UIElementInfoProvider.GetUIElementInfo("cms.Design", "EditWebPartContainer"); if (ui != null) { // Create base URL for element String url = UIContextHelper.GetElementUrl(ui, UIContext); // Append object ID url = URLHelper.AddParameterToUrl(url, "objectid", webPartContainer.ContainerID.ToString()); // Append actual query string parameters url = URLHelper.AddParameterToUrl(url, "returnhandler", QueryHelper.GetString("returnhandler", String.Empty)); url = URLHelper.AddParameterToUrl(url, "dialog", "1"); url = URLHelper.AddParameterToUrl(url, "aliaspath", QueryHelper.GetString("aliaspath", String.Empty)); url = URLHelper.AddParameterToUrl(url, "instanceguid", QueryHelper.GetString("instanceguid", String.Empty)); // Append dialog hash url = UIContextHelper.AppendDialogHash(url); script += "window.location.replace('" + ResolveUrl(url) + "');"; } } ScriptHelper.RegisterStartupScript(this, GetType(), "UpdateSelector", script, true); }