protected void Page_Load(object sender, EventArgs e) { pnlUmbraco.Text = umbraco.ui.Text("usertype", base.getUser()); ImageButton save = pnlUmbraco.Menu.NewImageButton(); save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; save.Click += new ImageClickEventHandler(save_Click); save.ID = "save"; pp_alias.Text = umbraco.ui.Text("usertype", base.getUser()) + " " + umbraco.ui.Text("alias", base.getUser()); pp_name.Text = umbraco.ui.Text("usertype", base.getUser()) + " " + umbraco.ui.Text("name", base.getUser()); pp_rights.Text = umbraco.ui.Text("default", base.getUser()) + " " + umbraco.ui.Text("rights", base.getUser()); //ensure we have a query string if (string.IsNullOrEmpty(Request.QueryString["id"])) { return; } //ensuer it is an integer if (!int.TryParse(Request.QueryString["id"], out m_userTypeID)) { return; } if (!IsPostBack) { BindActions(); ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <UserTypes>().Tree.Alias) .SyncTree(m_userTypeID.ToString(), false); } }
protected void Page_Load(object sender, EventArgs e) { _stylesheetproperty = new businesslogic.web.StylesheetProperty(int.Parse(Request.QueryString["id"])); Panel1.Text = ui.Text("stylesheet", "editstylesheetproperty", getUser()); if (IsPostBack == false) { _stylesheetproperty.RefreshFromFile(); NameTxt.Text = _stylesheetproperty.Text; Content.Text = _stylesheetproperty.value; AliasTxt.Text = _stylesheetproperty.Alias; ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheetProperty>().Tree.Alias) .SyncTree(Request.GetItemAsString("id"), false); } else { //true = force reload from server on post back ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheetProperty>().Tree.Alias) .SyncTree(Request.GetItemAsString("id"), true); } ImageButton bt = Panel1.Menu.NewImageButton(); bt.Click += SaveClick; bt.ImageUrl = UmbracoPath + "/images/editor/save.gif"; bt.AlternateText = ui.Text("save"); bt.ID = "save"; SetupPreView(); }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { vatGroup.Name = TxtName.Text; vatGroup.DefaultVatRate = new VatRate((TxtVAT.Text.ParseToDecimal() ?? 0M) / 100M); vatGroup.CountrySpecificVatRates.Clear(); vatGroup.CountryRegionSpecificVatRates.Clear(); foreach (ListViewDataItem item in LvCountrySpecificVatRates.Items) { decimal?vatRate = (item.FindControl <TextBox>("TxtValue")).Text.ParseToDecimal(); if (vatRate != null) { vatGroup.CountrySpecificVatRates.Add(long.Parse((item.FindControl <HiddenField>("HdfKey")).Value), new VatRate(vatRate.Value / 100M)); } //Get country region specific vat rates foreach (ListViewDataItem item2 in item.FindControl <ListView>("LvCountryRegionSpecificVatRates").Items) { decimal?vatRate2 = (item2.FindControl <TextBox>("TxtValue")).Text.ParseToDecimal(); if (vatRate2 != null) { vatGroup.CountryRegionSpecificVatRates.Add(long.Parse((item2.FindControl <HiddenField>("HdfKey")).Value), new VatRate(vatRate2.Value / 100M)); } } } vatGroup.Save(); ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.VatGroupSaved, string.Empty); } }
protected void Page_Load(object sender, EventArgs e) { Panel1.Text = ui.Text("stylesheet", "editstylesheet", UmbracoUser); pp_name.Text = ui.Text("name", UmbracoUser); pp_path.Text = ui.Text("path", UmbracoUser); var stylesheet = Services.FileService.GetStylesheetByName(filename); if (stylesheet == null) // not found { throw new FileNotFoundException("Could not find file '" + filename + "'."); } lttPath.Text = "<a id=\"" + lttPath.ClientID + "\" target=\"_blank\" href=\"" + stylesheet.VirtualPath + "\">" + stylesheet.VirtualPath + "</a>"; editorSource.Text = stylesheet.Content; TreeSyncPath = DeepLink.GetTreePathFromFilePath(filename).TrimEnd(".css"); // name derives from path, without the .css extension, clean for xss NameTxt.Text = stylesheet.Path.TrimEnd(".css").CleanForXss('\\', '/'); if (IsPostBack == false) { ClientTools .SetActiveTreeType(Constants.Trees.Stylesheets) .SyncTree(TreeSyncPath, false); } }
private void UpdateTreeNode() { var clientTools = new ClientTools(this.Page); clientTools .SyncTree(cType.Path, true); }
protected void Page_Load(object sender, System.EventArgs e) { _memberGroupId = !String.IsNullOrEmpty(memberGroupName.Value) ? memberGroupName.Value : Request.QueryString["id"]; if (!IsPostBack) { ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadMemberGroups>().Tree.Alias) .SyncTree(_memberGroupId, false); } if (!Member.IsUsingUmbracoRoles()) { NameTxt.Enabled = false; save.Enabled = false; NameTxt.Text = _memberGroupId + " (not editable from umbraco)"; } else { _memberGroup = MemberGroup.GetByName(_memberGroupId); if (!IsPostBack) { NameTxt.Text = _memberGroup.Text; } } }
/// <summary> /// Handles the SaveAndPublish event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Sets the document's properties and if the page is valid continues to publish it, otherwise just saves a revision. /// </remarks> protected void Publish(object sender, EventArgs e) { //update UI and set document properties PerformSaveLogic(); //the business logic here will check to see if the doc can actually be published and will return the // appropriate result so we can display the correct error messages (or success). var savePublishResult = _document.SaveAndPublishWithResult(UmbracoUser); ShowMessageForStatus(savePublishResult.Result); if (savePublishResult.Success) { _littPublishStatus.Text = string.Format("{0}: {1}<br/>", ui.Text("content", "lastPublished", UmbracoUser), _document.VersionDate.ToString()); if (UmbracoUser.GetPermissions(_document.Path).IndexOf("U") > -1) { _unPublish.Visible = true; } _documentHasPublishedVersion = _document.Content.HasPublishedVersion(); } ClientTools.SyncTree(_document.Path, true); }
protected void Page_Load(object sender, System.EventArgs e) { currentItem = new cms.businesslogic.Dictionary.DictionaryItem(int.Parse(Request.QueryString["id"])); // Put user code to initialize the page here Panel1.hasMenu = true; Panel1.Text = ui.Text("editdictionary") + ": " + currentItem.key; uicontrols.Pane p = new uicontrols.Pane(); ImageButton save = Panel1.Menu.NewImageButton(); save.Click += new System.Web.UI.ImageClickEventHandler(save_click); save.AlternateText = ui.Text("save"); save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; save.ID = "save"; Literal txt = new Literal(); txt.Text = "<p>" + ui.Text("dictionaryItem", "description", currentItem.key, base.getUser()) + "</p><br/>"; p.addProperty(txt); foreach (cms.businesslogic.language.Language l in cms.businesslogic.language.Language.getAll) { /* * uicontrols.TabPage tp = tbv.NewTabPage(l.CultureAlias); * tp.HasMenu = false; * languageTextbox tmp = new languageTextbox(l.id); * * if (!IsPostBack) * tmp.Text = currentItem.Value(l.id); * * languageFields.Add(tmp); * tp.Controls.Add(tmp); */ TextBox languageBox = new TextBox(); languageBox.TextMode = TextBoxMode.MultiLine; languageBox.ID = l.id.ToString(); languageBox.CssClass = "umbEditorTextFieldMultiple"; if (!IsPostBack) { languageBox.Text = currentItem.Value(l.id); } languageFields.Add(languageBox); p.addProperty(l.FriendlyName, languageBox); } if (!IsPostBack) { ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadDictionary>().Tree.Alias) .SyncTree(helper.Request("id"), false); } Panel1.Controls.Add(p); }
/// <summary> /// Handles the Save event for the ContentControl. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// This will set the document's properties and persist a new document revision /// </remarks> protected void Save(object sender, EventArgs e) { //NOTE: This is only here because we have to keep backwards compatibility with events in the ContentControl. // see: http://issues.umbraco.org/issue/U4-1660 // in this case both Save and SaveAndPublish will fire when we are publishing but we only want to handle that once, // so if this is actually doing a publish, we'll exit and rely on the SaveAndPublish handler to do all the work. if (_cControl.DoesPublish) { return; } //update UI and set document properties PerformSaveLogic(); //persist the document _document.Save(); // Run Handler BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionUpdate.Instance); ClientTools.ShowSpeechBubble( speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSavedHeader", null), ui.Text("speechBubbles", "editContentSavedText", null)); ClientTools.SyncTree(_document.Path, true); }
protected void BtnFinalize_Click(object sender, EventArgs e) { if (!_order.IsFinalized) { ClientTools.OpenModalWindow(WebUtils.GetPageUrl(Constants.Pages.FinalizeOrder) + "?storeId=" + _order.StoreId + "&id=" + _order.Id, PaymentProviderTerms.Finalize, true, 420, 270, 0, 0, string.Empty, string.Empty); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ClientTools.SyncTree(_media.Path, false); } }
protected void Save(object sender, System.EventArgs e) { // error handling test if (!Page.IsValid) { foreach (uicontrols.TabPage tp in tmp.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 tmp.GetPanels()) { tp.ErrorControl.Visible = false; } } _media.Save(); this.updateDateLiteral.Text = _media.VersionDate.ToShortDateString() + " " + _media.VersionDate.ToShortTimeString(); this.UpdateMediaFileLinksLiteral(); _media.XmlGenerate(new XmlDocument()); ClientTools.SyncTree(_media.Path, true); }
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; } } }
public static bool CanLoot(this HarvestableObject obj, LocalPlayerCharacterView localPlayer) { if (!obj.IsHarvestable()) { return(false); } bool requiresTool = obj.RequiresTool(); EquipmentItemProxy tool = obj.GetTool(localPlayer); if (requiresTool && !tool) { return(false); } //TODO: Implement converters GuiDurableItemProxy toolProxy = ClientTools.GetStackProxy(tool).GuiItemProxy_Internal as a9h; int durability = toolProxy ? ClientTools.SomeCalculationWithUnfloatyFloats(tool.GetUnfloatyFloat(), toolProxy.GetUnfloatyFloat()) : -1; if (requiresTool && durability <= 10) { return(false); } return(true); }
protected void Page_Load(object sender, System.EventArgs e) { if (!m_ContentId.HasValue) { return; } if (!CheckUserValidation()) { return; } // clear preview cookie // zb-00004 #29956 : refactor cookies names & handling StateHelper.Cookies.Preview.Clear(); if (!IsPostBack) { BusinessLogic.Log.Add(BusinessLogic.LogTypes.Open, base.getUser(), _document.Id, ""); ClientTools.SyncTree(_document.Path, false); } jsIds.Text = "var umbPageId = " + _document.Id.ToString() + ";\nvar umbVersionId = '" + _document.Version.ToString() + "';\n"; }
protected override bool OnBubbleEvent(object source, EventArgs e) { if (e is controls.SaveClickEventArgs) { controls.SaveClickEventArgs sce = (controls.SaveClickEventArgs)e; if (sce.Message == "Saved") { int mtid = 0; ClientTools.ShowSpeechBubble(speechBubbleIcon.save, "Mediatype saved", "Mediatype was successfully saved"); if (int.TryParse(Request.QueryString["id"], out mtid)) { new cms.businesslogic.media.MediaType(mtid).Save(); } } else if (sce.Message.Contains("Tab")) { ClientTools.ShowSpeechBubble(sce.IconType, sce.Message, ""); } else { ClientTools.ShowSpeechBubble(sce.IconType, sce.Message, ""); } return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["id"])) { return; } CheckUser(Request.QueryString["id"]); ImageButton save = pnlUmbraco.Menu.NewImageButton(); save.ID = "btnSave"; save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; save.OnClientClick = "SavePermissions(); return false;"; nodePermissions.UserID = Convert.ToInt32(Request.QueryString["id"]); pnlUmbraco.Text = ui.Text("user", "userPermissions"); pnl1.Text = ui.Text("user", "permissionSelectPages"); if (!IsPostBack) { ClientTools cTools = new ClientTools(this); cTools.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <Trees.UserPermissions>().Tree.Alias) .SyncTree(Request.QueryString["id"], false); } }
protected override bool OnBubbleEvent(object source, EventArgs args) { bool handled = false; if (args is controls.SaveClickEventArgs) { controls.SaveClickEventArgs e = (controls.SaveClickEventArgs)args; if (e.Message == "Saved") { saveExtras(); ClientTools .ShowSpeechBubble(speechBubbleIcon.save, "Memebertype saved", "") .SyncTree(dt.Id.ToString(), true); } else { ClientTools .ShowSpeechBubble(e.IconType, e.Message, "") .SyncTree(dt.Id.ToString(), true); } handled = true; } setupExtraEditorControls(); return(handled); }
protected override bool OnBubbleEvent(object source, EventArgs args) { var handled = false; var eventArgs = args as SaveClickEventArgs; if (eventArgs != null) { var e = eventArgs; if (e.Message == "Saved") { SetupExtraEditorControls(); ClientTools .ShowSpeechBubble(speechBubbleIcon.save, "Membertype saved", "") .SyncTree(_memberType.Id.ToString(CultureInfo.InvariantCulture), true); } else { ClientTools .ShowSpeechBubble(e.IconType, e.Message, "") .SyncTree(_memberType.Id.ToString(CultureInfo.InvariantCulture), true); } handled = true; } return(handled); }
protected void Page_Load(object sender, System.EventArgs e) { stylesheetproperty = new cms.businesslogic.web.StylesheetProperty(int.Parse(Request.QueryString["id"])); Panel1.Text = ui.Text("stylesheet", "editstylesheetproperty", base.getUser()); if (!IsPostBack) { stylesheetproperty.RefreshFromFile(); NameTxt.Text = stylesheetproperty.Text; Content.Text = stylesheetproperty.value; AliasTxt.Text = stylesheetproperty.Alias; ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheetProperty>().Tree.Alias) .SyncTree(helper.Request("id"), false); } ImageButton bt = Panel1.Menu.NewImageButton(); bt.Click += new System.Web.UI.ImageClickEventHandler(save_click); bt.ImageUrl = UmbracoPath + "/images/editor/Save.GIF"; bt.AlternateText = ui.Text("save"); bt.ID = "save"; setupPreView(); }
protected void Page_Load(object sender, EventArgs e) { Panel1.Text = ui.Text("stylesheet", "editstylesheet", getUser()); pp_name.Text = ui.Text("name", getUser()); pp_path.Text = ui.Text("path", getUser()); stylesheet = new StyleSheet(int.Parse(Request.QueryString["id"])); var appPath = Request.ApplicationPath; if (appPath == "/") { appPath = ""; } lttPath.Text = "<a target='_blank' href='" + appPath + "/css/" + stylesheet.Text + ".css'>" + appPath + SystemDirectories.Css + "/" + stylesheet.Text + ".css</a>"; if (IsPostBack == false) { NameTxt.Text = stylesheet.Text; editorSource.Text = stylesheet.Content; ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheets>().Tree.Alias) .SyncTree("-1,init," + Request.GetItemAsString("id"), false); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { //configure screen for editing a template if (_template != null) { MasterTemplate.Items.Add(new ListItem(ui.Text("none"), "0")); var selectedTemplate = string.Empty; foreach (Template t in Template.GetAllAsList()) { if (t.Id == _template.Id) { continue; } var li = new ListItem(t.Text, t.Id.ToString()); li.Attributes.Add("id", t.Alias.Replace(" ", "") + ".cshtml"); MasterTemplate.Items.Add(li); } try { if (_template.MasterTemplate > 0) { MasterTemplate.SelectedValue = _template.MasterTemplate.ToString(); } } catch (Exception ex) { } MasterTemplate.SelectedValue = selectedTemplate; NameTxt.Text = _template.GetRawText(); AliasTxt.Text = _template.Alias; editorSource.Text = _template.Design; } else { //configure editor for editing a file.... NameTxt.Text = OriginalFileName; var file = IOHelper.MapPath(SystemDirectories.MvcViews.EnsureEndsWith('/') + OriginalFileName); using (var sr = File.OpenText(file)) { var s = sr.ReadToEnd(); editorSource.Text = s; } } } ClientTools .SetActiveTreeType(CurrentTreeType) .SyncTree(TemplateTreeSyncPath, false); }
private void save_click(object sender, System.Web.UI.ImageClickEventArgs e) { currentLanguage.CultureAlias = Cultures.SelectedValue; currentLanguage.Save(); updateCultureList(); ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "languageSaved"), ""); }
protected void SendToPublish(object sender, System.EventArgs e) { if (Page.IsValid) { ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSendToPublish", base.getUser()), ui.Text("speechBubbles", "editContentSendToPublishText", base.getUser())); _document.SendToPublication(base.getUser()); } }
/// <summary> /// Runs Post install actions such as clearning any necessary cache, reloading the correct tree nodes, etc... /// </summary> /// <param name="packageId"></param> /// <param name="dir"></param> private void PerformPostInstallCleanup(int packageId, string dir) { BasePage.Current.ClientTools.ReloadActionNode(true, true); _installer.InstallCleanUp(packageId, dir); //clear the tree cache ClientTools.ClearClientTreeCache().RefreshTree("packager"); TreeDefinitionCollection.Instance.ReRegisterTrees(); BizLogicAction.ReRegisterActionsAndHandlers(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadMediaTypes>().Tree.Alias) .SyncTree("-1,init," + helper.Request("id"), false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadXslt>().Tree.Alias) .SyncTree(Request.QueryString["file"], false); } }
/// <summary> /// Handles the SendToPublish event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SendToPublish(object sender, EventArgs e) { if (Page.IsValid) { ClientTools.ShowSpeechBubble( speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSendToPublish", UmbracoUser), ui.Text("speechBubbles", "editContentSendToPublishText", UmbracoUser)); _document.SendToPublication(UmbracoUser); } }
private void save_click(object sender, System.Web.UI.ImageClickEventArgs e) { _memberGroup.Text = NameTxt.Text; memberGroupName.Value = NameTxt.Text; _memberGroup.Save(); this.ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editMemberGroupSaved", base.getUser()), ""); ClientTools .RefreshTree(TreeDefinitionCollection.Instance.FindTree <loadMemberGroups>().Tree.Alias); }
protected void SaveButton_Clicked(object sender, EventArgs e) { if (Page.IsValid) { //Get the name and media nodeId shippingMethod.Name = TxtName.Text; shippingMethod.Alias = TxtDictionaryItemName.Text; shippingMethod.Sku = TxtSku.Text; shippingMethod.VatGroupId = DrpVatGroups.SelectedValue.TryParse <long>(); shippingMethod.ImageIdentifier = CPImage.Value; shippingMethod.AllowedInFollowingCountries = new List <long>(); shippingMethod.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) { shippingMethod.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) { shippingMethod.AllowedInFollowingCountryRegions.Add(countryRegionId); } LoopPrices(item2.FindControl <ListView>("LvCurrencies"), countryId, countryRegionId); } } //Save the shippingmethod shippingMethod.Save(); LoadCurrenciesAndCountries(); //Show confirming speech bubble in umbraco ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Save, CommonTerms.ShippingMethodSaved, string.Empty); } }