Ejemplo n.º 1
0
 internal protected static string SetupDocument(String repositoryName, String contentId)
 {
     if (!String.IsNullOrEmpty(contentId) && OfficeApplication.TryLogOn())
     {
         IOfficeDocument document = OfficeApplication.OfficeDocumentProxy;
         try
         {
             if (document.exists(repositoryName, contentId))
             {
                 return(contentId);
             }
             else
             {
                 RtlAwareMessageBox.Show("El contenido parace haberse publicado en un sitio web.\r\nAl sitio donde se está intentando conectar, indica que este contenido no existe.\r\nSi desea continuar se perderá esta información, de lo contrario, cierre este documento.", "Verificación de contenido en sitio web", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (FormatException fe)
         {
             OfficeApplication.WriteError(fe);
         }
         catch (ApplicationException ap)
         {
             OfficeApplication.WriteError(ap);
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 public void InsertLinkToDoc()
 {
     if (OfficeApplication.TryLogOn())
     {
         FormInsertLinkToDocuentRepository formAddLink = new FormInsertLinkToDocuentRepository(this);
         formAddLink.ShowDialog();
     }
 }
Ejemplo n.º 3
0
 public void InsertLink()
 {
     if (OfficeApplication.TryLogOn())
     {
         FormAddLink formAddLink = new FormAddLink(this);
         formAddLink.ShowDialog();
     }
 }
Ejemplo n.º 4
0
 public void showContentInformation()
 {
     if (OfficeApplication.TryLogOn() && SetupDocument())
     {
         FormContentInformation formContentInformation = new FormContentInformation(reporitoryID, contentID, this);
         formContentInformation.ShowDialog();
     }
 }
Ejemplo n.º 5
0
 public static void showRepository(DocumentType documentType)
 {
     if (OfficeApplication.TryLogOn())
     {
         FormEditRepository frm = new FormEditRepository(documentType);
         frm.ShowDialog();
     }
 }
Ejemplo n.º 6
0
 public void Open(DocumentType documentType)
 {
     if (OfficeApplication.TryLogOn())
     {
         FormOpenContent frm = new FormOpenContent(this, documentType);
         frm.ShowDialog();
         frm.open();
     }
 }
Ejemplo n.º 7
0
 private void UpdateContent()
 {
     if (OfficeApplication.TryLogOn() && SetupDocument())
     {
         String contentID    = this.CustomProperties[CONTENT_ID_NAME];
         String reporitoryID = this.CustomProperties[REPOSITORY_ID_NAME];
         bool   canModify    = OfficeDocument.OfficeDocumentProxy.canModify(reporitoryID, contentID);
         if (!canModify)
         {
             MessageBox.Show("¡No tiene permisos para modificar o borrar este contenido, debe ser el propietario o un super usuario quien lo puede realizar!", "Actualizar contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         FormUpdateContent frm = new FormUpdateContent(this);
         frm.ShowDialog();
     }
 }
Ejemplo n.º 8
0
 public void Delete()
 {
     if (IsPublished)
     {
         if (OfficeApplication.TryLogOn() && SetupDocument())
         {
             bool canModify = OfficeDocument.OfficeDocumentProxy.canModify(reporitoryID, contentID);
             if (!canModify)
             {
                 MessageBox.Show("¡No tiene permisos para modificar o borrar este contenido, debe ser el propietario o un super usuario quien lo puede realizar!", "Borrar contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             DialogResult result = RtlAwareMessageBox.Show("¿Desea borrar el contenido del sitio web?", "Borrar contenido", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 try
                 {
                     OfficeDocumentProxy.delete(this.reporitoryID, this.contentID);
                     this.CleanContentProperties();
                     MessageBox.Show("¡Se ha borrado el contenido!", "Borrado de contenido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     if (OfficeApplication.MenuListener != null)
                     {
                         OfficeApplication.MenuListener.NoDocumentPublished();
                     }
                 }
                 catch (HttpException e)
                 {
                     RtlAwareMessageBox.Show(e.Message, "Borrar contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     OfficeApplication.WriteError(e);
                 }
                 catch (XmlRpcException e)
                 {
                     RtlAwareMessageBox.Show(e.Message, "Borrar contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     OfficeApplication.WriteError(e);
                 }
                 catch (WebException e)
                 {
                     RtlAwareMessageBox.Show(e.Message, "Borrar contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     OfficeApplication.WriteError(e);
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
 public void Publish(String title, String description, WebSiteInfo site)
 {
     try
     {
         if (OfficeApplication.TryLogOn() && SetupDocument() && IsPublished)
         {
             WebSiteInfo[] sites = OfficeApplication.OfficeApplicationProxy.getSites();
             if (sites == null || sites.Length == 0)
             {
                 MessageBox.Show("¡No hay sitios web creados, debe crear un sitio para publicar un documento!", "Publicación de contenido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 return;
             }
             FormPublishcontentToPage frm = new FormPublishcontentToPage(this, title, description, site);
             frm.ShowDialog();
         }
     }
     catch (Exception e)
     {
         OfficeApplication.WriteError(e);
     }
 }
Ejemplo n.º 10
0
 public void SaveToSite()
 {
     try
     {
         if (IsReadOnly)
         {
             RtlAwareMessageBox.Show("El documento es de sólo lectura, por lo tanto no puede ser publicado", "Publicación de contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (OfficeApplication.TryLogOn() && SetupDocument())
         {
             if (!ValidaNombre(this.FilePath))
             {
                 return;
             }
             if (!ValidaFiles())
             {
                 return;
             }
             if (isOldVersion())
             {
                 DialogResult res = RtlAwareMessageBox.Show("El documento esta publicado en una versión anterior, ¿Desea que se verifique si existe en el sitio actual?", "Publicación de contenido", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                 if (res == DialogResult.Yes)
                 {
                     String      contentid = this.CustomProperties["content"];
                     String      topicid   = this.CustomProperties["topicid"];
                     String      topicmap  = this.CustomProperties["topicmap"];
                     ContentInfo info      = OfficeApplication.OfficeDocumentProxy.existContentOldVersion(contentid, topicmap, topicid);
                     if (info != null)
                     {
                         res = RtlAwareMessageBox.Show("El documento se encuentra en el sitio, ¿Desea convertir el documento a versión 4?", "Publicación de contenido", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                         if (res == DialogResult.Yes)
                         {
                             CleanContentProperties();
                             SaveContentProperties(info.id, info.respositoryName);
                             this.Save();
                             RtlAwareMessageBox.Show("¡El documento se ha convertido a versión 4, puede continuar!", "Publicación de contenido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                         if (res == DialogResult.Cancel)
                         {
                             return;
                         }
                     }
                     else
                     {
                         res = RtlAwareMessageBox.Show("El documento no existe en el sitio actual, por lo cuál no se puede convertir, ¿Desea continuar?", "Publicación de contenido", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                         if (res == DialogResult.No)
                         {
                             return;
                         }
                     }
                 }
                 if (res == DialogResult.Cancel)
                 {
                     return;
                 }
             }
             if (IsNew)
             {
                 SaveFileDialog dialog = new SaveFileDialog();
                 dialog.Title           = "Guardar Documento";
                 dialog.CreatePrompt    = true;
                 dialog.CheckFileExists = false;
                 dialog.CheckPathExists = true;
                 dialog.OverwritePrompt = true;
                 dialog.AddExtension    = true;
                 dialog.DefaultExt      = DefaultExtension;
                 dialog.Filter          = DocumentFilter;
                 DialogResult result = dialog.ShowDialog();
                 if (result != DialogResult.OK)
                 {
                     return;
                 }
                 FileInfo file = new FileInfo(dialog.FileName);
                 if (file.Exists)
                 {
                     file.Delete();
                 }
                 Save(file);
                 new FormSaveContent(this).ShowDialog();
             }
             else if (!IsNew && this.IsPublished && OfficeApplication.OfficeDocumentProxy.exists(this.reporitoryID, this.contentID))
             {
                 // update the content
                 Save();
                 UpdateContent();
             }
             else
             {
                 Save();
                 new FormSaveContent(this).ShowDialog();
             }
         }
     }
     catch (Exception e)
     {
         OfficeApplication.WriteError(e);
     }
 }