template dialog for skinning (WIP)

[TFS Changeset #77161]
This commit is contained in:
PerPloug
2010-09-14 07:14:24 +00:00
parent 437538b23f
commit 3319ded749
7 changed files with 211 additions and 4 deletions

View File

@@ -17,7 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StandardConfig", "StandardConfig", "{B8ECDB8B-BF44-462C-B6DA-22421B3EC4D7}"
ProjectSection(SolutionItems) = preProject
config templates\access.xml = config templates\access.xml
aspnet35.config = aspnet35.config
config templates\config\UI.xml = config templates\config\UI.xml
config templates\umbraco.config = config templates\umbraco.config
@@ -71,7 +70,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DLLs", "DLLs", "{F06D18F6-C
foreign dlls\IronPython.dll = foreign dlls\IronPython.dll
foreign dlls\IronRuby.dll = foreign dlls\IronRuby.dll
License.txt = License.txt
foreign dlls\Lucene.Net.dll = foreign dlls\Lucene.Net.dll
foreign dlls\Microsoft.ApplicationBlocks.Data.dll = foreign dlls\Microsoft.ApplicationBlocks.Data.dll
foreign dlls\MySql.Data.dll = foreign dlls\MySql.Data.dll
foreign dlls\TidyNet.dll = foreign dlls\TidyNet.dll

View File

@@ -225,6 +225,13 @@ namespace umbraco.cms.businesslogic.skinning
return IsSkinnable(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(int templateID)
{
Template template = new Template(templateID);
return AllowedSkins(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(Template template)
{
return AllowedSkins(template.Alias);
@@ -268,8 +275,8 @@ namespace umbraco.cms.businesslogic.skinning
installed.Load(IO.IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config");
XmlNode starterKit = installed.SelectSingleNode(
string.Format("//templates [contains (., '{0}') ]//ancestor::package",template));
string.Format("//package [@enableSkins = 'True' and contains(./templates, '{0}')]", template));
if (starterKit != null)
return new Guid(starterKit.Attributes["packageGuid"].Value);
else

View File

@@ -565,6 +565,13 @@
<Compile Include="umbraco\dialogs\Preview.aspx.designer.cs">
<DependentUpon>Preview.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco\dialogs\TemplateSkinning.aspx.cs">
<DependentUpon>TemplateSkinning.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\dialogs\TemplateSkinning.aspx.designer.cs">
<DependentUpon>TemplateSkinning.aspx</DependentUpon>
</Compile>
<Compile Include="umbraco\endPreview.aspx.cs">
<DependentUpon>endPreview.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1574,6 +1581,7 @@
<Content Include="install\steps\Skinning\loadStarterKits.ascx" />
<Content Include="install\Title.ascx" />
<Content Include="umbraco\dashboard\Settings\Applyskin.ascx" />
<Content Include="umbraco\dialogs\TemplateSkinning.aspx" />
<Content Include="umbraco\helpRedirect.aspx" />
<Content Include="umbraco\images\aboutNew.png" />
<Content Include="umbraco\images\loginBg.png" />

View File

@@ -0,0 +1,30 @@
<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" CodeBehind="TemplateSkinning.aspx.cs" Inherits="umbraco.presentation.umbraco.dialogs.TemplateSkinning" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="server">
<cc1:Pane ID="p_apply" runat="server" Visible="false">
<cc1:PropertyPanel ID="PropertyPanel1" runat="server" Text="Select a skin">
<asp:DropDownList ID="dd_skins" runat="server" /> <asp:LinkButton OnClick="openRepo" runat="server">Download more skins</asp:LinkButton>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="PropertyPanel2" runat="server" Text=" ">
<br />
<asp:Button ID="Button1" runat="server" OnClick="apply" />
<asp:PlaceHolder ID="ph_rollback" runat="server" Visible="false">
<em>or</em> <asp:LinkButton ID="lb_rollback" OnClick="rollback" runat="server">Rollback current skin</asp:LinkButton>
</asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
<cc1:Pane ID="p_download" runat="server" Visible="false">
...connect to repo and list all skins available, mark those already installed...
</cc1:Pane>
</asp:Content>

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.template;
using umbraco.cms.businesslogic;
namespace umbraco.presentation.umbraco.dialogs
{
public partial class TemplateSkinning : System.Web.UI.Page
{
private int templateID = 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;
}
}
}
private int FindTemplateRoot(CMSNode t)
{
if (t.ParentId < 0)
return t.Id;
else
return FindTemplateRoot(t.Parent);
}
protected void openRepo(object sender, EventArgs e) { }
protected void apply(object sender, EventArgs e) {
if (dd_skins.SelectedIndex > 0)
{
Skinn
}
}
protected void rollback(object sender, EventArgs e) { }
}
}

View File

@@ -0,0 +1,87 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.umbraco.dialogs {
public partial class TemplateSkinning {
/// <summary>
/// p_apply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane p_apply;
/// <summary>
/// PropertyPanel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
/// <summary>
/// dd_skins control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList dd_skins;
/// <summary>
/// PropertyPanel2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2;
/// <summary>
/// Button1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button Button1;
/// <summary>
/// ph_rollback control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder ph_rollback;
/// <summary>
/// lb_rollback control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lb_rollback;
/// <summary>
/// p_download control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane p_download;
}
}

View File

@@ -11,6 +11,7 @@ using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using umbraco.cms.businesslogic.skinning;
namespace umbraco.cms.presentation.settings
@@ -124,6 +125,16 @@ namespace umbraco.cms.presentation.settings
umbContent.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" + _template.Id.ToString(), ui.Text("template", "insertContentArea"), 470, 300);
}
if (Skinning.StarterKitGuid(_template.Id).HasValue)
{
Panel1.Menu.InsertSplitter();
uicontrols.MenuIconI umbContainer = Panel1.Menu.NewIcon();
umbContainer.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
umbContainer.AltText = ui.Text("template", "modifyTemplateSkin");
umbContainer.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/TemplateSkinning.aspx?&id=" + _template.Id.ToString(), ui.Text("template", "modifyTemplateSkin"), 570, 420);
}
// Help
Panel1.Menu.InsertSplitter();