Beispiel #1
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            if (this.listViewCalendar.SelectedItems.Count > 0)
            {
                DialogResult res = MessageBox.Show(this, "¿Desea eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    CalendarInfo cal = ((CalendarItem)this.listViewCalendar.SelectedItems[0]).CalendarInfo;
                    this.listViewCalendar.Items.Remove((CalendarItem)this.listViewCalendar.SelectedItems[0]);


                    if (this.listViewCalendar.Items.Count == 0 || listViewCalendar.SelectedItems.Count == 0)
                    {
                        this.toolStripButtonDelete.Enabled = false;
                    }
                    try
                    {
                        added.Remove(cal);
                        OfficeApplication.OfficeDocumentProxy.deleteCalendar(pageInformation, cal);
                        loadCalendars();
                    }
                    catch (Exception ue)
                    {
                        OfficeApplication.WriteError(ue);
                    }
                }
            }
            if (this.listViewCalendar.SelectedItems.Count == 0)
            {
                this.toolStripButtonDelete.Enabled = false;
            }
        }
Beispiel #2
0
 private void loadRules()
 {
     try
     {
         ElementInfo[] rules = OfficeApplication.OfficeDocumentProxy.getElementsOfResource(resourceInfo);
         this.Cursor = Cursors.WaitCursor;
         foreach (ElementInfo info in OfficeApplication.OfficeApplicationProxy.getElementsToAdd(siteInfo))
         {
             bool exists = false;
             foreach (ElementInfo ruleinResource in rules)
             {
                 if (ruleinResource.Equals(info))
                 {
                     exists = true;
                     break;
                 }
             }
             if (!exists)
             {
                 listView1.Items.Add(new ElementListView(info));
             }
         }
     }
     catch (Exception e)
     {
         OfficeApplication.WriteError(e);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Beispiel #3
0
        private void loadTree()
        {
            this.treeView1.Nodes.Clear();
            TreeNode root = this.treeView1.Nodes.Add("Repositorios", "Repositorios", 0, 1);

            try
            {
                foreach (RepositoryInfo repository in OfficeApplication.OfficeApplicationProxy.getRepositories())
                {
                    RepositoryNode repositoryNode = new RepositoryNode(repository);
                    root.Nodes.Add(repositoryNode);
                    foreach (CategoryInfo category in OfficeApplication.OfficeApplicationProxy.getCategories(repository.name))
                    {
                        CategoryNode categoryNode = new CategoryNode(category, repository);
                        repositoryNode.Nodes.Add(categoryNode);
                        if (category.childs > 0)
                        {
                            TreeNode dummyNode = new DummyNode();
                            categoryNode.Nodes.Add(dummyNode);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                OfficeApplication.WriteError(e);
            }
            if (this.treeView1.Nodes.Count > 0)
            {
                this.treeView1.Nodes[0].Expand();
            }
        }
Beispiel #4
0
        private void initizalize()
        {
            this.checkBoxActivePag.Checked   = pageInformation.page.active;
            this.dateTimePickerEndDate.Value = DateTime.Now;

            this.textBoxTitle.Text       = pageInformation.title;
            this.textBoxDescription.Text = pageInformation.description;
            this.checkBoxActive.Checked  = pageInformation.active;
            this.labelSite.Text          = pageInformation.page.site.title;
            this.labelPage.Text          = pageInformation.page.title;
            loadCalendars();
            VersionInfo info = new VersionInfo();

            info.nameOfVersion = "*";

            comboBoxVersiones.Items.Add(info);
            foreach (VersionInfo versionInfo in OfficeApplication.OfficeDocumentProxy.getVersions(repositoryName, contentID))
            {
                comboBoxVersiones.Items.Add(versionInfo);
            }
            VersionInfo selected = new VersionInfo();

            selected.nameOfVersion = pageInformation.version;
            if (OfficeApplication.OfficeDocumentProxy.needsSendToPublish(pageInformation))
            {
                this.toolTip1.SetToolTip(this.checkBoxActive, "Necesita enviar a flujo el contenido para activarlo");
                this.buttonSenttoAuthorize.Visible = true;
            }
            else
            {
                this.buttonSenttoAuthorize.Visible = false;
            }
            if (OfficeApplication.OfficeDocumentProxy.isInFlow(pageInformation))
            {
                this.toolTip1.SetToolTip(this.checkBoxActive, "El contenido se encuentra en proceso de ser autorizado, para activarlo, necesita terminar este proceso");
            }
            comboBoxVersiones.SelectedItem = selected;
            loadProperties();
            loadRules();
            loadTitles();
            try
            {
                DateTime date = OfficeApplication.OfficeDocumentProxy.getEndDate(pageInformation);
                if (date == null)
                {
                    this.checkBoxEndDate.Checked       = false;
                    this.dateTimePickerEndDate.Enabled = false;
                }
                else
                {
                    this.checkBoxEndDate.Checked       = true;
                    this.dateTimePickerEndDate.Enabled = true;
                    this.dateTimePickerEndDate.Value   = date;
                }
            }
            catch (Exception ue)
            {
                OfficeApplication.WriteError(ue);
            }
        }
Beispiel #5
0
 private void toolStripButtonDeleteRule_Click(object sender, EventArgs e)
 {
     if (this.listViewRules.Items.Count > 0 && this.listViewRules.SelectedIndices.Count > 0)
     {
         ElementInfo  info = ((ElementListView)listViewRules.SelectedItems[0]).ElementInfo;
         DialogResult res  = MessageBox.Show(this, "¿Desea eliminar la regla / rol ó grupo de usuario " + info.title, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Question);
         if (res == DialogResult.OK)
         {
             try
             {
                 this.Cursor = Cursors.WaitCursor;
                 OfficeApplication.OfficeDocumentProxy.deleteElementToResource(pageInformation, info);
                 loadRules();
                 if (listViewRules.Items.Count == 0 || listViewRules.SelectedIndices.Count == 0)
                 {
                     toolStripButtonDeleteRule.Enabled = false;
                     toolStripButtonActivate.Enabled   = false;
                 }
                 else
                 {
                     toolStripButtonDeleteRule.Enabled = true;
                     toolStripButtonActivate.Enabled   = true;
                 }
             }
             catch (Exception ue)
             {
                 OfficeApplication.WriteError(ue);
             }
             finally
             {
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Beispiel #6
0
 private void treedir_BeforeExpand(object sender, TreeViewCancelEventArgs e)
 {
     if (e.Node.FirstNode != null)
     {
         if (e.Node.FirstNode.Text.Equals(""))
         {
             e.Node.Nodes.Clear();
             try
             {
                 System.IO.DirectoryInfo   dir  = (DirectoryInfo)e.Node.Tag;
                 System.IO.DirectoryInfo[] dirs = dir.GetDirectories();
                 foreach (System.IO.DirectoryInfo dirinfo in dirs)
                 {
                     TreeNode node = e.Node.Nodes.Add(dirinfo.Name);
                     node.Tag = dirinfo;
                     node.Nodes.Add("");
                 }
             }
             catch (System.IO.IOException ioe)
             {
                 OfficeApplication.WriteError(ioe);
             }
         }
     }
 }
Beispiel #7
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            FrmPeriodicidad dialogCalendar = new FrmPeriodicidad(false);
            DialogResult    res            = dialogCalendar.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                XmlDocument xmlCalendar = dialogCalendar.Document;

                String xml   = xmlCalendar.OuterXml;
                String title = dialogCalendar.textBoxTitle.Text;
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    OfficeApplication.OfficeApplicationProxy.createCalendar(resourceInfo.page.site, title, xml);
                    fillCalendarList();
                }
                catch (Exception ue)
                {
                    OfficeApplication.WriteError(ue);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Beispiel #8
0
 private void TitleAndDescription_ShowStep(object sender, TSWizards.ShowStepEventArgs e)
 {
     this.textBoxTitle.Focus();
     if (showType)
     {
         ComboBoxType.Items.Clear();
         try
         {
             String repository = this.Wizard.Data[SelectCategory.REPOSITORY_ID].ToString();
             foreach (ContentType type in OfficeApplication.OfficeApplicationProxy.getContentTypes(repository))
             {
                 this.ComboBoxType.Items.Add(type);
             }
             if (this.ComboBoxType.Items.Count > 0)
             {
                 this.ComboBoxType.SelectedIndex = 0;
             }
         }
         catch (Exception ue)
         {
             OfficeApplication.WriteError(ue);
         }
         ContentType    contentType    = (ContentType)this.ComboBoxType.SelectedItem;
         String         repositoryName = this.Wizard.Data[SelectCategory.REPOSITORY_ID].ToString();
         PropertyInfo[] props          = OfficeApplication.OfficeDocumentProxy.getContentProperties(repositoryName, contentType.id);
         if (props == null || props.Length == 0)
         {
             this.Wizard.changeToFinish();
         }
         else
         {
             this.Wizard.changeToNext();
         }
     }
 }
Beispiel #9
0
 /// <summary>
 /// Delete a Directory
 /// </summary>
 /// <param name="dir"></param>
 /// <exception cref="DirectoryNotFoundException">If the especific directory does not exist</exception>
 public static void DeleteTemporalDirectory(DirectoryInfo dir)
 {
     try
     {
         dir.Delete(true);
     }
     catch (DirectoryNotFoundException e)
     {
         OfficeApplication.WriteError(e);
     }
 }
Beispiel #10
0
 private void fillCalendarList()
 {
     this.listBoxCalendars.Items.Clear();
     try
     {
         foreach (CalendarInfo cal in OfficeApplication.OfficeDocumentProxy.getCatalogCalendars(resourceInfo.page.site))
         {
             this.listBoxCalendars.Items.Add(cal);
         }
     }
     catch (Exception e)
     {
         OfficeApplication.WriteError(e);
     }
 }
Beispiel #11
0
 private void loadContents()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         this.toolStripButtonSee.Enabled       = false;
         this.toolStripButtonAuthorize.Enabled = false;
         this.toolStripButtonReject.Enabled    = false;
         this.listViewFlows.Items.Clear();
         if (this.comboBoxSites.SelectedItem is WebSiteInfo)
         {
             WebSiteInfo site = (WebSiteInfo)this.comboBoxSites.SelectedItem;
             if (this.radioButtonAll.Checked)
             {
                 foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getAllContents(site))
                 {
                     FlowItem item = new FlowItem(info);
                     this.listViewFlows.Items.Add(item);
                 }
             }
             else if (this.radioButtonMyDocuments.Checked)
             {
                 foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getMyContents(site))
                 {
                     FlowItem item = new FlowItem(info);
                     this.listViewFlows.Items.Add(item);
                 }
             }
             else
             {
                 foreach (FlowContentInformation info in OfficeApplication.OfficeApplicationProxy.getContentsForAuthorize(site))
                 {
                     FlowItem item = new FlowItem(info);
                     this.listViewFlows.Items.Add(item);
                 }
             }
         }
     }
     catch (Exception e)
     {
         OfficeApplication.WriteError(e);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Beispiel #12
0
 private void toolStripButtonView_Click(object sender, EventArgs e)
 {
     if (this.listViewVersions.SelectedItems.Count > 0)
     {
         String name = null;
         try
         {
             String version = this.listViewVersions.SelectedItems[0].Text;
             String type    = document.DocumentType.ToString().ToLower();
             name = OfficeApplication.OfficeDocumentProxy.createPreview(this.document.reporitoryID, this.document.contentID, version, type);
             String urlproxy = OfficeApplication.OfficeDocumentProxy.WebAddress.ToString();
             if (!urlproxy.EndsWith("/gtw"))
             {
                 if (!urlproxy.EndsWith("/"))
                 {
                     urlproxy += "/";
                 }
                 if (!urlproxy.EndsWith("gtw"))
                 {
                     urlproxy += "gtw";
                 }
             }
             Uri         url           = new Uri(urlproxy + "?contentId=" + this.document.contentID + "&versionName=" + version + "&repositoryName=" + this.document.reporitoryID + "&name=" + name + "&type=" + type);
             String      title         = OfficeApplication.OfficeDocumentProxy.getTitle(this.document.reporitoryID, this.document.contentID);
             FormPreview dialogPreview = new FormPreview(url, false, title);
             dialogPreview.ShowDialog(this);
         }
         catch (Exception ue)
         {
             OfficeApplication.WriteError(ue);
         }
         finally
         {
             if (name != null)
             {
                 try
                 {
                     OfficeApplication.OfficeDocumentProxy.deletePreview(name);
                 }
                 catch (Exception ue)
                 {
                     OfficeApplication.WriteError(ue);
                 }
             }
         }
     }
 }
Beispiel #13
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     if (this.listBoxCalendars.SelectedItem != null)
     {
         CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem;
         DialogResult res = MessageBox.Show(this, "¿Deseas eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             try
             {
                 this.Cursor = Cursors.WaitCursor;
                 bool canDelete = OfficeApplication.OfficeApplicationProxy.canDeleteCalendar(this.resourceInfo.page.site, cal);
                 if (canDelete)
                 {
                     OfficeApplication.OfficeDocumentProxy.deleteCalendarFromCatalog(this.resourceInfo.page.site, cal);
                     fillCalendarList();
                     if (this.listBoxCalendars.SelectedItem == null || this.listBoxCalendars.Items.Count == 0)
                     {
                         this.toolStripButtonDelete.Enabled = false;
                         this.toolStripButtonEdit.Enabled   = false;
                     }
                     else
                     {
                         this.toolStripButtonDelete.Enabled = true;
                         this.toolStripButtonEdit.Enabled   = true;
                     }
                 }
                 else
                 {
                     MessageBox.Show(this, "¡El calendario no se puede borrar, esta siendo utilizado por otro contenido u otro elemento del portal!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             catch (Exception ue)
             {
                 OfficeApplication.WriteError(ue);
             }
             finally
             {
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Beispiel #14
0
        public static void setValue(WBOffice4.Interfaces.PropertyInfo prop, Object obj, String value)
        {
            Type   type = obj.GetType();
            String name = prop.id;
            int    pos  = name.IndexOf("#");

            if (pos != -1)
            {
                name = name.Substring(pos + 1);
            }
            name = name.Replace(':', '_');

            System.Reflection.PropertyInfo info = type.GetProperty(name);
            object[] index = { };
            if (info.PropertyType.Name.Equals("Int32", StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    Int32 ivalue = Int32.Parse(value);
                    info.SetValue(obj, ivalue, index);
                }
                catch (Exception e)
                {
                    OfficeApplication.WriteError(e);
                }
            }
            else if (info.PropertyType.Name.Equals("Boolean", StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    bool bvalue = bool.Parse(value);
                    info.SetValue(obj, bvalue, index);
                }
                catch (Exception e)
                {
                    OfficeApplication.WriteError(e);
                }
            }
            else
            {
                info.SetValue(obj, value, index);
            }
        }
Beispiel #15
0
 private void loadRules()
 {
     this.listViewRules.Items.Clear();
     this.Cursor = Cursors.WaitCursor;
     try
     {
         foreach (ElementInfo info in OfficeApplication.OfficeDocumentProxy.getElementsOfResource(pageInformation))
         {
             this.listViewRules.Items.Add(new ElementListView(info));
         }
     }
     catch (Exception ue)
     {
         OfficeApplication.WriteError(ue);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Beispiel #16
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     if (this.listViewVersions.SelectedItems.Count > 0)
     {
         String versionInfo = this.listViewVersions.SelectedItems[0].Text;
         bool   published   = ((VersionInfo)this.listViewVersions.SelectedItems[0].Tag).published;
         if (published)
         {
             MessageBox.Show(this, "¡No se puede borrar una versión que ha sido publicada.!\r\nDebe borrar primero la publicación del contenido.", "Borrado de versión de contenido", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         try
         {
             DialogResult res = MessageBox.Show(this, "¿Desea borrar la versión " + versionInfo + "?", "Borrado de versión de contenido", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (res == DialogResult.Yes)
             {
                 try
                 {
                     this.Cursor = Cursors.WaitCursor;
                     OfficeApplication.OfficeDocumentProxy.deleteVersionOfContent(this.document.reporitoryID, this.document.contentID, versionInfo);
                     loadVersions();
                 }
                 catch (Exception ue)
                 {
                     OfficeApplication.WriteError(ue);
                 }
                 finally
                 {
                     this.Cursor = Cursors.Default;
                 }
             }
         }
         catch (Exception ue)
         {
             OfficeApplication.WriteError(ue);
         }
     }
 }
Beispiel #17
0
        private void toolStripButtonAddRule_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            FormAddElement frm = new FormAddElement(this.pageInformation.page.site, this.pageInformation);

            this.Cursor = Cursors.Default;
            DialogResult res = frm.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                ElementInfo element = frm.ElementInfo;
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    OfficeApplication.OfficeDocumentProxy.addElementToResource(this.pageInformation, element);
                    loadRules();
                    if (listViewRules.Items.Count == 0 || listViewRules.SelectedIndices.Count == 0)
                    {
                        toolStripButtonDeleteRule.Enabled = false;
                        toolStripButtonActivate.Enabled   = false;
                    }
                    else
                    {
                        toolStripButtonDeleteRule.Enabled = true;
                        toolStripButtonActivate.Enabled   = true;
                    }
                }
                catch (Exception ue)
                {
                    OfficeApplication.WriteError(ue);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Beispiel #18
0
 private void toolStripButtonEdit_Click(object sender, EventArgs e)
 {
     if (this.listBoxCalendars.SelectedItem != null)
     {
         CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem;
         if (cal.xml != null)
         {
             FrmPeriodicidad dialogCalendar = new FrmPeriodicidad(cal.active);
             dialogCalendar.textBoxTitle.Text = cal.title;
             XmlDocument document = new XmlDocument();
             document.LoadXml(cal.xml);
             dialogCalendar.Document = document;
             DialogResult res = dialogCalendar.ShowDialog(this);
             if (res == DialogResult.OK)
             {
                 XmlDocument xmlCalendar = dialogCalendar.Document;
                 String      xml         = xmlCalendar.OuterXml;
                 String      title       = dialogCalendar.textBoxTitle.Text;
                 cal.title = title;
                 cal.xml   = xml;
                 try
                 {
                     this.Cursor = Cursors.WaitCursor;
                     OfficeApplication.OfficeDocumentProxy.updateCalendar(resourceInfo.page.site, cal);
                 }
                 catch (Exception ue)
                 {
                     OfficeApplication.WriteError(ue);
                 }
                 finally
                 {
                     this.Cursor = Cursors.Default;
                 }
             }
         }
     }
 }
Beispiel #19
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            FormCalendarList list = new FormCalendarList(pageInformation);
            DialogResult     res  = list.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                if (list.listBoxCalendars.SelectedItem != null)
                {
                    CalendarInfo calendar = (CalendarInfo)list.listBoxCalendars.SelectedItem;
                    bool         exists   = false;
                    int          count    = this.listViewCalendar.Items.Count;
                    for (int i = 0; i < count; i++)
                    {
                        CalendarItem calactual = (CalendarItem)this.listViewCalendar.Items[i];
                        if (calactual.CalendarInfo.id.Equals(calendar.id))
                        {
                            exists = true;
                            break;
                        }
                    }
                    if (!exists)
                    {
                        try
                        {
                            added.Add(calendar);
                        }
                        catch (Exception ue)
                        {
                            OfficeApplication.WriteError(ue);
                        }
                    }
                }
            }
            loadCalendars();
        }
Beispiel #20
0
        private void ContentProperties_ValidateStep(object sender, CancelEventArgs e)
        {
            FileInfo       zipFile        = null;
            String         title          = this.Wizard.Data[TitleAndDescription.TITLE].ToString();
            String         description    = this.Wizard.Data[TitleAndDescription.DESCRIPTION].ToString();
            String         categoryID     = this.Wizard.Data[SelectCategory.CATEGORY_ID].ToString();
            String         repositoryName = this.Wizard.Data[SelectCategory.REPOSITORY_ID].ToString();
            RepositoryInfo rep            = null;

            foreach (RepositoryInfo temp in OfficeApplication.OfficeApplicationProxy.getRepositories())
            {
                if (temp.name.Equals(repositoryName))
                {
                    rep = temp;
                }
            }
            ContentType contentType = (ContentType)this.Wizard.Data[TitleAndDescription.NODE_TYPE];

            PropertyInfo[] properties = OfficeApplication.OfficeDocumentProxy.getContentProperties(repositoryName, contentType.id);
            String[]       values     = this.propertyEditor1.Values;
            try
            {
                OfficeApplication.OfficeDocumentProxy.validateContentValues(repositoryName, properties, values, contentType.id);
            }
            catch (Exception ue)
            {
                OfficeApplication.WriteError(ue);
                MessageBox.Show(this, ue.Message, this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Wizard.SetProgressBarInit(3, 1, "Preparando documento para guardar...");
            try
            {
                zipFile = document.CreateZipFile();
                this.Wizard.SetProgressBarInit(3, 2, "Guardando documento en el sitio...");
                IOfficeDocument openOfficeDocument = OfficeDocument.OfficeDocumentProxy;
                openOfficeDocument.Attachments.Add(new Attachment(zipFile, zipFile.Name));
                String name      = document.FilePath.Name.Replace(document.DefaultExtension, document.PublicationExtension);
                String contentID = openOfficeDocument.save(title, description, repositoryName, categoryID, document.DocumentType.ToString().ToUpper(), contentType.id, name, properties, values);
                this.Wizard.Data[TitleAndDescription.CONTENT_ID] = contentID;
                document.SaveContentProperties(contentID, repositoryName);
                this.Wizard.SetProgressBarEnd();
                WebSiteInfo[] sites = OfficeApplication.OfficeApplicationProxy.getSites();
                if (sites != null && sites.Length > 0 && rep != null && rep.siteInfo != null)
                {
                    DialogResult res = MessageBox.Show(this, "¿Desea publicar el contenido en una página web?", this.Wizard.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (res == DialogResult.Yes)
                    {
                        WebSiteInfo webSiteInfo = new WebSiteInfo();
                        webSiteInfo.id    = rep.siteInfo.id;
                        webSiteInfo.title = rep.siteInfo.title;
                        document.Publish(title, description, webSiteInfo);
                    }
                }
                if (OfficeApplication.MenuListener != null)
                {
                    OfficeApplication.MenuListener.DocumentPublished();
                }
            }
            catch (Exception ue)
            {
                OfficeApplication.WriteError(ue);
                MessageBox.Show(this, "Error al tratar de publicar un documento " + ue.Message, this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (zipFile != null && zipFile.Exists)
                {
                    zipFile.Delete();
                }
            }
        }
Beispiel #21
0
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(this.textBoxTitle.Text.Trim()))
     {
         MessageBox.Show(this, "¡Debe indicar un título de contenido!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.textBoxTitle.Focus();
         return;
     }
     if (String.IsNullOrEmpty(this.textBoxDescription.Text.Trim()))
     {
         MessageBox.Show(this, "¡Debe indicar una descripción de contenido!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.textBoxTitle.Focus();
         return;
     }
     PropertyInfo[] props  = null;
     String[]       values = null;
     if (contentType != null)
     {
         props  = OfficeApplication.OfficeDocumentProxy.getContentProperties(repositoryName, contentType.id);
         values = this.propertyEditor1.Values;
         try
         {
             OfficeApplication.OfficeDocumentProxy.validateContentValues(repositoryName, props, values, this.contentType.id);
         }
         catch (Exception ue)
         {
             OfficeApplication.WriteError(ue);
             MessageBox.Show(this, ue.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             tabPageProperties.Focus();
             return;
         }
     }
     try
     {
         this.Cursor = Cursors.WaitCursor;
         String oldTitle = OfficeApplication.OfficeDocumentProxy.getTitle(repositoryName, contentID);
         if (!oldTitle.Equals(textBoxTitle.Text))
         {
             OfficeApplication.OfficeDocumentProxy.setTitle(repositoryName, contentID, this.textBoxTitle.Text);
         }
         String oldDescription = OfficeApplication.OfficeDocumentProxy.getDescription(repositoryName, contentID);
         if (!oldDescription.Equals(this.textBoxDescription.Text))
         {
             OfficeApplication.OfficeDocumentProxy.setDescription(repositoryName, contentID, this.textBoxDescription.Text);
         }
         if (props != null && values != null)
         {
             OfficeApplication.OfficeDocumentProxy.setContentProperties(repositoryName, contentID, props, values);
         }
         CategoryInfo oldCategory = OfficeApplication.OfficeDocumentProxy.getCategoryInfo(repositoryName, contentID);
         CategoryInfo newCategory = (CategoryInfo)this.comboBoxVersiones.SelectedItem;
         if (!oldCategory.Equals(newCategory))
         {
             OfficeApplication.OfficeDocumentProxy.changeCategory(repositoryName, contentID, newCategory.UDDI);
         }
         DateTime date = OfficeApplication.OfficeDocumentProxy.getLastUpdate(repositoryName, contentID);
         this.labelLasUpdate.Text = date.ToShortDateString() + " " + date.ToShortTimeString();
         loadPorlets();
         loadVersions();
         MessageBox.Show(this, "¡Se han realizado correctamente los cambios!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Beispiel #22
0
 private void toolStripButtonCreate_Click(object sender, EventArgs e)
 {
     if (this.treedir.SelectedNode != null)
     {
         if (this.treedir.SelectedNode.Tag is DirectoryInfo)
         {
             try
             {
                 DirectoryInfo dir      = (DirectoryInfo)this.treedir.SelectedNode.Tag;
                 int           iCarpeta = 1;
                 bool          continua = true;
                 while (continua)
                 {
                     TreeNode      nodenew = null;
                     DirectoryInfo dirnew  = new DirectoryInfo(dir.FullName + "\\Folder " + iCarpeta);
                     if (dirnew.Exists)
                     {
                         continua = true;
                         iCarpeta++;
                     }
                     else
                     {
                         continua = false;
                         dirnew.Create();
                         if (this.treedir.SelectedNode.Nodes.Count == 1 && this.treedir.SelectedNode.Nodes[0].Text == "")
                         {
                             this.treedir.SelectedNode.Expand();
                             foreach (TreeNode node in this.treedir.SelectedNode.Nodes)
                             {
                                 if (node.Tag is DirectoryInfo)
                                 {
                                     DirectoryInfo dirtest = (DirectoryInfo)node.Tag;
                                     if (dirtest.FullName == dirnew.FullName)
                                     {
                                         this.treedir.SelectedNode = node;
                                         nodenew = node;
                                     }
                                 }
                             }
                         }
                         else
                         {
                             nodenew                    = new TreeNode(dirnew.Name);
                             nodenew.Tag                = dirnew;
                             nodenew.ImageIndex         = 0;
                             nodenew.SelectedImageIndex = 0;
                             this.treedir.SelectedNode.Nodes.Add(nodenew);
                             this.treedir.SelectedNode = nodenew;
                         }
                         if (nodenew != null)
                         {
                             nodenew.BeginEdit();
                         }
                     }
                 }
             }
             catch (Exception err)
             {
                 OfficeApplication.WriteError(err);
                 MessageBox.Show(this, err.Message, "Crear folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
Beispiel #23
0
        /*private void toolStripButtonEdit_Click(object sender, EventArgs e)
         * {
         *  if (this.listViewCalendar.SelectedItems.Count > 0)
         *  {
         *      CalendarItem calendarItem = (CalendarItem)this.listViewCalendar.SelectedItems[0];
         *      CalendarInfo cal = calendarItem.CalendarInfo;
         *      FrmPeriodicidad frmPeriodicidad = new FrmPeriodicidad(cal.active);
         *      XmlDocument doc = new XmlDocument();
         *      doc.LoadXml(cal.xml);
         *      frmPeriodicidad.textBoxTitle.Text = cal.title;
         *      frmPeriodicidad.Document = doc;
         *      DialogResult res = frmPeriodicidad.ShowDialog(this);
         *      if (res == DialogResult.OK)
         *      {
         *          cal.xml = frmPeriodicidad.Document.OuterXml;
         *          calendarItem.Title = frmPeriodicidad.textBoxTitle.Text;
         *          calendarItem.Active = frmPeriodicidad.isActive();
         *      }
         *
         *  }
         * }*/

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.textBoxTitle.Text))
            {
                MessageBox.Show(this, "¡Debe indicar el título!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textBoxTitle.Focus();
                return;
            }
            if (String.IsNullOrEmpty(this.textBoxDescription.Text))
            {
                MessageBox.Show(this, "¡Debe indicar la descripción!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textBoxDescription.Focus();
                return;
            }
            DialogResult res = MessageBox.Show(this, "Se va a realizar los cambios de la información de publicación.\r\n¿Desea continuar?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                pageInformation.title       = this.textBoxTitle.Text;
                pageInformation.description = this.textBoxDescription.Text;
                pageInformation.version     = ((VersionInfo)this.comboBoxVersiones.SelectedItem).nameOfVersion;
                OfficeApplication.OfficeDocumentProxy.updatePorlet(pageInformation);
                if (this.checkBoxActive.Checked)
                {
                    if (this.pageInformation.active)
                    {
                        OfficeApplication.OfficeDocumentProxy.activateResource(pageInformation, this.checkBoxActive.Checked);
                    }
                    else
                    {
                        if (OfficeApplication.OfficeDocumentProxy.needsSendToPublish(pageInformation))
                        {
                            this.checkBoxActive.Checked = pageInformation.active;
                            res = MessageBox.Show(this, "El documento requiere una autorización para activarse" + "\r\n" + "¿Desea envíar a publicar el contenido?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (res == DialogResult.Yes)
                            {
                                FormSendToAutorize formSendToAutorize = new FormSendToAutorize(pageInformation);
                                formSendToAutorize.ShowDialog();
                                if (formSendToAutorize.DialogResult == DialogResult.OK)
                                {
                                    OfficeApplication.OfficeDocumentProxy.sendToAuthorize(pageInformation, formSendToAutorize.pflow, formSendToAutorize.textBoxMessage.Text);
                                    this.buttonSenttoAuthorize.Visible = false;
                                }
                                else
                                {
                                    MessageBox.Show(this, "El contenido no se activo, ya que se requiere una autorización", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "El contenido no se activo, ya que se requiere una autorización", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else if (OfficeApplication.OfficeDocumentProxy.isInFlow(pageInformation))
                        {
                            this.checkBoxActive.Checked = pageInformation.active;
                            MessageBox.Show(this, "El contenido se encuentra en proceso de ser autorizado.\r\nPara activarlo necesita terminar el proceso de autorización", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else if (OfficeApplication.OfficeDocumentProxy.isAuthorized(pageInformation))
                        {
                            OfficeApplication.OfficeDocumentProxy.activateResource(pageInformation, this.checkBoxActive.Checked);
                        }
                        else
                        {
                            this.checkBoxActive.Checked = pageInformation.active;
                            res = MessageBox.Show(this, "El contenido fue rechazado.\r\nPara activarlo necesita enviarlo a autorización de nuevo\r\n¿Desea enviarlo a autorización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (res == DialogResult.Yes)
                            {
                                FormSendToAutorize formSendToAutorize = new FormSendToAutorize(pageInformation);
                                formSendToAutorize.ShowDialog();
                                if (formSendToAutorize.DialogResult == DialogResult.OK)
                                {
                                    OfficeApplication.OfficeDocumentProxy.sendToAuthorize(pageInformation, formSendToAutorize.pflow, formSendToAutorize.textBoxMessage.Text);
                                }
                                else
                                {
                                    MessageBox.Show(this, "El contenido no se activo, ya que se requiere una autorización", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "El contenido no se activo, ya que se requiere una autorización", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
                else
                {
                    OfficeApplication.OfficeDocumentProxy.activateResource(pageInformation, this.checkBoxActive.Checked);
                }
                OfficeApplication.OfficeDocumentProxy.setTitlesOfWebPage(this.pageInformation.page, this.titleEditor1.Languages, this.titleEditor1.Titles);
                foreach (ListViewItem calendar in this.listViewCalendar.Items)
                {
                    CalendarItem calendarItem = (CalendarItem)calendar;
                    CalendarInfo cal          = (CalendarInfo)calendarItem.CalendarInfo;
                    bool         active       = cal.active;
                    OfficeApplication.OfficeDocumentProxy.insertCalendartoResource(pageInformation, cal);
                    added.Remove(cal);
                    OfficeApplication.OfficeDocumentProxy.activeCalendar(pageInformation, cal, active);
                }
                OfficeApplication.OfficeApplicationProxy.activePage(this.pageInformation.page, this.checkBoxActivePag.Checked);

                PropertyInfo[] properties = null;
                String[]       values     = null;

                properties = OfficeApplication.OfficeDocumentProxy.getResourceProperties(repositoryName, contentID);
                values     = this.propertyEditor1.Values;
                try
                {
                    OfficeApplication.OfficeDocumentProxy.validateViewValues(repositoryName, contentID, properties, values);
                }
                catch (Exception ue)
                {
                    OfficeApplication.WriteError(ue);
                    MessageBox.Show(this, ue.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabPageProperties.Focus();
                    return;
                }

                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (properties != null && values != null)
                    {
                        int i = 0;
                        foreach (PropertyInfo prop in properties)
                        {
                            String value = values[i];
                            OfficeApplication.OfficeDocumentProxy.setViewPropertyValue(this.pageInformation, prop, value);
                            i++;
                        }
                    }
                }
                catch (Exception ue)
                {
                    OfficeApplication.WriteError(ue);
                    MessageBox.Show(this, ue.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }

            this.DialogResult = DialogResult.OK;
        }