Sitecore xsl localisation - localization

When testing with ..
/xsl/sample rendering.xslt
..which is a simple rendering provided out of the box by Sitecore, I notice that, in the loop that outputs the item's children, all children are included, regardless of whether those items have a version in the current language.
Is this normal? ... And is there a way to force/check the language to ensure only the items we want appear?

Sitecore items will always coexist across language barriers. This has to do (atleast I believe this is one of the reasons) with the fact that they all inherit from Standard Template, and this template has some fields that are marked "Shared", i.e. implicitly available to any language.
What the item does not have however, is a Version in the current language. Field values will return null.
You can test this yourself by modifying the Sample Rendering.xsl to this:
<xsl:for-each select="item">
<xsl:value-of select="#name" /> ( <sc:text field="title" /> )
<br />
</xsl:for-each>
I ran a quick test, and this was my result. Sample Item 3 is created in non-context language.
Sitecore Welcome to Sitecore
Sample Item 1 ( Sample Item 1 )
Sample Item 2 ( Sample Item 2 )
Sample Item 3 ( )

Related

grails fields plugin <f:display is 'chopping off' bootstrap dropright action with a table of values

grails v 3.3.9, fields plugin
fighting with fields plgin and theres a problem when rendering domain objects and using bootstrap
i've got a sample here from a simple standalone page to show the problem
<p>f:display category </p>
<f:display bean="maintenanceAgreement" >
</f:display>
<hr />
<p>f:field category</p>
<f:field bean="${this.pageScope.maintenanceAgreement}" property="category">
<g:render template="/_fields/map/displayWidget" ></g:render>
</f:field>
<hr />
in essenence i have added a template in "/_fields/map/displayWidget" that renders a drop right table on a button
when you render a map field directly from your Domain object the sample table opens and you get all of the table
however when you
you can see the differences between using f.display (has clipping problem), f.field ( which seems to work) and f.all that ignores my _fields/map/_displayWidget.gsp
I dont want to have not use the fields plugin but its not working with bootstrap templating
has any one come up with a fix for this problem?
the project demo page is here
github standalone page to show rendering problem
the attached shows the output as you try each and select category property
well goldarn it another 2 days down the pan - but i have it !
I thought at first it was something to do with fields plugin processing. so i hacked a clone of plugin project locally and added some bits so i could watch it/debug step through it
in doing so i noted that my dummy web domain class page i'd cut across to the plugin didnt have the clipping problem. but the styles were not the same so i copied main.css and grails.css from ordinary project back into the plugin, then re rendered in the browser - and the clipping happened again.
so its in the css!. some very careful watching of browser and looking at the browser 'inspect' indicated that the clipping seemed to be enabled very early on in the journey.
so in my dummy page i just used
I then spent a day wandering round the various bits of fields plugin as its not that well explained anywhere.
if you look at the plugins taglib display method, by default that triggers the /templates/fields/_list.gsp. naming is a little odd but its the gsp that renders the domains persistent attributes as an ordered list - the plugins default _list.gsp looks like this
<ol class="property-list ${domainClass.decapitalizedName}">
<g:each in="${domainProperties}" var="p">
<li class="fieldcontain">
<span id="${p.name}-label" class="property-label"><g:message code="${domainClass.decapitalizedName}.${p.name}.label" default="${p.defaultLabel}" /></span>
<div class="property-value" aria-labelledby="${p.name}-label">${body(p)}</div>
</li>
</g:each>
</ol>
so after much exploration coming up through templates, from the bottom I ended up right at the top with the '
so nearly there now. back into main.css that i'd copied in. if you edit that, down around line 215 you get this style. If you comment out the overflow property - its all fixed !
.property-list .fieldcontain {
list-style: none;
/*overflow: hidden; */
zoom: 1;
}
I tried auto, scroll, and visible but that seems to much about with too much of the page so best to just comment it out.
once you do that - the rest of the rendering of your forms starts to work !! blimey one line of css for all that pain. Attached is the page using
Lastly through out all this, id ended up digging through /tracing fields plugin. What a nest that is. Not really finished here, but basically
with no body just renders a label and no content. So you either need to provide provide a body tag, say to get the value field displayed.
as
if no widget template has been defined then the renderDefaultDisplay is called which again has very limited options for controlling the rendering by falling through a 'switch (prop.type)' and basically calls either g.format (bool), g.formatDate (but no LocalDateTime/LocalDate Support) or g.fieldValue, non of which are bootstrap enabled.
if you call
these two diagrams are not beautiful but just high level pseudo code walk through for what the core tags are trying to do. One day i'll try and pretty that up but it might help you if you get stuck
I'll raise a bug for the main.css clipping directly to the grails team and see what happens, but you can comment the line out yourself if you fall foul of it.

JSF 2.0 h:datatable not using supplied id attribute

I'm observing the following behavior within a JSF 2 page (Mojarra 2.1.18 / RedHat EAP 6.1, if that's useful). I've got a form wrapping a data table, and I'm supplying an ID attribute value for both the form and the table. When I view the resulting html source file, I see that the table ID is set to an auto-generated value and the form ID attribute is not prepended to the auto-generated table ID. That is:
This set of tags:
<h:form id="form4">
<h:datatable id="notices" ...>
...
</h:datatable>
</h:form>
Yields the following html:
<form id="form4" ...>
<table id="j_itd68"> //i.e. id != "notices"
...
</table>
</form>
There are more elements in the JSF xhtml file preceding the h:form/h:datatable, but I've intentionally excluded them here (hoping that someone might recognize this symptom without additional clutter). Things go wrong for me when I attempt to include some PrimeFaces p:commandbutton instances within the table. They don't get named properly (i.e. they don't include the enclosing form ID in the generated ID), and this causes a "component not found for ID" servlet error. The same improper naming occurs if I replace the p:commandbutton instances with h:commandbutton instances (so I don't believe this is a PrimeFaces issue). This behavior seems like the result of a malformed JSF page, but I haven't found anything yet (a NetBeans XML check on the JSF xhtml file returns a successful result). Any help is appreciated.
Best regards,
-Andy

