예제 #1
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;

                if (ps != null && ps.ActiveTab != null && ps.ActiveTab.BreadCrumbs == null)
                {
                    ps.ActiveTab.BreadCrumbs = new System.Collections.ArrayList();
                }

                Dictionary <string, string> BaseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "menu");
                if (Attributes["data-block-global"] == "true")
                {
                    Attributes = BaseAttributes;
                }
                else
                {
                    //Loop on base attributes and add missing attribute
                    foreach (KeyValuePair <string, string> attr in BaseAttributes)
                    {
                        if (!Attributes.ContainsKey(attr.Key))
                        {
                            Attributes.Add(attr.Key, attr.Value);
                        }
                    }
                }

                MenuSetting menuSetting = new MenuSetting
                {
                    NodeSelector  = Attributes["data-block-nodeselector"],
                    IncludeHidden = Convert.ToBoolean(Attributes["data-block-includehidden"]),
                };

                MenuNode rootNode = new MenuNode(
                    Localiser.LocaliseDNNNodeCollection(
                        Navigation.GetNavigationNodes(
                            ExtensionInfo.GUID,
                            Navigation.ToolTipSource.None,
                            -1,
                            -1,
                            MenuBase.GetNavNodeOptions(true))));

                MenuBase menu = new MenuBase();
                menu.ApplySetting(menuSetting);
                menu.RootNode = rootNode;
                menu.Initialize();

                IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>;
                dynObjects.Add("Menu", menu);
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
예제 #2
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalInfo    portal   = PortalController.Instance.GetPortal(PortalSettings.Current.PortalId, PortalSettings.Current.CultureCode);
                IFileInfo     logoFile = string.IsNullOrEmpty(portal.LogoFile) ? null : FileManager.Instance.GetFile(PortalSettings.Current.PortalId, portal.LogoFile);
                Entities.Logo logo     = new Entities.Logo
                {
                    NavigateURL = ServiceProvider.NavigationManager.NavigateURL("")
                };
                if (logoFile != null && logoFile.FileId > 0)
                {
                    logo.Path = FileManager.Instance.GetUrl(FileManager.Instance.GetFile(logoFile.FileId));
                }

                logo.NavigateURL = ServiceProvider.NavigationManager.NavigateURL(PortalSettings.Current.HomeTabId);

                IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>;
                dynObjects.Add("Logo", logo);
                string uIPath   = HttpContext.Current.Server.MapPath(UIPath);
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
예제 #3
0
        private void GetCookieConsentMarkup()
        {
            try
            {
                if (string.IsNullOrEmpty(Request.QueryString["mid"]) && string.IsNullOrEmpty(Request.QueryString["icp"]))
                {
                    if (Request.Cookies["cookieconsent_status"] == null)
                    {
                        string d = PortalController.GetPortalSetting("Vanjaro_CookieConsent", PortalSettings.PortalId, "False");
                        if (d == bool.TrueString)
                        {
                            if (FindControlRecursive(this, "CookieConsentPane") == null)
                            {
                                Controls.Add(ParseControl("<div id=\"CookieConsentPane\" runat=\"server\" />"));
                            }

                            if (FindControlRecursive(this, "CookieConsentPane") != null)
                            {
                                IDictionary <string, object> Objects = new ExpandoObject() as IDictionary <string, object>;
                                Objects.Add("CookieConsentUrl", PortalSettings.CookieMoreLink);
                                string Template = RazorEngineManager.RenderTemplate("", BlockPath + "/Cookie Consent/", "Default", Objects);
                                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                                FindControlRecursive(this, "CookieConsentPane").Controls.Add(ParseControl(Template));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
            }
        }
예제 #4
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;

                if (ps != null && ps.ActiveTab != null && ps.ActiveTab.BreadCrumbs == null)
                {
                    ps.ActiveTab.BreadCrumbs = new System.Collections.ArrayList();
                }

                Dictionary <string, string> BaseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "login");
                if (Attributes["data-block-global"] == "true")
                {
                    Attributes = BaseAttributes;
                }
                else
                {
                    //Loop on base attributes and add missing attribute
                    foreach (KeyValuePair <string, string> attr in BaseAttributes)
                    {
                        if (!Attributes.ContainsKey(attr.Key))
                        {
                            Attributes.Add(attr.Key, attr.Value);
                        }
                    }
                }

                Entities.Login login = new Entities.Login
                {
                    ButtonAlign          = Attributes["data-block-buttonalign"],
                    ShowLabel            = Convert.ToBoolean(Attributes["data-block-showlabel"]),
                    ShowResetPassword    = Convert.ToBoolean(Attributes["data-block-showresetpassword"]),
                    ShowRememberPassword = Convert.ToBoolean(Attributes["data-block-showrememberpassword"]),
                    ResetPassword        = Convert.ToBoolean(Attributes["data-block-resetpassword"]),
                    ShowRegister         = Convert.ToBoolean(Attributes["data-block-showregister"])
                };

                login.RegisterUrl = Globals.RegisterURL(HttpUtility.UrlEncode(ServiceProvider.NavigationManager.NavigateURL()), Null.NullString);
                IDictionary <string, object> Objects = new System.Dynamic.ExpandoObject() as IDictionary <string, object>;
                Objects.Add("Login", login);
                Objects.Add("UseEmailAsUserName", (PortalController.Instance.GetCurrentSettings() as PortalSettings).Registration.UseEmailAsUserName);
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], Objects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
예제 #5
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;

                if (ps != null && ps.ActiveTab != null && ps.ActiveTab.BreadCrumbs == null)
                {
                    ps.ActiveTab.BreadCrumbs = new System.Collections.ArrayList();
                }

                Dictionary <string, string> BaseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "register");
                if (Attributes["data-block-global"] == "true")
                {
                    Attributes = BaseAttributes;
                }
                else
                {
                    //Loop on base attributes and add missing attribute
                    foreach (KeyValuePair <string, string> attr in BaseAttributes)
                    {
                        if (!Attributes.ContainsKey(attr.Key))
                        {
                            Attributes.Add(attr.Key, attr.Value);
                        }
                    }
                }
                DotNetNuke.Security.RegistrationSettings RegistrationSettings = (PortalController.Instance.GetCurrentSettings() as PortalSettings).Registration;
                int UserRegistration = (PortalController.Instance.GetCurrentSettings() as PortalSettings).UserRegistration;
                IDictionary <string, object> dynObjects = new System.Dynamic.ExpandoObject() as IDictionary <string, object>;
                Entities.Register            register   = new Entities.Register
                {
                    ButtonAlign  = Attributes["data-block-buttonalign"],
                    ShowLabel    = Convert.ToBoolean(Attributes["data-block-showlabel"]),
                    TermsPrivacy = Convert.ToBoolean(Attributes["data-block-termsprivacy"])
                };
                dynObjects.Add("Register", register);
                dynObjects.Add("RegistrationSettings", RegistrationSettings);
                dynObjects.Add("UserRegistration", UserRegistration);

                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;

                if (ps != null && ps.ActiveTab != null && ps.ActiveTab.BreadCrumbs == null)
                {
                    ps.ActiveTab.BreadCrumbs = new System.Collections.ArrayList();
                }

                Dictionary <string, string> BaseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "register link");
                if (Attributes["data-block-global"] == "true")
                {
                    Attributes = BaseAttributes;
                }
                else
                {
                    //Loop on base attributes and add missing attribute
                    foreach (KeyValuePair <string, string> attr in BaseAttributes)
                    {
                        if (!Attributes.ContainsKey(attr.Key))
                        {
                            Attributes.Add(attr.Key, attr.Value);
                        }
                    }
                }
                Entities.RegisterLink rl = new Entities.RegisterLink
                {
                    Url              = Globals.RegisterURL(HttpUtility.UrlEncode(ServiceProvider.NavigationManager.NavigateURL()), Null.NullString),
                    IsAuthenticated  = HttpContext.Current.Request.IsAuthenticated,
                    ShowRegisterLink = Convert.ToBoolean(Attributes["data-block-showregisterlink"]),
                    ShowNotification = Convert.ToBoolean(Attributes["data-block-shownotification"]),
                    ShowAvatar       = Convert.ToBoolean(Attributes["data-block-showavatar"])
                };
                IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>;
                dynObjects.Add("RegisterLink", rl);
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
예제 #7
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                IDictionary <string, object> Objects = new ExpandoObject() as IDictionary <string, object>;

                Objects.Add("LoginLink", GetModel());
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], Objects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
 private string GenerateMarkup(Dictionary <string, string> Attributes)
 {
     try
     {
         IDictionary <string, object> Objects       = new ExpandoObject() as IDictionary <string, object>;
         Entities.ResetPassword       resetPassword = new Entities.ResetPassword();
         Objects.Add("ResetPassword", resetPassword);
         string Template = RazorEngineManager.RenderTemplate(Guid.ToString(), BlockPath, "Default", Objects);
         Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
         return(Template);
     }
     catch (Exception ex)
     {
         DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
         return(ex.Message);
     }
 }
