예제 #1
0
        protected virtual void Run(ClientPipelineArgs args)
        {
            ItemUri itemUri = ItemUri.Parse(args.Parameters["uri"]);
            Item    item    = Database.GetItem(itemUri);

            Error.AssertItemFound(item);
            bool   flag = true;
            string str1 = string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"));

            if (!IsValidPath(str1))
            {
                str1 = HttpContext.Current.Server.MapPath("~/") + str1;
            }
            str1 = str1.Replace("/", "\\");
            FileUtil.CreateFolder(FileUtil.MapPath(str1));
            var innerfolders = item.Paths.FullPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var folder in innerfolders)
            {
                str1 = str1 + "\\" + folder;
                FileUtil.CreateFolder(FileUtil.MapPath(str1));
            }
            Log.Info(string.Concat("Starting export of media items to: ", string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"))), this);
            ProgressBoxMethod progressBoxMethod = new ProgressBoxMethod(StartProcess);

            object[] objArray = new object[] { item, str1, flag };
            ProgressBox.Execute("Export Media Items...", "Export Media Items", progressBoxMethod, objArray);
        }
예제 #2
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            Item item = context.Items[0];

            ProgressBox.Execute("ItemSync", "Translate", this.GetIcon(context, string.Empty), TranslateItem, "item:load(id=" + item.ID + ")", new object[] { item, context });
        }
        public void OnUserDeletedUnlockFiles(object sender, EventArgs args)
        {
            if (EventDisabler.IsActive)
            {
                return;
            }

            var objList  = new List <Item>();
            var userName = Event.ExtractParameter <string>(args, 0);

            Assert.IsNotNullOrEmpty(userName, "User name was null or empty");

            var lockedItems = Client.ContentDatabase.SelectItems($"search://*[@__lock='%{userName}%']");

            if (lockedItems == null || !lockedItems.Any())
            {
                return;
            }

            foreach (var lockedItem in lockedItems)
            {
                objList.AddRange(lockedItem.Versions.GetVersions(true).Where(version =>
                                                                             string.Compare(version.Locking.GetOwner(), userName, StringComparison.OrdinalIgnoreCase) == 0));
            }

            ProgressBox.Execute(nameof(RemovedUserEventHandler), "Unlocking items", "Network/16x16/lock.png",
                                UnlockAllItems, "lockeditems:refresh", Context.User, objList);

            SheerResponse.Alert($"Successfully unlocked {objList.Count} item(s) checked out by {userName}",
                                Array.Empty <string>());
        }
예제 #4
0
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length >= 0)
     {
         ProgressBox.Execute("Image", "Optimize images", new ProgressBoxMethod(this.StartProcess), new object[] { context.Items });
     }
 }
예제 #5
0
        public override void Execute(CommandContext context)
        {
            var database    = Factory.GetDatabase("master");
            var contextItem = SitecoreCommandHelper.GetContextItem(context, database);

            ProgressBox.Execute("Running Tests", "Test Preview", new ProgressBoxMethod(RunTests), new object[] { database, contextItem });

            ModalDialogHelper.ShowTestingModalDialog(contextItem.ID, contextItem.Language, PageMode.Live);
        }
        public override void Execute(CommandContext context)
        {
            var item = context.Items.First();

            ProgressBox.Execute(
                "DeleteSqlData",
                Translate.Text("Delete"),
                GetIcon(context, string.Empty),
                Process,
                $"item:load(id={item.ID})",
                item, context);
        }
        public override void Execute(CommandContext context)
        {
            if (!context.Items.Any(t => t.Paths.IsMediaItem))
            {
                return;
            }

            ProgressBox.Execute("Shrink Image", "Shrink Image", new ProgressBoxMethod(this.Shrink), new object[1]
            {
                context.Items[0]
            });
        }
예제 #8
0
        public override void Execute(CommandContext context)
        {
            if (!context.Items.Any(t => t.Paths.IsMediaItem))
            {
                return;
            }
            objFillSetting = null;
            //Sitecore.Context.ClientPage.
            string JobName = "Shrink Image - " + ValidationHelper.ValidateToString(Sitecore.Data.ID.NewID, Guid.NewGuid().ToString());

            ProgressBox.Execute(JobName, "Shrink Image", new ProgressBoxMethod(this.Shrink), new object[1]
            {
                context.Items[0]
            });
        }
예제 #9
0
 public override void Execute(CommandContext context)
 {
     if (SessionManager.Instance.CurrentIndex == null)
     {
         SheerResponse.Alert(Translate.Text("The index is not selected. Please select the index."));
     }
     else
     {
         ProgressBox.Execute("IndexRebuild", "Rebuild",
                             this.GetIcon(context, string.Empty),
                             new ProgressBoxMethod(this.Optimize),
                             "indexviewer:indexoptimized",
                             new object[] { SessionManager.Instance.CurrentIndex, context });
     }
 }
예제 #10
0
 protected void Confirm(ClientPipelineArgs args)
 {
     if (!args.IsPostBack)
     {
         SheerResponse.Confirm("Are you sure you want to rebuild the WeBlog search index?");
         args.WaitForPostBack();
     }
     else
     {
         if (args.Result == "yes")
         {
             ProgressBox.Execute("weblog-index-rebuild", "Rebuilding WeBlog Search Index", new ProgressBoxMethod(Run));
         }
     }
 }
