Пример #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (HttpContext.Current == null)
            {
                writer.Write("[" + this.ID + "]");
                return;
            }

            if (fileName.Length == 0)
            {
                return;
            }

            if (sizes.Length > 0)
            {
                writer.Write("\n<link rel='apple-touch-icon' sizes=\"{0}\" href='{1}{2}' />",
                             sizes,
                             SiteUtils.DetermineSkinBaseUrl(true, false, Page),
                             fileName
                             );
            }
            else
            {
                writer.Write("\n<link rel='apple-touch-icon' href='{0}{1}' />",
                             SiteUtils.DetermineSkinBaseUrl(true, false, Page),
                             fileName
                             );
            }
        }
Пример #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            //base.Render(writer);
            if (!Visible)
            {
                return;
            }

            if (cssFullUrl.Length > 0)
            {
                writer.Write(
                    string.Format(CultureInfo.InvariantCulture, linkFormat, cssFullUrl)
                    );
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return;
            }

            string cssUrl = SiteUtils.DetermineSkinBaseUrl(true, WebConfigSettings.UseFullUrlsForSkins, Page)
                            + cssFileName + "?v=" + siteSettings.SkinVersion.ToString();

            writer.Write(
                string.Format(CultureInfo.InvariantCulture, linkFormat, cssUrl)
                );
        }
Пример #3
0
        private void SetupScript()
        {
            if (scriptFullUrl.Length > 0)
            {
                if (isStartup)
                {
                    ScriptManager.RegisterStartupScript(
                        this,
                        typeof(Page),
                        ClientID,
                        string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptFullUrl),
                        false);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(
                        this,
                        typeof(Page),
                        ClientID,
                        string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptFullUrl),
                        false);
                }
                return;
            }

            if (scriptFileName.Length == 0)
            {
                return;
            }
            string scriptUrl = SiteUtils.DetermineSkinBaseUrl(true, WebConfigSettings.UseFullUrlsForSkins, Page) + scriptFileName;

            if (isStartup)
            {
                ScriptManager.RegisterStartupScript(
                    this,
                    typeof(Page),
                    scriptFileName,
                    string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptUrl),
                    false);
            }
            else
            {
                if (addToCombinedScript && (scriptUrl.StartsWith("/")) && (Page is mojoBasePage))
                {
                    mojoBasePage basePage = Page as mojoBasePage;
                    basePage.ScriptConfig.AddPathScriptReference(scriptUrl);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(
                        this,
                        typeof(Page),
                        scriptFileName,
                        string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptUrl),
                        false);
                }
            }
        }
Пример #4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (this.imageFileName.Length == 0)
            {
                this.Visible = false;
                return;
            }

            this.ImageUrl = SiteUtils.DetermineSkinBaseUrl(true, WebConfigSettings.UseFullUrlsForSkins, Page) + this.imageFileName;
        }
        private void EnsureItems()
        {
            if (ddlLayouts == null)
            {
                ddlLayouts = new DropDownList();
                if (this.Controls.Count == 0)
                {
                    this.Controls.Add(ddlLayouts);
                }
            }
            if (ddlLayouts.Items.Count > 0)
            {
                return;
            }

            themesPath = SiteUtils.DetermineSkinBaseUrl(true, false, this.Page) + "/Views/Blog/";
            //globalThemesPath = WebUtils.GetApplicationRoot() + "/Views/Blog/";

            List <FileInfo> themeFiles = GetLayouts(themesPath);
            //List<FileInfo> globalThemeFiles = GetLayouts(globalThemesPath);

            List <ListItem> items = new List <ListItem>();



            if (themeFiles != null)
            {
                PopulateDefinitionList(themeFiles, themesPath);
            }
            //if (globalThemeFiles != null)
            //{
            //    PopulateDefinitionList(globalThemeFiles, globalThemesPath, true);
            //}



            //items.Sort()
            //ddlLayouts.DataSource = items;
            //ddlLayouts.DataBind();
            if (ddlLayouts.Items.Count == 0)
            {
                ddlLayouts.Enabled = false;
                ddlLayouts.Visible = false;
                litNoLayouts.Text  = BlogResources.NoPostListLayoutsInSkin;
            }
            else
            {
                ddlLayouts.Items.Insert(0, new ListItem("Please Select", string.Empty));
            }
        }
