예제 #1
0
 public Page(RemotePageSummary pageSummary)
 {
     id       = pageSummary.id;
     Title    = pageSummary.title;
     SpaceKey = pageSummary.space;
     Url      = pageSummary.url;
 }
예제 #2
0
        void RootPageComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            string            rootPageName = RootPageComboBox.Text;
            RemotePageSummary rootPage     = m_pages.ContainsKey(rootPageName) ? m_pages[rootPageName] : null;

            RootPageExistsLabel.Text = (rootPage == null) ? "New" : "Exists";
            SetPlatforms(rootPage);
        }
 private static PageSummary ToPageSummary(RemotePageSummary remotePageSummary)
 {
     return(new PageSummary
     {
         Id = remotePageSummary.id,
         ParentId = remotePageSummary.parentId,
         Name = remotePageSummary.title,
         Space = remotePageSummary.space,
         Version = remotePageSummary.version
     });
 }
예제 #4
0
파일: PostDialog.cs 프로젝트: mo5h/omeo
        private void _btnBrowse_Click(object sender, System.EventArgs e)
        {
            string            spaceKey    = (_cmbSpaces.SelectedItem as SpaceSummary).Key;
            RemotePageSummary pageSummary = BrowsePagesDialog.BrowseForPage(this, spaceKey);

            if (pageSummary != null)
            {
                _parentId       = pageSummary.id;
                _edtParent.Text = pageSummary.title;
            }
            else
            {
                _parentId       = 0L;
                _edtParent.Text = "";
            }
        }
예제 #5
0
        void BuildComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            string            buildPageName = BuildComboBox.Text;
            RemotePageSummary buildPage     = m_pages.ContainsKey(buildPageName) ? m_pages[buildPageName] : null;

            BuildPageExistsLabel.Text  = (buildPage == null) ? "New" : "Exists";
            ReplaceRadioButton.Enabled = (buildPage != null);
            AppendRadioButton.Enabled  = (buildPage != null);

            if (buildPage != null)
            {
                string            platformPageName = PlatformComboBox.Text;
                RemotePageSummary platformPage     = m_pages.ContainsKey(platformPageName) ? m_pages[platformPageName] : null;
                if ((platformPage != null) && (buildPage.parentId != platformPage.id))
                {
                    BuildPageExistsLabel.Text = "Platform not parent!";
                }
            }
        }
예제 #6
0
        void PlatformComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            string            platformPageName = PlatformComboBox.Text;
            RemotePageSummary platformPage     = m_pages.ContainsKey(platformPageName) ? m_pages[platformPageName] : null;

            PlatformPageExistsLabel.Text = (platformPage == null) ? "New" : "Exists";

            if (platformPage != null)
            {
                string            rootPageName = RootPageComboBox.Text;
                RemotePageSummary rootPage     = m_pages.ContainsKey(rootPageName) ? m_pages[rootPageName] : null;
                if ((rootPage != null) && (platformPage.parentId != rootPage.id))
                {
                    PlatformPageExistsLabel.Text = "Root not parent!";
                }
            }

            SetBuilds(platformPage);
        }
예제 #7
0
        void SetBuilds(RemotePageSummary platformPage)
        {
            BuildComboBox.Items.Clear();
            BuildComboBox.Items.Add(m_initialBuildPageName);

            if (platformPage != null)
            {
                foreach (KeyValuePair <string, RemotePageSummary> pagePair in m_pages)
                {
                    RemotePageSummary page = pagePair.Value;

                    if ((page.parentId == platformPage.id) && (page.title != m_initialBuildPageName))
                    {
                        BuildComboBox.Items.Add(page.title);
                    }
                }
            }

            BuildComboBox.SelectedItem = m_initialBuildPageName;
        }
