Localizing XForms in EPiServer File Manager - localization

In the EPiServer file upload dialogue, there is a section for adding meta data to an uploaded file such as Title, Link, Description, Author and Publisher. These form fields are implemented using XForms and configured in FileSummary.config.
The headings for these fields are defined directly in HTML markup containing the XForms controls as in the snippet below.
<tr>
<td class="EP-tableCaptionCell">
<span id="id_field1">Author</span>
</td>
<td valign="top" width="200" height="10">
<xforms:input ref="Author" value="" id="id_field2" size="40" class="commonInput" />
</td>
</tr>
My question is, how can I localise these field captions? In this case it would be Author.
The localisation is working in Japanese in every other section of the file manager driven from the lang xml file, but it seems this part of the file manager works in a totally different way from the rest of the episerver admin and edit.

EPiServer CMS feature XForm is used to render the form used in the upload dialog. You specify the file where the form is loaded from in a tag in web.config or episerver.config.
The file is processed and all xform-tags are replaced with EPiServer Web Controls for XForms. Then Page.ParseControl is used to transform the text into a User Control. This string cannot contain any code, because the ParseControl method never causes compilation but you can use other web controls.
There is only one small extra step. Since the text is converted to an xml document you need to add namespace either to the element itself or the root-tag.
<root ... xmlns:asp="dummy1" > ...
<td class="EP-tableCaptionCell">
<label for="id_field2" id="id_field1" style="margin-bottom: 10px;">
<asp:Label runat="server"
Text="TEST!"/>
<EPiServer:Translate xmlns:EPiServer="dummy2"
runat="server"
Text="/admin/admingroup/addgroup" />
</label>
</td>

Related

Submit cell data from table in thymeleaf template

I have following code snippet:
<table class="table">
<thead>
<tr>
<th>Type</th>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr th:if="${list.isEmpty()}">
<td colspan="2">No Media Available</td>
</tr>
<tr th:each="media : ${list}">
<form th:action="#{/pages}" method="post">
<td><span th:text="${media.getType()}">Type</span></td>
<td><span th:text="${media.getTitle()}">Title</span></td>
<td><input name="submit" type="submit" value="add"/></td>
</form>
</tr>
</tbody>
Now to my question: How can I submit the content from the rows?
Another question: Is my approach to creating a form for each row makes sense at all?
If you want to have user-entered data sent to the server, then replace this:
<td><span th:text="${media.getTitle()}">Title</span></td>
with this:
<td><input name="title" th:value="${media.title}"></td>
Assuming the ${media.title} evaluates to "War and Peace" This will use the name field to submit data as title=War and Peace (with URL encoding for the spaces in the title: War%20and%20Peace).
Note the use of ${media.title} instead of ${media.getTitle()}. You should be able to refer to the field name, rather than the get method. Thymeleaf will use the getFoo() method for a field called foo, based on naming conventions.
There are other approaches, for example:
use a visible input field, but styled to look and behave like regular text (cannot be edited, and has no surrounding box).
use JavaScript to replace the default form submission process, and read your row data from the vanilla table, without a form - instead, with a button using a click event handler.
If you create one form for the entire table, you're going to get all the table's data submitted at once (arrays of title data, and so on).
Alternatively, if you have one form per table row, you have to consider what happens if a user edits multiple rows of data before hitting submit for one row. All those other unsent changes will potentially be lost.
A common solution is to avoid this problem, by forcing users to update records one at a time: The table does not use forms. Each row's button click opens a new modal dialog containing the data for only that one row (in a form) - which can then be edited and submitted.

Ordering Members in Umbraco 7 Back Office

We are currently utilising the Umbraco 7 membership service. Our site creates members as part of a sign-up process.
In the CMS side of Umbraco I can see that the members should be sorted into folders alphabetically, however it would appear that the Name is being used to sort. This causes issues as the Name is for example "Mr Joe Blogs" which means nearly everyone ends up in the "M" folder. We have custom properties for title, forename and surname on the member object.
How can I configure umbraco to sort in to alphabetical folders by the surname property.
Also on the members manage tab Name is displayed on the grid how can I change this to surname and forename?
Update:
So i've done a bit more investigation and I can see that I have the MemberListView for Umbraco 7 installed and I file called memberListView.html which has an angularjs bound template and the bit I am looking at is:
<tr ng-repeat="result in listViewResultSet.items"
ng-class="{selected:result.selected}">
<td>
<i class="icon {{result.icon}}" ng-class="getIcon(result)"></i>
<input type="checkbox" ng-model="result.selected">
</td>
<td>
<!-- ng-class="{inactive: entityType === 'content' && !result.published}" - use this as a template to color based on locked/approved state -->
<a href="#" ng-click="editMember(result.key)" prevent-default>{{result.name}}</a>
</td>
<td>
{{result.email}}
</td>
<td colspan="2">
<span title="{{getLockedDescription(result)}}" ng-class="getLockedIcon(result)"></span>
<span title="{{getSuspendedDescription(result)}}" ng-class="getSuspendedIcon(result)"></span>
</td>
</tr>
When I try and get my custom property off result it isn't there but looking at the JSON some standard properties are there.
If you modify the List View - Members data type in the Developer section you can select the property that you would like to order the members by. It also gives you the option to change which columns appear in the grid so you should be able to replace the Name property with Forename and Surname.
If you've managed to organise the members into alphabetical folders then you may have performed some customisation already. As far as I know this isn't possible out of the box.

