Example #1
0
        /// <summary>
        /// Configure the editor for editing a template
        /// </summary>
        private void InitializeEditorForTemplate()
        {
            //TODO: implement content placeholders, etc... just like we had in v5

            editorSource.Menu.InsertSplitter();

            MenuIconI umbRenderBody = editorSource.Menu.NewIcon();

            umbRenderBody.ImageURL = UmbracoPath + "/images/editor/renderbody.gif";
            //umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
            umbRenderBody.AltText = "Insert @RenderBody()";

            umbRenderBody.OnClickCommand = "editViewEditor.insertRenderBody()";

            MenuIconI umbSection = editorSource.Menu.NewIcon();

            umbSection.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
            //umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
            umbSection.AltText = "Insert Section";

            umbSection.OnClickCommand = "editViewEditor.openSnippetModal('section')";

            MenuIconI umbRenderSection = editorSource.Menu.NewIcon();

            umbRenderSection.ImageURL = UmbracoPath + "/images/editor/masterpageContent.gif";
            //umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
            umbRenderSection.AltText = "Insert @RenderSection";

            umbRenderSection.OnClickCommand = "editViewEditor.openSnippetModal('rendersection')";
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            SaveButton = UmbracoPanel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText = "Save scripting File";
            SaveButton.ID = "save";

            // 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;
        }
Example #3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            SaveButton          = UmbracoPanel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText  = "Save scripting File";
            SaveButton.ID       = "save";

            // 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          = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText  = "Save stylesheet";
            SaveButton.ID       = "save";
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            SaveButton = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText = "Save stylesheet";
            SaveButton.ID = "save";
        }
Example #6
0
        private void AddMenuIcon(ScrollingMenu menu, umbracoPage page, int pageId)
        {
            var title = Configuration.GetUmbracoObjectsByPagePath(page.Request.Path).First().Name + " Usages";

            MenuIconI ni = menu.NewIcon();

            ni.AltText        = "View Usages";
            ni.OnClickCommand = string.Format("UmbClientMgr.openModalWindow('plugins/census/usages.aspx?sourcePage={0}&sourceId={1}', '{2}', true, 600, 500, 0, 0); return false;", page.Request.Path, pageId, title);
            ni.ImageURL       = string.Concat(Configuration.PluginDirectory, "census-toolbar-icon.png");

            TweakMenuButton(ref page);
        }
Example #7
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            file = Request.QueryString["file"].TrimStart('/');

            //need to change the editor type if it is XML
            if (file.EndsWith("xml"))
            {
                editorSource.CodeBase = uicontrols.CodeArea.EditorType.XML;
            }
            else if (file.EndsWith("master"))
            {
                editorSource.CodeBase = uicontrols.CodeArea.EditorType.HTML;
            }

            SaveButton          = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText  = "Save File";
            SaveButton.ID       = "save";

            if (editorSource.CodeBase == uicontrols.CodeArea.EditorType.HTML)
            {
                // Editing buttons
                Panel1.Menu.InsertSplitter();
                uicontrols.MenuIconI umbField = Panel1.Menu.NewIcon();
                umbField.ImageURL       = UmbracoPath + "/images/editor/insField.gif";
                umbField.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550);
                umbField.AltText        = ui.Text("template", "insertPageField");

                // TODO: Update icon
                uicontrols.MenuIconI umbDictionary = Panel1.Menu.NewIcon();
                umbDictionary.ImageURL       = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
                umbDictionary.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"), 640, 550);
                umbDictionary.AltText        = "Insert umbraco dictionary item";

                uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
                umbMacro.ImageURL       = UmbracoPath + "/images/editor/insMacro.gif";
                umbMacro.AltText        = ui.Text("template", "insertMacro");
                umbMacro.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);

                // Help
                Panel1.Menu.InsertSplitter();

                uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon();
                helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=", ui.Text("template", "quickGuide"), 600, 580);
                helpIcon.ImageURL       = UmbracoPath + "/images/editor/help.png";
                helpIcon.AltText        = ui.Text("template", "quickGuide");
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // editor source

                if (!UmbracoSettings.ScriptDisableEditor)
                {
                    // TODO: Register the some script editor js file if you can find a good one.
                }

                ClientTools
                .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree <loadStylesheets>().Tree.Alias)
                .SyncTree(helper.Request("id"), false);
            }

            MenuIconI save = Panel1.Menu.NewIcon();

            save.ImageURL       = SystemDirectories.Umbraco + "/images/editor/Save.GIF";
            save.OnClickCommand = "doSubmit()";
            save.AltText        = "Save stylesheet";
            save.ID             = "save";
            Panel1.Text         = ui.Text("stylesheet", "editstylesheet", base.getUser());
            pp_name.Text        = ui.Text("name", base.getUser());
            pp_path.Text        = ui.Text("path", base.getUser());

            stylesheet = new StyleSheet(int.Parse(Request.QueryString["id"]));
            string appPath = Request.ApplicationPath;

            if (appPath == "/")
            {
                appPath = "";
            }
            lttPath.Text = "<a target='_blank' href='" + appPath + "/css/" + stylesheet.Text + ".css'>" + appPath +
                           IO.SystemDirectories.Css + "/" + stylesheet.Text + ".css</a>";


            if (!IsPostBack)
            {
                NameTxt.Text      = stylesheet.Text;
                editorSource.Text = stylesheet.Content;
            }
        }
