private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { aliasChanged = false; // ALIAS group is displayed if (!pnlUIAlias.IsHidden) { if (!String.IsNullOrEmpty(txtAlias.Text.Trim()) || mIsRoot) { string nodeAlias = txtAlias.Text.Trim(); aliasChanged = (Node.NodeAlias != nodeAlias); mOldAliasPath = Node.NodeAliasPath; Node.NodeAlias = nodeAlias; } else { e.IsValid = false; e.ErrorMessage = GetString("general.errorvalidationerror"); return; } } // PATH group is displayed if (!pnlUIPath.IsHidden) { // Validate URL path if (!ctrlURL.IsValid()) { e.IsValid = false; e.ErrorMessage = ctrlURL.ValidationError; return; } aliasChanged |= (ctrlURL.URLPath != Node.DocumentUrlPath); Node.DocumentUseNamePathForUrlPath = !ctrlURL.IsCustom; if (!Node.DocumentUseNamePathForUrlPath) { Node.DocumentUrlPath = TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, Node.NodeSiteName); } } // EXTENDED group is displayed if (!pnlUIExtended.IsHidden) { Node.DocumentUseCustomExtensions = chkCustomExtensions.Checked; if (Node.DocumentUseCustomExtensions) { Node.DocumentExtensions = txtExtensions.Text; } } }
protected void btnOK_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(ctrlURL.PlainURLPath)) { ShowError(GetString("doc.urls.requiresurlpath")); return; } // Validate URL path if (!ctrlURL.IsValid()) { ShowError(ctrlURL.ValidationError); return; } if (Node != null) { // Check modify permissions if (!DocumentUIHelper.CheckDocumentPermissions(Node, PermissionsEnum.Modify)) { ShowError(String.Format(GetString("cmsdesk.notauthorizedtoreaddocument"), Node.NodeAliasPath)); return; } // Check whether if (!DocumentAliasInfoProvider.IsUnique(ctrlURL.URLPath, DocumentAlias.AliasID, Convert.ToString(cultureSelector.Value), txtURLExtensions.Text.Trim(), SiteContext.CurrentSiteName, true, NodeID)) { ShowError(GetString("doc.urls.doacaliasnotunique")); return; } // Set object properties DocumentAlias.AliasURLPath = TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, Node.NodeSiteName); DocumentAlias.AliasExtensions = txtURLExtensions.Text.Trim(); DocumentAlias.AliasCulture = ValidationHelper.GetString(cultureSelector.Value, ""); DocumentAlias.AliasSiteID = Node.NodeSiteID; DocumentAlias.AliasActionMode = drpAction.SelectedValue.ToEnum <AliasActionModeEnum>(); DocumentAlias.AliasNodeID = NodeID; // Insert into database DocumentAliasInfoProvider.SetDocumentAliasInfo(DocumentAlias); // Log synchronization DocumentSynchronizationHelper.LogDocumentChange(Node, TaskTypeEnum.UpdateDocument, Tree); aliasId = DocumentAlias.AliasID; string url = "Alias_Edit.aspx?saved=1&nodeid=" + NodeID + "&aliasid=" + aliasId + "&dialog=" + IsDialog; if (IsDialog) { url += "&defaultNodeID=" + defaultNodeID; } // Refresh the second frame in split mode if (PortalUIHelper.DisplaySplitMode) { url += "&refresh=1"; } URLHelper.Redirect(UrlResolver.ResolveUrl(url)); } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { bool aliasChanged = false; // ALIAS group is displayed if (!pnlUIAlias.IsHidden) { if (!String.IsNullOrEmpty(txtAlias.Text.Trim()) || isRoot) { string nodeAlias = txtAlias.Text.Trim(); aliasChanged = (Node.NodeAlias != nodeAlias); oldAliasPath = Node.NodeAliasPath; Node.NodeAlias = nodeAlias; } else { e.IsValid = false; e.ErrorMessage = GetString("general.errorvalidationerror"); return; } } // PATH group is displayed if (!pnlUIPath.IsHidden) { // Validate URL path if (!ctrlURL.IsValid()) { e.IsValid = false; e.ErrorMessage = ctrlURL.ValidationError; return; } aliasChanged |= (ctrlURL.URLPath != Node.DocumentUrlPath); Node.DocumentUseNamePathForUrlPath = !ctrlURL.IsCustom; if (Node.DocumentUseNamePathForUrlPath) { string urlPath = TreePathUtils.GetUrlPathFromNamePath(Node.DocumentNamePath, Node.NodeLevel, SiteContext.CurrentSiteName); Node.DocumentUrlPath = urlPath; } else { Node.DocumentUrlPath = TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, SiteContext.CurrentSiteName, true); } } if ((!pnlUIAlias.IsHidden || !pnlUIPath.IsHidden) && aliasChanged && (PortalContext.ViewMode == ViewModeEnum.EditLive)) { // Redirect the parent page to the new document alias string newAliasPath = string.Empty; if (Node.Parent != null) { newAliasPath = Node.Parent.NodeAliasPath.TrimEnd('/'); } newAliasPath += "/" + Node.NodeAlias; // Get the updated document url string url = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(newAliasPath, Node.DocumentUrlPath, Node.NodeSiteName, RequestContext.CurrentURLLangPrefix)); // Register redirect script string reloadScript = "if (parent.parent.frames['header'] != null) { parent.parent.frames['header'].reloadPageUrl =" + ScriptHelper.GetString(url) + "; }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "reloadScript", reloadScript, true); } // EXTENDED group is displayed if (!pnlUIExtended.IsHidden) { Node.DocumentUseCustomExtensions = chkCustomExtensions.Checked; if (Node.DocumentUseCustomExtensions) { Node.DocumentExtensions = txtExtensions.Text; } } }
protected void lnkSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtAlias.Text.Trim()) && !isRoot) { lblError.Visible = true; lblError.Text = GetString("general.errorvalidationerror"); } else { // Get the document if (node != null) { // Check modify permissions if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) { return; } // PATH group is displayed if (!this.pnlUIPath.IsHidden) { node.NodeAlias = txtAlias.Text.Trim(); node.DocumentUseNamePathForUrlPath = !ctrlURL.IsCustom; if (node.DocumentUseNamePathForUrlPath) { string urlPath = TreePathUtils.GetUrlPathFromNamePath(node.DocumentNamePath, node.NodeLevel, CMSContext.CurrentSiteName); node.DocumentUrlPath = urlPath; } else { node.DocumentUrlPath = TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, CMSContext.CurrentSiteName, true); } } // EXTENDED group is displayed if (!this.pnlUIExtended.IsHidden) { node.DocumentUseCustomExtensions = chkCustomExtensions.Checked; if (node.DocumentUseCustomExtensions) { node.DocumentExtensions = txtExtensions.Text; } } // Save the data node.Update(); // Update search index if ((node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); } txtAlias.Text = node.NodeAlias; // Load the URL path LoadURLPath(node); // Log synchronization DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, tree); lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); UniGridAlias.ReloadData(); } } }