protected override void OnInit(EventArgs e) { base.OnInit(e); SaveButton = UmbracoPanel1.Menu.NewButton(); SaveButton.ToolTip = "Save scripting File"; SaveButton.Text = ui.Text("save"); SaveButton.OnClientClick = "return false;"; SaveButton.ID = "save"; SaveButton.ButtonType = MenuButtonType.Primary; var code = UmbracoPanel1.NewTabPage("code"); code.Controls.Add(Pane1); var props = UmbracoPanel1.NewTabPage("properties"); props.Controls.Add(Pane2); // Add source and filename String file = IOHelper.MapPath(SystemDirectories.MacroScripts + "/" + Request.QueryString["file"]); // validate file IOHelper.ValidateEditPath(file, SystemDirectories.MacroScripts); // validate extension IOHelper.ValidateFileExtension(file, validScriptingExtensions()); pythonFileName.Text = file.Replace(IOHelper.MapPath(SystemDirectories.MacroScripts), "").Substring(1).Replace(@"\", "/"); StreamReader SR; string S; SR = File.OpenText(file); S = SR.ReadToEnd(); SR.Close(); pythonSource.Text = S; }
protected override void OnInit(EventArgs e) { base.OnInit(e); SaveButton = UmbracoPanel1.Menu.NewButton(); SaveButton.ToolTip = "Save Xslt File"; SaveButton.Text = ui.Text("save"); SaveButton.ButtonType = MenuButtonType.Primary; SaveButton.ID = "save"; SaveButton.CssClass = "client-side"; var code = UmbracoPanel1.NewTabPage("xslt"); code.Controls.Add(pane1); var props = UmbracoPanel1.NewTabPage("properties"); props.Controls.Add(pane2); var tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/images/editor/insField.GIF"; tmp.OnClickCommand = ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/developer/xslt/xsltinsertvalueof.aspx?objectId=" + editorSource.ClientID, "Insert value", 750, 250); //"umbracoInsertField(document.getElementById('editorSource'), 'xsltInsertValueOf', '','felt', 750, 230, '');"; tmp.AltText = "Insert xslt:value-of"; editorSource.Menu.InsertSplitter(); tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = SystemDirectories.Umbraco + "/images/editor/insMemberItem.GIF"; tmp.OnClickCommand = "UmbEditor.Insert('<xsl:variable name=\"\" select=\"', '\"/>\\n', '" + editorSource.ClientID + "'); return false;"; tmp.AltText = "Insert xsl:variable"; editorSource.Menu.InsertSplitter(); tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = SystemDirectories.Umbraco + "/images/editor/insChildTemplateNew.GIF"; tmp.OnClickCommand = "UmbEditor.Insert('<xsl:if test=\"CONDITION\">\\n', '\\n</xsl:if>\\n', '" + editorSource.ClientID + "'); return false;"; tmp.AltText = "Insert xsl:if"; tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = SystemDirectories.Umbraco + "/images/editor/insChildTemplateNew.GIF"; tmp.OnClickCommand = "UmbEditor.Insert('<xsl:for-each select=\"QUERY\">\\n', '\\n</xsl:for-each>\\n', '" + editorSource.ClientID + "'); return false;"; tmp.AltText = "Insert xsl:for-each"; editorSource.Menu.InsertSplitter(); tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = SystemDirectories.Umbraco + "/images/editor/insFieldByLevel.GIF"; tmp.OnClickCommand = "UmbEditor.Insert('<xsl:choose>\\n<xsl:when test=\"CONDITION\">\\n', '\\n</xsl:when>\\n<xsl:otherwise>\\n</xsl:otherwise>\\n</xsl:choose>\\n', '" + editorSource.ClientID + "'); return false;"; tmp.AltText = "Insert xsl:choose"; editorSource.Menu.InsertSplitter(); tmp = editorSource.Menu.NewIcon(); tmp.ImageURL = SystemDirectories.Umbraco + "/images/editor/xslVisualize.GIF"; tmp.OnClickCommand = "xsltVisualize();"; tmp.AltText = "Visualize XSLT"; // Add source and filename var file = IOHelper.MapPath(SystemDirectories.Xslt + "/" + Request.QueryString["file"]); // validate file IOHelper.ValidateEditPath(file, SystemDirectories.Xslt); // validate extension IOHelper.ValidateFileExtension(file, new List <string>() { "xslt", "xsl" }); xsltFileName.Text = file.Replace(IOHelper.MapPath(SystemDirectories.Xslt), "").Substring(1).Replace(@"\", "/"); StreamReader SR; string S; SR = File.OpenText(file); S = SR.ReadToEnd(); SR.Close(); editorSource.Text = S; }