Example #9
0
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			//check if a templateId is assigned, meaning we are editing a template
			if (!Request.QueryString["templateID"].IsNullOrWhiteSpace())
			{
				_template = new Template(int.Parse(Request.QueryString["templateID"]));
                TemplateTreeSyncPath = "-1,init," + _template.Path.Replace("-1,", "");
			}
			else if (!Request.QueryString["file"].IsNullOrWhiteSpace())
			{
				//we are editing a view (i.e. partial view)
				OriginalFileName = HttpUtility.UrlDecode(Request.QueryString["file"]);
                TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName);
			}
			else
			{
				throw new InvalidOperationException("Cannot render the editor without a supplied templateId or a file");
			}
			
			Panel1.hasMenu = true;

			SaveButton = Panel1.Menu.NewIcon();
			SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
			SaveButton.AltText = ui.Text("save");
			SaveButton.ID = "save";

			Panel1.Text = ui.Text("edittemplate");
			pp_name.Text = ui.Text("name", base.getUser());
			pp_alias.Text = ui.Text("alias", base.getUser());
			pp_masterTemplate.Text = ui.Text("mastertemplate", base.getUser());

			// Editing buttons
			Panel1.Menu.InsertSplitter();
			MenuIconI umbField = Panel1.Menu.NewIcon();
			umbField.ImageURL = UmbracoPath + "/images/editor/insField.gif";
			umbField.OnClickCommand =
				ClientTools.Scripts.OpenModalWindow(
					IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
					editorSource.ClientID + "&tagName=UMBRACOGETDATA&mvcView=true", ui.Text("template", "insertPageField"), 640, 550);
			umbField.AltText = ui.Text("template", "insertPageField");


			// TODO: Update icon
			MenuIconI umbDictionary = Panel1.Menu.NewIcon();
			umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
			umbDictionary.OnClickCommand =
				ClientTools.Scripts.OpenModalWindow(
					IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY&mvcView=true", ui.Text("template", "insertDictionaryItem"),
					640, 550);
			umbDictionary.AltText = "Insert umbraco dictionary item";

			var macroSplitButton = new InsertMacroSplitButton
				{
					ClientCallbackInsertMacroMarkup = "function(alias) {editViewEditor.insertMacroMarkup(alias);}",
					ClientCallbackOpenMacroModel = "function(alias) {editViewEditor.openMacroModal(alias);}"
				};
			Panel1.Menu.InsertNewControl(macroSplitButton, 40);
			
			if (_template == null)
			{
				InitializeEditorForPartialView();
			}
			else
			{
				InitializeEditorForTemplate();	
			}
			
		}
