protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; // Wireframe string errorMessage = null; PageTemplateInfo pti = selTemplate.EnsureTemplate(node.DocumentName, node.NodeGUID, ref errorMessage); if (String.IsNullOrEmpty(errorMessage)) { if (pti != null) { node.NodeWireframeTemplateID = pti.PageTemplateId; } // Wireframe mode for wireframes PortalContext.ViewMode = ViewModeEnum.Wireframe; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "Refresh", ScriptHelper.GetScript(String.Format( "RefreshTree({0}, {0}); SelectNode({0});", node.NodeID ))); } else { e.IsValid = false; e.ErrorMessage = errorMessage; } }
protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { if (Node != null) { string conversionName = ValidationHelper.GetString(ucConversionSelector.Value, String.Empty).Trim(); if (!ucConversionSelector.IsValid()) { e.ErrorMessage = ucConversionSelector.ValidationError; e.IsValid = false; return; } if (!usSelectCampaign.IsValid()) { e.ErrorMessage = usSelectCampaign.ValidationError; e.IsValid = false; return; } if (!txtConversionValue.IsValid()) { e.ErrorMessage = GetString("conversionvalue.error"); e.IsValid = false; return; } Node.DocumentCampaign = ValidationHelper.GetString(usSelectCampaign.Value, String.Empty).Trim(); Node.DocumentConversionValue = txtConversionValue.Value.ToString(); Node.DocumentTrackConversionName = conversionName; } }
void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Refresh content if (e.ActionName == DocumentComponentEvents.UNDO_CHECKOUT) { ucAttachments.ReloadData(); } }
protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { e.UpdateDocument = false; string errorMessage = null; string newPageName = txtPageName.Text.Trim(); if (!String.IsNullOrEmpty(newPageName)) { // Limit length newPageName = TreePathUtils.EnsureMaxNodeNameLength(newPageName, pageClassName); } TreeNode node = e.Node; node.DocumentName = newPageName; bool updateGuidAfterInsert = false; // Same template for all language versions by default PageTemplateInfo pti = selTemplate.EnsureTemplate(node.DocumentName, node.NodeGUID, ref errorMessage); if (pti != null) { node.SetDefaultPageTemplateID(pti.PageTemplateId); // Template should by updated after document insert if (!pti.IsReusable) { updateGuidAfterInsert = true; } } // Insert node if no error if (String.IsNullOrEmpty(errorMessage)) { // Insert the document // Ensures documents consistency (blog post hierarchy etc.) DocumentManager.EnsureDocumentsConsistency(); DocumentHelper.InsertDocument(node, DocumentManager.ParentNode, DocumentManager.Tree); if (updateGuidAfterInsert) { PageTemplateInfo pageTemplateInfo = PageTemplateInfoProvider.GetPageTemplateInfo(node.NodeTemplateID); if (pageTemplateInfo != null) { // Update template's node GUID pageTemplateInfo.PageTemplateNodeGUID = node.NodeGUID; PageTemplateInfoProvider.SetPageTemplateInfo(pageTemplateInfo); } } } else { e.IsValid = false; e.ErrorMessage = errorMessage; } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; SaveDocumentOwner(node); SaveDocumentStylesheet(node); SaveDocumentCacheSettings(node, e); SaveDocumentActivitySettings(node); }
/// <summary> /// Handles the OnValidateData event of the DocumentManager control. /// </summary> protected void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { if (!ucEditableText.IsValid()) { // Set the error message when an error occurs e.IsValid = false; e.ErrorMessage = ucEditableText.ErrorMessage; } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { if (!DocumentManager.SaveChanges) { return; } new TempPageBuilderWidgetsPropagator(e.Node).Propagate(InstanceGUID); dataPropagated = true; }
protected void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { string newPageName = txtPageName.Text.Trim(); if (String.IsNullOrEmpty(newPageName)) { e.ErrorMessage = GetString("newpage.nameempty"); e.IsValid = false; } }
private static void PreparePageWithDefaultTemplate(DocumentManagerEventArgs e, string templateIdentifier) { var configuration = new PageTemplateConfiguration { Identifier = templateIdentifier }; var json = new PageTemplateConfigurationSerializer().Serialize(configuration); e.Node.SetValue("DocumentPageTemplateConfiguration", json); }
void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Refresh control state if ((e.ActionName == DocumentComponentEvents.UNDO_CHECKOUT) || // After undo checkout action (there will be different attachments from previous version) e.WorkflowFinished || // When the workflow is finished (there may be published attachments instead of versioned) (e.ActionName == ComponentEvents.SAVE && (e.Mode != FormModeEnum.Update)) // When a new document is created, temporary may be converted to normal attachments ) { ReloadData(); } }
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; } } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { if (!DocumentManager.SaveChanges) { return; } widgetsPropagator.Propagate(e.Node, InstanceGUID); dataPropagated = true; }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Ensure default combination if page template changed if (PortalContext.MVTVariantsEnabled) { int templateId = Node.GetUsedPageTemplateId(); ModuleCommands.OnlineMarketingEnsureDefaultCombination(templateId); } ReloadControls(); }
void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { // Additional validation if (e.IsValid) { e.IsValid = !IsBannedIP(); if (!e.IsValid) { e.ErrorMessage = GetString("General.BannedIP"); } } }
void DocumentManager_OnBeforeAction(object sender, DocumentManagerEventArgs e) { if (newdocument) { var templateIdentifier = QueryHelper.GetString("templateidentifier", string.Empty); if (string.IsNullOrEmpty(templateIdentifier)) { return; } var templateType = QueryHelper.GetString("templateType", string.Empty); if (string.IsNullOrEmpty(templateType)) { e.IsValid = false; e.ErrorMessage = GetString("pagetemplatesmvc.missingtype"); return; } if (!ValidationHelper.IsCodeName(templateIdentifier)) { e.IsValid = false; e.ErrorMessage = GetString("pagetemplatesmvc.invalidcodename"); return; } if (string.Equals(templateType, "custom", StringComparison.OrdinalIgnoreCase)) { PreparePageWithCustomTemplate(e); } else if (string.Equals(templateType, "default", StringComparison.OrdinalIgnoreCase)) { PreparePageWithDefaultTemplate(e, templateIdentifier); } else { e.IsValid = false; e.ErrorMessage = GetString("pagetemplatesmvc.invalidtype"); } } else if (newculture) { var defaultCulture = CultureHelper.GetDefaultCultureCode(CurrentSiteName); var templateConfiguration = new PageTemplateConfigurationForEmptyCultureVersionProvider() .Get(NodeID, defaultCulture); if (templateConfiguration != null) { PreparePageWithDefaultTemplate(e, templateConfiguration.Identifier); } } }
protected void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { if (!radInherit.Checked) { // Set the selected template ID int templateId = SelectedTemplateID; if (templateId <= 0) { e.IsValid = false; e.ErrorMessage = GetString("newpage.templateerror"); } } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Ensure default combination if page template changed if (SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSMVTEnabled") && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.MVTesting) && (ModuleCommands.OnlineMarketingContainsMVTest(Node.NodeAliasPath, Node.NodeSiteID, Node.DocumentCulture, false))) { int templateId = Node.GetUsedPageTemplateId(); ModuleCommands.OnlineMarketingEnsureDefaultCombination(templateId); } ReloadControls(); }
void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { switch (e.ActionName) { case ComponentEvents.SAVE: // Clear cache if current document is blogpost or blog if (ci != null) { if ((ci.ClassName.ToLowerCSafe() == "cms.blogpost") || (ci.ClassName.ToLowerCSafe() == "cms.blog")) { // Clear cache if (PortalContext.CurrentPageManager != null) { PortalContext.CurrentPageManager.ClearCache(); } } } // Set the edit mode if (Node != null) { NodeID = Node.NodeID; Action = "edit"; ReloadData(true); } AddScript("changed=false;"); break; case DocumentComponentEvents.APPROVE: RaiseOnAfterApprove(); break; case DocumentComponentEvents.REJECT: RaiseOnAfterReject(); break; case DocumentComponentEvents.UNDO_CHECKOUT: formElem.LoadForm(true); // Reload the values in the form formElem.LoadControlValues(); break; default: break; } ReloadForm(); }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { actionName = e.ActionName; if (!IsSavePerformingAction(e.ActionName)) { return; } if (!DocumentManager.SaveChanges) { return; } new TempPageBuilderWidgetsPropagator(e.Node).Delete(InstanceGUID); }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { txtAlias.Text = Node.NodeAlias; // If alias was changed, update all related MVTests if (Node.NodeAliasPath != oldAliasPath) { ModuleCommands.OnlineMarketingMoveMVTests(Node.NodeAliasPath, oldAliasPath, SiteContext.CurrentSiteID); } // Load the URL path LoadURLPath(Node); UniGridAlias.ReloadData(); }
void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { if ((UseFileUploader && !FileUpload.HasFile) || (!UseFileUploader && !ucDirectUploader.HasData())) { e.IsValid = false; e.ErrorMessage = GetString("NewFile.ErrorEmpty"); } else { // Get file extension fileExtension = UseFileUploader ? FileUpload.FileName : ucDirectUploader.AttachmentName; fileExtension = Path.GetExtension(fileExtension).TrimStart('.'); e.IsValid = IsExtensionAllowed(fileExtension); e.ErrorMessage = string.Format(GetString("NewFile.ExtensionNotAllowed"), fileExtension); } }
private void EnsureAdHocTemplate(DocumentManagerEventArgs e) { var pti = PageTemplateInfoProvider.GetPageTemplateInfo(formElem.DefaultPageTemplateID); // Ensure ad-hoc template as default if ((pti != null) && pti.IsReusable && pti.PageTemplateCloneAsAdHoc) { // Create ad-hoc template (display name is created automatically) var adHocTemplate = PageTemplateInfoProvider.CloneTemplateAsAdHoc(pti, null, SiteContext.CurrentSiteID, e.Node.NodeGUID); PageTemplateInfoProvider.SetPageTemplateInfo(adHocTemplate); formElem.DefaultPageTemplateID = adHocTemplate.PageTemplateId; if (SiteContext.CurrentSite != null) { PageTemplateInfoProvider.AddPageTemplateToSite(adHocTemplate.PageTemplateId, SiteContext.CurrentSiteID); } } }
/// <summary> /// Creates or removes a record in database for current page according to state of amp filter (enabled/disabled) /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event arguments</param> protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { if (Node != null) { string nodeGuid = Node.NodeGUID.ToString(); ObjectQuery <AmpFilterInfo> q = GetAmpFilterInfoForGuid(nodeGuid); if (chkEnableAmpFilter.Checked) { AmpFilterInfo ampInfo; // First check if any record exists for this page if (q.Count == 0) { // Insert new record to AmpFilterInfo table ampInfo = new AmpFilterInfo(); } else { // Update existing record ampInfo = q.FirstOrDefault(); } if (ampInfo != null) { // Update object properties ampInfo.PageNodeGUID = nodeGuid; ampInfo.SiteID = SiteContext.CurrentSiteID; ampInfo.UseDefaultStylesheet = chkDefaultCss.Checked; ampInfo.StylesheetID = ValidationHelper.GetInteger(selectStyleSheet.Value, 0); AmpFilterInfoProvider.SetAmpFilterInfo(ampInfo); } } else { // First check if any record exists for this page if (q.Count != 0) { // Remove record from AmpFilterInfo table AmpFilterInfoProvider.DeleteAmpFilterInfo(q.FirstOrDefault()); } } } }
void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { e.UpdateDocument = false; TreeNode node = DocumentManager.Node; if (UseFileUploader) { // Process file using file upload ProcessFileUploader(); } else { // Process file using direct uploader ProcessDirectUploader(); // Save temporary attachments DocumentHelper.SaveTemporaryAttachments(node, Guid, SiteContext.CurrentSiteName, DocumentManager.Tree); } // Create default SKU if configured if (ModuleManager.CheckModuleLicense(ModuleName.ECOMMERCE, RequestContext.CurrentDomain, FeatureEnum.Ecommerce, ObjectActionEnum.Insert)) { bool?skuCreated = node.CreateDefaultSKU(); if (skuCreated.HasValue && !skuCreated.Value) { ShowError(GetString("com.CreateDefaultSKU.Error")); } } // Set additional values if (!string.IsNullOrEmpty(fileExtension)) { // Update document extensions if no custom are used if (!node.DocumentUseCustomExtensions) { node.DocumentExtensions = "." + fileExtension; } node.SetValue("DocumentType", "." + fileExtension); } // Update the document DocumentHelper.UpdateDocument(node, DocumentManager.Tree); }
/// <summary> /// Handles the OnAfterAction event of the DocumentManager control. /// </summary> protected void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Update the ViewMode in order to enable/disable the edit text control (used for workflow actions). ucEditableText.ViewMode = CheckPermissions(); // Refresh the page after action switch (e.ActionName) { case DocumentComponentEvents.UNDO_CHECKOUT: case DocumentComponentEvents.CHECKOUT: case DocumentComponentEvents.CHECKIN: case DocumentComponentEvents.CREATE_VERSION: case DocumentComponentEvents.PUBLISH: case DocumentComponentEvents.APPROVE: case DocumentComponentEvents.REJECT: URLHelper.RefreshCurrentPage(); break; } }
private void SaveAlias(DocumentManagerEventArgs e) { if (pnlUIAlias.IsHidden) { return; } var node = e.Node; if (!String.IsNullOrEmpty(txtAlias.Text.Trim()) || node.IsRoot()) { node.NodeAlias = txtAlias.Text.Trim(); } else { e.IsValid = false; e.ErrorMessage = GetString("general.errorvalidationerror"); } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { EditingForms editingForm = (EditingForms)Convert.ToInt32(drpEditControl.SelectedValue); // Code name string codeName = txtName.Text.Trim().ToLowerCSafe(); if (txtName.Text != string.Empty) { keyName = codeName; } // Refresh tree if (createNew) { ltlScript.Text += ScriptHelper.GetScript("parent.frames['tree'].location.replace('" + ResolveUrl("~/CMSModules/Content/CMSDesk/Properties/Advanced/EditableContent/tree.aspx") + "?nodeid=" + node.NodeID + "&selectednodename=" + codeName + "&selectednodetype=" + keyType + "');SelectNode('" + codeName + "', '" + keyType + "')"); if (editingForm == EditingForms.EditableImage) { ltlScript.Text += ScriptHelper.GetScript("SelectNodeAfterImageSave(" + ScriptHelper.GetString(keyName) + ", '" + keyType + "');"); } } else { if (e.ActionName == DocumentComponentEvents.UNDO_CHECKOUT) { // Refresh content content = GetContent(); txtAreaContent.Text = content; htmlContent.ResolvedValue = content; txtContent.Text = content; } ltlScript.Text += ScriptHelper.GetScript("RefreshNode(" + ScriptHelper.GetString(codeName) + ", '" + keyType + "', " + node.NodeID + ");"); } createNew = false; }
protected void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; int newNodeId = node.NodeID; if (newdocument || newculture) { // Store error text if (!string.IsNullOrEmpty(formElem.MessagesPlaceHolder.ErrorText)) { SessionHelper.SetValue("FormErrorText|" + newNodeId, formElem.MessagesPlaceHolder.ErrorText); } } else { // Reload the values in the form formElem.LoadControlValues(); } }
private void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { string codeName = txtName.Text.Trim(); // Validate string errorMessage = new Validator().NotEmpty(codeName, GetString("general.invalidcodename")).IsRegularExp(codeName, ValidationHelper.CodenameRegExp.ToString(), GetString("general.invalidcodename")).Result; if (errorMessage == string.Empty) { string value = null; EditingForms editingForm = (EditingForms)Convert.ToInt32(drpEditControl.SelectedValue); // Check content switch (editingForm) { case EditingForms.TextArea: value = txtAreaContent.Text.Trim(); break; case EditingForms.HTMLEditor: value = htmlContent.ResolvedValue; break; case EditingForms.EditableImage: value = imageContent.GetContent(); break; case EditingForms.TextBox: value = txtContent.Text.Trim(); break; } errorMessage = new Validator().NotEmpty(value, GetString("EditableContent.NotEmpty")).Result; } if (!String.IsNullOrEmpty(errorMessage)) { e.ErrorMessage = errorMessage; e.IsValid = false; } }
protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { // Update the data if (!pnlUIPage.IsHidden) { // Set Page title property node.SetValue("DocumentPageTitle", null); if (!chkTitle.Checked) { node.SetValue("DocumentPageTitle", txtTitle.Text); } // Set Page key words property node.SetValue("DocumentPageKeyWords", null); if (!chkKeyWords.Checked) { node.SetValue("DocumentPageKeyWords", txtKeywords.Text); } // Set Page description property node.SetValue("DocumentPageDescription", null); if (!chkDescription.Checked) { node.SetValue("DocumentPageDescription", txtDescription.Text); } } // Update the tags related data if (!pnlUITags.IsHidden) { node.SetValue("DocumentTagGroupID", null); if (!chkTagGroupSelector.Checked) { // If is tag group id node.SetValue("DocumentTagGroupID", (ValidationHelper.GetInteger(tagGroupSelectorElem.Value, 0) > 0) ? tagGroupSelectorElem.Value : DBNull.Value); } node.SetValue("DocumentTags", (ValidationHelper.GetInteger(tagGroupSelectorElem.Value, 0) > 0) ? tagSelectorElem.Value : DBNull.Value); } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { actionName = e.ActionName; if (e.ActionName == DocumentComponentEvents.UNDO_CHECKOUT) { widgetsPropagator.Delete(InstanceGUID); return; } if (!IsSavePerformingAction(e.ActionName)) { return; } if (!DocumentManager.SaveChanges) { return; } widgetsPropagator.Delete(InstanceGUID); }
void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { switch (e.ActionName) { case ComponentEvents.SAVE: // Set the edit mode if (Node != null) { NodeID = Node.NodeID; Action = "edit"; ReloadData(true); } AddScript("changed=false;"); break; case DocumentComponentEvents.APPROVE: RaiseOnAfterApprove(); break; case DocumentComponentEvents.REJECT: RaiseOnAfterReject(); break; case DocumentComponentEvents.UNDO_CHECKOUT: formElem.LoadForm(true); // Reload the values in the form formElem.LoadControlValues(); break; default: break; } ReloadForm(); }
protected void OnAfterAction(object sender, DocumentManagerEventArgs args) { // Render UI scripts (Refresh tree/Split mode etc.) if (!IsLiveSite) { // Try get dialog flag from page instance bool isDialog = false; CMSContentPage page = Page as CMSContentPage; if ((page != null) && (page.RequiresDialog)) { isDialog = true; } // Set refresh tree value with dependence on dialog mode (for dialog mode is by default true) bool refreshTree = isDialog; switch (args.ActionName) { case DocumentComponentEvents.APPROVE: { WorkflowStepInfo originalStep = args.OriginalStep; WorkflowStepInfo nextStep = args.CurrentStep; // Approve from published or archived step bool allowRefresh = DocumentManager.AutoCheck && ((originalStep == null) || originalStep.StepIsArchived || originalStep.StepIsPublished); // Next step is published or edit step allowRefresh |= (nextStep == null) || (nextStep.StepIsPublished || nextStep.StepIsEdit); // Refresh content tree when step is 'Published' or scope has been removed and icons should be displayed refreshTree |= allowRefresh && DocumentUIHelper.IconsUsed(IconType.Published | IconType.VersionNotPublished | IconType.NotPublished); } break; case DocumentComponentEvents.CREATE_VERSION: case DocumentComponentEvents.PUBLISH: refreshTree = true; break; case DocumentComponentEvents.ARCHIVE: refreshTree |= DocumentUIHelper.IconsUsed(IconType.Archived | IconType.Published | IconType.NotPublished); break; case DocumentComponentEvents.REJECT: refreshTree |= DocumentUIHelper.IconsUsed(IconType.CheckedOut | IconType.NotPublished); break; case DocumentComponentEvents.CHECKIN: refreshTree |= DocumentUIHelper.IconsUsed(IconType.CheckedOut); break; case DocumentComponentEvents.CHECKOUT: case DocumentComponentEvents.UNDO_CHECKOUT: refreshTree |= DocumentUIHelper.IconsUsed(IconType.CheckedOut); EnsureSplitModeScript(); break; case ComponentEvents.SAVE: if (string.IsNullOrEmpty(args.SaveActionContext)) { refreshTree = ProcessSaveAction(originalMode, args.OriginalStep, isDialog); } break; } if (refreshTree) { ScriptHelper.RefreshTree(Page, NodeID, Node.NodeParentID); } } }
void OnBeforeAction(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; // Backup original document's values - before saving originalDocumentName = node.DocumentName; originalPublishFrom = node.DocumentPublishFrom; originalPublishTo = node.DocumentPublishTo; wasArchived = node.IsArchived; wasInPublishedStep = node.IsInPublishStep; // Set send e-mails settings WorkflowManager.SendEmails = mSendNotification; }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; // OWNER group is displayed by UI profile if (!pnlUIOwner.IsHidden) { // Set owner int ownerId = ValidationHelper.GetInteger(usrOwner.Value, 0); node.SetValue("NodeOwner", (ownerId > 0) ? usrOwner.Value : null); } // DESIGN group is displayed by UI profile if (!pnlUIDesign.IsHidden) { node.SetValue("DocumentStylesheetID", -1); if (!chkCssStyle.Checked) { // Set style sheet int selectedCssId = ValidationHelper.GetInteger(ctrlSiteSelectStyleSheet.Value, 0); if (selectedCssId < 1) { node.SetValue("DocumentStylesheetID", null); } else { node.SetValue("DocumentStylesheetID", selectedCssId); } ctrlSiteSelectStyleSheet.CurrentDropDown.Enabled = true; } else { ctrlSiteSelectStyleSheet.CurrentDropDown.Enabled = false; } } // CACHE group is displayed by UI profile if (!pnlUICache.IsHidden) { // Cache minutes int cacheMinutes = 0; if (radNo.Checked) { cacheMinutes = 0; txtCacheMinutes.Text = ""; } else if (radYes.Checked) { cacheMinutes = ValidationHelper.GetInteger(txtCacheMinutes.Text, -5); if (cacheMinutes <= 0) { e.IsValid = false; } } else if (radInherit.Checked) { cacheMinutes = -1; txtCacheMinutes.Text = ""; } // Set cache minutes if (cacheMinutes != node.NodeCacheMinutes) { node.NodeCacheMinutes = cacheMinutes; clearCache = true; } // Allow file system cache int allowFs = Node.NodeAllowCacheInFileSystem; if (radFSYes.Checked) { allowFs = 1; } else if (radFSNo.Checked) { allowFs = 0; } else if (radInherit.Checked) { allowFs = -1; } Node.NodeAllowCacheInFileSystem = allowFs; } if (e.IsValid) { // Check UI element permission if (CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Content", "General.OnlineMarketing")) { node.DocumentLogVisitActivity = (chkPageVisitInherit.Checked ? (bool?)null : chkLogPageVisit.Checked); } } else { // Show error message e.ErrorMessage = GetString("GeneralProperties.BadCacheMinutes"); } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { EditingForms editingForm = (EditingForms)Convert.ToInt32(drpEditControl.SelectedValue); // Get content to save switch (editingForm) { case EditingForms.TextArea: content = txtAreaContent.Text.Trim(); break; case EditingForms.HTMLEditor: content = htmlContent.ResolvedValue; break; case EditingForms.EditableImage: content = imageContent.GetContent(); break; case EditingForms.TextBox: content = txtContent.Text.Trim(); break; } if (!QueryHelper.GetBoolean("imagesaved", false)) { createNew = !node.DocumentContent.EditableWebParts.Contains(keyName) && !node.DocumentContent.EditableRegions.ContainsKey(keyName); } // Code name string codeName = txtName.Text.Trim().ToLowerCSafe(); // Set PageInfo switch (keyType) { case EditableContentType.webpart: if (!createNew) { // If editing -> remove old node.DocumentContent.EditableWebParts.Remove(keyName); } if (!node.DocumentContent.EditableWebParts.ContainsKey(codeName)) { node.DocumentContent.EditableWebParts.Add(codeName, content); } else { ShowError(GetString("EditableContent.ItemExists")); return; } break; case EditableContentType.region: if (!createNew) { // If editing -> remove old node.DocumentContent.EditableRegions.Remove(keyName); } if (!node.DocumentContent.EditableRegions.ContainsKey(codeName)) { node.DocumentContent.EditableRegions.Add(codeName, content); } else { ShowError(GetString("EditableContent.ItemExists")); return; } break; } node.SetValue("DocumentContent", node.DocumentContent.GetContentXml()); }
protected void DocumentManager_OnLoadData(object sender, DocumentManagerEventArgs e) { formElem.LoadControlValues(); }
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; Node.DocumentUrlPath = Node.DocumentUseNamePathForUrlPath ? TreePathUtils.GetUrlPathFromNamePath(Node) : TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, Node.NodeSiteName); } // EXTENDED group is displayed if (!pnlUIExtended.IsHidden) { Node.DocumentUseCustomExtensions = chkCustomExtensions.Checked; if (Node.DocumentUseCustomExtensions) { Node.DocumentExtensions = txtExtensions.Text; } } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Refresh tree ScriptHelper.RefreshTree(this, Node.NodeID, Node.NodeParentID); }
protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { node.SetValue("NodeWireframeComment", txtComment.Text); node.SetValue("NodeWireframeInheritPageLevels", inheritElem.Value); }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { if (!pnlUISearch.IsHidden) { // Search Node.DocumentSearchExcluded = chkExcludeFromSearch.Checked; // Sitemap string sitemapSettings = drpChange.SelectedValue + ";"; // Do not keep default value in DB if (drpPriority.SelectedValue != "0.5") { sitemapSettings += drpPriority.SelectedValue; } // Do not keep any data if default values are specified if (sitemapSettings == ";") { sitemapSettings = String.Empty; } Node.DocumentSitemapSettings = sitemapSettings; } // Update the data if (!pnlUIBasicProperties.IsHidden) { Node.DocumentMenuCaption = txtMenuCaption.Text.Trim(); Node.SetValue("DocumentMenuItemHideInNavigation", !chkShowInNavigation.Checked); Node.SetValue("DocumentShowInSiteMap", chkShowInSitemap.Checked); } if (!pnlUIDesign.IsHidden) { Node.DocumentMenuItemImage = txtMenuItemImage.Text.Trim(); Node.DocumentMenuItemLeftImage = txtMenuItemLeftImage.Text.Trim(); Node.DocumentMenuItemRightImage = txtMenuItemRightImage.Text.Trim(); Node.DocumentMenuStyle = txtMenuItemStyle.Text.Trim(); Node.SetValue("DocumentMenuClass", txtCssClass.Text.Trim()); Node.SetValue("DocumentMenuStyleOver", txtMenuItemStyleMouseOver.Text.Trim()); Node.SetValue("DocumentMenuClassOver", txtCssClassMouseOver.Text.Trim()); Node.SetValue("DocumentMenuItemImageOver", txtMenuItemImageMouseOver.Text.Trim()); Node.SetValue("DocumentMenuItemLeftImageOver", txtMenuItemLeftImageMouseOver.Text.Trim()); Node.SetValue("DocumentMenuItemRightImageOver", txtMenuItemRightImageMouseOver.Text.Trim()); Node.SetValue("DocumentMenuStyleHighlighted", txtMenuItemStyleHighlight.Text.Trim()); Node.SetValue("DocumentMenuClassHighlighted", txtCssClassHighlight.Text.Trim()); Node.SetValue("DocumentMenuItemImageHighlighted", txtMenuItemImageHighlight.Text.Trim()); Node.SetValue("DocumentMenuItemLeftImageHighlighted", txtMenuItemLeftImageHighlight.Text.Trim()); Node.SetValue("DocumentMenuItemRightImageHighlighted", txtMenuItemRightImageHighlight.Text.Trim()); } if (!pnlUIActions.IsHidden) { // Menu action txtJavaScript.Enabled = false; txtUrl.Enabled = false; txtUrlInactive.Enabled = false; if (radStandard.Checked) { if (Node != null) { Node.SetValue("DocumentMenuRedirectUrl", ""); Node.SetValue("DocumentMenuJavascript", ""); Node.SetValue("DocumentMenuItemInactive", false); Node.SetValue("DocumentMenuRedirectToFirstChild", false); } } if (radInactive.Checked) { txtUrl.Text = txtUrlInactive.Text; if (Node != null) { Node.SetValue("DocumentMenuRedirectUrl", txtUrlInactive.Text); Node.SetValue("DocumentMenuJavascript", ""); Node.SetValue("DocumentMenuItemInactive", true); Node.SetValue("DocumentMenuRedirectToFirstChild", false); } } if (radFirstChild.Checked) { txtJavaScript.Enabled = false; if (Node != null) { Node.SetValue("DocumentMenuRedirectUrl", ""); Node.SetValue("DocumentMenuJavascript", ""); Node.SetValue("DocumentMenuItemInactive", false); Node.SetValue("DocumentMenuRedirectToFirstChild", true); } } if (radJavascript.Checked) { txtJavaScript.Enabled = true; txtUrl.Enabled = false; if (Node != null) { Node.SetValue("DocumentMenuRedirectUrl", ""); Node.SetValue("DocumentMenuJavascript", txtJavaScript.Text); Node.SetValue("DocumentMenuItemInactive", false); Node.SetValue("DocumentMenuRedirectToFirstChild", false); } } if (radUrl.Checked) { txtJavaScript.Enabled = false; txtUrl.Enabled = true; txtUrlInactive.Text = txtUrl.Text; if (Node != null) { Node.SetValue("DocumentMenuRedirectUrl", txtUrl.Text.Trim()); Node.SetValue("DocumentMenuJavascript", ""); Node.SetValue("DocumentMenuItemInactive", false); Node.SetValue("DocumentMenuRedirectToFirstChild", false); } } } }
void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { e.UpdateDocument = false; TreeNode node = DocumentManager.Node; if (UseFileUploader) { // Process file using file upload ProcessFileUploader(); } else { // Process file using direct uploader ProcessDirectUploader(); // Save temporary attachments DocumentHelper.SaveTemporaryAttachments(node, Guid, SiteContext.CurrentSiteName, DocumentManager.Tree); } // Create default SKU if configured if (ModuleManager.CheckModuleLicense(ModuleName.ECOMMERCE, RequestContext.CurrentDomain, FeatureEnum.Ecommerce, ObjectActionEnum.Insert)) { bool? skuCreated = node.CreateDefaultSKU(); if (skuCreated.HasValue && !skuCreated.Value) { ShowError(GetString("com.CreateDefaultSKU.Error")); } } // Set additional values if (!string.IsNullOrEmpty(fileExtension)) { // Update document extensions if no custom are used if (!node.DocumentUseCustomExtensions) { node.DocumentExtensions = "." + fileExtension; } node.SetValue("DocumentType", "." + fileExtension); } // Update the document DocumentHelper.UpdateDocument(node, DocumentManager.Tree); }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { bool 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; } } var siteName = Node.NodeSiteName; // 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, siteName); Node.DocumentUrlPath = urlPath; } else { Node.DocumentUrlPath = TreePathUtils.GetSafeUrlPath(ctrlURL.URLPath, siteName, 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, siteName, 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; } } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { txtAlias.Text = Node.NodeAlias; // Check if alias was changed if (Node.NodeAliasPath != mOldAliasPath) { // Update all related MVTests ModuleCommands.OnlineMarketingMoveMVTests(Node.NodeAliasPath, mOldAliasPath, SiteContext.CurrentSiteID); } // Load the URL path LoadURLPath(Node); UniGridAlias.ReloadData(); if ((!pnlUIAlias.IsHidden || !pnlUIPath.IsHidden) && aliasChanged && (PortalContext.ViewMode == ViewModeEnum.EditLive)) { // Get the updated document url string url = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(Node)); // 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); } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { EditingForms editingForm = (EditingForms)Convert.ToInt32(drpEditControl.SelectedValue); // Code name string codeName = txtName.Text.Trim().ToLowerCSafe(); if (txtName.Text != string.Empty) { keyName = codeName; } // Refresh tree if (createNew) { ltlScript.Text += ScriptHelper.GetScript("parent.frames['tree'].location.replace('" + ResolveUrl(EDITABLE_CONTENT_FOLDER + "tree.aspx") + "?nodeid=" + node.NodeID + "&selectednodename=" + ScriptHelper.GetString(codeName, false) + "&selectednodetype=" + keyType + "');SelectNode('" + ScriptHelper.GetString(codeName, false) + "', '" + keyType + "')"); if (editingForm == EditingForms.EditableImage) { ltlScript.Text += ScriptHelper.GetScript("SelectNodeAfterImageSave(" + ScriptHelper.GetString(keyName) + ", '" + keyType + "');"); } } else { if (e.ActionName == DocumentComponentEvents.UNDO_CHECKOUT) { // Refresh content content = GetContent(); txtAreaContent.Text = content; htmlContent.ResolvedValue = content; txtContent.Text = content; } ltlScript.Text += ScriptHelper.GetScript("RefreshNode(" + ScriptHelper.GetString(codeName) + ", '" + keyType + "', " + node.NodeID + ");"); } createNew = false; }
void DocumentManager_OnBeforeAction(object sender, DocumentManagerEventArgs e) { if (newdocument || newculture) { var pti = PageTemplateInfoProvider.GetPageTemplateInfo(formElem.DefaultPageTemplateID); // Ensure ad-hoc template as default if ((pti != null) && pti.IsReusable && pti.PageTemplateCloneAsAdHoc) { // Create ad-hoc template (display name is created automatically) var adHocTemplate = PageTemplateInfoProvider.CloneTemplateAsAdHoc(pti, null, SiteContext.CurrentSiteID, e.Node.NodeGUID); PageTemplateInfoProvider.SetPageTemplateInfo(adHocTemplate); formElem.DefaultPageTemplateID = adHocTemplate.PageTemplateId; if (SiteContext.CurrentSite != null) { PageTemplateInfoProvider.AddPageTemplateToSite(adHocTemplate.PageTemplateId, SiteContext.CurrentSiteID); } } } }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { txtAlias.Text = Node.NodeAlias; // If alias was changed, update all related MVTests if (Node.NodeAliasPath != mOldAliasPath) { ModuleCommands.OnlineMarketingMoveMVTests(Node.NodeAliasPath, mOldAliasPath, SiteContext.CurrentSiteID); } // Load the URL path LoadURLPath(Node); UniGridAlias.ReloadData(); }
protected void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { TreeNode node = e.Node; int newNodeId = node.NodeID; if (newdocument || newculture) { // Store error text if (!string.IsNullOrEmpty(formElem.MessagesPlaceHolder.ErrorText)) { SessionHelper.SetValue("FormErrorText|" + newNodeId, formElem.MessagesPlaceHolder.ErrorText); } var pti = PageTemplateInfoProvider.GetPageTemplateInfo(node.NodeTemplateID); if ((pti != null) && !pti.IsReusable) { // Update node guid and display name when new document selected template is ad-hoc pti.PageTemplateNodeGUID = node.NodeGUID; pti.DisplayName = "Ad-hoc: " + node.DocumentName; PageTemplateInfoProvider.SetPageTemplateInfo(pti); } } else { // Reload the values in the form formElem.LoadControlValues(); } }
private void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { node = Node; if (radInherit.Checked) { // Set 0 as inherited SetTemplateId(0); node.NodeInheritPageTemplate = true; } else { // Set the selected template ID int templateId = SelectedTemplateID; SetTemplateId(templateId); bool templateSelected = (templateId > 0); node.NodeInheritPageTemplate = !templateSelected; if (!templateSelected) { radInherit.Checked = true; radThisCulture.Checked = false; radAllCultures.Checked = false; txtTemplate.Enabled = false; btnSelect.Enabled = false; } } node.SetValue("NodeInheritPageLevels", inheritElem.Value); }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { // Clear cache if cache settings changed if (clearCache) { Node.ClearOutputCache(true, true); } }
protected void DocumentManager_OnSaveData(object sender, DocumentManagerEventArgs e) { e.UpdateDocument = false; string errorMessage = null; string newPageName = txtPageName.Text.Trim(); if (!String.IsNullOrEmpty(newPageName)) { // Limit length newPageName = TreePathUtils.EnsureMaxNodeNameLength(newPageName, pageClassName); } TreeNode node = e.Node; node.DocumentName = newPageName; bool updateGuidAfterInsert = false; // Same template for all language versions by default PageTemplateInfo pti = selTemplate.EnsureTemplate(node.DocumentName, node.NodeGUID, ref errorMessage); if (pti != null) { node.SetDefaultPageTemplateID(pti.PageTemplateId); // Template should by updated after document insert if (!pti.IsReusable) { updateGuidAfterInsert = true; } } // Insert node if no error if (String.IsNullOrEmpty(errorMessage)) { // Insert the document // Ensures documents consistency (blog post hierarchy etc.) DocumentManager.EnsureDocumentsConsistency(); DocumentHelper.InsertDocument(node, DocumentManager.ParentNode, DocumentManager.Tree); if (updateGuidAfterInsert) { PageTemplateInfo pageTemplateInfo = PageTemplateInfoProvider.GetPageTemplateInfo(node.NodeTemplateID); if (pageTemplateInfo != null) { // Update template's node GUID pageTemplateInfo.PageTemplateNodeGUID = node.NodeGUID; PageTemplateInfoProvider.SetPageTemplateInfo(pageTemplateInfo); } } // Create default SKU if configured if (ModuleManager.CheckModuleLicense(ModuleName.ECOMMERCE, RequestContext.CurrentDomain, FeatureEnum.Ecommerce, ObjectActionEnum.Insert)) { bool? skuCreated = node.CreateDefaultSKU(); if (skuCreated.HasValue && !skuCreated.Value) { AddError(GetString("com.CreateDefaultSKU.Error")); } } if (node.NodeSKUID > 0) { DocumentManager.UpdateDocument(true); } } else { e.IsValid = false; e.ErrorMessage = errorMessage; } }
protected void DocumentManager_OnValidateData(object sender, DocumentManagerEventArgs e) { if (radInherit.Checked) { return; } // Set the selected template ID int templateId = SelectedTemplateID; if (templateId <= 0) { e.IsValid = false; e.ErrorMessage = GetString("newpage.templateerror"); } }
void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { RefreshGrid(); }