protected void btnClear_Click(object sender, EventArgs e) { if (node != null) { // Check modify permissions if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) { return; } // Clear the output cache with the children node.ClearOutputCache(true, true); this.lblCacheInfo.Text = GetString("GeneralProperties.CacheCleared"); this.lblCacheInfo.Visible = true; } }
protected void lnkSave_Click(object sender, EventArgs e) { // Get the document TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode); if (node != null) { // Check modify permissions if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied) { return; } bool correct = true; // OWNER group is displayed by UI profile if (!this.pnlUIOwner.IsHidden) { // Set owner int ownerId = ValidationHelper.GetInteger(usrOwner.Value, 0); if (ownerId > 0) { node.SetValue("NodeOwner", usrOwner.Value); } else { node.SetValue("NodeOwner", null); } } // Search node.DocumentSearchExcluded = chkExcludeFromSearch.Checked; // DESIGN group is displayed by UI profile if (!this.pnlUIDesign.IsHidden) { node.SetValue("DocumentStylesheetID", -1); if (!chkCssStyle.Checked) { // Set stylesheet 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 bool clearCache = false; if (!this.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) { correct = false; } } else if (radInherit.Checked) { cacheMinutes = -1; txtCacheMinutes.Text = ""; } // Set cache minutes if (cacheMinutes != node.NodeCacheMinutes) { node.NodeCacheMinutes = cacheMinutes; clearCache = true; } } if (correct) { node.DocumentLogVisitActivity = (chkPageVisitInherit.Checked ? (bool?)null : chkLogPageVisit.Checked); // Save the data node.Update(); // Update search index for node if ((node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); } // Log synchronization DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, tree); // Clear cache if cache settings changed if (clearCache) { node.ClearOutputCache(true, true); } lblInfo.Text = GetString("General.ChangesSaved"); lblInfo.Visible = true; ReloadData(); } else { // Show error message lblError.Text = GetString("GeneralProperties.BadCacheMinutes"); lblError.Visible = true; } } }