public string RegisterEmotIcons(int ModuleId, string ImagePath, EditorTypes InsertType) { string strHost = Common.Globals.AddHTTP(Common.Globals.GetDomainName(HttpContext.Current.Request)) + "/"; var sb = new System.Text.StringBuilder(); IDataReader dr = DataProvider.Instance().Filters_GetEmoticons(ModuleId); sb.Append("<div id=\"emotions\" class=\"afemoticons\"><div id=\"emotions\" style=\"width:100%; height:100%;align:center;\">"); int i = 0; while (dr.Read()) { string sEmotPath = ImagePath + dr["Replace"]; string sInsert; if (InsertType == EditorTypes.TEXTBOX) { sInsert = dr["Find"].ToString(); } else { sInsert = "<img src=\\'" + sEmotPath + "\\' />"; } //sb.Append("<div class=""afEmot"" style=""width:16px;height:16px;""><img class=""afEmot"" src=""" & sEmotPath & """ width=""20"" height=""20"" title=""" & dr("Find").ToString & """ unselectable=""on"" style=""cursor:hand;"" onclick=""insertEmoticon('" & sInsert & "')"" />") sb.Append("<span class=\"afEmot\" style=\"width:20px;height:20px;cursor:hand;\" unselectable=\"on\" onclick=\"amaf_insertHTML('" + sInsert + "')\"><img onmousedown=\"return false;\" src=\"" + sEmotPath + "\" width=\"20\" height=\"20\" title=\"" + dr["Find"] + "\" /></span>"); i += 1; if (i % 2 == 0) { sb.Append("<br />"); } } dr.Close(); sb.Append("</div></div>"); return sb.ToString(); }
public string RegisterEmotIcons(int ModuleId, string ImagePath, EditorTypes InsertType) { string strHost = Common.Globals.AddHTTP(Common.Globals.GetDomainName(HttpContext.Current.Request)) + "/"; var sb = new System.Text.StringBuilder(); IDataReader dr = DataProvider.Instance().Filters_GetEmoticons(ModuleId); sb.Append("<div id=\"emotions\" class=\"afemoticons\"><div id=\"emotions\" style=\"width:100%; height:100%;align:center;\">"); int i = 0; while (dr.Read()) { string sEmotPath = ImagePath + dr["Replace"]; string sInsert; if (InsertType == EditorTypes.TEXTBOX) { sInsert = dr["Find"].ToString(); } else { sInsert = "<img src=\\'" + sEmotPath + "\\' />"; } //sb.Append("<div class=""afEmot"" style=""width:16px;height:16px;""><img class=""afEmot"" src=""" & sEmotPath & """ width=""20"" height=""20"" title=""" & dr("Find").ToString & """ unselectable=""on"" style=""cursor:hand;"" onclick=""insertEmoticon('" & sInsert & "')"" />") sb.Append("<span class=\"afEmot\" style=\"width:20px;height:20px;cursor:hand;\" unselectable=\"on\" onclick=\"amaf_insertHTML('" + sInsert + "')\"><img onmousedown=\"return false;\" src=\"" + sEmotPath + "\" width=\"20\" height=\"20\" title=\"" + dr["Find"] + "\" /></span>"); i += 1; if (i % 2 == 0) { sb.Append("<br />"); } } dr.Close(); sb.Append("</div></div>"); return(sb.ToString()); }
/// <summary>Returns an object of type <seealso cref="IEditor"/> based on the <seealso cref="EditorTypes"/> enum index</summary> /// <param name="editortype">The <seealso cref="EditorTypes"/> ID</param> /// <returns></returns> public static IEditor returnEditorFromType(EditorTypes editortype) { //As a dev, you will need to add your editor into this section, this should be the only place you will need to ""initialize"" it //You will however need to, you know, handle all the processing of files and whatnot on the actual UserControl itself, so, yeah... if (editortype == EditorTypes.NGNEditor) { return(new T2Control_NGNEditor()); } else if (editortype == EditorTypes.SAVEditor) { return(new T2Control_SaveEditor()); } else if (editortype == EditorTypes.DATEditor) { return(null); } else if (editortype == EditorTypes.BINEditor) { return(null); } else if (editortype == EditorTypes.MultiMatEditor) { return(new T2Control_MaterialEditor()); } else { return(null); } }
private void OnGUI() { if (this.audioBank != null) { DragAndDrop.visualMode = DragAndDropVisualMode.Generic; Event e = Event.current; if (e.type == EventType.DragExited) { HandleDrag(e); return; } } else { DragAndDrop.visualMode = DragAndDropVisualMode.Rejected; } GUILayout.BeginHorizontal(EditorStyles.toolbar); this.editorType = (EditorTypes)GUILayout.Toolbar((int)this.editorType, this.editorTypeNames, EditorStyles.toolbarButton); GUILayout.FlexibleSpace(); if (GUILayout.Button("Actions", EditorStyles.toolbarDropDown)) { GenericMenu newNodeMenu = new GenericMenu(); newNodeMenu.AddItem(new GUIContent("Add Event"), false, AddEvent); newNodeMenu.AddItem(new GUIContent("Delete Event"), false, ConfirmDeleteEvent); newNodeMenu.AddItem(new GUIContent("Preview Event"), false, PreviewEvent); newNodeMenu.AddItem(new GUIContent("Stop Preview"), false, StopPreview); newNodeMenu.ShowAsContext(); } GUILayout.EndHorizontal(); switch (this.editorType) { case EditorTypes.Events: if (this.selectedEvent != null) { GetInput(); DrawEventNodes(this.selectedEvent); DrawEventProperties(this.selectedEvent); } DrawEventList(); break; case EditorTypes.Parameters: DrawParameterList(); break; case EditorTypes.BatchEdit: DrawBatchEditor(); break; } }
private void OnGUI() { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); foreach (EditorTypes eT in System.Enum.GetValues(typeof(EditorTypes))) { if (GUILayout.Button(eT.ToString(), EditorStyles.toolbarButton)) { currentEditor = eT; if (currentEditor == EditorTypes.LipsyncCreator) { currentEditor = EditorTypes.None; LipsyncCreator.OpenLipsyncCreator(); } else if (currentEditor == EditorTypes.EntityCreator) { currentEditor = EditorTypes.None; DialogTriggerCreator.OpenDialogCreator(); } } } EditorGUILayout.EndHorizontal(); if (currentEditor != EditorTypes.None) { if (currentEditor == EditorTypes.Dialogs) { EditorGUILayout.BeginVertical(); RenderCreateDialog(); RenderDialogList(); EditorGUILayout.EndVertical(); } else if (currentEditor == EditorTypes.Vars) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); RenderCreateVars(); RenderVarsList(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); RenderVarEdit(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); } } }
public MainWindow() { var deserialize = JsonSerializer.Deserialize <List <XX> >(File.ReadAllText(@"C:\temp\editors1.json")); GrovelTypes(); foreach (var(item1, item2) in deserialize.Select(xx => Tuple.Create(Type.GetType(xx.Item1), Type.GetType(xx.Item2)))) { EditorTypes.Add(new TypeNode2(new NamespaceType() { Type = item1 })); } InitializeComponent(); AllowDrop = true; tt.RootItems = EditorTypes; VisualTreeViewModel.RootVisual = this; }
/// <summary> /// Select the type of editor /// </summary> public void SelectEditorType(EditorTypes type) { this.CurrentEditorType = type; for (int i = 0; i < this.CharacterTabButton.Length; i++) { if (this.CharacterTabButton[i].CurrentEditorType != type) { this.CharacterTabButton[i].ButtonToggle(true); } else { this.CharacterTabButton[i].ButtonToggle(false); } } this.CharacterDisplay.ShowPanel(EditorTypes.CharacterEditor == type); this.AccessoryDisplayHolder.SetActive(EditorTypes.AccSkillEditor == type); this.CharacterAccessoryHolder.SetActive(EditorTypes.AccSkillEditor == type); }
protected override void OnInit(EventArgs e) { base.OnInit(e); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); var oLink = new System.Web.UI.HtmlControls.HtmlGenericControl("link"); oLink.Attributes["rel"] = "stylesheet"; oLink.Attributes["type"] = "text/css"; oLink.Attributes["href"] = Page.ResolveUrl("~/DesktopModules/ActiveForums/scripts/calendar.css"); var oCSS = Page.FindControl("CSS"); if (oCSS != null) oCSS.Controls.Add(oLink); _fi = ForumInfo; _authorId = UserId; _canModEdit = Permissions.HasPerm(_fi.Security.ModEdit, ForumUser.UserRoles); _canModApprove = Permissions.HasPerm(_fi.Security.ModApprove, ForumUser.UserRoles); _canEdit = Permissions.HasPerm(_fi.Security.Edit, ForumUser.UserRoles); _canAttach = Permissions.HasPerm(_fi.Security.Attach, ForumUser.UserRoles); _canTrust = Permissions.HasPerm(_fi.Security.Trust, ForumUser.UserRoles); _canLock = Permissions.HasPerm(_fi.Security.Lock, ForumUser.UserRoles); _canPin = Permissions.HasPerm(_fi.Security.Pin, ForumUser.UserRoles); _canAnnounce = Permissions.HasPerm(_fi.Security.Announce, ForumUser.UserRoles); if (_fi == null) Response.Redirect(NavigateUrl(ForumTabId)); else if (Request.Params["action"] != null) { if (!_canEdit && (Request.Params["action"].ToLowerInvariant() == "te" || Request.Params["action"].ToLowerInvariant() == "re")) Response.Redirect(NavigateUrl(ForumTabId)); } if (CanCreate == false && CanReply == false) Response.Redirect(NavigateUrl(ForumTabId, "", "ctl=login") + "?returnurl=" + Server.UrlEncode(Request.RawUrl)); if (UserId > 0) _ui = ForumUser.Profile; else { _ui.TopicCount = 0; _ui.ReplyCount = 0; _ui.RewardPoints = 0; _ui.IsMod = false; _ui.TrustLevel = -1; } _userIsTrusted = Utilities.IsTrusted((int)_fi.DefaultTrustValue, _ui.TrustLevel, _canTrust, _fi.AutoTrustLevel, _ui.PostCount); Spinner = Page.ResolveUrl("~/DesktopModules/activeforums/themes/" + MainSettings.Theme + "/images/loading.gif"); _isApproved = !_fi.IsModerated || _userIsTrusted || _canModApprove; var myTheme = MainSettings.Theme; _themePath = Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + myTheme); ctlForm.ID = "ctlForm"; ctlForm.PostButton.ImageUrl = _themePath + "/images/save32.png"; ctlForm.PostButton.ImageLocation = "TOP"; ctlForm.PostButton.Height = Unit.Pixel(50); ctlForm.PostButton.Width = Unit.Pixel(50); ctlForm.PostButton.ClientSideScript = "amPostback();"; ctlForm.PostButton.PostBack = false; ctlForm.AttachmentsClientId = hidAttachments.ClientID; // TODO: Make sure this check happens on submit //if (_canAttach && _fi.AllowAttach) {} ctlForm.CancelButton.ImageUrl = _themePath + "/images/cancel32.png"; ctlForm.CancelButton.ImageLocation = "TOP"; ctlForm.CancelButton.PostBack = false; ctlForm.CancelButton.ClientSideScript = "javascript:history.go(-1);"; ctlForm.CancelButton.Confirm = true; ctlForm.CancelButton.Height = Unit.Pixel(50); ctlForm.CancelButton.Width = Unit.Pixel(50); ctlForm.CancelButton.ConfirmMessage = GetSharedResource("[RESX:ConfirmCancel]"); ctlForm.ModuleConfiguration = ModuleConfiguration; ctlForm.Subscribe = UserPrefTopicSubscribe; if (_fi.AllowHTML) { _allowHTML = IsHtmlPermitted(_fi.EditorPermittedUsers, _userIsTrusted, _canModEdit); } ctlForm.AllowHTML = _allowHTML; if (_allowHTML) { _editorType = _fi.EditorType; } else { _editorType = EditorTypes.TEXTBOX; } if (Request.Browser.IsMobileDevice) { _editorType = EditorTypes.TEXTBOX; _allowHTML = false; } ctlForm.EditorType = _editorType; ctlForm.ForumInfo = _fi; ctlForm.RequireCaptcha = true; switch (_editorType) { case EditorTypes.TEXTBOX: Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/text_editor.js")); break; case EditorTypes.ACTIVEEDITOR: Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/active_editor.js")); break; default: { var prov = ProviderConfiguration.GetProviderConfiguration("htmlEditor"); if (prov.DefaultProvider.ToLowerInvariant().Contains("telerik") | prov.DefaultProvider.ToLowerInvariant().Contains("radeditor")) { Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/telerik_editor.js")); } else if (prov.DefaultProvider.Contains("CKHtmlEditorProvider")) { Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/ck_editor.js")); } else if (prov.DefaultProvider.Contains("FckHtmlEditorProvider")) { Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/fck_editor.js")); } else { Page.ClientScript.RegisterClientScriptInclude("afeditor", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/other_editor.js")); } } break; } if (Request.Params["action"] != null) { switch (Request.Params["action"].ToLowerInvariant()) { case "te": //Topic Edit if (_canModEdit || (_canEdit && Request.IsAuthenticated)) { _isEdit = true; PrepareTopic(); LoadTopic(); } break; case "re": //Reply Edit if (_canModEdit || (_canEdit && Request.IsAuthenticated)) { _isEdit = true; PrepareReply(); LoadReply(); } break; case "reply": if (CanReply) { PrepareReply(); } break; case "new": if (CanCreate) { PrepareTopic(); } break; default: if (CanCreate) { PrepareTopic(); } break; } } else { if (QuoteId == 0 && ReplyId == 0 && TopicId == -1 && CanCreate) { PrepareTopic(); } else if ((QuoteId > 0 | ReplyId > 0 | TopicId > 0) && CanReply) { PrepareReply(); } } if (_isEdit && !Request.IsAuthenticated) { Response.Redirect(NavigateUrl(ForumTabId)); } PrepareAttachments(_contentId); ctlForm.ContentId = _contentId; ctlForm.AuthorId = _authorId; plhContent.Controls.Add(ctlForm); EditorClientId = ctlForm.ClientID; ctlForm.BubbleClick += ctlForm_Click; cbPreview.CallbackEvent += cbPreview_Callback; //Page.ClientScript.RegisterClientScriptInclude("aftags", Page.ResolveUrl("~/desktopmodules/activeforums/scripts/jquery.tokeninput.js")) }
public string LoadEmoticons(EditorTypes Type, int ModuleId, string ImagePath) { return(RegisterEmotIcons(ModuleId, ImagePath, Type)); }
public static string CleanString(int portalId, string text, bool allowHTML, EditorTypes editorType, bool useFilter, bool allowScript, int moduleId, string themePath, bool processEmoticons) { var sClean = HttpContext.Current.Server.HtmlDecode(text); if (sClean != string.Empty) { if (!allowHTML) sClean = HTMLEncode(sClean); sClean = editorType == EditorTypes.TEXTBOX ? CleanTextBox(portalId, sClean, allowHTML, useFilter, moduleId, themePath, processEmoticons) : CleanEditor(portalId, sClean, useFilter, moduleId, themePath, processEmoticons); var regExp = new Regex(@"(<a [^>]*>)(?'url'(\S*?))(</a>)", RegexOptions.IgnoreCase); var matches = regExp.Matches(sClean); foreach (Match match in matches) { var sNewURL = match.Groups[0].Value; var sStart = match.Groups[1].Value; var sText = match.Groups[2].Value; var sEnd = match.Groups[3].Value; if (sText.Length > 55) sClean = sClean.Replace(sNewURL, sStart + sText.Substring(0, 35) + "..." + sText.Substring(sText.Length - 10) + sEnd); } if (!allowScript) { sClean = sClean.Replace("[", "["); sClean = sClean.Replace("]", "]"); sClean = XSSFilter(sClean); } sClean = sClean.Replace("[", "["); sClean = sClean.Replace("]", "]"); } return sClean; }
internal static string PrepareForEdit(int portalId, int moduleId, string themePath, string text, bool allowHTML, EditorTypes editorType) { if (!allowHTML) { text = text.Replace("[", "["); text = text.Replace("]", "]"); text = text.Replace("<br>", System.Environment.NewLine); text = text.Replace("<br />", System.Environment.NewLine); text = text.Replace("<BR>", System.Environment.NewLine); text = RemoveFilterWords(portalId, moduleId, themePath, text); return text; } if (editorType == EditorTypes.TEXTBOX) { text = text.Replace("[", "["); text = text.Replace("]", "]"); text = text.Replace("<br>", System.Environment.NewLine); text = text.Replace("<br />", System.Environment.NewLine); text = text.Replace("<BR>", System.Environment.NewLine); text = RemoveFilterWords(portalId, moduleId, themePath, text); return text; } return text; }
public override void OnInspectorGUI() { serializedObject.Update(); Setup(); if (props.Count == 0) { DrawDefaultInspector(); return; } Header(); Body(); serializedObject.ApplyModifiedProperties(); void Header() { using (new EditorGUI.DisabledScope("m_Script" == props[0].propertyPath)) { EditorGUILayout.Space(); EditorGUILayout.PropertyField(props[0], true); EditorGUILayout.Space(); } } void Body() { foreach (var pair in cacheFolds) { this.UseVerticalLayout(() => Foldout(pair.Value), StyleFramework.box); EditorGUI.indentLevel = 0; } EditorGUILayout.Space(); for (var i = 1; i < props.Count; i++) { EditorGUILayout.PropertyField(props[i], true); } EditorGUILayout.Space(); if (methods == null) { return; } foreach (MethodInfo memberInfo in methods) { this.UseButton(memberInfo); } } void Foldout(CacheFoldProp cache) { cache.expanded = EditorGUILayout.Foldout(cache.expanded, cache.atr.name, true, StyleFramework.foldout); if (cache.expanded) { EditorGUI.indentLevel = 1; for (int i = 0; i < cache.props.Count; i++) { this.UseVerticalLayout(() => Child(i), StyleFramework.boxChild); } } void Child(int i) { EditorGUILayout.PropertyField(cache.props[i], new GUIContent(cache.props[i].name.FirstLetterToUpperCase()), true); } } void Setup() { EditorFramework.currentEvent = Event.current; if (!initialized) { List <FieldInfo> objectFields; FoldoutAttribute prevFold = default; var length = EditorTypes.Get(target, out objectFields); for (var i = 0; i < length; i++) { #region FOLDERS var fold = Attribute.GetCustomAttribute(objectFields[i], typeof(FoldoutAttribute)) as FoldoutAttribute; CacheFoldProp c; if (fold == null) { if (prevFold != null && prevFold.foldEverything) { if (!cacheFolds.TryGetValue(prevFold.name, out c)) { cacheFolds.Add(prevFold.name, new CacheFoldProp { atr = prevFold, types = new HashSet <string> { objectFields[i].Name } }); } else { c.types.Add(objectFields[i].Name); } } continue; } prevFold = fold; if (!cacheFolds.TryGetValue(fold.name, out c)) { var expanded = EditorPrefs.GetBool(string.Format($"{fold.name}{objectFields[i].Name}{target.name}"), false); cacheFolds.Add(fold.name, new CacheFoldProp { atr = fold, types = new HashSet <string> { objectFields[i].Name }, expanded = expanded }); } else { c.types.Add(objectFields[i].Name); } #endregion } var property = serializedObject.GetIterator(); var next = property.NextVisible(true); if (next) { do { HandleFoldProp(property); } while (property.NextVisible(false)); } initialized = true; } } }
public DiscussionInfo(EditorTypes editorFor) { this.EditorFor = editorFor; }
public string LoadEmoticons(EditorTypes Type, int ModuleId, string ImagePath) { return RegisterEmotIcons(ModuleId, ImagePath, Type); }