/// <param name="_wiki">A reference to the currently loaded wiki structure.</param>
 /// <param name="_spaceName">
 /// The default space name in which the new page will be created
 /// </param>
 public AddPageForm(ref Wiki _wiki, String _spaceName)
 {
     InitializeComponent();
     this.wiki = _wiki;
     LoadSpaces();
     foreach (Space space in wiki.spaces)
     {
         if (space.name == _spaceName)
         {
             radioButtonExistingSpace.Checked = true;
             foreach (Object item in comboBoxSpaceName.Items)
             {
                 if (item.ToString() == _spaceName)
                 {
                     comboBoxSpaceName.SelectedItem = item;
                 }
             }
         }
     }
     txtPageName.Focus();
 }
Exemple #2
0
        /// <summary>
        /// Gets the unplublished spaces and documents from wiki structure instance.
        /// </summary>
        /// <returns>A new WikiStructure instance containing only the unpublished spaces and documents.</returns>
        public Wiki GetUnpublishedWikiStructure()
        {
            Wiki unpublishedStruct = new Wiki();

            foreach (Space sp in spaces)
            {
                //space with unpublished pages?
                if (!sp.published)
                {
                    unpublishedStruct.spaces.Add(sp);
                }
                else
                {
                    List <XWikiDocument> docs = sp.GetUnpublishedDocuments();
                    if (docs.Count > 0)
                    {
                        sp.documents = docs;
                        unpublishedStruct.spaces.Add(sp);
                    }
                }
            }
            return(unpublishedStruct);
        }
 /// <param name="_wiki">A reference to the currently loaded wiki structure.</param>
 public AddPageForm(ref Wiki _wiki)
 {
     InitializeComponent();
     this.wiki = _wiki;
     LoadSpaces();
 }
 /// <param name="_wiki">A reference to the currently loaded wiki structure.</param>
 /// <param name="newSpace">Specifies if a new space will be created.</param>
 /// <param name="_exportMode">
 /// Specifies if the form is used to assign an export destination
 /// for a document
 /// </param>
 public AddPageForm(ref Wiki _wiki, bool newSpace, bool _exportMode)
 {
     InitializeComponent();
     this.wiki = _wiki;
     this.exportMode = _exportMode;
     LoadSpaces();
     if (newSpace)
     {
         comboBoxSpaceName.Visible = false;
         txtSpaceName.Visible = true;
         radioButtonNewSpace.Checked = true;
         txtPageName.Text = "WebHome";
         txtPageTitle.Text = "WebHome";
     }
     if (exportMode)
     {
         btnAddPage.Left = btnAddPage.Left - (100 - btnAddPage.Width);
         btnAddPage.Width = 100;
         btnAddPage.Text = "Export page";
         txtPageTitle.Visible = false;
         label2.Visible = false;
     }
 }
Exemple #5
0
 /// <summary>
 /// Gets the unplublished spaces and documents from wiki structure instance.
 /// </summary>
 /// <returns>A new WikiStructure instance containing only the unpublished spaces and documents.</returns>
 public Wiki GetUnpublishedWikiStructure()
 {
     Wiki unpublishedStruct = new Wiki();
     foreach (Space sp in spaces)
     {
         //space with unpublished pages?
         if (!sp.published)
         {
             unpublishedStruct.spaces.Add(sp);
         }
         else
         {
             List<XWikiDocument> docs = sp.GetUnpublishedDocuments();
             if (docs.Count > 0)
             {
                 sp.documents = docs;
                 unpublishedStruct.spaces.Add(sp);
             }
         }
     }
     return unpublishedStruct;
 }
 /// <summary>
 /// Removes all protected pages from the Word wiki structure.
 /// </summary>
 /// <param name="wiki">The wiki instance.</param>
 /// <param name="wildcards">The list of protected pages wildcards.</param>
 public void HideProtectedPages(Wiki wiki, List<String> wildcards)
 {
     foreach (XWikiDocument doc in wiki.GetAllDocuments())
     {
         foreach (String wildcard in wildcards)
         {
             String docFullName = doc.space + "." + doc.name;
             if (UtilityClass.IsWildcardMatch(wildcard, docFullName, true))
             {
                 wiki.RemoveXWikiDocument(doc);
                 break;
             }
         }
     }
 }
 /// <summary>
 /// Requests the spaces and pages of the wiki from the server.
 /// </summary>
 /// <returns>A WikiStructure instance.</returns>
 private Wiki RequestWikiStructure()
 {
     Wiki wikiStructure = new Wiki();
     List<String> spacesNames = Client.GetSpacesNames();
     spacesNames.Sort();
     wikiStructure.AddSpaces(spacesNames);
     //TODO: Implement user option
     if (false)
     {
         foreach (String spaceName in spacesNames)
         {
             List<String> pagesNames = Client.GetPagesNames(spaceName);
             wikiStructure[spaceName].AddDocuments(pagesNames);
         }
     }
     //TODO: Add opt-in prefetch
     return wikiStructure;
 }
 private void AddUnpublishedData(ref Wiki actualWiki,ref Wiki unpublishedWiki)
 {
     //add local spaces and pages
     if (unpublishedWiki != null)
     {
         //add unexistent spaces from old structure
         //and update existing spaces with unpublished pages
         foreach (Space sp in unpublishedWiki.spaces)
         {
             if (actualWiki.ContainsSpace(sp.name))
             {
                 //The old local space containing local unpublished documents.
                 Space existingSpace = actualWiki[sp.name];
                 foreach (XWikiDocument xwd in sp.documents)
                 {
                     existingSpace.documents.Add(xwd);
                 }
                 existingSpace.published = true;
             }
             else
             {
                 sp.published = false;
                 actualWiki.spaces.Add(sp);
             }
         }
     }
 }