Beispiel #1
0
        protected void openRepo(object sender, EventArgs e)
        {
            Guid?g = Skinning.StarterKitGuid(templateID);


            if (g == null || !Skinning.HasAvailableSkins(templateID))
            {
                bt_repo.Visible = false;
            }
            else
            {
                if (repo.HasConnection())
                {
                    try
                    {
                        rep_starterKitDesigns.DataSource = repo.Webservice.Skins(g.ToString());
                        rep_starterKitDesigns.DataBind();
                    }
                    catch (Exception ex)
                    {
                        BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, -1, ex.ToString());

                        //ShowConnectionError();
                    }
                }
                else
                {
                    //ShowConnectionError();
                }
            }

            p_apply.Visible    = false;
            p_download.Visible = true;
        }
Beispiel #2
0
        protected void openRepo(object sender, EventArgs e)
        {
            var g = Skinning.StarterKitGuid(_templateId);


            if (g == null || !Skinning.HasAvailableSkins(_templateId))
            {
                bt_repo.Visible = false;
            }
            else
            {
                if (_repo.HasConnection())
                {
                    try
                    {
                        rep_starterKitDesigns.DataSource = _repo.Webservice.Skins(g.ToString());
                        rep_starterKitDesigns.DataBind();
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Error <TemplateSkinning>("An error occurred", ex);

                        //ShowConnectionError();
                    }
                }
            }

            p_apply.Visible    = false;
            p_download.Visible = true;
        }
Beispiel #3
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 #5
0
        protected void LoadSkins()
        {
            List <string> skinNames = new List <string>();

            Guid?nullable = Skinning.StarterKitGuid(Node.GetCurrent().template);

            if (nullable.HasValue)
            {
                InstalledPackage p = InstalledPackage.GetByGuid(nullable.Value.ToString());
                if (p.Data.SkinRepoGuid != null && p.Data.SkinRepoGuid != Guid.Empty && p.Data.SkinRepoGuid.ToString() != repoGuid)
                {
                    this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(p.Data.SkinRepoGuid.ToString());
                }
            }

            if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template)))
            {
                this.pChangeSkin.Visible = false;
            }
            else if (this.repo.HasConnection())
            {
                try
                {
                    var skins = this.repo.Webservice.Skins(nullable.ToString());
                    this.rep_starterKitDesigns.DataSource = skins;
                    this.rep_starterKitDesigns.DataBind();

                    foreach (var s in skins)
                    {
                        if (!skinNames.Contains(s.Text))
                        {
                            skinNames.Add(s.Text);
                        }
                    }
                }
                catch (Exception exception)
                {
                    LogHelper.Error <SkinCustomizer>("An error occurred", exception);
                }
            }
            else
            {
                this.ShowConnectionError();
            }

            //check for local skins

            List <string> localSkins = new List <string>();
            DirectoryInfo dirInfo    = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages));

            foreach (DirectoryInfo subDur in dirInfo.GetDirectories())
            {
                var skinFile = subDur.GetFiles("skin.xml");

                if (skinFile.Length > 0)
                {
                    string c = Skin.GetSkinNameFromFile(skinFile[0].FullName);

                    if (!skinNames.Contains(c))
                    {
                        localSkins.Add(c);
                    }
                }
            }

            if (localSkins.Count > 0)
            {
                rep_starterKitDesignsLocal.DataSource = localSkins;
                rep_starterKitDesignsLocal.DataBind();
            }
            else
            {
                localSkinsContainer.Visible = false;
            }
        }