protected void btnSave_Click(object sender, EventArgs e) { try { //Session["COD_INCIDENCE"] = grvHtml.DataKeys[rowIndex]["COD_HTML_PK"].ToString(); TitleSubtitle1.SetSubTitleVisible = false; HTMLEditor incidence = new HTMLEditor(); string strHtml = txtContenido.Content; //strHtml = strHtml.Replace("&","|||"); //strHtml = "'" + strHtml + "'"; string strDesc = txtDescript.Text; decimal idHtml = Convert.ToDecimal(Session["COD_INCIDENCE"]); string id2 = Convert.ToString(idHtml); int id3 = Convert.ToInt32(id2); //preCKEditorData.InnerText = strHtml; incidence.UpdateHtml(strHtml, strDesc, idHtml); if (incidence.Messages.Status == 1) { wucMessageControl.Title = "Mensaje"; wucMessageControl.Image = "../include/imagenes/info_32.png"; } else { wucMessageControl.Title = "Error"; wucMessageControl.Image = "../include/imagenes/error_32.png"; } wucMessageControl.Message = incidence.Messages.Message; wucMessageControl.ShowPopup(); Fill_gvEmail(ddlClasif.Text, true); pnlEditor.Visible = false; pnlLoad.Visible = true; } catch (Exception ex) { TitleSubtitle1.SetSubtitle("OcurriĆ³ un inconveniente"); TitleSubtitle1.SetSubTitleVisible = true; SafetyPad.SetLogRecord("HtmlEditor.aspx.cs", ex.ToString()); } }
internal static string DeleteProfile(int portalID, int profileid) { if (profileid > 0) { int ProfileInUse = HTMLEditor.Query("where ProfileID=@0", profileid).Count(); if (ProfileInUse > 0) { return("inuse"); } else { HTMLEditor_Profile Profile = HTMLEditor_Profile.FirstOrDefault("where PortalID=@0 and ProfileID=@1", portalID, profileid); if (Profile != null) { Profile.Delete(); } return("deleted"); } } return(null); }
public bool SaveEditorProfile(string uid, int profileid, string applyto, HTMLEditorSetting settings) { if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(applyto)) { string uniqueUid = uid; try { switch (applyto) { case "CurrentModule": { if (ActiveModule != null) { uid = uniqueUid.ToLower().Trim() + ActiveModule.ModuleID; } else { uid = uniqueUid.ToLower().Trim() + "0"; } HTMLEditor HTMLEditor = HTMLEditor.Query("where UID=@0", uid).SingleOrDefault(); if (HTMLEditor != null) { HTMLEditor.ProfileID = profileid; HTMLEditor.Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings); HTMLEditor.Update(); } else { HTMLEditor = new HTMLEditor { ProfileID = profileid, UID = uid, Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings), PortalID = PortalSettings.ActiveTab.PortalID, TabID = PortalSettings.ActiveTab.TabID }; HTMLEditor.Insert(); } break; } case "PageModule": { foreach (ModuleInfo moduleinfo in EditorConfigFactory.GetTabModules(ActiveModule)) { uid = uniqueUid.ToLower().Trim() + moduleinfo.ModuleID; HTMLEditor HTMLEditor = HTMLEditor.Query("where UID=@0", uid).SingleOrDefault(); if (HTMLEditor != null) { HTMLEditor.ProfileID = profileid; HTMLEditor.Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings); HTMLEditor.Update(); } else { HTMLEditor = new HTMLEditor { ProfileID = profileid, UID = uid, Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings) }; HTMLEditor.Insert(); } } break; } case "PortalModule": { foreach (ModuleInfo moduleinfo in EditorConfigFactory.GetPortalModules(ActiveModule)) { uid = uniqueUid.ToLower().Trim() + moduleinfo.ModuleID; HTMLEditor HTMLEditor = HTMLEditor.Query("where UID=@0", uid).SingleOrDefault(); if (HTMLEditor != null) { HTMLEditor.ProfileID = profileid; HTMLEditor.Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings); HTMLEditor.Update(); } else { HTMLEditor = new HTMLEditor { ProfileID = profileid, UID = uid, Settings = DotNetNuke.Common.Utilities.Json.Serialize(settings) }; HTMLEditor.Insert(); } } break; } default: goto case "CurrentModule"; } return(true); } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } } return(false); }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { _fileExtension = string.Empty; eventGetDocument = null; htmlEditor = null; }
/// <summary> /// Binds the content. /// </summary> /// <param name="eventGetInteractionContent">Content of the event get interaction.</param> public void BindContent(EventGetInteractionContent eventGetInteractionContent) { try { if (eventGetInteractionContent != null) { if (eventGetInteractionContent.InteractionAttributes.StartDate != null && eventGetInteractionContent.InteractionAttributes.StartDate.ToString() != string.Empty) { lblInboundDateTime.Text = eventGetInteractionContent.InteractionAttributes.StartDate.ToString(); lblInboundDateTime.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetLocalDateTime(eventGetInteractionContent.InteractionAttributes.StartDate.ToString()); } if (eventGetInteractionContent.EntityAttributes != null) { EmailInEntityAttributes emailInEntityAttributes = (EmailInEntityAttributes)eventGetInteractionContent.EntityAttributes; if (!string.IsNullOrEmpty(emailInEntityAttributes.CcAddresses)) { txtInboundCc.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(emailInEntityAttributes.CcAddresses); dockCc.Visibility = Visibility.Visible; } else { dockCc.Visibility = Visibility.Collapsed; } if (!string.IsNullOrEmpty(emailInEntityAttributes.BccAddresses)) { txtInboundBcc.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(emailInEntityAttributes.BccAddresses); dockBcc.Visibility = Visibility.Visible; } else { dockBcc.Visibility = Visibility.Collapsed; } } if (eventGetInteractionContent.Attachments != null) { foreach (Attachment attachementDetails in eventGetInteractionContent.Attachments) { wrapInboundAttachments.Children.Add(LoadAttachments(attachementDetails.TheName, Convert.ToInt64(attachementDetails.TheSize.Value.ToString()), attachementDetails.DocumentId)); attacScroll.ScrollToTop(); } } if (!string.IsNullOrEmpty(eventGetInteractionContent.InteractionContent.StructuredText)) { htmlEditor = new HTMLEditor(false, true, eventGetInteractionContent.InteractionContent.StructuredText); //htmlEditor.Width = dockInboundContent.ActualWidth; //htmlEditor.Height = dockInboundContent.ActualHeight; dockInboundContent.Children.Clear(); dockInboundContent.Children.Add(htmlEditor); } else if (!string.IsNullOrEmpty(eventGetInteractionContent.InteractionContent.Text)) { string content = eventGetInteractionContent.InteractionContent.Text.Replace("\r\n", "<br />"); content = eventGetInteractionContent.InteractionContent.Text.Replace("\n", "<br />"); htmlEditor = new HTMLEditor(false, false, content); //htmlEditor.Width = dockInboundContent.ActualWidth; //htmlEditor.Height = dockInboundContent.ActualHeight; dockInboundContent.Children.Clear(); dockInboundContent.Children.Add(htmlEditor); } } } catch (Exception ex) { logger.Error("Error occurred at BindContent " + ex.ToString()); } }
public static string GetEditorToolbarMarkupForRazor(int moduleid, string uid, string BrowseUrl, string Profile) { if (HTMLEditor_Profile.Query("").Count() < 4) { GetHTMLEditorProfiles(-1); } string result = string.Empty; HTMLEditor_Profile HTMLEditorProfile = null; HTMLEditor HTMLEditor = null; if (!string.IsNullOrEmpty(uid)) { uid = uid = uid.ToLower().Trim(); HTMLEditor = HTMLEditor.Query("where UID=@0", uid).SingleOrDefault(); if (HTMLEditor != null) { HTMLEditorProfile = HTMLEditor_Profile.Query("where ProfileID=@0", HTMLEditor.ProfileID).SingleOrDefault(); } if (HTMLEditorProfile == null) { string Preset = "Basic"; if (!string.IsNullOrEmpty(Profile)) { Preset = Profile; } int ProfileID = 0; if (HTMLEditor != null) { ProfileID = HTMLEditor.ProfileID; if (ProfileID == 0) { Preset = "Basic"; } if (ProfileID == -1) { Preset = "Standard"; } if (ProfileID == -2) { Preset = "Full"; } if (ProfileID == -3) { Preset = "Minimal"; } } else { switch (Preset) { case "Standard": ProfileID = -1; break; case "Full": ProfileID = -2; break; case "Minimal": ProfileID = -3; break; default: ProfileID = 0; break; } } EditorOptions EditorOptions = new EditorOptions { Plugins = GetPluginsKeyValueSaved(ProfileID) }; HTMLEditorProfile = new HTMLEditor_Profile() { ProfileID = ProfileID, PortalID = -1, Name = Preset, Value = DotNetNuke.Common.Utilities.Json.Serialize(EditorOptions) }; } } if (HTMLEditorProfile != null) { EditorOptions editorOptions = DotNetNuke.Common.Utilities.Json.Deserialize <EditorOptions>(HTMLEditorProfile.Value); if (editorOptions != null) { StringBuilder sb = new StringBuilder(); sb.Append("{"); if (!string.IsNullOrEmpty(editorOptions.Height)) { sb.Append("\"height\": \"" + editorOptions.Height + "\","); } if (!string.IsNullOrEmpty(editorOptions.Width)) { sb.Append("\"width\": \"" + editorOptions.Width + "\","); } if (!string.IsNullOrEmpty(editorOptions.UiColor)) { sb.Append("\"uiColor\": \"" + editorOptions.UiColor + "\","); } if (editorOptions.FilebrowserBrowseUrl && PortalSettings.Current.UserInfo.UserID > 0) { sb.Append("\"filebrowserBrowseUrl\": \"" + BrowseUrl + "&type=filebrowserBrowseUrl#/common/controls/url/" + uid.Replace(moduleid.ToString(), "") + "\","); } if (editorOptions.FilebrowserImageBrowseUrl && PortalSettings.Current.UserInfo.UserID > 0) { sb.Append("\"filebrowserImageBrowseUrl\": \"" + BrowseUrl + "&type=filebrowserImageBrowseUrl#/common/controls/url/" + uid.Replace(moduleid.ToString(), "") + "\","); } if (HTMLEditorProfile.ProfileID == -3) { sb.Append("\"removeButtons\": \"Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript,Outdent,Indent\","); } else { sb.Append("\"removeButtons\": \"\","); } sb.Append("\"disableNativeSpellChecker\": false,"); if (HTMLEditor != null && !string.IsNullOrEmpty(HTMLEditor.Settings)) { HTMLEditorSetting HTMLEditorSetting = DotNetNuke.Common.Utilities.Json.Deserialize <HTMLEditorSetting>(HTMLEditor.Settings); if (HTMLEditorSetting != null) { sb.Append("\"fullPage\": " + HTMLEditorSetting.FullPageMode.ToString().ToLower() + ","); } } if (HTMLEditorProfile.ProfileID != -3) { sb.Append("\"allowedContent\": true,"); } sb.Append("\"extraPlugins\": \"" + GetPlugins(editorOptions) + "\""); sb.Append("}"); result = sb.ToString(); } } return(result); }
internal static List <IUIData> GetData(PortalSettings portalSettings, ModuleInfo moduleInfo, Dictionary <string, string> parameters) { int PortalID = portalSettings.PortalId; int ModuleID = 0; if (moduleInfo != null) { ModuleID = moduleInfo.ModuleID; } string profile = string.Empty; if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.ToString().Contains("profile=")) { profile = HttpContext.Current.Request.UrlReferrer.ToString().Split('=').Last(); } else if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.ToString().Contains("profile/")) { profile = HttpContext.Current.Request.UrlReferrer.ToString().Split('/').Last(); if (profile.Contains('?')) { profile = profile.Split('?').First(); } } Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>(); List <HTMLEditor_Profile> HTMLEditorProfiles = GetHTMLEditorProfiles(PortalID); int ProfileID = 0; Settings.Add("UID", new UIData() { Name = "UID", Value = parameters.Where(p => p.Key == "uid").FirstOrDefault().Value }); HTMLEditor Editor = HTMLEditor.Query("where UID=@0", Settings["UID"].Value + ModuleID).SingleOrDefault(); if (Editor != null) { ProfileID = Editor.ProfileID; HTMLEditorSetting HTMLEditorSetting = DotNetNuke.Common.Utilities.Json.Deserialize <HTMLEditorSetting>(Editor.Settings); if (HTMLEditorSetting.UploadFilesRootFolder == 0) { HTMLEditorSetting.UploadFilesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID; } if (HTMLEditorSetting.UploadImagesRootFolder == 0) { HTMLEditorSetting.UploadImagesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID; } Settings.Add("Settings", new UIData() { Name = "Settings", Options = HTMLEditorSetting }); } else { if (!string.IsNullOrEmpty(profile) && HTMLEditorProfiles.Where(p => p.Name.ToLower() == profile.ToLower()).FirstOrDefault() != null) { ProfileID = HTMLEditorProfiles.Where(p => p.Name.ToLower() == profile.ToLower()).FirstOrDefault().ProfileID; } HTMLEditorSetting HTMLEditorSetting = new HTMLEditorSetting(); HTMLEditorSetting.UploadFilesRootFolder = HTMLEditorSetting.UploadImagesRootFolder = BrowseUploadFactory.GetRootFolder(PortalID).FolderID; Settings.Add("Settings", new UIData() { Name = "Settings", Options = HTMLEditorSetting }); } Settings.Add("Profiles", new UIData() { Name = "Profiles", Options = HTMLEditorProfiles, Value = ProfileID.ToString() }); Settings.Add("EditorOptions", new UIData() { Name = "EditorOptions", Options = GetEditorOptions(HTMLEditorProfiles, int.Parse(Settings["Profiles"].Value)) }); Settings.Add("LocalizationKeyValue", new UIData() { Name = "LocalizationKeyValue", Options = getLocalizationKeyValue() }); Settings.Add("Folders", new UIData() { Name = "Folders", Options = BrowseUploadFactory.GetFolders(PortalID) }); Settings.Add("IsSuperUser", new UIData() { Name = "IsSuperUser", Value = PortalSettings.Current.UserInfo.IsSuperUser.ToString() }); Settings.Add("ModuleID", new UIData() { Name = "ModuleID", Value = ModuleID.ToString() }); return(Settings.Values.ToList()); }