Пример #1
0
        /// <summary>
        /// Provides logic keyed to navigation
        /// </summary>
        /// <param name="page"></param>
        /// <param name="newpage"></param>
        /// <returns></returns>
        protected override bool ActivePageChanging(string page, ref string newpage)
        {
            NextButton.Header = "Next >";
            if (HasCustomPageChangingEvent(page, newpage))
            {
                return(true);
            }
            else if (newpage == SummaryPage)
            {
                NextButton.Header = ExecuteBtnText;
                // invokes an aggegate function on each sitebuilder page using a new string builder
                // as the aggregate object to collect the output.
                StringBuilder sb = SiteBuilderPages.Aggregate(new StringBuilder(), (acc, aPage) => {
                    acc.AppendFormat(@"<h4>{0}</h4>", aPage.PageName);
                    acc.Append(@"<ul>");
                    foreach (string val in aPage.DataSummary)
                    {
                        acc.AppendFormat("<li>{0}</li>", val);
                    }
                    acc.Append(@"</ul>");
                    return(acc);
                });
                Choices.Text = sb.ToString();
            }
            else if (newpage == ProcessPage)
            {
                // performs an aggregation function on each sitebuilder page using a new dictionary as the aggregate object.
                // Collects the data from all pages and builds the requested site.
                Dictionary <string, object> data = SiteBuilderPages.Aggregate(new Dictionary <string, object>(), (d, aPage) => d.Merge(aPage.DataDictionary, false));

                //disable the buttons and start the long running process
                NextButton.Visible = false;
                BackButton.Visible = false;

                for (int i = 0; i < TotalSteps; i++)
                {
                    SetStatus((i + 1), StatusType.queued, " ");
                }

                Job job = JobManager.Start(new JobOptions(
                                               JobName,
                                               "Wizard Tools",
                                               Sitecore.Context.Site.Name,
                                               this,
                                               "ProcessBuild",
                                               new object[] { data }));
                job.Status.Total = TotalSteps;

                HandleId.Value = job.Handle.ToString();
                SheerResponse.Timer("CheckBuildStatus", RefreshTime);
            }

            return(true);
        }
Пример #2
0
        protected override bool HasCustomPageChangingEvent(string page, string newpage)
        {
            if (!newpage.Equals(SetSecurityPage))
            {
                return(false);
            }

            SetSecurityPage np = (SetSecurityPage)SiteBuilderPages.Where(a => a.ID.Equals(SetSecurityPage)).First();
            BasePage        op = SiteBuilderPages.Where(a => a.ID.Equals(SelectSitePage)).First();

            np.PreviousPage = op;
            np.SetDataContext();

            return(true);
        }