Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            ClientScriptProxy proxy = ClientScriptProxy.Current;

            proxy.Require(CurrentSite, Require);

            foreach (string css in StringUtil.Split(Css, ",", true, true))
            {
                if (css.Contains("|"))
                {
                    string[] array = StringUtil.Split(css, "|", true, true);
                    if (array.Length != 2)
                    {
                        continue;
                    }

                    proxy.RegisterCssResource(array[1], array[0]);
                }
                else if (css.EndsWith(".css", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (css.StartsWith("~"))
                    {
                        proxy.RegisterCss(ServerUtil.ResolveUrl(css));
                    }
                    else if (css.StartsWith("."))
                    {
                        proxy.RegisterCss(StringUtil.CombinUrl(CurrentSite.VirtualPath, CurrentSite.ThemeRoot, MobileDetect.Instance.GetRealThemeName(CurrentSite), css.Substring(1)));
                    }
                    else
                    {
                        proxy.RegisterCss(StringUtil.CombinUrl(CurrentSite.VirtualPath, css));
                    }
                }
                else
                {
                    proxy.RegisterCssResource(string.Format("Kiss.Web.jQuery.{0}.css", css));
                }
            }
        }
Esempio n. 2
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            JContext jc = JContext.Current;

            if (jc.User == null)
            {
                return;
            }

            isSiteAdmin = jc.User.HasPermission(string.Format("site.control_panel@{0}",
                                                              jc.Area["support_multi_site"].ToBoolean() ? jc.SiteId : string.Empty));

            jc.Context.Items["_has_controlpanel_permission_"] = isSiteAdmin;

            foreach (var cpItem in Plugin.Plugins.GetPlugins <ControlPanelItemAttribute>(JContext.Current.User))
            {
                Object obj = Activator.CreateInstance(cpItem.Decorates);
                if (obj is Control)
                {
                    Controls.Add(obj as Control);
                }

                renderers.Add(obj as IControlPanelItemRenderer);
            }

            if (renderers.Count == 0 || !isSiteAdmin)
            {
                return;
            }

            ClientScriptProxy proxy = ClientScriptProxy.Current;

            proxy.Require(jc.Area, "jquery.js,kiss.js,kiss.css");

            proxy.RegisterCssResource(GetType(),
                                      "Kiss.Web.jQuery.cp.c.css");
        }