How can we create the back button in liferay - liferay

Can any one tell me how can I create the back button in my portlet. Are there any existing tags to create the back button which looks like as shared below.

Solution as mentioned in below post should work.
http://www.liferay.com/en_GB/community/forums/-/message_boards/message/22392288
Liferay uses back URL in many of its default portlets.
For example, You can refer sources for message board portlet - view.jsp, edit_category.jsp
If you use to move from first JSP to second JSP, then backURL should be passed as argument in first JSP and retrieve in second JSP to use inside liferay-ui:header tag.
For example,
<portlet:renderURL var="varURL">
<portlet:param name="mvcPath" value="<second-JSP-URL>"></portlet:param>
<portlet:param name="backURL" value="<%= themeDisplay.getURLCurrent() %>"></portlet:param>
</portlet:renderURL>

Try this instead.
Just use one line and it will direct back to previous URL.(Place this code in second jsp).
<input type=button value=" Back" onClick="javascript: window.history.go(-1)" text-align="right">

Related

How to customize search container emptyResultsMessage in lifray?

I want to display the message with a jsp page in search container emptyResultsMessage.
Presently my code is:
<liferay-ui:search-container delta="10" emptyResultsMessage="There are no results." iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
Now when I want to display
There are no results.+ button.jsp
in emptyResultsMessage.
In button.jsp I have a button. It has to display when emptyResultsMessage is empty.
Can any one tell me how to display it?
<liferay-ui:search-container delta="10" emptyResultsMessage="there were no courses found please <jsp:include page='subscribeSearch.jsp' /> with us" iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
<liferay-util:buffer .../> is your friend. You don't seem to care for internationalization, so the easy approach is this: Construct the message before, then just use it:
(untested pseudocode, don't expect it to work out of the box)
<liferay-util:buffer var="emptyMessage">
there were no courses found please
<liferay-util:include
page="subscribeSearch.jsp"
/>
with us
</liferay-util:buffer>
<liferay-ui:search-container delta="10"
emptyResultsMessage="<%=emptyMessage%>"
iteratorURL="<%=iteratorURL %>"
deltaConfigurable="true"
var="searchContainer"
>
....
IMHO I'd construct the whole message on that jsp page rather than just fragments. But I'd also use proper i18n, but you get the basic idea from this.
Also, check if you need to escape the string (e.g. use <%=HtmlUtil.escape(emptyMessage)%>). I'm not sure which order the processing is done out of the top of my head (can't test currently)

Create own customized Web Content List

I'm looking to create my own Web Content List portlet. I exactly want to display the web content of my portal applying some filters.
I'm a little bit lost...
I tried to create a hook but I dont know how to find the possible actions of this portlet.
I don't want to get all the content. I want to use a rules mechanism for filtering the contents(drools portlet), depending on the user information.
Thank you in advance,
Oriol
You can get the list of web contents by using following method:
List<JournalArticle> result = JournalArticleLocalServiceUtil.getArticles(groupId, -1, -1);
You can display the list using liferay search container as:
<liferay-ui:search-container delta="30" emptyResultsMessage="no-users-were-found">`
<liferay-ui:search-container-results>`
results="<%= result%>"
total="<%=result.size() %>" />
<liferay-ui:search-container-row
className="com.liferay.portlet.journal.model.JournalArticle"
keyProperty="articleId"
modelVar="content" >
<liferay-ui:search-container-column-text
name="ID" value="<%= content.getArticleId()%>" /> // You can add multiple columns
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Hope this will help you.

How to get document datasource in another Custom Control?

I have an xPage with this content:
<div class="lotusFrame">
<xc:layoutCommonBanner />
<xp:callback facetName="facetTitleBar" id="callbackTitleBar" />
<xc:layoutDiscrepancyPlaceBar />
<div class="lotusMain">
<div class="lotusColLeft">
<xp:callback facetName="facetColLeft" id="callbackColLeft" />
</div>
<div class="lotusColRight">
<xp:callback facetName="facetColRight" id="callbackColRight" />
</div>
<div class="lotusContent">
<xp:callback facetName="facetContent" id="callbackContent" />
</div>
</div>
<xc:layoutCommonFooter />
<xc:layoutCommonLegal />
</div>
As you can see, there are several custom controls in it composing layout. In the facetContent, there is a document with document datasource. It's the only document in the page. I need to get this document somehow in the layoutDiscrepancyPlaceBar custom control.
I found some old articles on the web with undocumented feature called currentDocument. It should be on every page with document datasource. But it doesn's work. I have Domino 8.5.2 and currentDocument seems to be no longer supported.
Can you help me out? How can I get document datasource from one custom control in another custom control. Is it even possible?
Thanks in advance, Jiří
EDIT: OK, it is still supported, but it only works in custom control, that is included inside the one with document datasource. In the case scenario above it doesn't work.
Your best option is to hand over the binding name in a custom property. (lets call it bindto. Then you bind your field to
"${#{"+compositeData.bindto+"}}"
See details here (inside the prezi)
P.S. currentDocument is documented somewhere.
You can also pass a handle on the data source directly to the custom control, as well as the name of the item to bind to on the data source. Because EL supports array syntax as well as dot syntax, this allows you to define expressions like this:
#{compositeData.dsn[compositeData.fieldName]}
(where "dsn" is the property being passed the handle on the data source, and "fieldName" is the property being passed the name of the item to bind to on that data source.)
More details on this approach can be found here.

Content rating control is always hidden

I've added the following code to the selected transformation of a News List webpart:
<%# Register Src="~/CMSAdminControls/ContentRating/RatingControl.ascx" TagName="RatingControl" TagPrefix="cms" %>
<cms:RatingControl ID="elemRating" runat="server" Enabled="true" RatingType="Stars" ExternalValue='
<%# Convert.ToString(CMS.GlobalHelper.ValidationHelper.GetDouble(Eval("DocumentRatingValue"), 0)/((CMS.GlobalHelper.ValidationHelper.GetDouble(Eval("DocumentRatings"), 0) == 0?1:CMS.GlobalHelper.ValidationHelper.GetDouble(Eval("DocumentRatings"), 1)))) %>' />
The rest of the selected transformation is the same as the default.
According to the Kentico documentation this should add the webpart to the details page of a news item.
For some reason the input tag is getting rendered as follows:
<input type="hidden" name="p$lt$zoneContent$pageplaceholder$pageplaceholder$lt$News$NewsList$repItems$ctl00$ctl00$elemRating$RatingControl$elemRating_RatingExtender_ClientState" id="p_lt_zoneContent_pageplaceholder_pageplaceholder_lt_News_NewsList_repItems_ctl00_ctl00_elemRating_RatingControl_elemRating_RatingExtender_ClientState" value="0">
note the type="hidden" attribute. This causes the control not to render and I'm not sure where to fix this.
As mentioned in my comment. The is actually just used to store the value. Below that, it renders some extra content that will not display unless some CSS classes are carried over from the CMSDesk.css.
You can either copy the necessary CSS classes into your own CSS, or just import the CMSDesk.css file where necessary to make sure the rating elements are displaying.

how to refer values of one jsp file to other jsp

I am calling jsp on <a href> tag like this
<div align="left"><%=searchList1.getProjid()%></div>
I want to get the value of searchlist1.getProjid in UpdateProject.jsp
How can I do it... please suggest me with example code.
You can send it as parameter:
<div align="left"><%=searchList1.getProjid()%></div>
And then use it in the new jsp like:
request.getParameter('projid');

Resources