/// <summary> /// Handles the Click event of the menuSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> protected void MenuSave_Click(object sender, ImageClickEventArgs e) { var errors = new List <Pair>(); if (!this.SkipTesting.Checked) { errors = this.ValidateRobotsTxt(this.editorSource.Text); } if (errors.Count > 0) { var sb = new StringBuilder(ui.Text("errors", "xsltErrorText").Replace("XSLT", "robots.txt")); var format = ui.Text("errorHandling", "errorRegExp", new string[] { "{0}", "line {1}" }, null); sb.AppendLine("<ul>"); foreach (var error in errors) { sb.AppendLine("<li>").AppendFormat(format, error.Second, error.First).AppendLine("</li>"); } sb.AppendLine("</ul>"); // display the error message this.Feedback1.Text = sb.ToString(); this.Feedback1.type = Feedback.feedbacktype.error; this.Feedback1.Visible = true; } else { // save the file if there are no errors if (this.SaveRobotsTxt(this.editorSource.Text)) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "fileSavedHeader"), ui.Text("speechBubbles", "fileSavedText")); } else { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "fileErrorHeader"), ui.Text("speechBubbles", "fileErrorText")); } } }
protected void Publish(object sender, System.EventArgs e) { if (Page.IsValid) { if (_document.Level == 1 || new cms.businesslogic.web.Document(_document.Parent.Id).Published) { Trace.Warn("before d.publish"); if (_document.PublishWithResult(base.getUser())) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentPublishedHeader", null), ui.Text("speechBubbles", "editContentPublishedText", null)); library.UpdateDocumentCache(_document.Id); BusinessLogic.Log.Add(BusinessLogic.LogTypes.Publish, base.getUser(), _document.Id, ""); littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToString() + "<br/>"; if (base.getUser().GetPermissions(_document.Path).IndexOf("U") > -1) { UnPublish.Visible = true; } _documentHasPublishedVersion = _document.HasPublishedVersion(); updateLinks(); } else { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("error"), ui.Text("contentPublishedFailedByEvent")); } } else { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("error"), ui.Text("speechBubbles", "editContentPublishedFailedByParent")); } // page cache disabled... // cms.businesslogic.cache.Cache.ClearCacheObjectTypes("umbraco.page"); // Update links } }
protected override bool OnBubbleEvent(object source, EventArgs args) { bool handled = false; if (args is controls.SaveClickEventArgs) { var e = (controls.SaveClickEventArgs)args; if (e.Message == "Saved") { ClientTools.ShowSpeechBubble(e.IconType, ui.Text("contentTypeSavedHeader"), ""); BindTemplates(); } else { ClientTools.ShowSpeechBubble(e.IconType, e.Message, ""); } handled = true; } return(handled); }
void save_Click(object sender, EventArgs e) { foreach (TextBox t in languageFields) { //check for null but allow empty string! // http://issues.umbraco.org/issue/U4-1931 if (t.Text != null) { currentItem.setValue(int.Parse(t.ID), t.Text); } } labelChangeKey.Text = ""; // reset error text var newKey = boxChangeKey.Text; if (string.IsNullOrWhiteSpace(newKey) == false && newKey != currentItem.key) { // key already exists, save but inform if (Dictionary.DictionaryItem.hasKey(newKey) == true) { labelChangeKey.Text = ui.Text("dictionaryItem", "changeKeyError", newKey, currentUser); boxChangeKey.Text = currentItem.key; // reset key } else { // set the new key currentItem.setKey(newKey); // update the title with the new key Panel1.title.InnerHtml = ui.Text("editdictionary") + ": " + newKey; // sync the content tree var path = BuildPath(currentItem); ClientTools.SyncTree(path, true); } } txt.Text = "<br/><p>" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "</p><br/>"; ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dictionaryItemSaved"), ""); }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { store.Name = TxtName.Text; store.GeneralSettings.DefaultCountryId = long.Parse(DrpCountries.SelectedValue); store.GeneralSettings.DefaultVatGroupId = long.Parse(DrpVatGroups.SelectedValue); store.GeneralSettings.DefaultOrderStatusId = long.Parse(DrpOrderStatuses.SelectedValue); store.GeneralSettings.ConfirmationEmailTemplateId = DrpConfirmationEmail.Text.TryParse <long>(); store.GeneralSettings.PaymentInconsistencyEmailTemplateId = DrpPaymentInconsistencyEmail.Text.TryParse <long>(); store.GeneralSettings.PricesIsSpecifiedWithVat = ChkPricesIsSpecifiedWithVat.Checked; store.GeneralSettings.CookieTimeout = ChkPersistOrderId.Checked ? (TimeSpan?)TimeSpan.FromMinutes(TxtOrderPersistanceTimeout.Text.TryParse <int>() ?? 0) : null; store.OrderSettings.CartNumberPrefix = TxtCartNumberPrefix.Text; store.OrderSettings.OrderNumberPrefix = TxtOrderNumberPrefix.Text; store.ProductSettings.ProductPropertyAliases = TxtProductPropertyAliases.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.Trim()).ToList(); store.ProductSettings.ProductUniquenessPropertyAliases = TxtProductUniquenessPropertyAliases.Text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => i.Trim()).ToList(); store.ProductSettings.ProductVariantPropertyAlias = TxtProductVariantPropertyAlias.Text; store.ProductSettings.StockSharingStoreId = DrpStockSharingStore.SelectedValue.TryParse <long>(); if (store.ProductSettings.StockSharingStoreId != null && (store.ProductSettings.StockSharingStoreId == store.Id || currentLoggedInUserPermissions == null || !currentLoggedInUserPermissions.HasPermission(StoreSpecificPermissionType.AccessStore, store.ProductSettings.StockSharingStoreId.Value))) { store.ProductSettings.StockSharingStoreId = null; } store.GiftCardSettings.Length = TxtGiftCardLength.Text.TryParse <int>() ?? 0; store.GiftCardSettings.DaysValid = TxtGiftCardDaysValid.Text.TryParse <int>() ?? 0; store.GiftCardSettings.Prefix = TxtGiftCardPrefix.Text; store.GiftCardSettings.Suffix = TxtGiftCardSuffix.Text; store.UISettings.EditOrderUiFile = TemplateFileSelectorControl.SelectedValue; store.UISettings.AllowedFilesForClientRendering = TemplateFileSelectionListControl.Items.Cast <ListItem>().Where(i => i.Selected).Select(i => i.Value).ToList(); store.Save(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, StoreTerms.StoreSaved, string.Empty); } }
private void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { emailTemplate.Name = TxtName.Text; emailTemplate.Alias = TxtAlias.Text; emailTemplate.SendEmailToCustomer = ChkShouldClientReceiveEmail.Checked; string subject = TxtSubject.Text; string senderName = TxtSenderName.Text; string senderAddress = TxtSenderAddress.Text; string toAddresses = TxtToAddresses.Text; string ccAddresses = TxtCCAddresses.Text; string bccAddresses = TxtBCCAddresses.Text; string templateFile = TemplateFileSelectorControl.SelectedValue; AddOrUpdateEmailTemplateSettings(emailTemplate.Settings.SingleOrDefault(s => s.LanguageId == null), subject, senderName, senderAddress, toAddresses, ccAddresses, bccAddresses, templateFile); foreach (Language language in umbracoLanguages) { subject = CurrentTabView.FindControl <TextBox>("TxtSubject" + language.id).Text; senderName = CurrentTabView.FindControl <TextBox>("TxtSenderName" + language.id).Text; senderAddress = CurrentTabView.FindControl <TextBox>("TxtSenderAddress" + language.id).Text; toAddresses = CurrentTabView.FindControl <TextBox>("TxtToAddresses" + language.id).Text; ccAddresses = CurrentTabView.FindControl <TextBox>("TxtCCAddresses" + language.id).Text; bccAddresses = CurrentTabView.FindControl <TextBox>("TxtBCCAddresses" + language.id).Text; templateFile = CurrentTabView.FindControl <TemplateFileSelector>("TemplateFileSelectorControl" + language.id).SelectedValue; AddOrUpdateEmailTemplateSettings(emailTemplate.Settings.SingleOrDefault(s => s.LanguageId == language.id), subject, senderName, senderAddress, toAddresses, ccAddresses, bccAddresses, templateFile, language.id); } emailTemplate.Save(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.EmailTemplateSaved, string.Empty); } }
private void Save() { if (SaveConfigFile(TxtName.Text, EditorSource.Text)) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "fileSavedHeader"), ui.Text("speechBubbles", "fileSavedText")); } else { //If we have an error - most likely have a line number from the parser - highlight in the editor? if (ErrorLineNumber > 0) { //Figure how to write or inject some JS to highlight the line with the error... //highlightLine(ErrorLineNumber); var jsString = "console.log('Highlight Line Function(): " + ErrorLineNumber + "');" + "highlightLine(" + ErrorLineNumber + ");"; Page.ClientScript.RegisterStartupScript(this.GetType(), "errorLineJS", jsString, true); } ClientTools.ShowSpeechBubble(speechBubbleIcon.error, "Error Compiling", "There was an error compiling your file."); } }
protected override bool OnBubbleEvent(object source, EventArgs e) { if (e is controls.SaveClickEventArgs) { var sce = (controls.SaveClickEventArgs)e; if (sce.Message == "Saved") { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Mediatype saved", "Mediatype was successfully saved"); } else if (sce.Message.Contains("Tab")) { ClientTools.ShowSpeechBubble(sce.IconType, sce.Message, ""); } else { ClientTools.ShowSpeechBubble(sce.IconType, sce.Message, ""); } return(true); } return(false); }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { currency.Name = TxtName.Text; currency.IsoCode = TxtIsoCode.Text; currency.PricePropertyAlias = TxtPriceField.Text; currency.CultureName = CultureCodeSelectorControl.SelectedValue; currency.Symbol = ChkSpecialSymbol.Checked ? TxtSymbol.Text : null; currency.SymbolPlacement = ChkSpecialSymbol.Checked ? (CurrencySymbolPlacement?)Enum.Parse(typeof(CurrencySymbolPlacement), RdbListSymbolPlacement.SelectedValue) : null; List <long> allowedRegions = new List <long>(); foreach (ListItem listItem in ChkLstCountries.Items) { if (listItem.Selected) { allowedRegions.Add(long.Parse(listItem.Value)); } } currency.AllowedInFollowingCountries = allowedRegions; currency.Save(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.CurrencySaved, string.Empty); } }
protected void tmp_save(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) { foreach (uicontrols.TabPage tp in _contentControl.GetPanels()) { tp.ErrorControl.Visible = true; tp.ErrorHeader = ui.Text("errorHandling", "errorHeader"); tp.CloseCaption = ui.Text("close"); } } else { if (Page.IsPostBack) { // hide validation summaries foreach (uicontrols.TabPage tp in _contentControl.GetPanels()) { tp.ErrorControl.Visible = false; } } if (Member.InUmbracoMemberMode()) { _document.LoginName = MemberLoginNameTxt.Text; _document.Email = MemberEmail.Text; // Check if password should be changed string tempPassword = ((controls.passwordChanger)MemberPasswordTxt.Controls[0]).Password; if (tempPassword.Trim() != "") { _document.Password = tempPassword; } // Groups foreach (ListItem li in _memberGroups.Items) { if (("," + _memberGroups.Value + ",").IndexOf("," + li.Value + ",") > -1) { if (!Roles.IsUserInRole(_document.LoginName, li.Value)) { Roles.AddUserToRole(_document.LoginName, li.Value); } } else if (Roles.IsUserInRole(_document.LoginName, li.Value)) { Roles.RemoveUserFromRole(_document.LoginName, li.Value); } } //The value of the properties has been set on IData through IDataEditor in the ContentControl //so we need to 'retrieve' that value and set it on the property of the new IContent object. //NOTE This is a workaround for the legacy approach to saving values through the DataType instead of the Property //- (The DataType shouldn't be responsible for saving the value - especically directly to the db). foreach (var item in _contentControl.DataTypes) { _document.getProperty(item.Key).Value = item.Value.Data.Value; } // refresh cache _document.XmlGenerate(new System.Xml.XmlDocument()); _document.Save(); } else { _member.Email = MemberEmail.Text; if (Membership.Provider.EnablePasswordRetrieval) { string tempPassword = ((controls.passwordChanger)MemberPasswordTxt.Controls[0]).Password; if (tempPassword.Trim() != "") { _member.ChangePassword(_member.GetPassword(), tempPassword); } } Membership.UpdateUser(_member); // Groups foreach (ListItem li in _memberGroups.Items) { if (("," + _memberGroups.Value + ",").IndexOf("," + li.Value + ",") > -1) { if (!Roles.IsUserInRole(_member.UserName, li.Value)) { Roles.AddUserToRole(_member.UserName, li.Value); } } else if (Roles.IsUserInRole(_member.UserName, li.Value)) { Roles.RemoveUserFromRole(_member.UserName, li.Value); } } } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editMemberSaved", base.getUser()), ""); } }
/// <summary> /// Handles the Click event of the saveUser control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> private void saveUser_Click(object sender, ImageClickEventArgs e) { if (base.IsValid) { try { MembershipUser user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(u.LoginName, true); string tempPassword = ((controls.passwordChanger)passw.Controls[0]).Password; if (!string.IsNullOrEmpty(tempPassword.Trim())) { // make sure password is not empty if (string.IsNullOrEmpty(u.Password)) { u.Password = "******"; } user.ChangePassword(u.Password, tempPassword); } // Is it using the default membership provider if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider) { // Save user in membership provider UsersMembershipUser umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = uname.Text.Trim(); umbracoUser.Language = userLanguage.SelectedValue; umbracoUser.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser); // Save user details u.Email = email.Text.Trim(); u.Language = userLanguage.SelectedValue; } else { u.Name = uname.Text.Trim(); u.Language = userLanguage.SelectedValue; u.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); if (!(Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) { Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(user); } } u.LoginName = lname.Text; //u.StartNodeId = int.Parse(startNode.Value); int startNode; if (!int.TryParse(contentPicker.Value, out startNode)) { //set to default if nothing is choosen if (u.StartNodeId > 0) { startNode = u.StartNodeId; } else { startNode = -1; } } u.StartNodeId = startNode; u.Disabled = Disabled.Checked; u.DefaultToLiveEditing = DefaultToLiveEditing.Checked; u.NoConsole = NoConsole.Checked; //u.StartMediaId = int.Parse(mediaStartNode.Value); int mstartNode; if (!int.TryParse(mediaPicker.Value, out mstartNode)) { //set to default if nothing is choosen if (u.StartMediaId > 0) { mstartNode = u.StartMediaId; } else { mstartNode = -1; } } u.StartMediaId = mstartNode; u.clearApplications(); foreach (ListItem li in lapps.Items) { if (li.Selected) { u.addApplication(li.Value); } } u.Save(); // save data if (cName.Text != "") { Channel c; try { c = new Channel(u.Id); } catch { c = new Channel(); c.User = u; } c.Name = cName.Text; c.FullTree = cFulltree.Checked; c.StartNode = int.Parse(cContentPicker.Value); c.MediaFolder = int.Parse(cMediaPicker.Value); c.FieldCategoriesAlias = cCategories.SelectedValue; c.FieldDescriptionAlias = cDescription.SelectedValue; c.FieldExcerptAlias = cExcerpt.SelectedValue; c.DocumentTypeAlias = cDocumentType.SelectedValue; // c.MediaTypeAlias = Constants.Conventions.MediaTypes.Image; // [LK:2013-03-22] This was previously lowercase; unsure if using const will cause an issue. c.MediaTypeFileProperty = Constants.Conventions.Media.File; c.ImageSupport = true; c.Save(); } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editUserSaved", base.getUser()), ""); } catch (Exception ex) { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "editUserError", base.getUser()), ""); LogHelper.Error <EditUser>("Exception", ex); } } else { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "editUserError", base.getUser()), ""); } }
void Save_Click(object sender, EventArgs e) { Page.Validate(); ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadMacros>().Tree.Alias) .SyncTree("-1,init," + _macro.Id.ToInvariantString(), true); //true forces the reload var tempMacroAssembly = macroAssembly.Text; var tempMacroType = macroType.Text; var tempCachePeriod = cachePeriod.Text; if (tempCachePeriod == string.Empty) { tempCachePeriod = "0"; } if (tempMacroAssembly == string.Empty && macroUserControl.Text != string.Empty) { tempMacroType = macroUserControl.Text; } SetMacroValuesFromPostBack(_macro, Convert.ToInt32(tempCachePeriod), tempMacroAssembly, tempMacroType); // save elements // this is oh so completely broken var aliases = new Dictionary <string, string>(); foreach (RepeaterItem item in macroProperties.Items) { var macroPropertyId = (HtmlInputHidden)item.FindControl("macroPropertyID"); var macroElementName = (TextBox)item.FindControl("macroPropertyName"); var macroElementAlias = (TextBox)item.FindControl("macroPropertyAlias"); var macroElementSortOrder = (TextBox)item.FindControl("macroPropertySortOrder"); var macroElementType = (DropDownList)item.FindControl("macroPropertyType"); var prop = _macro.Properties.Single(x => x.Id == int.Parse(macroPropertyId.Value)); var sortOrder = 0; int.TryParse(macroElementSortOrder.Text, out sortOrder); var alias = macroElementAlias.Text.Trim(); if (prop.Alias != alias) // changing the alias { // use a temp alias to avoid collision if eg swapping aliases var tempAlias = Guid.NewGuid().ToString("N").Substring(0, 8); aliases[tempAlias] = alias; alias = tempAlias; } _macro.Properties.UpdateProperty( prop.Alias, macroElementName.Text.Trim(), sortOrder, macroElementType.SelectedValue, alias); } // now apply the real aliases, should not collide foreach (var kvp in aliases) { _macro.Properties.UpdateProperty(kvp.Key, newAlias: kvp.Value); } Services.MacroService.Save(_macro); ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Macro saved", ""); // Check for assemblyBrowser if (tempMacroType.IndexOf(".ascx", StringComparison.Ordinal) > 0) { assemblyBrowserUserControl.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text + "¯oID=" + Request.QueryString["macroID"] + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty) { assemblyBrowser.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text + "¯oID=" + Request.QueryString["macroID"] + "&type=" + macroType.Text + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } macroPropertyBind(); }
protected void Save(object sender, EventArgs e) { // error handling test if (Page.IsValid == false) { foreach (uicontrols.TabPage tp in _cControl.GetPanels()) { tp.ErrorControl.Visible = true; tp.ErrorHeader = ui.Text("errorHandling", "errorButDataWasSaved"); tp.CloseCaption = ui.Text("close"); } } else if (Page.IsPostBack) { // hide validation summaries foreach (uicontrols.TabPage tp in _cControl.GetPanels()) { tp.ErrorControl.Visible = false; } } // Update name if it has not changed and is not empty if (_cControl.NameTxt != null && _document.Text != _cControl.NameTxt.Text && !_cControl.NameTxt.Text.IsNullOrWhiteSpace()) { //_refreshTree = true; _document.Text = _cControl.NameTxt.Text; //newName.Text = _document.Text; } if (_dpRelease.DateTime > new DateTime(1753, 1, 1) && _dpRelease.DateTime < new DateTime(9999, 12, 31)) { _document.ReleaseDate = _dpRelease.DateTime; } else { _document.ReleaseDate = new DateTime(1, 1, 1, 0, 0, 0); } if (_dpExpire.DateTime > new DateTime(1753, 1, 1) && _dpExpire.DateTime < new DateTime(9999, 12, 31)) { _document.ExpireDate = _dpExpire.DateTime; } else { _document.ExpireDate = new DateTime(1, 1, 1, 0, 0, 0); } // Update default template if (_ddlDefaultTemplate.SelectedIndex > 0) { _document.Template = int.Parse(_ddlDefaultTemplate.SelectedValue); } else { if (new DocumentType(_document.ContentType.Id).allowedTemplates.Length == 0) { _document.RemoveTemplate(); } } //The value of the properties has been set on IData through IDataEditor in the ContentControl //so we need to 'retrieve' that value and set it on the property of the new IContent object. //NOTE This is a workaround for the legacy approach to saving values through the DataType instead of the Property //- (The DataType shouldn't be responsible for saving the value - especically directly to the db). foreach (var item in _cControl.DataTypes) { _document.getProperty(item.Key).Value = item.Value.Data.Value; } // Run Handler BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionUpdate.Instance); _document.Save(); // Update the update date _dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString(); if (_cControl.DoesPublish == false) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSavedHeader", null), ui.Text("speechBubbles", "editContentSavedText", null)); } ClientTools.SyncTree(_document.Path, true); }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { paymentMethod.Name = TxtName.Text; paymentMethod.Alias = TxtDictionaryItemName.Text; paymentMethod.Sku = TxtSku.Text; paymentMethod.VatGroupId = DrpVatGroups.SelectedValue.TryParse <long>(); paymentMethod.ImageIdentifier = CPImage.Value; paymentMethod.AllowedInFollowingCountries = new List <long>(); paymentMethod.AllowedInFollowingCountryRegions = new List <long>(); //Add default prices LoopPrices(LvDefaultCurrencies); //Run through countries foreach (ListViewDataItem item in LvCountries.Items) { long countryId = long.Parse(item.FindControl <HiddenField>("HdfId").Value); //Check to see if the country has been selected if (item.FindControl <CheckBox>("ChkIsSupported").Checked) { paymentMethod.AllowedInFollowingCountries.Add(countryId); } LoopPrices(item.FindControl <ListView>("LvCurrencies"), countryId); //Run through country regions ListView lvCountryRegions = item.FindControl <ListView>("LvCountryRegions"); foreach (ListViewDataItem item2 in lvCountryRegions.Items) { long countryRegionId = long.Parse(item2.FindControl <HiddenField>("HdfId").Value); //Check to see if the country has been selected if (item2.FindControl <CheckBox>("ChkIsSupported").Checked) { paymentMethod.AllowedInFollowingCountryRegions.Add(countryRegionId); } LoopPrices(item2.FindControl <ListView>("LvCurrencies"), countryId, countryRegionId); } } paymentMethod.PaymentProviderAlias = DrpPaymentProviders.SelectedValue; paymentMethod.AllowsRetrievalOfPaymentStatus = ChkAllowsGetStatus.Checked; paymentMethod.AllowsCapturingOfPayment = ChkAllowsCapturePayment.Checked; paymentMethod.AllowsRefundOfPayment = ChkAllowsRefundPayment.Checked; paymentMethod.AllowsCancellationOfPayment = ChkAllowsCancelPayment.Checked; //Reset settings var tempSettings = GetTempSettings(null).ToList(); ViewState["PaymentMethodSettings"] = null; foreach (Language language in umbracoLanguages) { tempSettings.AddRange(GetTempSettings(language.id).ToList()); ViewState["PaymentMethodSettings" + language.id] = null; } paymentMethod.Settings = tempSettings.Select(tempSetting => new PaymentMethodSetting(tempSetting.Key, tempSetting.Value, tempSetting.UmbracoLanguageId) { Id = tempSetting.Id }).ToList(); //Save the paymentmethod paymentMethod.Save(); LoadCurrenciesAndCountries(); //Reload settings LoadPaymentMethodSettings(); //Show confirming speech bubble in umbraco ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.PaymentMethodSaved, string.Empty); } }
/// <summary> /// Handles the Click event of the saveUser control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> private void SaveUser_Click(object sender, EventArgs e) { if (base.IsValid) { try { var membershipUser = BackOfficeProvider.GetUser(u.LoginName, false); if (membershipUser == null) { throw new ProviderException("Could not find user in the membership provider with login name " + u.LoginName); } var passwordChangerControl = (passwordChanger)passw.Controls[0]; var passwordChangerValidator = (CustomValidator)passw.Controls[1].Controls[0].Controls[0]; //perform the changing password logic ChangePassword(passwordChangerControl, membershipUser, passwordChangerValidator); //update the membership provider UpdateMembershipProvider(membershipUser); //update the Umbraco user properties - even though we are updating some of these properties in the membership provider that is // ok since the membership provider might be storing these details someplace totally different! But we want to keep our UI in sync. u.Name = uname.Text.Trim(); u.Language = userLanguage.SelectedValue; u.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); u.Email = email.Text.Trim(); u.LoginName = lname.Text; u.Disabled = Disabled.Checked; u.NoConsole = NoConsole.Checked; int startNode; if (int.TryParse(contentPicker.Value, out startNode) == false) { //set to default if nothing is choosen if (u.StartNodeId > 0) { startNode = u.StartNodeId; } else { startNode = -1; } } u.StartNodeId = startNode; int mstartNode; if (int.TryParse(mediaPicker.Value, out mstartNode) == false) { //set to default if nothing is choosen if (u.StartMediaId > 0) { mstartNode = u.StartMediaId; } else { mstartNode = -1; } } u.StartMediaId = mstartNode; u.ClearApplications(); foreach (ListItem li in lapps.Items) { if (li.Selected) { u.AddApplication(li.Value); } } u.Save(); // save data if (cName.Text != "") { Channel c; try { c = new Channel(u.Id); } catch { c = new Channel(); c.User = u; } c.Name = cName.Text; c.FullTree = cFulltree.Checked; c.StartNode = int.Parse(cContentPicker.Value); c.MediaFolder = int.Parse(cMediaPicker.Value); c.FieldCategoriesAlias = cCategories.SelectedValue; c.FieldDescriptionAlias = cDescription.SelectedValue; c.FieldExcerptAlias = cExcerpt.SelectedValue; c.DocumentTypeAlias = cDocumentType.SelectedValue; // c.MediaTypeAlias = Constants.Conventions.MediaTypes.Image; // [LK:2013-03-22] This was previously lowercase; unsure if using const will cause an issue. c.MediaTypeFileProperty = Constants.Conventions.Media.File; c.ImageSupport = true; c.Save(); } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editUserSaved", UmbracoUser), ""); } catch (Exception ex) { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "editUserError", UmbracoUser), ""); LogHelper.Error <EditUser>("Exception", ex); } } else { ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("speechBubbles", "editUserError", UmbracoUser), ""); } }
protected void Save(object sender, System.EventArgs e) { // error handling test if (!Page.IsValid) { foreach (uicontrols.TabPage tp in cControl.GetPanels()) { tp.ErrorControl.Visible = true; tp.ErrorHeader = ui.Text("errorHandling", "errorButDataWasSaved"); tp.CloseCaption = ui.Text("close"); } } else if (Page.IsPostBack) { // hide validation summaries foreach (uicontrols.TabPage tp in cControl.GetPanels()) { tp.ErrorControl.Visible = false; } } //Audit trail... BusinessLogic.Log.Add(BusinessLogic.LogTypes.Save, base.getUser(), _document.Id, ""); // Update name if (_document.Text != cControl.NameTxt.Text) { //_refreshTree = true; _document.Text = cControl.NameTxt.Text; //newName.Text = _document.Text; } if (dpRelease.DateTime > new DateTime(1753, 1, 1) && dpRelease.DateTime < new DateTime(9999, 12, 31)) { _document.ReleaseDate = dpRelease.DateTime; } else { _document.ReleaseDate = new DateTime(1, 1, 1, 0, 0, 0); } if (dpExpire.DateTime > new DateTime(1753, 1, 1) && dpExpire.DateTime < new DateTime(9999, 12, 31)) { _document.ExpireDate = dpExpire.DateTime; } else { _document.ExpireDate = new DateTime(1, 1, 1, 0, 0, 0); } // Update default template if (ddlDefaultTemplate.SelectedIndex > 0) { _document.Template = int.Parse(ddlDefaultTemplate.SelectedValue); } else { if (new DocumentType(_document.ContentType.Id).allowedTemplates.Length == 0) { _document.RemoveTemplate(); } } // Run Handler BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionUpdate.Instance); _document.Save(); // Update the update date dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString(); if (!cControl.DoesPublish) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSavedHeader", null), ui.Text("speechBubbles", "editContentSavedText", null)); } ClientTools.SyncTree(_document.Path, true); }
void Save_Click(object sender, EventArgs e) { Page.Validate(); ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadMacros>().Tree.Alias) .SyncTree("-1,init," + _macro.Id.ToInvariantString(), true); //true forces the reload var tempMacroAssembly = macroAssembly.Text; var tempMacroType = macroType.Text; var tempCachePeriod = cachePeriod.Text; if (tempCachePeriod == string.Empty) { tempCachePeriod = "0"; } if (tempMacroAssembly == string.Empty && macroUserControl.Text != string.Empty) { tempMacroType = macroUserControl.Text; } SetMacroValuesFromPostBack(_macro, Convert.ToInt32(tempCachePeriod), tempMacroAssembly, tempMacroType); // Save elements var sort = 0; foreach (RepeaterItem item in macroProperties.Items) { var macroPropertyId = (HtmlInputHidden)item.FindControl("macroPropertyID"); var macroElementName = (TextBox)item.FindControl("macroPropertyName"); var macroElementAlias = (TextBox)item.FindControl("macroPropertyAlias"); var macroElementType = (DropDownList)item.FindControl("macroPropertyType"); var prop = _macro.Properties.Single(x => x.Id == int.Parse(macroPropertyId.Value)); _macro.Properties.UpdateProperty( prop.Alias, macroElementName.Text.Trim(), sort, macroElementType.SelectedValue, macroElementAlias.Text.Trim()); sort++; } Services.MacroService.Save(_macro); ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Macro saved", ""); // Check for assemblyBrowser if (tempMacroType.IndexOf(".ascx", StringComparison.Ordinal) > 0) { assemblyBrowserUserControl.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text + "¯oID=" + Request.QueryString["macroID"] + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty) { assemblyBrowser.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text + "¯oID=" + Request.QueryString["macroID"] + "&type=" + macroType.Text + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } }
protected void Page_Load(object sender, EventArgs e) { m_macro = new Macro(Convert.ToInt32(Request.QueryString["macroID"])); if (!IsPostBack) { ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadMacros>().Tree.Alias) .SyncTree("-1,init," + m_macro.Id.ToString(), false); string tempMacroAssembly = m_macro.Assembly ?? ""; string tempMacroType = m_macro.Type ?? ""; PopulateFieldsOnLoad(m_macro, tempMacroAssembly, tempMacroType); // Check for assemblyBrowser if (tempMacroType.IndexOf(".ascx") > 0) { assemblyBrowserUserControl.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('" + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text + "¯oID=" + m_macro.Id.ToString() + "', 'Browse Properties', true, 475,500); return false;\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty) { assemblyBrowser.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('" + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text + "¯oID=" + m_macro.Id.ToString() + "&type=" + macroType.Text + "', 'Browse Properties', true, 475,500); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } // Load elements from macro macroPropertyBind(); // Load xslt files from default dir PopulateXsltFiles(); // Load python files from default dir PopulatePythonFiles(); // Load usercontrols PopulateUserControls(IOHelper.MapPath(SystemDirectories.UserControls)); userControlList.Items.Insert(0, new ListItem("Browse usercontrols on server...", string.Empty)); } else { int macroID = Convert.ToInt32(Request.QueryString["macroID"]); string tempMacroAssembly = macroAssembly.Text; string tempMacroType = macroType.Text; string tempCachePeriod = cachePeriod.Text; if (tempCachePeriod == string.Empty) { tempCachePeriod = "0"; } if (tempMacroAssembly == string.Empty && macroUserControl.Text != string.Empty) { tempMacroType = macroUserControl.Text; } SetMacroValuesFromPostBack(m_macro, Convert.ToInt32(tempCachePeriod), tempMacroAssembly, tempMacroType); m_macro.Save(); // Save elements foreach (RepeaterItem item in macroProperties.Items) { HtmlInputHidden macroPropertyID = (HtmlInputHidden)item.FindControl("macroPropertyID"); TextBox macroElementName = (TextBox)item.FindControl("macroPropertyName"); TextBox macroElementAlias = (TextBox)item.FindControl("macroPropertyAlias"); CheckBox macroElementShow = (CheckBox)item.FindControl("macroPropertyHidden"); DropDownList macroElementType = (DropDownList)item.FindControl("macroPropertyType"); MacroProperty mp = new MacroProperty(int.Parse(macroPropertyID.Value)); mp.Type = new MacroPropertyType(int.Parse(macroElementType.SelectedValue)); mp.Alias = macroElementAlias.Text; mp.Name = macroElementName.Text; mp.Save(); } // Flush macro from cache! if (UmbracoSettings.UseDistributedCalls) { dispatcher.Refresh( new Guid("7B1E683C-5F34-43dd-803D-9699EA1E98CA"), macroID); } else { macro.GetMacro(macroID).removeFromCache(); } ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Macro saved", ""); // Check for assemblyBrowser if (tempMacroType.IndexOf(".ascx") > 0) { assemblyBrowserUserControl.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text + "¯oID=" + Request.QueryString["macroID"] + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty) { assemblyBrowser.Controls.Add( new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text + "¯oID=" + Request.QueryString["macroID"] + "&type=" + macroType.Text + "', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>")); } } }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { if (permissions == null) { permissions = new Permissions(HttpContext.Current.Request.QueryString["id"], false); } if (ChkAccessSecurity.Checked) { permissions.GeneralPermissions |= GeneralPermissionType.AccessSecurity; } else { if (permissions.GeneralPermissions.HasFlag(GeneralPermissionType.AccessSecurity)) { permissions.GeneralPermissions ^= GeneralPermissionType.AccessSecurity; } } if (ChkAccessLicenses.Checked) { permissions.GeneralPermissions |= GeneralPermissionType.AccessLicenses; } else { if (permissions.GeneralPermissions.HasFlag(GeneralPermissionType.AccessLicenses)) { permissions.GeneralPermissions ^= GeneralPermissionType.AccessLicenses; } } if (ChkCreateAndDeleteStore.Checked) { permissions.GeneralPermissions |= GeneralPermissionType.CreateAndDeleteStore; } else { if (permissions.GeneralPermissions.HasFlag(GeneralPermissionType.CreateAndDeleteStore)) { permissions.GeneralPermissions ^= GeneralPermissionType.CreateAndDeleteStore; } } foreach (ListViewDataItem item in LvStores.Items) { long storeId = long.Parse(item.FindControl <HiddenField>("HdfId").Value); if (!permissions.StoreSpecificPermissions.ContainsKey(storeId)) { permissions.StoreSpecificPermissions.Add(storeId, StoreSpecificPermissionType.None); } if (item.FindControl <CheckBox>("ChkAccessStore").Checked) { permissions.StoreSpecificPermissions[storeId] |= StoreSpecificPermissionType.AccessStore; } else { if (permissions.StoreSpecificPermissions[storeId].HasFlag(StoreSpecificPermissionType.AccessStore)) { permissions.StoreSpecificPermissions[storeId] ^= StoreSpecificPermissionType.AccessStore; } } if (item.FindControl <CheckBox>("ChkMarketing").Checked) { permissions.StoreSpecificPermissions[storeId] |= StoreSpecificPermissionType.AccessMarketing; } else { if (permissions.StoreSpecificPermissions[storeId].HasFlag(StoreSpecificPermissionType.AccessMarketing)) { permissions.StoreSpecificPermissions[storeId] ^= StoreSpecificPermissionType.AccessMarketing; } } if (item.FindControl <CheckBox>("ChkAccessSettings").Checked) { permissions.StoreSpecificPermissions[storeId] |= StoreSpecificPermissionType.AccessSettings; } else { if (permissions.StoreSpecificPermissions[storeId].HasFlag(StoreSpecificPermissionType.AccessSettings)) { permissions.StoreSpecificPermissions[storeId] ^= StoreSpecificPermissionType.AccessSettings; } } if (permissions.StoreSpecificPermissions[storeId] == StoreSpecificPermissionType.None) { permissions.StoreSpecificPermissions.Remove(storeId); } } permissions.Save(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.UserPermissionsSaved, string.Empty); } }
void Save_Click(object sender, EventArgs e) { Page.Validate(); ClientTools .SyncTree("-1," + _macro.Id.ToInvariantString(), true); //true forces the reload var tempCachePeriod = cachePeriod.Text; if (tempCachePeriod == string.Empty) { tempCachePeriod = "0"; } SetMacroValuesFromPostBack(_macro, Convert.ToInt32(tempCachePeriod), macroUserControl.Text, SelectedPartialView.Text); // save elements // this is oh so completely broken var aliases = new Dictionary <string, string>(); foreach (RepeaterItem item in macroProperties.Items) { var macroPropertyId = (HtmlInputHidden)item.FindControl("macroPropertyID"); var macroElementName = (TextBox)item.FindControl("macroPropertyName"); var macroElementAlias = (TextBox)item.FindControl("macroPropertyAlias"); var macroElementSortOrder = (TextBox)item.FindControl("macroPropertySortOrder"); var macroElementType = (DropDownList)item.FindControl("macroPropertyType"); var prop = _macro.Properties.Values.Single(x => x.Id == int.Parse(macroPropertyId.Value)); var sortOrder = 0; int.TryParse(macroElementSortOrder.Text, out sortOrder); var alias = macroElementAlias.Text.Trim(); if (prop.Alias != alias) // changing the alias { // use a temp alias to avoid collision if eg swapping aliases var tempAlias = Guid.NewGuid().ToString("N").Substring(0, 8); aliases[tempAlias] = alias; alias = tempAlias; } _macro.Properties.UpdateProperty( prop.Alias, macroElementName.Text.Trim(), sortOrder, macroElementType.SelectedValue, alias); } // now apply the real aliases, should not collide foreach (var kvp in aliases) { _macro.Properties.UpdateProperty(kvp.Key, newAlias: kvp.Value); } Services.MacroService.Save(_macro); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, "Macro saved", ""); MacroPropertyBind(); }