Example #10
0
        private void addControlNew(Property p, TabPage tp, string Caption)
        {
            IDataType dt = p.PropertyType.DataTypeDefinition.DataType;

            dt.DataEditor.Editor.ID = string.Format("prop_{0}", p.PropertyType.Alias);
            dt.Data.PropertyId      = p.Id;

            // check for buttons
            IDataFieldWithButtons df1 = dt.DataEditor.Editor as IDataFieldWithButtons;

            if (df1 != null)
            {
                // df1.Alias = p.PropertyType.Alias;

                /*
                 *              // df1.Version = _content.Version;
                 *              editDataType.Data.PropertyId = p.Id;
                 */
                ((Control)df1).ID = p.PropertyType.Alias;


                if (df1.MenuIcons.Length > 0)
                {
                    tp.Menu.InsertSplitter();
                }


                // Add buttons
                int  c          = 0;
                bool atEditHtml = false;
                bool atSplitter = false;
                foreach (object o in df1.MenuIcons)
                {
                    try
                    {
                        MenuIconI m  = (MenuIconI)o;
                        MenuIconI mi = tp.Menu.NewIcon();
                        mi.ImageURL       = m.ImageURL;
                        mi.OnClickCommand = m.OnClickCommand;
                        mi.AltText        = m.AltText;
                        mi.ID             = tp.ID + "_" + m.ID;

                        if (m.ID == "html")
                        {
                            atEditHtml = true;
                        }
                        else
                        {
                            atEditHtml = false;
                        }

                        atSplitter = false;
                    }
                    catch
                    {
                        tp.Menu.InsertSplitter();
                        atSplitter = true;
                    }

                    // Testing custom styles in editor
                    if (atSplitter && atEditHtml && dt.DataEditor.TreatAsRichTextEditor)
                    {
                        DropDownList ddl = tp.Menu.NewDropDownList();

                        ddl.Style.Add("margin-bottom", "5px");
                        ddl.Items.Add(ui.Text("buttons", "styleChoose", null));
                        ddl.ID = tp.ID + "_editorStyle";
                        if (StyleSheet.GetAll().Length > 0)
                        {
                            foreach (StyleSheet s in StyleSheet.GetAll())
                            {
                                foreach (StylesheetProperty sp in s.Properties)
                                {
                                    ddl.Items.Add(new ListItem(sp.Text, sp.Alias));
                                }
                            }
                        }
                        ddl.Attributes.Add("onChange", "addStyle(this, '" + p.PropertyType.Alias + "');");
                        atEditHtml = false;
                    }
                    c++;
                }
            }

            // check for element additions
            IMenuElement menuElement = dt.DataEditor.Editor as IMenuElement;

            if (menuElement != null)
            {
                // add separator
                tp.Menu.InsertSplitter();

                // add the element
                tp.Menu.NewElement(menuElement.ElementName, menuElement.ElementIdPreFix + p.Id.ToString(),
                                   menuElement.ElementClass, menuElement.ExtraMenuWidth);
            }


            // fieldData.Alias = p.PropertyType.Alias;
            // ((Control) fieldData).ID = p.PropertyType.Alias;
            // fieldData.Text = p.Value.ToString();

            _dataFields.Add(dt.DataEditor.Editor);


            Pane    pp     = new Pane();
            Control holder = new Control();

            holder.Controls.Add(dt.DataEditor.Editor);
            if (p.PropertyType.DataTypeDefinition.DataType.DataEditor.ShowLabel)
            {
                string caption = p.PropertyType.Name;
                if (p.PropertyType.Description != null && p.PropertyType.Description != String.Empty)
                {
                    switch (UmbracoSettings.PropertyContextHelpOption)
                    {
                    case "icon":
                        caption += " <img src=\"" + this.ResolveUrl(SystemDirectories.Umbraco) + "/images/help.png\" class=\"umbPropertyContextHelp\" alt=\"" + p.PropertyType.Description + "\" title=\"" + p.PropertyType.Description + "\" />";
                        break;

                    case "text":
                        caption += "<br /><small>" + umbraco.library.ReplaceLineBreaks(p.PropertyType.Description) + "</small>";
                        break;
                    }
                }
                pp.addProperty(caption, holder);
            }
            else
            {
                pp.addProperty(holder);
            }

            // Validation
            if (p.PropertyType.Mandatory)
            {
                try
                {
                    RequiredFieldValidator rq = new RequiredFieldValidator();
                    rq.ControlToValidate = dt.DataEditor.Editor.ID;
                    Control component = dt.DataEditor.Editor; // holder.FindControl(rq.ControlToValidate);
                    ValidationPropertyAttribute attribute =
                        (ValidationPropertyAttribute)
                        TypeDescriptor.GetAttributes(component)[typeof(ValidationPropertyAttribute)];
                    PropertyDescriptor pd = null;
                    if (attribute != null)
                    {
                        pd = TypeDescriptor.GetProperties(component, (Attribute[])null)[attribute.Name];
                    }
                    if (pd != null)
                    {
                        rq.EnableClientScript = false;
                        rq.Display            = ValidatorDisplay.Dynamic;
                        string[] errorVars = { p.PropertyType.Name, Caption };
                        rq.ErrorMessage = ui.Text("errorHandling", "errorMandatory", errorVars, null) + "<br/>";
                        holder.Controls.AddAt(0, rq);
                    }
                }
                catch (Exception valE)
                {
                    HttpContext.Current.Trace.Warn("contentControl",
                                                   "EditorControl (" + dt.DataTypeName + ") does not support validation",
                                                   valE);
                }
            }

            // RegExp Validation
            if (!string.IsNullOrWhiteSpace(p.PropertyType.ValidationRegExp))
            {
                try
                {
                    RegularExpressionValidator rv = new RegularExpressionValidator();
                    rv.ControlToValidate = dt.DataEditor.Editor.ID;

                    Control component = dt.DataEditor.Editor; // holder.FindControl(rq.ControlToValidate);
                    ValidationPropertyAttribute attribute =
                        (ValidationPropertyAttribute)
                        TypeDescriptor.GetAttributes(component)[typeof(ValidationPropertyAttribute)];
                    PropertyDescriptor pd = null;
                    if (attribute != null)
                    {
                        pd = TypeDescriptor.GetProperties(component, (Attribute[])null)[attribute.Name];
                    }
                    if (pd != null)
                    {
                        rv.ValidationExpression = p.PropertyType.ValidationRegExp;
                        rv.EnableClientScript   = false;
                        rv.Display = ValidatorDisplay.Dynamic;
                        string[] errorVars = { p.PropertyType.Name, Caption };
                        rv.ErrorMessage = ui.Text("errorHandling", "errorRegExp", errorVars, null) + "<br/>";
                        holder.Controls.AddAt(0, rv);
                    }
                }
                catch (Exception valE)
                {
                    HttpContext.Current.Trace.Warn("contentControl",
                                                   "EditorControl (" + dt.DataTypeName + ") does not support validation",
                                                   valE);
                }
            }

            // This is once again a nasty nasty hack to fix gui when rendering wysiwygeditor
            if (dt.DataEditor.TreatAsRichTextEditor)
            {
                tp.Controls.Add(dt.DataEditor.Editor);
            }
            else
            {
                Panel ph = new Panel();
                ph.Attributes.Add("style", "padding: 0; position: relative;"); // NH 4.7.1, latest styles added to support CP item: 30363
                ph.Controls.Add(pp);

                tp.Controls.Add(ph);
            }
        }
