Forums de discussion

Displaying an Article or a Wiki Entry in Pop-Up

Marc Grünewald, modifié il y a 11 années.

Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Hello everyone,

once again I need your Help. I'm currently developing several Portlets and I'm trying to provide a simple and clean help for these Portlets. I want to realize that, by writing a Liferay Article and implement a Button in the Portlets which preferrably opens that article in a Pop-Up. For your Information, I'm using Icefaces, JSF and Liferay 6.1.?

Hope you guys can help


Cheers Marc
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
You can use the ICEfaces3 ace:dialog component tag for the popup. For the article text, you can retrieve that from a JSF model managed-bean like this:


@ManagedBean
public class HelpModelBean {

    private String text;

    public String getText() {
        if (text == null) {
            LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
            ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay();
            long groupId = liferayFacesContext.getScopeGroupId() // assumes that the help text article is in the current site/community
            String articleId = "1234"; // the id of the help text article
            String languageId = LanguageUtil.getLanguage(liferayFacesContext.getLocale());
            text = JournalArticleLocalServiceUtil.getArticleContent(long groupId,
		java.lang.String articleId, java.lang.String languageId,
		com.liferay.portal.theme.ThemeDisplay themeDisplay)
        }
        return text;
    }
}
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Wow that's awesome. Thank you very much!

Best Regards

Marc
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
My pleasure Marc -- thanks for using Liferay and Liferay Faces emoticon
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Hi Neil,

sorry to bother you again, but I tried your code(in fact I fetch the content of a WikiPage) and it is doing what it should but just displaying unformatted plain text isn't really user friendly to read... Is it possible to show the whole wikipage in the ace:dialog?

Best Regards

Marc
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Is your content using stored as Wiki entries (like the ones created with the Liferay Wiki portlet) or is the content stored as Web Content articles?
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Its created using the Wiki-Portlet from the Control Panel.
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
OK for retrieving Wiki content from the Liferay database that can be rendered as HTML, then I recommend that you look at the following JSP found in the Liferay Portal source code: portal-web/docroot/html/portlet/wiki/view_page_content.jspf

You can use similar Java Scriptlet code in your JSF model managed-bean to retrieve the Wiki article.
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Okay thanks, I'll look into it. Just out of curiosity, is there a huge difference between displaying an Article and a Wiki Page? If yes, what are the advantages/disadvantages? Basically I want to provide a Help for my Custom Portlet which should be visible after a button-click. Whether that renders in a pop-up or in a new Page is not that important, a pop-up is probalby a little more user friendly though.
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
For the purpose of rendering Help, there isn't much difference. I think that Web Content articles might be a better fit though, because they are similar to individual text files which are not necessarily related to each other. Wiki articles tend to be part of a Wiki Page hierarchy with hyperlinks to related Wiki content.
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Hmm I see, then I would take your advice and stick with Web Content articles. Is there a similiar jsp(f)-File for me to take a look at? Sorry for asking all that... still a pretty newbie to all that stuff. Thanks anyway for all your help so far, I really apreciate it.

Best Regards

Marc
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
No problem, here's the file I think you're asking about:
portal-web/docroot/html/portlet/journal/view_article.jsp
Marc Grünewald, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Junior Member Publications: 45 Date d'inscription: 20/03/12 Publications récentes
Hello Neil, I gave it a try and it works!
I "exported" the code of the jsp mentioned to a Bean and accessed the article content with an ice:outputext and "escape" disabled.
The content shwos inside a ace:dialog as you've suggested. Thanks you very much, that really really helped. Have a nice day! Cheers Marc
thumbnail
Neil Griffin, modifié il y a 11 années.

RE: Displaying an Article or a Wiki Entry in Pop-Up

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Thanks for the good report! Glad to hear it. emoticon