Ejemplo n.º 1
0
        /// <inheritDoc/>
        public virtual string GetLoginPageUrl()
        {
            var loginRedirectUrl = this.ExternalLoginUrl;

            if (string.IsNullOrEmpty(loginRedirectUrl))
            {
                var    claimsModule = SitefinityClaimsAuthenticationModule.Current;
                string pageUrl;


                if (this.AllowWindowsStsLogin)
                {
                    pageUrl = claimsModule.GetIssuer();
                }
                else if (this.LoginPageId.HasValue)
                {
                    pageUrl = HyperLinkHelpers.GetFullPageUrl(this.LoginPageId.Value);
                }
                else
                {
                    pageUrl = SitefinityContext.FrontendLoginUrl;
                }

                if (!pageUrl.IsNullOrEmpty())
                {
                    var currentUrl = HttpContext.Current.Request.RawUrl;
                    var returnUrl  = this.AppendUrlParameter(currentUrl, LoginStatusModel.HandleRejectedUser, "true");
                    loginRedirectUrl = "{0}?realm={1}&redirect_uri={2}&deflate=true".Arrange(
                        pageUrl, claimsModule.GetRealm(), HttpUtility.UrlEncode(returnUrl));
                }
            }

            return(loginRedirectUrl);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public virtual string GetLogoutPageUrl()
        {
            string logoutRedirectUrl = this.ExternalLogoutUrl;

            if (string.IsNullOrEmpty(logoutRedirectUrl))
            {
                if (this.LogoutPageId.HasValue)
                {
                    logoutRedirectUrl = HyperLinkHelpers.GetFullPageUrl(this.LogoutPageId.Value);
                }
                else
                {
                    logoutRedirectUrl = UrlPath.ResolveAbsoluteUrl(this.currentPageUrl, true);
                }
            }

            if (HttpContext.Current.Request.Url == null)
            {
                return(string.Empty);
            }

            string fullLogoutUrl = RouteHelper.ResolveUrl(ClaimsManager.GetLogoutUrl(logoutRedirectUrl), UrlResolveOptions.Rooted);

            // Workaround an issue when the application is hosted under an application path.
            if (SystemManager.CurrentHttpContext != null && SystemManager.CurrentHttpContext.Request.ApplicationPath != "/")
            {
                fullLogoutUrl = fullLogoutUrl.Replace("sts_signout=true&", "");
            }

            return(fullLogoutUrl);
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public virtual string GetProfilePageUrl()
        {
            var profileRedirectUrl = this.ExternalProfileUrl;

            if (string.IsNullOrEmpty(profileRedirectUrl) && this.ProfilePageId.HasValue)
            {
                profileRedirectUrl = HyperLinkHelpers.GetFullPageUrl(this.ProfilePageId.Value);
            }

            return(profileRedirectUrl);
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public virtual bool AddSubscriber(SubscribeFormViewModel viewModel, out string error)
        {
            error = string.Empty;

            if (NewsletterValidator.IsValidEmail(viewModel.Email))
            {
                var newslettersManager = NewslettersManager.GetManager(this.Provider);

                // check if subscriber exists
                var email = viewModel.Email.ToLower();
                IQueryable <Subscriber> matchingSubscribers = newslettersManager.GetSubscribers().Where(s => s.Email == email);
                bool subscriberAlreadyInList = false;
                foreach (Subscriber s in matchingSubscribers)
                {
                    if (s.Lists.Any(ml => ml.Id == this.SelectedMailingListId))
                    {
                        subscriberAlreadyInList = true;
                        break;
                    }
                }

                if (subscriberAlreadyInList)
                {
                    // If the email has already been subscribed, consider it as success.
                    return(true);
                }
                else
                {
                    Subscriber subscriber = matchingSubscribers.FirstOrDefault();
                    if (subscriber == null)
                    {
                        subscriber           = newslettersManager.CreateSubscriber(true);
                        subscriber.Email     = viewModel.Email;
                        subscriber.FirstName = viewModel.FirstName != null ? viewModel.FirstName : string.Empty;
                        subscriber.LastName  = viewModel.LastName != null ? viewModel.LastName : string.Empty;
                    }

                    // check if the mailing list exists
                    if (newslettersManager.Subscribe(subscriber, this.SelectedMailingListId))
                    {
                        if (this.SuccessfullySubmittedForm == SuccessfullySubmittedForm.OpenSpecificPage)
                        {
                            viewModel.RedirectPageUrl = HyperLinkHelpers.GetFullPageUrl(this.PageId);
                        }

                        newslettersManager.SaveChanges();

                        return(true);
                    }
                }
            }
            error = Res.Get <SubscribeFormResources>().EmailAddressErrorMessageResourceName;
            return(false);
        }
Ejemplo n.º 5
0
        /// <inheritdoc />
        public virtual string GetRegistrationPageUrl()
        {
            var registrationRedirectUrl = this.ExternalRegistrationUrl;

            if (string.IsNullOrEmpty(registrationRedirectUrl) && this.RegistrationPageId.HasValue)
            {
                registrationRedirectUrl = HyperLinkHelpers.GetFullPageUrl(this.RegistrationPageId.Value);
            }

            return(registrationRedirectUrl);
        }
Ejemplo n.º 6
0
 /// <inheritDoc/>
 public virtual string GetPageUrl(Guid?pageId)
 {
     if (pageId.HasValue)
     {
         return(HyperLinkHelpers.GetFullPageUrl(pageId.Value));
     }
     else
     {
         var currentNode = SiteMapBase.GetActualCurrentNode();
         return(currentNode != null?HyperLinkHelpers.GetFullPageUrl(currentNode.Id) : null);
     }
 }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public virtual string GetJobAlertPageUrl()
        {
            var jobAlertRedirectUrl = this.ExternalJobAlertUrl;

            if (string.IsNullOrEmpty(jobAlertRedirectUrl) && this.JobAlertPageId.HasValue)
            {
                if (string.IsNullOrEmpty(jobAlertRedirectUrl) && this.JobAlertPageId.HasValue)
                {
                    jobAlertRedirectUrl = HyperLinkHelpers.GetFullPageUrl(this.JobAlertPageId.Value);
                }
            }

            return(jobAlertRedirectUrl);
        }
Ejemplo n.º 8
0
        /// <inheritDoc/>
        public string GetPageUrl(Guid?pageId)
        {
            if (!pageId.HasValue)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode == null)
                {
                    return(null);
                }

                pageId = currentNode.Id;
            }

            return(HyperLinkHelpers.GetFullPageUrl(pageId.Value));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the confirmation page URL.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        protected virtual string GetConfirmationPageUrl(User user)
        {
            if (!this.ConfirmationPageId.HasValue)
            {
                return(string.Empty);
            }
            string confirmationPageUrl = HyperLinkHelpers.GetFullPageUrl(this.ConfirmationPageId.Value);

            if (string.IsNullOrWhiteSpace(confirmationPageUrl))
            {
                return(string.Empty);
            }

            return(UserRegistrationEmailGenerator.GetConfirmationPageUrl(confirmationPageUrl, user.Id, this.MembershipProviderName, ReturnUrlName, this.DefaultReturnUrl));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Gets the login redirect URL.
        /// </summary>
        /// <returns></returns>
        public virtual string GetLoginPageUrl()
        {
            string result;

            if (this.LoginPageId.HasValue)
            {
                result = HyperLinkHelpers.GetFullPageUrl(this.LoginPageId.Value);
            }
            else
            {
                result = SitefinityContext.FrontendLoginUrl;
            }

            return(result);
        }
        /// <inheritDoc/>
        public virtual bool Unsubscribe(UnsubscribeFormViewModel viewModel, out string error)
        {
            error = string.Empty;

            var newslettersManager = NewslettersManager.GetManager(this.ProviderName);

            string email = viewModel.Email.ToLower();
            IQueryable <Subscriber> subscribers = newslettersManager.GetSubscribers().Where(s => s.Email == email);

            if (subscribers.Count() == 0)
            {
                error = string.Format(Res.Get <UnsubscribeFormResources>().YouDontBelongToTheMailingList, email);
                return(false);
            }

            var hasUnsubscribedUser = false;

            foreach (Subscriber subscriber in subscribers)
            {
                if (subscriber != null)
                {
                    var isUnsubscribed = newslettersManager.Unsubscribe(subscriber, this.ListId);
                    hasUnsubscribedUser = hasUnsubscribedUser || isUnsubscribed;
                }
            }

            if (hasUnsubscribedUser)
            {
                newslettersManager.SaveChanges();

                if (this.SuccessfullySubmittedForm == SuccessfullySubmittedForm.OpenSpecificPage)
                {
                    viewModel.RedirectPageUrl = HyperLinkHelpers.GetFullPageUrl(this.PageId);
                }

                this.Message = string.Format(Res.Get <UnsubscribeFormResources>().UnsubscribedFromMailingListSuccessMessage, email);
                return(true);
            }
            else
            {
                error = string.Format(Res.Get <UnsubscribeFormResources>().YouDontBelongToTheMailingList, email);
                return(false);
            }
        }
Ejemplo n.º 12
0
        /// <inheritDoc/>
        public virtual string GetRedirectPageUrl()
        {
            if (!this.UseCustomConfirmation && !string.IsNullOrEmpty(this.FormData.RedirectPageUrl))
            {
                return(this.FormData.RedirectPageUrl);
            }
            else if (this.CustomConfirmationPageId == Guid.Empty)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode == null)
                {
                    return(null);
                }

                this.CustomConfirmationPageId = currentNode.Id;
            }

            return(HyperLinkHelpers.GetFullPageUrl(this.CustomConfirmationPageId));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets the login redirect URL.
        /// </summary>
        /// <returns></returns>
        public virtual string GetLoginPageUrl()
        {
            string result;

            if (SystemManager.IsPreviewMode || SystemManager.IsDesignMode)
            {
                result = "javascript:void(0);";
            }
            else
            {
                if (this.LoginPageId.HasValue)
                {
                    result = HyperLinkHelpers.GetFullPageUrl(this.LoginPageId.Value);
                }
                else
                {
                    result = SitefinityContext.FrontendLoginUrl;
                }
            }

            return(result);
        }
Ejemplo n.º 14
0
        /// <inheritDoc/>
        public virtual string GetLoginPageUrl()
        {
            var loginRedirectUrl = this.ExternalLoginUrl;

            if (string.IsNullOrEmpty(loginRedirectUrl))
            {
                string pageUrl;

                if (this.LoginPageId.HasValue)
                {
                    pageUrl = HyperLinkHelpers.GetFullPageUrl(this.LoginPageId.Value);
                }
                else
                {
                    pageUrl = SitefinityContext.FrontendLoginUrl;
                }

                loginRedirectUrl = pageUrl;
            }

            return(loginRedirectUrl);
        }
Ejemplo n.º 15
0
        /// <inheritdoc />
        public virtual string GetLogoutPageUrl()
        {
            string logoutRedirectUrl = this.ExternalLogoutUrl;

            if (string.IsNullOrEmpty(logoutRedirectUrl))
            {
                if (this.LogoutPageId.HasValue)
                {
                    logoutRedirectUrl = HyperLinkHelpers.GetFullPageUrl(this.LogoutPageId.Value);
                }
                else
                {
                    logoutRedirectUrl = HttpContext.Current.Request.UrlReferrer?.AbsoluteUri ?? UrlPath.ResolveAbsoluteUrl(this.currentPageUrl, true);
                }
            }

            if (HttpContext.Current.Request.Url == null)
            {
                return(string.Empty);
            }

            return(logoutRedirectUrl);
        }
        public override void Execute()
        {
            WriteLiteral("\n");


            #line 9 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Html.StyleSheet(Url.EmbeddedResource("Telerik.Sitefinity.Resources.Reference", "Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_common_min.css"), "head", false));


            #line default
            #line hidden
            WriteLiteral("\n");


            #line 10 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            if (Html.ShouldRenderInlineEditing() || SystemManager.IsDesignMode || SystemManager.IsPreviewMode)
            {
            #line default
            #line hidden

            #line 12 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.StyleSheet(Url.EmbeddedResource("Telerik.Sitefinity.Resources.Reference", "Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_bootstrap_min.css"), "bottom", false));


            #line default
            #line hidden

            #line 12 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"


                if (ViewBag.IsRtl)
                {
            #line default
            #line hidden

            #line 16 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                    Write(Html.StyleSheet(Url.EmbeddedResource("Telerik.Sitefinity.Resources.Reference", "Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_rtl_min.css"), "bottom", false));


            #line default
            #line hidden

            #line 16 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                }
            }
            else
            {
            #line default
            #line hidden

            #line 21 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.StyleSheet(Url.EmbeddedResource("Telerik.Sitefinity.Resources.Reference", "Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_bootstrap_min.css"), "head", false));


            #line default
            #line hidden

            #line 21 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"


                if (ViewBag.IsRtl)
                {
            #line default
            #line hidden

            #line 25 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                    Write(Html.StyleSheet(Url.EmbeddedResource("Telerik.Sitefinity.Resources.Reference", "Telerik.Sitefinity.Resources.Scripts.Kendo.styles.kendo_rtl_min.css"), "bottom", false));


            #line default
            #line hidden

            #line 25 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                }
            }


            #line default
            #line hidden
            WriteLiteral("<div");

            WriteLiteral(" data-sf-current-page-id=\'");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.CurrentPageId);


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-widget-id=\'");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.WidgetId);


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-role=\"scheduler-wrapper\"");

            WriteLiteral(" data-sf-rtl=\"");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.IsRtl);


            #line default
            #line hidden
            WriteLiteral("\"");

            WriteAttribute("class", Tuple.Create(" class=\'", 1579), Tuple.Create("\'", 1606)

            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                           , Tuple.Create(Tuple.Create("", 1587), Tuple.Create <System.Object, System.Int32>(Model.ListCssClass

            #line default
            #line hidden
                                                                                                             , 1587), false)
                           );

            WriteLiteral(" data-sf-controller-events=\'");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Url.Content("~/web-interface/events"));


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-controller-calendars=\'");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Url.Content("~/web-interface/calendars"));


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-siteid=\"");


            #line 28 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(SystemManager.CurrentContext.CurrentSite.Id);


            #line default
            #line hidden
            WriteLiteral("\"");

            WriteLiteral("\n    data-sf-defaultview=\'");


            #line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Model.EventSchedulerViewMode);


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-allowchangecalendarview=\'");


            #line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Json.Encode(Model.AllowChangeCalendarView));


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-allowcalendarfilter=\'");


            #line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Json.Encode(Model.AllowCalendarFilter));


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-weekstartday=\'");


            #line 29 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Model.WeekStartDay);


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-loaded=\'false\'");

            WriteLiteral(" \n\tdata-sf-mincalendarlength=\'2\'");

            WriteLiteral(" data-sf-calendarlist-class-active=\'active\'");

            WriteLiteral(" data-sf-uiculture=\'");


            #line 30 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.UiCulture);


            #line default
            #line hidden
            WriteLiteral("\'");

            WriteLiteral(" data-sf-timezoneoffset=\"");


            #line 30 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.TimeZoneOffset);


            #line default
            #line hidden
            WriteLiteral("\"");

            WriteLiteral(" data-sf-timezoneid=\"");


            #line 30 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(ViewBag.TimeZoneId);


            #line default
            #line hidden
            WriteLiteral("\"");

            WriteLiteral(" data-sf-localtimezoneoffset=\"\"");

            WriteLiteral(">\n    <div");

            WriteLiteral(" class=\"row\"");

            WriteLiteral(">\n        <div");

            WriteLiteral(" class=\"col-md-10\"");

            WriteLiteral(">\n            <div");

            WriteLiteral(" data-sf-role=\"scheduler\"");

            WriteLiteral("></div>\n        </div>\n");


            #line 35 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"


            #line default
            #line hidden

            #line 35 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            if (Model.AllowCalendarFilter)
            {
            #line default
            #line hidden
                WriteLiteral("        <div");

                WriteLiteral(" class=\"col-md-2\"");

                WriteLiteral(">\n            <div");

                WriteLiteral(" data-sf-role=\"calendarlist\"");

                WriteLiteral(" style=\"display: none;\"");

                WriteLiteral(">\n                <h4");

                WriteLiteral(" class=\"sf-calendarList-title\"");

                WriteLiteral(">");


            #line 38 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.Resource("Calendars"));


            #line default
            #line hidden
                WriteLiteral("</h4>\n            </div>\n        </div>\n");


            #line 41 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("    </div>\n    <script");

            WriteLiteral(" data-sf-role=\"event-alldayeventtemplate\"");

            WriteLiteral(" type=\"text/x-kendo-tmpl\"");

            WriteLiteral(">\n        <div class=\"sf-event-item\" data-sf-eventid=\"#= taskId #\" data-sf-date-s" +
                         "tart=#= JSON.stringify(start) # data-sf-date-end=#= JSON.stringify(end) # data-s" +
                         "f-allday=\"#= isAllDay #\">\n\t\t\t<a class=\"sf-event-link\" href=\"");


            #line 45 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Html.Raw(Html.Encode(HyperLinkHelpers.GetFullPageUrl(ViewBag.DetailsPageId)).Replace("#", "\\#")));


            #line default
            #line hidden
            WriteLiteral("#= eventUrl #\" title=\"#= title #\">#= title #</a>\n\t\t</div>\n    </script>\n    <scri" +
                         "pt");

            WriteLiteral(" data-sf-role=\"event-eventtemplate\"");

            WriteLiteral(" type=\"text/x-kendo-tmpl\"");

            WriteLiteral(">\n\t\t<div class=\"sf-event-item\" data-sf-eventid=\"#= taskId #\" data-sf-date-start=#" +
                         "= JSON.stringify(start) # data-sf-date-end=#= JSON.stringify(end) # data-sf-alld" +
                         "ay=\"#= isAllDay #\">\n\t\t\t<a class=\"sf-event-link\" href=\"");


            #line 50 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Html.Raw(Html.Encode(HyperLinkHelpers.GetFullPageUrl(ViewBag.DetailsPageId)).Replace("#", "\\#")));


            #line default
            #line hidden
            WriteLiteral("#= eventUrl #\" title=\"#= title #\">#= title #</a>\n\t\t</div>\n    </script>\n    <scri" +
                         "pt");

            WriteLiteral(" data-sf-role=\"event-calendarlist-template-wrapper\"");

            WriteLiteral(" type=\"text/x-kendo-tmpl\"");

            WriteLiteral(">\n        <div data-sf-role=\"calendarlist-wrapper\" class=\"list-unstyled nav nav-p" +
                         "ills nav-stacked\">\n            <div data-sf-role=\"calendarlist-item\" class=\"sf-c" +
                         "alendarList-item active\"><span class=\"sf-event-type sf-event-type--all\"></span>");


            #line 55 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            Write(Html.Resource("AllEvents"));


            #line default
            #line hidden
            WriteLiteral("</div>\n        </div>\n    </script>\n    <script");

            WriteLiteral(" data-sf-role=\"event-calendarlist-template-item\"");

            WriteLiteral(" type=\"text/x-kendo-tmpl\"");

            WriteLiteral(">\n        <div data-sf-role=\"calendarlist-item\" class=\"sf-calendarList-item\" data" +
                         "-sf-id=\"#= calendarId #\"><span class=\"sf-event-type\" style=\"background-color: #=" +
                         " color #;\"></span>#= title #</div>\n    </script>\t\n</div>\n");


            #line 62 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            if (SystemManager.IsDesignMode && !SystemManager.IsPreviewMode)
            {
                var scriptUrl     = Url.WidgetContent("Mvc/Scripts/EventScheduler/scheduler-events.js");
                var fullScriptUrl = scriptUrl + (scriptUrl.Contains("?") ? "&" : "?") + string.Format("_={0}", DateTime.UtcNow.Ticks.ToString());


            #line default
            #line hidden
                WriteLiteral("    <script");

                WriteLiteral(" type=\"text/javascript\"");

                WriteAttribute("src", Tuple.Create(" src=\'", 4654), Tuple.Create("\'", 4674)

            #line 66 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                               , Tuple.Create(Tuple.Create("", 4660), Tuple.Create <System.Object, System.Int32>(fullScriptUrl

            #line default
            #line hidden
                                                                                                                 , 4660), false)
                               );

                WriteLiteral("></script>\n");


            #line 67 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            }
            else
            {
            #line default
            #line hidden

            #line 70 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.Script(ScriptRef.JQuery, "top", false));


            #line default
            #line hidden

            #line 70 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"



            #line default
            #line hidden

            #line 71 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.Script(ScriptRef.KendoAll, "top", false));


            #line default
            #line hidden

            #line 71 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"



            #line default
            #line hidden

            #line 72 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.Script(ScriptRef.KendoTimezones, "top", false));


            #line default
            #line hidden

            #line 72 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"



            #line default
            #line hidden

            #line 73 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
                Write(Html.Script(Url.WidgetContent("Mvc/Scripts/EventScheduler/scheduler-events.js"), "bottom", false));


            #line default
            #line hidden

            #line 73 "..\..\ResourcePackages\Bootstrap\MVC\Views\EventScheduler\List.Calendar.cshtml"
            }

            #line default
            #line hidden
        }