예제 #11
0
파일: RefreshTree.cs 프로젝트: netojoa/blog
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            var item = context.Items[0];

            Assert.IsNotNull(item, "context item cannot be null");

            var progressBoxMethod = new ProgressBoxMethod(Refresh);

            ProgressBox.Execute(
                string.Format("{0} ({1})", "Re-Index Elastic Tree.", item.Paths.ContentPath),
                "Re-indexing the current item and its descendants in Elastic",
                progressBoxMethod,
                new object[] { item });
        }
예제 #12
0
 public void DialogProcessor(ClientPipelineArgs args)
 {
     if (!args.IsPostBack)
     {
         SheerResponse.YesNoCancel("Are you sure you want to sync synonyms?", "500px", "200px", true);
         args.WaitForPostBack(true);
     }
     else
     {
         if (args.Result == "yes")
         {
             ProgressBox.Execute("Sync Synonyms", "Sync Synonyms", Sync);
             SheerResponse.Alert("Sync has been completed");
         }
     }
 }
예제 #13
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            var item = context.Items[0];

            Assert.IsNotNull(item, "context item cannot be null");

            var progressBoxMethod = new ProgressBoxMethod(Recreate);

            ProgressBox.Execute(
                "Recreate Elastic Indexes.",
                "Recreating all Elastic indexes.",
                progressBoxMethod,
                new object[] { item });
        }
        /// <summary>
        ///     Called when the item copied event runs. Will update the Context references contained in the copied tree structure.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.EventArgs" /> instance containing the event data.</param>
        protected void OnItemCopied(object sender, EventArgs args)
        {
            var itemThatWasCopied     = Event.ExtractParameter(args, 0) as Item;
            var itemRootCreatedByCopy = Event.ExtractParameter(args, 1) as Item;

            Error.AssertNotNull(itemThatWasCopied, "No sourceItem in parameters");
            Error.AssertNotNull(itemRootCreatedByCopy, "No targetItem in parameters");

            var updater = new LayoutDataSourceReferenceUpdater
            {
                NewRoot      = itemRootCreatedByCopy,
                OriginalRoot = itemThatWasCopied
            };

            ProgressBox.Execute(
                Translate.Text("Updating context references"),
                Translate.Text("Updating context references"),
                "Applications/16x16/form_blue.png",
                updater.UpdateReferences, Event.ExtractParameter(args, 0), Event.ExtractParameter(args, 1));
        }
        protected virtual void Run(ClientPipelineArgs args)
        {
            ItemUri itemUri = ItemUri.Parse(args.Parameters["uri"]);
            Item    item    = Database.GetItem(itemUri);

            Error.AssertItemFound(item);
            bool   flag = true;
            string str1 = string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports")) + item.Paths.FullPath;

            if (!IsValidPath(str1))
            {
                str1 = HttpContext.Current.Server.MapPath("~/") + str1;
            }
            str1 = str1.Replace("/", "\\");
            if (FileUtil.FolderExists(FileUtil.MapPath(str1)))
            {
                Log.Info(string.Concat("Starting import media items from: ", string.Concat(Settings.DataFolder.TrimStart(new char[] { '/' }), "\\", Settings.GetSetting("Sitecore.Scientist.MediaExportImport.ExportFolderName", "MediaExports"))), this);
                ProgressBoxMethod progressBoxMethod = new ProgressBoxMethod(StartProcess);
                object[]          objArray          = new object[] { item, str1, flag };
                ProgressBox.Execute("Import Media Items...", "Import Media Items", progressBoxMethod, objArray);
            }
        }
        public override void Execute(CommandContext context)
        {
            ProgressBox.Execute("Exporting Site", "Generating Configuration, Databases, Files, Update Packages", StartProcess, new object[] { context.Items[0].ID.ToString() });

            //Step 1: Move over empty deploy template
            //Step 2: Create Item Packages
            //Step 3: Move Project Output
            //Step 4: Fill in Deploy Scripts
            //Step 5: Generate Output
            //Step 6: Run Go.cmd to generate nuget package
            //Step 7: Deploy script to stop IIS install, and warm up.
            //Step 8: Hit site and warm cache
            //Step 9: Run Smoke Tests
            //Step 10: Send Deployment Confirmation Email.
            Sitecore.Data.Database db = Factory.GetDatabase("master");
            var items = context.Items[0];

            foreach (Item project in items.Children)
            {
                RunPowershellScript(@"C:\Export\" + project.Name + "\\SiteName\\SiteEnvironment", "go.cmd", "package");
            }
        }
 protected void Execute(Message message)
 {
     if (!(AgentTaskList.SelectedItems.Any() || ScheduledTaskList.SelectedItems.Any()))
     {
         Context.ClientPage.ClientResponse.Alert("Please select an task");
     }
     else
     {
         List <XmlNode> agents =
             AgentTaskList.SelectedItems.Select(task => GetAgentNode(task.Value)).ToList();
         List <Item> scheduledTasks =
             ScheduledTaskList.SelectedItems.Select(task => Context.ContentDatabase.GetItem(task.Value)).ToList();
         if (agents.Any() || scheduledTasks.Any())
         {
             ProgressBox.Execute("XCoreScheduledTaskHelper", "XCore Scheduled Task Helper", "", RunAgent,
                                 "XCore:refresh", new object[] { agents, scheduledTasks });
         }
         else
         {
             Context.ClientPage.ClientResponse.Alert("Cannot retreive tasks");
         }
     }
 }
예제 #18
0
 public void Execute(string query, string id, string database)
 {
     ProgressBox.Execute("Bulk Applying Profile Cards", this.GetName(), "Business/16x16/radar-chart.png", this.DumpItem, new object[] { query, id, database });
 }