Пример #1
0
        private void ConfigureShellWax(ITaskOutput output, string database)
        {
            using (new SecurityDisabler())
            {
                var currentdb = Factory.GetDatabase(database, false);
                if (currentdb == null)
                {
                    output.Alert(string.Format("Database '{0}' not found. ShellWax auto-configuration will not be executed.", database));
                }
                else
                {
                    //Configuring the "Task Schedule Field Editor":
                    //1. Change the field type of the "Schedule" field on the template "/sitecore/templates/System/Tasks/Schedule" from "text" to "IFrame"
                    //2. In the field source enter: "/sitecore modules/shell/editors/TaskSchedule/TaskSchedule.aspx?field=Schedule"
                    //3. On the /sitecore/templates/System/Tasks/Schedule/Data/Schedule item, select View-->Standard Fields
                    //4. Goto the "Style" field in the "Appearance" section and add this value: "height:250px"
                    var scheduleTemplate = currentdb.GetTemplate("System/Tasks/Schedule");
                    var scheduleField    = scheduleTemplate.GetField("Schedule");

                    scheduleField.BeginEdit();
                    try
                    {
                        scheduleField.Type   = "IFrame";
                        scheduleField.Source = "/sitecore modules/shell/editors/TaskSchedule/TaskSchedule.aspx?field=Schedule";
                        scheduleField.Style  = "height:300px";
                        scheduleField.EndEdit();
                        output.Alert("'Task Schedule Field Editor' configured successfully.");
                    }
                    catch (Exception exception)
                    {
                        scheduleField.InnerItem.Editing.CancelEdit();
                        output.Alert(string.Format("'Task Schedule Field Editor' configuration failed. Exception details: {0}", exception.ToString()));
                    }



                    //Configuring the "Execute Now!" ribbon:
                    //1. Goto the "/sitecore/templates/System/Tasks/Schedule" template in Content Editor
                    //2. In the "Configure" tab, click the "Contextual Tab" button in the "Appearance" chunk
                    //3. Choose: /content/Applications/Content Editor/Ribbons/Contextual Ribbons/Schedules

                    scheduleTemplate.BeginEdit();
                    try
                    {
                        scheduleTemplate.InnerItem.Appearance.Ribbon = "{DE9038AE-568B-4ED0-A4DF-D80BD867AD27}";
                        scheduleTemplate.EndEdit();
                        output.Alert("Task 'Execute Now!' configured successfully.");
                    }
                    catch (Exception exception)
                    {
                        scheduleTemplate.InnerItem.Editing.CancelEdit();
                        output.Alert(string.Format("Task 'Execute Now!' configuration failed. Exception details: {0}", exception.ToString()));
                    }
                }
            }
        }
Пример #2
0
        private void ConfigureShellWax(ITaskOutput output, string database)
        {
            using (new SecurityDisabler())
            {
                var currentdb = Factory.GetDatabase(database, false);
                if (currentdb == null)
                {
                    output.Alert(string.Format("Database '{0}' not found. ShellWax auto-configuration will not be executed.", database));
                }
                else
                {
                    //Configuring the "Task Schedule Field Editor":
                    //1. Change the field type of the "Schedule" field on the template "/sitecore/templates/System/Tasks/Schedule" from "text" to "IFrame"
                    //2. In the field source enter: "/sitecore modules/shell/editors/TaskSchedule/TaskSchedule.aspx?field=Schedule"
                    //3. On the /sitecore/templates/System/Tasks/Schedule/Data/Schedule item, select View-->Standard Fields
                    //4. Goto the "Style" field in the "Appearance" section and add this value: "height:250px"
                    var scheduleTemplate = currentdb.GetTemplate("System/Tasks/Schedule");
                    var scheduleField = scheduleTemplate.GetField("Schedule");

                    scheduleField.BeginEdit();
                    try
                    {
                        scheduleField.Type = "IFrame";
                        scheduleField.Source = "/sitecore modules/shell/editors/TaskSchedule/TaskSchedule.aspx?field=Schedule";
                        scheduleField.Style = "height:300px";
                        scheduleField.EndEdit();
                        output.Alert("'Task Schedule Field Editor' configured successfully.");
                    }
                    catch (Exception exception)
                    {
                        scheduleField.InnerItem.Editing.CancelEdit();
                        output.Alert(string.Format("'Task Schedule Field Editor' configuration failed. Exception details: {0}", exception.ToString()));
                    }

                    //Configuring the "Execute Now!" ribbon:
                    //1. Goto the "/sitecore/templates/System/Tasks/Schedule" template in Content Editor
                    //2. In the "Configure" tab, click the "Contextual Tab" button in the "Appearance" chunk
                    //3. Choose: /content/Applications/Content Editor/Ribbons/Contextual Ribbons/Schedules

                    scheduleTemplate.BeginEdit();
                    try
                    {
                        scheduleTemplate.InnerItem.Appearance.Ribbon = "{DE9038AE-568B-4ED0-A4DF-D80BD867AD27}";
                        scheduleTemplate.EndEdit();
                        output.Alert("Task 'Execute Now!' configured successfully.");
                    }
                    catch (Exception exception)
                    {
                        scheduleTemplate.InnerItem.Editing.CancelEdit();
                        output.Alert(string.Format("Task 'Execute Now!' configuration failed. Exception details: {0}", exception.ToString()));
                    }
                }
            }
        }
