Exemplo n.º 1
0
    protected void show_EditorCreated(object sender, EventArgs e)
    {
        PXWikiShow show  = sender as PXWikiShow;
        WikiReader graph = (WikiReader)this.DS.DataGraph;

        if (show != null)
        {
            if (graph.Pages.Current != null)
            {
                ((PXDBContext)show.Editor.PreviewSettings).WikiID = graph.Pages.Current.WikiID;
                if (graph.Pages.Current.ArticleType == WikiArticleType.Notification)
                {
                    WikiNotificationTemplateMaintenance g = TreeDS.DataGraph as WikiNotificationTemplateMaintenance;
                    if (g != null)
                    {
                        g.Filter.Current.PageID = graph.Pages.Current.PageID;
                        g.Pages.Current         = g.Pages.SelectWindowed(0, 1);
                    }

                    show.Editor.TemplateDataSourceID = TreeDS.ID;
                    PXTreeItemBinding binding = new PXTreeItemBinding();
                    binding.DataMember    = "EntityItems";
                    binding.TextField     = "Name";
                    binding.ValueField    = "Path";
                    binding.ImageUrlField = "Icon";
                    show.Editor.TemplateDataBindings.Add(binding);
                }
            }
        }
    }
Exemplo n.º 2
0
 protected override void Initialize()
 {
     if (_templateWikiArticleType != null && _rootTemplate != null)
     {
         string language = Request.Params["Language"];
         if (string.IsNullOrEmpty(language))
         {
             language = LocaleInfo.GetCulture().Name;
         }
         int        revision;
         Guid       pageID          = WikiPageId;
         int?       correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
         WikiReader graph           = PXGraph.CreateInstance <WikiReader>();
         try
         {
             object article = pageID == Guid.Empty
                                     ? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
                                     : Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
             _wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
         }
         catch (StackOverflowException) { throw; }
         catch (OutOfMemoryException) { throw; }
         catch
         {
             _wikiShow = new PXWikiShow();
         }
     }
     else
     {
         _wikiShow = new PXWikiShow();
     }
     _wikiShow.NotFoundMessage = PXMessages.LocalizeNoPrefix(Msg.WkNotFound);
     base.Initialize();
 }
Exemplo n.º 3
0
    protected override void Initialize()
    {
        if (_templateWikiArticleType != null && _rootTemplate != null)
        {
            string language = Request.Params["Language"];
            if (string.IsNullOrEmpty(language))
            {
                language = LocaleInfo.GetCulture().Name;
            }
            int        revision;
            Guid       pageID          = WikiPageId;
            int?       correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
            WikiReader graph           = PXGraph.CreateInstance <WikiReader>();
            object     article         = pageID == Guid.Empty
                                ? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
                                : Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
            _wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
        }
        else
        {
            _wikiShow = new PXWikiShow();
        }

        base.Initialize();
        this.MainForm.DataBinding += new EventHandler(MainForm_DataBinding);
    }
Exemplo n.º 4
0
    protected virtual void Initialize()
    {
        Guid pageId = WikiPageId;

        article = new WikiPage();
        article = GetArticle();

        PXWikiShow show = GetRenderControl("edContent", "Content", "lblContent");

        MainForm.TemplateContainer.Controls.Add(show);

        MainForm.DataBinding += new EventHandler(form_DataBinding);
        if (show != null)
        {
            show.WikiContext = _pageDBContextType == null
                                ? new PXDBContext(WikiSettings.Relative)
                                : (PXDBContext)Activator.CreateInstance(_pageDBContextType, WikiSettings.Relative, pageId);
            show.SectionEditStarting += new PXWikiSectionEventHandler(show_SectionEditStarting);
            show.SectionUpdated      += new PXWikiSectionEventHandler(show_SectionUpdated);
            show.EditorCreated       += new EventHandler(show_EditorCreated);
            this.ClientScript.RegisterClientScriptBlock(GetType(), "showid", "var wikiShowId='" + show.ClientID + "';", true);
        }
        if (!DesignMode)
        {
            string prevScreenID = Page.Request.QueryString["PrevScreenID"];
            if (!string.IsNullOrEmpty(prevScreenID) && this.Master is IPXMasterPage)
            {
                (Master as IPXMasterPage).ScreenID = prevScreenID;
            }
        }
        string navurl = this.GetExportUrl();

        if (this.MainToolbar != null)
        {
            PXToolBarButton exportBtn = ((PXToolBarButton)this.MainToolbar.Items["export"]);
            exportBtn.MenuItems[0].NavigateUrl = navurl + "&type=txt";
            exportBtn.MenuItems[1].NavigateUrl = navurl + "&type=rtf";

            /*if (article != null)
             * {
             *      exportBtn.MenuItems[2].NavigateUrl = "ExportDita.axd?DITAConversionType=ConversionType1&pageid=" + article.PageID + "&lang=" + article.Language + "&name=" + HttpUtility.HtmlEncode(article.Title) + "&type=last";
             *      exportBtn.MenuItems[3].NavigateUrl = "ExportDita.axd?DITAConversionType=ConversionType1&pageid=" + article.PageID + "&lang=" + article.Language + "&name=" + HttpUtility.HtmlEncode(article.Title) + "&type=published";
             * }*/
        }
        WikiReader wikiReader = DS.DataGraph as WikiReader;

        if (wikiReader != null)
        {
            wikiReader.AppVirtualPath  = Request.GetWebsiteAuthority().GetLeftPart(UriPartial.Authority);
            wikiReader.WebDAVFilesPath = !string.IsNullOrEmpty(_filesPath) ? ResolveUrl(_filesPath) : ResolveUrl("~/Files");
        }
    }
