I have looked everywhere for this bug and I have seen no other issue
Currently I am using Liferay 7.0 and I embedded my portlet in a web content template like so:
<div class ="container-fluid">
<div class ="row">
<div class ="col-md-6 col-sm-6">
<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "barebone") />
<#liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
portletName="foo" />
${freeMarkerPortletPreferences.reset()}
</div>
</div>
</div>
Portlet works fine outside of the freemarker template, however inside it actionRequest button is called but it never enters render function so the buttons I set do nothing.
Is there any special requirement for a portlet to be put inside a freemarker template? Did I forget anything?
It seems that you are embedding by portletName so it can be either:
Instanceable, and then you need to provide its instance ID, as:
instanceId="INSTANCE_ID"
If not, set com.liferay.portlet.instanceable=false
If your portlet is instanceable, an instance ID must be provided; otherwise, you can remove this line. To set your portlet to non-instanceable, set the property com.liferay.portlet.instanceable in the component annotation of your portlet to false.
Related
How do I get title of a HTML widget (in this case the "default" TripelFirst) in Orchard CMS? Newbie question, but I can't figure it out.
This is the code, I just can't figure out how to get the title into the "panel-heading" div.
#if (Model.TripelFirst != null || Model.TripelSecond != null || Model.TripelThird != null) {
<div class="row">
#if (Model.TripelFirst != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelFirst">
<div class="panel-heading">#Model.TripelFirst.Title()</div>
<div class="panel-body">#Model.TripelFirst.Body</div>
</div>
}
#if (Model.TripelSecond != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelSecond">#Display(Model.TripelSecond)</div>
}
#if (Model.TripelThird != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelThird">#Display(Model.TripelThird)</div>
}
</div>
}
First, it seems you are confusing zone and widget. TripelFirst is a zone, not a widget (see "So what are zones really?" for a more in-depth explanation of what a zone is). A zone should be seen as a placeholder, a container to which the widgets will be added. Orchard has a rich composition model where many decoupled services participate in the rendering of the page. The zone itself knows almost nothing about what's inside of it, it will just delegate rendering to its contents (such as widgets) when time comes. As such, the zone will not provide the easiest way to get to the title of the widgets it contains.
By far the easiest way to customize the rendering in Orchard is to do it from the right place :D Case in point, in this case, you might want to override the specific template for the widget, or a template for its wrapper (all shapes in Orchard can have wrappers which are templates that render around the shape itself).
This may look a little intimidating at first, but Orchard provides a marvelous tool out of the box that makes it easy to discover the shape structure of the page. Enable the "shape tracing" feature from the designer tools module on your dev machine (never activate this in production of course), and you'll get a nice Firebug-like debugging panel on the bottom of the page, that you can use to explore the tree of shapes/templates, the model for each of them, etc.
Another concept that is essential to understand rendering in Orchard is the placement file, which primarily describes in what order shapes representing a content item should get rendered.
In the end, to control the rendering of the title of a widget that goes into the TripelFirst zone, find the what template you need to override in your theme using shape tracing, then modify the rendering in this template to be exactly what you need.
Here's an example of code that you can put in a content part template override (such as Parts.Title.cshtml), that first finds the content item for the current part, then gets to the Title part, and displays it as a link.
#{
Orchard.ContentManagement.ContentItem contentItem =
Model.ContentPart.ContentItem;
string title = Model.Title.ToString();
}
<h2>#Html.ItemDisplayLink(title, contentItem)</h2>
Using the Shape Tracing tool, it helped me understand the model structure. Now I'm not saying this is the way the Orchard team wants this done, but this is how I ended up solving the problem.
#if (Model.SideItems != null)
{
<div class="col-md-12"> </div>
var sideWidgetItems = ((IEnumerable<dynamic>)Model.SideItems.Items).Where(x => x.ContentItem.ContentType == "HtmlWidget");
if (sideWidgetItems.Any())
{
foreach (var item in sideWidgetItems)
{
<div class="col-md-12">
<div class="panel panel-success">
<div class="panel-heading">#Html.Raw(item.ContentItem.Content.Parts[3].Title)
</div>
<div class="panel-body">#Html.Raw(item.ContentItem.Content.Parts[1].Text)
</div>
</div>
</div>
}
}
}
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">
I'm having an issue setting Page.Title for a page from the codebehind of a usercontrol (sublayout).
We have a layout, MainLayout.aspx. I can set the page title from the codebehind of this page, and it works fine. However, if, after this, I try to set the page title in the codebehind of MySublayout1, the new value is set for the Page.Title property, but the change is not reflected on the page.
I've tried moving the code from the Page_Load to the OnInit events for both the page and the control, but nothing seems to work. Any idea why this doesn't work?
The best approach for this is creating an new rendering or sublayout that renders the -section of your page. So you can set the values in literals or sc:text controls in the sublayout instead of setting only the Page.Title from codebehind.
This way you can set more properties all at once like the meta-keywords and meta-description, based on the current Sitecore Item.
I'd add the following to the layout or sublayout that is in it:
<head runat="server" id="_Head">
<title><sc:FieldRenderer ID="frTitle" runat="server" FieldName="title" /></title>
</head>
Also make sure that you call DataBind(); or set Sitecore.Context.State.DataBind to true.
If you want the Sublayout to override the title set in the Layout, you can move the code in the Layout to Page_Init and use Page_Load in your Sublayout.
If that doesn't work, then your Sublayout may have trouble accessing the Page. You can try using WebUtil.CurrentPage.Title to access the current page title. It might also require that you set runat="server" on the head and title elements as follows:
<head runat="server">
<title runat="server"></title>
You can simply use this:
< title> <%=Sitecore.Context.Item["PageTitleFieldName"] %> < /title>
It works fine to render page title from given field.
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.
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.