MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

How to display name instead of username when publishing, posting in forum etc.  (Mono Support )

Viewed 16218 time(s), 23 post(s) 2/13/2014 11:47:41 AMby sonap
mzilic

mzilic

2/13/2014 1:41:28 PM
Hello,

There are no plans to my knowledge. However, the following can easily be implemented in any solution using the approach I described. There are various scenarios how one might want to use or extend MonoX and thus supporting all scenarios is usually not possible.

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
Zoomicon

Zoomicon

2/13/2014 2:03:11 PM

I really don't get it how some of the repeater templates can have that info available to the template designer and why some don't. I find this at least inconsistent.

Displaying user name-surname instead of a username is essential when one builds for example an educational community like the one in http://social.clipflair.net. Teachers can't remember who is who by the username of each member in the groups they moderate.

Having to write code to do such a basic task means a steeper learning curve for MonoX, plus that one has to touch more parts of it. Currently we have managed to not use custom code at all and would prefer to keep it that way.

As I said, the inconsistency is that the info is available only to some templates and to others it's not available, for no apparent reason to explain this difference

This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

2/13/2014 2:07:32 PM
Hello,

You can make a feature request for this using the RoadMap forum: http://www.mono-software.com/Mono/Pages/Discussion/dboard/oPCcyo0aUUue0qC-ANa6fg/MonoX-Roadmap/

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
Zoomicon

Zoomicon

2/13/2014 2:43:52 PM
is there any alternative syntax to put inline in a page (like Razor) to lookup the <# Author #> and get the user object for it, then get the user surname/name from there?
This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

2/13/2014 3:15:04 PM
This is a template which is being loaded and markup is being replaced with values or controls which have been setup in the ParseTemplateTags. So in this scenario something like this is not possible without making code changes, for more advanced scenarios you can explore the VelocityContext. You can use the VelocityContext to put an object and use it similarly to what you want. For that I think you will as well have to extend the MonoX logic on certain controls.

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
khorvat

khorvat

2/13/2014 3:15:37 PM
Just to mention that every MonoX module in his template has support for NVelocity syntax and there is a "Container" object available in every template that you can use to access all the data available in particular object. So for an example inside discussion board templates you can use something like this:

<p>$Container.ItemIndex</p>
<p>$Container.DataItem.Message</p>
<p>$Container.DataItem.AspnetUser.UserDisplayName</p>
DataItem is bound 1-1 with the business model entities, the only thing that you need to be sure is that you have prefetched that data.

Important thing here is that Container object will allow you not to implement dozens of tags but rather use this object to output data you need.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
Zoomicon

Zoomicon

2/14/2014 8:40:30 AM

thanks, this looks promising

would be handy if I could do something like

$Container.Dump

to get a string (with <br /> for newline I guess) that dumps the Container properties and for object held at Container's properties dumpt their own properties indended etc. in the same fashion (up to some depth like 8-10 using recursion and some count-down parameter to the recursed internal method to avoid infinite looping)

unless one can somehow break into NVelocity expressions with a debugger and check the Container object (to see what it contains)

do you know if NVelocity has any such Dump facility or if your Container object has something like that to list its "API"?

This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

2/14/2014 2:38:44 PM
I don't think NVelocity supports such a feature.

Also, please note that if you're missing a prefetch for some of the items in the templates you will have to resort to the earlier described approach by either manually adding new tags or using VelocityContext.

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
panos-pag

panos.pag

2/28/2014 9:34:48 AM
Dear Khorvat,

We tried using $Container.DataItem.AspnetUser.UserDisplayName in a forum module but, although it works fine, it produces the user's username and not his /her name - surname. 

Any idea?

Thanks a lot,
Panos
This content has not been rated yet. 
390 Reputation 35 Total posts
1 2 3