Exemple #1
0
    protected void tab_DataBinding(object sender, EventArgs e)
    {
        this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "gridID", "var gridID=\"" + this.gridSub.ClientID + "\";", true);
        WikiPage curr = (WikiPage)ds.DataGraph.Caches[typeof(WikiPage)].Current;

        if (curr != null)
        {
            /*PXRichTextEdit edHtmlText = (PXRichTextEdit)this.tab.DataControls["edHtmlText"];
             *
             * edHtmlText.WikiArticleId = curr.PageID;
             * if (curr.IsHtml == true)
             * {
             *      PXUIFieldAttribute.SetVisible<WikiPage.content>(ds.DataGraph.Caches[typeof(WikiPage)], curr, false);
             *      PXUIFieldAttribute.SetVisible<WikiPage.contentHtml>(ds.DataGraph.Caches[typeof(WikiPage)], curr, true);
             * }
             * else
             * {
             *      PXUIFieldAttribute.SetVisible<WikiPage.content>(ds.DataGraph.Caches[typeof(WikiPage)], curr, true);
             *      PXUIFieldAttribute.SetVisible<WikiPage.contentHtml>(ds.DataGraph.Caches[typeof(WikiPage)], curr, false);
             * }*/
            ((PXDBContext)this.edtWikiText.PreviewSettings).WikiID = curr.WikiID;
            this.Page.Header.Controls.Add(new LiteralControl(PXHtmlFormatter.GetPageStyle(this.edtWikiText.PreviewSettings)));
            this.ScreenTitle = string.IsNullOrEmpty(curr.Title) ? (string.IsNullOrEmpty(curr.Name) ? this.ScreenTitle : curr.Name) : curr.Title;
            if (curr.Folder != true)
            {
                tab.Items["Subarticles"].Visible = false;
            }
            if (!Page.IsPostBack)
            {
                WikiDescriptor wiki = PXSelect <WikiDescriptor,
                                                Where <WikiDescriptor.pageID,
                                                       Equal <Required <WikiDescriptor.pageID> > > > .SelectWindowed(new PXGraph(), 0, 1, curr.WikiID);

                PXAuditJournal.Register("WE000000", "Edit: " +
                                        Wiki.Link((wiki != null ? wiki.Name : curr.WikiID.ToString()), curr.Name));
            }

            PXWikiMapNode node = PXSiteMap.WikiProvider.FindSiteMapNodeFromKey(curr.PageID.GetValueOrDefault()) as PXWikiMapNode;
            if (node != null)
            {
                this.CurrentNode = node;
            }

            if (!this.Page.IsCallback && !this.Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["wiki"]))
            {
                T graph = (T)ds.DataGraph;
                graph.Caches[typeof(PX.SM.WikiArticle)].IsDirty = false;
            }
        }
    }
        protected virtual IEnumerable articles(string PageID)
        {
            Guid parentID = PX.Common.GUID.CreateGuid(PageID) ?? Guid.Empty;

            PXResultset <WikiPageSimple> result =
                PXSelect <WikiPageSimple,
                          Where <WikiPageSimple.parentUID, Equal <Required <WikiPageSimple.parentUID> > > > .Select(this, parentID);

            foreach (WikiPageSimple art in result)
            {
                if (PXSiteMap.WikiProvider.GetAccessRights(art.PageID.Value) >= PXWikiRights.Select)
                {
                    PXWikiMapNode node = (PXWikiMapNode)PXSiteMap.WikiProvider.FindSiteMapNodeFromKey(art.PageID.GetValueOrDefault());
                    art.Title = node == null ? art.Name : node.Title;
                    yield return(art);
                }
            }
        }