コード例 #1
0
ファイル: AccountController.cs プロジェクト: thewruck/bvcms
        protected void TryLoadAlternateShell()
        {
            var shell = string.Empty;
            var alternateShellSetting = DbUtil.DbReadOnly.Settings.SingleOrDefault(x => x.Id == LogonPageShellSettingKey);

            if (alternateShellSetting != null)
            {
                var alternateShell = DbUtil.DbReadOnly.Contents.SingleOrDefault(x => x.Name == alternateShellSetting.SettingX);
                if (alternateShell != null)
                {
                    shell = alternateShell.Body;
                }
            }

            if (shell.HasValue())
            {
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css());
                t = t.Replace("<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body>&nbsp;</body>\r\n", "");
                ViewBag.hasshell = true;
                ViewBag.top      = t;
                var b = re.Match(shell).Groups[2].Value;
                b = b.Replace("</html>", "");
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
            }
        }
コード例 #2
0
ファイル: SetHeaders.cs プロジェクト: lightyeare/bvcms
        private void SetHeaders2(int id)
        {
            var org   = CurrentDatabase.LoadOrganizationById(id);
            var shell = GetAlternativeManagedGivingShell(org.OrganizationId);

            if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id)) && org != null)
            {
                var setting = CurrentDatabase.CreateRegistrationSettings(id);
                shell = CurrentDatabase.ContentOfTypeHtml(setting.ShellBs)?.Body;
            }
            if (!shell.HasValue() && settings != null && settings.ContainsKey(id))
            {
                shell = CurrentDatabase.ContentOfTypeHtml(settings[id].ShellBs)?.Body;
            }

            if (!shell.HasValue())
            {
                shell = CurrentDatabase.ContentOfTypeHtml("ShellDefaultBs")?.Body;
                if (!shell.HasValue())
                {
                    shell = CurrentDatabase.ContentOfTypeHtml("DefaultShellBs")?.Body;
                }
            }


            if (shell != null && shell.HasValue())
            {
                shell = shell.Replace("{title}", ViewBag.Title);
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css());
                ViewBag.hasshell = true;
                ViewBag.top      = t;
                var b = re.Match(shell).Groups[2].Value;
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
            }
        }
コード例 #3
0
ファイル: SetHeaders.cs プロジェクト: thewruck/bvcms
        private void SetHeaders2(int id)
        {
            var org   = DbUtil.Db.LoadOrganizationById(id);
            var shell = "";

            if ((settings == null || !settings.ContainsKey(id)) && org != null)
            {
                var setting = DbUtil.Db.CreateRegistrationSettings(id);
                shell = DbUtil.Content(setting.ShellBs, null);
            }
            if (!shell.HasValue() && settings != null && settings.ContainsKey(id))
            {
                shell = DbUtil.Content(settings[id].ShellBs, null);
            }
            if (!shell.HasValue())
            {
                shell = DbUtil.Content("ShellDefaultBs", "");
                if (!shell.HasValue())
                {
                    shell = DbUtil.Content("DefaultShellBs", "");
                }
            }


            if (shell.HasValue())
            {
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css());
                ViewBag.hasshell = true;
                ViewBag.top      = t;
                var b = re.Match(shell).Groups[2].Value;
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
            }
        }
コード例 #4
0
        protected void TryLoadAlternateShell()
        {
            var shell = string.Empty;
            var logonPageShellSettingKey = LogonPageShellSettingKey;
            var queryString = Request.QueryString["campus"];

            if (!string.IsNullOrWhiteSpace(queryString))
            {
                logonPageShellSettingKey += "-" + queryString.ToUpper();
            }
            var alternateShellSetting = CurrentDatabase.Settings.SingleOrDefault(x => x.Id == logonPageShellSettingKey);

            if (alternateShellSetting != null)
            {
                var alternateShell = CurrentDatabase.Contents.SingleOrDefault(x => x.Name == alternateShellSetting.SettingX);
                if (alternateShell != null)
                {
                    shell = alternateShell.Body;
                }
            }

            if (shell.HasValue())
            {
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css());
                t = t.Replace("<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body>&nbsp;</body>\r\n", "");
                ViewBag.hasshell = true;
                ViewBag.top      = t;
                var b = re.Match(shell).Groups[2].Value;
                b = b.Replace("</html>", "");
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
            }
        }