Пример #6
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (HttpContext.Current == null)
            {
                // TODO: show a bmp or some other design time thing?
                writer.Write("[" + this.ID + "]");
                return;
            }

            //writer.Write("\n<link rel='shortcut icon' href='{0}/Data/Sites/{1}/skins/{2}/favicon.ico' />",
            //    WebUtils.GetSiteRoot(), siteSettings.SiteId, siteSettings.Skin);

            writer.Write("\n<link rel='shortcut icon' href='{0}favicon.ico' />",
                         SiteUtils.DetermineSkinBaseUrl(true, false, Page));
        }
Пример #7
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (!renderInPlace)
            {
                return;
            }


            if (scriptFullUrl.Length > 0)
            {
                writer.Write(string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptFullUrl));
            }
            else
            {
                string scriptUrl = SiteUtils.DetermineSkinBaseUrl(true, WebConfigSettings.UseFullUrlsForSkins, Page) + scriptFileName;
                writer.Write(string.Format(CultureInfo.InvariantCulture, scriptRefFormat, scriptUrl));
            }
        }
Пример #8
0
        private void EnsureItems()
        {
            if (ddlLayouts == null)
            {
                ddlLayouts = new DropDownList();
                if (this.Controls.Count == 0)
                {
                    this.Controls.Add(ddlLayouts);
                }
            }
            if (ddlLayouts.Items.Count > 0)
            {
                return;
            }

            themesPath = SiteUtils.DetermineSkinBaseUrl(true, false, this.Page) + viewPath;

            List <FileInfo> themeFiles = GetLayouts(themesPath);

            List <ListItem> items = new List <ListItem>();



            if (themeFiles != null)
            {
                PopulateDefinitionList(themeFiles, themesPath);
            }

            if (ddlLayouts.Items.Count == 0)
            {
                ddlLayouts.Enabled = false;
                ddlLayouts.Visible = false;
                litNoLayouts.Text  = Resource.NoViewsInSkin;
            }
            else
            {
                ddlLayouts.Items.Insert(0, new ListItem(Resource.ViewSelectDropDown, string.Empty));
            }
        }
Пример #9
0
        private void EnsureItems()
        {
            if (ddlLayouts == null)
            {
                ddlLayouts = new DropDownList();

                if (Controls.Count == 0)
                {
                    Controls.Add(ddlLayouts);
                }
            }

            if (ddlLayouts.Items.Count > 0)
            {
                return;
            }
            string skinThemesPath = SiteUtils.DetermineSkinBaseUrl(true, false, Page) + themesPath;

            List <FileInfo> themeFiles = GetLayouts(skinThemesPath);
            List <ListItem> items      = new List <ListItem>();

            if (themeFiles != null)
            {
                PopulateDefinitionList(themeFiles, skinThemesPath);
            }

            if (ddlLayouts.Items.Count == 0)
            {
                ddlLayouts.Enabled = false;
                ddlLayouts.Visible = false;
                litNoLayouts.Text  = BetterImageGalleryResources.NoLayoutsInSkin;
            }
            else
            {
                ddlLayouts.Items.Insert(0, new ListItem(BetterImageGalleryResources.SelectLayout, string.Empty));
            }
        }