Showing the user a custom page after list add in Sharepoint 2007

After my user adds a new list item with my custom list page, Sharepoint 2007 redirects them to AllItems.aspx. I want them to go the the custom page ThankYou.aspx instead.
My buttos are the standard buttons generated by SharePoint Designer
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap=""><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="">
<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/>
</td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/>
</td>
</tr>
</table>
I have seen several solutions that require adding 150 lines of JavaScript or changing the underlying SharePoint code, and I just can't believe that is the solution - I think either it is so simple that no one has written about it, or I am using the wrong search term to look for it.
I was just overlooking something simple.
The Source parameter on the form link will change the redirect for you. So if your custom form is at
https://myserver/lists/customadd.aspx
Then you can just add the source parameter and Sharepoint will redirect there on submit:
https://myserver/lists/customadd.aspx?Source=ThankYou.aspx

How to dynamically generate id in dataTable using ui:repeat tag

I am using ui:repeat tag which render images. I have five images i want that on each iteration my image get ids like image1, image2, image3.... imagen. I tried this but it is not working.
<div id="imageGallery">
<ui:repeat value="#{countryPages_Setup.images}" var="image" varStatus="status">
<tr>
<td>
<a href="javascript:void()" class="launchLink">
<p:graphicImage id="image#{status.index}" //problem
value="/resources/images/#{image}"
width="100"
height="100"
rendered="#{countryPages_Setup.renderImages}"/>
</a>
</td>
</tr>
</ui:repeat>
</div>
I also tried {staus.index + 1}. I also tried id= image#{1++} But it is also not working. How can i do it?
Thanks
You can use EL in the id attribute, but it has to be available during view build time. The <ui:repeat> however runs during view render time, it will reuse the same <p:graphicImage> to generate multiple HTML <img> elements. It doesn't run during view build time, so the id remains image.
If you replace <ui:repeat> by <c:forEach>, then it'll work as you intented. The <c:forEach> runs during view build time and it will generate multiple <p:graphicImage> components which will then each get rendered only once.
<div id="imageGallery">
<c:forEach items="#{countryPages_Setup.images}" var="image" varStatus="status">
<tr>
<td>
<a href="javascript:void()" class="launchLink">
<p:graphicImage id="image#{status.index}"
name="images/#{image}"
width="100"
height="100"
rendered="#{countryPages_Setup.renderImages}"/>
</a>
</td>
</tr>
</c:forEach>
</div>
You cannot use el expressions within the id attribute. It needs to be static. The ui:repeat itself generates a prefix to your id. You don't need to care about uniqueness.
So, for instance if you have an id="image", then the generated ids are
somePrefix:0:image, somePrefix:1:image, ...
But you can use variable in Javascript, for example:
<h:graphicImage ... onclick="top.location.href='http://blabla.com/imageclicked?id=#{status.index}'"/>
You can also use Variables with event handlers (since JSF 2.0):
<h:commandLink ... action="#{myBean.imageClicked(status.index)"/>
But your loop with c:forEach can cause problems. Be aware that the JSTL tags (everything that begins with c:) are not fully compatible to JSF. If you have luck, then they work as expected. But anyways the slow down the rendering engine, since the page gets processed multiple times by the JSF and JSP rendering engine.
Better use ui:repeat.
Just change <ui:repeat> to <c:forEach>

How to create a "sidebar" in Umbraco CMS?

In Umbraco, every page has a content field that you can edit in the admin-area. What I want would be a second content field that I (actually my customer who will be editing the content by himself) can edit on every page. I would then create a masterpage/template that contains the two content areas (the first one as the main content and the second one as the sidebar). At least this is how I would do it. Is this possible or is there even a better approach for having a main content and a separate sidebar on every page?
Answer found, it is super easy: Add a rich text editor property to the runway text page and have your markup like this:
<table style="font-size: 13px; line-height: 1.5em;">
<tr>
<td class="innerTD">
<div style="min-height:600px; width: 465px;">
<div id="contentHeader">
<h2><umbraco:Item runat="server" field="pageName"/></h2>
</div>
<form id="RunwayMasterForm" runat="server">
<umbraco:Item runat="server" field="bodyText" />
</form>
</div>
</td>
<td style="width: 250px; padding: 8px;">
<umbraco:Item runat="server" field="sidebarText" />
</td>
</tr>
</table>
notice <umbraco:Item runat="server" field="sidebarText" />
Generally, yes.
Add a new tab to the Document Type that you want to add a sidebar to (called Sidebar or something). Then add a new property or set of properties to that tab to manage the content.
Then in your templates simply add the sidebar to the markup (and edit the CSS to style the new markup) and add your new fields to the template.
In the case above it's this line: <umbraco:Item runat="server" field="sidebarText" />
You can also have a default sidebar setting on the home page or any parent item that contains the sidebar info by recursively getting that value. Thus, if the "sidebarText" field on the current page is empty, it would use its parent. That makes managing the content a little easier on a large site and you can change just what you need on the specific page with differences.
The recursive setting is just a check box in the dialog to add an item to a template.

Resources