Пример #1
0
        /// <exclude />
        public ScriptLoader(string type, string directive = null, bool updateManagerDisabled = false)
        {
            _ctx  = HttpContext.Current;
            _type = type;
            _updateManagerDisabled = updateManagerDisabled;

            if (directive == "compile")
            {
                _mode = CompositeScriptMode.COMPILE;
            }
            else if (CookieHandler.Get("mode") == "develop")
            {
                _mode = CompositeScriptMode.DEVELOP;
            }
            else
            {
                _mode = CompositeScriptMode.OPERATE;
            }

            string folderPath = Path.Combine(_ctx.Request.PhysicalApplicationPath, "Composite");

            switch (type)
            {
            case "top":
                _defaultscripts = ScriptHandler.GetTopScripts(_mode, folderPath);

                break;

            case "sub":
                _defaultscripts = ScriptHandler.GetSubScripts(_mode, folderPath);
                break;
            }
        }
Пример #2
0
        private static HttpCookie GetAuthenticationCooke(HttpContext context)
        {
            // TODO: generate a short life cookie
            string authenticationCookieName = CookieHandler.GetApplicationSpecificCookieName(HttpContextBasedLoginSessionStore.AuthCookieName);

            return(context.Request.Cookies[authenticationCookieName]);
        }
Пример #3
0
        /// <exclude />
        public static string Render(string directive = null)
        {
            string root = UrlUtils.AdminRootPath;

            bool isInDevelopMode = CookieHandler.Get("mode") == "develop";

            string styleFile = isInDevelopMode
                ? "/styles/styles.css"
                : "/styles/styles.min.css";

            string cssLink = root + styleFile;

            string filePath = PathUtil.Resolve("~/Composite" + styleFile);

            if (C1File.Exists(filePath))
            {
                cssLink += "?timestamp=" + C1File.GetLastWriteTimeUtc(filePath).GetHashCode();
            }

            return(stylesheet(cssLink));
        }