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.
Related
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.
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
I am trying to act on links found in a specific row in an HTML table.
The table has a column for a date and a column for city names which act as links. I need to find row with specific date and then cycle through the links found from the next cell on same row one after the another.
I reach the target page with Mechanize from the previous page (link to page is generated at previous page so direct link is not possible) and I am able to select the said table with this:
agent.page.search("//table[#class='calendar']")
But, after that, I am at a loss how to select the correct row based on the date in Date-column and click each of the links in turn (and naturally do stuff before moving on to the next city).
EDIT
I managed to make some progress. I am now able to get contents of correct cell in correct row IF I hardcode the date in. But I can't figure out how to use variable in place of hardcoded date and I also need to find a way to use just the date and not to include weekday as text in there as well.
agent.page.search("//table[#class='calendar']/tbody/tr/td[#class='date']
[text()='wed 27.8.2014']/following-sibling::td[1]/ul/li")
Example HTML below:
<table class="calendar">
<tr>
<th>Date</th>
<th>City</th>
</tr>
<tr class="odd">
<td class="date">thu 28.8.2014</td>
<td class="city">
<ul>
<li>London</li>
<li>Paris</li>
<li>Berlin</li>
</ul>
</td>
</tr>
<tr class="even">
<td class="date">wed 27.8.2014</td>
<td class="city">
<ul>
<li>London</li>
<li>Paris</li>
<li>Berlin</li>
</ul>
</td>
</table>
All help is greatly appreciated!
With further research I was able to find the answer my self. Of great help was this question and answer Nokogiri: How to select nodes by matching text? about partial matching in Nokogiri.
Following snippet is what works for me now and I am able to proceed.
date = Date.new(2014,8,27)
agent.page.search("//table[#class='calendar']/tbody/tr/td[#class='date']
[contains(text(),
\"#{date.strftime("%e.%-m.%Y")}\")]/following-sibling::td[1]/ul/li")
I am trying to create a table to display some data using iterator over my list from action class. Each row has the properties of each object in the list.
<table class="TableA" cellpadding="5px" border="1">
<tr class="even">
<th></th>
<th>Col1</th>
<th>Col2</th>
</tr>
<s:iterator value="objectList" status="obj">
<tr
class="<s:if test="#obj.odd == true ">odd</s:if><s:else>even</s:else>">
<td></td>
<td><s:property value="objId" /></td>
<td><s:property value="objValue" /></td>
</tr>
</s:iterator>
I need a radio button in first cell of every row so that a row can be selected for edition or deletion.
I know this can be done using <input type="radio" ...>. But I need to use struts2's radio tag. But problem using this tag is that it generates a row for every radio tag (see here).
Is it possible ? If yes then how ?
I think the following syntax will be better for you as you want to select each row with radio button
<s:radio theme="simple" name="object_radio" list="#{objId:objId}"/>
This way you wont need the objId column too
This syntax will submit objId as the value of selected radio button.You can modify the syntax to change the display property of the radio button or make it blank
anu, your answer helped me a lot.
Also this link was of great help for me:
http://struts.apache.org/2.0.14/docs/how-do-i-render-a-single-radio-button.html
What I needed was a table where two of the columns were radio buttons, but each column was an independent group. Furthermore I did not want to show the key as the label/value for each radio button, since that information was displayed in the other columns. My rows were built iterating over a hashmap, where the key of the hashmap was the radio button value.
<s:iterator value="myHashMap">
<tr>
<td><s:radio name="selectedRadioValueFirstColumn" list="#{key:''}"/></td>
<td><s:radio name="selectedRadioValueSecondColumn" list="#{key:''}"/></td>
<%--....... (my other columns) .... --%>
<tr>
So I am setting the option value as the key of the hashmap, and the selected value will be stored in the string property "selectedRadioValueFirstColumn" and "selectedRadioValueSecondColumn".
Kaillash:
if i understand your requirements completely all you mean to say that when page getting displayed with struts2 radio button struts2 is automatically creating a row for each radio button.
if this is the case than that is default struts2 functionality,struts2 operates on template theme and the default theme (xhtml) will automatically generate some HTML markup for each struts2 tag.
if you want struts2 tags not to generate any extra markup use the theme as simple.it can be done per tag basis something like this
<s:radio key="personBean.gender" list="genders" theme="simple" />
or you can also set theme on the page basis..
create struts2.properties file in the root and put the following entry
struts.ui.theme=simple
i hope this will help you
We have two separate front end projects for the same company which are basically the same except for all the html and css. (Different divisions within the same company) I'm trying to add a page that was built in one over to the other. (Yes, yes, I know we probably should've built a single app that display different presentations based on which division's instance was running so that we wouldn't have to maintain two separate but the same codebases, but we just can't go there with this client.)
Anyway, I copied over the controller, the model, and the aspx and ascx pages. All I needed to change was the name on the root namespace. For some reason, a particular ascx page that compiles successfully in the first project, fails in the second project.
Here's the error message:
e:\pathtocode\Web\Views\EmailToFriend\Email.ascx(24): error CS1061:
'System.Web.Mvc.HtmlHelper<MainWeb.Models.EmailToFriend>' does not contain a definition for
'TextBox' and no extension method 'TextBox' accepting a first argument of type
'System.Web.Mvc.HtmlHelper<MainWeb.Models.EmailToFriend>'
could be found (are you missing a using directive or an assembly reference?)
Here's the code for the ascx:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="Form.ascx.cs"
Inherits="MainWeb.Views.EmailToFriend.Form" %>
<%# Import Namespace="System.Web.Mvc" %>
<table>
<span class="error" style="color: red;">
<%= Model.ErrorString %>
</span>
<tr>
<td>Friend's Name: </td>
<td><%= Html.TextBox("RecipientName", Model.RecipientName)%></td>
</tr>
<tr>
<td>Friend's Email Address: </td>
<td><%= Html.TextBox("RecipientAddress", Model.RecipientEmail)%></td>
</tr>
<tr>
<td>Your Name: </td>
<td><%= Html.TextBox("SenderName", Model.SenderName ?? UserName)%></td>
</tr>
<tr>
<td>Your Email Address: </td>
<td><%= Html.TextBox("SenderAddress", Model.SenderEmail ?? UserEmail)%></td>
</tr>
<tr>
<td>Message</td>
<td><%= Html.TextArea("Message", Model.Message) %></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Send" style="float: right;"/></td>
</tr>
</table>
I've been futzing around with everything I could think of. Html.TextBox works fine in other files in the same project, so I can't figure out why this is blowing chunks.
UPDATE
I've just discovered that in the project where this code works, VS recognizes the project as an MVC web application, but in the second one where it doesn't work, VS does not recognize that it's MVC. At least if I right click on a Views subfolder the former has a context menu item for 'New View', where the latter project doesn't have this.
Now all I have to do is figure out how to turn it into an MVC project, and maybe that will fix it.
UPDATE #2
Drat, that didn't work. I modified the Import directive to use System.Web.Mvc.Html, and now at least intellisense shows the definition for the .TextBox extension - will try restarting the box to see what happens. :(
final update
As I posted in the comments, I found the error and it had to do with a completely different file, so it was basically my mistake and not a code problem. :(
Are you sure Form (as in Inherits="MainWeb.Views.EmailToFriend.Form") inherits from MVC's ViewPage base class?
My guess is you either want to have
Inherits="System.Web.Mvc.ViewPage"
or
namespace MainWeb.Views.EmailToFriend
{
public class Form : System.Web.Mvc.ViewPage
{
}
}
Most likely you also don't need CodeBehind="Form.ascx.cs". Did you add a regular web form instead of MVC view to your project?
Have you made sure that the compiler is set to 3.5 in the codedom section of the web.config? I battled for hours trying to figure out why I could not use html helpers, most posts are advising to add the System.Web.Mvc.Html namespace which is neccessary for the intellisense, yet since the pages aren't compiled until they are rendered you don't realise that this is false security. Here is a post to fix the compiler version issue: Problem creating my own extension to HtmlHelper