예제 #9
0
 private string GenerateMarkup(Dictionary <string, string> Attributes)
 {
     try
     {
         Entities.Profile profile = new Entities.Profile
         {
             IsAuthenticated = HttpContext.Current.Request.IsAuthenticated
         };
         IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>;
         dynObjects.Add("Profile", profile);
         string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
         Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
         return(Template);
     }
     catch (Exception ex)
     {
         DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
         return(ex.Message);
     }
 }
예제 #10
0
        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);
                    }
                }
            }
        }
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                string Template = string.Empty;
                Dictionary <string, string> blockAttribute = new Dictionary <string, string>();
                string Keyword = HttpContext.Current.Request.QueryString["Search"];
                if (!string.IsNullOrEmpty(Keyword))
                {
                    PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;
                    if (Attributes.ContainsKey("data-block-pageindex"))
                    {
                        blockAttribute.Add("data-block-pageindex", Attributes["data-block-pageindex"]);
                    }
                    Dictionary <string, string> baseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "search result");

                    if (Attributes["data-block-global"] == "true")
                    {
                        Attributes.Clear();
                        if (baseAttributes != null)
                        {
                            foreach (KeyValuePair <string, string> baseattr in baseAttributes)
                            {
                                Attributes.Add(baseattr.Key, baseattr.Value);
                            }
                        }
                    }
                    else
                    {
                        //Loop on base attributes and add missing attribute
                        if (baseAttributes != null)
                        {
                            foreach (KeyValuePair <string, string> attr in baseAttributes)
                            {
                                if (!Attributes.ContainsKey(attr.Key))
                                {
                                    Attributes.Add(attr.Key, attr.Value);
                                }
                            }
                        }
                    }

                    foreach (KeyValuePair <string, string> t in blockAttribute)
                    {
                        if (!Attributes.ContainsKey(t.Key))
                        {
                            Attributes.Add(t.Key, t.Value);
                        }
                    }

                    Entities.SearchResult searchResult = new Entities.SearchResult(Keyword, Attributes)
                    {
                        LinkTargetOpenInNewTab = Attributes.ContainsKey("data-block-linktarget") && Attributes["data-block-linktarget"] == "false" ? false : true
                    };
                    IDictionary <string, object> dynObjects = new System.Dynamic.ExpandoObject() as IDictionary <string, object>;
                    dynObjects.Add("SearchResult", searchResult);
                    Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                    Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                }
                else
                {
                    Template = "<div class='Searchresultempty'><div class='no-search-result-found search-info-msg'>" + Localization.GetString("NoSearchResultFound", Components.Constants.LocalResourcesFile) + "</div></div>";
                }
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }