Exemple #1
0
 /// <summary>
 /// Saves the updated content and publishes the current page.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void ButtonSave_Click(object sender, EventArgs e)
 {
     CurrentPage = CurrentPage.CreateWritableClone();
     CurrentPage[PropertyName] = TextEditor.Text.ToSafeString();
     DataFactory.Instance.Save(CurrentPage, SaveAction.Publish);
     Response.Redirect(CurrentPage.LinkURL);
 }
Exemple #2
0
        /// <summary>
        /// Toggels the value of the property IsLocked on the thread page.
        /// </summary>
        protected void Lock_Click(object sender, EventArgs e)
        {
            PageData page = CurrentPage.CreateWritableClone();

            page["IsLocked"] = page["IsLocked"] != null ? false : true;
            DataFactory.Instance.Save(page, SaveAction.Publish);
            Response.Redirect(CurrentPage.LinkURL, true);
        }
Exemple #3
0
        /// <summary>
        /// Handles the Click event of the SaveNewsSectionName button.
        /// Saves new name for the current news section
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveNewsSectionNameButton_Click(object sender, EventArgs e)
        {
            PageData page = CurrentPage.CreateWritableClone();

            page["PageName"] = NewsSectionNameTextBox.Text.ToSafeString();
            DataFactory.Instance.Save(page, SaveAction.Publish);
            Response.Redirect(page.LinkURL);
        }
Exemple #4
0
        /// <summary>
        /// Handles the ButtonSaveClicked event of the EditCalendarBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
        void EditCalendarBox_ButtonSaveClicked(object sender, CommandEventArgs e)
        {
            PageData page     = CurrentPage.CreateWritableClone();
            string   pageName = EditCalendarBox.Text.ToSafeString();

            page["PageName"] = pageName.Length > 255 ? pageName.Remove(254) : pageName;
            DataFactory.Instance.Save(page, SaveAction.Publish);
            Response.Redirect(page.LinkURL);
        }
Exemple #5
0
        private void ConvertEmailTemplateToLocal(string sharedBlock, string localBlock)
        {
            EventPageBase      currentEventPageBase = CurrentPage.CreateWritableClone() as EventPageBase;
            EmailTemplateBlock sharedBlockData      = Get <EmailTemplateBlock>((CurrentPage as EventPageBase)[sharedBlock] as ContentReference) as EmailTemplateBlock;
            EmailTemplateBlock localBlockData       = currentEventPageBase[localBlock] as EmailTemplateBlock;

            localBlockData.BCC                = sharedBlockData.BCC;
            localBlockData.CC                 = sharedBlockData.CC;
            localBlockData.From               = sharedBlockData.From;
            localBlockData.MainBody           = sharedBlockData.MainBody;
            localBlockData.MainTextBody       = sharedBlockData.MainTextBody;
            localBlockData.Subject            = sharedBlockData.Subject;
            localBlockData.To                 = sharedBlockData.To;
            currentEventPageBase[sharedBlock] = null;
            Locate.ContentRepository().Save(currentEventPageBase, AttendScheduledEmailEngine.GetForcedSaveActionFor(currentEventPageBase));
            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((CurrentData as IContent).ContentLink) + "'", true);
        }
Exemple #6
0
        /// <summary>
        /// Updates the CurrentPage with the values entered by the user and saves the page to the database.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Save_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            try
            {
                PageData curPage = CurrentPage.CreateWritableClone();

                DateTime startDate = StartDatePicker.Value;
                DateTime stopDate  = StopDatePicker.Value;


                if (startDate > stopDate)
                {
                    Page.Validators.Add(new StaticValidator(Translate("/workroom/calendar/latestarttime")));
                    return;
                }

                curPage.PageName    = EditPageName.Text.ToSafeString();
                curPage["MainBody"] = EditMainBody.Text.ToSafeString();
                if (curPage.LanguageBranch != curPage.MasterLanguageBranch)
                {
                    PageReference curPageRef = DataFactory.Instance.Save(curPage, SaveAction.Publish);

                    curPage = DataFactory.Instance.GetLanguageBranches(curPageRef)
                              .Cast <PageData>().First(page => page.LanguageID == page.MasterLanguageBranch);
                    curPage = curPage.CreateWritableClone();
                }
                curPage["EventStartDate"] = startDate;
                curPage["EventStopDate"]  = stopDate;

                DataFactory.Instance.Save(curPage, SaveAction.Publish);
                Response.Redirect(DataFactory.Instance.GetPage(CurrentPageLink).LinkURL);
            }
            catch (FormatException ex)
            {
                Page.Validators.Add(new StaticValidator(ex.Message));
            }
            catch (Exception x)
            {
                Page.Validators.Add(new StaticValidator(x.Message));
            }
        }