updates #U4-2070 for skin module files in live editing
This commit is contained in:
@@ -4,35 +4,43 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.skinning;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class CssParser : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
|
||||
public CssParser()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
//will be used to parse the global variables in the embedded css of a skin manifest
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "text/plain";
|
||||
|
||||
string skinAlias = Request["skinAlias"];
|
||||
var skinAlias = Request["skinAlias"];
|
||||
|
||||
if (!string.IsNullOrEmpty(skinAlias) && Skin.CreateFromAlias(skinAlias) != null)
|
||||
{
|
||||
Skin ActiveSkin = Skin.CreateFromAlias(skinAlias);
|
||||
var activeSkin = Skin.CreateFromAlias(skinAlias);
|
||||
|
||||
if (ActiveSkin.Css != null)
|
||||
if (activeSkin.Css != null)
|
||||
{
|
||||
|
||||
SortedList<string, string> varValues = new SortedList<string, string>();
|
||||
var varValues = new SortedList<string, string>();
|
||||
|
||||
foreach (CssVariable var in ActiveSkin.Css.Variables)
|
||||
foreach (var var in activeSkin.Css.Variables)
|
||||
{
|
||||
varValues.Add(var.Name, string.IsNullOrEmpty(Request[var.Name]) ? var.DefaultValue : Request[var.Name]);
|
||||
|
||||
}
|
||||
|
||||
Response.Write(ParseEmbeddedCss(ActiveSkin.Css.Content,varValues));
|
||||
Response.Write(ParseEmbeddedCss(activeSkin.Css.Content,varValues));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
@@ -17,7 +18,12 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
public int MaxWidth = 700;
|
||||
public int MaxHeight = 480;
|
||||
public string scaleWidth = "500px";
|
||||
|
||||
|
||||
public ImageUploader()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -5,15 +5,22 @@ using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Reflection;
|
||||
using umbraco.IO;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class ModuleInjector : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private cms.businesslogic.macro.Macro m;
|
||||
private cms.businesslogic.macro.Macro _m;
|
||||
public string _macroAlias = "";
|
||||
|
||||
public ModuleInjector()
|
||||
{
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
renderProperties();
|
||||
@@ -25,38 +32,35 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
|
||||
|
||||
m = cms.businesslogic.macro.Macro.GetByAlias(Request["macroAlias"]);
|
||||
_m = cms.businesslogic.macro.Macro.GetByAlias(Request["macroAlias"]);
|
||||
|
||||
String macroAssembly = "";
|
||||
String macroType = "";
|
||||
|
||||
_macroAlias = m.Alias;
|
||||
_macroAlias = _m.Alias;
|
||||
|
||||
|
||||
//If no properties, we will exit now...
|
||||
if (m.Properties.Length == 0)
|
||||
if (_m.Properties.Length == 0)
|
||||
{
|
||||
Literal noProps = new Literal();
|
||||
var noProps = new Literal();
|
||||
noProps.Text = "<script type='text/javascript'>updateMacro()</script>";
|
||||
macroProperties.Controls.Add(noProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if we have properties, we'll render the controls for them...
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in m.Properties)
|
||||
foreach (cms.businesslogic.macro.MacroProperty mp in _m.Properties)
|
||||
{
|
||||
macroAssembly = mp.Type.Assembly;
|
||||
macroType = mp.Type.Type;
|
||||
var macroAssembly = mp.Type.Assembly;
|
||||
var macroType = mp.Type.Type;
|
||||
try
|
||||
{
|
||||
|
||||
Assembly assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
var assembly = Assembly.LoadFrom(IOHelper.MapPath(SystemDirectories.Bin + "/" + macroAssembly + ".dll"));
|
||||
|
||||
Type type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
interfaces.IMacroGuiRendering typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
var type = assembly.GetType(macroAssembly + "." + macroType);
|
||||
var typeInstance = Activator.CreateInstance(type) as interfaces.IMacroGuiRendering;
|
||||
if (typeInstance != null)
|
||||
{
|
||||
Control control = Activator.CreateInstance(type) as Control;
|
||||
var control = Activator.CreateInstance(type) as Control;
|
||||
control.ID = mp.Alias;
|
||||
|
||||
if (!IsPostBack)
|
||||
@@ -71,7 +75,7 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
|
||||
// register alias
|
||||
uicontrols.PropertyPanel pp = new uicontrols.PropertyPanel();
|
||||
var pp = new uicontrols.PropertyPanel();
|
||||
pp.Text = mp.Name;
|
||||
pp.Controls.Add(control);
|
||||
macroProperties.Controls.Add(pp);
|
||||
@@ -94,10 +98,6 @@ namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,42 +4,45 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.cms.businesslogic.packager;
|
||||
|
||||
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
|
||||
{
|
||||
public partial class ModuleInstaller : BasePages.UmbracoEnsuredPage
|
||||
{
|
||||
private cms.businesslogic.packager.repositories.Repository repo;
|
||||
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
private readonly cms.businesslogic.packager.repositories.Repository _repo;
|
||||
private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
|
||||
|
||||
public ModuleInstaller()
|
||||
{
|
||||
this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(this.repoGuid);
|
||||
_repo = cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
|
||||
//for skinning, you need to be a developer
|
||||
CurrentApp = DefaultApps.developer.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(Request["guid"])){
|
||||
if (!string.IsNullOrEmpty(Request["guid"]))
|
||||
{
|
||||
|
||||
Guid guid = new Guid(Request["guid"]);
|
||||
var guid = new Guid(Request["guid"]);
|
||||
|
||||
if (this.repo.HasConnection())
|
||||
if (_repo.HasConnection())
|
||||
{
|
||||
Installer installer = new Installer();
|
||||
string tempDir = installer.Import(this.repo.fetch(guid.ToString()));
|
||||
var installer = new Installer();
|
||||
var tempDir = installer.Import(_repo.fetch(guid.ToString()));
|
||||
installer.LoadConfig(tempDir);
|
||||
int packageId = installer.CreateManifest(tempDir, guid.ToString(), this.repoGuid);
|
||||
var packageId = installer.CreateManifest(tempDir, guid.ToString(), RepoGuid);
|
||||
installer.InstallFiles(packageId, tempDir);
|
||||
installer.InstallBusinessLogic(packageId, tempDir);
|
||||
installer.InstallCleanUp(packageId, tempDir);
|
||||
library.RefreshContent();
|
||||
|
||||
if (cms.businesslogic.skinning.Skinning.IsPackageInstalled(new Guid(Request["guid"])) ||
|
||||
cms.businesslogic.skinning.Skinning.IsPackageInstalled(Request["name"]))
|
||||
cms.businesslogic.skinning.Skinning.IsPackageInstalled(Request["name"]))
|
||||
{
|
||||
Response.Write(cms.businesslogic.skinning.Skinning.GetModuleAlias(Request["name"]));
|
||||
Response.Write(cms.businesslogic.skinning.Skinning.GetModuleAlias(Request["name"]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user