Пример #10
0
        public static void ReplaceStaticTokens(
            StringBuilder stringBuilder,
            ModuleConfiguration config,
            bool isEditable,
            SuperFlexiDisplaySettings displaySettings,
            int moduleId,
            PageSettings pageSettings,
            SiteSettings siteSettings,
            out StringBuilder sb)
        {
            sb = stringBuilder;
            string featuredImageUrl       = String.IsNullOrWhiteSpace(config.InstanceFeaturedImage) ? string.Empty : WebUtils.GetApplicationRoot() + config.InstanceFeaturedImage;
            string jsonObjName            = "sflexi" + moduleId.ToString() + (config.IsGlobalView ? "Modules" : "Items");
            string currentSkin            = string.Empty;
            string siteRoot               = SiteUtils.GetNavigationSiteRoot();
            bool   publishedOnCurrentPage = true;

            if (HttpContext.Current != null && HttpContext.Current.Request.Params.Get("skin") != null)
            {
                currentSkin = SiteUtils.SanitizeSkinParam(HttpContext.Current.Request.Params.Get("skin")) + "/";
            }

            if (isEditable)
            {
                var pageModules = PageModule.GetPageModulesByModule(moduleId);
                if (pageModules.Where(pm => pm.PageId == pageSettings.PageId).ToList().Count() == 0)
                {
                    publishedOnCurrentPage = false;
                }
            }

            Module module = new Module(moduleId);

            if (module != null)
            {
                sb.Replace("$_ModuleTitle_$", module.ShowTitle ? String.Format(displaySettings.ModuleTitleFormat, module.ModuleTitle) : string.Empty);
                sb.Replace("$_RawModuleTitle_$", module.ModuleTitle);
                sb.Replace("$_ModuleGuid_$", module.ModuleGuid.ToString());
                if (String.IsNullOrWhiteSpace(config.ModuleFriendlyName))
                {
                    sb.Replace("$_FriendlyName_$", module.ModuleTitle);
                }

                siteSettings = new SiteSettings(module.SiteGuid);
            }
            if (!String.IsNullOrWhiteSpace(config.ModuleFriendlyName))
            {
                sb.Replace("$_FriendlyName_$", config.ModuleFriendlyName);
            }
            sb.Replace("$_FeaturedImageUrl_$", featuredImageUrl);
            sb.Replace("$_ModuleID_$", moduleId.ToString());
            sb.Replace("$_PageID_$", pageSettings.PageId.ToString());
            sb.Replace("$_PageUrl_$", siteRoot + pageSettings.Url.Replace("~/", ""));
            sb.Replace("$_PageName_$", siteRoot + pageSettings.PageName);
            //sb.Replace("$_ModuleLinks_$", isEditable ? SuperFlexiHelpers.GetModuleLinks(config, displaySettings, moduleId, pageSettings.PageId) : string.Empty);
            sb.Replace("$_ModuleLinks_$", isEditable ? SuperFlexiHelpers.GetModuleLinks(config, displaySettings, moduleId, publishedOnCurrentPage ? pageSettings.PageId : -1) : string.Empty);
            sb.Replace("$_JSONNAME_$", jsonObjName);
            sb.Replace("$_ModuleClass_$", SiteUtils.IsMobileDevice() && !String.IsNullOrWhiteSpace(config.MobileInstanceCssClass) ? config.MobileInstanceCssClass : config.InstanceCssClass);
            sb.Replace("$_ModuleTitleElement_$", module.HeadElement);
            sb.Replace("$_SiteID_$", siteSettings.SiteId.ToString());
            sb.Replace("$_SiteRoot_$", String.IsNullOrWhiteSpace(siteRoot) ? "/" : siteRoot);
            sb.Replace("$_SitePath_$", String.IsNullOrWhiteSpace(siteRoot) ? "/" : WebUtils.GetApplicationRoot() + "/Data/Sites/" + CacheHelper.GetCurrentSiteSettings().SiteId.ToInvariantString());
            sb.Replace("$_SkinPath_$", SiteUtils.DetermineSkinBaseUrl(currentSkin));
            sb.Replace("$_CustomSettings_$", config.CustomizableSettings); //this needs to be enhanced, a lot, right now we just dump the 'settings' where ever this token exists.
            sb.Replace("$_EditorType_$", siteSettings.EditorProviderName);
            sb.Replace("$_EditorSkin_$", siteSettings.EditorSkin.ToString());
            sb.Replace("$_EditorBasePath_$", WebUtils.ResolveUrl(ConfigurationManager.AppSettings["CKEditor:BasePath"]));
            sb.Replace("$_EditorConfigPath_$", WebUtils.ResolveUrl(ConfigurationManager.AppSettings["CKEditor:ConfigPath"]));
            sb.Replace("$_EditorToolbarSet_$", mojoPortal.Web.Editor.ToolBar.FullWithTemplates.ToString());
            sb.Replace("$_EditorTemplatesUrl_$", siteRoot + "/Services/CKeditorTemplates.ashx?cb=" + Guid.NewGuid().ToString());
            sb.Replace("$_EditorStylesUrl_$", siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty));
            sb.Replace("$_DropFileUploadUrl_$", siteRoot + "/Services/FileService.ashx?cmd=uploadfromeditor&rz=true&ko=" + WebConfigSettings.KeepFullSizeImagesDroppedInEditor.ToString().ToLower()
                       + "&t=" + Global.FileSystemToken.ToString());
            sb.Replace("$_FileBrowserUrl_$", siteRoot + WebConfigSettings.FileDialogRelativeUrl);
            sb.Replace("$_HeaderContent_$", config.HeaderContent);
            sb.Replace("$_FooterContent_$", config.FooterContent);
            sb.Replace("$_SkinVersionGuid_$", siteSettings.SkinVersion.ToString());
        }
