예제 #1
0
        private void SetHeaders(int id)
        {
            Settings setting = null;
            var      org     = CurrentDatabase.LoadOrganizationById(id);

            if (org != null)
            {
                SetHeaders2(id);
                return;
            }

            var shell = SetAlternativeManagedGivingShell();

            if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id)))
            {
                setting = CurrentDatabase.CreateRegistrationSettings(id);
                shell   = DbUtil.Content(CurrentDatabase, setting.Shell, null);
            }
            if (!shell.HasValue() && settings != null && settings.ContainsKey(id))
            {
                shell = DbUtil.Content(CurrentDatabase, settings[id].Shell, null);
            }
            if (!shell.HasValue())
            {
                shell = DbUtil.Content(CurrentDatabase, "ShellDiv-" + id, DbUtil.Content(CurrentDatabase, "ShellDefault", ""));
            }

            var s = shell;

            if (s.HasValue())
            {
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(s).Groups[1].Value.Replace("<!--FORM CSS-->",
                                                             ViewExtensions2.jQueryUICss() +
                                                             "\r\n<link href=\"/Content/styles/onlinereg.css?v=8\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
                ViewBag.hasshell = true;
                var b = re.Match(s).Groups[2].Value;
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
                ViewBag.header   = DbUtil.Content(CurrentDatabase, "OnlineRegHeader-" + id,
                                                  DbUtil.Content(CurrentDatabase, "OnlineRegHeader", ""));
                ViewBag.top = DbUtil.Content(CurrentDatabase, "OnlineRegTop-" + id,
                                             DbUtil.Content(CurrentDatabase, "OnlineRegTop", ""));
                ViewBag.bottom = DbUtil.Content(CurrentDatabase, "OnlineRegBottom-" + id,
                                                DbUtil.Content(CurrentDatabase, "OnlineRegBottom", ""));
            }
        }