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

Forums / Developing with Sitefinity / Users and Custom Module relations

Users and Custom Module relations

5 posts, 0 answered
  1. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    09 Jan 2013
    Link to this post
    Hello,

    I need to develop relations between users and custom modules. It could be one-to-one or one-to-many relations. Special user can manage this relations and can query custom modules by user.

    What are the best practices of doing this?

    Thanks,
    Denis.
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    14 Jan 2013
    Link to this post
    Hello Denis,

    For one to one or one to many (users) relationship you need a field in the module that will be user selector field and will select the ID of the user thus using the module API you can query the module to get the user field and read the GUID value and determine which user is selected. I am attaching a sample user selector field. It is following the approach from this blog post

    If you are using many selector control in the module you may encounter a problem caused by opening several field controls with RadWindowManager.

    When multiple selectors are in the form RadWindowManager behaves unexpectedly. The solution applied to the Sitefinity modules when this is happening remove RadWindowManager and use just RadWindow.
    <telerik:RadWindow ID="userSelector" Width="600" Height="400" NavigateUrl="~/Sitefinity/Dialog/SelectUsersAndRolesDialog" runat="server"
                             Modal="true" VisibleStatusbar="false" Behaviors="Close" Skin="Sitefinity">
                            </telerik:RadWindow>
      
    <---------- Instead of ------------------>
     <telerik:RadWindowManager ID="windowManager" runat="server" Skin="Sitefinity">
                        <Windows>
                            <telerik:RadWindow ID="userSelector" Width="560" Height="600" NavigateUrl="~/Sitefinity/Dialog/SelectUsersAndRolesDialog" runat="server"
                             Modal="true" VisibleStatusbar="false" Behaviors="Close">
                            </telerik:RadWindow>
                        </Windows>
                    </telerik:RadWindowManager>
    change the reference to RadWindowManager to be of type RadWindow to save renaming
    protected virtual RadWindow RadWindowManager
           {
               get
               {
                   return this.Container.GetControl<RadWindow>("simplePageSelector", true);
               }
           }

    Greetings,
    Stanislav Velikov
    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. Ivan
    Ivan avatar
    12 posts
    Registered:
    16 Sep 2012
    23 Apr 2013 in reply to Stanislav Velikov
    Link to this post
    Hi Stanislav,

    this control would have been very useful to me, but somehow when following your advice i can't get it to work. The compile Js file also needs to be modified to replace WindowManager with RadWindow but whatever code I try I get no where. Do you have this exemple that works with a RadWindow. I have multiple selectors in my dynamic content module and can't use the RadWindowManager.

    Thanks in advance,

    Ivan
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    08 Dec 2016
    26 Apr 2013
    Link to this post
    Hi,

    Here is the updated selector.

    Greetings,
    Stanislav Velikov
    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. Ivan
    Ivan avatar
    12 posts
    Registered:
    16 Sep 2012
    26 Apr 2013 in reply to Stanislav Velikov
    Link to this post
    Hi Stanislav,

    you example doesn't work, because all you've done in it is hide the Window manager, but both the class UserSelectorField and the javascript "UserSelectorField.js" continue referring to the window manager and trigger naturally a bunch of errors since there is no longer a window manager (removing the window manager is the easy part, I was able to do that much), but where I have problems is with 3 other related issues:

    1) Fixing properly the Class UserSelectorField to support the window instead of the window manager
    2) Fixing the javascript file accordingly.
    3) Making sure I can have multiple users and multipe roles selected and correctly persisted with my dynamic module object.

    You field is defined as a text field (it isn't a big problem - although it would have been great if it was a Guid array, collecting users and roles). Doesn't it require an interface inheritting from IFieldControlDefinition to work with Dynamic Modules?

    Thank you in advance for all the help you can provide here.

    Ivan
5 posts, 0 answered