Ejemplo n.º 17
0
        /// <inheritdoc />
        public virtual bool AddSubscriber(SubscribeFormViewModel viewModelOld, out string error)
        {
            var agreed    = SystemManager.CurrentHttpContext.Request.Params["TermsAgreement"].Split(',').Count() > 1;
            var viewModel = new SubscribeFormViewModelCustom()
            {
                FirstName       = viewModelOld.FirstName,
                LastName        = viewModelOld.LastName,
                Email           = viewModelOld.Email,
                CssClass        = viewModelOld.CssClass,
                RedirectPageUrl = viewModelOld.RedirectPageUrl,

                // custom - getting the property values from the request
                TermsAgreement = agreed
            };

            error = string.Empty;
            if (viewModel.TermsAgreement)
            {
                if (NewsletterValidator.IsValidEmail(viewModel.Email))
                {
                    var newslettersManager = NewslettersManager.GetManager(this.Provider);

                    // check if subscriber exists
                    var email = viewModel.Email.ToLower();

                    IQueryable <Subscriber> matchingSubscribers = newslettersManager.GetSubscribers().Where(s => s.Email == email);
                    bool subscriberAlreadyInList = false;
                    foreach (Subscriber s in matchingSubscribers)
                    {
                        if (s.Lists.Any(ml => ml.Id == this.SelectedMailingListId))
                        {
                            subscriberAlreadyInList = true;
                            break;
                        }
                    }

                    if (subscriberAlreadyInList)
                    {
                        Subscriber subscriber = matchingSubscribers.FirstOrDefault();
                        if (subscriber != null)
                        {
                            //update their name
                            subscriber.FirstName = viewModel.FirstName;
                            subscriber.LastName  = viewModel.LastName;

                            //update their terms acceptance
                            subscriber.SetValue("TermsAccepted", viewModel.TermsAgreement);
                            newslettersManager.SaveChanges();
                        }
                        // If the email has already been subscribed, consider it as success.
                        return(true);
                    }
                    else
                    {
                        Subscriber subscriber = matchingSubscribers.FirstOrDefault();
                        if (subscriber == null)
                        {
                            subscriber           = newslettersManager.CreateSubscriber(true);
                            subscriber.Email     = viewModel.Email;
                            subscriber.FirstName = viewModel.FirstName ?? string.Empty;
                            subscriber.LastName  = viewModel.LastName ?? string.Empty;

                            // custom - setting the property values
                            subscriber.SetValue("TermsAccepted", viewModel.TermsAgreement);
                        }
                        else
                        {
                            subscriber.FirstName = viewModel.FirstName ?? string.Empty;
                            subscriber.LastName  = viewModel.LastName ?? string.Empty;
                            //update acceptance of terms
                            subscriber.SetValue("TermsAccepted", viewModel.TermsAgreement);
                        }

                        // check if the mailing list exists
                        if (newslettersManager.Subscribe(subscriber, this.SelectedMailingListId))
                        {
                            if (this.SuccessfullySubmittedForm == SuccessfullySubmittedForm.OpenSpecificPage)
                            {
                                viewModel.RedirectPageUrl = HyperLinkHelpers.GetFullPageUrl(this.PageId);
                            }

                            newslettersManager.SaveChanges();

                            return(true);
                        }
                    }
                }
                error = Res.Get <SubscribeFormResources>().EmailAddressErrorMessageResourceName;
            }
            error = "You must agree to the terms";
            return(false);
        }