Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ConfluenceContext.SaveCredentials(AppSettingsHelper.GetValue("username"), AppSettingsHelper.GetValue("password"));

            ConfluenceSpaceTaskExecutor confSpaceService = new ConfluenceSpaceTaskExecutor(this);
            AllSpaces r = confSpaceService.Execute();

            this.MaincomboBox.ValueMember   = Strings.KEY;
            this.MaincomboBox.DisplayMember = Strings.NAME;
            r.results.Insert(0, new Result()
            {
                id = 0, name = "--SELECT--", key = string.Empty, type = string.Empty
            });
            this.MaincomboBox.DataSource = r.results;


            AllSpaces r2 = confSpaceService.Execute();

            this.TargetcomboBox.ValueMember   = Strings.KEY;
            this.TargetcomboBox.DisplayMember = Strings.NAME;
            r2.results.Insert(0, new Result()
            {
                id = 0, name = "--SELECT--", key = string.Empty, type = string.Empty
            });
            this.TargetcomboBox.DataSource = r2.results;
        }
Example #2
0
        private void AppendButton_Click(object sender, EventArgs e)
        {
            ConfluenceContext.SaveCredentials(AppSettingsHelper.GetValue("username"), AppSettingsHelper.GetValue("password"));

            ChildPagesOutput_Result        firstchecked = GetFirstChecked();
            ConfluencePageTreeTaskExecutor task         = new ConfluencePageTreeTaskExecutor();

            ChildPagesOutput_Result lastProcessed = firstchecked;
            string leftSideSpace   = firstchecked.ParentSpace;
            string currentParentId = firstchecked.id;

            List <ChildPagesOutput_Result> list   = new List <ChildPagesOutput_Result>();
            List <ChildPagesOutput_Result> result = GetAllToAppend(this.ConfluencetreeView2.Nodes, list);



            foreach (ChildPagesOutput_Result node in result)
            {
                lastProcessed = task.CreateChildPageX(
                    AppSettingsHelper.GetValue(Strings.CREATE_PAGE_URL_KEY),
                    JsonConvert.SerializeObject(
                        task.CreateChildPageInstance(leftSideSpace, currentParentId, string.Format("{0} - {1}", node.ParentSpace, node.title), string.Format(AppSettingsHelper.GetValue(Strings.INCLUDE_PAGECONTENT_KEY), node.title, node.ParentSpace)
                                                     )
                        )
                    );
            }

            MaincomboBox_SelectedIndexChanged(sender, e);


            MessageBox.Show("All Done.");
        }
Example #3
0
        private void Copybutton_Click(object sender, EventArgs e)
        {
            if (MaincomboBox.SelectedIndex == 0 || TargetcomboBox.SelectedIndex == 0)
            {
                return;
            }

            ConfluenceContext.SaveCredentials(AppSettingsHelper.GetValue("username"), AppSettingsHelper.GetValue("password"));

            ChildPagesOutput_Result        firstchecked = GetFirstChecked();
            ConfluencePageTreeTaskExecutor task         = new ConfluencePageTreeTaskExecutor();

            ChildPagesOutput_Result lastProcessed = firstchecked;
            string leftSideSpace   = firstchecked.ParentSpace;
            string currentParentId = firstchecked.id;


            var projectNode = this.ConfluencetreeView2.Nodes[0];

            if (projectNode != null)
            {
                lastProcessed = task.CreateChildPageX(
                    AppSettingsHelper.GetValue(Strings.CREATE_PAGE_URL_KEY),
                    JsonConvert.SerializeObject(
                        task.CreateChildPageInstance(leftSideSpace, currentParentId, projectNode.Text, string.Format(AppSettingsHelper.GetValue(Strings.INCLUDE_PAGECONTENT_KEY), string.Format("{0} Home", projectNode.Text), rightSideSpace)
                                                     )
                        )
                    );
            }
            firstchecked    = lastProcessed;
            currentParentId = lastProcessed.id;

            foreach (TreeNode node in this.ConfluencetreeView2.Nodes[0].Nodes)
            {
                if (node.Checked && node.Tag != null)
                {
                    ChildPagesOutput_Result tag = node.Tag as ChildPagesOutput_Result;
                    if (tag != null)
                    {
                        lastProcessed = task.CreateChildPageX(
                            AppSettingsHelper.GetValue(Strings.CREATE_PAGE_URL_KEY),
                            JsonConvert.SerializeObject(
                                task.CreateChildPageInstance(leftSideSpace, currentParentId, string.Format("{0} - {1}", tag.ParentSpace, tag.title), string.Format(AppSettingsHelper.GetValue(Strings.INCLUDE_PAGECONTENT_KEY), tag.title, tag.ParentSpace)
                                                             )
                                )
                            );


                        if (node.Nodes.Count > 0)
                        {
                            currentParentId = lastProcessed.id;
                            CreateChildrenNodes(task, lastProcessed, currentParentId, leftSideSpace, node.Nodes);
                            currentParentId = firstchecked.id;
                        }
                    }
                }
            }


            MessageBox.Show("All Done.");
        }