Пример #11
0
        protected override void RenderContents(HtmlTextWriter output)
        {
            string featuredImageUrl = string.Empty;

            featuredImageUrl = String.IsNullOrWhiteSpace(config.InstanceFeaturedImage) ? featuredImageUrl : SiteUtils.GetNavigationSiteRoot() + config.InstanceFeaturedImage;

            //dynamic expando = new ExpandoObject();

            var superFlexiItemClass = CreateClass();

            var itemModels = new List <object> ();

            //var model = expando as IDictionary<string, object>;
            WidgetModel model = new WidgetModel
            {
                Module = new ModuleModel
                {
                    Id           = module.ModuleId,
                    Guid         = module.ModuleGuid,
                    Title        = module.ModuleTitle,
                    TitleElement = module.HeadElement
                },
                Config = Config,
                Page   = new PageModel
                {
                    Id   = CurrentPage.PageId,
                    Url  = CurrentPage.Url,
                    Name = CurrentPage.PageName
                },
                Site = new SiteModel
                {
                    Id       = module.SiteId,
                    SkinPath = SiteUtils.DetermineSkinBaseUrl(SiteUtils.GetSkinName(true, this.Page))
                },
                SiteRoot = SiteUtils.GetNavigationSiteRoot()
            };

            //dynamic dModel = model;

            foreach (Item item in items)
            {
                var itemObject = Activator.CreateInstance(superFlexiItemClass);

                bool itemIsEditable = IsEditable || WebUser.IsInRoles(item.EditRoles);
                bool itemIsViewable = WebUser.IsInRoles(item.ViewRoles) || itemIsEditable;
                if (!itemIsViewable)
                {
                    continue;
                }

                string itemEditUrl = SiteUtils.GetNavigationSiteRoot() + "/SuperFlexi/Edit.aspx?pageid=" + PageId + "&mid=" + item.ModuleID + "&itemid=" + item.ItemID;

                SetItemClassProperty(itemObject, "Id", item.ItemID);
                SetItemClassProperty(itemObject, "Guid", item.ItemGuid);
                SetItemClassProperty(itemObject, "SortOrder", item.SortOrder);
                SetItemClassProperty(itemObject, "EditUrl", itemEditUrl);

                //dynamic itemModel = new ExpandoObject();
                //itemModel.Id = item.ItemID;
                //itemModel.Guid = item.ItemGuid;
                //itemModel.SortOrder = item.SortOrder;
                //itemModel.EditUrl = itemEditUrl;

                List <ItemFieldValue> fieldValues = ItemFieldValue.GetItemValues(item.ItemGuid);

                //foreach (Field field in fields)
                //{
                //    foreach (ItemFieldValue fieldValue in fieldValues)
                //    {
                //        if (field.FieldGuid == fieldValue.FieldGuid)
                //        {
                //            if (field.ControlType == "CheckBox")
                //            {
                //                ((IDictionary<string, object>)itemModel)[field.Name] = Convert.ToBoolean(fieldValue.FieldValue);
                //            }
                //            ((IDictionary<string, object>)itemModel)[field.Name] = fieldValue.FieldValue;
                //        }
                //    }
                //}

                //var itemModel = new
                //{
                //    Id = item.ItemID,
                //    Guid = item.ItemGuid,
                //    SortOrder = item.SortOrder,
                //    EditUrl = itemEditUrl,
                //};

                foreach (Field field in fields)
                {
                    foreach (ItemFieldValue fieldValue in fieldValues)
                    {
                        if (field.FieldGuid == fieldValue.FieldGuid)
                        {
                            switch (field.ControlType)
                            {
                            case "CheckBox":
                                SetItemClassProperty(itemObject, field.Name, Convert.ToBoolean(fieldValue.FieldValue));

                                break;

                            case "CheckBoxList":
                            case "DynamicCheckBoxList":
                                SetItemClassProperty(itemObject, field.Name, fieldValue.FieldValue.SplitOnCharAndTrim(';'));
                                break;

                            case "DateTime":
                            case "Date":
                                if (!string.IsNullOrWhiteSpace(fieldValue.FieldValue))
                                {
                                    DateTime.TryParse(fieldValue.FieldValue, out DateTime dt);
                                    SetItemClassProperty(itemObject, field.Name, dt);
                                }
                                break;

                            case "TextBox":
                            default:
                                SetItemClassProperty(itemObject, field.Name, fieldValue.FieldValue);
                                break;
                            }
                        }
                    }
                }

                itemModels.Add(itemObject);
            }

            model.Items = itemModels;

            var viewPath = config.RelativeSolutionLocation + "/" + config.ViewName;

            string text;

            try
            {
                text = RazorBridge.RenderPartialToString(viewPath, model, "SuperFlexi");
            }
            catch (Exception ex)
            {
                renderDefaultView(ex.ToString());
            }

            void renderDefaultView(string error = "")
            {
                if (!string.IsNullOrWhiteSpace(error))
                {
                    log.ErrorFormat(
                        "chosen layout ({0}) for _SuperFlexiRazor was not found in skin {1} or SuperFlexi Solution. Perhaps it is in a different skin or Solution. Error was: {2}",
                        config.ViewName,
                        SiteUtils.GetSkinBaseUrl(true, Page),
                        error
                        );
                }
                text = RazorBridge.RenderPartialToString("_SuperFlexiRazor", model, "SuperFlexi");
            }

            output.Write(text);
        }
