Merging, installer / skinning branch with 4.1 branch

[TFS Changeset #76863]
This commit is contained in:
PerPloug
2010-09-06 13:48:30 +00:00
parent c704dd35f2
commit 54dfd6d44a
109 changed files with 5026 additions and 780 deletions
Binary file not shown.
+3 -2
View File
@@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
SHOCKING.testrunconfig = SHOCKING.testrunconfig
umbraco weekly.build = umbraco weekly.build
umbraco.build = umbraco.build
umbraco3.vsmdi = umbraco3.vsmdi
umbraco2.vsmdi = umbraco2.vsmdi
UMBRACOELISE.testrunconfig = UMBRACOELISE.testrunconfig
UMBRACOHUMMER.testrunconfig = UMBRACOHUMMER.testrunconfig
EndProjectSection
@@ -64,6 +64,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DLLs", "DLLs", "{F06D18F6-C
foreign dlls\ClientDependency.Core.dll = foreign dlls\ClientDependency.Core.dll
foreign dlls\CookComputing.XmlRpcV2.dll = foreign dlls\CookComputing.XmlRpcV2.dll
foreign dlls\Examine.dll = foreign dlls\Examine.dll
foreign dlls\HtmlAgilityPack.dll = foreign dlls\HtmlAgilityPack.dll
foreign dlls\ICSharpCode.SharpZipLib.dll = foreign dlls\ICSharpCode.SharpZipLib.dll
foreign dlls\IronMath.dll = foreign dlls\IronMath.dll
IronPython License.Rtf = IronPython License.Rtf
@@ -153,7 +154,7 @@ Global
SccLocalPath13 = umbraco.Test
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = umbraco3.vsmdi
CategoryFile = umbraco2.vsmdi
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+9
View File
@@ -67,6 +67,15 @@ namespace umbraco.IO
}
}
public static string SkinningXml
{
get
{
return SystemDirectories.Data + "/skinning.config";
}
}
public static string NotFoundhandlersConfig
{
get
+23
View File
@@ -251,6 +251,29 @@ namespace umbraco
}
}
/// <summary>
/// Gets a value indicating whether umbraco will attempt to load any skins to override default template files
/// </summary>
/// <value><c>true</c> if umbraco will override templates with skins if present and configured <c>false</c>.</value>
public static bool EnableTemplateFolders
{
get
{
try
{
bool result;
if (bool.TryParse(GetKey("/settings/templates/enableTemplateFolders"), out result))
return result;
return false;
}
catch
{
return false;
}
}
}
/// <summary>
/// Gets a value indicating whether umbraco will clone XML cache on publish.
/// </summary>
@@ -52,6 +52,9 @@ namespace umbraco.BusinessLogic.Utils
string binFolder = Path.Combine(IO.IOHelper.MapPath("/", false), "bin");
string[] strTypes = TypeResolver.GetAssignablesFromType<T>(binFolder, "*.dll");
List<Type> types = new List<Type>();
foreach (string type in strTypes)
@@ -19,6 +19,7 @@ namespace umbraco.cms.businesslogic.packager.repositories
{
private System.Threading.SendOrPostCallback CategoriesOperationCompleted;
private System.Threading.SendOrPostCallback NitrosOperationCompleted;
private System.Threading.SendOrPostCallback NitrosByVersionOperationCompleted;
@@ -27,6 +28,8 @@ namespace umbraco.cms.businesslogic.packager.repositories
private System.Threading.SendOrPostCallback NitrosCategorizedByVersionOperationCompleted;
private System.Threading.SendOrPostCallback StarterKitsOperationCompleted;
private System.Threading.SendOrPostCallback authenticateOperationCompleted;
private System.Threading.SendOrPostCallback fetchPackageByVersionOperationCompleted;
@@ -39,10 +42,14 @@ namespace umbraco.cms.businesslogic.packager.repositories
private System.Threading.SendOrPostCallback PackageByGuidOperationCompleted;
private System.Threading.SendOrPostCallback SkinByGuidOperationCompleted;
private System.Threading.SendOrPostCallback SkinsOperationCompleted;
/// <remarks/>
public RepositoryWebservice(string url)
{
this.Url = url; // "http://packages.umbraco.org/umbraco/webservices/api/repository.asmx";
this.Url = url; //"http://packages.umbraco.org/umbraco/webservices/api/repository.asmx";
}
/// <remarks/>
@@ -60,6 +67,9 @@ namespace umbraco.cms.businesslogic.packager.repositories
/// <remarks/>
public event NitrosCategorizedByVersionCompletedEventHandler NitrosCategorizedByVersionCompleted;
/// <remarks/>
public event StarterKitsCompletedEventHandler StarterKitsCompleted;
/// <remarks/>
public event authenticateCompletedEventHandler authenticateCompleted;
@@ -78,6 +88,12 @@ namespace umbraco.cms.businesslogic.packager.repositories
/// <remarks/>
public event PackageByGuidCompletedEventHandler PackageByGuidCompleted;
/// <remarks/>
public event SkinByGuidCompletedEventHandler SkinByGuidCompleted;
/// <remarks/>
public event SkinsCompletedEventHandler SkinsCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/Categories", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Category[] Categories(string repositoryGuid)
@@ -317,6 +333,52 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/StarterKits", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Package[] StarterKits()
{
object[] results = this.Invoke("StarterKits", new object[0]);
return ((Package[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginStarterKits(System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("StarterKits", new object[0], callback, asyncState);
}
/// <remarks/>
public Package[] EndStarterKits(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((Package[])(results[0]));
}
/// <remarks/>
public void StarterKitsAsync()
{
this.StarterKitsAsync(null);
}
/// <remarks/>
public void StarterKitsAsync(object userState)
{
if ((this.StarterKitsOperationCompleted == null))
{
this.StarterKitsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStarterKitsOperationCompleted);
}
this.InvokeAsync("StarterKits", new object[0], this.StarterKitsOperationCompleted, userState);
}
private void OnStarterKitsOperationCompleted(object arg)
{
if ((this.StarterKitsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.StarterKitsCompleted(this, new StarterKitsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/authenticate", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string authenticate(string email, string md5Password)
@@ -650,6 +712,104 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/SkinByGuid", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Skin SkinByGuid(string skinGuid)
{
object[] results = this.Invoke("SkinByGuid", new object[] {
skinGuid});
return ((Skin)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSkinByGuid(string skinGuid, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SkinByGuid", new object[] {
skinGuid}, callback, asyncState);
}
/// <remarks/>
public Skin EndSkinByGuid(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((Skin)(results[0]));
}
/// <remarks/>
public void SkinByGuidAsync(string skinGuid)
{
this.SkinByGuidAsync(skinGuid, null);
}
/// <remarks/>
public void SkinByGuidAsync(string skinGuid, object userState)
{
if ((this.SkinByGuidOperationCompleted == null))
{
this.SkinByGuidOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSkinByGuidOperationCompleted);
}
this.InvokeAsync("SkinByGuid", new object[] {
skinGuid}, this.SkinByGuidOperationCompleted, userState);
}
private void OnSkinByGuidOperationCompleted(object arg)
{
if ((this.SkinByGuidCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SkinByGuidCompleted(this, new SkinByGuidCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://packages.umbraco.org/webservices/Skins", RequestNamespace = "http://packages.umbraco.org/webservices/", ResponseNamespace = "http://packages.umbraco.org/webservices/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Skin[] Skins(string starterKitGuid)
{
object[] results = this.Invoke("Skins", new object[] {
starterKitGuid});
return ((Skin[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSkins(string starterKitGuid, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("Skins", new object[] {
starterKitGuid}, callback, asyncState);
}
/// <remarks/>
public Skin[] EndSkins(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((Skin[])(results[0]));
}
/// <remarks/>
public void SkinsAsync(string starterKitGuid)
{
this.SkinsAsync(starterKitGuid, null);
}
/// <remarks/>
public void SkinsAsync(string starterKitGuid, object userState)
{
if ((this.SkinsOperationCompleted == null))
{
this.SkinsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSkinsOperationCompleted);
}
this.InvokeAsync("Skins", new object[] {
starterKitGuid}, this.SkinsOperationCompleted, userState);
}
private void OnSkinsOperationCompleted(object arg)
{
if ((this.SkinsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SkinsCompleted(this, new SkinsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState)
{
@@ -962,6 +1122,151 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://packages.umbraco.org/webservices/")]
public partial class Skin
{
private System.Guid repoGuidField;
private string textField;
private string thumbnailField;
private string previewField;
private string descriptionField;
private string authorField;
private string authorUrlField;
private string licenseField;
private string licenseUrlField;
/// <remarks/>
public System.Guid RepoGuid
{
get
{
return this.repoGuidField;
}
set
{
this.repoGuidField = value;
}
}
/// <remarks/>
public string Text
{
get
{
return this.textField;
}
set
{
this.textField = value;
}
}
/// <remarks/>
public string Thumbnail
{
get
{
return this.thumbnailField;
}
set
{
this.thumbnailField = value;
}
}
/// <remarks/>
public string Preview
{
get
{
return this.previewField;
}
set
{
this.previewField = value;
}
}
/// <remarks/>
public string Description
{
get
{
return this.descriptionField;
}
set
{
this.descriptionField = value;
}
}
/// <remarks/>
public string Author
{
get
{
return this.authorField;
}
set
{
this.authorField = value;
}
}
/// <remarks/>
public string AuthorUrl
{
get
{
return this.authorUrlField;
}
set
{
this.authorUrlField = value;
}
}
/// <remarks/>
public string License
{
get
{
return this.licenseField;
}
set
{
this.licenseField = value;
}
}
/// <remarks/>
public string LicenseUrl
{
get
{
return this.licenseUrlField;
}
set
{
this.licenseUrlField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.SerializableAttribute()]
@@ -978,6 +1283,9 @@ namespace umbraco.cms.businesslogic.packager.repositories
/// <remarks/>
Version41,
/// <remarks/>
Version41Legacy,
/// <remarks/>
Version50,
}
@@ -1152,6 +1460,36 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void StarterKitsCompletedEventHandler(object sender, StarterKitsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class StarterKitsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal StarterKitsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public Package[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((Package[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void authenticateCompletedEventHandler(object sender, authenticateCompletedEventArgs e);
@@ -1331,4 +1669,65 @@ namespace umbraco.cms.businesslogic.packager.repositories
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void SkinByGuidCompletedEventHandler(object sender, SkinByGuidCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SkinByGuidCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal SkinByGuidCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public Skin Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((Skin)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
public delegate void SkinsCompletedEventHandler(object sender, SkinsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SkinsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal SkinsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public Skin[] Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((Skin[])(this.results[0]));
}
}
}
}
@@ -47,4 +47,6 @@ namespace umbraco.cms.businesslogic {
public umbraco.cms.businesslogic.web.DocumentType DocumentType { get; internal set; }
public int ParentId { get; internal set; }
}
}
@@ -0,0 +1,12 @@
using System;
namespace umbraco.cms.businesslogic.installer
{
interface IInstallerStep
{
string Alias { get;}
bool Completed();
string Name { get;}
string NextStep();
string UserControl {get;}
}
}
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
namespace umbraco.cms.businesslogic.installer
{
public class InstallerStepCollection : List<KeyValuePair<string,InstallerStep>>
{
public void Add(InstallerStep step){
step.Index = this.Count;
KeyValuePair<string, InstallerStep> kv = new KeyValuePair<string, InstallerStep>(step.Alias, step);
this.Add(kv);
}
public InstallerStep Get(int index)
{
return this[index].Value;
}
public InstallerStep Get(string key)
{
return this.First(item => item.Key == key).Value;
}
public bool StepExists(string key)
{
return this.Exists(item => item.Key == key);
}
public InstallerStep GotoNextStep(string key)
{
InstallerStep s = this.Get(key);
for (int i = s.Index+1; i < this.Count; i++)
{
InstallerStep next = this[i].Value;
if (!next.Completed())
return next;
}
return null;
}
public InstallerStep FirstAvailableStep()
{
return this.First(item => item.Value.Completed() == false ).Value;
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.cms.businesslogic.installer
{
public abstract class InstallerStep : umbraco.cms.businesslogic.installer.IInstallerStep
{
public abstract string Alias { get; }
public abstract string Name { get; }
public abstract string UserControl { get;}
public virtual int Index { get; set; }
public virtual bool MoveToNextStepAutomaticly { get; set; }
public virtual bool HideNextButtonUntillCompleted { get; set; }
public abstract bool Completed();
public virtual string NextStep(){
return "meh";
}
}
}
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web;
using System.Reflection;
namespace umbraco.cms.businesslogic.skinning
{
public class Dependency
{
public Dependency()
{
Tasks = new List<Task>();
Properties = new Dictionary<string, string>();
}
public static Dependency CreateFromXmlNode(XmlNode node)
{
Dependency d = new Dependency();
if (node.SelectSingleNode("Properties") != null)
{
foreach (XmlNode prop in node.SelectSingleNode("Properties").ChildNodes)
{
if(prop.Name != "Output" && prop.Name != "#comment")
d.Properties.Add(prop.Name, prop.InnerText);
}
}
if(node.Attributes["label"] != null)
d.Label = node.Attributes["label"].Value;
if (node.Attributes["type"] != null)
{
if (node.Attributes["assembly"] != null)
{
//custom dependency type
string assemblyFile =
HttpContext.Current.Server.MapPath(
String.Format("{0}/../bin/{1}.dll",
GlobalSettings.Path,
node.Attributes["assembly"].Value));
Assembly customAssembly = Assembly.LoadFrom(assemblyFile);
d.DependencyType = (DependencyType)Activator.CreateInstance(
customAssembly.GetType(node.Attributes["type"].Value),d);
foreach (var prop in d.Properties)
{
d.DependencyType.GetType().InvokeMember(prop.Key, System.Reflection.BindingFlags.SetProperty, null, d.DependencyType, new object[] { prop.Value });
}
//d.DependencyType.Properties = d.Properties;
}
else
{
//internal dependency type
string assemblyFile =
HttpContext.Current.Server.MapPath(
String.Format("{0}/../bin/{1}.dll",
GlobalSettings.Path,
"cms"));
Assembly defaultAssembly = Assembly.LoadFrom(assemblyFile);
d.DependencyType = (DependencyType)Activator.CreateInstance(
defaultAssembly.GetType(
string.Format(
"umbraco.cms.businesslogic.skinning.dependencies.{0}",
node.Attributes["type"].Value)));
foreach (var prop in d.Properties)
{
d.DependencyType.GetType().InvokeMember(prop.Key, System.Reflection.BindingFlags.SetProperty, null, d.DependencyType, new object[] { prop.Value });
}
//d.DependencyType.Properties = d.Properties;
}
XmlNode outputNode = node.SelectSingleNode("Properties/Output");
if (outputNode != null)
{
d.DependencyType.Values.Add(outputNode.InnerText);
}
}
foreach (XmlNode taskNode in node.SelectNodes("Tasks/Task"))
{
try
{
d.Tasks.Add(Task.CreateFromXmlNode(taskNode));
}
catch (Exception ex)
{
umbraco.BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, 0,
"Failed to load task type " + (taskNode.Attributes["type"] != null ? taskNode.Attributes["type"].Value : string.Empty) + ex.Message);
}
}
return d;
}
public DependencyType DependencyType { get; set; }
public string Label { get; set; }
public Dictionary<string,string> Properties {get; set;}
public List<Task> Tasks { get; set; }
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using umbraco.interfaces.skinning;
namespace umbraco.cms.businesslogic.skinning
{
public abstract class DependencyType : ProviderBase, IDependencyType
{
public virtual WebControl Editor { get; set; }
public virtual List<Object> Values { get; set; }
public virtual string ClientSideGetValueScript()
{
return string.Format(
"jQuery('#{0}').val()"
,Editor.ClientID);
}
public virtual string ClientSidePreviewEventType()
{
return "change";
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.cms.businesslogic.skinning
{
public abstract class ProviderBase
{
public string Name { get; set; }
public string Description { get; set; }
}
}
+284
View File
@@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.XPath;
namespace umbraco.cms.businesslogic.skinning
{
public class Skin
{
public Skin()
{
AllowedDocumentTypeAliases = new List<string>();
Dependencies = new List<Dependency>();
}
public static Skin CreateFromFile(string filename)
{
XmlDocument manifest = new XmlDocument();
FileInfo f = new FileInfo(filename);
if (f.Exists)
{
manifest.Load(filename);
Skin s = Skin.CreateFromXmlNode(manifest.SelectSingleNode("//Skin"));
s.FullFileName = filename;
s.Alias = f.Directory.Name;
return s;
}
else
return null;
}
public static Skin CreateFromXmlNode(XmlNode node)
{
Skin s = new Skin();
if(node.SelectSingleNode("/Skin/Name") != null)
s.Name = node.SelectSingleNode("/Skin/Name").InnerText;
if(node.SelectSingleNode("/Skin/Author") != null)
s.Author = node.SelectSingleNode("/Skin/Author").InnerText;
if(node.SelectSingleNode("/Skin/Version") != null)
s.Version = node.SelectSingleNode("/Skin/Version").InnerText;
if(node.SelectSingleNode("/Skin/Description") != null)
s.Description = node.SelectSingleNode("/Skin/Description").InnerText;
if (node.SelectSingleNode("/Skin/AllowedDocumentTypes") != null)
{
s.AllowedDocumentTypeAliases.AddRange(
node.SelectSingleNode("/Skin/AllowedDocumentTypes").InnerText.Split(','));
}
if (node.SelectSingleNode("/Skin/AllowedRootTemplate") != null)
s.AllowedRootTemplate = node.SelectSingleNode("/Skin/AllowedRootTemplate").InnerText;
foreach (XmlNode depNode in node.SelectNodes("/Skin//Dependency"))
{
try
{
s.Dependencies.Add(Dependency.CreateFromXmlNode(depNode));
}
catch (Exception ex)
{
umbraco.BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, 0,
"Failed to load dependency type " + (depNode.Attributes["type"] != null ? depNode.Attributes["type"].Value : string.Empty) + ex.Message);
}
}
return s;
}
public static Skin CreateFromAlias(string alias)
{
string manifest = Path.Combine(IO.IOHelper.MapPath( IO.SystemDirectories.Masterpages + "/" + alias), "skin.xml");
return CreateFromFile(manifest);
}
public bool OverridesTemplates()
{
return (System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master").Count() > 0);
}
public bool HasBackupFiles()
{
return System.IO.Directory.Exists( IO.IOHelper.MapPath(SkinBackupFolder) );
}
public void SaveOutput()
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
int i = 1;
foreach (Dependency d in Dependencies)
{
if (d.DependencyType.Values.Count > 0)
{
XmlNode pNode = manifest.SelectSingleNode(
string.Format("/Skin/Dependencies/Dependency[{0}]/Properties", i.ToString()));
XmlNode outputNode = pNode.SelectSingleNode("./Output");
if (outputNode == null)
{
outputNode = manifest.CreateElement("Output");
outputNode.InnerText = d.DependencyType.Values[0].ToString();
pNode.AppendChild(outputNode);
}
else
{
outputNode.InnerText = d.DependencyType.Values[0].ToString();
}
}
i++;
}
manifest.Save(FullFileName);
}
public string FullFileName { get; set; }
public string Name { get; set; }
public string Author { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public string Alias { get; set; }
public List<string> AllowedDocumentTypeAliases { get; set; }
public string AllowedRootTemplate { get; set; }
public List<Dependency> Dependencies { get; set; }
public void RollbackDependencies()
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
XmlNode hNode = manifest.SelectSingleNode("/Skin/History");
if (!(hNode == null || hNode.SelectNodes("Task").Count == 0))
{
XPathNavigator navigator = manifest.CreateNavigator();
XPathExpression expression = navigator.Compile("/Skin/History/Task");
expression.AddSort("@executed", XmlSortOrder.Descending, XmlCaseOrder.UpperFirst,
string.Empty, XmlDataType.Text);
XPathNodeIterator iterator = navigator.Select(expression);
foreach (XPathNavigator item in iterator)
{
Task t = Task.CreateFromXmlNode(((System.Xml.IHasXmlNode)item).GetNode());
t.TaskType.RollBack(((System.Xml.IHasXmlNode)item).GetNode().SelectSingleNode("OriginalValue").InnerText);
}
hNode.RemoveAll();
manifest.Save(FullFileName);
}
}
public void DeployTemplateFiles()
{
DeployTemplateFiles(IO.SystemDirectories.Masterpages);
}
public void DeployTemplateFiles(string folder)
{
string[] masterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master");
if (masterFiles.Count() > 0)
{
if (!System.IO.Directory.Exists(IO.IOHelper.MapPath(SkinBackupFolder)))
System.IO.Directory.CreateDirectory(IO.IOHelper.MapPath(SkinBackupFolder));
foreach (string master in masterFiles)
{
FileInfo fi = new FileInfo(master);
string original = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
string backup = Path.Combine(IO.IOHelper.MapPath(SkinBackupFolder), fi.Name);
if (System.IO.File.Exists(original))
System.IO.File.Copy(original, backup, true);
System.IO.File.Copy(master, original, true);
}
}
}
public void RollbackTemplateFiles(){
RollbackTemplateFiles(IO.SystemDirectories.Masterpages);
}
public void RollbackTemplateFiles(string folder)
{
string[] masterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinFolder), "*.master");
//1. take the skin files back into skin folder to store the changes made
if (masterFiles.Count() > 0)
{
foreach (string master in masterFiles)
{
FileInfo fi = new FileInfo(master);
string inUse = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
if (System.IO.File.Exists(inUse))
System.IO.File.Copy(inUse, master, true);
}
}
//2. copy the /backup files back to the masterpages to restore the templates to the way they were before the skin was applied
string[] backedUpmasterFiles = System.IO.Directory.GetFiles(IO.IOHelper.MapPath(SkinBackupFolder), "*.master");
foreach (string backup in backedUpmasterFiles)
{
FileInfo fi = new FileInfo(backup);
string inUse = Path.Combine(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages), fi.Name);
System.IO.File.Copy(backup, inUse, true);
System.IO.File.Delete(backup);
}
//3. put on some clothes
}
public void AddTaskHistoryNode(XmlNode taskNode)
{
XmlDocument manifest = new XmlDocument();
manifest.Load(FullFileName);
XmlNode hNode = manifest.SelectSingleNode("/Skin/History");
if (hNode == null)
{
hNode = manifest.CreateElement("History");
manifest.SelectSingleNode("/Skin").AppendChild(hNode);
}
hNode.AppendChild(manifest.ImportNode(taskNode, true));
manifest.Save(FullFileName);
}
public string SkinFolder
{
get
{
return IO.SystemDirectories.Masterpages + "/" + Alias;
}
}
public string SkinBackupFolder
{
get
{
return SkinFolder + "/backup";
}
}
}
}
@@ -0,0 +1,426 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using umbraco.IO;
using System.IO;
using System.Collections;
using System.Web;
using System.Web.Caching;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.template;
namespace umbraco.cms.businesslogic.skinning
{
public class Skinning
{
static private Hashtable _checkedPages = new Hashtable();
static private XmlDocument _skinningXmlContent;
static private string _skinningXmlSource = IOHelper.MapPath(SystemFiles.SkinningXml, false);
private const string CACHEKEY = "SkinnableTemplates";
private static void clearCheckPages()
{
_checkedPages.Clear();
}
public static void RollbackSkin(int template)
{
string currentSkin = GetCurrentSkinAlias(template);
Skin skin = Skin.CreateFromAlias(currentSkin);
if (skin.OverridesTemplates())
skin.RollbackTemplateFiles();
else
skin.RollbackDependencies();
RemoveSkin(template);
save();
}
public static void ActivateAsCurrentSkin(Skin skin)
{
Template t = Template.GetByAlias(skin.AllowedRootTemplate);
ActivateAsCurrentSkin(t.Id, skin.Alias);
}
public static void ActivateAsCurrentSkin(int template, string skinAlias)
{
//lookup template in skinning.config
string currentSkin = GetCurrentSkinAlias(template);
//if different from current, and the template is skinned
if(currentSkin != skinAlias){
//this will restore the files to the standard runway, as they looked before the skin was applied
if (currentSkin != string.Empty)
{
RollbackSkin(template);
}
Skin newSkin = Skin.CreateFromAlias(skinAlias);
if (newSkin.OverridesTemplates())
newSkin.DeployTemplateFiles();
SetSkin(template, skinAlias);
save();
}
}
private static void save()
{
System.IO.FileStream f = System.IO.File.Open(_skinningXmlSource, FileMode.Create);
SkinXml.Save(f);
f.Close();
}
public static string GetCurrentSkinAlias(int templateID)
{
XmlElement x = (XmlElement)getTemplate(templateID);
if(x != null && x.HasAttribute("alias") && !string.IsNullOrEmpty(x.Attributes["alias"].Value))
return x.Attributes["alias"].Value;
return string.Empty;
}
private static void SetSkin(int templateID, string skinAlias)
{
XmlElement x = (XmlElement)getTemplate(templateID);
if (x == null)
{
x = (XmlElement)_skinningXmlContent.CreateNode(XmlNodeType.Element, "skin", "");
SkinXml.DocumentElement.AppendChild(x);
}
x.SetAttribute("template", templateID.ToString());
x.SetAttribute("alias", skinAlias);
save();
clearCheckPages();
}
private static void RemoveSkin(int templateID)
{
XmlElement x = (XmlElement)getTemplate(templateID);
if (x != null)
{
x.ParentNode.RemoveChild(x);
save();
clearCheckPages();
}
}
private static XmlNode getTemplate(int templateId)
{
XmlNode x = SkinXml.SelectSingleNode("/skinning/skin [@template=" + templateId.ToString() + "]");
return x;
}
public static List<Skin> GetAllSkins()
{
List<Skin> skins = new List<Skin>();
foreach (string dir in Directory.GetDirectories(IO.IOHelper.MapPath(SystemDirectories.Masterpages)))
{
if (File.Exists(Path.Combine(dir, "skin.xml")))
{
Skin s = Skin.CreateFromFile((Path.Combine(dir, "skin.xml")));
s.Alias = new DirectoryInfo(dir).Name;
skins.Add(s);
}
}
return skins;
}
private static XmlDocument SkinXml
{
get
{
if (_skinningXmlContent == null)
{
if (_skinningXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_skinningXmlSource = IOHelper.MapPath(SystemFiles.SkinningXml, false);
}
_skinningXmlContent = new XmlDocument();
if (!System.IO.File.Exists(_skinningXmlSource))
{
System.IO.FileStream f = System.IO.File.Open(_skinningXmlSource, FileMode.Create);
System.IO.StreamWriter sw = new StreamWriter(f);
sw.WriteLine("<skinning/>");
sw.Close();
f.Close();
}
_skinningXmlContent.Load(_skinningXmlSource);
}
return _skinningXmlContent;
}
}
public static Dictionary<string, Dictionary<string, string>> SkinnableTemplates()
{
Dictionary<string, Dictionary<string, string>> dts = (Dictionary<string, Dictionary<string, string>>)HttpRuntime.Cache[CACHEKEY];
if (dts == null)
dts = registerSkinnableTemplates();
return dts;
}
//this is an pretty expensive operation, so we will cache the result...
private static Dictionary<string, Dictionary<string, string>> registerSkinnableTemplates()
{
HttpRuntime.Cache.Remove(CACHEKEY);
Dictionary<string, Dictionary<string, string>> _allowedTemplates = new Dictionary<string, Dictionary<string, string>>();
foreach (string dir in Directory.GetDirectories(IO.IOHelper.MapPath(SystemDirectories.Masterpages)))
{
if (File.Exists(Path.Combine(dir, "skin.xml")))
{
XmlDocument manifest = new XmlDocument();
manifest.Load(Path.Combine(dir, "skin.xml"));
string name = umbraco.xmlHelper.GetNodeValue(manifest.SelectSingleNode("/Skin/Name"));
string[] types = umbraco.xmlHelper.GetNodeValue(manifest.SelectSingleNode("/Skin/AllowedRootTemplate")).Split(',');
string alias = new DirectoryInfo(dir).Name;
//foreach allowed type, test if it is already there...
foreach (string t in types)
{
if (!_allowedTemplates.ContainsKey(t))
_allowedTemplates.Add(t, new Dictionary<string, string>());
if (!_allowedTemplates[t].ContainsKey(alias))
_allowedTemplates[t].Add(alias, name);
}
}
}
HttpRuntime.Cache.Insert(CACHEKEY, _allowedTemplates, new CacheDependency(IO.IOHelper.MapPath(SystemDirectories.Masterpages)));
return _allowedTemplates;
}
//Helpers for detecting what skins work with what document types
public static bool IsSkinnable(string templateAlias)
{
return SkinnableTemplates().ContainsKey(templateAlias);
}
public static bool IsSkinnable(Template template)
{
return IsSkinnable(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(Template template)
{
return AllowedSkins(template.Alias);
}
public static Dictionary<string, string> AllowedSkins(string templateAlias)
{
if (IsSkinnable(templateAlias))
{
return SkinnableTemplates()[templateAlias];
}
else
return new Dictionary<string, string>();
}
public static Guid? StarterKitGuid(int template)
{
XmlDocument installed = new XmlDocument();
installed.Load(IO.IOHelper.MapPath(SystemDirectories.Packages) + "/installed/installedPackages.config");
XmlNode starterKit = installed.SelectSingleNode(
string.Format("//templates [contains (., '{0}') ]//ancestor::package",template));
if (starterKit != null)
return new Guid(starterKit.Attributes["repositoryGuid"].Value);
else
return null;
}
public static bool HasAvailableSkins(int template)
{
bool r = false;
Guid? g = StarterKitGuid(template);
if (g != null)
{
try
{
r = cms.businesslogic.packager.repositories.Repository.
getByGuid("65194810-1f85-11dd-bd0b-0800200c9a66").Webservice.Skins(g.ToString()).Length > 0;
}
catch { }
}
return r;
}
#region old code
/*
public static string FindAppliedSkin(int DocumentId, string Path)
{
string skinAlias = string.Empty;
if (!_checkedPages.ContainsKey(DocumentId))
{
foreach (string id in Path.Split(','))
{
XmlNode n = getPage(int.Parse(id));
if (n != null && n.Attributes["skin"] != null && !string.IsNullOrEmpty(n.Attributes["skin"].Value))
{
skinAlias = n.Attributes["skin"].Value;
break;
}
}
// Add thread safe updating to the hashtable
System.Web.HttpContext.Current.Application.Lock();
if (!_checkedPages.ContainsKey(DocumentId))
_checkedPages.Add(DocumentId, skinAlias);
System.Web.HttpContext.Current.Application.UnLock();
}
else
skinAlias = (string)_checkedPages[DocumentId];
return skinAlias;
}
*
*
public static Skin AppliedSkin(int DocumentId, string Path)
{
string active = FindAppliedSkin(DocumentId, Path);
if (!string.IsNullOrEmpty(active))
{
return Skin.CreateFromFile(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + active + "/skin.xml");
}
return null;
}
public static Dictionary<string, Dictionary<string, string>> SkinnableDocumentTypes()
{
Dictionary<string, Dictionary<string, string>> dts = (Dictionary<string, Dictionary<string, string>>)HttpRuntime.Cache[CACHEKEY];
if (dts == null)
dts = registerAllowedDocumentTypes();
return dts;
}
//this is an pretty expensive operation, so we will cache the result...
private static Dictionary<string, Dictionary<string, string>> registerAllowedDocumentTypes()
{
HttpRuntime.Cache.Remove(CACHEKEY);
Dictionary<string, Dictionary<string, string>> _allowedDocumentTypes = new Dictionary<string, Dictionary<string, string>>();
foreach (string dir in Directory.GetDirectories(IO.IOHelper.MapPath(SystemDirectories.Masterpages)))
{
if( File.Exists( Path.Combine( dir , "skin.xml" ) )) {
XmlDocument manifest = new XmlDocument();
manifest.Load(Path.Combine(dir, "skin.xml"));
string name = umbraco.xmlHelper.GetNodeValue( manifest.SelectSingleNode("/Skin/Name"));
string[] types = umbraco.xmlHelper.GetNodeValue( manifest.SelectSingleNode("/Skin/AllowedDocumentTypes")).Split(',');
string alias = new DirectoryInfo(dir).Name;
//foreach allowed type, test if it is already there...
foreach(string t in types){
if (!_allowedDocumentTypes.ContainsKey(t))
_allowedDocumentTypes.Add(t, new Dictionary<string,string>());
if (!_allowedDocumentTypes[t].ContainsKey(alias))
_allowedDocumentTypes[t].Add(alias, name);
}
}
}
HttpRuntime.Cache.Insert(CACHEKEY, _allowedDocumentTypes, new CacheDependency( IO.IOHelper.MapPath(SystemDirectories.Masterpages) ));
return _allowedDocumentTypes;
}
public static void SetSkin(int DocumentId, string skinAlias)
{
XmlElement x = (XmlElement)getPage(DocumentId);
if (x == null)
{
x = (XmlElement)_skinningXmlContent.CreateNode(XmlNodeType.Element, "page", "");
SkinXml.DocumentElement.AppendChild(x);
}
x.SetAttribute("id", DocumentId.ToString());
x.SetAttribute("skin", skinAlias);
save();
clearCheckPages();
}
public static void RemoveSkin(int DocumentId)
{
XmlElement x = (XmlElement)getPage(DocumentId);
if (x != null)
{
x.ParentNode.RemoveChild(x);
save();
clearCheckPages();
}
}
private static XmlNode getPage(int documentId)
{
XmlNode x = SkinXml.SelectSingleNode("/skinning/page [@id=" + documentId.ToString() + "]");
return x;
}
//Helpers for detecting what skins work with what document types
public static bool IsSkinnable(string documentTypeAlias)
{
return SkinnableDocumentTypes().ContainsKey(documentTypeAlias);
}
public static bool IsSkinnable(DocumentType documentType)
{
return IsSkinnable(documentType.Alias);
}
public static Dictionary<string, string> AllowedSkins(DocumentType documentType)
{
return AllowedSkins(documentType.Alias);
}
public static Dictionary<string, string> AllowedSkins(string documentTypeAlias)
{
if (IsSkinnable(documentTypeAlias))
{
return SkinnableDocumentTypes()[documentTypeAlias];
}
else
return new Dictionary<string, string>();
}
*
*
*/
#endregion
}
}
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web;
using System.Reflection;
namespace umbraco.cms.businesslogic.skinning
{
public class Task
{
public Task()
{
Properties = new Dictionary<string, string>();
}
public static Task CreateFromXmlNode(XmlNode node)
{
Task t = new Task();
if (node.Attributes["type"] != null)
{
if (node.Attributes["assembly"] != null)
{
//custom task type
string assemblyFile =
HttpContext.Current.Server.MapPath(
String.Format("{0}/../bin/{1}.dll",
GlobalSettings.Path,
node.Attributes["assembly"].Value));
Assembly customAssembly = Assembly.LoadFrom(assemblyFile);
t.TaskType = (TaskType)Activator.CreateInstance(
customAssembly.GetType(node.Attributes["type"].Value));
}
else
{
//internal dependency type
string assemblyFile =
HttpContext.Current.Server.MapPath(
String.Format("{0}/../bin/{1}.dll",
GlobalSettings.Path,
"cms"));
Assembly defaultAssembly = Assembly.LoadFrom(assemblyFile);
t.TaskType = (TaskType)Activator.CreateInstance(
defaultAssembly.GetType(
string.Format(
"umbraco.cms.businesslogic.skinning.tasks.{0}",
node.Attributes["type"].Value)));
}
}
foreach (XmlNode prop in node.ChildNodes)
{
if (prop.Name != "OriginalValue" && prop.Name != "NewValue")
{
if (prop.Name == "Value")
t.Value = prop.InnerText;
else
t.Properties.Add(prop.Name, prop.InnerText);
t.TaskType.GetType().InvokeMember(
prop.Name,
System.Reflection.BindingFlags.SetProperty,
null,
t.TaskType,
new object[] { prop.InnerText });
}
}
return t;
}
public TaskType TaskType { get; set; }
public Dictionary<string, string> Properties { get; set; }
public string Value { get; set; }
}
}
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using System.Xml;
using System.Reflection;
namespace umbraco.cms.businesslogic.skinning
{
public abstract class TaskType : ProviderBase, ITaskType
{
public abstract TaskExecutionDetails Execute(string Value);
public virtual TaskExecutionStatus RollBack(string OriginalValue)
{
return Execute(OriginalValue).TaskExecutionStatus;
}
public abstract string PreviewClientScript(string ControlClientId, string ClientSidePreviewEventType, string ClientSideGetValueScript);
public String Value { get; set; }
public virtual XmlNode ToXml(string OriginalValue, string NewValue)
{
XmlDocument d = new XmlDocument();
XmlNode n = d.CreateElement("Task");
XmlAttribute type = d.CreateAttribute("type");
type.Value = this.GetType().Name;
n.Attributes.Append(type);
if (!this.GetType().FullName.Contains("umbraco.cms.businesslogic.skinning"))
{
XmlAttribute assembly = d.CreateAttribute("assembly");
assembly.Value = this.GetType().Assembly.FullName;
n.Attributes.Append(assembly);
}
XmlAttribute executed = d.CreateAttribute("executed");
executed.Value = DateTime.Now.ToString("s");
n.Attributes.Append(executed);
foreach(PropertyInfo p in this.GetType().GetProperties())
{
if(p.Name != "Name" && p.Name != "Description")
{
XmlNode pNode = d.CreateElement(p.Name);
pNode.InnerText = p.GetValue(this,null) != null ? p.GetValue(this,null).ToString() : string.Empty;
n.AppendChild(pNode);
}
}
XmlNode origValNode = d.CreateElement("OriginalValue");
origValNode.InnerText = OriginalValue;
n.AppendChild(origValNode);
XmlNode newValNode = d.CreateElement("NewValue");
newValNode.InnerText = NewValue;
n.AppendChild(newValNode);
return n;
}
}
}
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using System.Web.UI;
namespace umbraco.cms.businesslogic.skinning.controls
{
//[ClientDependency(ClientDependencyType.Javascript, "colorpicker/js/colorpicker.js", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Css, "colorpicker/css/colorpicker.css", "UmbracoClient")]
public class ColorPicker: TextBox
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
ScriptManager.RegisterClientScriptInclude(this, this.GetType(), "colorpicker.js",
this.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco_client + "/colorpicker/js/colorpicker.js"));
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "cp" + this.ClientID,
string.Format(@"$(document).ready(function() {{
$('#{0}').ColorPicker({{
onSubmit: function(hsb, hex, rgb, el) {{
$(el).val('#' + hex);
$(el).ColorPickerHide();
jQuery(el).trigger('change');
}},
onBeforeShow: function () {{
$(this).ColorPickerSetColor(this.value);
}}
}})
.bind('keyup', function(){{
$(this).ColorPickerSetColor(this.value);
}});}});", this.ClientID), true);
}
}
}
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.cms.businesslogic.skinning;
using umbraco.cms.businesslogic.skinning.controls;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Color : DependencyType
{
public ColorPicker cp;
public List<Object> _value;
public Color()
{
this.Name = "Color";
this.Description = "Will render a color picker";
cp = new ColorPicker();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
cp.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
cp.CssClass = "color";
if (_value.Count > 0)
cp.Text = _value[0].ToString();
return cp;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (cp.Text != "")
{
_value.Clear();
_value.Add(cp.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Image: DependencyType
{
public string Height { get; set; }
public string Width { get; set; }
//currently just returning a textbox, need to replace this with a custom image control
public System.Web.UI.WebControls.TextBox tb;
public List<Object> _value;
public Image()
{
this.Name = "Text";
this.Description = "Will render a text input";
tb = new TextBox();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
tb.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
tb.CssClass = "text";
if (_value.Count > 0)
tb.Text = _value[0].ToString();
return tb;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (tb.Text != "")
{
_value.Clear();
_value.Add(tb.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace umbraco.cms.businesslogic.skinning.dependencies
{
public class Text : DependencyType
{
public System.Web.UI.WebControls.TextBox tb;
public List<Object> _value;
public Text()
{
this.Name = "Text";
this.Description = "Will render a text input";
tb = new TextBox();
_value = new List<object>();
}
public override WebControl Editor
{
get
{
tb.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
tb.CssClass = "text";
if (_value.Count > 0)
tb.Text = _value[0].ToString();
return tb;
}
set
{
base.Editor = value;
}
}
public override List<Object> Values
{
get
{
if (tb.Text != "")
{
_value.Clear();
_value.Add(tb.Text);
}
return _value;
}
set
{
_value = value;
}
}
}
}
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using System.IO;
using umbraco.IO;
using System.Web;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class ModifyCss : TaskType
{
public string TargetFile { get; set; }
public string TargetRule { get; set; }
public string TargetParameter { get; set; }
public ModifyCss()
{
this.Name = "Modify Css";
this.Description = "Will modify the stylesheet";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
//currently just appending it to the end of the css file
StreamWriter sw = File.AppendText(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
sw.WriteLine(string.Format("{0}{{ {1}:{2};}}", TargetRule, TargetParameter, Value));
sw.Close();
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
d.OriginalValue = "";
d.NewValue = Value;
return d;
}
public override string PreviewClientScript(string ControlClientId,string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
return string.Format(
@"jQuery('#{0}').bind('{5}', function() {{
var val = '{3}';
jQuery('{1}').css('{2}', val.replace('${{Output}}',{4}));
}});",
ControlClientId,
TargetRule,
TargetParameter,
Value,
ClientSideGetValueScript,
ClientSidePreviewEventType);
}
}
}
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.interfaces.skinning;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using umbraco.IO;
using umbraco.cms.businesslogic.packager.standardPackageActions;
using System.Xml;
using HtmlAgilityPack;
namespace umbraco.cms.businesslogic.skinning.tasks
{
public class ModifyTemplate : TaskType
{
public string TargetFile { get; set; }
public string TargetID { get; set; }
public string TargetAttribute { get; set; }
public ModifyTemplate()
{
this.Name = " Modify template";
this.Description = "Will modify a template";
}
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
//open template
HtmlDocument doc = new HtmlDocument();
doc.Load(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" +TargetFile);
foreach(HtmlNode target in doc.DocumentNode.SelectNodes(string.Format("//*[@id = '{0}']",TargetID)))
{
if (string.IsNullOrEmpty(TargetAttribute))
{
d.OriginalValue = target.InnerHtml;
target.InnerHtml = Value;
}
else
{
if (target.Attributes[TargetAttribute] == null)
{
target.Attributes.Add(TargetAttribute, Value);
}
else
{
d.OriginalValue = target.Attributes[TargetAttribute].Value;
target.Attributes[TargetAttribute].Value = Value;
}
}
}
doc.Save(IO.IOHelper.MapPath(SystemDirectories.Masterpages) + "/" + TargetFile);
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
d.NewValue = Value;
//save
return d;
}
public override string PreviewClientScript(string ControlClientId,string ClientSidePreviewEventType, string ClientSideGetValueScript)
{
if (string.IsNullOrEmpty(TargetAttribute))
{
return string.Format(
@"jQuery('#{0}').bind('{3}', function() {{
jQuery('#{1}').html({2});
}});",
ControlClientId,
TargetID,
ClientSideGetValueScript,
ClientSidePreviewEventType);
}
else
{
return string.Format(
@"jQuery('#{0}').bind('{4}', function() {{
jQuery('#{1}').attr('{2}',{3});
}});",
ControlClientId,
TargetID,
TargetAttribute,
ClientSideGetValueScript,
ClientSidePreviewEventType);
}
}
}
}
+310 -310
View File
@@ -37,11 +37,11 @@ namespace umbraco.cms.businesslogic.web
get {
if (_accessXmlContent == null)
{
if (_accessXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_accessXmlSource = IOHelper.MapPath(SystemFiles.AccessXml, false);
}
if (_accessXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_accessXmlSource = IOHelper.MapPath(SystemFiles.AccessXml, false);
}
_accessXmlContent = new XmlDocument();
@@ -59,30 +59,30 @@ namespace umbraco.cms.businesslogic.web
}
}
public static void AddMembershipRoleToDocument(int documentId, string role) {
//event
AddMemberShipRoleToDocumentEventArgs e = new AddMemberShipRoleToDocumentEventArgs();
new Access().FireBeforeAddMemberShipRoleToDocument(new Document(documentId), role, e);
public static void AddMembershipRoleToDocument(int documentId, string role) {
//event
AddMemberShipRoleToDocumentEventArgs e = new AddMemberShipRoleToDocumentEventArgs();
new Access().FireBeforeAddMemberShipRoleToDocument(new Document(documentId), role, e);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (x == null)
throw new Exception("Document is not protected!");
else {
if (x.SelectSingleNode("group [@id = '" + role + "']") == null) {
XmlElement groupXml = (XmlElement)AccessXml.CreateNode(XmlNodeType.Element, "group", "");
groupXml.SetAttribute("id", role);
x.AppendChild(groupXml);
save();
}
}
if (x == null)
throw new Exception("Document is not protected!");
else {
if (x.SelectSingleNode("group [@id = '" + role + "']") == null) {
XmlElement groupXml = (XmlElement)AccessXml.CreateNode(XmlNodeType.Element, "group", "");
groupXml.SetAttribute("id", role);
x.AppendChild(groupXml);
save();
}
}
new Access().FireAfterAddMemberShipRoleToDocument(new Document(documentId), role, e);
}
}
new Access().FireAfterAddMemberShipRoleToDocument(new Document(documentId), role, e);
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static void AddMemberGroupToDocument(int DocumentId, int MemberGroupId)
{
XmlElement x = (XmlElement) getPage(DocumentId);
@@ -101,7 +101,7 @@ namespace umbraco.cms.businesslogic.web
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static void AddMemberToDocument(int DocumentId, int MemberId)
{
XmlElement x = (XmlElement) getPage(DocumentId);
@@ -117,31 +117,31 @@ namespace umbraco.cms.businesslogic.web
save();
}
}
public static void AddMembershipUserToDocument(int documentId, string membershipUserName) {
//event
AddMembershipUserToDocumentEventArgs e = new AddMembershipUserToDocumentEventArgs();
new Access().FireBeforeAddMembershipUserToDocument(new Document(documentId), membershipUserName, e);
public static void AddMembershipUserToDocument(int documentId, string membershipUserName) {
//event
AddMembershipUserToDocumentEventArgs e = new AddMembershipUserToDocumentEventArgs();
new Access().FireBeforeAddMembershipUserToDocument(new Document(documentId), membershipUserName, e);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (x == null)
throw new Exception("Document is not protected!");
else {
if (x.Attributes.GetNamedItem("memberId") != null)
x.Attributes.GetNamedItem("memberId").Value = membershipUserName;
else
x.SetAttribute("memberId", membershipUserName);
save();
}
if (x == null)
throw new Exception("Document is not protected!");
else {
if (x.Attributes.GetNamedItem("memberId") != null)
x.Attributes.GetNamedItem("memberId").Value = membershipUserName;
else
x.SetAttribute("memberId", membershipUserName);
save();
}
new Access().FireAfterAddMembershipUserToDocument(new Document(documentId), membershipUserName, e);
}
}
new Access().FireAfterAddMembershipUserToDocument(new Document(documentId), membershipUserName, e);
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static void RemoveMemberGroupFromDocument(int DocumentId, int MemberGroupId)
{
XmlElement x = (XmlElement) getPage(DocumentId);
@@ -159,111 +159,111 @@ namespace umbraco.cms.businesslogic.web
}
}
public static void RemoveMembershipRoleFromDocument(int documentId, string role) {
public static void RemoveMembershipRoleFromDocument(int documentId, string role) {
RemoveMemberShipRoleFromDocumentEventArgs e = new RemoveMemberShipRoleFromDocumentEventArgs();
new Access().FireBeforeRemoveMemberShipRoleFromDocument(new Document(documentId), role, e);
RemoveMemberShipRoleFromDocumentEventArgs e = new RemoveMemberShipRoleFromDocumentEventArgs();
new Access().FireBeforeRemoveMemberShipRoleFromDocument(new Document(documentId), role, e);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (!e.Cancel) {
XmlElement x = (XmlElement)getPage(documentId);
if (x == null)
throw new Exception("Document is not protected!");
else {
XmlNode xGroup = x.SelectSingleNode("group [@id = '" + role + "']");
if (xGroup != null) {
x.RemoveChild(xGroup);
save();
}
}
if (x == null)
throw new Exception("Document is not protected!");
else {
XmlNode xGroup = x.SelectSingleNode("group [@id = '" + role + "']");
if (xGroup != null) {
x.RemoveChild(xGroup);
save();
}
}
new Access().FireAfterRemoveMemberShipRoleFromDocument(new Document(documentId), role, e);
}
}
new Access().FireAfterRemoveMemberShipRoleFromDocument(new Document(documentId), role, e);
}
}
public static bool RenameMemberShipRole(string oldRolename, string newRolename)
{
bool hasChange = false;
if (oldRolename != newRolename)
{
foreach (XmlNode x in AccessXml.SelectNodes("//group [@id = '" + oldRolename + "']"))
{
x.Attributes["id"].Value = newRolename;
hasChange = true;
}
if (hasChange)
save();
}
return hasChange;
}
public static void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId)
public static bool RenameMemberShipRole(string oldRolename, string newRolename)
{
AddProtectionEventArgs e = new AddProtectionEventArgs();
new Access().FireBeforeAddProtection(new Document(DocumentId), e);
bool hasChange = false;
if (oldRolename != newRolename)
{
foreach (XmlNode x in AccessXml.SelectNodes("//group [@id = '" + oldRolename + "']"))
{
x.Attributes["id"].Value = newRolename;
hasChange = true;
}
if (hasChange)
save();
}
if (!e.Cancel) {
return hasChange;
}
public static void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId)
{
AddProtectionEventArgs e = new AddProtectionEventArgs();
new Access().FireBeforeAddProtection(new Document(DocumentId), e);
XmlElement x = (XmlElement)getPage(DocumentId);
if (x == null) {
x = (XmlElement)_accessXmlContent.CreateNode(XmlNodeType.Element, "page", "");
AccessXml.DocumentElement.AppendChild(x);
}
// if using simple mode, make sure that all existing groups are removed
else if (Simple) {
x.RemoveAll();
}
x.SetAttribute("id", DocumentId.ToString());
x.SetAttribute("loginPage", LoginDocumentId.ToString());
x.SetAttribute("noRightsPage", ErrorDocumentId.ToString());
x.SetAttribute("simple", Simple.ToString());
save();
if (!e.Cancel) {
clearCheckPages();
XmlElement x = (XmlElement)getPage(DocumentId);
if (x == null) {
x = (XmlElement)_accessXmlContent.CreateNode(XmlNodeType.Element, "page", "");
AccessXml.DocumentElement.AppendChild(x);
}
// if using simple mode, make sure that all existing groups are removed
else if (Simple) {
x.RemoveAll();
}
x.SetAttribute("id", DocumentId.ToString());
x.SetAttribute("loginPage", LoginDocumentId.ToString());
x.SetAttribute("noRightsPage", ErrorDocumentId.ToString());
x.SetAttribute("simple", Simple.ToString());
save();
new Access().FireAfterAddProtection(new Document(DocumentId), e);
}
clearCheckPages();
new Access().FireAfterAddProtection(new Document(DocumentId), e);
}
}
public static void RemoveProtection(int DocumentId)
{
XmlElement x = (XmlElement) getPage(DocumentId);
XmlElement x = (XmlElement) getPage(DocumentId);
if (x != null)
{
//event
RemoveProtectionEventArgs e = new RemoveProtectionEventArgs();
new Access().FireBeforeRemoveProtection(new Document(DocumentId), e);
//event
RemoveProtectionEventArgs e = new RemoveProtectionEventArgs();
new Access().FireBeforeRemoveProtection(new Document(DocumentId), e);
if (!e.Cancel) {
if (!e.Cancel) {
x.ParentNode.RemoveChild(x);
save();
clearCheckPages();
x.ParentNode.RemoveChild(x);
save();
clearCheckPages();
new Access().FireAfterRemoveProtection(new Document(DocumentId), e);
}
new Access().FireAfterRemoveProtection(new Document(DocumentId), e);
}
}
}
private static void save()
{
SaveEventArgs e = new SaveEventArgs();
SaveEventArgs e = new SaveEventArgs();
new Access().FireBeforeSave(e);
new Access().FireBeforeSave(e);
if (!e.Cancel) {
System.IO.FileStream f = System.IO.File.Open(_accessXmlSource, FileMode.Create);
AccessXml.Save(f);
f.Close();
if (!e.Cancel) {
System.IO.FileStream f = System.IO.File.Open(_accessXmlSource, FileMode.Create);
AccessXml.Save(f);
f.Close();
new Access().FireAfterSave(e);
}
new Access().FireAfterSave(e);
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static bool IsProtectedByGroup(int DocumentId, int GroupId)
{
bool isProtected = false;
@@ -284,39 +284,39 @@ namespace umbraco.cms.businesslogic.web
return isProtected;
}
public static bool IsProtectedByMembershipRole(int documentId, string role) {
bool isProtected = false;
public static bool IsProtectedByMembershipRole(int documentId, string role) {
bool isProtected = false;
CMSNode d = new CMSNode(documentId);
CMSNode d = new CMSNode(documentId);
if (!IsProtected(documentId, d.Path))
isProtected = false;
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
isProtected = true;
}
}
if (!IsProtected(documentId, d.Path))
isProtected = false;
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
isProtected = true;
}
}
return isProtected;
}
return isProtected;
}
public static string[] GetAccessingMembershipRoles(int documentId, string path) {
ArrayList roles = new ArrayList();
public static string[] GetAccessingMembershipRoles(int documentId, string path) {
ArrayList roles = new ArrayList();
if (!IsProtected(documentId, path))
return null;
else {
XmlNode currentNode = getPage(getProtectedPage(path));
foreach (XmlNode n in currentNode.SelectNodes("./group")) {
roles.Add(n.Attributes.GetNamedItem("id").Value);
}
return (string[])roles.ToArray(typeof(string));
}
if (!IsProtected(documentId, path))
return null;
else {
XmlNode currentNode = getPage(getProtectedPage(path));
foreach (XmlNode n in currentNode.SelectNodes("./group")) {
roles.Add(n.Attributes.GetNamedItem("id").Value);
}
return (string[])roles.ToArray(typeof(string));
}
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static cms.businesslogic.member.MemberGroup[] GetAccessingGroups(int DocumentId)
{
cms.businesslogic.web.Document d = new Document(DocumentId);
@@ -325,7 +325,7 @@ namespace umbraco.cms.businesslogic.web
return null;
else
{
XmlNode currentNode = getPage(getProtectedPage(d.Path));
XmlNode currentNode = getPage(getProtectedPage(d.Path));
cms.businesslogic.member.MemberGroup[] mg = new umbraco.cms.businesslogic.member.MemberGroup[currentNode.SelectNodes("./group").Count];
int count = 0;
foreach (XmlNode n in currentNode.SelectNodes("./group"))
@@ -338,47 +338,47 @@ namespace umbraco.cms.businesslogic.web
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static cms.businesslogic.member.Member GetAccessingMember(int DocumentId) {
cms.businesslogic.web.Document d = new Document(DocumentId);
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static cms.businesslogic.member.Member GetAccessingMember(int DocumentId) {
cms.businesslogic.web.Document d = new Document(DocumentId);
if (!IsProtected(DocumentId, d.Path))
return null;
else if (GetProtectionType(DocumentId) != ProtectionType.Simple)
throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead");
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.Attributes.GetNamedItem("memberId") != null)
return new cms.businesslogic.member.Member(int.Parse(
currentNode.Attributes.GetNamedItem("memberId").Value));
else
throw new Exception("Document doesn't contain a memberId. This might be caused if document is protected using umbraco RC1 or older.");
if (!IsProtected(DocumentId, d.Path))
return null;
else if (GetProtectionType(DocumentId) != ProtectionType.Simple)
throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead");
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.Attributes.GetNamedItem("memberId") != null)
return new cms.businesslogic.member.Member(int.Parse(
currentNode.Attributes.GetNamedItem("memberId").Value));
else
throw new Exception("Document doesn't contain a memberId. This might be caused if document is protected using umbraco RC1 or older.");
}
}
}
public static MembershipUser GetAccessingMembershipUser(int documentId) {
CMSNode d = new CMSNode(documentId);
}
public static MembershipUser GetAccessingMembershipUser(int documentId) {
CMSNode d = new CMSNode(documentId);
if (!IsProtected(documentId, d.Path))
return null;
else if (GetProtectionType(documentId) != ProtectionType.Simple)
throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead");
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.Attributes.GetNamedItem("memberId") != null)
return Membership.GetUser(currentNode.Attributes.GetNamedItem("memberId").Value);
else
throw new Exception("Document doesn't contain a memberId. This might be caused if document is protected using umbraco RC1 or older.");
if (!IsProtected(documentId, d.Path))
return null;
else if (GetProtectionType(documentId) != ProtectionType.Simple)
throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead");
else {
XmlNode currentNode = getPage(getProtectedPage(d.Path));
if (currentNode.Attributes.GetNamedItem("memberId") != null)
return Membership.GetUser(currentNode.Attributes.GetNamedItem("memberId").Value);
else
throw new Exception("Document doesn't contain a memberId. This might be caused if document is protected using umbraco RC1 or older.");
}
}
}
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static bool HasAccess(int DocumentId, cms.businesslogic.member.Member Member)
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
public static bool HasAccess(int DocumentId, cms.businesslogic.member.Member Member)
{
bool hasAccess = false;
@@ -407,30 +407,30 @@ namespace umbraco.cms.businesslogic.web
return hasAccess;
}
public static bool HasAccces(int documentId, object memberId) {
bool hasAccess = false;
cms.businesslogic.CMSNode node = new CMSNode(documentId);
public static bool HasAccces(int documentId, object memberId) {
bool hasAccess = false;
cms.businesslogic.CMSNode node = new CMSNode(documentId);
if (!IsProtected(documentId, node.Path))
return true;
else {
MembershipUser member = Membership.GetUser(memberId);
XmlNode currentNode = getPage(getProtectedPage(node.Path));
if (!IsProtected(documentId, node.Path))
return true;
else {
MembershipUser member = Membership.GetUser(memberId);
XmlNode currentNode = getPage(getProtectedPage(node.Path));
if (member != null) {
foreach(string role in Roles.GetRolesForUser()) {
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
hasAccess = true;
break;
}
}
}
}
return hasAccess;
}
if (member != null) {
foreach(string role in Roles.GetRolesForUser()) {
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
hasAccess = true;
break;
}
}
}
}
return hasAccess;
}
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
private static bool HasAccess(int DocumentId, string Path, cms.businesslogic.member.Member Member)
[Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
private static bool HasAccess(int DocumentId, string Path, cms.businesslogic.member.Member Member)
{
bool hasAccess = false;
@@ -457,28 +457,28 @@ namespace umbraco.cms.businesslogic.web
return hasAccess;
}
public static bool HasAccess(int documentId, string path, MembershipUser member) {
bool hasAccess = false;
public static bool HasAccess(int documentId, string path, MembershipUser member) {
bool hasAccess = false;
if (!IsProtected(documentId, path))
hasAccess = true;
else {
XmlNode currentNode = getPage(getProtectedPage(path));
if (member != null) {
string[] roles = Roles.GetRolesForUser(member.UserName);
foreach(string role in roles) {
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
hasAccess = true;
break;
}
}
}
}
if (!IsProtected(documentId, path))
hasAccess = true;
else {
XmlNode currentNode = getPage(getProtectedPage(path));
if (member != null) {
string[] roles = Roles.GetRolesForUser(member.UserName);
foreach(string role in roles) {
if (currentNode.SelectSingleNode("./group [@id='" + role + "']") != null) {
hasAccess = true;
break;
}
}
}
}
return hasAccess;
}
return hasAccess;
}
public static ProtectionType GetProtectionType(int DocumentId)
public static ProtectionType GetProtectionType(int DocumentId)
{
XmlNode x = getPage(DocumentId);
try
@@ -510,13 +510,13 @@ namespace umbraco.cms.businesslogic.web
}
}
// Add thread safe updating to the hashtable
System.Web.HttpContext.Current.Application.Lock();
if (!_checkedPages.ContainsKey(DocumentId))
_checkedPages.Add(DocumentId, isProtected);
System.Web.HttpContext.Current.Application.UnLock();
}
else
// Add thread safe updating to the hashtable
System.Web.HttpContext.Current.Application.Lock();
if (!_checkedPages.ContainsKey(DocumentId))
_checkedPages.Add(DocumentId, isProtected);
System.Web.HttpContext.Current.Application.UnLock();
}
else
isProtected = (bool) _checkedPages[DocumentId];
return isProtected;
@@ -540,7 +540,7 @@ namespace umbraco.cms.businesslogic.web
if (getPage(int.Parse(id)) != null)
protectedPage = int.Parse(id);
return protectedPage;
return protectedPage;
}
private static XmlNode getPage(int documentId)
@@ -550,104 +550,104 @@ namespace umbraco.cms.businesslogic.web
}
//Event delegates
public delegate void SaveEventHandler(Access sender, SaveEventArgs e);
//Event delegates
public delegate void SaveEventHandler(Access sender, SaveEventArgs e);
public delegate void AddProtectionEventHandler(Document sender, AddProtectionEventArgs e);
public delegate void RemoveProtectionEventHandler(Document sender, RemoveProtectionEventArgs e);
public delegate void AddProtectionEventHandler(Document sender, AddProtectionEventArgs e);
public delegate void RemoveProtectionEventHandler(Document sender, RemoveProtectionEventArgs e);
public delegate void AddMemberShipRoleToDocumentEventHandler(Document sender, string role, AddMemberShipRoleToDocumentEventArgs e);
public delegate void RemoveMemberShipRoleFromDocumentEventHandler(Document sender, string role, RemoveMemberShipRoleFromDocumentEventArgs e);
public delegate void AddMemberShipRoleToDocumentEventHandler(Document sender, string role, AddMemberShipRoleToDocumentEventArgs e);
public delegate void RemoveMemberShipRoleFromDocumentEventHandler(Document sender, string role, RemoveMemberShipRoleFromDocumentEventArgs e);
public delegate void RemoveMemberShipUserFromDocumentEventHandler(Document sender, string MembershipUserName, RemoveMemberShipUserFromDocumentEventArgs e);
public delegate void AddMembershipUserToDocumentEventHandler(Document sender, string MembershipUserName, AddMembershipUserToDocumentEventArgs e);
public delegate void RemoveMemberShipUserFromDocumentEventHandler(Document sender, string MembershipUserName, RemoveMemberShipUserFromDocumentEventArgs e);
public delegate void AddMembershipUserToDocumentEventHandler(Document sender, string MembershipUserName, AddMembershipUserToDocumentEventArgs e);
//Events
//Events
public static event SaveEventHandler BeforeSave;
protected virtual void FireBeforeSave(SaveEventArgs e) {
if (BeforeSave != null)
BeforeSave(this, e);
}
public static event SaveEventHandler BeforeSave;
protected virtual void FireBeforeSave(SaveEventArgs e) {
if (BeforeSave != null)
BeforeSave(this, e);
}
public static event SaveEventHandler AfterSave;
protected virtual void FireAfterSave(SaveEventArgs e) {
if (AfterSave != null)
AfterSave(this, e);
}
public static event SaveEventHandler AfterSave;
protected virtual void FireAfterSave(SaveEventArgs e) {
if (AfterSave != null)
AfterSave(this, e);
}
public static event AddProtectionEventHandler BeforeAddProtection;
protected virtual void FireBeforeAddProtection(Document doc, AddProtectionEventArgs e) {
if (BeforeAddProtection != null)
BeforeAddProtection(doc, e);
}
public static event AddProtectionEventHandler BeforeAddProtection;
protected virtual void FireBeforeAddProtection(Document doc, AddProtectionEventArgs e) {
if (BeforeAddProtection != null)
BeforeAddProtection(doc, e);
}
public static event AddProtectionEventHandler AfterAddProtection;
protected virtual void FireAfterAddProtection(Document doc, AddProtectionEventArgs e) {
if (AfterAddProtection != null)
AfterAddProtection(doc, e);
}
public static event AddProtectionEventHandler AfterAddProtection;
protected virtual void FireAfterAddProtection(Document doc, AddProtectionEventArgs e) {
if (AfterAddProtection != null)
AfterAddProtection(doc, e);
}
public static event RemoveProtectionEventHandler BeforeRemoveProtection;
protected virtual void FireBeforeRemoveProtection(Document doc, RemoveProtectionEventArgs e) {
if (BeforeRemoveProtection != null)
BeforeRemoveProtection(doc, e);
}
public static event RemoveProtectionEventHandler BeforeRemoveProtection;
protected virtual void FireBeforeRemoveProtection(Document doc, RemoveProtectionEventArgs e) {
if (BeforeRemoveProtection != null)
BeforeRemoveProtection(doc, e);
}
public static event RemoveProtectionEventHandler AfterRemoveProtection;
protected virtual void FireAfterRemoveProtection(Document doc, RemoveProtectionEventArgs e) {
if (AfterRemoveProtection != null)
AfterRemoveProtection(doc, e);
}
public static event RemoveProtectionEventHandler AfterRemoveProtection;
protected virtual void FireAfterRemoveProtection(Document doc, RemoveProtectionEventArgs e) {
if (AfterRemoveProtection != null)
AfterRemoveProtection(doc, e);
}
public static event AddMemberShipRoleToDocumentEventHandler BeforeAddMemberShipRoleToDocument;
protected virtual void FireBeforeAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) {
if (BeforeAddMemberShipRoleToDocument != null)
BeforeAddMemberShipRoleToDocument(doc, role, e);
}
public static event AddMemberShipRoleToDocumentEventHandler BeforeAddMemberShipRoleToDocument;
protected virtual void FireBeforeAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) {
if (BeforeAddMemberShipRoleToDocument != null)
BeforeAddMemberShipRoleToDocument(doc, role, e);
}
public static event AddMemberShipRoleToDocumentEventHandler AfterAddMemberShipRoleToDocument;
protected virtual void FireAfterAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) {
if (AfterAddMemberShipRoleToDocument != null)
AfterAddMemberShipRoleToDocument(doc, role, e);
}
public static event AddMemberShipRoleToDocumentEventHandler AfterAddMemberShipRoleToDocument;
protected virtual void FireAfterAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) {
if (AfterAddMemberShipRoleToDocument != null)
AfterAddMemberShipRoleToDocument(doc, role, e);
}
public static event RemoveMemberShipRoleFromDocumentEventHandler BeforeRemoveMemberShipRoleToDocument;
protected virtual void FireBeforeRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) {
if (BeforeRemoveMemberShipRoleToDocument != null)
BeforeRemoveMemberShipRoleToDocument(doc, role, e);
}
public static event RemoveMemberShipRoleFromDocumentEventHandler BeforeRemoveMemberShipRoleToDocument;
protected virtual void FireBeforeRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) {
if (BeforeRemoveMemberShipRoleToDocument != null)
BeforeRemoveMemberShipRoleToDocument(doc, role, e);
}
public static event RemoveMemberShipRoleFromDocumentEventHandler AfterRemoveMemberShipRoleToDocument;
protected virtual void FireAfterRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) {
if (AfterRemoveMemberShipRoleToDocument != null)
AfterRemoveMemberShipRoleToDocument(doc, role, e);
}
public static event RemoveMemberShipRoleFromDocumentEventHandler AfterRemoveMemberShipRoleToDocument;
protected virtual void FireAfterRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) {
if (AfterRemoveMemberShipRoleToDocument != null)
AfterRemoveMemberShipRoleToDocument(doc, role, e);
}
public static event RemoveMemberShipUserFromDocumentEventHandler BeforeRemoveMembershipUserFromDocument;
protected virtual void FireBeforeRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) {
if (BeforeRemoveMembershipUserFromDocument != null)
BeforeRemoveMembershipUserFromDocument(doc, username, e);
}
public static event RemoveMemberShipUserFromDocumentEventHandler BeforeRemoveMembershipUserFromDocument;
protected virtual void FireBeforeRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) {
if (BeforeRemoveMembershipUserFromDocument != null)
BeforeRemoveMembershipUserFromDocument(doc, username, e);
}
public static event RemoveMemberShipUserFromDocumentEventHandler AfterRemoveMembershipUserFromDocument;
protected virtual void FireAfterRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) {
if (AfterRemoveMembershipUserFromDocument != null)
AfterRemoveMembershipUserFromDocument(doc, username, e);
}
public static event RemoveMemberShipUserFromDocumentEventHandler AfterRemoveMembershipUserFromDocument;
protected virtual void FireAfterRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) {
if (AfterRemoveMembershipUserFromDocument != null)
AfterRemoveMembershipUserFromDocument(doc, username, e);
}
public static event AddMembershipUserToDocumentEventHandler BeforeAddMembershipUserToDocument;
protected virtual void FireBeforeAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) {
if (BeforeAddMembershipUserToDocument != null)
BeforeAddMembershipUserToDocument(doc, username, e);
}
public static event AddMembershipUserToDocumentEventHandler BeforeAddMembershipUserToDocument;
protected virtual void FireBeforeAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) {
if (BeforeAddMembershipUserToDocument != null)
BeforeAddMembershipUserToDocument(doc, username, e);
}
public static event AddMembershipUserToDocumentEventHandler AfterAddMembershipUserToDocument;
protected virtual void FireAfterAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) {
if (AfterAddMembershipUserToDocument != null)
AfterAddMembershipUserToDocument(doc, username, e);
}
}
public static event AddMembershipUserToDocumentEventHandler AfterAddMembershipUserToDocument;
protected virtual void FireAfterAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) {
if (AfterAddMembershipUserToDocument != null)
AfterAddMembershipUserToDocument(doc, username, e);
}
}
public enum ProtectionType
{
+23
View File
@@ -101,6 +101,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\..\foreign dlls\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\ICSharpCode.SharpZipLib.dll</HintPath>
@@ -195,6 +198,13 @@
<Compile Include="businesslogic\datatype\ClientDependencyAttribute.cs" />
<Compile Include="businesslogic\datatype\DBTypes.cs" />
<Compile Include="businesslogic\datatype\PreValue.cs" />
<Compile Include="businesslogic\installer\IInstallerStep.cs" />
<Compile Include="businesslogic\installer\InstallerStep.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="businesslogic\installer\InstallStepCollection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="businesslogic\ISaveHandlerContents.cs" />
<Compile Include="businesslogic\Packager\FileResources\PackageFiles.Designer.cs">
<AutoGen>True</AutoGen>
@@ -202,9 +212,22 @@
<DependentUpon>PackageFiles.resx</DependentUpon>
</Compile>
<Compile Include="businesslogic\Property\Properties.cs" />
<Compile Include="businesslogic\skinning\controls\ColorPicker.cs" />
<Compile Include="businesslogic\skinning\dependencies\Color.cs" />
<Compile Include="businesslogic\skinning\dependencies\Image.cs" />
<Compile Include="businesslogic\skinning\dependencies\Text.cs" />
<Compile Include="businesslogic\skinning\Dependency.cs" />
<Compile Include="businesslogic\skinning\DependencyType.cs" />
<Compile Include="businesslogic\skinning\ProviderBase.cs" />
<Compile Include="businesslogic\skinning\Skin.cs" />
<Compile Include="businesslogic\skinning\Task.cs" />
<Compile Include="businesslogic\skinning\tasks\ModifyCss.cs" />
<Compile Include="businesslogic\skinning\tasks\ModifyTemplate.cs" />
<Compile Include="businesslogic\skinning\TaskType.cs" />
<Compile Include="businesslogic\Tags\Tag.cs" />
<Compile Include="businesslogic\task\Tasks.cs" />
<Compile Include="businesslogic\web\DocumentVersionList.cs" />
<Compile Include="businesslogic\skinning\Skinning.cs" />
<Compile Include="helpers\Casing.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace umbraco.interfaces.skinning
{
public interface IDependencyType
{
String Name { get; set; }
List<Object> Values { get; set; }
WebControl Editor { get; set; }
}
}
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace umbraco.interfaces.skinning
{
public interface ITaskType
{
String Name { get; set; }
String Value { get; set; }
TaskExecutionDetails Execute(string Value);
TaskExecutionStatus RollBack(string OriginalValue);
string PreviewClientScript(string ControlClientId, string ClientSidePreviewEventType, string ClientSideGetValueScript);
XmlNode ToXml(string OriginalValue, string NewValue);
}
public struct TaskExecutionDetails
{
public TaskExecutionStatus TaskExecutionStatus;
public string OriginalValue;
public string NewValue;
}
public enum TaskExecutionStatus
{
Failed,
Cancelled,
Completed
}
}
@@ -160,6 +160,8 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="IUseTags.cs" />
<Compile Include="skinning\IDependencyType.cs" />
<Compile Include="skinning\ITaskType.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
@@ -178,6 +180,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
+30 -10
View File
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<dashBoard>
<section>
<section>
<areas>
<area>settings</area>
</areas>
<tab caption="Apply skin">
<control>/umbraco/dashboard/settings/Applyskin.ascx</control>
</tab>
</section>
<section>
<access>
<deny>translator</deny>
</access>
@@ -52,13 +64,21 @@
<control>/usercontrols/dashboards/EmailAFriendForm_logs.ascx</control>
</tab>
</section>
<section>
<areas>
<area>default</area>
<area>member</area>
</areas>
<tab caption="Search Members">
<control>/umbraco/members/membersearch.ascx</control>
</tab>
</section>
<section>
<areas>
<area>default</area>
<area>member</area>
</areas>
<tab caption="Search Members">
<control>/umbraco/members/membersearch.ascx</control>
</tab>
</section>
<section id="contour">
<areas>
<area>contour</area>
</areas>
<tab caption="Umbraco Contour">
<control>/umbraco/plugins/umbracocontour/formsdashboard.ascx</control>
</tab>
</section>
</dashBoard>
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<skinning>
<skin alias="" template="1043"/>
</skinning>
@@ -1,3 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<metablogapi>
<channel>
<name>My FAQs</name>
<user>0</user>
<startNode>1080</startNode>
<fullTree>False</fullTree>
<documentTypeAlias>FAQItem</documentTypeAlias>
<fields>
<categories>
</categories>
<description>answer</description>
<excerpt>
</excerpt>
</fields>
<mediaObjectSupport enabled="True" folderId="-1" mediaTypeAlias="image" mediaTypeFileProperty="umbracoFile" />
</channel>
</metablogapi>
@@ -5,6 +5,7 @@
</languages>
<options>
<![CDATA[]]>
<set language="Ruby" option="LibraryPaths" value="..\..\Languages\Ruby\libs\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\1.8\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\site_ruby\;..\..\..\External\Languages\Ruby\ruby-1.8.6\lib\ruby\1.8\" />
</options>
</microsoft.scripting>
@@ -88,6 +88,7 @@
</requestHandler>
<templates>
<useAspNetMasterPages>true</useAspNetMasterPages>
<enableSkinSupport>true</enableSkinSupport>
</templates>
<viewstateMoverModule enable="false" />
@@ -2,4 +2,4 @@
<XsltExtensions>
<!-- <ext assembly="your.assemblyName" type="your.class.name" alias="yourAlias">
</ext> -->
</XsltExtensions>
</XsltExtensions>
+113 -55
View File
@@ -6,6 +6,7 @@ using System.Xml;
using System.Text.RegularExpressions;
using umbraco.presentation;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic;
namespace umbraco
{
@@ -141,6 +142,8 @@ namespace umbraco
if (UmbracoSettings.UseAspNetMasterPages)
{
HttpContext.Current.Trace.Write("umbracoPage", "Looking up skin information");
if (m_umbPage != null)
this.MasterPageFile = template.GetMasterPageName(m_umbPage.Template);
@@ -165,9 +168,6 @@ namespace umbraco
}
else
Page.Trace.IsEnabled = false;
}
@@ -187,71 +187,85 @@ namespace umbraco
private void initUmbracoPage()
{
if (!UmbracoSettings.EnableSplashWhileLoading || !content.Instance.isInitializing)
RequestInitEventArgs e = new RequestInitEventArgs();
e.Page = m_umbPage;
e.PageId = m_umbPage.PageID;
e.Context = System.Web.HttpContext.Current;
FireBeforeRequestInit(e);
if (!e.Cancel)
{
if (m_umbPage != null)
if (!UmbracoSettings.EnableSplashWhileLoading || !content.Instance.isInitializing)
{
// Add page elements to global items
try
{
System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
if (m_umbPage != null)
{
// Add page elements to global items
try
{
System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
}
catch (ArgumentException aex)
{
System.Web.HttpContext.Current.Items.Remove("pageElements");
System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
}
string tempCulture = m_umbPage.GetCulture();
if (tempCulture != "")
{
System.Web.HttpContext.Current.Trace.Write("default.aspx", "Culture changed to " + tempCulture);
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture(tempCulture);
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
}
if (!UmbracoSettings.UseAspNetMasterPages)
{
layoutControls.umbracoPageHolder pageHolder = new umbraco.layoutControls.umbracoPageHolder();
pageHolder.ID = "umbPageHolder";
Page.Controls.Add(pageHolder);
m_umbPage.RenderPage(m_umbPage.Template);
layoutControls.umbracoPageHolder umbPageHolder =
(layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
umbPageHolder.Populate(m_umbPage);
}
}
catch (ArgumentException aex)
else
{
// If there's no published content, show friendly error
if (umbraco.content.Instance.XmlContent.SelectSingleNode("/root/*") == null)
Response.Redirect(IO.SystemDirectories.Config + "/splashes/noNodes.aspx");
else
{
System.Web.HttpContext.Current.Items.Remove("pageElements");
System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
Response.StatusCode = 404;
Response.Write("<html><body><h1>Page not found</h1>");
if (m_umbRequest != null)
HttpContext.Current.Response.Write("<h3>No umbraco document matches the url '" + HttpUtility.HtmlEncode(Request.Url.ToString()) + "'</h3><p>umbraco tried this to match it using this xpath query'" + m_umbRequest.PageXPathQuery + "')");
else
HttpContext.Current.Response.Write("<h3>No umbraco document matches the url '" + HttpUtility.HtmlEncode(Request.Url.ToString()) + "'</h3>");
Response.Write("</p>");
Response.Write("<p>This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.</p>");
Response.Write("<p>For more information, visit <a href=\"http://umbraco.org/redir/custom-404\">information about custom 404</a> on the umbraco website.</p>");
Response.Write("<p style=\"border-top: 1px solid #ccc; padding-top: 10px\"><small>This page is intentionally left ugly ;-)</small></p>");
Response.Write("</body></html>");
}
}
string tempCulture = m_umbPage.GetCulture();
if (tempCulture != "")
{
System.Web.HttpContext.Current.Trace.Write("default.aspx", "Culture changed to " + tempCulture);
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture(tempCulture);
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
}
if (!UmbracoSettings.UseAspNetMasterPages)
{
layoutControls.umbracoPageHolder pageHolder = new umbraco.layoutControls.umbracoPageHolder();
pageHolder.ID = "umbPageHolder";
Page.Controls.Add(pageHolder);
m_umbPage.RenderPage(m_umbPage.Template);
layoutControls.umbracoPageHolder umbPageHolder =
(layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
umbPageHolder.Populate(m_umbPage);
}
}
else
{
// If there's no published content, show friendly error
if (umbraco.content.Instance.XmlContent.SelectSingleNode("/root/*") == null)
Response.Redirect(IO.SystemDirectories.Config + "/splashes/noNodes.aspx");
else
{
Response.StatusCode = 404;
Response.Write("<html><body><h1>Page not found</h1>");
if (m_umbRequest != null)
HttpContext.Current.Response.Write("<h3>No umbraco document matches the url '" + HttpUtility.HtmlEncode(Request.Url.ToString()) + "'</h3><p>umbraco tried this to match it using this xpath query'" + m_umbRequest.PageXPathQuery + "')");
else
HttpContext.Current.Response.Write("<h3>No umbraco document matches the url '" + HttpUtility.HtmlEncode(Request.Url.ToString()) + "'</h3>");
Response.Write("</p>");
Response.Write("<p>This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.</p>");
Response.Write("<p>For more information, visit <a href=\"http://umbraco.org/redir/custom-404\">information about custom 404</a> on the umbraco website.</p>");
Response.Write("<p style=\"border-top: 1px solid #ccc; padding-top: 10px\"><small>This page is intentionally left ugly ;-)</small></p>");
Response.Write("</body></html>");
}
Response.Redirect(IO.SystemDirectories.Config + "/splashes/booting.aspx?orgUrl=" + Request.Url);
}
}
else
{
Response.Redirect(IO.SystemDirectories.Config + "/splashes/booting.aspx?orgUrl=" + Request.Url);
FireAfterRequestInit(e);
}
}
@@ -264,5 +278,49 @@ namespace umbraco
}
#endregion
/// <summary>
/// The preinit event handler
/// </summary>
public delegate void RequestInitEventHandler(object sender, RequestInitEventArgs e);
/// <summary>
/// occurs before the umbraco page is initialized for rendering.
/// </summary>
public static event RequestInitEventHandler BeforeRequestInit;
/// <summary>
/// Raises the <see cref="E:BeforeRequestInit"/> event.
/// </summary>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected internal new virtual void FireBeforeRequestInit(RequestInitEventArgs e)
{
if (BeforeRequestInit != null)
BeforeRequestInit(this, e);
}
/// <summary>
/// Occurs when [after save].
/// </summary>
public static event RequestInitEventHandler AfterRequestInit;
/// <summary>
/// Raises the <see cref="E:AfterRequestInit"/> event.
/// </summary>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected virtual void FireAfterRequestInit(RequestInitEventArgs e)
{
if (AfterRequestInit != null)
AfterRequestInit(this, e);
}
}
//Request Init Events Arguments
public class RequestInitEventArgs : System.ComponentModel.CancelEventArgs
{
public page Page { get; internal set; }
public HttpContext Context { get; internal set; }
public string Url { get; internal set; }
public int PageId { get; internal set; }
}
}
+27 -29
View File
@@ -1,6 +1,7 @@
<%@ Page Language="c#" CodeBehind="default.aspx.cs" AutoEventWireup="True" Inherits="umbraco.presentation.install._default" EnableViewState="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -11,29 +12,17 @@
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="style.css" />
<link rel="Stylesheet" href="style.css" type="text/css" />
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="modal/style.css" PathNameAlias="UmbracoClient" />
<umb:JsInclude ID="JsInclude4" runat="server" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient" Priority="0" />
<umb:JsInclude ID="JsInclude3" runat="server" FilePath="Application/NamespaceManager.js" PathNameAlias="UmbracoClient" Priority="0" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="modal/modal.js" PathNameAlias="UmbracoClient" Priority="10" />
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="passwordStrength/passwordstrength.js" PathNameAlias="UmbracoClient" Priority="11" />
<umb:JsInclude ID="JsInclude5" runat="server" FilePath="installer.js" Priority="0" />
<style type="text/css">
#generatedCategories{display: none;}
#list1a{height: 300px; overflow: auto;}
#list1a .installed h3, #list1a .installed h3 *{color: #666;}
#list1a .installed h3 span{font-size: 11px; padding-left: 25px;}
.loadNitrosButton{position: absolute; bottom: 5px;}
.actions a{color: #333; text-decoration: none; display:block; padding: 0px 25px 0px 10px; margin-top: 20px;}
.actions a h3{color: #000; margin-bottom: 2px; text-decoration: underline}
.actions a:hover{text-decoration: underline;}
.passtestresult{margin-left: 15px; font-weight: bold; padding: 4px 10px 4px 10px !Important;}
</style>
</head>
<body>
@@ -41,7 +30,7 @@
function nextStep(button, elementId) {
showProgress(button, elementId);
setTimeout('document.location.href = \'default.aspx?installStep=' + document.getElementById("step").value + '\'', 100);
//setTimeout('document.location.href = \'default.aspx?installStep=' + document.getElementById("step").value + '\'', 100);
}
function showProgress(button, elementId) {
@@ -73,20 +62,29 @@
<form id="Form1" method="post" runat="server">
<asp:ScriptManager runat="server" ID="umbracoScriptManager">
</asp:ScriptManager>
<cc1:UmbracoPanel Style="text-align: left;" ID="Panel1" AutoResize="false" runat="server" Height="550px" Width="680px" Text="Umbraco Configuration Wizard">
<div id="contentScroll">
<asp:PlaceHolder ID="PlaceHolderStep" runat="server"></asp:PlaceHolder>
</div>
<div id="buttons">
<div id="loadingBar">
<cc1:ProgressBar ID="prgbar" runat="server" Title="Loading..." /><br />
</div>
<div id="main">
<h1 id="header"><asp:Literal ID="lt_header" runat="server" /></h1>
<div id="step">
<asp:PlaceHolder ID="PlaceHolderStep" runat="server"></asp:PlaceHolder>
</div>
<div id="buttons">
<div id="loadingBar">
<cc1:ProgressBar ID="prgbar" runat="server" Title="Loading..." /><br />
</div>
<asp:Button ID="next" OnClientClick="nextStep(this,'loadingBar'); return false;" Text="Next &raquo;" runat="server" />
</div>
</cc1:UmbracoPanel>
<asp:Button ID="next" CssClass="next" OnClientClick="showProgress(this,'loadingBar'); return true;" OnCommand="onNextCommand" Text="Next &raquo;" runat="server" />
</div>
</div>
<input type="hidden" runat="server" value="welcome" id="step">
</form>
<div id="umbModalBox">
+93 -60
View File
@@ -10,13 +10,14 @@ using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
using umbraco.IO;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install
{
/// <summary>
/// Summary description for _default.
/// </summary>
public partial class _default : BasePages.BasePage
public partial class _default : BasePages.BasePage
{
private string _installStep = "";
@@ -25,63 +26,83 @@ namespace umbraco.presentation.install
{
ClientLoader.DataBind();
//If user wishes to subscribe to security updates
if (!string.IsNullOrEmpty(Request["email"]) && !string.IsNullOrEmpty(Request["name"]))
SubscribeToNewsLetter(Request["name"], Request["email"]);
//If user wishes to subscribe to security updates
if (!string.IsNullOrEmpty(Request["email"]) && !string.IsNullOrEmpty(Request["name"]))
SubscribeToNewsLetter(Request["name"], Request["email"]);
// use buffer, so content isn't sent until it's ready (minimizing the blank screen experience)
Response.Buffer = true;
step.Value = _installStep;
//ScriptManager sm = Page.FindControl("umbracoScriptManager") as ScriptManager;
//webservices.ajaxHelpers.EnsureLegacyCalls(Page);
prepareNextButton();
}
// use buffer, so content isn't sent until it's ready (minimizing the blank screen experience)
Response.Buffer = true;
//ScriptManager sm = Page.FindControl("umbracoScriptManager") as ScriptManager;
//webservices.ajaxHelpers.EnsureLegacyCalls(Page);
//prepareNextButton();
}
private void SubscribeToNewsLetter(string name, string email) {
try {
System.Net.WebClient client = new System.Net.WebClient();
NameValueCollection values = new NameValueCollection();
values.Add("name", name);
values.Add("email", email);
private void SubscribeToNewsLetter(string name, string email) {
try {
System.Net.WebClient client = new System.Net.WebClient();
NameValueCollection values = new NameValueCollection();
values.Add("name", name);
values.Add("email", email);
client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values);
client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values);
} catch { /* fail in silence */ }
}
} catch { /* fail in silence */ }
}
private void loadContent()
private void loadContent(InstallerStep currentStep)
{
//Response.Redirect("./default.aspx?installStep=" + step.Value, true);
PlaceHolderStep.Controls.Clear();
PlaceHolderStep.Controls.Add(new System.Web.UI.UserControl().LoadControl(IOHelper.ResolveUrl( currentStep.UserControl ) ));
step.Value = currentStep.Alias;
next.CommandArgument = currentStep.Alias;
lt_header.Text = currentStep.Name;
}
protected void onNextCommand(object sender, CommandEventArgs e)
{
string currentStep = (string)e.CommandArgument;
InstallerStep _s = InstallerSteps().GotoNextStep(currentStep);
Response.Redirect("?installStep=" + _s.Alias);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
_installStep = helper.Request("installStep");
//if this is not an upgrade we will log in with the default user.
if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim())) {
try {
ensureContext();
} catch {
Response.Redirect(SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl));
}
InitializeComponent();
base.OnInit(e);
//set the first step to upgrade.
if (string.IsNullOrEmpty(_installStep))
_installStep = "upgrade";
//we might override the beginning step here
_installStep = helper.Request("installStep");
InstallerStep currentStep;
//if this is not an upgrade we will log in with the default user.
if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim())) {
try {
ensureContext();
} catch {
Response.Redirect(SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl));
}
}
//set the first step to upgrade.
if (string.IsNullOrEmpty(_installStep))
_installStep = "upgrade";
// empty / security check: only controls inside steps folder allowed
if (_installStep == "" || _installStep.Contains("/"))
_installStep = "welcome";
}
PlaceHolderStep.Controls.Add(new System.Web.UI.UserControl().LoadControl( IOHelper.ResolveUrl( SystemDirectories.Install ) + "/steps/" + _installStep + ".ascx"));
if (!string.IsNullOrEmpty(_installStep) && InstallerSteps().StepExists(_installStep))
currentStep = InstallerSteps().Get(_installStep);
else
currentStep = InstallerSteps().FirstAvailableStep();
//if the step we are loading is complete, we will continue to the next one if it's set to auto redirect
if (currentStep.Completed() && currentStep.MoveToNextStepAutomaticly)
currentStep = InstallerSteps().FirstAvailableStep();
loadContent(currentStep);
}
/// <summary>
@@ -94,34 +115,46 @@ namespace umbraco.presentation.install
}
#endregion
private static InstallerStepCollection InstallerSteps()
{
InstallerStepCollection ics = new InstallerStepCollection();
ics.Add(new install.steps.Definitions.License());
ics.Add(new install.steps.Definitions.FilePermissions());
ics.Add(new install.steps.Definitions.Database());
//ics.Add(new install.steps.Definitions.DefaultUser());
ics.Add(new install.steps.Definitions.TheEnd());
return ics;
}
/*
protected void prepareNextButton()
{
switch (step.Value)
{
case "welcome": case "upgrade":
step.Value = "license";
loadContent();
break;
case "license":
step.Value = "detect";
loadContent();
break;
case "detect":
// upgrade!
if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim()))
step.Value = "renaming";
else
step.Value = "validatePermissions";
case "welcome": case "upgrade":
step.Value = "license";
loadContent();
break;
case "license":
step.Value = "detect";
loadContent();
break;
case "detect":
// upgrade!
if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim()))
step.Value = "renaming";
else
step.Value = "validatePermissions";
loadContent();
break;
case "upgradeIndex":
step.Value = "validatePermissions";
loadContent();
break;
case "renaming" :
step.Value = "validatePermissions";
loadContent();
break;
case "renaming" :
step.Value = "validatePermissions";
loadContent();
break;
case "validatePermissions":
step.Value = "defaultUser";
loadContent();
@@ -136,6 +169,6 @@ namespace umbraco.presentation.install
default:
break;
}
}
}*/
}
}
+11 -11
View File
@@ -21,15 +21,6 @@ namespace umbraco.presentation.install {
/// </remarks>
protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader;
/// <summary>
/// CssInclude1 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 CssInclude1;
/// <summary>
/// CssInclude2 control.
/// </summary>
@@ -75,6 +66,15 @@ namespace umbraco.presentation.install {
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude2;
/// <summary>
/// JsInclude5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude5;
/// <summary>
/// Form1 control.
/// </summary>
@@ -94,13 +94,13 @@ namespace umbraco.presentation.install {
protected global::System.Web.UI.ScriptManager umbracoScriptManager;
/// <summary>
/// Panel1 control.
/// lt_header control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.UmbracoPanel Panel1;
protected global::System.Web.UI.WebControls.Literal lt_header;
/// <summary>
/// PlaceHolderStep control.
@@ -0,0 +1 @@

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
using umbraco.IO;
using umbraco.DataLayer.Utility.Installer;
using umbraco.DataLayer;
namespace umbraco.presentation.install.steps.Definitions
{
public class Database : InstallerStep
{
public override string Alias
{
get { return "database"; }
}
public override string Name
{
get { return "Database configuration"; }
}
public override string UserControl
{
get { return SystemDirectories.Install + "/steps/database.ascx"; }
}
public override bool HideNextButtonUntillCompleted
{
get
{
return false;
}
}
public override bool MoveToNextStepAutomaticly
{
get
{
return true;
}
}
//here we determine if the installer should skip this step...
public override bool Completed()
{
bool retval = false;
IInstallerUtility m_Installer = BusinessLogic.Application.SqlHelper.Utility.CreateInstaller();
retval = m_Installer.IsLatestVersion;
m_Installer = null;
return retval;
}
}
}
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
public class DefaultUser : InstallerStep
{
public override string Alias
{
get { return "defaultUser"; }
}
public override string Name
{
get { return "Default user"; }
}
public override bool HideNextButtonUntillCompleted
{
get
{
return false;
}
}
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/defaultuser.ascx"; }
}
public override bool Completed()
{
BusinessLogic.User u = BusinessLogic.User.GetUser(0);
if (u.NoConsole || u.Disabled)
return true;
if (u.GetPassword() != "default")
return true;
return false;
}
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
public class FilePermissions : InstallerStep
{
public override string Alias
{
get { return "filepermissions"; }
}
public override string Name
{
get { return "Confirm permissions"; }
}
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/validatepermissions.ascx"; }
}
public override bool Completed()
{
return utills.FilePermissions.RunFilePermissionTestSuite();
}
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
public class Skinning : InstallerStep
{
public override string Alias
{
get { return "skinning"; }
}
public override string Name
{
get { return "Configure your site"; }
}
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/skinning.ascx"; }
}
public override bool Completed()
{
return false;
}
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
public class TheEnd : InstallerStep
{
public override string Alias
{
get { return "theend"; }
}
public override string Name
{
get { return "thats all folks"; }
}
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/theend.ascx"; }
}
public override bool Completed()
{
return false;
}
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
public class License : InstallerStep
{
public override string Alias
{
get { return "license"; }
}
public override string Name
{
get { return "License"; }
}
public override bool HideNextButtonUntillCompleted
{
get
{
return false;
}
}
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/license.ascx"; }
}
public override bool Completed()
{
return false;
}
}
}
@@ -0,0 +1,31 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="loadStarterKitDesigns.ascx.cs" Inherits="umbraco.presentation.install.steps.Skinning.loadStarterKitDesigns" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<asp:Panel id="pl_loadStarterKitDesigns" runat="server">
<asp:Repeater ID="rep_starterKitDesigns" runat="server">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:LinkButton ID="bt_selectKit" runat="server" onclick="SelectStarterKitDesign" CommandArgument="<%# ((Skin)Container.DataItem).RepoGuid %>">
<%# ((Skin)Container.DataItem).Text %>
</asp:LinkButton>
<br />
<img src="<%# ((Skin)Container.DataItem).Thumbnail %>" />
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</asp:Panel>
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.BusinessLogic;
namespace umbraco.presentation.install.steps.Skinning
{
public partial class loadStarterKitDesigns : System.Web.UI.UserControl
{
public Guid StarterKitGuid { get; set; }
private cms.businesslogic.packager.repositories.Repository repo;
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
public loadStarterKitDesigns()
{
repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (repo.HasConnection())
{
try
{
rep_starterKitDesigns.DataSource = repo.Webservice.Skins(StarterKitGuid.ToString());
rep_starterKitDesigns.DataBind();
}
catch (Exception ex)
{
Log.Add(LogTypes.Debug, -1, ex.ToString());
ShowConnectionError();
}
}
else
{
ShowConnectionError();
}
}
private void ShowConnectionError()
{
uicontrols.Feedback fb = new global::umbraco.uicontrols.Feedback();
fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
fb.Text = "<strong>No connection to repository.</strong> Starter Kits Designs could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'";
pl_loadStarterKitDesigns.Controls.Clear();
pl_loadStarterKitDesigns.Controls.Add(fb);
}
protected void SelectStarterKitDesign(object sender, EventArgs e)
{
Guid kitGuid = new Guid(((LinkButton)sender).CommandArgument);
cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer();
if (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.InstallBusinessLogic(pID, tempFile);
p.InstallCleanUp(pID, tempFile);
library.RefreshContent();
//((skinning)Parent.Parent.Parent).showStarterKitDesigns(kitGuid);
}
else
{
ShowConnectionError();
}
}
}
}
@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <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.install.steps.Skinning {
public partial class loadStarterKitDesigns {
/// <summary>
/// pl_loadStarterKitDesigns 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.Panel pl_loadStarterKitDesigns;
/// <summary>
/// rep_starterKitDesigns 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.Repeater rep_starterKitDesigns;
}
}
@@ -0,0 +1,27 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="loadStarterKits.ascx.cs" Inherits="umbraco.presentation.install.steps.Skinning.loadStarterKits" %>
<%@ Import Namespace="umbraco.cms.businesslogic.packager.repositories" %>
<asp:Panel id="pl_loadStarterKits" runat="server">
<asp:Repeater ID="rep_starterKits" runat="server">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:LinkButton ID="bt_selectKit" runat="server" onclick="SelectStarterKit" CommandArgument="<%# ((Package)Container.DataItem).RepoGuid %>">
<%# ((Package)Container.DataItem).Text %>
</asp:LinkButton>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</asp:Panel>
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.BusinessLogic;
using umbraco.IO;
using System.IO;
namespace umbraco.presentation.install.steps.Skinning
{
public partial class loadStarterKits : System.Web.UI.UserControl
{
private cms.businesslogic.packager.repositories.Repository repo;
private string repoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66";
public loadStarterKits()
{
repo = cms.businesslogic.packager.repositories.Repository.getByGuid(repoGuid);
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (repo.HasConnection())
{
try
{
rep_starterKits.DataSource = repo.Webservice.StarterKits();
rep_starterKits.DataBind();
}
catch (Exception ex)
{
Log.Add(LogTypes.Debug, -1, ex.ToString());
ShowConnectionError();
}
}
else
{
ShowConnectionError();
}
}
private void ShowConnectionError()
{
uicontrols.Feedback fb = new global::umbraco.uicontrols.Feedback();
fb.type = global::umbraco.uicontrols.Feedback.feedbacktype.error;
fb.Text = "<strong>No connection to repository.</strong> Starter Kits could not be fetched from the repository as there was no connection to: '" + repo.RepositoryUrl + "'";
pl_loadStarterKits.Controls.Clear();
pl_loadStarterKits.Controls.Add(fb);
}
protected void SelectStarterKit(object sender, EventArgs e)
{
Guid kitGuid = new Guid(((LinkButton)sender).CommandArgument);
cms.businesslogic.packager.Installer installer = new cms.businesslogic.packager.Installer();
if (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.InstallBusinessLogic(pID, tempFile);
p.InstallCleanUp(pID, tempFile);
library.RefreshContent();
((skinning)Parent.Parent.Parent).showStarterKitDesigns(kitGuid);
}
else
{
ShowConnectionError();
}
}
}
}
@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <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.install.steps.Skinning {
public partial class loadStarterKits {
/// <summary>
/// pl_loadStarterKits 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.Panel pl_loadStarterKits;
/// <summary>
/// rep_starterKits 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.Repeater rep_starterKits;
}
}
@@ -1,4 +1,4 @@
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="detect.ascx.cs" Inherits="umbraco.presentation.install.steps.detect"
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="database.ascx.cs" Inherits="umbraco.presentation.install.steps.detect"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<h1>Step 2/5: Database configuration</h1>
<asp:Panel ID="settings" runat="server" Visible="true">
@@ -1,11 +1,14 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="license.ascx.cs" Inherits="umbraco.presentation.install.steps.license" %>
<h1>
Step 1/5 Accept license</h1>
<h2>
Accept the license for umbraco CMS</h2>
<div class="abstract">
<p>
By clicking the next button (or modifying the umbracoConfigurationStatus in web.config),
you accept the license for this software as specified in the box below.</p>
<div style="border: 1px solid #ccc; padding: 0px; width: 642px; height: 355px; overflow: auto;">
<div style="padding: 10px;">
</div>
<div id="licenseText">
<a name="mit"></a>
<h3>
The License (MIT):</h3>
@@ -30,9 +33,6 @@
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p>&nbsp;
</p>
<p>
(That's all. That didn't hurt, did it?)</p>
</div>
<p>That's all. That didn't hurt, did it?)</p>
</div>
@@ -0,0 +1,24 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="skinning.ascx.cs" Inherits="umbraco.presentation.install.steps.skinning" %>
<!-- Choose starter kit -->
<asp:Panel ID="pl_starterKit" Runat="server" Visible="True">
<div id="starterKits">
<asp:PlaceHolder ID="ph_starterKits" runat="server" />
</div>
</asp:Panel>
<asp:Panel ID="pl_starterKitDesign" Runat="server" Visible="True">
<div id="starterKitDesigns">
<asp:PlaceHolder ID="ph_starterKitDesigns" runat="server" />
</div>
</asp:Panel>
<!-- Choose starter kit design -->
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.IO;
namespace umbraco.presentation.install.steps
{
public partial class skinning : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (string.IsNullOrEmpty(Request.QueryString["starterKit"]))
showStarterKits();
else
showStarterKitDesigns(new Guid(Request.QueryString["starterKit"]));
}
private void showStarterKits()
{
ph_starterKits.Controls.Add(new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKits.ascx"));
pl_starterKit.Visible = true;
pl_starterKitDesign.Visible = false;
}
public void showStarterKitDesigns(Guid starterKitGuid)
{
Skinning.loadStarterKitDesigns ctrl = (Skinning.loadStarterKitDesigns)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx");
ctrl.StarterKitGuid = starterKitGuid;
ph_starterKitDesigns.Controls.Add(ctrl);
pl_starterKit.Visible = false;
pl_starterKitDesign.Visible = true;
}
}
}
@@ -0,0 +1,51 @@
//------------------------------------------------------------------------------
// <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.install.steps {
public partial class skinning {
/// <summary>
/// pl_starterKit 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.Panel pl_starterKit;
/// <summary>
/// ph_starterKits 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_starterKits;
/// <summary>
/// pl_starterKitDesign 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.Panel pl_starterKitDesign;
/// <summary>
/// ph_starterKitDesigns 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_starterKitDesigns;
}
}
+16 -191
View File
@@ -1,201 +1,26 @@
body, input, select
{
font-size: 11px;
font-family: "Trebuchet MS" , Verdana, Arial, "Lucida Grande";
font-size: 12px;
font-family: Calibri, "Trebuchet MS" , Verdana, Arial, "Lucida Grande";
}
body
{
width: 100%;
text-align: center;
padding-top: 25px;
margin: 0px;
background: no-repeat #fff url(images/logo_type.png) center 20px;
}
#Panel1_content
{
margin-left: 1px;
background: url(images/background.png) no-repeat bottom center;
width: 100%;
overflow: hidden;
}
#Panel1_content p
{
font-size: 11px;
line-height: 15px;
}
#buttons
{
position: absolute;
bottom: 5px;
width: 248px;
margin-left: 400px;
}
#buttons #next
{
float: right;
}
#buttons #back
{
float: left;
}
#loadingBar
{
visibility: hidden;
margin-left: -180px;
}
#loadingBar img
{
width: 220px;
}
#contentScroll
{
overflow: auto;
width: 100%;
height: 465px;
padding-right: 7px;
}
h1
{
font-size: 2em;
margin-top: 5px;
margin-bottom: 5px;
}
h2
{
font-size: 1.4em;
margin-top: 5px;
margin-bottom: 5px;
}
.error, .notice, .success
{
padding: .8em;
padding-top: 0em;
padding-bottom: 0em;
margin-bottom: .5em;
border: 2px solid #ddd;
}
.error
{
background: #FBE3E4;
color: #8a1f11;
border-color: #FBC2C4;
}
.notice
{
background: #FFF6BF;
color: #514721;
border-color: #FFD324;
}
.success
{
background: #E6EFC2;
color: #264409;
border-color: #C6D880;
}
.error a
{
color: #8a1f11;
}
.notice a
{
color: #514721;
}
.success a
{
color: #264409;
}
.errormessage
{
color: #8a1f11;
}
#videos
{
padding: 0px;
width: 400px;
text-align: center;
margin: auto;
font-size: 11px;
}
#videos td
{
text-align: center;
}
#videos a
{
color: #666;
text-decoration: none;
}
#videos img
{
padding: 1px;
border: none;
display: block;
margin: auto;
}
#videos.single
{
margin: 0px;
width: 150px;
}
#nitros
{
margin: 0;
}
#nitros h2
{
font-size: 1.2em;
}
#nitros h3
{
font-size: 1em;
margin-bottom: 0px;
margin-top: 0px;
}
#nitros .umbNitroList input
{
float: left;
}
#nitros .umbNitroList div.nitro
{
float: left;
padding: 3px 0px 5px 10px;
clear: right;
}
ol.form
{
list-style: none;
margin: 0;
padding: 5px;
}
ol.form li
{
padding: 3px 0 5px 0;
}
ol.form label
{
width: 130px;
float: left;
clear: both;
}
ol.form .textfield
{
width: 200px;
}
#list1a a.accordianOpener{cursor: pointer; font-size: 14px; font-weight: bold; display: block; padding: 5px; text-decoration: none;}
#list1a a.accordianOpener small{display: block;}
#list1a div.accordianContainer{border-bottom: 1px solid #D9D7D7; height: auto; overflow: auto; display: block; clear: both;}
#list1a .nitroCB{display: block; padding: 2px; margin: 0px 0px 5px 20px; clear: both;}
#list1a .nitroCB small{clear: both; display: block;}
#list1a input{float: left; margin: 0px 10px 20px 0px;}
#list1a div.nitro{float: left; padding: 0px 10px 0px 0px; width: 90%;}
#list1a div.nitro h3{padding: 0px; margin: 0px; line-height: 14px;}
#newsLetterForm{padding:10px; margin: 0px 0px 0px 10px;}
#newsLetterForm input.text{border: 1px #ccc solid; background: #fff; padding: 3px; margin:0px 0px 7px 0px; width: 200px; clear: right;}
#newsLetterForm label{padding: 5px; width: 70px; display: block; float: left; clear: left;}
#newsLetterForm p{padding-left: 80px;} #newsLetterForm a{color: Blue; text-decoration: underline;}
#newsLetterResponse{padding:10px; margin: 0px 0px 0px 10px; color: #264409;}
input.errorField{background: #FBE3E4 !Important; color: #8A1F11 !Important; border-color: #FBC2C4 !Important}
h1,h2,h3,h4,h5{font-weight: normal; }
h1{font-size: 2.5em; border-bottom: 1px solid #eaeaea; padding-bottom: 7px; margin-bottom: 7px;}
#main{text-align: left; width: 900px; margin: auto; margin-top: 120px;}
#buttons{text-align: center; position: relative; border-top: 1px solid #eaeaea; margin-top: 40px;}
#buttons img{margin: auto; margin-top: 15px;}
#buttons .next{position: absolute; top: 10px; right: 10px;}
@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.IO;
using System.IO;
namespace umbraco.presentation.install.utills
{
public class FilePermissions
{
public static string[] permissionDirs = { SystemDirectories.Css, SystemDirectories.Config, SystemDirectories.Data, SystemDirectories.Media, SystemDirectories.Masterpages, SystemDirectories.Xslt, SystemDirectories.Usercontrols, SystemDirectories.Preview };
public static string[] permissionFiles = { };
public static string[] packagesPermissionsDirs = { SystemDirectories.Bin, SystemDirectories.Umbraco, SystemDirectories.Usercontrols, SystemDirectories.Packages };
public static bool RunFilePermissionTestSuite()
{
Dictionary<string, string> newReport = new Dictionary<string, string>();
if (!TestDirectories(permissionDirs, ref newReport))
return false;
if (!TestDirectories(packagesPermissionsDirs, ref newReport))
return false;
if (!TestFiles(permissionFiles, ref newReport))
return false;
if (!TestContentXml(ref newReport))
return false;
if (!TestFolderCreation(SystemDirectories.Media, ref newReport))
return false;
return true;
}
public static bool TestDirectories(string[] directories, ref Dictionary<string, string> errorReport)
{
bool succes = true;
foreach (string dir in permissionDirs)
{
bool result = SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
if (!result)
{
succes = false;
if (errorReport != null)
errorReport.Add(dir, "Missing permissions, cannot create new files");
}
}
return succes;
}
public static bool TestFiles(string[] files, ref Dictionary<string,string> errorReport)
{
bool succes = true;
foreach (string file in permissionFiles)
{
bool result = OpenFileForWrite(IOHelper.MapPath(file));
if (!result)
{
if (errorReport != null)
errorReport.Add(file, "Missing write permissions");
succes = false;
}
}
return succes;
}
public static bool TestFolderCreation(string folder, ref Dictionary<string,string> errorReport)
{
try
{
string tempDir = IOHelper.MapPath(folder + "/testCreatedByConfigWizard");
Directory.CreateDirectory(tempDir);
Directory.Delete(tempDir);
return true;
}
catch
{
if (errorReport != null)
errorReport.Add(folder, "Could not create sub-directory");
return false;
}
}
public static bool TestContentXml(ref Dictionary<string, string> errorReport)
{
// Test umbraco.xml file
try
{
content.Instance.PersistXmlToFile();
return true;
}
catch
{
if(errorReport != null)
errorReport.Add(SystemFiles.ContentCacheXml, "Could not persist content cache");
return false;
}
}
private static string successOrFailure(bool result)
{
if (result)
return "Success";
else
return "Failure";
}
private static bool SaveAndDeleteFile(string file)
{
try
{
//first check if the directory of the file exists, and if not try to create that first.
FileInfo fi = new FileInfo(file);
if (!fi.Directory.Exists)
{
fi.Directory.Create();
}
File.WriteAllText(file,
"This file has been created by the umbraco configuration wizard. It is safe to delete it!");
File.Delete(file);
return true;
}
catch
{
return false;
}
}
private static bool OpenFileForWrite(string file)
{
try
{
File.AppendText(file).Close();
}
catch
{
return false;
}
return true;
}
}
}
+10 -3
View File
@@ -31,6 +31,8 @@ namespace umbraco
private int pageID;
private Guid pageVersion;
private int template;
private Hashtable elements = new Hashtable();
private StringBuilder pageContent = new StringBuilder();
private Control pageContentControl = new Control();
@@ -70,11 +72,14 @@ namespace umbraco
string sValue = p.Value!=null ? p.Value.ToString() : String.Empty;
elements.Add(p.PropertyType.Alias, sValue);
}
template = d.Template;
HttpContext.Current.Trace.Write("umbracoPage",
"Pagedata loaded for " + pageName + " (ID: " + pageID.ToString() +
", Version: " + pageVersion.ToString() + ")");
// RenderPage(template);
//RenderPage(template);
}
private void populatePageData(int pageID, string pageName, int nodeType, string nodeTypeAlias, string writerName, string creatorName,
@@ -191,6 +196,7 @@ namespace umbraco
{
}
HttpContext.Current.Trace.Write("umbracoPage", "testing altTemplate");
// Check for alternative template
if (HttpContext.Current.Items["altTemplate"] != null &&
HttpContext.Current.Items["altTemplate"].ToString() != "")
@@ -218,7 +224,8 @@ namespace umbraco
HttpContext.Current.Trace.Warn("umbracoPage", "No template defined");
}
}
// Load all page elements
string xpath = UmbracoSettings.UseLegacyXmlSchema ? "./data" : "./* [not(@id)]";
foreach (XmlNode dataNode in xmlNode.SelectNodes(xpath))
@@ -381,4 +388,4 @@ namespace umbraco
#endregion
}
}
}
+43 -2
View File
@@ -63,6 +63,39 @@ namespace umbraco {
}
}
//Support for template folders, if a alternative skin folder is requested
//we will try to look for template files in another folder
public string AlternateMasterPageFile(string templateFolder)
{
string file = TemplateAlias.Replace(" ", "") + ".master";
string path = SystemDirectories.Masterpages + "/" + templateFolder + "/" + file;
//if it doesn't exists then we return the normal file
if (!System.IO.File.Exists(IOHelper.MapPath(VirtualPathUtility.ToAbsolute(path)))){
string originalPath = IOHelper.MapPath(VirtualPathUtility.ToAbsolute(MasterPageFile));
string copyPath = IOHelper.MapPath(VirtualPathUtility.ToAbsolute(path));
FileStream fs = new FileStream(originalPath, FileMode.Open, FileAccess.ReadWrite);
StreamReader f = new StreamReader(fs);
String newfile = f.ReadToEnd();
f.Close();
fs.Close();
newfile = newfile.Replace("MasterPageFile=\"~/masterpages/", "MasterPageFile=\"");
fs = new FileStream(copyPath, FileMode.Create, FileAccess.Write);
StreamWriter replacement = new StreamWriter(fs);
replacement.Write(newfile);
replacement.Close();
}
return path;
}
public string TemplateAlias {
get { return _templateAlias; }
}
@@ -383,13 +416,21 @@ namespace umbraco {
#region constructors
public static string GetMasterPageName(int templateID) {
public static string GetMasterPageName(int templateID)
{
return GetMasterPageName(templateID, null);
}
public static string GetMasterPageName(int templateID, string templateFolder) {
template t = (template)templateCache["template" + templateID];
if (t == null)
t = new template(templateID);
if (t != null)
return t.MasterPageFile;
if (!string.IsNullOrEmpty(templateFolder))
return t.AlternateMasterPageFile(templateFolder);
else
return t.MasterPageFile;
else
throw new ArgumentException(String.Format("Template with id '{0}' not found", templateID));
}
@@ -186,6 +186,41 @@
<Compile Include="..\..\LinqToUmbraco\src\umbraco.Linq\Solution Items\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="install\steps\database.ascx.cs">
<DependentUpon>database.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\steps\database.ascx.designer.cs">
<DependentUpon>database.ascx</DependentUpon>
</Compile>
<Compile Include="install\steps\Definitions\Database.cs" />
<Compile Include="install\steps\Definitions\DefaultUser.cs" />
<Compile Include="install\steps\Definitions\FilePermissions.cs" />
<Compile Include="install\steps\Definitions\Skinning.cs" />
<Compile Include="install\steps\Definitions\TheEnd.cs" />
<Compile Include="install\steps\Definitions\Welcome.cs" />
<Compile Include="install\steps\skinning.ascx.cs">
<DependentUpon>skinning.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\steps\skinning.ascx.designer.cs">
<DependentUpon>skinning.ascx</DependentUpon>
</Compile>
<Compile Include="install\steps\Skinning\loadStarterKitDesigns.ascx.cs">
<DependentUpon>loadStarterKitDesigns.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\steps\Skinning\loadStarterKitDesigns.ascx.designer.cs">
<DependentUpon>loadStarterKitDesigns.ascx</DependentUpon>
</Compile>
<Compile Include="install\steps\Skinning\loadStarterKits.ascx.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\steps\Skinning\loadStarterKits.ascx.designer.cs">
<DependentUpon>loadStarterKits.ascx</DependentUpon>
</Compile>
<Compile Include="install\utills\FilePermissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
@@ -242,13 +277,6 @@
<Compile Include="install\steps\defaultUser.ascx.designer.cs">
<DependentUpon>defaultUser.ascx</DependentUpon>
</Compile>
<Compile Include="install\steps\detect.ascx.cs">
<DependentUpon>detect.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\steps\detect.ascx.designer.cs">
<DependentUpon>detect.ascx</DependentUpon>
</Compile>
<Compile Include="install\steps\license.ascx.cs">
<DependentUpon>license.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -519,6 +547,13 @@
<Compile Include="umbraco\create\templateTasks.cs" />
<Compile Include="umbraco\create\userTasks.cs" />
<Compile Include="umbraco\create\XsltTasks.cs" />
<Compile Include="umbraco\dashboard\Settings\Applyskin.ascx.cs">
<DependentUpon>Applyskin.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\dashboard\Settings\Applyskin.ascx.designer.cs">
<DependentUpon>Applyskin.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\dialogs\Preview.aspx.cs">
<DependentUpon>Preview.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -550,6 +585,14 @@
<Compile Include="umbraco\LiveEditing\CanvasClientDependencyProvider.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="umbraco\LiveEditing\Modules\SkinModule\SkinCustomizer.ascx.cs">
<DependentUpon>SkinCustomizer.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\LiveEditing\Modules\SkinModule\SkinCustomizer.ascx.designer.cs">
<DependentUpon>SkinCustomizer.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\LiveEditing\Modules\SkinModule\SkinModule.cs" />
<Compile Include="umbraco\members\MemberSearch.ascx.cs">
<DependentUpon>MemberSearch.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1511,13 +1554,50 @@
<Content Include="config\splashes\booting.aspx" />
<Content Include="config\splashes\noNodes.aspx" />
<Content Include="config\splashes\worker.png" />
<Content Include="install\installer.js" />
<Content Include="install\steps\database.ascx" />
<Content Include="install\steps\renaming.ascx" />
<Content Include="install\steps\skinning.ascx" />
<Content Include="install\steps\Skinning\loadStarterKitDesigns.ascx" />
<Content Include="install\steps\Skinning\loadStarterKits.ascx" />
<Content Include="install\Title.ascx" />
<Content Include="umbraco\dashboard\Settings\Applyskin.ascx" />
<Content Include="umbraco\helpRedirect.aspx" />
<Content Include="umbraco\images\aboutNew.png" />
<Content Include="umbraco\images\loginBg.png" />
<Content Include="umbraco\images\umbracoSplash.png" />
<Content Include="umbraco\LiveEditing\Modules\SkinModule\skin.png" />
<Content Include="umbraco\LiveEditing\Modules\SkinModule\SkinCustomizer.ascx" />
<Content Include="umbraco\LiveEditing\Modules\SkinModule\SkinModule.js" />
<Content Include="umbraco\members\MemberSearch.ascx" />
<Content Include="umbraco_client\colorpicker\css\colorpicker.css" />
<Content Include="umbraco_client\colorpicker\images\blank.gif" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_background.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_hex.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_hsb_b.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_hsb_h.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_hsb_s.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_indic.gif" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_overlay.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_rgb_b.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_rgb_g.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_rgb_r.png" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_select.gif" />
<Content Include="umbraco_client\colorpicker\images\colorpicker_submit.png" />
<Content Include="umbraco_client\colorpicker\images\custom_background.png" />
<Content Include="umbraco_client\colorpicker\images\custom_hex.png" />
<Content Include="umbraco_client\colorpicker\images\custom_hsb_b.png" />
<Content Include="umbraco_client\colorpicker\images\custom_hsb_h.png" />
<Content Include="umbraco_client\colorpicker\images\custom_hsb_s.png" />
<Content Include="umbraco_client\colorpicker\images\custom_indic.gif" />
<Content Include="umbraco_client\colorpicker\images\custom_rgb_b.png" />
<Content Include="umbraco_client\colorpicker\images\custom_rgb_g.png" />
<Content Include="umbraco_client\colorpicker\images\custom_rgb_r.png" />
<Content Include="umbraco_client\colorpicker\images\custom_submit.png" />
<Content Include="umbraco_client\colorpicker\images\select.png" />
<Content Include="umbraco_client\colorpicker\images\select2.png" />
<Content Include="umbraco_client\colorpicker\images\slider.png" />
<Content Include="umbraco_client\colorpicker\js\colorpicker.js" />
<Content Include="web.config.Az-VAIO.xslt" />
<Content Include="umbraco\endPreview.aspx" />
<Content Include="umbraco\js\UmbracoCasingRules.aspx" />
@@ -1980,9 +2060,6 @@
<Content Include="install\steps\defaultUser.ascx">
<SubType>UserControl</SubType>
</Content>
<Content Include="install\steps\detect.ascx">
<SubType>UserControl</SubType>
</Content>
<Content Include="install\steps\theend.ascx">
<SubType>UserControl</SubType>
</Content>
@@ -2028,6 +2105,7 @@
<Content Include="config\ExamineSettings.config" />
<Content Include="config\ExamineIndex.config" />
<Content Include="config\scripting.config" />
<Content Include="config\Skinning.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
@@ -2770,14 +2848,13 @@
<None Include="Web References\org.umbraco.update\UpgradeResult.datasource">
<DependentUpon>Reference.map</DependentUpon>
</None>
<EmbeddedResource Include="install\steps\database.ascx.resx">
<DependentUpon>database.ascx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="install\steps\defaultUser.ascx.resx">
<DependentUpon>defaultUser.ascx.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="install\steps\detect.ascx.resx">
<DependentUpon>detect.ascx.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="install\steps\theend.ascx.resx">
<DependentUpon>theend.ascx.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -14,6 +14,8 @@ using umbraco.BusinessLogic.Actions;
using umbraco.presentation.umbraco.controls;
using ClientDependency.Core;
using umbraco.IO;
using umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule;
using umbraco.cms.businesslogic.skinning;
namespace umbraco.presentation.LiveEditing.Controls
{
/// <summary>
@@ -76,6 +78,16 @@ namespace umbraco.presentation.LiveEditing.Controls
m_Manager.LiveEditingContext.Menu.Add(new UnpublishModule(m_Manager));
m_Manager.LiveEditingContext.Menu.Add(new DeleteModule(m_Manager));
//m_Manager.LiveEditingContext.Menu.Add(new MacroModule(m_Manager));
//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));
}
}
/// <summary>
@@ -0,0 +1,31 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SkinCustomizer.ascx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.SkinCustomizer" %>
<div id="costumizeSkin" <asp:Literal ID="ltCustomizeSkinStyle" runat="server" Text=""></asp:Literal>>
<div id="dependencies">
<asp:PlaceHolder ID="ph_dependencies" runat="server"></asp:PlaceHolder>
</div>
<p runat="server" id="pChangeSkin">... or <a href="#" onclick="jQuery('#costumizeSkin').hide();jQuery('#changeSkin').show();">change</a> skin</p>
<asp:Button ID="btnOk" runat="server" Text="Ok" onclick="btnOk_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="modalbuton" />
</div>
<div id="changeSkin" <asp:Literal ID="ltChangeSkinStyle" runat="server" Text="style='display:none;'"></asp:Literal>>
<div id="skins">
<asp:PlaceHolder ID="ph_skins" runat="server"></asp:PlaceHolder>
</div>
<p runat="server" id="pCustomizeSkin">... or <a href="#" onclick="jQuery('#changeSkin').hide();jQuery('#costumizeSkin').show();">customize</a> current skin</p>
<asp:Button ID="btnCancelSkin" runat="server" Text="Cancel" CssClass="modalbuton" />
</div>
@@ -0,0 +1,177 @@
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 System.Xml;
using System.Text;
using umbraco.interfaces.skinning;
using umbraco.IO;
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
{
public partial class SkinCustomizer : System.Web.UI.UserControl
{
private Skin ActiveSkin { get; set; }
private List<Dependency> sDependencies = new List<Dependency>();
protected void Page_Load(object sender, EventArgs e)
{
nodeFactory.Node n = nodeFactory.Node.GetCurrent();
ActiveSkin = Skin.CreateFromAlias(Skinning.GetCurrentSkinAlias(n.template));
//load dependencies
if (ActiveSkin != null)
LoadDependencies();
else
{
//show skin selection
pCustomizeSkin.Visible = false;
ltCustomizeSkinStyle.Text = ltChangeSkinStyle.Text;
ltChangeSkinStyle.Text = string.Empty;
}
LoadSkins();
}
protected void LoadSkins()
{
Guid? g = Skinning.StarterKitGuid(nodeFactory.Node.GetCurrent().template);
if (g == null || !Skinning.HasAvailableSkins(nodeFactory.Node.GetCurrent().template))
{
pChangeSkin.Visible = false;
}
else
{
install.steps.Skinning.loadStarterKitDesigns ctrl =
(install.steps.Skinning.loadStarterKitDesigns)new UserControl().LoadControl(SystemDirectories.Install + "/steps/Skinning/loadStarterKitDesigns.ascx");
ctrl.StarterKitGuid = (Guid)g;
ph_skins.Controls.Add(ctrl);
}
}
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 bt_ChangeSkin_Click(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,96 @@
//------------------------------------------------------------------------------
// <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.LiveEditing.Modules.SkinModule {
public partial class SkinCustomizer {
/// <summary>
/// ltCustomizeSkinStyle 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 ltCustomizeSkinStyle;
/// <summary>
/// ph_dependencies 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_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;
/// <summary>
/// btnOk 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 btnOk;
/// <summary>
/// btnCancel 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 btnCancel;
/// <summary>
/// ltChangeSkinStyle 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 ltChangeSkinStyle;
/// <summary>
/// ph_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.PlaceHolder ph_skins;
/// <summary>
/// pCustomizeSkin 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 pCustomizeSkin;
/// <summary>
/// btnCancelSkin 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 btnCancelSkin;
}
}
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.presentation.LiveEditing.Modules;
using ClientDependency.Core;
using System.Web.UI.WebControls;
using umbraco.presentation.LiveEditing.Controls;
using umbraco.IO;
using System.Web.UI;
namespace umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule
{
[ClientDependency(200, ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient")]
[ClientDependency(200, ClientDependencyType.Css, "modal/style.css", "UmbracoClient")]
public class SkinModule : BaseModule
{
protected ImageButton m_SkinButton = new ImageButton();
protected Panel m_SkinModal;
public SkinModule(LiveEditingManager manager)
: base(manager)
{ }
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
EnsureChildControls();
}
protected override void CreateChildControls()
{
base.CreateChildControls();
m_SkinModal = new Panel();
m_SkinModal.ID = "LeSkinModal";
m_SkinModal.Attributes.Add("style", "display: none");
m_SkinModal.Controls.Add(new UserControl().LoadControl(String.Format("{0}/LiveEditing/Modules/SKinModule/SkinCustomizer.ascx", SystemDirectories.Umbraco)));
Controls.Add(m_SkinModal);
m_SkinButton.ID = "LeSkinButton";
m_SkinButton.CssClass = "button";
m_SkinButton.ToolTip = ui.GetText("skin");
m_SkinButton.ImageUrl = String.Format("{0}/LiveEditing/Modules/SKinModule/skin.png", SystemDirectories.Umbraco);
m_SkinButton.OnClientClick = "setTasksClientScripts();jQuery('#" + m_SkinModal.ClientID + @"').ModalWindowShow('" + ui.GetText("skin") + "',true,500,400,50,0, ['.modalbuton'], null);return false;";
Controls.Add(m_SkinButton);
}
}
}
@@ -0,0 +1 @@
/********************* Live Editing SkinModule functions *********************/
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -24,6 +24,7 @@ using umbraco.cms.businesslogic.template;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.presentation.Trees;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.skinning;
namespace umbraco
{
@@ -41,13 +42,133 @@ namespace umbraco
{
Javascript.Append(
@"
function openTemplate(id) {
UmbClientMgr.contentFrame('settings/editTemplate.aspx?templateID=' + id);
}
");
function openTemplate(id) {
UmbClientMgr.contentFrame('settings/editTemplate.aspx?templateID=' + id);
}
function openSkin(id) {
UmbClientMgr.contentFrame('settings/editSkin.aspx?skinID=' + id);
}
");
}
public override void Render(ref XmlTree tree)
{
string folder = umbraco.library.Request("folder");
string folderPath = umbraco.library.Request("folderPath");
if (!string.IsNullOrEmpty(folder))
RenderTemplateFolderItems(folder, folderPath, ref tree);
else
{
if(UmbracoSettings.EnableTemplateFolders)
RenderTemplateFolders(ref tree);
RenderTemplates(ref tree);
}
}
private void RenderTemplateFolderItems(string folder, string folderPath, ref XmlTree tree)
{
string relPath = IO.SystemDirectories.Masterpages + "/" + folder;
if (!string.IsNullOrEmpty(folderPath))
relPath += folderPath;
string fullPath = IO.IOHelper.MapPath(relPath);
foreach (string dir in System.IO.Directory.GetDirectories(fullPath))
{
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(dir);
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.Menu.Clear();
xNode.Menu.Add(ActionRefresh.Instance);
xNode.NodeID = "-1";
xNode.Text = directoryInfo.Name;
xNode.HasChildren = true;
xNode.Icon = "folder.gif";
xNode.OpenIcon = "folder_o.gif";
xNode.Source = GetTreeServiceUrl(directoryInfo.Name) + "&folder=" + folder + "&folderPath=" + folderPath + "/" + directoryInfo.Name;
tree.Add(xNode);
}
foreach (string file in System.IO.Directory.GetFiles(fullPath))
{
System.IO.FileInfo fileinfo = new FileInfo(file);
string ext = fileinfo.Extension.ToLower().Trim('.');
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.Menu.Clear();
xNode.Menu.Add(ActionRefresh.Instance);
xNode.NodeID = "-1";
xNode.Text = Path.GetFileName(file);
xNode.HasChildren = false;
xNode.Action = "javascript:openScriptEditor('" + relPath + "/" + Path.GetFileName(file) + "');";
//tree.Add(xNode);
switch (ext)
{
case "master":
xNode.Icon = "settingTemplate.gif";
xNode.OpenIcon = "settingTemplate.gif";
tree.Add(xNode);
break;
case "css":
case "js":
xNode.Icon = "settingsScript.gif";
xNode.OpenIcon = "settingsScript.gif";
tree.Add(xNode);
break;
case "xml":
if (xNode.Text == "skin.xml")
{
xNode.Icon = "settingXml.gif";
xNode.OpenIcon = "settingXml.gif";
tree.Add(xNode);
}
break;
default:
break;
}
//xNode.Source = GetTreeServiceUrl(s.Alias) + "&skin=" + skin + "&path=" + path;
}
}
private void RenderTemplateFolders(ref XmlTree tree)
{
if (base.m_id == -1)
{
List<Skin> skins = Skinning.GetAllSkins();
foreach (Skin s in skins)
{
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = s.Alias;
xNode.Text = s.Name;
xNode.Icon = "folder.gif";
xNode.OpenIcon = "folder_o.gif";
xNode.Source = GetTreeServiceUrl(s.Alias) + "&folder=" + s.Alias;
xNode.HasChildren = true;
xNode.Menu.Clear();
xNode.Menu.Add(ActionRefresh.Instance);
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
if (xNode != null)
{
tree.Add(xNode);
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
}
}
}
}
private void RenderTemplates(ref XmlTree tree)
{
List<Template> templates = null;
if (base.m_id == -1)
@@ -63,9 +184,10 @@ function openTemplate(id) {
xNode.Action = "javascript:openTemplate(" + t.Id + ");";
xNode.Icon = "settingTemplate.gif";
xNode.OpenIcon = "settingTemplate.gif";
xNode.Source = GetTreeServiceUrl(t.Id);
xNode.HasChildren = t.HasChildren;
if (t.HasChildren) {
xNode.Source = GetTreeServiceUrl(t.Id);
xNode.HasChildren = t.HasChildren;
if (t.HasChildren)
{
xNode.Icon = "settingMasterTemplate.gif";
xNode.OpenIcon = "settingMasterTemplate.gif";
}
@@ -76,10 +198,12 @@ function openTemplate(id) {
tree.Add(xNode);
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
}
}
}
protected override void CreateAllowedActions(ref List<IAction> actions) {
actions.Clear();
actions.AddRange(new IAction[] { ActionNew.Instance, ActionDelete.Instance,
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<createUI>
<nodeType alias="initnodeTypes">
<header>Nodetype</header>
@@ -53,10 +53,10 @@
<nodeType alias="contentRecycleBin">
<header>Page</header>
<usercontrol>/create/content.ascx</usercontrol>
<tasks>
<tasks>
<delete assembly="umbraco" type="contentTasks" />
</tasks>
</nodeType>
</nodeType>
<nodeType alias="content">
<header>Page</header>
<usercontrol>/create/content.ascx</usercontrol>
@@ -270,7 +270,6 @@
<delete assembly="umbraco" type="PythonTasks" />
</tasks>
</nodeType>
<nodeType alias="initdlrscripting">
<header>Scripting file</header>
<usercontrol>/create/DLRScripting.ascx</usercontrol>
@@ -278,7 +277,6 @@
<create assembly="umbraco" type="DLRScriptingTasks" />
</tasks>
</nodeType>
<nodeType alias="dlrscripting">
<header>Macro</header>
<usercontrol>/create/DLRScripting.ascx</usercontrol>
@@ -286,7 +284,6 @@
<delete assembly="umbraco" type="DLRScriptingTasks" />
</tasks>
</nodeType>
<nodeType alias="initscripts">
<header>Script file</header>
<usercontrol>/create/script.ascx</usercontrol>
@@ -309,7 +306,6 @@
<delete assembly="umbraco" type="ScriptTasks" />
</tasks>
</nodeType>
<nodeType alias="initpackager">
<header>Package</header>
<usercontrol>/create/simple.ascx</usercontrol>
@@ -346,5 +342,28 @@
<delete assembly="umbraco" type="cms.presentation.user.UserTypeTasks" />
</tasks>
</nodeType>
</createUI>
<nodeType alias="forms">
<header>Forms</header>
<usercontrol>/plugins/umbracocontour/createform.ascx</usercontrol>
<tasks>
<create assembly="Umbraco.Forms.UI" type="Tasks.FormTasks" />
<delete assembly="Umbraco.Forms.UI" type="Tasks.FormTasks" />
</tasks>
</nodeType>
<nodeType alias="formdatasources">
<header>Datasources</header>
<usercontrol>/create/simple.ascx</usercontrol>
<tasks>
<create assembly="Umbraco.Forms.UI" type="Tasks.DataSourceTasks" />
<delete assembly="Umbraco.Forms.UI" type="Tasks.DataSourceTasks" />
</tasks>
</nodeType>
<nodeType alias="formprevaluesource">
<header>Prevalue source</header>
<usercontrol>/create/simple.ascx</usercontrol>
<tasks>
<create assembly="Umbraco.Forms.UI" type="Tasks.PrevalueSourceTasks" />
<delete assembly="Umbraco.Forms.UI" type="Tasks.PrevalueSourceTasks" />
</tasks>
</nodeType>
</createUI>
@@ -80,11 +80,14 @@ namespace umbraco.cms.presentation
{
string control = getFirstText(uc).Trim(' ', '\r', '\n');
string path = IOHelper.FindFile(control);
try
{
Control c = LoadControl(path);
//resolving files from dashboard config which probably does not map to a virtual fi
tab.Controls.Add(LoadControl(path));
tab.Controls.Add(c);
}
catch (Exception ee)
{
@@ -0,0 +1,9 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Applyskin.ascx.cs" Inherits="umbraco.presentation.umbraco.dashboard.Settings.Applyskin" %>
<asp:DropDownList ID="skinpicker" runat="server" />
<asp:Button ID="bt_apply" runat="server" Text="Apply" OnClick="apply" />
<asp:Button ID="bt_rollback" runat="server" Text="Rollback skin" OnClick="rollback" />
@@ -0,0 +1,41 @@
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;
namespace umbraco.presentation.umbraco.dashboard.Settings
{
public partial class Applyskin : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
skinpicker.Items.Add("Choose...");
foreach (Skin s in Skinning.GetAllSkins())
{
skinpicker.Items.Add( new ListItem(s.Name, s.Alias));
}
}
protected void apply(object sender, EventArgs e)
{
if (skinpicker.SelectedIndex > 0)
{
Skin s = Skin.CreateFromAlias(skinpicker.SelectedValue);
Skinning.ActivateAsCurrentSkin(s);
}
}
protected void rollback(object sender, EventArgs e)
{
Template t = Template.GetByAlias("RunwayHomepage");
Skinning.RollbackSkin(t.Id);
}
}
}
@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <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.dashboard.Settings {
public partial class Applyskin {
/// <summary>
/// skinpicker 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 skinpicker;
/// <summary>
/// bt_apply 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 bt_apply;
/// <summary>
/// bt_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.Button bt_rollback;
}
}
@@ -18,6 +18,8 @@ using umbraco.BusinessLogic;
using umbraco.presentation.preview;
using umbraco.cms.businesslogic.web;
using umbraco.presentation;
using umbraco.cms.businesslogic.skinning;
using System.Collections.Generic;
namespace umbraco.cms.presentation
{
@@ -27,7 +29,7 @@ namespace umbraco.cms.presentation
protected System.Web.UI.WebControls.TextBox documentName;
private cms.businesslogic.web.Document _document;
private bool _documentHasPublishedVersion = false;
protected System.Web.UI.WebControls.Literal jsIds;
protected System.Web.UI.WebControls.Literal jsIds;
private LiteralControl dp = new LiteralControl();
private DateTimePicker dpRelease = new DateTimePicker();
private DateTimePicker dpExpire = new DateTimePicker();
@@ -35,7 +37,7 @@ namespace umbraco.cms.presentation
controls.ContentControl cControl;
DropDownList ddlDefaultTemplate = new DropDownList();
uicontrols.Pane publishProps = new uicontrols.Pane();
uicontrols.Pane linkProps = new uicontrols.Pane();
@@ -130,8 +132,12 @@ namespace umbraco.cms.presentation
PlaceHolder template = new PlaceHolder();
cms.businesslogic.web.DocumentType DocumentType = new cms.businesslogic.web.DocumentType(_document.ContentType.Id);
cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));
cControl.PropertiesPane.addProperty(ui.Text("template"), template);
//template picker
cControl.PropertiesPane.addProperty(ui.Text("template"), template);
int defaultTemplate;
if (_document.Template != 0)
defaultTemplate = _document.Template;
@@ -186,14 +192,13 @@ namespace umbraco.cms.presentation
cControl.SaveToPublish += new System.EventHandler(SendToPublish);
// Add panes to property page...
cControl.tpProp.Controls.AddAt(1,publishProps);
cControl.tpProp.Controls.AddAt(2,linkProps);
cControl.tpProp.Controls.AddAt(1, publishProps);
cControl.tpProp.Controls.AddAt(2, linkProps);
// add preview to properties pane too
addPreviewButton(cControl.tpProp.Menu, _document.Id);
}
protected void Page_Load(object sender, System.EventArgs e)
@@ -205,17 +210,18 @@ namespace umbraco.cms.presentation
return;
// clear preview cookie
if (!String.IsNullOrEmpty(StateHelper.GetCookieValue(PreviewContent.PREVIEW_COOKIE_KEY))) {
if (!String.IsNullOrEmpty(StateHelper.GetCookieValue(PreviewContent.PREVIEW_COOKIE_KEY)))
{
PreviewContent.ClearPreviewCookie();
}
if (!IsPostBack)
{
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Open, base.getUser(), _document.Id, "");
ClientTools.SyncTree(_document.Path, false);
ClientTools.SyncTree(_document.Path, false);
}
jsIds.Text = "var umbPageId = " + _document.Id.ToString() + ";\nvar umbVersionId = '" + _document.Version.ToString() + "';\n";
@@ -232,51 +238,56 @@ namespace umbraco.cms.presentation
tp.ErrorHeader = ui.Text("errorHandling", "errorButDataWasSaved");
tp.CloseCaption = ui.Text("close");
}
} else if (Page.IsPostBack) {
}
else if (Page.IsPostBack)
{
// hide validation summaries
foreach (uicontrols.TabPage tp in cControl.GetPanels())
{
tp.ErrorControl.Visible = false;
}
}
//Audit trail...
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Save, base.getUser(), _document.Id, "");
//Audit trail...
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Save, base.getUser(), _document.Id, "");
// Update name
if (_document.Text != cControl.NameTxt.Text)
{
//_refreshTree = true;
_document.Text = cControl.NameTxt.Text;
//newName.Text = _document.Text;
}
// Update name
if (_document.Text != cControl.NameTxt.Text)
{
//_refreshTree = true;
_document.Text = cControl.NameTxt.Text;
//newName.Text = _document.Text;
}
if (dpRelease.DateTime > new DateTime(1753, 1, 1) && dpRelease.DateTime < new DateTime(9999, 12, 31))
_document.ReleaseDate = dpRelease.DateTime;
else
_document.ReleaseDate = new DateTime(1, 1, 1, 0, 0, 0);
if (dpExpire.DateTime > new DateTime(1753, 1, 1) && dpExpire.DateTime < new DateTime(9999, 12, 31))
_document.ExpireDate = dpExpire.DateTime;
else
_document.ExpireDate = new DateTime(1, 1, 1, 0, 0, 0);
// Update default template
if (ddlDefaultTemplate.SelectedIndex > 0)
{
_document.Template = int.Parse(ddlDefaultTemplate.SelectedValue);
}
if (dpRelease.DateTime > new DateTime(1753, 1, 1) && dpRelease.DateTime < new DateTime(9999, 12, 31))
_document.ReleaseDate = dpRelease.DateTime;
else
_document.ReleaseDate = new DateTime(1, 1, 1, 0, 0, 0);
if (dpExpire.DateTime > new DateTime(1753, 1, 1) && dpExpire.DateTime < new DateTime(9999, 12, 31))
_document.ExpireDate = dpExpire.DateTime;
else
_document.ExpireDate = new DateTime(1, 1, 1, 0, 0, 0);
// Run Handler
BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionUpdate.Instance);
_document.Save();
// Update default template
if (ddlDefaultTemplate.SelectedIndex > 0)
{
_document.Template = int.Parse(ddlDefaultTemplate.SelectedValue);
}
// Update the update date
dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString();
if (!cControl.DoesPublish)
ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSavedHeader", null), ui.Text("speechBubbles", "editContentSavedText", null));
ClientTools.SyncTree(_document.Path, true);
// Run Handler
BusinessLogic.Actions.Action.RunActionHandlers(_document, ActionUpdate.Instance);
_document.Save();
// Update the update date
dp.Text = _document.UpdateDate.ToShortDateString() + " " + _document.UpdateDate.ToShortTimeString();
if (!cControl.DoesPublish)
ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentSavedHeader", null), ui.Text("speechBubbles", "editContentSavedText", null));
ClientTools.SyncTree(_document.Path, true);
}
protected void SendToPublish(object sender, System.EventArgs e)
@@ -298,12 +309,13 @@ namespace umbraco.cms.presentation
if (_document.PublishWithResult(base.getUser()))
{
ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "editContentPublishedHeader", null), ui.Text("speechBubbles", "editContentPublishedText", null));
library.UpdateDocumentCache(_document.Id);
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Publish, base.getUser(), _document.Id, "");
littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToString() + "<br/>";
if (base.getUser().GetPermissions(_document.Path).IndexOf("U") > -1)
UnPublish.Visible = true;
@@ -317,7 +329,7 @@ namespace umbraco.cms.presentation
}
else
ClientTools.ShowSpeechBubble(speechBubbleIcon.error, ui.Text("error"), ui.Text("speechBubbles", "editContentPublishedFailedByParent"));
// page cache disabled...
// cms.businesslogic.cache.Cache.ClearCacheObjectTypes("umbraco.page");
@@ -336,7 +348,7 @@ namespace umbraco.cms.presentation
//newPublishStatus.Text = "0";
}
}
private void updateLinks()
{
+1 -2
View File
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -27,21 +27,26 @@ namespace umbraco.cms.presentation.settings.scripts
protected umbraco.uicontrols.PropertyPanel pp_name;
protected umbraco.uicontrols.PropertyPanel pp_path;
private string file;
protected void Page_Load(object sender, System.EventArgs e)
{
String file = Request.QueryString["file"].TrimStart('/');
NameTxt.Text = file;
//need to change the editor type if it is XML
if (file.EndsWith("xml"))
editorSource.CodeBase = umbraco.uicontrols.CodeArea.EditorType.XML;
string path = IOHelper.ResolveUrl(SystemDirectories.Scripts + "/" + file);
string path = "";
if (file.StartsWith("~/"))
path = IOHelper.ResolveUrl(file);
else
path = IOHelper.ResolveUrl(SystemDirectories.Scripts + "/" + file);
lttPath.Text = "<a target='_blank' href='" + path + "'>" + path + "</a>";
//security check... only allow script files
if (path.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Scripts) + "/"))
if (path.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Scripts) + "/") || path.StartsWith(IOHelper.ResolveUrl(SystemDirectories.Masterpages) + "/"))
{
StreamReader SR;
string S;
@@ -69,11 +74,50 @@ namespace umbraco.cms.presentation.settings.scripts
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
file = Request.QueryString["file"].TrimStart('/');
//need to change the editor type if it is XML
if (file.EndsWith("xml"))
editorSource.CodeBase = umbraco.uicontrols.CodeArea.EditorType.XML;
else if (file.EndsWith("master"))
editorSource.CodeBase = umbraco.uicontrols.CodeArea.EditorType.HTML;
uicontrols.MenuIconI save = Panel1.Menu.NewIcon();
save.ImageURL = SystemDirectories.Umbraco + "/images/editor/save.gif";
save.OnClickCommand = "doSubmit()";
save.AltText = "Save File";
if (editorSource.CodeBase == uicontrols.CodeArea.EditorType.HTML)
{
// Editing buttons
Panel1.Menu.InsertSplitter();
uicontrols.MenuIconI umbField = Panel1.Menu.NewIcon();
umbField.ImageURL = UmbracoPath + "/images/editor/insField.gif";
umbField.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550);
umbField.AltText = ui.Text("template", "insertPageField");
// TODO: Update icon
uicontrols.MenuIconI umbDictionary = Panel1.Menu.NewIcon();
umbDictionary.ImageURL = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
umbDictionary.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"), 640, 550);
umbDictionary.AltText = "Insert umbraco dictionary item";
uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
umbMacro.ImageURL = UmbracoPath + "/images/editor/insMacro.gif";
umbMacro.AltText = ui.Text("template", "insertMacro");
umbMacro.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);
// Help
Panel1.Menu.InsertSplitter();
uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon();
helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" , ui.Text("template", "quickGuide"), 600, 580);
helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
helpIcon.AltText = ui.Text("template", "quickGuide");
}
this.Load += new System.EventHandler(Page_Load);
InitializeComponent();
@@ -300,22 +300,33 @@ namespace umbraco.presentation.webservices
string val = contents;
string returnValue = "false";
try
{
string savePath = IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename);
{
string saveOldPath = "";
if (oldName.StartsWith("~/"))
saveOldPath = IOHelper.MapPath(oldName);
else
saveOldPath = IOHelper.MapPath(SystemDirectories.Scripts + "/" + oldName);
string savePath = "";
if (filename.StartsWith("~/"))
savePath = IOHelper.MapPath(filename);
else
savePath = IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename);
//Directory check.. only allow files in script dir and below to be edited
if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Scripts + "/")))
if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Scripts + "/")) || savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Masterpages + "/")))
{
StreamWriter SW;
SW = File.CreateText(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename));
SW = File.CreateText(savePath);
SW.Write(val);
SW.Close();
//deletes the old file
if (filename != oldName) {
string p = IOHelper.MapPath(SystemDirectories.Scripts + "/" + oldName);
if (System.IO.File.Exists(p))
System.IO.File.Delete(p);
if (savePath != saveOldPath)
{
if (System.IO.File.Exists(saveOldPath))
System.IO.File.Delete(saveOldPath);
}
returnValue = "true";
@@ -0,0 +1,162 @@
.colorpicker {
width: 356px;
height: 176px;
overflow: hidden;
position: absolute;
background: url(../images/colorpicker_background.png);
font-family: Arial, Helvetica, sans-serif;
display: none;
z-index:10020;
}
.colorpicker_color {
width: 150px;
height: 150px;
left: 14px;
top: 13px;
position: absolute;
background: #f00;
overflow: hidden;
cursor: crosshair;
}
.colorpicker_color div {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: url(../images/colorpicker_overlay.png);
}
.colorpicker_color div div {
position: absolute;
top: 0;
left: 0;
width: 11px;
height: 11px;
overflow: hidden;
background: url(../images/colorpicker_select.gif);
margin: -5px 0 0 -5px;
}
.colorpicker_hue {
position: absolute;
top: 13px;
left: 171px;
width: 35px;
height: 150px;
cursor: n-resize;
}
.colorpicker_hue div {
position: absolute;
width: 35px;
height: 9px;
overflow: hidden;
background: url(../images/colorpicker_indic.gif) left top;
margin: -4px 0 0 0;
left: 0px;
}
.colorpicker_new_color {
position: absolute;
width: 60px;
height: 30px;
left: 213px;
top: 13px;
background: #f00;
}
.colorpicker_current_color {
position: absolute;
width: 60px;
height: 30px;
left: 283px;
top: 13px;
background: #f00;
}
.colorpicker input {
background-color: transparent;
border: 1px solid transparent;
position: absolute;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #898989;
top: 4px;
right: 11px;
text-align: right;
margin: 0;
padding: 0;
height: 11px;
}
.colorpicker_hex {
position: absolute;
width: 72px;
height: 22px;
background: url(../images/colorpicker_hex.png) top;
left: 212px;
top: 142px;
}
.colorpicker_hex input {
right: 6px;
}
.colorpicker_field {
height: 22px;
width: 62px;
background-position: top;
position: absolute;
}
.colorpicker_field span {
position: absolute;
width: 12px;
height: 22px;
overflow: hidden;
top: 0;
right: 0;
cursor: n-resize;
}
.colorpicker_rgb_r {
background-image: url(../images/colorpicker_rgb_r.png);
top: 52px;
left: 212px;
}
.colorpicker_rgb_g {
background-image: url(../images/colorpicker_rgb_g.png);
top: 82px;
left: 212px;
}
.colorpicker_rgb_b {
background-image: url(../images/colorpicker_rgb_b.png);
top: 112px;
left: 212px;
}
.colorpicker_hsb_h {
background-image: url(../images/colorpicker_hsb_h.png);
top: 52px;
left: 282px;
}
.colorpicker_hsb_s {
background-image: url(../images/colorpicker_hsb_s.png);
top: 82px;
left: 282px;
}
.colorpicker_hsb_b {
background-image: url(../images/colorpicker_hsb_b.png);
top: 112px;
left: 282px;
}
.colorpicker_submit {
position: absolute;
width: 22px;
height: 22px;
background: url(../images/colorpicker_submit.png) top;
left: 322px;
top: 142px;
overflow: hidden;
}
.colorpicker_focus {
background-position: center;
}
.colorpicker_hex.colorpicker_focus {
background-position: bottom;
}
.colorpicker_submit.colorpicker_focus {
background-position: bottom;
}
.colorpicker_slider {
background-position: bottom;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More