private void SelectWebPageID_ValidateStep(object sender, CancelEventArgs e) { if (String.IsNullOrEmpty(textBoxID.Text)) { textBoxID.Focus(); MessageBox.Show(this, "¡Debe indicar un identificador!", this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } IOfficeApplication openOfficeApplication = OfficeApplication.OfficeApplicationProxy; String title = this.Wizard.Data[TitleAndDescription.TITLE].ToString(); String description = this.Wizard.Data[TitleAndDescription.DESCRIPTION].ToString(); WebPageInfo parent = (WebPageInfo)this.Wizard.Data[SelectSiteCreatePage.WEB_PAGE]; try { this.Cursor = Cursors.WaitCursor; openOfficeApplication.createPage(parent, this.textBoxID.Text, title, description); MessageBox.Show(this, "¡Se ha creado la página web correctamente!", this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ue) { MessageBox.Show(this, "¡Existe un error al crear la página web!\r\nDetalle: " + ue.Message, this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
void btnAddExpert_Click(object sender, EventArgs e) { if ( (this.txtFriendlyUrl.Text.Length > 0) && (this.txtRealUrl.Text.Length > 0) ) { if (WebPageInfo.IsPhysicalWebPage("~/" + txtFriendlyUrl.Text)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text)) { this.lblError.Text = Resource.FriendlyUrlDuplicateWarning; return; } FriendlyUrl url = new FriendlyUrl(); url.SiteId = siteSettings.SiteId; url.SiteGuid = siteSettings.SiteGuid; url.Url = this.txtFriendlyUrl.Text; url.RealUrl = this.txtRealUrl.Text; url.Save(); WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage; } }
private void SelectSite_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage == null) { MessageBox.Show(this, "¡Debe indicar una página web", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } else { WebPageInfo webpage = selectWebPage.SelectedWebPage.WebPageInfo; Uri address = OfficeApplication.OfficeApplicationProxy.WebAddress; String host; if (address.Port == 80) { host = address.Host; } else { host = address.Host + ":" + address.Port; } Uri uri = new Uri(address.Scheme + "://" + host + webpage.url); String text = this.Wizard.Data[SelectTitle.TITLE].ToString(); document.InsertLink(uri.ToString(), text); } }
void selectWebPage_onAddNode(TreeNode node) { if (node is WebPageTreeNode) { WebPageInfo page = ((WebPageTreeNode)node).WebPageInfo; if (!OfficeApplication.OfficeApplicationProxy.canCreatePage(page)) { node.ForeColor = Color.Gray; } } }
void selectWebPage_onAddNode(TreeNode node) { if (node is WebPageTreeNode) { WebPageInfo page = ((WebPageTreeNode)node).WebPageInfo; if (!OfficeApplication.OfficeDocumentProxy.canPublishToResourceContent(type.ToString(), page)) { node.ForeColor = Color.Gray; } } }
public WebPageInfoViewModel(WebPageInfo webPageInfo = null) : base(webPageInfo ?? new WebPageInfo()) { Locator = null; if (webPageInfo != null) { UrlRegexString = webPageInfo.UrlRegexString; DefaultUrl = webPageInfo.DefaultUrl; } }
public HomeWebPageTreeNode(WebPageInfo webPageInfo) : base(webPageInfo) { if (this.WebPageInfo.active) { this.ImageIndex = 0; this.SelectedImageIndex = 0; } else { this.ImageIndex = 3; this.SelectedImageIndex = 3; } }
public void addHomePage() { this.Nodes.Clear(); WebPageInfo home = OfficeApplication.OfficeApplicationProxy.getHomePage(webSiteInfo); HomeWebPageTreeNode homeNode = new HomeWebPageTreeNode(home); this.Nodes.Add(homeNode); if (AddNode != null) { AddNode(homeNode); } homeNode.onAddNode += new NodeEvent(homeNode_onAddNode); }
private void SelectSite_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage != null) { WebPageInfo webpage = selectWebPage.SelectedWebPage.WebPageInfo; this.Wizard.Data[WEB_PAGE] = webpage; OfficeApplication.OfficeDocumentProxy.changeResourceOfWebPage(this.resourceInfo, webpage); this.Wizard.Close(); } else { MessageBox.Show(this, "¡Debe indicar una página web", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } }
private void btnAddFriendlyUrl_Click(object sender, EventArgs e) { if (this.txtFriendlyUrl.Text.Length > 0) { if (WebPageInfo.IsPhysicalWebPage("~/" + txtFriendlyUrl.Text)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text)) { this.lblError.Text = Resource.FriendlyUrlDuplicateWarning; return; } if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text.ToLower())) { this.lblError.Text = Resource.FriendlyUrlDuplicateWarning; return; } FriendlyUrl url = new FriendlyUrl(); url.SiteId = siteSettings.SiteId; url.SiteGuid = siteSettings.SiteGuid; int pageId = -1; if (int.TryParse(ddPages.SelectedValue, out pageId)) { if (pageId > -1) { PageSettings page = new PageSettings(siteSettings.SiteId, pageId); url.PageGuid = page.PageGuid; } } url.Url = this.txtFriendlyUrl.Text; url.RealUrl = "Default.aspx?pageid=" + ddPages.SelectedValue; url.Save(); WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage; } }
private void buttonSearch_Click(object sender, EventArgs e) { if (this.comboBoxRepositories.SelectedItem != null && this.comboBoxRepositories.SelectedItem != null && comboBoxType.SelectedItem != null) { String rep = this.comboBoxRepositories.SelectedItem.ToString(); String category = ((CategoryInfo)this.comboBoxCategories.SelectedItem).UDDI; String type = ((ContentType)this.comboBoxType.SelectedItem).id; this.listView1.Items.Clear(); this.Cursor = Cursors.WaitCursor; WebPageInfo page = null; if (this.textBox_WebPage.Tag != null && this.textBox_WebPage.Tag is WebPageInfo) { page = this.textBox_WebPage.Tag as WebPageInfo; } ContentInfo[] contents = null; if (page == null) { contents = OfficeApplication.OfficeApplicationProxy.search(rep, this.textBoxTitle.Text, this.textBoxDescription.Text, category, type, this.documentType.ToString().ToUpper()); } else { contents = OfficeApplication.OfficeApplicationProxy.search(rep, this.textBoxTitle.Text, this.textBoxDescription.Text, category, type, this.documentType.ToString().ToUpper(), page); } this.Cursor = Cursors.Default; if (contents.Length == 0) { MessageBox.Show(this, "No se encontraron contenidos coincidentes", "Búsqueda de contenido", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, "Se encontraron " + contents.Length + " contenidos coincidentes", this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } foreach (ContentInfo content in contents) { ListViewItem item = new ListViewItem(content.title); item.Tag = content; item.SubItems.Add(content.descripcion); String date = String.Format(OfficeApplication.iso8601dateFormat, content.created); item.SubItems.Add(date); item.SubItems.Add(content.categoryTitle); this.listView1.Items.Add(item); } this.tabControl1.SelectTab(1); } }
private void SelectSiteToOpen_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage != null) { WebPageInfo webpage = selectWebPage.SelectedWebPage.WebPageInfo; if (!OfficeApplication.OfficeDocumentProxy.canPublishToResourceContent(type.ToString(), webpage)) { MessageBox.Show(this, "No tiene permisos para abrir contenidos en esta página", this.Wizard.Title, MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } this.Wizard.Data[WEB_PAGE] = webpage; this.Wizard.Close(); } else { MessageBox.Show(this, "¡Debe indicar una página web", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } }
public WebPageTreeNode(WebPageInfo webPageInfo) { this.webPageInfo = webPageInfo; this.Text = webPageInfo.title; this.Tag = webPageInfo; if (webPageInfo.active) { this.ImageIndex = 2; this.SelectedImageIndex = 2; } else { this.ImageIndex = 4; this.SelectedImageIndex = 4; } this.Tag = webPageInfo; this.ToolTipText = webPageInfo.description; if (webPageInfo.childs > 0) { TreeNode dummy = new TreeNode(""); Nodes.Add(dummy); } }
private void SelectSite_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage == null) { MessageBox.Show(this, "¡Debe indicar una página web!", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } else { WebPageInfo parent = selectWebPage.SelectedWebPage.WebPageInfo; if (OfficeApplication.OfficeApplicationProxy.canCreatePage(parent)) { this.Wizard.Data[SelectSiteCreatePage.WEB_PAGE] = parent; return; } else { MessageBox.Show(this, "¡No tiene permisos para crear páginas web!", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } } }
private void SendResponse(HttpContext context) { if (context == null) { return; } context.Response.ContentType = "application/xml"; Encoding encoding = new UTF8Encoding(); XmlTextWriter xmlTextWriter = new XmlTextWriter(context.Response.OutputStream, encoding); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("DATA"); string warning = string.Empty; if (context.Request.Params.Get("pn") != null) { String pageName = context.Request.Params.Get("pn"); if (WebConfigSettings.AppendDateToBlogUrls) { pageName += "-" + DateTime.UtcNow.AddHours(timeOffset).ToString("yyyy-MM-dd"); } SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); if (siteSettings != null) { String friendlyUrl = SiteUtils.SuggestFriendlyUrl(pageName, siteSettings); if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl)) { warning = BlogResources.BlogUrlConflictWithPhysicalPageError; } xmlTextWriter.WriteStartElement("fn"); xmlTextWriter.WriteString("~/" + friendlyUrl); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteStartElement("wn"); xmlTextWriter.WriteString(warning); xmlTextWriter.WriteEndElement(); } } else { if (context.Request.Params.Get("cu") != null) { String enteredUrl = context.Server.UrlDecode(context.Request.Params.Get("cu")); if (WebPageInfo.IsPhysicalWebPage(enteredUrl)) { warning = BlogResources.BlogUrlConflictWithPhysicalPageError; } xmlTextWriter.WriteStartElement("wn"); xmlTextWriter.WriteString(warning); xmlTextWriter.WriteEndElement(); } } //end of document xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndDocument(); xmlTextWriter.Close(); //Response.End(); }
public override async void OnNavigatedTo(NavigationParameters parameters) { var responseMessage = await _fitMeetRestService.GetPageDetailAsync(pageName); DataSource = responseMessage?.Output?.Response; }
public WebPageInfoVertex(string id, WebPageInfo _wpi) { ID = id; WebPageInfo = _wpi; }
protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "application/xml"; Encoding encoding = new UTF8Encoding(); XmlTextWriter xmlTextWriter = new XmlTextWriter(Response.OutputStream, encoding); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("DATA"); string warning = string.Empty; if (Request.Params.Get("pn") != null) { String pageName = Request.Params.Get("pn"); SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); if (siteSettings != null) { String friendlyUrl = SiteUtils.SuggestFriendlyUrl(pageName, siteSettings); if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl)) { warning = Resource.PageSettingsPhysicalUrlWarning; } xmlTextWriter.WriteStartElement("fn"); xmlTextWriter.WriteString("~/" + friendlyUrl); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteStartElement("wn"); xmlTextWriter.WriteString(warning); xmlTextWriter.WriteEndElement(); } } else { if (Request.Params.Get("cu") != null) { String enteredUrl = HttpContext.Current.Server.UrlDecode(Request.Params.Get("cu")); if (WebPageInfo.IsPhysicalWebPage(enteredUrl)) { warning = Resource.PageSettingsPhysicalUrlWarning; } xmlTextWriter.WriteStartElement("wn"); xmlTextWriter.WriteString(warning); xmlTextWriter.WriteEndElement(); } } //end of document xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndDocument(); xmlTextWriter.Close(); //Response.End(); }
protected virtual void SelectSitePublish_ValidateStep(object sender, CancelEventArgs e) { if (selectWebPage.SelectedWebPage != null) { WebPageInfo webpage = selectWebPage.SelectedWebPage.WebPageInfo; if (!OfficeApplication.OfficeDocumentProxy.canPublishToResourceContent(type.ToString(), webpage)) { MessageBox.Show(this, "No tiene permisos para publicar en esta página", this.Wizard.Title, MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } this.Wizard.Data[WEB_PAGE] = webpage; String version = this.Wizard.Data[SelectVersionToOpen.VERSION].ToString(); string repositoryName = this.Wizard.Data[SelectVersionToPublish.REPOSITORY_ID_NAME].ToString(); string contentID = this.Wizard.Data[SelectVersionToPublish.CONTENT_ID_NAME].ToString(); if (m_title == null || m_description == null) { m_title = this.Wizard.Data[TitleAndDescription.TITLE].ToString(); m_description = this.Wizard.Data[TitleAndDescription.DESCRIPTION].ToString(); } PropertyInfo[] properties = OfficeApplication.OfficeDocumentProxy.getResourceProperties(document.reporitoryID, document.contentID); String[] values = null; if (properties == null || properties.Length == 0) { values = new String[0]; } else { values = (String[])this.Wizard.Data[ViewProperties.VIEW_PROPERTIES_VALUES]; } ResourceInfo portletInfo = OfficeApplication.OfficeDocumentProxy.publishToResourceContent(repositoryName, contentID, version, m_title, m_description, webpage, properties, values); if (OfficeApplication.OfficeDocumentProxy.needsSendToPublish(portletInfo)) { DialogResult res = MessageBox.Show(this, "Para activar el contenido, se necesita que sea autorizado primero\r\n¿Desea enviar el contenido a autorizar?", this.Wizard.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { FormSendToAutorize formSendToAutorize = new FormSendToAutorize(portletInfo); formSendToAutorize.ShowDialog(); if (formSendToAutorize.DialogResult == DialogResult.OK) { OfficeApplication.OfficeDocumentProxy.sendToAuthorize(portletInfo, formSendToAutorize.pflow, formSendToAutorize.textBoxMessage.Text); } } else { MessageBox.Show(this, "Para activar el contenido deberá enviar primero esta publicación a autorizar", this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { DialogResult res = MessageBox.Show(this, "¿Desea activar el contenido?", this.Wizard.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { OfficeApplication.OfficeDocumentProxy.activateResource(portletInfo, true); MessageBox.Show(this, "Se ha publicado correctamente el contenido en la página web", this.Wizard.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } this.Wizard.Close(); } else { MessageBox.Show(this, "¡Debe indicar una página web", "Seleccionar página web", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } }
private void dlUrlMap_ItemCommand(object sender, DataListCommandEventArgs e) { int urlID = Convert.ToInt32(dlUrlMap.DataKeys[e.Item.ItemIndex]); FriendlyUrl friendlyUrl = new FriendlyUrl(urlID); switch (e.CommandName) { case "edit": dlUrlMap.EditItemIndex = e.Item.ItemIndex; Control c = e.Item.FindControl("ddPagesEdit"); DropDownList dd = null; if ((c != null) && (pageList != null)) { dd = (DropDownList)c; dd.DataSource = pageList; dd.DataBind(); } PopulateControls(); if (dd != null) { String selection = ParsePageId(friendlyUrl.RealUrl); if (selection.Length > 0) { ListItem listItem = dd.Items.FindByValue(selection); if (listItem != null) { dd.ClearSelection(); listItem.Selected = true; } } } break; case "apply": TextBox txtItemFriendlyUrl = (TextBox)e.Item.FindControl("txtItemFriendlyUrl"); if (txtItemFriendlyUrl.Text.Length > 0) { Control cEdit = e.Item.FindControl("ddPagesEdit"); if (cEdit != null) { DropDownList ddEdit = (DropDownList)cEdit; friendlyUrl.Url = txtItemFriendlyUrl.Text; if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } int pageId = -1; if (int.TryParse(ddEdit.SelectedValue, out pageId)) { if (pageId > -1) { PageSettings page = new PageSettings(siteSettings.SiteId, pageId); friendlyUrl.PageGuid = page.PageGuid; } } friendlyUrl.RealUrl = "Default.aspx?pageid=" + ddEdit.SelectedValue; friendlyUrl.Save(); } WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage; } break; case "applymanual": if ( ( (((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text.Length > 0) ) && ( (((TextBox)e.Item.FindControl("txtItemRealUrl")).Text.Length > 0) ) ) { friendlyUrl.Url = ((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text; if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } friendlyUrl.RealUrl = ((TextBox)e.Item.FindControl("txtItemRealUrl")).Text; friendlyUrl.PageGuid = Guid.Empty; friendlyUrl.Save(); WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage; } break; case "delete": FriendlyUrl.DeleteUrl(urlID); WebUtils.SetupRedirect(this, Request.RawUrl); break; case "cancel": WebUtils.SetupRedirect(this, Request.RawUrl); break; } }
public static WebElementInfo CreateInfoFromModel(WebElementInfoViewModel model, CombinedWebElementInfo parent = null) { WebElementInfo info = null; switch (model) { case WebElementWithReferenceViewModel wr: { var innerInfo = CreateInfoFromModel(wr.ReferencedWebElement); switch (wr.ElementType) { case WebElementTypes.Frame: var f = new FrameWebElementInfo(); f.TreePathToInnerElement = wr.ReferenceBreadString; innerInfo.Parent = f; f.InnerElement = innerInfo; info = f; break; case WebElementTypes.Reference: var r = new WebElementReference(); r.TreePathToReferencedElement = wr.ReferenceBreadString; innerInfo.Parent = r; r.ReferencedElement = innerInfo; info = r; break; default: throw new Exception($"Unexpected WebElementWithReferenceViewModel ElementType: {wr.ElementType}"); } } break; case CombinedWebElementInfoViewModel combinedModel: { CombinedWebElementInfo combined = null; switch (combinedModel.ElementType) { case WebElementTypes.Context: combined = new WebContextInfo(); break; case WebElementTypes.DropDown: combined = new DropDownElementInfo(); break; case WebElementTypes.RadioGroup: combined = new RadioGroupElementInfo(); break; case WebElementTypes.Directory: combined = new WebElementsDirectory(); break; case WebElementTypes.Control: combined = new CombinedWebElementInfo(); break; case WebElementTypes.Page: { var wpModel = model as WebPageInfoViewModel; var wpInfo = new WebPageInfo(); wpInfo.DefaultUrl = wpModel.DefaultUrl; wpInfo.UrlRegexString = wpModel.UrlRegexString; combined = wpInfo; } break; default: throw new Exception($"Unexpected combinedModel.ElementType: {combinedModel.ElementType}"); } info = combined; combined.Elements = combinedModel.Elements ?.Select(em => CreateInfoFromModel(em, combined)) .ToList(); } break; default: info = new WebElementInfo(); break; } info.Name = model.Name; info.Description = model.Description; info.InnerKey = model.InnerKey; info.Tags = model.Tags?.ToList(); info.Locator = model.Locator?.GetLocatorInfo(); info.IsKey = model.IsKey; info.Parent = parent; return(info); }