Unique Event/Meeting Calendar Scheduler for registered users

Posted by Community Admin on 04-Aug-2018 18:47

Unique Event/Meeting Calendar Scheduler for registered users

All Replies

Posted by Community Admin on 06-Jul-2012 00:00

I would like to add functionality to my web site that will allow users to manage their meetings/events similar to Outlook's calendar.  How do I set up Sitefinity so that users can add events/meetings but those entries will not display for other users?  I have looked at RadScheduler but haven't figured out exactly how to connect that to a Sitefinity user account.

Thanks,
Matt 

Posted by Community Admin on 11-Jul-2012 00:00

Would someone mind posting a similar custom user control that is used on this page to display the training calendar?

http://www.sitefinity.com/resources/training/calendar.aspx

Posted by Community Admin on 11-Jul-2012 00:00

Hello,

You could bind a RadScheduler control to our Events module and have this functionality, please check out the discussion on the URL bellow:
http://www.sitefinity.com/devnet/forums/sitefinity/general-discussions/events-calender-help.aspx

Greetings,
Stefani Tacheva
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

Posted by Community Admin on 11-Jul-2012 00:00

Thanks.  I was able to get the calendar to show with a tool tip but I'm not sure how to filter the Events/Appointment calendar based on the logged-in user id.  How does one filter events by user id?  I only want to show appointments/events based on what a user has entered and restrict users from seeing other appointment/events unless logged in as the Administrator.

Here are my files.  I assume that I need to modify the where clause and include a reference to using Telerik.Sitefinity.Security.Model;

Radscheduler.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity;
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Modules.Events;
using Telerik.Sitefinity.Events.Model;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
  
 
namespace SitefinityWebApp.Modules.Calendar
    public partial class RadScheduler : System.Web.UI.UserControl
    
 
        protected void Page_Load(object sender, EventArgs e)
        
            Scheduler1.DataSource = GetSourceItems();
        
 
        protected virtual IList<Event> GetSourceItems()
        
            var list = new List<Event>();
            list = App.WorkWith().Events().Where(c => c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Get().ToList();
            return list;
        
 
        public string SinglePage
        
            get;
            set;
        
 
        
 
    
 
RadScheduler.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RadScheduler.ascx.cs" Inherits="SitefinityWebApp.Modules.Calendar.RadScheduler" %>
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
        <script type="text/javascript">
            function OnClientAppointmentClick(sender, args)
                var apt = args.get_appointment();
                showTooltip(apt);
            
            function showTooltip(apt)
                var tooltip = $find('<%=RadToolTip1.ClientID %>');
                tooltip.set_targetControl(apt.get_element());
                $get("startTime").innerHTML = apt.get_start().format("MM/dd/yyyy HH:mm");
                $get("endTime").innerHTML = apt.get_end().format("MM/dd/yyyy HH:mm");
                $get("descriptionDiv").innerHTML = apt.get_subject();
                tooltip.set_text($get("contentContainer").innerHTML);
                setTimeout(function ()
                    tooltip.show();
                , 20);
            
 
            function hideTooltip()
                setTimeout(function ()
                    var activeTooltip = Telerik.Web.UI.RadToolTip.getCurrent();
                    if (activeTooltip)
                     activeTooltip.hide();
                , 50);
            
        </script>
  
</telerik:RadCodeBlock>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<telerik:RadScheduler runat="server" ID="Scheduler1"
            AllowDelete="false"
            AllowEdit="false"
            AllowInsert="false"
            DataKeyField = "Id"
            DataSubjectField = "Title"
            DataStartField = "EventStart"
            DataEndField = "EventEnd"
            SelectedView="MonthView"
            Skin="Office2007"
            OnClientAppointmentDoubleClick="hideTooltip"
            OnClientAppointmentContextMenu="hideTooltip"
            OnClientAppointmentClick="OnClientAppointmentClick"
            OnClientRecurrenceActionDialogShowing="hideTooltip"
            _OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
        Height="500px" Width="700px">
<AppointmentTemplate>
       <asp:Label ID="lblSub" runat="Server" Text='<%#Eval("Subject")%>'></asp:Label>
</AppointmentTemplate>
</telerik:RadScheduler>
<telerik:RadToolTip ID="RadToolTip1" runat="server" RelativeTo="Element" Position="BottomCenter"
           AutoCloseDelay="0" ShowEvent="FromCode" Width="250px"
        ManualClose="True" Skin="Office2007" >
            <div id="contentContainer">
                Starts on: <span id="startTime"></span>
                <br />
                Ends on: <span id="endTime"></span>
                <hr />
                Description:
                <div id="descriptionDiv">
                </div>
            </div>
 </telerik:RadToolTip>
 </telerik:RadAjaxPanel>

Posted by Community Admin on 11-Jul-2012 00:00

I just wanted to say what you are doing here sounds really cool! 

P.S. I also posted so I would be notified of updates.

Posted by Community Admin on 16-Jul-2012 00:00

Hi,

You can get the ID of the current user and after that get all the items, which have the same owner's ID as the user's ID. Please review the source code bellow:

protected virtual IList<Event> GetSourceItems()
        
            SecurityManager manager = SecurityManager.GetManager();
            var user = SecurityManager.GetCurrentUserId();
            var list = new List<Event>();
            list = App.WorkWith().Events().Where(c => c.Owner == user & c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Get().ToList();
            return list;
        


Kind regards,
Stefani Tacheva
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

Posted by Community Admin on 16-Jul-2012 00:00

Thank you.  That did the trick.  I appreciate your response, it saved me a bunch of time. 

This thread is closed