Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            templateID = int.Parse(Request["id"]);
            Template t = new Template(templateID);

            if (Skinning.StarterKitGuid(templateID).HasValue)
            {
                p_apply.Visible = true;

                string currentSkin  = Skinning.GetCurrentSkinAlias(templateID);
                int    templateRoot = FindTemplateRoot((CMSNode)t);

                dd_skins.Items.Add("Choose...");
                foreach (KeyValuePair <string, string> kvp in Skinning.AllowedSkins(templateRoot))
                {
                    ListItem li = new ListItem(kvp.Value, kvp.Key);
                    if (kvp.Key == currentSkin)
                    {
                        li.Selected = true;
                    }

                    dd_skins.Items.Add(li);
                }

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(templateID)))
                {
                    ph_rollback.Visible = true;
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _templateId = int.Parse(Request["id"]);
            var t = new Template(_templateId);

            if (Skinning.StarterKitGuid(_templateId).HasValue)
            {
                p_apply.Visible = true;

                var currentSkin  = Skinning.GetCurrentSkinAlias(_templateId);
                var templateRoot = FindTemplateRoot(t);

                dd_skins.Items.Add("Choose...");
                foreach (var kvp in Skinning.AllowedSkins(templateRoot))
                {
                    var li = new ListItem(kvp.Value, kvp.Key);
                    if (kvp.Key == currentSkin)
                    {
                        li.Selected = true;
                    }

                    dd_skins.Items.Add(li);
                }

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(_templateId)))
                {
                    ph_rollback.Visible = true;
                }
            }
        }
Beispiel #3
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();
        }
Beispiel #4
0
        protected virtual void AddSkinningModules()
        {
            // SKINNING
            // verify access to settings area
            if (User.GetCurrent().GetApplications().Find(t => string.Equals(t.alias, Umbraco.Core.Constants.Applications.Settings, StringComparison.OrdinalIgnoreCase)) != null)
            {
                //only add if there is a skin
                NodeFactory.Node n = NodeFactory.Node.GetCurrent();

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(n.template)) || Skinning.HasAvailableSkins(n.template))
                {
                    m_Manager.LiveEditingContext.Menu.Add(new Separator());
                    m_Manager.LiveEditingContext.Menu.Add(new SkinModule(m_Manager));
                }
            }
        }
        protected virtual void AddSkinningModules()
        {
            // SKINNING
            // verify access to settings area
            if (User.GetCurrent().GetApplications().Find(t => t.alias.ToLower() == "settings") != null)
            {
                //only add if there is a skin
                NodeFactory.Node n = NodeFactory.Node.GetCurrent();

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(n.template)) || Skinning.HasAvailableSkins(n.template))
                {
                    m_Manager.LiveEditingContext.Menu.Add(new Separator());
                    m_Manager.LiveEditingContext.Menu.Add(new SkinModule(m_Manager));
                }
            }
        }
Beispiel #6
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);
            }
        }