Custom Module Help
I have a few questions on creating custom modules. The first question is what does Lstring Content do or reference? I understand it is a Localized string object, but outside of that I do not understand what it does or how one uses it.
I see where it is created, but then I do not see where it ever gets used in the fluent mapping classes and such.
[DataMember]
[ScaffoldInfo(@
"<sitefinity:HtmlField runat="
"server"
" DisplayMode="
"Read"
" Value='<%# Eval("
"Content"
")%>' />"
)]
public
Lstring Content
get
if
(
this
.content ==
null
)
this
.content =
this
.GetString(
"Content"
);
return
this
.ApplyContentFilters(
this
.content);
set
this
.content = value;
this
.SetString(
"Content"
,
this
.content);
Hi Stacey,
The purpose of LString is that you have different "versions" of one string, according to the Culture. This means that when you create multilingual content, you won't have to set/get different properties for each translated field of the item, but you would only have to set one property by passing a parameter of the desired culture.
About the second question - we have such functionality implemented and it is called BrowseAndEdit. It is by default enabled on all Sitefinity pages and when you create a role, you just need to grant the users BrowseAndEdit permissions and they would be able to edit the content inline, without logging in to Sitefinity's backend. We actually have a an out-of-the-box role for this, called Editors. Here you can read more about this functionality:
http://www.sitefinity.com/documentation/content-writers-guide/creating-and-editing-content-while-browsing.aspx
Svetoslav,
I know about the existing in-line editing permission, but my understanding was that it only worked for administrators and/or that you had to also be assigned to the role "BackendUser". I have tried setting in-line editing permissions for my custom role and have never been able to get it to show up when said user with role was logged in.
The bigger picture here is that I am using a standard edition for an intranet site. I have 3 administrators so have not yet hit the 5 concurrent user limit. I will have up to 8 additional department managers whom I wish to give the ability to edit content on a page they are given permission to via a front end UI only. I cannot have them counting towards the concurrent user limit as they need to stay logged in during the work day.
Should I be looking at creating a custom control based of the HtmlField and then use logic to determine if they are a valid role that can use BrowseAndEdit for that control itself? I have seen a blog post on how to enable BrowseAndEdit on the content block, but I would like to know if there is a similar example of creating a content block that can be used on a public page that does not require admin/backenduser roles to be assigned.
Edit: Additional questions on Lstring Content
1.) If I am not doing any localization do I need to have this?
2.) I am going to try making a module that is a content block that will store content for departments. I will initially use a content field and a department id to match content up to its respective area. Would I want to make a completely different property in the Model class or should I use the Lstring Content to store the value of whatever is entered into the html editor?
Should I use this?
[DataMember]
[MetadataMapping(
true
,
true
)]
[UserFriendlyDataType(UserFriendlyDataType.LongText)]
public
Lstring Content
get
if
(
this
.content ==
null
)
this
.content =
this
.GetString(
"Content"
);
return
this
.ApplyContentFilters(
this
.content);
set
this
.content = value;
this
.SetString(
"Content"
,
this
.content);
[DataMember]
public
string
Content
get
return
this
.content;
set
this
.content= value;
Hi Stacey,
Considering the LString property - no you do not need it if you're not going to use localized versions.
Considering the Content Block that you would like to create - I don't think that just inheriting from our control or using our Browse and Edit functionality (and somehow trying to hack it not to filter the backend users) would work. If you create a new module, you will have to implement your own Browse and Edit functionality for it, because just enabling ours wouldn't work either.
Thanks for the direction. Just for the record, it was not my intention to make a workaround/hack of the current controls. I am perhaps using the wrong terminology, but my plan all along has been to create a custom content based module that will keep track of html content for a specific department. My thought was that I will attempt to do this with the RadEditor, but I have seen posts where it has been stated that this control is wrapped in the HtmlField control and should be used that way.
Would it be correct to say that I can make a custom module using the RadEditor and create my own "browse edit", via the RadEditor enabled property, functionality with that?
Hello Stacey,
I suppose you could do that - create a Content-based module and for the Client widget, implement a control with rad editor that displays the content and lets the users edit it. To update/save the content, however, you will have to use WebServices and Ajax.
Greetings,