Example #11
0
		protected override void OnInit(EventArgs e)
		{
			_template = new Template(int.Parse(Request.QueryString["templateID"]));
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
			Panel1.hasMenu = true;

			SaveButton = Panel1.Menu.NewIcon();
			SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
			//SaveButton.OnClickCommand = "doSubmit()";
			SaveButton.AltText = ui.Text("save");
			SaveButton.ID = "save";

			Panel1.Text = ui.Text("edittemplate");
			pp_name.Text = ui.Text("name", base.getUser());
			pp_alias.Text = ui.Text("alias", base.getUser());
			pp_masterTemplate.Text = ui.Text("mastertemplate", base.getUser());

			// Editing buttons
			Panel1.Menu.InsertSplitter();
			MenuIconI umbField = Panel1.Menu.NewIcon();
			umbField.ImageURL = UmbracoPath + "/images/editor/insField.gif";
			umbField.OnClickCommand =
				ClientTools.Scripts.OpenModalWindow(
					IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
					editorSource.ClientID + "&tagName=UMBRACOGETDATA&mvcView=true", ui.Text("template", "insertPageField"), 640, 550);
			umbField.AltText = ui.Text("template", "insertPageField");


			// TODO: Update icon
			MenuIconI umbDictionary = Panel1.Menu.NewIcon();
			umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
			umbDictionary.OnClickCommand =
				ClientTools.Scripts.OpenModalWindow(
					IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY&mvcView=true", ui.Text("template", "insertDictionaryItem"),
					640, 550);
			umbDictionary.AltText = "Insert umbraco dictionary item";

			//uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
			//umbMacro.ImageURL = UmbracoPath + "/images/editor/insMacro.gif";
			//umbMacro.AltText = ui.Text("template", "insertMacro");
			//umbMacro.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);

			Panel1.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40);

			if (UmbracoSettings.UseAspNetMasterPages)
			{
				Panel1.Menu.InsertSplitter();

				MenuIconI umbContainer = Panel1.Menu.NewIcon();
				umbContainer.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
				umbContainer.AltText = ui.Text("template", "insertContentAreaPlaceHolder");
				umbContainer.OnClickCommand =
					ClientTools.Scripts.OpenModalWindow(
						IOHelper.ResolveUrl(SystemDirectories.Umbraco) +
						"/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id,
						ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320);

				MenuIconI umbContent = Panel1.Menu.NewIcon();
				umbContent.ImageURL = UmbracoPath + "/images/editor/masterpageContent.gif";
				umbContent.AltText = ui.Text("template", "insertContentArea");
				umbContent.OnClickCommand =
					ClientTools.Scripts.OpenModalWindow(
						IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" +
						_template.Id, ui.Text("template", "insertContentArea"), 470, 300);
			}


			//Spit button
			Panel1.Menu.InsertSplitter();
			Panel1.Menu.NewElement("div", "splitButtonPlaceHolder", "sbPlaceHolder", 40);

			// Help
			Panel1.Menu.InsertSplitter();

			MenuIconI helpIcon = Panel1.Menu.NewIcon();
			helpIcon.OnClickCommand =
				ClientTools.Scripts.OpenModalWindow(
					IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" +
					_template.Alias, ui.Text("template", "quickGuide"), 600, 580);
			helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
			helpIcon.AltText = ui.Text("template", "quickGuide");
		}
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            file = Request.QueryString["file"].TrimStart('/');

            //need to change the editor type if it is XML
            if (file.EndsWith("xml"))
                editorSource.CodeBase = uicontrols.CodeArea.EditorType.XML;
            else if (file.EndsWith("master"))
                editorSource.CodeBase = uicontrols.CodeArea.EditorType.HTML;

            SaveButton = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText = "Save File";
            SaveButton.ID = "save";

            if (editorSource.CodeBase == uicontrols.CodeArea.EditorType.HTML)
            {
                // Editing buttons
                Panel1.Menu.InsertSplitter();
                uicontrols.MenuIconI umbField = Panel1.Menu.NewIcon();
                umbField.ImageURL = UmbracoPath + "/images/editor/insField.gif";
                umbField.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550);
                umbField.AltText = ui.Text("template", "insertPageField");

                // TODO: Update icon
                uicontrols.MenuIconI umbDictionary = Panel1.Menu.NewIcon();
                umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
                umbDictionary.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"), 640, 550);
                umbDictionary.AltText = "Insert umbraco dictionary item";

                uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
                umbMacro.ImageURL = UmbracoPath + "/images/editor/insMacro.gif";
                umbMacro.AltText = ui.Text("template", "insertMacro");
                umbMacro.OnClickCommand = BasePages.ClientTools.Scripts.OpenModalWindow(IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);

                // Help
                Panel1.Menu.InsertSplitter();

                uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon();
                helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=", ui.Text("template", "quickGuide"), 600, 580);
                helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
                helpIcon.AltText = ui.Text("template", "quickGuide");

            }

        }
