protected override void OnInit(EventArgs e) { if (int.TryParse(Request.QueryString["mid"], out ModuleID) && ModuleID == 0 && Request.QueryString.Get("guid") != null && !string.IsNullOrEmpty(Request.QueryString.Get("guid"))) { ext = MenuManager.GetExtentions(false).Where(x => x.SettingGuid == Guid.Parse(Request.QueryString.Get("guid"))).FirstOrDefault(); if (ext == null) { ext = ToolbarManager.GetExtentions().Where(x => x.SettingGuid == Guid.Parse(Request.QueryString.Get("guid"))).FirstOrDefault(); } if (ext == null) { ext = AppManager.GetExtentions(AppType.None).Where(x => x.SettingGuid == Guid.Parse(Request.QueryString.Get("guid"))).FirstOrDefault(); } if (ext == null) { ext = Core.Managers.BlockManager.GetExtentions().Where(x => x.Guid == Guid.Parse(Request.QueryString.Get("guid"))).FirstOrDefault(); } if (ext == null) { ext = Core.Managers.ExtensionManager.Extentions.Where(x => x.SettingGuid == Guid.Parse(Request.QueryString.Get("guid"))).FirstOrDefault(); } } base.OnInit(e); WebForms.LinkCSS(Page, "extensioncommoncss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/StyleSheets/common.css")); FrameworkManager.Load(this, "FontAwesome"); //For ThemeBuilder if (!string.IsNullOrEmpty(Request.QueryString["guid"]) && Request.QueryString["guid"].ToLower() == "726c5619-e193-4605-acaf-828576ba095a") { FrameworkManager.Load(this, "SpectrumColorPicker"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["m2v"] == null) { m2v = null; } else { m2v = Convert.ToBoolean(Request.QueryString["m2v"]); } if (IsAllowed()) { if (string.IsNullOrEmpty(Request.QueryString["ctl"]) && (string.IsNullOrEmpty(Request.QueryString["icp"]) || Convert.ToBoolean(Request.QueryString["icp"]) == false)) { if (string.IsNullOrEmpty(Request.QueryString["uxmode"])) { Literal lt = new Literal(); IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>; dynObjects.Add("Setting", GetBaseModel()); string Template = RazorEngineManager.RenderTemplate("VanjaroUXManager", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/"), "Base", dynObjects); Template = new DNNLocalizationEngine(null, Server.MapPath("~/DesktopModules/Vanjaro/UXManager/Library/App_LocalResources/Shared.resx"), ShowMissingKeys).Parse(Template); lt.Text = Template; Controls.Add(lt); } string DirectoryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/DesktopModules/Vanjaro/UXManager/Library/Resources/tui/"); if (Directory.Exists(DirectoryPath)) { foreach (string file in Directory.GetFiles(DirectoryPath)) { string FileName = Path.GetFileName(file); if (!string.IsNullOrEmpty(FileName)) { if (FileName.EndsWith(".js")) { WebForms.RegisterClientScriptInclude(Page, FileName.Replace(".", ""), Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/tui/" + FileName), false); } else { WebForms.LinkCSS(Page, FileName.Replace(".", ""), Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/tui/" + FileName), false); } } } } WebForms.LinkCSS(Page, "UXManagerAppCss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/StyleSheets/app.css")); WebForms.LinkCSS(Page, "GrapesJsCss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/GrapesJs/css/grapes.min.css")); WebForms.LinkCSS(Page, "GrapickJsCss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/GrapesJs/css/grapick.min.css")); WebForms.RegisterClientScriptInclude(Page, "GrapesJsJs", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/uxmanager.min.js"), false); WebForms.LinkCSS(Page, "GrapesJsPanelCss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/jsPanel/jspanel.min.css")); WebForms.LinkCSS(Page, "GrapesJspluginCss", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/GrapesJsManagers/css/uxmanager.css")); WebForms.LinkCSS(Page, "FontawesomeV4Css", Page.ResolveUrl("~/DesktopModules/Vanjaro/UXManager/Library/Resources/Scripts/GrapesJs/css/fontawesome/v4.css")); if (!IsAllowed()) { WebForms.RegisterClientScriptBlock(Page, "MenuSettingsBlocks", "$(document).ready(function(){$('[href=\"#MenuSettings\"]').click();$('#mode-switcher').remove();setTimeout(function(){$('.gjs-cv-canvas__frames').css('pointer-events','none');}, 100); });", true); } LocalizeGrapeJS(); FrameworkManager.Load(this, "FontAwesome"); } string NavigateURL = PageManager.GetCurrentTabUrl(PortalSettings); string ClientScript = "var AppMenus=" + JsonConvert.SerializeObject(AppManager.GetAll(AppType.Module)) + "; var m2vPageTabUrl='" + NavigateURL + "'; var CurrentTabUrl ='" + NavigateURL + "'; var IsAdmin=" + PortalSettings.UserInfo.IsInRole("Administrators").ToString().ToLower() + ";"; WebForms.RegisterClientScriptBlock(Page, "GrapesJsAppsExts", ClientScript, true); if (TabPermissionController.HasTabPermission("EDIT") && !Request.QueryString.AllKeys.Contains("mid")) { string OpenPopup = string.Empty; if (m2v.HasValue && !m2v.Value && (Vanjaro.Core.Managers.PageManager.GetPages(PortalSettings.ActiveTab.TabID).Count == 0)) { OpenPopup = "#/choosetemplate"; } else if (Request.QueryString["m2vsetup"] != null && Request.QueryString["m2vsetup"] == "page") { OpenPopup = "#detail"; } if (!string.IsNullOrEmpty(OpenPopup)) { NavigateURL = PageManager.GetCurrentTabUrl(PortalSettings, "&mid=0&icp=true&guid=10E56C75-548E-4A10-822E-52E6AA2AB45F" + OpenPopup); WebForms.RegisterStartupScript(Page, "m2v", "<script type=\"text/javascript\" vanjarocore=\"true\">OpenPopUp(event, 800,'right','Choose Template', '" + NavigateURL + "')</script>", false); } } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); //WebForms.InitURLLibrary(this); //Request Services Framework ServicesFramework.Instance.RequestAjaxScriptSupport(); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); //Request jQuery & UI Support JavaScript.RequestRegistration(CommonJs.jQuery); if (Dependencies.Contains(Frameworks.jQueryUI.ToString())) { JavaScript.RequestRegistration(CommonJs.jQueryUI); WebForms.LinkCSS(Page, "JQuery" + "-JQuery-css", FrameworkManager.Request("JQuery", "css", "smoothness.css")); } WebForms.RegisterClientScriptInclude(Page, "DNNModal", Page.ResolveUrl("js/dnn.modalpopup.js")); //Load Angular JS FrameworkManager.Load(this, "AngularJS"); //Load Angular Common Service FrameworkManager.LoadPlugin(this, "AngularJS", "mnCommonService", "mnCommonService.min.js"); //Load Ckeditor if (Dependencies.Contains(AngularPlugins.CKEditor.ToString())) { FrameworkManager.Load(this, "Ckeditor", false); } //Load ColorPicker if (Dependencies.Contains(JavaScriptPlugins.ColorPicker.ToString())) { FrameworkManager.Load(this, "ColorPicker"); } if (Dependencies.Contains(JavaScriptPlugins.ValidationJS.ToString())) { FrameworkManager.Load(this, "ValidationJS"); } if (Dependencies.Contains(Frameworks.FontAwesome.ToString())) { FrameworkManager.Load(this, "FontAwesome"); } if (Dependencies.Contains(JavaScriptPlugins.SpectrumColorPicker.ToString())) { FrameworkManager.Load(this, "SpectrumColorPicker"); } if (Dependencies.Contains(JavaScriptPlugins.ContextMenu.ToString())) { FrameworkManager.Load(this, "ContextMenu"); } //Load JsonViewer if (Dependencies.Contains(JavaScriptPlugins.JsonViewer.ToString())) { FrameworkManager.Load(this, "JsonViewer"); } //Load JsonViewer if (Dependencies.Contains(JavaScriptPlugins.Barcode.ToString())) { FrameworkManager.Load(this, "Barcode"); } if (Dependencies.Contains(JavaScriptPlugins.Notify.ToString())) { FrameworkManager.Load(this, "Notify"); } if (Dependencies.Contains(JavaScriptPlugins.Numeral.ToString())) { FrameworkManager.Load(this, "Numeral"); } if (Dependencies.Contains(JavaScriptPlugins.CodeMirror.ToString())) { FrameworkManager.Load(this, "CodeMirror"); } if (Dependencies.Contains(JavaScriptPlugins.Toastr.ToString())) { FrameworkManager.Load(this, "Toastr"); } if (Dependencies.Contains(JavaScriptPlugins.BootstrapDatepicker.ToString())) { FrameworkManager.Load(this, "BootstrapDatepicker"); } if (Dependencies.Contains(AngularPlugins.Grid.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "SmartTable", "smart-table.min.js"); } if (Dependencies.Contains(AngularPlugins.FileUpload.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "FileUpload", "ng-file-upload.min.js"); } if (Dependencies.Contains(AngularPlugins.CSVImport.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "AngularCsvImport", "angular-csv-import.min.js"); WebForms.RegisterClientScriptBlock(Page, "ImportHandler", "var mnImportHandler = '" + Page.ResolveUrl("DesktopModules/Vanjaro/Common/Handlers/ImportMapHandler.ashx?portalid=" + PortalId.ToString()) + "';", true); } WebForms.LinkCSS(Page, "AngularJS" + "-SweetAlert-css", FrameworkManager.Request("AngularJs", "Plugins", "SweetAlert/sweetalert.css")); FrameworkManager.LoadPlugin(this, "AngularJS", "SweetAlert", "alert.min.js"); FrameworkManager.LoadPlugin(this, "AngularJS", "SweetAlert", "SweetAlert.min.js"); if (Dependencies.Contains(AngularPlugins.TreeView.ToString())) { WebForms.LinkCSS(Page, "AngularJS" + "-TreeView-css", FrameworkManager.Request("AngularJs", "Plugins", "TreeView/angular-ui-tree.min.css")); FrameworkManager.LoadPlugin(this, "AngularJS", "TreeView", "angular-ui-tree.min.js"); } if (Dependencies.Contains(AngularPlugins.Dialog.ToString())) { WebForms.LinkCSS(Page, "AngularJS" + "-Dialog-css", FrameworkManager.Request("AngularJs", "Plugins", "Dialog/ngDialog.min.css")); WebForms.LinkCSS(Page, "AngularJS" + "-Dialog-default-css", FrameworkManager.Request("AngularJs", "Plugins", "Dialog/ngDialog-theme-default.min.css")); FrameworkManager.LoadPlugin(this, "AngularJS", "Dialog", "ngDialog.min.js"); } //Load Angular Loading Bar FrameworkManager.LoadPlugin(this, "AngularJS", "loading-bar", "loading-bar.min.js"); WebForms.LinkCSS(Page, "AngularJS" + "-loading-css", FrameworkManager.Request("AngularJs", "Plugins", "loading-bar/loading-bar.min.css")); //Load Angular XEditable if (Dependencies.Contains(AngularPlugins.InlineEditor.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "x-editable", "js/xeditable.min.js"); WebForms.LinkCSS(Page, "AngularJS" + "-xeditable-css", FrameworkManager.Request("AngularJs", "Plugins", "x-editable/css/xeditable.css")); } //Load Angular Tags Input if (Dependencies.Contains(AngularPlugins.Tags.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "TagsInput", "js/ng-tags-input.min.js"); WebForms.LinkCSS(Page, "AngularJS" + "-tags-input-css", FrameworkManager.Request("AngularJs", "Plugins", "tagsinput/css/ng-tags-input.min.css")); WebForms.LinkCSS(Page, "AngularJS" + "-tags-input-bootstrap-css", FrameworkManager.Request("AngularJs", "Plugins", "tagsinput/css/ng-tags-input.bootstrap.min.css")); } //Load autocomplete if (Dependencies.Contains(AngularPlugins.AutoComplete.ToString())) { FrameworkManager.LoadPlugin(this, "AngularJS", "autocomplete", "js/autocomplete.min.js"); WebForms.LinkCSS(Page, "AngularJS" + "-autocomplete-css", FrameworkManager.Request("AngularJs", "Plugins", "autocomplete/css/autocomplete.css")); } //Load Bootstrap FrameworkManager.Load(this, "Bootstrap"); //Load WebAPI FrameworkManager.Load(this, "WebAPI"); if (Dependencies.Contains(JavaScriptPlugins.ReCaptcha.ToString())) { FrameworkManager.Load(this, "ReCaptcha"); } //Add Necessary Markup for Angular App Literal lit = new Literal { Text = "<div class=\"container-fluid " + App.Name + " \" id=\"" + App.Name + ModuleId.ToString() + "\" data-app-name=\"" + App.Name + " \" data-show-missing-keys=\"" + ShowMissingKeys.ToString().ToLower() + "\" data-roles=\"" + string.Join(",", AccessRoles) + "\" data-ModuleId=\"" + ModuleId.ToString() + "\" ng-controller=\"" + ControllerName + "\"><div ng-view=\"\" class=\"view-animate\"></div></div>" }; Controls.Add(lit); if (!IsPostBack) { //Add Necessary Script to Initialize App string AngularAppScript = "angular.element(document).ready(function () {angular.bootstrap(document.getElementById(\"" + App.Name + ModuleId.ToString() + "\"), [\"" + App.Name + "\"]);});"; WebForms.RegisterStartupScript(Page, "angular-init" + ModuleId.ToString(), AngularAppScript, true); //serialized form data into hidden field Dictionary <string, object> dicFormData = new Dictionary <string, object>(); foreach (string key in HttpContext.Current.Request.Form.AllKeys) { if (!string.IsNullOrEmpty(key)) { if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form[key])) { dicFormData.Add(key, HttpContext.Current.Request.Form[key].Replace("'", "'")); } else { dicFormData.Add(key, HttpContext.Current.Request.Form[key]); } } } Controls.Add(new Literal() { Text = "<input type=\"hidden\" name=\"hfFormData\" value=\'" + JsonConvert.SerializeObject(dicFormData) + "\'>" }); } //serialized form data into hidden field //Dictionary<string, object> dicFormData = new Dictionary<string, object>(); //foreach (string key in HttpContext.Current.Request.Form.AllKeys) //{ // dicFormData.Add(key, HttpContext.Current.Request.Form[key]); //} //this.Controls.Add(new Literal() { Text = "<input type=\"hidden\" name=\"hfFormData\" value=\'" + JsonConvert.SerializeObject(dicFormData) + "\'>" }); //Literal s = new Literal(); //lit.Text = "<script>" + AngularAppScript + "</script>"; //this.Controls.Add(s); }
private void AddModulePanes() { //Get the Page Markup if (!IsAllowed()) { if (FindControlRecursive(this, "ContentPane") == null) { Controls.Add(ParseControl("<div id=\"ContentPane\" runat=\"server\" />")); } BuildPanes(); return; } if (string.IsNullOrEmpty(Request.QueryString["ctl"])) { if (FindControlRecursive(this, "ContentPane") == null) { Controls.Add(ParseControl("<div id=\"ContentPane\" runat=\"server\" />")); } Control ContentPane = FindControlRecursive(this, "ContentPane"); StringBuilder sb = new StringBuilder(); page = GetPage(); if (page != null) { InjectStyle(page); if (page.ReplaceTokens) { sb.Append(new TokenReplace().ReplaceEnvironmentTokens(page.Content)); } else { sb.Append(page.Content.ToString()); } } if (page != null && page.StateID.HasValue) { HasReviewPermission = WorkflowManager.HasReviewPermission(page.StateID.Value, PortalSettings.UserInfo); } if (TabPermissionController.HasTabPermission("EDIT") || (page != null && page.StateID.HasValue && HasReviewPermission)) { FrameworkManager.Load(this, "jQuerySweetAlert"); FrameworkManager.Load(this, "Toastr"); } if ((TabPermissionController.HasTabPermission("EDIT") || HasReviewPermission)) { WebForms.RegisterClientScriptBlock(Page, "ReviewGlobalVariable", GetReviewGlobalVariable(PortalSettings, HasReviewPermission), true); } if (!TabPermissionController.HasTabPermission("EDIT") && HasReviewPermission) { FrameworkManager.Load(this, "FontAwesome"); } if (TabPermissionController.HasTabPermission("EDIT")) { try { string Fonts = JsonConvert.SerializeObject(Core.Managers.ThemeManager.GetDDLFonts("all")); WebForms.RegisterClientScriptBlock(Page, "VJThemeFonts", "var VJFonts=" + Fonts + ";", true); } catch (Exception) { } } HtmlDocument html = new HtmlDocument(); html.LoadHtml(sb.ToString()); InjectBlocks(page, html); string ClassName = "vj-wrapper"; if (!string.IsNullOrEmpty(Request.QueryString["m2v"]) && string.IsNullOrEmpty(Request.QueryString["pv"])) { ClassName += " m2vDisplayNone"; } ContentPane.Controls.Add(ParseControl("<div class=\"" + ClassName + "\"><div id=\"VjContentPane\">" + InjectModules(html.DocumentNode.OuterHtml) + "</div></div>")); InjectLoginAuthentication(); } else { string FolderPath = HttpContext.Current.Server.MapPath("~/Portals/_default/vThemes/" + Core.Managers.ThemeManager.GetCurrentThemeName() + "/Layout.Edit.html"); string Content = System.IO.File.ReadAllText(FolderPath); Controls.Add(ParseControl(Content)); } BuildPanes(); }