Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.GetCurrent().GetApplications().Find(t => string.Equals(t.alias, Constants.Applications.Settings, StringComparison.OrdinalIgnoreCase)) == null)
            {
                throw new Exception("The current user can't edit skins as the user doesn't have access to the Settings section!");
            }

            NodeFactory.Node n = NodeFactory.Node.GetCurrent();
            ActiveSkin = Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(n.template));

            pnl_connectionerror.Visible = false;

            //load dependencies
            if (ActiveSkin != null && ActiveSkin.Dependencies.Count > 0)
            {
                LoadDependencies();
            }
            else
            {
                //show skin selection
                pCustomizeSkin.Visible    = false;
                ltCustomizeSkinStyle.Text = ltChangeSkinStyle.Text;
                ltChangeSkinStyle.Text    = string.Empty;
            }

            LoadSkins();
        }
Exemplo n.º 2
0
 protected void apply(object sender, EventArgs e)
 {
     if (dd_skins.SelectedIndex > 0)
     {
         Skin s = Skin.CreateFromAlias(dd_skins.SelectedValue);
         Skinning.ActivateAsCurrentSkin(s);
     }
 }
Exemplo n.º 3
0
        //will be used to parse the global variables in the embedded css of a skin manifest
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "text/plain";

            var skinAlias = Request["skinAlias"];

            if (!string.IsNullOrEmpty(skinAlias) && Skin.CreateFromAlias(skinAlias) != null)
            {
                var activeSkin = Skin.CreateFromAlias(skinAlias);

                if (activeSkin.Css != null)
                {
                    var varValues = new SortedList <string, string>();

                    foreach (var var in activeSkin.Css.Variables)
                    {
                        varValues.Add(var.Name, string.IsNullOrEmpty(Request[var.Name]) ? var.DefaultValue : Request[var.Name]);
                    }

                    Response.Write(ParseEmbeddedCss(activeSkin.Css.Content, varValues));
                }
            }
        }
Exemplo n.º 4
0
        protected void rep_starterKitDesigns_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem != null)
            {
                cms.businesslogic.packager.repositories.Skin s = (cms.businesslogic.packager.repositories.Skin)e.Item.DataItem;

                if (Skinning.IsSkinInstalled(s.RepoGuid))
                {
                    Button inst = (Button)e.Item.FindControl("Button1");
                    inst.Text            = "Apply (already downloaded)";
                    inst.CommandName     = "apply";
                    inst.CommandArgument = s.Text;
                }

                if (Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(templateID)).Name == s.Text)
                {
                    Button inst = (Button)e.Item.FindControl("Button1");
                    inst.Text            = "Rollback (active skin)";
                    inst.CommandName     = "remove";
                    inst.CommandArgument = s.Text;
                }
            }
        }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();


            Skin ActiveSkin = Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(NodeFactory.Node.GetCurrent().template));


            m_SkinModal    = new Panel();
            m_SkinModal.ID = "LeSkinModal";
            m_SkinModal.Attributes.Add("style", "display: none");

            m_SkinModal.Controls.Add(new UserControl().LoadControl(String.Format("{0}/LiveEditing/Modules/SKinModule/SkinCustomizer.ascx", SystemDirectories.Umbraco)));

            Controls.Add(m_SkinModal);

            m_SkinButton.ID       = "LeSkinButton";
            m_SkinButton.CssClass = "button";
            m_SkinButton.ToolTip  = ActiveSkin != null && ActiveSkin.Dependencies.Count > 0 ? "Customize skin" : "Change skin";
            m_SkinButton.ImageUrl = String.Format("{0}/LiveEditing/Modules/SKinModule/images/skin.gif", SystemDirectories.Umbraco);

            string s = (ActiveSkin != null && ActiveSkin.Dependencies.Count > 0 ? "setTasksClientScripts();" : "") + "jQuery('#" + m_SkinModal.ClientID + @"').show();" + "jQuery('#" + m_SkinModal.ClientID + @"').ModalWindowShowWithoutBackground('" + ui.GetText("skin") + "',true,500,400,50,0, ['.modalbuton'], null);";

            m_SkinButton.OnClientClick = s + "return false;";

            Controls.Add(m_SkinButton);

            if (UmbracoContext.Current.LiveEditingContext.InSkinningMode && !string.IsNullOrEmpty(UmbracoContext.Current.Request["umbSkinningConfigurator"]))
            {
                ScriptManager.RegisterClientScriptBlock(
                    this,
                    this.GetType(),
                    "ShowSkinModule",
                    "function ShowSkinModule(){" + s + "}",
                    true);


                ClientDependencyLoader.Instance.RegisterDependency(500, "LiveEditing/Modules/SkinModule/js/SkinModuleShowOnStartup.js", "UmbracoRoot", ClientDependencyType.Javascript);
            }

            // modules
            if (CanInsertModules(NodeFactory.Node.GetCurrent().template))
            {
                m_ModuleModal          = new Panel();
                m_ModuleModal.ID       = "LeModuleModal";
                m_ModuleModal.CssClass = "ModuleSelector";
                m_ModuleModal.Attributes.Add("style", "display: none");

                m_ModuleModal.Controls.Add(new UserControl().LoadControl(String.Format("{0}/LiveEditing/Modules/SKinModule/ModuleSelector.ascx", SystemDirectories.Umbraco)));

                Controls.Add(m_ModuleModal);


                m_ModuleButton.ID       = "LeModuleButton";
                m_ModuleButton.CssClass = "button";
                m_ModuleButton.ToolTip  = "Insert Module";
                m_ModuleButton.ImageUrl = String.Format("{0}/LiveEditing/Modules/SKinModule/images/module.gif", SystemDirectories.Umbraco);

                m_ModuleButton.OnClientClick = "umbShowModuleSelection();" + "return false;";

                Controls.Add(m_ModuleButton);
            }
        }