Example #13
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //check if a templateId is assigned, meaning we are editing a template
            if (!Request.QueryString["templateID"].IsNullOrWhiteSpace())
            {
                _template            = new Template(int.Parse(Request.QueryString["templateID"]));
                TemplateTreeSyncPath = "-1,init," + _template.Path.Replace("-1,", "");
            }
            else if (!Request.QueryString["file"].IsNullOrWhiteSpace())
            {
                //we are editing a view (i.e. partial view)
                OriginalFileName     = HttpUtility.UrlDecode(Request.QueryString["file"]);
                TemplateTreeSyncPath = "-1,init," + Path.GetFileName(OriginalFileName);
            }
            else
            {
                throw new InvalidOperationException("Cannot render the editor without a supplied templateId or a file");
            }

            Panel1.hasMenu = true;

            SaveButton          = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText  = ui.Text("save");
            SaveButton.ID       = "save";

            Panel1.Text            = ui.Text("edittemplate");
            pp_name.Text           = ui.Text("name", base.getUser());
            pp_alias.Text          = ui.Text("alias", base.getUser());
            pp_masterTemplate.Text = ui.Text("mastertemplate", base.getUser());

            // Editing buttons
            Panel1.Menu.InsertSplitter();
            MenuIconI umbField = Panel1.Menu.NewIcon();

            umbField.ImageURL       = UmbracoPath + "/images/editor/insField.gif";
            umbField.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDATA&mvcView=true", ui.Text("template", "insertPageField"), 640, 550);
            umbField.AltText = ui.Text("template", "insertPageField");


            // TODO: Update icon
            MenuIconI umbDictionary = Panel1.Menu.NewIcon();

            umbDictionary.ImageURL       = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
            umbDictionary.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY&mvcView=true", ui.Text("template", "insertDictionaryItem"),
                    640, 550);
            umbDictionary.AltText = "Insert umbraco dictionary item";

            var macroSplitButton = new InsertMacroSplitButton
            {
                ClientCallbackInsertMacroMarkup = "function(alias) {editViewEditor.insertMacroMarkup(alias);}",
                ClientCallbackOpenMacroModel    = "function(alias) {editViewEditor.openMacroModal(alias);}"
            };

            Panel1.Menu.InsertNewControl(macroSplitButton, 40);

            if (_template == null)
            {
                InitializeEditorForPartialView();
            }
            else
            {
                InitializeEditorForTemplate();
            }
        }