wrong ids when render h:panelGroup's inside c:forEach

I have page where I render some h:panelGroup panels. Those panels are realized as plugins registered in a plugin registry on startup.
Part of the plugins api is a custom jsf component where I get the registered plugins for extension point and include their facelet templates by path:
<c:forEach items="#{pluginRegistry.getPlugins(point)}" var="extension">
<ui:include src="#{extension.path}" />
</c:forEach>
The page where I include the panels looks like:
<h:panelGrid id="dashboard" columns="3">
<cmf:insertPageFragments point="dashboardExtensionPoint" />
</h:panelGrid>
For every panel there are facelet templates like the one below:
<rich:panel id="caseDetailsPanel" header="panel label">
<!-- panel content -->
</rich:panel>
Now, the problem is that the very first panel in the list returned by the pluginsRegistry is rendered in the page with the provided id like formId:caseDetailsPanel for example. The rest of them have generated ids like formId:j_idt223 !!! Obviously if I want to rerender some of the panels, I can't do that.
That happens when environment is jboss AS 7.1 with JSF 2.1, richfaces 4.2.3.Final.
When deployed on jboss-eap-6.1 everything looks fine but for now I can't use this jboss version.
Any suggestions on how to workaround this issue?
There can not be multiple JSF components with the same ID. Each JSF component must have an unique ID. When dynamically creating JSF components using JSTL, you need to manually assign and ensure an unique ID, otherwise JSF will discard the provided ID and autogenerate an unique ID.
There are several ways to achieve this, depending on the concrete functional requirement and the existing code.
Use use the iteration index of <c:forEach>.
<c:forEach ... varStatus="loop">
...
<rich:panel id="caseDetailsPanel_#{loop.index}" ...>
This will generate caseDetailsPanel_0, caseDetailsPanel_1, etc depending on the current iteration index.
Use the unique identifier of the currently iterated item. It isn't clear based on the information provided so far if you have any, so here's just a fictive example assuming that the class behind #{extension} has an id property representing the technical DB identifier.
<c:forEach ... var="extension">
...
<rich:panel id="caseDetailsPanel_#{extension.id}" ...>
Wrap #1 or #2 if necessary in a <f:subview> with an unique identifier, so that you don't need to modify the includes.
<c:forEach ... varStatus="loop">
<f:subview id="panel_#{loop.index}">
<ui:include ... />
The <f:subview> creates a new NamingContainer around it, so you end up getting formId:panel_0:caseDetailsPanel, formId:panel_1:caseDetailsPanel and so on.
A completely different alternative would be to use <ui:repeat> instead of <c:forEach>. The <ui:repeat> does not run during view build time, but during view render time. This way there's physically only one <rich:panel id="caseDetailsPanel"> component in the component tree which is reused multiple times during generating HTML whereby JSF will take care of generating the right IDs with the <ui:repeat> index like so formId:repeatId:0:caseDetailsPanel. However, this in turn may cause trouble with <ui:include> as it also runs during view build time and thus can't get the #{extension} at hands.

grails - bug in scaffolded view generation for Floats (Grails 2.0 RC1 - RC3)?

If one has a Float field in a domain class, the Grails view generation uses a
<g:field type="number" />
and one gets a
<input type="number" />
type of html field, which purely allows integers .... unless I'm just unable to get it to work differently.
Can one override the scaffolded generation to use something else for Floats, e.g. a simple text field, so that a floating point value can be entered?
Thanks
P.S. I can't find any documentation on the g:field tag, apparently new in this release. Can you refer me to any reference you've seen or include the documentation in this post? (if available)
Voting for the bug in the Grails bug-tracker might help get it fixed. There's also a workaround
This could be fixed by using the widget constraint which allows you to define a custom html element to be generated by scaffold.
Exp:
description widget: 'textarea'
http://grails.org/doc/2.2.x/ref/Constraints/widget.html

RADScheduler Appointments not appearing issue in Resource Grouping mode

Hi i am using RAD Scheduler. The Problem is when i bind RAD Scheduler in Resource Grouping mode its not showing Appointments. If i remove resource grouping the scheduler is working fine.
I have two tables one for Projects (Appointments ) and other for Techs ( Resources.). Both table have FK relationship. I tried all possible way of binding ( In Memory DataTable with Custom fields required by Scheduler) and finally i m using Sql Data Sources for Projects ( Appointments) and Techs (Resources.) The FK relationship is defined.
And here is Resource defination
<ResourceTypes>
<telerik:ResourceType DataSourceID="sdsResources" ForeignKeyField="Assignedto"
KeyField="uID" Name="Tech" TextField="UserName" />
</ResourceTypes>
here are two DataSources.
"
SelectCommand="Select * From Techs" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsProjects" runat="server"
ConnectionString="<%$ ConnectionStrings:Mycon %>"
SelectCommand="sched_GetSchedule" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="schedDate" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
Any help will be greatly appreciated.
Thanks
Without seeing your scheduler markup there isn't a lot to go by, but I'll take a shot.
In your markup, you will need explicitely tell the scheduler how you want to show the grouping.
Between your <telerik:RadScheduler> and </telerik:RadScheduler> tags, include the following line:
<TimelineView UserSelectable="true" GroupBy="Tech" GroupingDirection="Vertical" />
You need to set the GroupBy property of your TimelineView tag equal to the Name property of the resource that you wish to group by. In your example, the value is "Tech".
That will allow your grid to visually display the relationship.

Resources