예제 #8
0
        void SetPlatforms(RemotePageSummary rootPage)
        {
            PlatformComboBox.Items.Clear();
            PlatformComboBox.Items.Add(m_initialPlatformPageName);

            if (rootPage != null)
            {
                foreach (KeyValuePair <string, RemotePageSummary> pagePair in m_pages)
                {
                    RemotePageSummary page = pagePair.Value;

                    if ((page.parentId == rootPage.id) && (page.title != m_initialPlatformPageName))
                    {
                        PlatformComboBox.Items.Add(page.title);
                    }
                }
            }

            PlatformComboBox.SelectedItem = m_initialPlatformPageName;
        }
예제 #9
0
 public PageNode(RemotePageSummary page)
 {
     _page = page;
 }
예제 #10
0
        private string MovePageStubs(XDoc spaceManifest, string spaceRoot, string parentPagePath, RemotePageSummary confluenceRemotePageSummary,
                                     string pageName, string pageTitle, ACConverterPageInfo parentPage)
        {
            RemotePage confluenceRemotePage = _confluenceService.GetPage(confluenceRemotePageSummary.id);
            string     tinyUrl = null;

            if (_rpcclient != null)
            {
                CFRpcExtensions rpcExt = new CFRpcExtensions(_rpcclient);
                tinyUrl = rpcExt.GetTinyUrlForPageId(confluenceRemotePageSummary.id.ToString());
            }

            string pagePath = null;

            //If PageName not null use it, else use Confluence page title.
            if (pageName == null)
            {
                pageName = confluenceRemotePage.title;
            }

            pagePath = pageName;
            if (parentPagePath != null)
            {
                pagePath = parentPagePath + Utils.DoubleUrlEncode("/" + pagePath);
            }

            //If the page title is too long it gets saved as {spaceroot}/misc/{pageid} with the page title set
            if (pagePath.Length > MaxLengthOfPageTitle)
            {
                pagePath = Utils.DoubleUrlEncode(string.Format(@"{0}/misc/{1}", spaceRoot, confluenceRemotePage.id));
                if (string.IsNullOrEmpty(pageTitle))
                {
                    pageTitle = pageName;
                }
                Log.WarnFormat("Page title longer than {0}. Will be placed into {1}. Title: {2}", MaxLengthOfPageTitle, pagePath, pageTitle);
            }

            Plug postPageDekiPlug = (confluenceRemotePage.creator == null) ? _dekiPlug :
                                    GetPlugForConvertedUser(confluenceRemotePage.creator);

            Log.TraceFormat("Creating page stub in space '{0}'", confluenceRemotePage.space);

            string mtPageUrl;

            // modified date string, according to:

            /* http://developer.mindtouch.com/en/ref/MindTouch_API/POST%3apages%2f%2f%7Bpageid%7D%2f%2fcontents
             * should be formatted as:
             * the edit timestamp - yyyyMMddHHmmss or yyyy-MM-ddTHH:mm:ssZ
             */

            int dekiPageId = CreateDekiPage(postPageDekiPlug, pagePath, pageTitle, confluenceRemotePage.modified, "",
                                            out mtPageUrl);

            if (dekiPageId == -1)
            {
                //TODO (maxm): page failure needs to be recorded and steps that depend
                // on it such as attachments and children should be skipped
                return(string.Empty);
            }
            ACConverterPageInfo pageInfo = new ACConverterPageInfo(confluenceRemotePage, spaceRoot, mtPageUrl, pagePath, dekiPageId, pageTitle, tinyUrl, parentPage);

            Utils.PersistPageInfo(pageInfo);

            //Confluence view page permission is inherited. Save they to use later in MovePermissions.
            SavePageViewPermissions(pageInfo);

            RemotePageSummary[] childPages = _confluenceService.GetChildren(confluenceRemotePage.id);
            foreach (RemotePageSummary childPageSummary in childPages)
            {
                MovePageStubs(spaceManifest, spaceRoot, pagePath, childPageSummary, null, null, pageInfo);
            }

            SaveCommentsLinks(spaceManifest, pageInfo.ConfluencePage.space, pageInfo.ConfluencePage.id, mtPageUrl);

            MoveAttachments(spaceManifest, pageInfo.DekiPageId, pageInfo.ConfluencePage.id);

            LogPageConversion(spaceManifest, pageInfo);

            return(pagePath);
        }