Example #14
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            SaveButton          = UmbracoPanel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText  = "Save Xslt File";
            SaveButton.ID       = "save";

            UmbracoPanel1.Menu.InsertSplitter();

            var tmp = UmbracoPanel1.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";

            UmbracoPanel1.Menu.InsertSplitter();

            tmp                = UmbracoPanel1.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";

            UmbracoPanel1.Menu.InsertSplitter();

            tmp                = UmbracoPanel1.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                = UmbracoPanel1.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";

            UmbracoPanel1.Menu.InsertSplitter();

            tmp                = UmbracoPanel1.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";

            UmbracoPanel1.Menu.InsertSplitter();

            tmp                = UmbracoPanel1.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;
        }
        protected override void OnInit(EventArgs e)
        {
            _template = new Template(int.Parse(Request.QueryString["templateID"]));
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
            Panel1.hasMenu = true;

            var editor = Panel1.NewTabPage(ui.Text("template"));

            editor.Controls.Add(Pane8);

            var props = Panel1.NewTabPage(ui.Text("properties"));

            props.Controls.Add(Pane7);

            SaveButton            = Panel1.Menu.NewButton();
            SaveButton.Text       = ui.Text("save");
            SaveButton.ButtonType = MenuButtonType.Primary;
            SaveButton.ID         = "save";
            SaveButton.CssClass   = "client-side";

            Panel1.Text            = ui.Text("edittemplate");
            pp_name.Text           = ui.Text("name", UmbracoUser);
            pp_alias.Text          = ui.Text("alias", UmbracoUser);
            pp_masterTemplate.Text = ui.Text("mastertemplate", UmbracoUser);


            // Editing buttons
            MenuIconI umbField = editorSource.Menu.NewIcon();

            umbField.ImageURL       = UmbracoPath + "/images/editor/insField.gif";
            umbField.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550);
            umbField.AltText = ui.Text("template", "insertPageField");


            // TODO: Update icon
            MenuIconI umbDictionary = editorSource.Menu.NewIcon();

            umbDictionary.ImageURL       = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
            umbDictionary.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"),
                    640, 550);
            umbDictionary.AltText = "Insert umbraco dictionary item";

            editorSource.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40);

            if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages)
            {
                MenuIconI umbContainer = editorSource.Menu.NewIcon();
                umbContainer.ImageURL       = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
                umbContainer.AltText        = ui.Text("template", "insertContentAreaPlaceHolder");
                umbContainer.OnClickCommand =
                    ClientTools.Scripts.OpenModalWindow(
                        IOHelper.ResolveUrl(SystemDirectories.Umbraco) +
                        "/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id,
                        ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320);

                MenuIconI umbContent = editorSource.Menu.NewIcon();
                umbContent.ImageURL       = UmbracoPath + "/images/editor/masterpageContent.gif";
                umbContent.AltText        = ui.Text("template", "insertContentArea");
                umbContent.OnClickCommand =
                    ClientTools.Scripts.OpenModalWindow(
                        IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" +
                        _template.Id, ui.Text("template", "insertContentArea"), 470, 300);
            }


            //Spit button
            editorSource.Menu.InsertSplitter();
            editorSource.Menu.NewElement("div", "splitButtonPlaceHolder", "sbPlaceHolder", 40);

            // Help
            editorSource.Menu.InsertSplitter();

            MenuIconI helpIcon = editorSource.Menu.NewIcon();

            helpIcon.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" +
                    _template.Alias, ui.Text("template", "quickGuide"), 600, 580);
            helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
            helpIcon.AltText  = ui.Text("template", "quickGuide");
        }
