diff --git a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx index c1a363ea89..92a2a02af0 100644 --- a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx +++ b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx @@ -90,6 +90,27 @@ +
+

Looks like there are also some local skins

+ + + +
    + + +
  • + <%# ((string)Container.DataItem).ToString() %> + + +
  • +
    + +
+ +
+ + +

Go back to your current skin diff --git a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.cs b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.cs index da58563adb..a7e52a519e 100644 --- a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.cs +++ b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.cs @@ -154,6 +154,8 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule protected void LoadSkins() { + List skinNames = new List(); + Guid? nullable = Skinning.StarterKitGuid(Node.GetCurrent().template); if(nullable.HasValue){ @@ -170,8 +172,15 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule { try { - this.rep_starterKitDesigns.DataSource = this.repo.Webservice.Skins(nullable.ToString()); + 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) { @@ -182,6 +191,37 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule { this.ShowConnectionError(); } + + //check for local skins + + List localSkins = new List(); + DirectoryInfo dirInfo = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages)); + foreach (DirectoryInfo subDur in dirInfo.GetDirectories()) + { + var skinFile = subDur.GetFiles("skin.xml"); + + if (skinFile != null) + { + 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; + } + + + } protected void Page_Load(object sender, EventArgs e) @@ -287,6 +327,37 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule } } + + protected void rep_starterKitDesignsLocal_ItemDataBound(object sender, RepeaterItemEventArgs e) + { + if (e.Item.DataItem != null) + { + + if (ActiveSkin != null && ActiveSkin.Name == e.Item.DataItem.ToString()) + { + Button inst = (Button)e.Item.FindControl("btnApply"); + inst.Text = "Rollback"; + inst.CommandName = "remove"; + } + } + + } + + protected void SelectLocalStarterKitDesign(object sender, EventArgs e) + { + if (((Button)sender).CommandName == "apply") + { + Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandArgument)); + this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); + } + else if (((Button)sender).CommandName == "remove") + { + Template template = new Template(Node.GetCurrent().template); + Skinning.RollbackSkin(template.Id); + this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true"); + } + } + private void ShowConnectionError() { this.pnl_connectionerror.Visible = true; diff --git a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.designer.cs b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.designer.cs index b0e5ee8715..504c4aa545 100644 --- a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.designer.cs +++ b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/SkinCustomizer.ascx.designer.cs @@ -75,6 +75,24 @@ namespace umbraco.presentation.LiveEditing.Modules.SkinModule { /// protected global::System.Web.UI.WebControls.Repeater rep_starterKitDesigns; + ///

+ /// localSkinsContainer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl localSkinsContainer; + + /// + /// rep_starterKitDesignsLocal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater rep_starterKitDesignsLocal; + /// /// pCustomizeSkin control. /// diff --git a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/js/disableInstallButtonsOnClick.js b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/js/disableInstallButtonsOnClick.js index ace271d03b..4df5f81ad1 100644 --- a/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/js/disableInstallButtonsOnClick.js +++ b/umbraco/presentation/umbraco/LiveEditing/Modules/SkinModule/js/disableInstallButtonsOnClick.js @@ -3,4 +3,6 @@ jQuery('#skinupdateinprogress').show(); jQuery('#skins').hide(); + + jQuery('#localSkinsContainer').hide(); }); \ No newline at end of file