Пример #3
0
        public void Run(ITaskOutput output, NameValueCollection metaData)
        {
            var metaDataString = new StringBuilder();

            if (metaData != null)
            {
                foreach (var key in metaData.AllKeys)
                {
                    metaDataString.AppendFormat("key : {0}, value : {1} \n", key, metaData[key]);
                }
            }

            output.Alert(string.Format("Custom Post step fired with metadata : {0}", metaDataString));
        }
Пример #4
0
        public void Run(ITaskOutput output, NameValueCollection metaData)
        {
            bool isSuccessful = true;

            using (new SecurityDisabler())
            {
                using (new IntegrationDisabler())
                {
                    var ids = new[]
                    {
                        TemplateIDs.IntegrationConfig, TemplateIDs.IntegrationFolder
                    };

                    foreach (var id in ids)
                    {
                        string query = string.Format("fast://*[@@templateid = '{0}']", id);
                        foreach (Item item in Context.ContentDatabase.SelectItems(query))
                        {
                            isSuccessful = this.UpdateIntegrationConfigData(item) && isSuccessful;
                            this.UpdateModifiedFields(item);
                        }
                    }
                }
            }

            var message =
                isSuccessful ? "All integration config items updated successfully."
          : "Some integration config items haven't been updated. See log for details.";

            if (this.notWellConfiguredTemplates.Count > 0)
            {
                Log.Warn(string.Format(ModifiedFieldMessageFormat, string.Join(";", this.notWellConfiguredTemplates)), this);
                message += "\r\nUploading Modified BLOBs Only feature need to be reconfigured. See log for details.";
            }
            else
            {
                message += "\r\nUploading Modified BLOBs Only feature configured successfully.";
            }

            output.Alert(message);
        }
Пример #5
0
        public void Run(ITaskOutput output, NameValueCollection metaData)
        {
            bool isSuccessful = true;

            using (new IntegrationDisabler())
            {
                string query = string.Format("fast://*[@@templateid = '{0}']", TemplateIDs.IntegrationConfig);
                foreach (Item item in Context.ContentDatabase.SelectItems(query))
                {
                    isSuccessful = this.UpdateIntegrationConfigData(item) && isSuccessful;
                }

                query = string.Format("fast://*[@@templateid = '{0}']", TemplateIDs.IntegrationFolder);
                foreach (Item item in Context.ContentDatabase.SelectItems(query))
                {
                    isSuccessful = this.UpdateIntegrationConfigData(item) && isSuccessful;
                }
            }

            output.Alert(isSuccessful ? "All integration config items has been updated successfully." : "Some integration config items haven't been updated. See log for details.");
        }
Пример #6
0
        public override void Run(ITaskOutput output, NameValueCollection metaData)
        {
            base.Run(output, metaData);

            output.Alert(this.UpdateAll() ? "All integration items have been updated successfully." : "Some integration items haven't been updated. See log for details.");
        }