protected void RandomArticle_Click(object sender, System.EventArgs e) { Domain.WikiFolder folder = CurrentMasterItem.TemplateID == Domain.WikiFolder.TemplateID ? new WikiFolder(CurrentMasterItem) : new WikiFolder(CurrentMasterItem.Parent); IList pages = folder.VersionedPages; if (pages.Count > 0) { int index = new Random().Next(pages.Count); Domain.WikiPage page = (Domain.WikiPage)pages[index]; RedirectToPage(page.InnerItem); } }
Item ProcessFirstPage(Domain.WikiFolder folder) { Item item = DBMaster.Items[folder.FirstPageID]; if (item == null) { IList pages = folder.Pages; if ((pages != null) && (pages.Count > 0)) { item = ((CustomItemBase)pages[0]).InnerItem; } } else { folder.FirstPageID = item.ID; } return(item); }
protected void Page_Load(object sender, EventArgs e) { this.WikiEditor.SaveButtonClick += new EventHandler <EventArgs>(WikiEditor_SaveButtonClick); if (!Page.IsPostBack) { if (CurrentMasterItem.TemplateID == WikiFolder.TemplateID) { SetupPageForFolder(); } else { SetupPageFowWikiPage(); } Domain.WikiFolder folder = CurrentMasterItem.TemplateID == WikiFolder.TemplateID ? new WikiFolder(CurrentMasterItem) : new WikiFolder(CurrentMasterItem.Parent); RandomArticle.Visible = folder.VersionedPages.Count > 0; } btnTitleSave.Attributes.Add("onclick", "javascript:return ProcessTitle();"); }