/// <summary> /// Clears all the ACL entries for a namespace. /// </summary> /// <param name="nspace">The namespace.</param> /// <param name="pages">The local names of the pages in the namespace.</param> public void ClearEntriesForNamespace(string nspace, List <string> pages) { if (nspace == null) { throw new ArgumentNullException("nspac"); } if (nspace.Length == 0) { throw new ArgumentException("Namespace cannot be empty", "nspace"); } if (pages == null) { throw new ArgumentNullException("pages"); } foreach (string p in pages) { if (p == null) { throw new ArgumentNullException("pages"); } if (p.Length == 0) { throw new ArgumentException("Page Element cannot be empty", "pages"); } } string resourceName; foreach (string p in pages) { resourceName = Actions.ForPages.ResourceMasterPrefix + NameTools.GetFullName(nspace, p); _settingsProvider.AclManager.DeleteEntriesForResource(resourceName); } resourceName = Actions.ForNamespaces.ResourceMasterPrefix + nspace; _settingsProvider.AclManager.DeleteEntriesForResource(resourceName); }
protected void btnCancel_Click(object sender, EventArgs e) { if (currentPage == null && txtName.Visible) { currentPage = Pages.FindPage(currentWiki, NameTools.GetFullName(DetectNamespace(), txtName.Text)); } if (currentPage != null) { // Try redirecting to proper section string anchor = null; if (currentSection != -1) { int start, len; ExtractSection(currentPage.Content, currentSection, out start, out len, out anchor); } UrlTools.Redirect(Tools.UrlEncode(currentPage.FullName) + GlobalSettings.PageExtension + (anchor != null ? ("#" + anchor + "_" + currentSection.ToString()) : "")); } else { UrlTools.Redirect(UrlTools.BuildUrl(currentWiki, "Default.aspx")); } }
protected void btnRename_Click(object sender, EventArgs e) { // Check name for change, validity and existence of another page with same name // Perform rename // Create shadow page, if needed PageInfo page = Pages.FindPage(txtCurrentPage.Value); if (!AuthChecker.CheckActionForNamespace(Pages.FindNamespace(NameTools.GetNamespace(page.FullName)), Actions.ForNamespaces.DeletePages, SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames())) { return; } txtNewName.Text = txtNewName.Text.Trim(); string currentNamespace = NameTools.GetNamespace(txtCurrentPage.Value); string currentPage = NameTools.GetLocalName(txtCurrentPage.Value); if (!Page.IsValid) { return; } if (txtNewName.Text.ToLowerInvariant() == currentPage.ToLowerInvariant()) { return; } if (Pages.FindPage(NameTools.GetFullName(currentNamespace, txtNewName.Text)) != null) { lblRenameResult.CssClass = "resulterror"; lblRenameResult.Text = Properties.Messages.PageAlreadyExists; return; } Log.LogEntry("Page rename requested for " + txtCurrentPage.Value, EntryType.General, Log.SystemUsername); PageInfo oldPage = Pages.FindPage(txtCurrentPage.Value); PageContent oldContent = Content.GetPageContent(oldPage, false); bool done = Pages.RenamePage(oldPage, txtNewName.Text); if (done) { if (chkShadowPage.Checked) { done = Pages.CreatePage(currentNamespace, currentPage); if (done) { done = Pages.ModifyPage(Pages.FindPage(txtCurrentPage.Value), oldContent.Title, oldContent.User, oldContent.LastModified, oldContent.Comment, ">>> [" + txtNewName.Text + "]", new string[0], oldContent.Description, SaveMode.Normal); if (done) { ResetPageList(); RefreshList(); lblRenameResult.CssClass = "resultok"; lblRenameResult.Text = Properties.Messages.PageRenamed; ReturnToList(); } else { lblRenameResult.CssClass = "resulterror"; lblRenameResult.Text = Properties.Messages.PageRenamedCouldNotSetShadowPageContent; } } else { lblRenameResult.CssClass = "resulterror"; lblRenameResult.Text = Properties.Messages.PageRenamedCouldNotCreateShadowPage; } } else { RefreshList(); lblRenameResult.CssClass = "resultok"; lblRenameResult.Text = Properties.Messages.PageRenamed; ReturnToList(); } } else { lblRenameResult.CssClass = "resulterror"; lblRenameResult.Text = Properties.Messages.CouldNotRenamePage; } }
protected void cvName2_ServerValidate(object sender, ServerValidateEventArgs e) { e.IsValid = NavigationPaths.Find(NameTools.GetFullName(lstNamespace.SelectedValue, txtName.Text)) == null; }
protected void btnCreate_Click(object sender, EventArgs e) { txtName.Text = txtName.Text.Trim(); Page.Validate("namespace"); if (!Page.IsValid) { return; } // Create new namespace and the default page (MainPage) bool done = Pages.CreateNamespace(txtName.Text, Collectors.PagesProviderCollector.GetProvider(providerSelector.SelectedProvider)); if (done) { NamespaceInfo nspace = Pages.FindNamespace(txtName.Text); done = Pages.CreatePage(nspace, "MainPage"); PageInfo page = Pages.FindPage(NameTools.GetFullName(nspace.Name, "MainPage")); if (done) { done = Pages.ModifyPage(page, "Main Page", Log.SystemUsername, DateTime.Now, "", Defaults.MainPageContentForSubNamespace, new string[0], "", SaveMode.Normal); if (done) { done = Pages.SetNamespaceDefaultPage(nspace, page); if (done) { Settings.SetTheme(nspace.Name, lstTheme.SelectedValue); if (done) { RefreshList(); lblResult.CssClass = "resultok"; lblResult.Text = Properties.Messages.NamespaceCreated; ReturnToList(); } else { lblResult.CssClass = "resulterror"; lblResult.Text = Properties.Messages.NamespaceCreatedCouldNotSetTheme; } } else { lblResult.CssClass = "resulterror"; lblResult.Text = Properties.Messages.NamespaceCreatedCouldNotSetDefaultPage; } } else { lblResult.CssClass = "resulterror"; lblResult.Text = Properties.Messages.NamespaceCreatedCouldNotStoreDefaultPageContent; } } else { lblResult.CssClass = "resulterror"; lblResult.Text = Properties.Messages.NamespaceCreatedCouldNotCreateDefaultPage; } } else { lblResult.CssClass = "resulterror"; lblResult.Text = Properties.Messages.CouldNotCreateNamespace; } }
public void MigratePagesStorageProviderData() { var mocks = new MockRepository(); var source = mocks.StrictMock <IPagesStorageProviderV30>(); var destination = mocks.StrictMock <IPagesStorageProviderV30>(); // Setup SOURCE ------------------------- // Setup snippets var s1 = new Snippet("S1", "Blah1", source); var s2 = new Snippet("S2", "Blah2", source); Expect.Call(source.GetSnippets()).Return(new[] { s1, s2 }); // Setup content templates var ct1 = new ContentTemplate("CT1", "Template 1", source); var ct2 = new ContentTemplate("CT2", "Template 2", source); Expect.Call(source.GetContentTemplates()).Return(new[] { ct1, ct2 }); // Setup namespaces var ns1 = new NamespaceInfo("NS1", source, null); var ns2 = new NamespaceInfo("NS2", source, null); Expect.Call(source.GetNamespaces()).Return(new[] { ns1, ns2 }); // Setup pages var p1 = new PageInfo("Page", source, DateTime.Now); var p2 = new PageInfo(NameTools.GetFullName(ns1.Name, "Page"), source, DateTime.Now); var p3 = new PageInfo(NameTools.GetFullName(ns1.Name, "Page1"), source, DateTime.Now); Expect.Call(source.GetPages(null)).Return(new[] { p1 }); Expect.Call(source.GetPages(ns1)).Return(new[] { p2, p3 }); Expect.Call(source.GetPages(ns2)).Return(new PageInfo[0]); // Set default page for NS1 ns1.DefaultPage = p2; // Setup categories/bindings var c1 = new CategoryInfo("Cat", source); c1.Pages = new[] { p1.FullName }; var c2 = new CategoryInfo(NameTools.GetFullName(ns1.Name, "Cat"), source); c2.Pages = new[] { p2.FullName }; var c3 = new CategoryInfo(NameTools.GetFullName(ns1.Name, "Cat1"), source); c3.Pages = new string[0]; Expect.Call(source.GetCategories(null)).Return(new[] { c1 }); Expect.Call(source.GetCategories(ns1)).Return(new[] { c2, c3 }); Expect.Call(source.GetCategories(ns2)).Return(new CategoryInfo[0]); // Setup drafts var d1 = new PageContent(p1, "Draft", "NUnit", DateTime.Now, "Comm", "Cont", new[] { "k1", "k2" }, "Descr"); Expect.Call(source.GetDraft(p1)).Return(d1); Expect.Call(source.GetDraft(p2)).Return(null); Expect.Call(source.GetDraft(p3)).Return(null); // Setup content var ctn1 = new PageContent(p1, "Title1", "User1", DateTime.Now, "Comm1", "Cont1", null, "Descr1"); var ctn2 = new PageContent(p2, "Title2", "User2", DateTime.Now, "Comm2", "Cont2", null, "Descr2"); var ctn3 = new PageContent(p3, "Title3", "User3", DateTime.Now, "Comm3", "Cont3", null, "Descr3"); Expect.Call(source.GetContent(p1)).Return(ctn1); Expect.Call(source.GetContent(p2)).Return(ctn2); Expect.Call(source.GetContent(p3)).Return(ctn3); // Setup backups Expect.Call(source.GetBackups(p1)).Return(new[] { 0, 1 }); Expect.Call(source.GetBackups(p2)).Return(new[] { 0 }); Expect.Call(source.GetBackups(p3)).Return(new int[0]); var bak1_0 = new PageContent(p1, "K1_0", "U1_0", DateTime.Now, "", "Cont", null, null); var bak1_1 = new PageContent(p1, "K1_1", "U1_1", DateTime.Now, "", "Cont", null, null); var bak2_0 = new PageContent(p2, "K2_0", "U2_0", DateTime.Now, "", "Cont", null, null); Expect.Call(source.GetBackupContent(p1, 0)).Return(bak1_0); Expect.Call(source.GetBackupContent(p1, 1)).Return(bak1_1); Expect.Call(source.GetBackupContent(p2, 0)).Return(bak2_0); // Messages var m1 = new Message(1, "User1", "Subject1", DateTime.Now, "Body1"); m1.Replies = new[] { new Message(2, "User2", "Subject2", DateTime.Now, "Body2") }; Message[] p1m = { m1 }; var p2m = new Message[0]; var p3m = new Message[0]; Expect.Call(source.GetMessages(p1)).Return(p1m); Expect.Call(source.GetMessages(p2)).Return(p2m); Expect.Call(source.GetMessages(p3)).Return(p3m); // Setup navigation paths var n1 = new NavigationPath("N1", source); n1.Pages = new[] { p1.FullName }; var n2 = new NavigationPath(NameTools.GetFullName(ns1.Name, "N1"), source); n2.Pages = new[] { p2.FullName, p3.FullName }; Expect.Call(source.GetNavigationPaths(null)).Return(new[] { n1 }); Expect.Call(source.GetNavigationPaths(ns1)).Return(new[] { n2 }); Expect.Call(source.GetNavigationPaths(ns2)).Return(new NavigationPath[0]); // Setup DESTINATION -------------------------- // Snippets Expect.Call(destination.AddSnippet(s1.Name, s1.Content)) .Return(new Snippet(s1.Name, s1.Content, destination)); Expect.Call(source.RemoveSnippet(s1.Name)).Return(true); Expect.Call(destination.AddSnippet(s2.Name, s2.Content)) .Return(new Snippet(s2.Name, s2.Content, destination)); Expect.Call(source.RemoveSnippet(s2.Name)).Return(true); // Content templates Expect.Call(destination.AddContentTemplate(ct1.Name, ct1.Content)) .Return(new ContentTemplate(ct1.Name, ct1.Name, destination)); Expect.Call(source.RemoveContentTemplate(ct1.Name)).Return(true); Expect.Call(destination.AddContentTemplate(ct2.Name, ct2.Content)) .Return(new ContentTemplate(ct2.Name, ct2.Name, destination)); Expect.Call(source.RemoveContentTemplate(ct2.Name)).Return(true); // Namespaces var ns1Out = new NamespaceInfo(ns1.Name, destination, null); var ns2Out = new NamespaceInfo(ns2.Name, destination, null); Expect.Call(destination.AddNamespace(ns1.Name)).Return(ns1Out); Expect.Call(source.RemoveNamespace(ns1)).Return(true); Expect.Call(destination.AddNamespace(ns2.Name)).Return(ns2Out); Expect.Call(source.RemoveNamespace(ns2)).Return(true); // Pages/drafts/content/backups/messages var p1Out = new PageInfo(p1.FullName, destination, p1.CreationDateTime); Expect.Call(destination.AddPage(null, p1.FullName, p1.CreationDateTime)).Return(p1Out); Expect.Call(destination.ModifyPage(p1Out, ctn1.Title, ctn1.User, ctn1.LastModified, ctn1.Comment, ctn1.Content, ctn1.Keywords, ctn1.Description, SaveMode.Normal)).Return(true); Expect.Call(destination.ModifyPage(p1Out, d1.Title, d1.User, d1.LastModified, d1.Comment, d1.Content, d1.Keywords, d1.Description, SaveMode.Draft)).Return(true); Expect.Call(destination.SetBackupContent(bak1_0, 0)).Return(true); Expect.Call(destination.SetBackupContent(bak1_1, 1)).Return(true); Expect.Call(destination.BulkStoreMessages(p1Out, p1m)).Return(true); Expect.Call(source.RemovePage(p1)).Return(true); var p2Out = new PageInfo(p2.FullName, destination, p2.CreationDateTime); Expect.Call(destination.AddPage(p2.Namespace, p2.Name, p2.CreationDateTime)).Return(p2Out); Expect.Call(destination.ModifyPage(p2Out, ctn2.Title, ctn2.User, ctn2.LastModified, ctn2.Comment, ctn2.Content, ctn2.Keywords, ctn2.Description, SaveMode.Normal)).Return(true); Expect.Call(destination.SetBackupContent(bak2_0, 0)).Return(true); Expect.Call(destination.BulkStoreMessages(p2Out, p2m)).Return(true); Expect.Call(source.RemovePage(p2)).Return(true); var p3Out = new PageInfo(p3.FullName, destination, p3.CreationDateTime); Expect.Call(destination.AddPage(p3.Namespace, p3.Name, p3.CreationDateTime)).Return(p3Out); Expect.Call(destination.ModifyPage(p3Out, ctn3.Title, ctn3.User, ctn3.LastModified, ctn3.Comment, ctn3.Content, ctn3.Keywords, ctn3.Description, SaveMode.Normal)).Return(true); Expect.Call(destination.BulkStoreMessages(p3Out, p3m)).Return(true); Expect.Call(source.RemovePage(p3)).Return(true); // Categories/bindings var c1Out = new CategoryInfo(c1.FullName, destination); var c2Out = new CategoryInfo(c2.FullName, destination); var c3Out = new CategoryInfo(c3.FullName, destination); Expect.Call(destination.AddCategory(null, c1.FullName)).Return(c1Out); Expect.Call(destination.AddCategory(NameTools.GetNamespace(c2.FullName), NameTools.GetLocalName(c2.FullName))) .Return(c2Out); Expect.Call(destination.AddCategory(NameTools.GetNamespace(c3.FullName), NameTools.GetLocalName(c3.FullName))) .Return(c3Out); Expect.Call(destination.RebindPage(p1Out, new[] { c1.FullName })).Return(true); Expect.Call(destination.RebindPage(p2Out, new[] { c2.FullName })).Return(true); Expect.Call(destination.RebindPage(p3Out, new string[0])).Return(true); Expect.Call(source.RemoveCategory(c1)).Return(true); Expect.Call(source.RemoveCategory(c2)).Return(true); Expect.Call(source.RemoveCategory(c3)).Return(true); // Navigation paths var n1Out = new NavigationPath(n1.FullName, destination); n1Out.Pages = n1.Pages; var n2Out = new NavigationPath(n2.FullName, destination); n2Out.Pages = n2.Pages; Expect.Call(destination.AddNavigationPath(null, n1.FullName, new[] { p1 })).Return(n1Out).Constraints( RMC.Is.Null(), RMC.Is.Equal(n1.FullName), RMC.Is.Matching(delegate(PageInfo[] array) { return(array[0].FullName == p1.FullName); })); Expect.Call(destination.AddNavigationPath(NameTools.GetNamespace(n2.FullName), NameTools.GetLocalName(n2.FullName), new[] { p2, p3 })).Return(n2Out).Constraints( RMC.Is.Equal(NameTools.GetNamespace(n2.FullName)), RMC.Is.Equal(NameTools.GetLocalName(n2.FullName)), RMC.Is.Matching( delegate(PageInfo[] array) { return(array[0].FullName == p2.FullName && array[1].FullName == p3.FullName); })); Expect.Call(source.RemoveNavigationPath(n1)).Return(true); Expect.Call(source.RemoveNavigationPath(n2)).Return(true); Expect.Call(destination.SetNamespaceDefaultPage(ns1Out, p2Out)).Return(ns1Out); Expect.Call(destination.SetNamespaceDefaultPage(ns2Out, null)).Return(ns2Out); // Used for navigation paths Expect.Call(destination.GetPages(null)).Return(new[] { p1Out }); Expect.Call(destination.GetPages(ns1Out)).Return(new[] { p2Out, p3Out }); Expect.Call(destination.GetPages(ns2Out)).Return(new PageInfo[0]); mocks.Replay(source); mocks.Replay(destination); DataMigrator.MigratePagesStorageProviderData(source, destination); mocks.Verify(source); mocks.Verify(destination); }
protected void cvCategory2_ServerValidate(object sender, ServerValidateEventArgs e) { e.IsValid = Pages.FindCategory(currentWiki, NameTools.GetFullName(DetectNamespace(), txtCategory.Text)) == null; }
protected void btnSave_Click(object sender, EventArgs e) { bool wasVisible = pnlPageName.Visible; pnlPageName.Visible = true; if (!wasVisible && Settings.GetAutoGeneratePageNames(currentWiki) && txtName.Enabled) { txtName.Text = GenerateAutoName(txtTitle.Text); } txtName.Text = txtName.Text.Trim(); Page.Validate("nametitle"); Page.Validate("captcha"); if (!Page.IsValid) { if (!rfvTitle.IsValid || !rfvName.IsValid || !cvName1.IsValid || !cvName2.IsValid) { pnlPageName.Visible = true; pnlManualName.Visible = false; } return; } pnlPageName.Visible = wasVisible; // Check permissions if (currentPage == null) { // Check permissions for creating new pages if (!canCreateNewPages) { UrlTools.Redirect("AccessDenied.aspx"); } } else { // Check permissions for editing current page if (!canEdit && !canEditWithApproval) { UrlTools.Redirect("AccessDenied.aspx"); } } chkMinorChange.Visible = true; chkSaveAsDraft.Visible = true; // Verify edit with approval if (!canEdit && canEditWithApproval) { chkSaveAsDraft.Checked = true; } // Check for scripts (Administrators can always add SCRIPT tags) if (!SessionFacade.GetCurrentGroupNames(currentWiki).Contains(Settings.GetAdministratorsGroup(currentWiki)) && !Settings.GetScriptTagsAllowed(currentWiki)) { Regex r = new Regex(@"\<script.*?\>", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (r.Match(editor.GetContent()).Success) { lblResult.Text = @"<span style=""color: #FF0000;"">" + Properties.Messages.ScriptDetected + "</span>"; return; } } bool redirect = true; if (sender == btnSaveAndContinue) { redirect = false; } lblResult.Text = ""; lblResult.CssClass = ""; string username = ""; if (SessionFacade.LoginKey == null) { username = Request.UserHostAddress; } else { username = SessionFacade.CurrentUsername; } IPagesStorageProviderV40 provider = FindAppropriateProvider(); // Create list of selected categories List <CategoryInfo> categories = new List <CategoryInfo>(); for (int i = 0; i < lstCategories.Items.Count; i++) { if (lstCategories.Items[i].Selected) { CategoryInfo cat = Pages.FindCategory(currentWiki, lstCategories.Items[i].Value); // Sanity check if (cat.Provider == provider) { categories.Add(cat); } } } txtComment.Text = txtComment.Text.Trim(); txtDescription.Text = txtDescription.Text.Trim(); SaveMode saveMode = SaveMode.Backup; if (chkSaveAsDraft.Checked) { saveMode = SaveMode.Draft; } if (chkMinorChange.Checked) { saveMode = SaveMode.Normal; } if (txtName.Enabled) { // Find page, if inexistent create it Log.LogEntry("Page update requested for " + txtName.Text, EntryType.General, username, currentWiki); string nspace = DetectNamespaceInfo() != null?DetectNamespaceInfo().Name : null; PageContent pg = Pages.FindPage(NameTools.GetFullName(DetectNamespace(), txtName.Text), provider); if (pg == null) { saveMode = SaveMode.Normal; pg = Pages.SetPageContent(currentWiki, nspace, txtName.Text, provider, txtTitle.Text, username, DateTime.UtcNow, txtComment.Text, editor.GetContent(), GetKeywords(), txtDescription.Text, saveMode); attachmentManager.CurrentPage = pg; } else { Pages.SetPageContent(currentWiki, nspace, txtName.Text, provider, txtTitle.Text, username, DateTime.UtcNow, txtComment.Text, editor.GetContent(), GetKeywords(), txtDescription.Text, saveMode); } // Save categories binding Pages.Rebind(pg, categories.ToArray()); // If not a draft, remove page draft if (saveMode != SaveMode.Draft) { Pages.DeleteDraft(pg.FullName, pg.Provider); isDraft = false; } else { isDraft = true; } ManageDraft(); lblResult.CssClass = "resultok"; lblResult.Text = Properties.Messages.PageSaved; // This is a new page, so only who has page management permissions can execute this code // No notification must be sent for drafts awaiting approval if (redirect) { Collisions.CancelEditingSession(pg, username); string target = UrlTools.BuildUrl(currentWiki, Tools.UrlEncode(txtName.Text), GlobalSettings.PageExtension, "?NoRedirect=1"); UrlTools.Redirect(target); } else { // Disable PageName, because the name cannot be changed anymore txtName.Enabled = false; pnlManualName.Visible = false; } } else { // Used for redirecting to a specific section after editing it string anchor = ""; if (currentPage == null) { currentPage = Pages.FindPage(currentWiki, NameTools.GetFullName(DetectNamespace(), txtName.Text)); } // Save data Log.LogEntry("Page update requested for " + currentPage.FullName, EntryType.General, username, currentWiki); if (!isDraft && currentSection != -1) { StringBuilder sb = new StringBuilder(currentPage.Content.Length); int start, len; ExtractSection(currentPage.Content, currentSection, out start, out len, out anchor); if (start > 0) { sb.Append(currentPage.Content.Substring(0, start)); } sb.Append(editor.GetContent()); if (start + len < currentPage.Content.Length - 1) { sb.Append(currentPage.Content.Substring(start + len)); } Pages.SetPageContent(currentPage.Provider.CurrentWiki, NameTools.GetNamespace(currentPage.FullName), NameTools.GetLocalName(currentPage.FullName), txtTitle.Text, username, DateTime.UtcNow, txtComment.Text, sb.ToString(), GetKeywords(), txtDescription.Text, saveMode); } else { Pages.SetPageContent(currentPage.Provider.CurrentWiki, NameTools.GetNamespace(currentPage.FullName), NameTools.GetLocalName(currentPage.FullName), txtTitle.Text, username, DateTime.UtcNow, txtComment.Text, editor.GetContent(), GetKeywords(), txtDescription.Text, saveMode); } // Save Categories binding Pages.Rebind(currentPage, categories.ToArray()); // If not a draft, remove page draft if (saveMode != SaveMode.Draft) { Pages.DeleteDraft(currentPage.FullName, currentPage.Provider); isDraft = false; } else { isDraft = true; } ManageDraft(); lblResult.CssClass = "resultok"; lblResult.Text = Properties.Messages.PageSaved; // This code is executed every time the page is saved, even when "Save & Continue" is clicked // This causes a draft approval notification to be sent multiple times for the same page, // but this is the only solution because the user might navigate away from the page after // clicking "Save & Continue" but not "Save" or "Cancel" - in other words, it is necessary // to take every chance to send a notification because no more chances might be available if (!canEdit && canEditWithApproval) { Pages.SendEmailNotificationForDraft(currentPage.Provider.CurrentWiki, currentPage.FullName, txtTitle.Text, txtComment.Text, username); } if (redirect) { Collisions.CancelEditingSession(currentPage, username); string target = UrlTools.BuildUrl(currentWiki, Tools.UrlEncode(currentPage.FullName), GlobalSettings.PageExtension, "?NoRedirect=1", (!string.IsNullOrEmpty(anchor) ? ("#" + anchor + "_" + currentSection.ToString()) : "")); UrlTools.Redirect(target); } } }
protected void cvName2_ServerValidate(object sender, ServerValidateEventArgs e) { e.IsValid = !txtName.Enabled || Pages.FindPage(currentWiki, NameTools.GetFullName(DetectNamespace(), txtName.Text)) == null; }