/// <summary>
        /// Handles a click on the OK button. Save the new publishing schedules
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The arguments.</param>
        protected override void OnOK(object sender, EventArgs args)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(args, "args");

            using (new LanguageSwitcher(LanguageManager.DefaultLanguage))
            {
                foreach (string key in Context.ClientPage.ClientRequest.Form.Keys)
                {
                    if (key != null && key.StartsWith("dt_", StringComparison.InvariantCulture))
                    {
                        string id = StringUtil.Mid(key, 3, 38);

                        DateTimePicker dtEditPicker = AllSchedules.FindControl("dt_" + id) as DateTimePicker;

                        Assert.IsNotNull(dtEditPicker, "dtEditPicker");

                        DateTime        dateTime        = DateUtil.IsoDateToDateTime(dtEditPicker.Value);
                        PublishSchedule publishSchedule = new PublishSchedule(_database.GetItem(new ID(id)));

                        //Scheudled time has changed
                        if (publishSchedule.PublishDate != dateTime)
                        {
                            publishSchedule.PublishDate = dateTime;

                            ValidationResult validationResult = ScheduledPublishValidator.Validate(publishSchedule);
                            if (!validationResult.IsValid)
                            {
                                SheerResponse.Alert(string.Join(Environment.NewLine, validationResult.ValidationErrors));
                                return;
                            }

                            _scheduledPublishRepo.UpdatePublishSchedule(publishSchedule);
                        }
                    }
                    else if (key != null && key.StartsWith("del_", StringComparison.InvariantCulture))
                    {
                        string   id             = StringUtil.Mid(key, 4, 38);
                        Checkbox deleteCheckbox = AllSchedules.FindControl("del_" + id) as Checkbox;

                        Assert.IsNotNull(deleteCheckbox, "deleteCheckbox");

                        bool doDelete = deleteCheckbox.Checked;
                        if (doDelete)
                        {
                            Item publishOption = _database.GetItem(new ID(id));
                            _scheduledPublishRepo.DeleteItem(publishOption);
                        }
                    }
                }
            }

            base.OnOK(sender, args);
        }
        protected void OnOptionNameChange(Message message)
        {
            string optionId = message.Arguments["id"];

            Edit lastFilledEdit = Parameters.FindControl(LastFilledId) as Edit;

            if (lastFilledEdit != null)
            {
                if (optionId == LastFilledId && !string.IsNullOrEmpty(lastFilledEdit.Value))
                {
                    LastFilledId = LastId;
                    LastId       = AddPollOptionEditControl();
                }
            }
            Edit optionName = GetEditControlByID(optionId);

            if (!Results.Contains(optionId))
            {
                Results.Add(optionId, optionName.Value);
            }
            else
            {
                Results[optionId] = optionName.Value;
            }
            SheerResponse.SetReturnValue(true);
        }
示例#3
0
        protected void UserPickerClick()
        {
            var requestParams = Sitecore.Context.ClientPage.Request.Params["__PARAMETERS"];

            if (requestParams.StartsWith("UserPickerClick("))
            {
                var controlId = requestParams.Substring(16, requestParams.IndexOf(')') - 16);
                var picker    = ValuePanel.FindControl(controlId) as UserPicker;
                if (picker != null)
                {
                    Sitecore.Context.ClientPage.Start(picker, "Clicked");
                }
            }
        }