Пример #12
0
        private void SetToolBar()
        {
            string siteRoot = SiteUtils.GetNavigationSiteRoot();

            var siteSettings = CacheHelper.GetCurrentSiteSettings();

            string skinRootFolder = SiteUtils.GetSiteSkinFolderPath();

            string currentSkin = siteSettings.Skin;
            var    currentPage = CacheHelper.GetCurrentPage();

            if (currentPage != null && !string.IsNullOrEmpty(currentPage.Skin))
            {
                currentSkin = currentPage.Skin;
            }

            FileInfo skinTemplates = new FileInfo($"{skinRootFolder + currentSkin}/templates/ckeditortemplates.js");

            var skinUrl = SiteUtils.DetermineSkinBaseUrl(currentSkin);

            Editor.MojoSkinPath = skinUrl;

            switch (toolBar)
            {
            case ToolBar.Full:
                Editor.FileManagerUrl    = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                Editor.EnableFileBrowser = true;
                Editor.StylesJsonUrl     = siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty);
                Editor.DropFileUploadUrl = $"{siteRoot}/Services/FileService.ashx?cmd=uploadfromeditor&rz=true&ko={WebConfigSettings.KeepFullSizeImagesDroppedInEditor.ToString().ToLower()}&t={Global.FileSystemToken}";
                break;

            case ToolBar.FullWithTemplates:
                //string sRoot = SiteUtils.GetNavigationSiteRoot();
                Editor.FileManagerUrl    = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                Editor.EnableFileBrowser = true;
                //string navRoot = SiteUtils.GetNavigationSiteRoot();
                Editor.TemplatesJsonUrl = siteRoot + "/Services/CKeditorTemplates.ashx?cb=" + Guid.NewGuid().ToString();                         //prevent caching with a guid param

                if (skinTemplates.Exists)
                {
                    Editor.SkinTemplatesUrl = $"{skinUrl}templates/ckeditortemplates.js?cb={Guid.NewGuid()}";
                }

                //Editor.TemplatesXmlUrl = navRoot + "/Services/HtmlTemplates.ashx?cb=" + Guid.NewGuid().ToString();
                Editor.StylesJsonUrl = siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty);
                //Editor.StylesJsonUrl =  "/ckstyles.js";
                Editor.DropFileUploadUrl = $"{siteRoot}/Services/FileService.ashx?cmd=uploadfromeditor&rz=true&ko={WebConfigSettings.KeepFullSizeImagesDroppedInEditor.ToString().ToLower()}&t={Global.FileSystemToken}";
                break;

            case ToolBar.Newsletter:
                Editor.FileManagerUrl    = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                Editor.EnableFileBrowser = true;
                Editor.FullPageMode      = true;
                //Editor.CustomConfigPath = "~/ClientScript/ckeditor-mojo-newsletterconfig.js";
                break;

            case ToolBar.ForumWithImages:
                Editor.FileManagerUrl        = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                Editor.EnableFileBrowser     = true;
                Editor.ForcePasteAsPlainText = true;
                break;

            case ToolBar.Forum:
                Editor.ForcePasteAsPlainText = true;
                break;

            case ToolBar.AnonymousUser:
                break;

            case ToolBar.SimpleWithSource:
                break;
            }
        }