Example #16
0
        protected override void OnInit(EventArgs e)
        {
            _template = new Template(int.Parse(Request.QueryString["templateID"]));
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
            Panel1.hasMenu = true;

            SaveButton          = Panel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            //SaveButton.OnClickCommand = "doSubmit()";
            SaveButton.AltText = ui.Text("save");
            SaveButton.ID      = "save";

            Panel1.Text            = ui.Text("edittemplate");
            pp_name.Text           = ui.Text("name", base.getUser());
            pp_alias.Text          = ui.Text("alias", base.getUser());
            pp_masterTemplate.Text = ui.Text("mastertemplate", base.getUser());

            // Editing buttons
            Panel1.Menu.InsertSplitter();
            MenuIconI umbField = Panel1.Menu.NewIcon();

            umbField.ImageURL       = UmbracoPath + "/images/editor/insField.gif";
            umbField.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDATA&mvcView=true", ui.Text("template", "insertPageField"), 640, 550);
            umbField.AltText = ui.Text("template", "insertPageField");


            // TODO: Update icon
            MenuIconI umbDictionary = Panel1.Menu.NewIcon();

            umbDictionary.ImageURL       = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
            umbDictionary.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" +
                    editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY&mvcView=true", ui.Text("template", "insertDictionaryItem"),
                    640, 550);
            umbDictionary.AltText = "Insert umbraco dictionary item";

            //uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
            //umbMacro.ImageURL = UmbracoPath + "/images/editor/insMacro.gif";
            //umbMacro.AltText = ui.Text("template", "insertMacro");
            //umbMacro.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);

            Panel1.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40);

            if (UmbracoSettings.UseAspNetMasterPages)
            {
                Panel1.Menu.InsertSplitter();

                MenuIconI umbContainer = Panel1.Menu.NewIcon();
                umbContainer.ImageURL       = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
                umbContainer.AltText        = ui.Text("template", "insertContentAreaPlaceHolder");
                umbContainer.OnClickCommand =
                    ClientTools.Scripts.OpenModalWindow(
                        IOHelper.ResolveUrl(SystemDirectories.Umbraco) +
                        "/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id,
                        ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320);

                MenuIconI umbContent = Panel1.Menu.NewIcon();
                umbContent.ImageURL       = UmbracoPath + "/images/editor/masterpageContent.gif";
                umbContent.AltText        = ui.Text("template", "insertContentArea");
                umbContent.OnClickCommand =
                    ClientTools.Scripts.OpenModalWindow(
                        IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" +
                        _template.Id, ui.Text("template", "insertContentArea"), 470, 300);
            }


            //Spit button
            Panel1.Menu.InsertSplitter();
            Panel1.Menu.NewElement("div", "splitButtonPlaceHolder", "sbPlaceHolder", 40);

            // Help
            Panel1.Menu.InsertSplitter();

            MenuIconI helpIcon = Panel1.Menu.NewIcon();

            helpIcon.OnClickCommand =
                ClientTools.Scripts.OpenModalWindow(
                    IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" +
                    _template.Alias, ui.Text("template", "quickGuide"), 600, 580);
            helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
            helpIcon.AltText  = ui.Text("template", "quickGuide");
        }
Example #17
0
		protected override void OnInit(EventArgs e)
		{			
			base.OnInit(e);
            
            SaveButton = UmbracoPanel1.Menu.NewIcon();
            SaveButton.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
            SaveButton.AltText = "Save Xslt File";
            SaveButton.ID = "save";

			UmbracoPanel1.Menu.InsertSplitter();

			var tmp = UmbracoPanel1.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";

			UmbracoPanel1.Menu.InsertSplitter();

			tmp = UmbracoPanel1.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";

			UmbracoPanel1.Menu.InsertSplitter();

			tmp = UmbracoPanel1.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 = UmbracoPanel1.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";

			UmbracoPanel1.Menu.InsertSplitter();

			tmp = UmbracoPanel1.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";

			UmbracoPanel1.Menu.InsertSplitter();

			tmp = UmbracoPanel1.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;
		}