@@ -225,4 +225,83 @@ html {
|
||||
.umbModalBox p select
|
||||
{
|
||||
margin-bottom:10px ! important;
|
||||
}
|
||||
}
|
||||
|
||||
.umbModalBox p{font-size: 11px !Important}
|
||||
|
||||
|
||||
#skins ul{list-style: none; padding: 0px; display: block; clear: both; height: 200px;}
|
||||
#skins ul li{margin-right: 12px; float: left; border: 1px solid #efefef; padding: 5px; width: 120px; text-align: center; font-weight: normal;}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
|
||||
Umbraco UI Components
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
.propertypane {
|
||||
position: relative;
|
||||
display: block;
|
||||
line-height: 1.1;
|
||||
background: #fff url('/umbraco_client/propertypane/images/propertyBackground.gif') top repeat-x !Important;
|
||||
background-image:url(/umbraco_client/propertypane/images/propertyBackground.gif) !Important;
|
||||
padding: 5px;
|
||||
margin:7px 0px 0px 0px;
|
||||
border: 1px solid #d9d7d7;
|
||||
text-align:left;
|
||||
clear: both;
|
||||
float: none;
|
||||
color: black;
|
||||
font-size: 11px !Important;
|
||||
}
|
||||
|
||||
.propertypane th
|
||||
{
|
||||
vertical-align: top;
|
||||
text-align:left;
|
||||
font-weight:bold;
|
||||
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
|
||||
font-size:12px;
|
||||
width: 16%;
|
||||
}
|
||||
|
||||
.propertypane,.propertypane td
|
||||
{
|
||||
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
|
||||
.propertypane small
|
||||
{
|
||||
font-weight: normal;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.propertypane div.propertyItem{
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
font-family: Trebuchet MS, Lucida Grande, verdana, arial;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
.propertypane div.propertyItem .propertyItemheader{
|
||||
width: 16%;
|
||||
padding-right: 1%;
|
||||
padding-bottom: 10px;
|
||||
float: left;
|
||||
clear: left;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.propertypane div.propertyItem .propertyItemContent{
|
||||
float: left;
|
||||
padding-bottom: 5px;
|
||||
clear: right;
|
||||
}
|
||||
|
||||
h2.propertypaneTitel{font-size: 14px; color: #999;margin: 7px 0px 0px 0px; padding-bottom: 0px; line-height: 14px;}
|
||||
|
||||
div.propertyPaneFooter{clear: both; height: 1px; overflow: hidden; color: #fff;}
|
||||
|
||||
|
||||
@@ -10,20 +10,16 @@
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
|
||||
#cropcontainer
|
||||
{
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#cropper {
|
||||
cursor:move;
|
||||
overflow:hidden;
|
||||
width:<%= Request["w"] %>px;
|
||||
height:<%= Request["h"] %>px;
|
||||
clear:both;
|
||||
border:1px solid black;
|
||||
background:black;
|
||||
border:1px solid #ccc;
|
||||
background:#ccc;
|
||||
margin: 5px 0px 15px 5px;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
@@ -31,6 +27,7 @@
|
||||
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
|
||||
|
||||
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="ui/ui-lightness/jquery-ui-1.8.4.custom.css" PathNameAlias="UmbracoClient" />
|
||||
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="ui/default.css" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient"
|
||||
Priority="0" />
|
||||
@@ -88,9 +85,6 @@
|
||||
{
|
||||
$("#cropper").css('width', <%= Request["w"] %> / 2);
|
||||
$("#cropper").css('height', <%= Request["h"] %> / 2);
|
||||
|
||||
$("#workingscale").show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -142,57 +136,57 @@
|
||||
|
||||
<asp:HiddenField ID="Image" runat="server" />
|
||||
|
||||
<asp:HiddenField ID="FileName" runat="server" />
|
||||
<asp:HiddenField ID="FileName" runat="server" />
|
||||
|
||||
<asp:HiddenField ID="X" runat="server" Value="0"/>
|
||||
<asp:HiddenField ID="Y" runat="server" Value="0"/>
|
||||
<asp:HiddenField ID="Scale" runat="server" Value="100"/>
|
||||
|
||||
<cc1:Feedback ID="fb_feedback1" runat="server" />
|
||||
|
||||
<asp:Panel ID="pnl_upload" runat="server">
|
||||
|
||||
<h1>Upload image</h1>
|
||||
<asp:PlaceHolder ID="pnl_upload" runat="server">
|
||||
|
||||
<asp:FileUpload ID="FileUpload1" runat="server" />
|
||||
<asp:Button ID="bt_upload" runat="server" Text="Upload"
|
||||
onclick="bt_upload_Click" /><br />
|
||||
<cc1:Pane Text="Upload image file" runat="server">
|
||||
|
||||
<cc1:PropertyPanel runat="server" Text="Select a image file <br/><small>jpg, gif and png files can be used</small>">
|
||||
<asp:FileUpload ID="FileUpload1" runat="server" />
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
<p style="margin-top: 20px;">
|
||||
<asp:Button ID="bt_upload" runat="server" Text="Upload" onclick="bt_upload_Click" /> <em> or </em> <a href="#" onclick="closeModal();">Cancel</a>
|
||||
</p>
|
||||
</asp:PlaceHolder>
|
||||
|
||||
<asp:Literal ID="lit_notvalid" runat="server" Text="Please upload a valid image file" Visible="false"></asp:Literal>
|
||||
|
||||
<br />
|
||||
<asp:PlaceHolder ID="pnl_crop" runat="server" Visible="false">
|
||||
|
||||
<button type="button" onclick="closeModal();">Cancel</button>
|
||||
|
||||
</asp:Panel>
|
||||
|
||||
<asp:Panel ID="pnl_crop" runat="server" Visible="false">
|
||||
|
||||
<h1>Crop image</h1>
|
||||
<div id="cropcontainer">
|
||||
|
||||
<span id="workingscale" style="display:none;">Result will be twice the size.</span>
|
||||
<cc1:Pane runat="server" Text="Crop and scale image">
|
||||
|
||||
<cc1:PropertyPanel runat="server" Text="Crop <br /><small>Drag image with mouse to selct crop area</small>">
|
||||
<div id="cropper">
|
||||
<asp:Image ID="Image1" runat="server" />
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
<a href="#" onclick="ResetToDefault();return false;">Reset</a>
|
||||
<asp:LinkButton ID="bt_uploadother" runat="server" onclick="bt_uploadother_Click">upload other image</asp:LinkButton>
|
||||
|
||||
<br />
|
||||
Scale image:
|
||||
<div id="slidercontainer" style="width:500px">
|
||||
<div id="slider"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<asp:Button ID="bt_crop" runat="server" Text="OK" onclick="bt_crop_Click" />
|
||||
<button type="button" onclick="closeModal();">Cancel</button>
|
||||
|
||||
</asp:Panel>
|
||||
<cc1:PropertyPanel runat="server" Text="Scale <br /><small>Drag slider to choose size</small>" >
|
||||
<div id="slidercontainer" style="width: <%= scaleWidth %>">
|
||||
<div id="slider"></div>
|
||||
</div>
|
||||
</cc1:PropertyPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</cc1:Pane>
|
||||
|
||||
<p style="margin-top: 20px;">
|
||||
<asp:Button ID="bt_crop" runat="server" Text="OK" onclick="bt_crop_Click" /> <em> or </em> <a href="#" onclick="closeModal();">Cancel</a>
|
||||
</p>
|
||||
|
||||
</asp:PlaceHolder>
|
||||
|
||||
</form>
|
||||
</body>
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
//max width and height is used to make sure the cropper doesn't grow bigger then the modal window
|
||||
public int MaxWidth = 700;
|
||||
public int MaxHeight = 480;
|
||||
public string scaleWidth = "500px";
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -26,7 +28,6 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
if (FileUpload1.HasFile)
|
||||
{
|
||||
lit_notvalid.Visible = false;
|
||||
|
||||
Guid g = Guid.NewGuid();
|
||||
DirectoryInfo updir = new DirectoryInfo(IO.IOHelper.MapPath("~/media/upload/" + g));
|
||||
@@ -46,15 +47,20 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
if (!string.IsNullOrEmpty(Request["w"]) && !string.IsNullOrEmpty(Request["h"]))
|
||||
{
|
||||
|
||||
|
||||
if (Convert.ToInt32(Request["w"]) > MaxWidth || Convert.ToInt32(Request["h"]) > MaxHeight)
|
||||
{
|
||||
System.Drawing.Image img = System.Drawing.Image.FromFile(IO.IOHelper.MapPath(Image.Value));
|
||||
|
||||
Image1.Width = img.Width / 2;
|
||||
Image1.Height = img.Height / 2;
|
||||
|
||||
fb_feedback1.Text = "<strong>Notice:</strong> The below exemple is scaled down 50% as the image is quite large, do not worry, it will be the right size on your website";
|
||||
}
|
||||
|
||||
if (Image1.Width.Value > 250)
|
||||
scaleWidth = (Image1.Width.Value).ToString() + "px";
|
||||
|
||||
|
||||
pnl_crop.Visible = true;
|
||||
pnl_upload.Visible = false;
|
||||
}
|
||||
@@ -64,7 +70,10 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
}
|
||||
else
|
||||
lit_notvalid.Visible = true;
|
||||
{
|
||||
fb_feedback1.Text = "Please choose a valid image file";
|
||||
fb_feedback1.type = uicontrols.Feedback.feedbacktype.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,15 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// </remarks>
|
||||
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
|
||||
|
||||
/// <summary>
|
||||
/// CssInclude2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::ClientDependency.Core.Controls.CssInclude CssInclude2;
|
||||
|
||||
/// <summary>
|
||||
/// JsInclude1 control.
|
||||
/// </summary>
|
||||
@@ -111,6 +120,15 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField Scale;
|
||||
|
||||
/// <summary>
|
||||
/// fb_feedback1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::umbraco.uicontrols.Feedback fb_feedback1;
|
||||
|
||||
/// <summary>
|
||||
/// pnl_upload control.
|
||||
/// </summary>
|
||||
@@ -118,7 +136,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel pnl_upload;
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder pnl_upload;
|
||||
|
||||
/// <summary>
|
||||
/// FileUpload1 control.
|
||||
@@ -138,15 +156,6 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button bt_upload;
|
||||
|
||||
/// <summary>
|
||||
/// lit_notvalid 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.Literal lit_notvalid;
|
||||
|
||||
/// <summary>
|
||||
/// pnl_crop control.
|
||||
/// </summary>
|
||||
@@ -154,7 +163,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel pnl_crop;
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder pnl_crop;
|
||||
|
||||
/// <summary>
|
||||
/// Image1 control.
|
||||
@@ -165,15 +174,6 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Image Image1;
|
||||
|
||||
/// <summary>
|
||||
/// bt_uploadother 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 bt_uploadother;
|
||||
|
||||
/// <summary>
|
||||
/// bt_crop control.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SkinCustomizer.ascx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.SkinCustomizer" %>
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SkinCustomizer.ascx.cs" Inherits="umbraco.presentation.LiveEditing.Modules.SkinModule.SkinCustomizer" %>
|
||||
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function closeCustomizeSkinModal() {
|
||||
|
||||
jQuery('#cancelSkinInstall').trigger('click');
|
||||
//jQuery('#cancelSkinInstall').trigger('click');
|
||||
UmbSpeechBubble.ShowMessage("Info", "Skin", "Skin updated...");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<asp:Panel ID="pnl_connectionerror" runat="server" Visible="false">
|
||||
@@ -20,38 +18,41 @@
|
||||
<div id="costumizeSkin" <asp:Literal ID="ltCustomizeSkinStyle" runat="server" Text=""></asp:Literal>>
|
||||
|
||||
<div id="dependencies">
|
||||
<asp:PlaceHolder ID="ph_dependencies" runat="server"></asp:PlaceHolder>
|
||||
<cc1:Pane ID="ph_dependencies" runat="server" />
|
||||
</div>
|
||||
|
||||
<p runat="server" id="pChangeSkin">... or <a href="#" onclick="jQuery('#costumizeSkin').hide();jQuery('#changeSkin').show();">change</a> skin</p>
|
||||
<p>
|
||||
<asp:Button ID="btnOk" runat="server" Text=" Ok " CssClass="modalButton" onclick="btnOk_Click" OnClientClick="closeCustomizeSkinModal();"/>
|
||||
<em> or </em> <a href="#" onclick="closeModal();">Cancel</a>
|
||||
</p>
|
||||
|
||||
<asp:Button ID="btnOk" runat="server" Text="Ok" onclick="btnOk_Click" OnClientClick="closeCustomizeSkinModal();"/>
|
||||
|
||||
<button type="button" class="modalbuton" id="cancelSkinCustomization">Cancel</button>
|
||||
|
||||
<p runat="server" id="pChangeSkin">You could also change to another skin <a href="#" onclick="jQuery('#costumizeSkin').hide();jQuery('#changeSkin').show();">change</a> skin</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="changeSkin" <asp:Literal ID="ltChangeSkinStyle" runat="server" Text="style='display:none;'"></asp:Literal>>
|
||||
|
||||
<p>
|
||||
Choose a skin from your local collection, or download one from the umbraco package repository
|
||||
</p>
|
||||
|
||||
<div id="skins">
|
||||
<asp:Repeater ID="rep_starterKitDesigns" runat="server" onitemdatabound="rep_starterKitDesigns_ItemDataBound">
|
||||
<HeaderTemplate>
|
||||
<ul id="starterKitDesigns">
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<li>
|
||||
|
||||
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" />
|
||||
|
||||
<span><%# ((Skin)Container.DataItem).Text %></span>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
<asp:Button ID="Button1" runat="server" Text="Install" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" OnClick="SelectStarterKitDesign" CommandName="<%# ((Skin)Container.DataItem).Text %>"/>
|
||||
</li>
|
||||
</ItemTemplate>
|
||||
|
||||
<ItemTemplate>
|
||||
<li>
|
||||
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" alt="<%# ((Skin)Container.DataItem).Text %>" />
|
||||
<span><%# ((Skin)Container.DataItem).Text %></span>
|
||||
<br />
|
||||
<asp:LinkButton ID="Button1" runat="server" Text="Install" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>" OnClick="SelectStarterKitDesign" CommandName="<%# ((Skin)Container.DataItem).Text %>"/>
|
||||
</li>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
</ul>
|
||||
</FooterTemplate>
|
||||
@@ -61,12 +62,8 @@
|
||||
|
||||
|
||||
<p runat="server" id="pCustomizeSkin">
|
||||
|
||||
|
||||
|
||||
... or <a href="#" onclick="jQuery('#changeSkin').hide();jQuery('#costumizeSkin').show();">customize</a> current skin</p>
|
||||
|
||||
<button type="button" class="modalbuton" id="cancelSkinInstall">Cancel</button>
|
||||
<button onclick="jQuery('#changeSkin').hide(); jQuery('#costumizeSkin').show();">Cancel</button>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -11,24 +11,97 @@ using umbraco.interfaces.skinning;
|
||||
using umbraco.IO;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
namespace umbraco.presentation.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
|
||||
public partial class SkinCustomizer : System.Web.UI.UserControl
|
||||
public partial class SkinCustomizer : UserControl
|
||||
{
|
||||
private Skin ActiveSkin { get; set; }
|
||||
// Fields
|
||||
|
||||
|
||||
private cms.businesslogic.packager.repositories.Repository repo;
|
||||
private cms.businesslogic.skinning.Skin ActiveSkin;
|
||||
|
||||
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
private List<Dependency> sDependencies = new List<Dependency>();
|
||||
|
||||
private cms.businesslogic.packager.repositories.Repository repo;
|
||||
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
// Methods
|
||||
public SkinCustomizer()
|
||||
{
|
||||
repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
|
||||
this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(this.repoGuid);
|
||||
}
|
||||
|
||||
protected void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.ActiveSkin.SaveOutput();
|
||||
foreach (Dependency dependency in this.sDependencies)
|
||||
{
|
||||
if (dependency.DependencyType.Values.Count > 0)
|
||||
{
|
||||
string output = dependency.DependencyType.Values[0].ToString();
|
||||
foreach (Task task in dependency.Tasks)
|
||||
{
|
||||
TaskExecutionDetails details = task.TaskType.Execute(this.ParsePlaceHolders(task.Value, output));
|
||||
if (details.TaskExecutionStatus == TaskExecutionStatus.Completed)
|
||||
{
|
||||
this.ActiveSkin.AddTaskHistoryNode(task.TaskType.ToXml(details.OriginalValue, details.NewValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LoadDependencies()
|
||||
{
|
||||
this.ph_dependencies.Controls.Clear();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append("\r\n var hasSetTasksClientScriptsRun = false; \r\n function setTasksClientScripts(){ \r\n if(hasSetTasksClientScriptsRun == false){");
|
||||
|
||||
foreach (Dependency dependency in this.ActiveSkin.Dependencies)
|
||||
{
|
||||
if (dependency.DependencyType != null)
|
||||
{
|
||||
this.sDependencies.Add(dependency);
|
||||
Control editor = dependency.DependencyType.Editor;
|
||||
this.ph_dependencies.addProperty(dependency.Label, editor);
|
||||
foreach (Task task in dependency.Tasks)
|
||||
{
|
||||
builder.Append(task.TaskType.PreviewClientScript(editor.ClientID, dependency.DependencyType.ClientSidePreviewEventType(), dependency.DependencyType.ClientSideGetValueScript()));
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.Append("hasSetTasksClientScriptsRun = true; }}");
|
||||
ScriptManager.RegisterClientScriptBlock(this, base.GetType(), "TasksClientScripts", builder.ToString(), true);
|
||||
}
|
||||
|
||||
protected void LoadSkins()
|
||||
{
|
||||
Guid? nullable = Skinning.StarterKitGuid(Node.GetCurrent().template);
|
||||
if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template)))
|
||||
{
|
||||
this.pChangeSkin.Visible = false;
|
||||
}
|
||||
else if (this.repo.HasConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
this.rep_starterKitDesigns.DataSource = this.repo.Webservice.Skins(nullable.ToString());
|
||||
this.rep_starterKitDesigns.DataBind();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Add(LogTypes.Debug, -1, exception.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowConnectionError();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -55,42 +128,14 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
ltCustomizeSkinStyle.Text = ltChangeSkinStyle.Text;
|
||||
ltChangeSkinStyle.Text = string.Empty;
|
||||
}
|
||||
|
||||
LoadSkins();
|
||||
|
||||
LoadSkins();
|
||||
}
|
||||
|
||||
protected void LoadSkins()
|
||||
private string ParsePlaceHolders(string value, string output)
|
||||
{
|
||||
Guid? g = Skinning.StarterKitGuid(nodeFactory.Node.GetCurrent().template);
|
||||
|
||||
|
||||
if (g == null || !Skinning.HasAvailableSkins(nodeFactory.Node.GetCurrent().template))
|
||||
{
|
||||
pChangeSkin.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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
value = value.Replace("${Output}", output);
|
||||
return value;
|
||||
}
|
||||
|
||||
protected void rep_starterKitDesigns_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
||||
@@ -118,168 +163,47 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void LoadDependencies()
|
||||
{
|
||||
ph_dependencies.Controls.Clear();
|
||||
|
||||
StringBuilder s = new StringBuilder();
|
||||
|
||||
s.Append(@"
|
||||
var hasSetTasksClientScriptsRun = false;
|
||||
function setTasksClientScripts(){
|
||||
if(hasSetTasksClientScriptsRun == false){");
|
||||
|
||||
|
||||
foreach (Dependency d in ActiveSkin.Dependencies)
|
||||
{
|
||||
if (d.DependencyType != null)
|
||||
{
|
||||
sDependencies.Add(d);
|
||||
|
||||
ph_dependencies.Controls.Add(new LiteralControl("<p class=\"dependency\">"));
|
||||
|
||||
Label lbl = new Label();
|
||||
|
||||
lbl.Text = d.Label;
|
||||
|
||||
Control ctrl = d.DependencyType.Editor;
|
||||
|
||||
//lbl.AssociatedControlID = ctrl.ID;
|
||||
|
||||
ph_dependencies.Controls.Add(lbl);
|
||||
|
||||
ph_dependencies.Controls.Add(new LiteralControl("<br/>"));
|
||||
|
||||
ph_dependencies.Controls.Add(ctrl);
|
||||
|
||||
ph_dependencies.Controls.Add(new LiteralControl("</p>"));
|
||||
|
||||
|
||||
|
||||
foreach (Task t in d.Tasks)
|
||||
{
|
||||
|
||||
s.Append(t.TaskType.PreviewClientScript(
|
||||
ctrl.ClientID,
|
||||
d.DependencyType.ClientSidePreviewEventType(),
|
||||
d.DependencyType.ClientSideGetValueScript()));
|
||||
|
||||
//ScriptManager.RegisterClientScriptBlock(
|
||||
// this,
|
||||
// this.GetType(),
|
||||
// d.Label + "_" + t.TaskType.Name,
|
||||
// t.TaskType.PreviewClientScript(ctrl.ClientID,d.Properties),
|
||||
// true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
s.Append("hasSetTasksClientScriptsRun = true; }}");
|
||||
|
||||
ScriptManager.RegisterClientScriptBlock(
|
||||
this,
|
||||
this.GetType(),
|
||||
"TasksClientScripts",
|
||||
s.ToString(),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
protected void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
ActiveSkin.SaveOutput();
|
||||
|
||||
foreach (Dependency d in sDependencies)
|
||||
{
|
||||
if (d.DependencyType.Values.Count > 0)
|
||||
{
|
||||
string output = d.DependencyType.Values[0].ToString();
|
||||
|
||||
foreach (Task t in d.Tasks)
|
||||
{
|
||||
TaskExecutionDetails details = t.TaskType.Execute(ParsePlaceHolders(t.Value, output));
|
||||
|
||||
if (details.TaskExecutionStatus == TaskExecutionStatus.Completed)
|
||||
{
|
||||
ActiveSkin.AddTaskHistoryNode(
|
||||
t.TaskType.ToXml(details.OriginalValue,details.NewValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private string ParsePlaceHolders(string value,string output)
|
||||
{
|
||||
//parse ${Output}
|
||||
value = value.Replace("${Output}", output);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
protected void SelectStarterKitDesign(object sender, EventArgs e)
|
||||
{
|
||||
if (((Button)sender).CommandName == "apply")
|
||||
{
|
||||
Skin s = Skin.CreateFromName(((Button)sender).CommandArgument);
|
||||
Skinning.ActivateAsCurrentSkin(s);
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true&umbSkinningConfigurator=true");
|
||||
Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandArgument));
|
||||
this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
}
|
||||
else if (((Button)sender).CommandName == "remove")
|
||||
{
|
||||
nodeFactory.Node n = nodeFactory.Node.GetCurrent();
|
||||
|
||||
Template t = new Template(n.template);
|
||||
Skinning.RollbackSkin(t.Id);
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())) + "?umbSkinning=true");
|
||||
Template template = new Template(Node.GetCurrent().template);
|
||||
Skinning.RollbackSkin(template.Id);
|
||||
this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
Guid kitGuid = new Guid(((Button)sender).CommandArgument);
|
||||
|
||||
cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer();
|
||||
|
||||
if (repo.HasConnection())
|
||||
Guid guid = new Guid(((Button)sender).CommandArgument);
|
||||
Installer installer = new Installer();
|
||||
if (this.repo.HasConnection())
|
||||
{
|
||||
cms.businesslogic.packager.Installer p = new cms.businesslogic.packager.Installer();
|
||||
|
||||
string tempFile = p.Import(repo.fetch(kitGuid.ToString()));
|
||||
p.LoadConfig(tempFile);
|
||||
int pID = p.CreateManifest(tempFile, kitGuid.ToString(), repoGuid);
|
||||
|
||||
p.InstallFiles(pID, tempFile);
|
||||
p.InstallBusinessLogic(pID, tempFile);
|
||||
p.InstallCleanUp(pID, tempFile);
|
||||
|
||||
Installer installer2 = new Installer();
|
||||
string tempDir = installer2.Import(this.repo.fetch(guid.ToString()));
|
||||
installer2.LoadConfig(tempDir);
|
||||
int packageId = installer2.CreateManifest(tempDir, guid.ToString(), this.repoGuid);
|
||||
installer2.InstallFiles(packageId, tempDir);
|
||||
installer2.InstallBusinessLogic(packageId, tempDir);
|
||||
installer2.InstallCleanUp(packageId, tempDir);
|
||||
library.RefreshContent();
|
||||
|
||||
Skin s = Skin.CreateFromName(((Button)sender).CommandName);
|
||||
Skinning.ActivateAsCurrentSkin(s);
|
||||
|
||||
Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
Skinning.ActivateAsCurrentSkin(Skin.CreateFromName(((Button)sender).CommandName));
|
||||
this.Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConnectionError();
|
||||
this.ShowConnectionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ShowConnectionError()
|
||||
{
|
||||
pnl_connectionerror.Visible = true;
|
||||
this.pnl_connectionerror.Visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
namespace umbraco.presentation.LiveEditing.Modules.SkinModule {
|
||||
|
||||
|
||||
public partial class SkinCustomizer {
|
||||
@@ -37,16 +37,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.PlaceHolder ph_dependencies;
|
||||
|
||||
/// <summary>
|
||||
/// pChangeSkin control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl pChangeSkin;
|
||||
protected global::umbraco.uicontrols.Pane ph_dependencies;
|
||||
|
||||
/// <summary>
|
||||
/// btnOk control.
|
||||
@@ -57,6 +48,15 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnOk;
|
||||
|
||||
/// <summary>
|
||||
/// pChangeSkin control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl pChangeSkin;
|
||||
|
||||
/// <summary>
|
||||
/// ltChangeSkinStyle control.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user