Пример #13
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (HttpContext.Current == null)
            {
                return;
            }
            if (!BrowserHelper.IsIE())
            {
                return;
            }

            bool allowPageOverride = true;

            if (Page is mojoBasePage)
            {
                mojoBasePage basePage = (mojoBasePage)Page;
                allowPageOverride = basePage.AllowSkinOverride;
                cacheBuster       = "?sv=" + basePage.SiteInfo.SkinVersion.ToString();
            }

            string skinBaseUrl = overrideCssBaseUrl;

            if (skinBaseUrl.Length == 0)
            {
                skinBaseUrl = SiteUtils.DetermineSkinBaseUrl(true, false, Page);
            }

            string scriptBaseUrl = ResolveUrl("~/ClientScript/");

            if (!WebConfigSettings.CacheCssInBrowser)
            {
                cacheBuster += "&amp;cb=" + Guid.NewGuid().ToString();
            }

            if (includeHtml5Script)
            {
                writer.Write("\n<!--[if IE]>\n");

                writer.Write("<script src=\"" + scriptBaseUrl + "html5shiv.js?v=2\" type=\"text/javascript\"></script>\n");

                writer.Write("\n<![endif]-->");
            }

            // IE 6
            if ((includeIE6) && (BrowserHelper.IsIE6()))
            {
                writer.Write("\n<!--[if lt IE 7]>\n");
                if (includeIE7Script)
                {
                    writer.Write("<script defer=\"defer\" src=\"" + scriptBaseUrl + "IE7.js\" type=\"text/javascript\"></script>\n");
                }

                writer.Write("<link rel=\"stylesheet\" href=\"" + skinBaseUrl + ie6CssFile + cacheBuster + "\" type=\"text/css\" id=\"IE6CSS\" />\n");

                writer.Write("<![endif]-->\n");
            }


            if ((includeIE7) && (BrowserHelper.IsIE7()))
            {
                writer.Write("<!--[if IE 7]>\n");
                if (includeIE8Script)
                {
                    writer.Write("<script defer=\"defer\" src=\"" + scriptBaseUrl + "IE8.js\" type=\"text/javascript\"></script>\n");
                }

                writer.Write("<link rel=\"stylesheet\" href=\"" + skinBaseUrl + ie7CssFile + cacheBuster + "\" type=\"text/css\" id=\"IE7CSS\" />\n");
                writer.Write("<![endif]-->\n");
            }

            if ((includeIE8) && (BrowserHelper.IsIE8()))

            {
                writer.Write("<!--[if IE 8]>\n");
                writer.Write("<link rel=\"stylesheet\" href=\"" + skinBaseUrl + ie8CssFile + cacheBuster + "\" type=\"text/css\" id=\"IE8CSS\" />\n");
                writer.Write("<![endif]-->\n");
            }

            if ((includeIE9) && (BrowserHelper.IsIE9()))
            {
                writer.Write("<!--[if IE 9]>\n");
                writer.Write("<link rel=\"stylesheet\" href=\"" + skinBaseUrl + ie9CssFile + cacheBuster + "\" type=\"text/css\" id=\"IE9CSS\" />\n");
                writer.Write("<![endif]-->\n");
            }

            if (includeIETransitionMeta)
            {
                writer.Write("\n<meta http-equiv=\"Page-Enter\" content=\"blendTrans(Duration=0)\" /><meta http-equiv=\"Page-Exit\" content=\"blendTrans(Duration=0)\" />");
            }
        }
