1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Module Help

Custom Module Help

6 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    21 Oct 2011
    Link to this post
    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);
        }
    }


    The second question is how would I go about creating a custom module for using a content block in which a non-backend user could create content.  I would like to have a page outside of the Sitefinity admin that is secured by a role.  An administrator would drop this custom widget (content block) onto a page.  When the frontend user logs in they can see the content block and add their text.

    I want to avoid forcing them into the Sitefinity backend both due to concurrent user limitations and because they truly do not need to mess with layout at all.

    I was going through the modules to see if there was something similar that I could do and that is why I am asking about the Lstring Content piece.
  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    25 Oct 2011
    Link to this post
    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

    Best wishes,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    25 Oct 2011
    Link to this post
    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);
                }
            }


    Or should I create a new property similar to this?
    [DataMember]
    public string Content
    {
        get { return this.content; }
        set { this.content= value; }
    }
  4. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    28 Oct 2011
    Link to this post
    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. 

    Best wishes,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    28 Oct 2011
    Link to this post
    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?
  6. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    31 Oct 2011
    Link to this post
    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,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered