protected void sbmt_Click(object sender, EventArgs e) { if (Page.IsValid) { int nodeId; if (int.TryParse(Request.QueryString["nodeId"], out nodeId) == false) { nodeId = -1; } try { var returnUrl = LegacyDialogHandler.Create( new HttpContextWrapper(Context), Security.CurrentUser, Request.GetItemAsString("nodeType"), nodeId, rename.Text.Trim(), Request.QueryString.AsEnumerable().ToDictionary(x => x.Key, x => (object)x.Value)); ClientTools .ChangeContentFrameUrl(returnUrl) .ReloadActionNode(false, true) .CloseModalWindow(); } catch (Exception ex) { CustomValidation.ErrorMessage = "* " + ex.Message; CustomValidation.IsValid = false; } } }
//PPH Handle doctype copies.. private void HandleDocumentTypeCopy() { var documentType = new DocumentType(int.Parse(helper.Request("id"))); //Documentype exists.. create new doc type... var alias = rename.Text; var newDocumentType = DocumentType.MakeNew(base.getUser(), alias.Replace("'", "''")); newDocumentType.IconUrl = documentType.IconUrl; newDocumentType.Thumbnail = documentType.Thumbnail; newDocumentType.Description = documentType.Description; newDocumentType.allowedTemplates = documentType.allowedTemplates; newDocumentType.DefaultTemplate = documentType.DefaultTemplate; newDocumentType.AllowedChildContentTypeIDs = documentType.AllowedChildContentTypeIDs; newDocumentType.AllowAtRoot = documentType.AllowAtRoot; newDocumentType.MasterContentType = int.Parse(masterType.SelectedValue); var oldNewTabIds = new Hashtable(); foreach (var tab in documentType.getVirtualTabs.Where(t => t.ContentType == documentType.Id)) { int tabId = newDocumentType.AddVirtualTab(tab.Caption); oldNewTabIds.Add(tab.Id, tabId); } foreach (var propertyType in documentType.PropertyTypes.Where(p => p.ContentTypeId == documentType.Id)) { var newPropertyType = cms.businesslogic.propertytype.PropertyType.MakeNew(propertyType.DataTypeDefinition, newDocumentType, propertyType.Name, propertyType.Alias); newPropertyType.ValidationRegExp = propertyType.ValidationRegExp; newPropertyType.SortOrder = propertyType.SortOrder; newPropertyType.Mandatory = propertyType.Mandatory; newPropertyType.Description = propertyType.Description; if (propertyType.TabId > 0 && oldNewTabIds[propertyType.TabId] != null) { var newTabId = (int)oldNewTabIds[propertyType.TabId]; newPropertyType.TabId = newTabId; } } var returnUrl = string.Format("{0}/settings/editNodeTypeNew.aspx?id={1}", SystemDirectories.Umbraco, newDocumentType.Id); newDocumentType.Save(); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); }
protected void BtnFinalize_Click(object sender, EventArgs e) { if (Page.IsValid) { string transactionId = TxtTransactionId.Text; decimal?amount = TxtAmount.Text.ParseToDecimal(); if (amount != null && !string.IsNullOrEmpty(transactionId) && order.PaymentInformation.PaymentMethodId != null) { PaymentMethodService.Instance.Get(order.StoreId, order.PaymentInformation.PaymentMethodId.Value).FinalizeOrder(order, amount.Value, transactionId); if (order.IsFinalized) { ClientTools.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditOrder) + "?storeId=" + order.StoreId + "&id=" + order.Id).CloseModalWindow(); } } } }
protected void doRollback_Click(object sender, System.EventArgs e) { if (allVersions.SelectedValue.Trim() != "") { Document d = new Document(int.Parse(helper.Request("nodeId"))); d.RollBack(new Guid(allVersions.SelectedValue), base.getUser()); BusinessLogic.Log.Add(BusinessLogic.LogTypes.RollBack, base.getUser(), d.Id, "Version rolled back to revision '" + allVersions.SelectedValue + "'"); Document rollback = new Document(d.Id, new Guid(allVersions.SelectedValue)); feedBackMsg.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; string[] vars = { rollback.Text, rollback.VersionDate.ToLongDateString() }; feedBackMsg.Text = ui.Text("rollback", "documentRolledBack", vars, new global::umbraco.BusinessLogic.User(0)) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>"; diffPanel.Height = new Unit(200, UnitType.Pixel); ClientTools.ChangeContentFrameUrl("editContent.aspx?Id=" + d.Id.ToString()); } }
/// <summary> /// Add a new relation type into the database, and redirects to it's editing page. /// </summary> /// <param name="sender">expects the addButton control</param> /// <param name="e">expects EventArgs for addButton</param> protected void AddButton_Click(object sender, EventArgs e) { if (Page.IsValid) { var newRelationTypeAlias = this.aliasTextBox.Text.Trim(); var relationService = Services.RelationService; var relationType = new RelationType(new Guid(this.childDropDownList.SelectedValue), new Guid(this.parentDropDownList.SelectedValue), newRelationTypeAlias, this.descriptionTextBox.Text) { IsBidirectional = this.dualRadioButtonList.SelectedValue == "1" }; relationService.Save(relationType); var newRelationTypeId = relationService.GetRelationTypeByAlias(newRelationTypeAlias).Id; ClientTools.ChangeContentFrameUrl("developer/RelationTypes/EditRelationType.aspx?id=" + newRelationTypeId).CloseModalWindow().ChildNodeCreated(); } }
private void HandleDocumentTypeCopy() { var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; var contentType = contentTypeService.GetContentType( int.Parse(Request.GetItemAsString("id"))); var alias = rename.Text.Replace("'", "''"); var clone = ((Umbraco.Core.Models.ContentType)contentType).Clone(alias); contentTypeService.Save(clone); var returnUrl = string.Format("{0}/settings/editNodeTypeNew.aspx?id={1}", SystemDirectories.Umbraco, clone.Id); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); }
/// <summary> /// Add a new relation type into the database, and redirects to it's editing page. /// </summary> /// <param name="sender">expects the addButton control</param> /// <param name="e">expects EventArgs for addButton</param> protected void AddButton_Click(object sender, EventArgs e) { if (Page.IsValid) { var newRelationTypeAlias = this.aliasTextBox.Text.Trim(); uQuery.SqlHelper.ExecuteNonQuery( string.Format("INSERT INTO umbracoRelationType ([dual], parentObjectType, childObjectType, name, alias) VALUES ({0}, '{1}', '{2}', '{3}', '{4}')", this.dualRadioButtonList.SelectedValue, uQuery.GetUmbracoObjectType(this.parentDropDownList.SelectedValue).GetGuid().ToString(), uQuery.GetUmbracoObjectType(this.childDropDownList.SelectedValue).GetGuid().ToString(), this.descriptionTextBox.Text, newRelationTypeAlias)); var newRelationTypeId = uQuery.SqlHelper.ExecuteScalar <int>("SELECT id FROM umbracoRelationType WHERE alias = '" + newRelationTypeAlias + "'"); // base.speechBubble(BasePage.speechBubbleIcon.success, "New Relation Type", "relation type created"); ClientTools.ChangeContentFrameUrl("/umbraco/developer/RelationTypes/EditRelationType.aspx?id=" + newRelationTypeId.ToString()).CloseModalWindow().ChildNodeCreated(); } }
private void HandleDocumentTypeCopy() { var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; var contentType = contentTypeService.GetContentType( int.Parse(Request.GetItemAsString("id"))); //set the master //http://issues.umbraco.org/issue/U4-2843 //http://issues.umbraco.org/issue/U4-3552 var parentId = int.Parse(masterType.SelectedValue); var alias = rename.Text.Trim().Replace("'", "''"); var clone = contentTypeService.Copy(contentType, alias, rename.Text.Trim(), parentId); var returnUrl = string.Format("{0}/settings/editNodeTypeNew.aspx?id={1}", SystemDirectories.Umbraco, clone.Id); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); }
//PPH Handle doctype copies.. private void HandleDocumentTypeCopy() { cms.businesslogic.web.DocumentType eDt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Documentype exists.. create new doc type... if (eDt != null) { string Alias = rename.Text; cms.businesslogic.web.DocumentType dt = cms.businesslogic.web.DocumentType.MakeNew(base.getUser(), Alias.Replace("'", "''")); dt.IconUrl = eDt.IconUrl; dt.Thumbnail = eDt.Thumbnail; dt.Description = eDt.Description; dt.allowedTemplates = eDt.allowedTemplates; dt.DefaultTemplate = eDt.DefaultTemplate; dt.AllowedChildContentTypeIDs = eDt.AllowedChildContentTypeIDs; dt.MasterContentType = int.Parse(masterType.SelectedValue); Hashtable oldNewTabIds = new Hashtable(); foreach (cms.businesslogic.web.DocumentType.TabI tab in eDt.getVirtualTabs.ToList()) { if (tab.ContentType == eDt.Id) { int tId = dt.AddVirtualTab(tab.Caption); oldNewTabIds.Add(tab.Id, tId); } } foreach (cms.businesslogic.propertytype.PropertyType pt in eDt.PropertyTypes) { if (pt.ContentTypeId == eDt.Id) { cms.businesslogic.propertytype.PropertyType nPt = umbraco.cms.businesslogic.propertytype.PropertyType.MakeNew(pt.DataTypeDefinition, dt, pt.Name, pt.Alias); nPt.ValidationRegExp = pt.ValidationRegExp; nPt.SortOrder = pt.SortOrder; nPt.Mandatory = pt.Mandatory; nPt.Description = pt.Description; if (pt.TabId > 0 && oldNewTabIds[pt.TabId] != null) { int newTabId = (int)oldNewTabIds[pt.TabId]; nPt.TabId = newTabId; } } } string returnUrl = SystemDirectories.Umbraco + "/settings/EditNodeTypeNew.aspx?id=" + dt.Id.ToString(); dt.Save(); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); } }