Пример #14
0
        private void AddCssLinks()
        {
            string configFilePath;

            if (overrideSkinName.Length > 0)
            {
                configFilePath = Server.MapPath(SiteUtils.DetermineSkinBaseUrl(SiteUtils.SanitizeSkinParam(overrideSkinName)) + "style.config");
            }
            else
            {
                configFilePath = Server.MapPath(SiteUtils.DetermineSkinBaseUrl(allowPageOverride, false, Page) + "style.config");
            }

            if (File.Exists(configFilePath))
            {
                using (XmlReader reader = new XmlTextReader(new StreamReader(configFilePath)))
                {
                    reader.MoveToContent();
                    while (reader.Read())
                    {
                        if (("file" == reader.Name) && (reader.NodeType != XmlNodeType.EndElement))
                        {
                            string csswebconfigkey = reader.GetAttribute("csswebconfigkey");
                            string cssVPath        = reader.GetAttribute("cssvpath");

                            if ((!string.IsNullOrEmpty(csswebconfigkey)))
                            {
                                if ((ConfigurationManager.AppSettings[csswebconfigkey] != null))
                                {
                                    AddCssLink(Page.ResolveUrl(ConfigurationManager.AppSettings[csswebconfigkey]));
                                }
                            }
                            else if ((!string.IsNullOrEmpty(cssVPath)))
                            {
                                AddCssLink(Page.ResolveUrl("~" + cssVPath));
                            }
                            else
                            {
                                string cssFile = reader.ReadElementContentAsString();
                                AddCssLink(skinBaseUrl + cssFile);
                            }
                        }
                    }
                }
            }
            else
            {
                // style.config is missing

                AddCssLink(skinBaseUrl + "style.css");
                //AddCssLink(skinBaseUrl + "stylecolors.css");
                //AddCssLink(skinBaseUrl + "styleimages.css");
                //AddCssLink(skinBaseUrl + "styleborders.css");
                //AddCssLink(skinBaseUrl + "style-gridview.css");
                // AddCssLink(skinBaseUrl + "styletext.css");
                AddCssLink(skinBaseUrl + "stylemenu.css");
                AddCssLink(skinBaseUrl + "styletreeview.css");
                AddCssLink(skinBaseUrl + "styleblog.css");
                AddCssLink(skinBaseUrl + "styleforum.css");
                AddCssLink(skinBaseUrl + "stylefeedmanager.css");
                AddCssLink(skinBaseUrl + "styleformwizard.css");
                AddCssLink(skinBaseUrl + "styleaspcalendar.css");
                AddCssLink(skinBaseUrl + "styledatacalendar.css");
            }
        }
Пример #15
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (SiteUtils.IsSecureRequest())
            {
                protocol = "https";
            }

            SetupYuiCss();

            if (includejQueryUI)
            {
                SetupjQueryUICss();
            }
            if (includejCrop)
            {
                SetupjCropCss();
            }
            //if (includeGreyBoxCss) { SetupGreyBox(); }
            if (includeTwitterCss)
            {
                SetupTwitter();
            }
            if (includeGoogleCustomSearchCss)
            {
                SetupGoogleSearch();
            }
            if (includeMediaElement)
            {
                SetupMediaElement();
            }

            if (addQtFileCss)
            {
                SetupQtFile();
            }

            if (!loadSkinCss)
            {
                return;
            }

            if (overrideSkinName.Length > 0)
            {
                skinBaseUrl = SiteUtils.DetermineSkinBaseUrl(overrideSkinName);
            }
            else
            {
                //skinBaseUrl = SiteUtils.GetSkinBaseUrl(allowPageOverride, Page);
                skinBaseUrl = SiteUtils.DetermineSkinBaseUrl(allowPageOverride, false, Page); //changed to relative url
            }

            if (WebConfigSettings.CombineCSS)
            {
                SetupCombinedCssUrl();
            }
            else
            {
                AddCssLinks();
            }
        }