Exemplo n.º 5
0
    protected void edContent_EditorCreated(object sender, EventArgs e)
    {
        PXWikiShow show = (PXWikiShow)MainForm.DataControls["edContent"];

        show.Editor.FileUploaded += new PXFileUploadEventHandler(editor_FileUploaded);

        WikiPage current = this.CurrentRec;

        if (current != null)
        {
            show.Editor.FileNamePrefix = current.Name;
        }
    }
Exemplo n.º 6
0
	protected override void Initialize()
	{
		if (_templateWikiArticleType != null && _rootTemplate != null)
		{
			string language = Request.Params["Language"];
			if (string.IsNullOrEmpty(language)) language = LocaleInfo.GetCulture().Name;
			int revision;
			Guid pageID = WikiPageId;
			int? correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
			WikiReader graph = PXGraph.CreateInstance<WikiReader>();
			object article = pageID == Guid.Empty
				? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
				: Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
			_wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
		}
		else _wikiShow = new PXWikiShow();

		base.Initialize();
		this.MainForm.DataBinding += new EventHandler(MainForm_DataBinding);
	}
Exemplo n.º 7
0
    protected PXWikiShow GetRenderControl(string id, string dataField, string labelId)
    {
        PXWikiShow wikiShow = CreateWikiShow();

        wikiShow.ID               = id;
        wikiShow.DataField        = dataField;
        wikiShow.Height           = Unit.Percentage(100.0D);
        wikiShow.LabelID          = labelId;
        wikiShow.Width            = Unit.Percentage(100.0D);
        wikiShow.SkinID           = "dummy";
        wikiShow.NotFoundMessage  = "There is no article to show in this view.";
        wikiShow.BackColor        = Color.White;
        wikiShow.Style["z-index"] = "103";
        wikiShow.EditorCreated   += edContent_EditorCreated;
        wikiShow.AutoSize.Enabled = true;
        if (article != null)
        {
            wikiShow.IsHtml = (bool)article.IsHtml;
        }
        return(wikiShow);
    }
Exemplo n.º 8
0
    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;
        }
    }
Exemplo n.º 9
0
	protected override void Initialize()
	{
		if (_templateWikiArticleType != null && _rootTemplate != null)
		{
			string language = Request.Params["Language"];
			if (string.IsNullOrEmpty(language)) language = LocaleInfo.GetCulture().Name;
			int revision;
			Guid pageID = WikiPageId;
			int? correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
			WikiReader graph = PXGraph.CreateInstance<WikiReader>();
			try
			{
				object article = pageID == Guid.Empty
					? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
					: Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
				_wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
			}
			catch (StackOverflowException) { throw; }
			catch (OutOfMemoryException) { throw; }
			catch
			{
				_wikiShow = new PXWikiShow();
			}
		}
		else _wikiShow = new PXWikiShow();
		_wikiShow.NotFoundMessage = "The article does not exist or you don't have enough rights to see it.";
		base.Initialize();		
	}