protected void form_DataBinding(object sender, EventArgs e) { WikiReader graph = (WikiReader)this.DS.DataGraph; PXCache cache = graph.Views[this.DS.PrimaryView].Cache; WikiPage current = cache.Current as WikiPage; if (current != null) { string language = Request.Params["Language"]; if (string.IsNullOrEmpty(language)) { language = LocaleInfo.GetCulture().Name; } WikiRevision currentrevision = PXSelect <WikiRevision, Where <WikiRevision.pageID, Equal <Required <WikiRevision.pageID> >, And <WikiRevision.language, Equal <Required <WikiRevision.language> > > >, OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, current.PageID, language); if (this.PublicUrlEditor != null) { this.PublicUrlEditor.Text = string.Empty; } if (current.WikiID != null) { if (Master is IPXMasterPage) { (Master as IPXMasterPage).ScreenTitle = current.Title; } if (Master is IPXMasterPage) { (Master as IPXMasterPage).BranchAvailable = false; } graph.Filter.Current.WikiID = current.WikiID; WikiDescriptor wiki = graph.wikis.SelectWindowed(0, 1, current.WikiID); PXWikiShow content = MainForm.FindControl("edContent") as PXWikiShow; if (wiki != null) { if (!string.IsNullOrEmpty(wiki.PubVirtualPath)) { if (PublicUrlEditor != null) { PublicUrlEditor.Text = Request.GetExternalUrl().ToString(); int index = PublicUrlEditor.Text.IndexOf("Wiki"); if (index > -1) { PublicUrlEditor.Text = PublicUrlEditor.Text.Remove(0, index); PublicUrlEditor.Text = wiki.PubVirtualPath + "/" + PublicUrlEditor.Text; } } } if (!Page.IsPostBack) { PXAuditJournal.Register("WI000000", Wiki.Link(wiki.Name, current.Name)); } } if (content != null) { PXDBContext wikiContext = (PXDBContext)content.WikiContext; if (currentrevision != null) { wikiContext.Text = currentrevision.Content; } if (_pageDBContextType == null) { wikiContext.ContentWidth = current.Width.GetValueOrDefault(0); wikiContext.ContentHeight = current.Height.GetValueOrDefault(0); wikiContext.PageTitle = current.Title; } wikiContext.WikiID = current.WikiID.Value != Guid.Empty ? current.WikiID.Value : current.PageID.Value; if (current.PageID != null && (_pageDBContextType == null && (PXSiteMap.WikiProvider.GetAccessRights(current.PageID.Value) >= PXWikiRights.Update && current.PageRevisionID > 0))) { wikiContext.LastModified = current.PageRevisionDateTime; wikiContext.LastModifiedByLogin = cache.GetStateExt(current, "PageRevisionCreatedByID").ToString(); } if (current.PageID != null && PXSiteMap.WikiProvider.GetAccessRights(current.PageID.Value) >= PXWikiRights.Update) { wikiContext.RenderSectionLink = true; } else { wikiContext.HideBrokenLink = true; wikiContext.RedirectAvailable = true; } if (this.WikiTextPanel != null) { this.WikiTextPanel.Caption = current.Title; } if (this.WikiTextEditor != null) { this.WikiTextEditor.Text = graph.ConvertGuidToLink(current.Content); } } if (this.LinkEditor != null) { this.LinkEditor.Text = "[" + (wiki != null && wiki.Name != null ? wiki.Name + "\\" : string.Empty) + current.Name + "]"; } } } this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "varreg", "var printLink=\"" + ResolveUrl("~/Wiki/Print.aspx") + "?" + ControlHelper.SanitizeUrl(Request.QueryString.ToString()) + "\";", true); if (this.LinkEditor != null) { LinkEditor.ReadOnly = true; } if (this.UrlEditor != null) { UrlEditor.Text = Request.GetExternalUrl().ToString(); UrlEditor.ReadOnly = true; } if (this.PublicUrlEditor != null) { PublicUrlEditor.Enabled = !string.IsNullOrEmpty(PublicUrlEditor.Text); PublicUrlEditor.ReadOnly = true; } }
protected void show_SectionEditStarting(object sender, PXWikiSectionEventArgs e) { WikiReader graph = (WikiReader)this.DS.DataGraph; e.SectionContent = graph.ConvertGuidToLink(e.SectionContent); }