Пример #16
0
        private void SetupScript()
        {
            string skinUrl = SiteUtils.DetermineSkinBaseUrl(SiteUtils.GetSkinName(false));
            //if (!Page.ClientScript.IsStartupScriptRegistered("commentplugin"))
            //{
            //    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "commentplugin", "<script type=\"text/javascript\" src=\""
            //        + skinUrl + "comment/script.js" + "\"></script>");
            //}

            StringBuilder scripts = new StringBuilder();

            scripts.Append("<script type=\"text/javascript\">"); // script

            scripts.Append("\nvar journalOptions = {};");        // journalOptions
            scripts.Append("\njournalOptions.productId=" + product.ProductId + ";");
            scripts.Append("\njournalOptions.pageSize=" + pgr.PageSize + ";");
            scripts.Append("\njournalOptions.siteRoot='" + SiteUtils.GetNavigationSiteRoot() + "';");

            if (Request.IsAuthenticated)
            {
                scripts.Append("\njournalOptions.fullName='" + currentUser.Name + "';");
                scripts.Append("\njournalOptions.email='" + currentUser.Email + "';");
            }
            else
            {
                scripts.Append("\njournalOptions.fullName='" + CommentHelper.GetNameCookieValue() + "';");
                scripts.Append("\njournalOptions.email='';");
            }

            scripts.Append("\njournalOptions.deleteConfirmText = 'Bạn có chắc chắn muốn xóa bình luận?';");
            scripts.Append("\njournalOptions.reportSuccessfullyText = 'Đã báo cáo vi phạm thành công!';");
            scripts.Append("\njournalOptions.contentRequiredText = 'Vui lòng nhập nội dung.';");
            scripts.Append("\njournalOptions.contentInvalidText = 'Nội dung không hợp lệ.';");
            scripts.Append("\njournalOptions.fullNameRequiredText = 'Vui lòng nhập tên của bạn.';");
            scripts.Append("\njournalOptions.emailInvalidText = 'Email không hợp lệ.';");
            scripts.Append("\njournalOptions.likeText = 'Thích';");
            scripts.Append("\njournalOptions.unlikeText = 'Không thích';"); // end journalOptions
            scripts.Append("\nvar commentOpts = {};");

            scripts.Append("\n\n$(document).ready(function () {"); // document ready

            scripts.Append("\npluginInit();");

            scripts.Append("\nif($('.rating').length){"); // init rating
            scripts.Append("\n$('.rating').raty({");
            scripts.Append("\npath:'" + skinUrl + "comment/images/',");
            scripts.Append("\nscore: function() { return $(this).attr('data-score'); }");
            scripts.Append("\n});");
            scripts.Append("\n}"); // end init rating

            scripts.Append("\nvar jopts = {};");
            scripts.Append("\njopts.maxLength=" + 2000 + ";");
            scripts.Append("\njopts.placeHolder = '#" + pnlFeedback.ClientID + " .journalPlaceholder';");
            scripts.Append("\njopts.shareButton = '#" + pnlFeedback.ClientID + " .btnShare';");
            scripts.Append("\njopts.closeButton = '#" + pnlFeedback.ClientID + " .journalClose';");
            scripts.Append("\njopts.info = '#" + pnlFeedback.ClientID + " .journalInfo';");
            scripts.Append("\njopts.fullName = '#" + pnlFeedback.ClientID + " .txtFullName';");
            scripts.Append("\njopts.email = '#" + pnlFeedback.ClientID + " .txtEmail';");
            scripts.Append("\njopts.content = '#" + pnlFeedback.ClientID + " .journalContent';");
            scripts.Append("\njopts.items = '#" + pnlFeedback.ClientID + " .journalItems';");
            scripts.Append("\njopts.pager = '#" + pnlFeedback.ClientID + " .commentpager a';");
            scripts.Append("\n$('body').journalTools(jopts);");

            scripts.Append("\n});");       // end document ready
            scripts.Append("\n</script>"); // end script
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "commentinit" + ((int)commentType).ToString(), scripts.ToString());
        }