Merged in changes from 4.9 branch regarding apps / trees

This commit is contained in:
Matt@MBP13-PC
2012-07-17 08:26:48 -01:00
parent 1c4edfb84a
commit e7d81b6a6e
4 changed files with 188 additions and 315 deletions

View File

@@ -9,8 +9,6 @@ using System.Web;
using System.Xml.Linq;
using umbraco.DataLayer;
using umbraco.IO;
using umbraco.interfaces;
using umbraco.BusinessLogic.Utils;
using System.Runtime.CompilerServices;
using umbraco.businesslogic;
@@ -21,30 +19,47 @@ namespace umbraco.BusinessLogic
/// </summary>
public class Application
{
private static ISqlHelper _sqlHelper;
private static ISqlHelper _sqlHelper;
private const string CACHE_KEY = "ApplicationCache";
private const string CacheKey = "ApplicationCache";
internal const string AppConfigFileName = "applications.config";
private static string _appConfig;
private static readonly object Locker = new object();
private static readonly string _appConfig =
IOHelper.MapPath(SystemDirectories.Config + "/applications.config");
private static readonly object m_Locker = new object();
/// <summary>
/// gets/sets the application.config file path
/// </summary>
/// <remarks>
/// The setter is generally only going to be used in unit tests, otherwise it will attempt to resolve it using the IOHelper.MapPath
/// </remarks>
internal static string AppConfigFilePath
{
get
{
if (string.IsNullOrWhiteSpace(_appConfig))
{
_appConfig = IOHelper.MapPath(SystemDirectories.Config + "/" + AppConfigFileName);
}
return _appConfig;
}
set { _appConfig = value; }
}
/// <summary>
/// The cache storage for all applications
/// </summary>
private static List<Application> Apps
internal static List<Application> Apps
{
get
{
//ensure cache exists
if (HttpRuntime.Cache[CACHE_KEY] == null)
ReCache();
return HttpRuntime.Cache[CACHE_KEY] as List<Application>;
{
//Whenever this is accessed, we need to ensure the cache exists!
EnsureCache();
return HttpRuntime.Cache[CacheKey] as List<Application>;
}
set
{
HttpRuntime.Cache.Insert(CACHE_KEY, value);
HttpRuntime.Cache.Insert(CacheKey, value);
}
}
@@ -74,14 +89,7 @@ namespace umbraco.BusinessLogic
}
}
/// <summary>
/// A static constructor that will cache all application trees
/// </summary>
static Application()
{
//RegisterIApplications();
Cache();
}
/// <summary>
/// Initializes a new instance of the <see cref="Application"/> class.
@@ -154,7 +162,7 @@ namespace umbraco.BusinessLogic
{
get { return _sortOrder; }
set { _sortOrder = value; }
}
}
/// <summary>
/// Creates a new applcation if no application with the specified alias is found.
@@ -187,14 +195,14 @@ namespace umbraco.BusinessLogic
if (!exist)
{
// SqlHelper.ExecuteNonQuery(@"
// insert into umbracoApp
// (appAlias,appIcon,appName, sortOrder)
// values (@alias,@icon,@name,@sortOrder)",
// SqlHelper.CreateParameter("@alias", alias),
// SqlHelper.CreateParameter("@icon", icon),
// SqlHelper.CreateParameter("@name", name),
// SqlHelper.CreateParameter("@sortOrder", sortOrder));
// SqlHelper.ExecuteNonQuery(@"
// insert into umbracoApp
// (appAlias,appIcon,appName, sortOrder)
// values (@alias,@icon,@name,@sortOrder)",
// SqlHelper.CreateParameter("@alias", alias),
// SqlHelper.CreateParameter("@icon", icon),
// SqlHelper.CreateParameter("@name", name),
// SqlHelper.CreateParameter("@sortOrder", sortOrder));
LoadXml(doc =>
{
@@ -212,7 +220,7 @@ namespace umbraco.BusinessLogic
// MakeNew(Iapp.Name, Iapp.Alias, Iapp.Icon);
// if (installAppTrees) {
// }
//}
@@ -222,14 +230,15 @@ namespace umbraco.BusinessLogic
/// </summary>
/// <param name="appAlias">The application alias.</param>
/// <returns></returns>
public static Application getByAlias(string appAlias) {
public static Application getByAlias(string appAlias)
{
return Apps.Find(t => t.alias == appAlias);
}
/// <summary>
/// Deletes this instance.
/// </summary>
public void Delete()
public void Delete()
{
//delete the assigned applications
SqlHelper.ExecuteNonQuery("delete from umbracoUser2App where app = @appAlias", SqlHelper.CreateParameter("@appAlias", this.alias));
@@ -273,22 +282,22 @@ namespace umbraco.BusinessLogic
/// </summary>
private static void ReCache()
{
HttpRuntime.Cache.Remove(CACHE_KEY);
Cache();
HttpRuntime.Cache.Remove(CacheKey);
EnsureCache();
}
/// <summary>
/// Read all Application data and store it in cache.
/// </summary>
private static void Cache()
private static void EnsureCache()
{
//don't query the database is the cache is not null
if (HttpRuntime.Cache[CACHE_KEY] != null)
if (HttpRuntime.Cache[CacheKey] != null)
return;
try
{
List<Application> tmp = new List<Application>();
var tmp = new List<Application>();
//using (IRecordsReader dr =
// SqlHelper.ExecuteReader("Select appAlias, appIcon, appName from umbracoApp"))
@@ -299,13 +308,14 @@ namespace umbraco.BusinessLogic
// }
//}
LoadXml(doc => {
LoadXml(doc =>
{
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
{
var sortOrderAttr = x.Attribute("sortOrder");
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
}))
{
var sortOrderAttr = x.Attribute("sortOrder");
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
}))
{
var sortOrderAttr = addElement.Attribute("sortOrder");
tmp.Add(new Application(addElement.Attribute("name").Value,
@@ -324,16 +334,18 @@ namespace umbraco.BusinessLogic
//installer is run and there is no database or connection string defined.
//the reason this method may get called during the installation is that the
//SqlHelper of this class is shared amongst everything "Application" wide.
//TODO: Perhaps we should log something here??
}
}
internal static void LoadXml(Action<XDocument> callback, bool saveAfterCallback)
{
lock (m_Locker)
lock (Locker)
{
var doc = File.Exists(_appConfig)
? XDocument.Load(_appConfig)
var doc = File.Exists(AppConfigFilePath)
? XDocument.Load(AppConfigFilePath)
: XDocument.Parse("<?xml version=\"1.0\"?><applications />");
if (doc.Root != null)
@@ -342,7 +354,10 @@ namespace umbraco.BusinessLogic
if (saveAfterCallback)
{
doc.Save(_appConfig);
//ensure the folder is created!
Directory.CreateDirectory(Path.GetDirectoryName(AppConfigFilePath));
doc.Save(AppConfigFilePath);
ReCache();
}
@@ -350,73 +365,4 @@ namespace umbraco.BusinessLogic
}
}
}
public enum DefaultApps
{
content,
media,
users,
settings,
developer,
member,
translation
}
public class ApplicationRegistrar : ApplicationStartupHandler
{
private ISqlHelper _sqlHelper;
protected ISqlHelper SqlHelper
{
get
{
if (_sqlHelper == null)
{
try
{
_sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
}
catch { }
}
return _sqlHelper;
}
}
public ApplicationRegistrar()
{
// Load all Applications by attribute and add them to the XML config
var types = TypeFinder.FindClassesOfType<IApplication>()
.Where(x => x.GetCustomAttributes(typeof(ApplicationAttribute), false).Any());
var attrs = types.Select(x => (ApplicationAttribute)x.GetCustomAttributes(typeof(ApplicationAttribute), false).Single())
.Where(x => Application.getByAlias(x.Alias) == null);
var allAliases = Application.getAll().Select(x => x.alias).Concat(attrs.Select(x => x.Alias));
var inString = "'" + string.Join("','", allAliases) + "'";
Application.LoadXml(doc =>
{
foreach (var attr in attrs)
{
doc.Root.Add(new XElement("add",
new XAttribute("alias", attr.Alias),
new XAttribute("name", attr.Name),
new XAttribute("icon", attr.Icon),
new XAttribute("sortOrder", attr.SortOrder)));
}
var dbApps = SqlHelper.ExecuteReader("SELECT * FROM umbracoApp WHERE appAlias NOT IN ("+ inString +")");
while (dbApps.Read())
{
doc.Root.Add(new XElement("add",
new XAttribute("alias", dbApps.GetString("appAlias")),
new XAttribute("name", dbApps.GetString("appName")),
new XAttribute("icon", dbApps.GetString("appIcon")),
new XAttribute("sortOrder", dbApps.GetByte("sortOrder"))));
}
}, true);
//SqlHelper.ExecuteNonQuery("DELETE FROM umbracoApp");
}
}
}

View File

@@ -5,11 +5,8 @@ using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
using umbraco.BusinessLogic.Utils;
using umbraco.DataLayer;
using umbraco.IO;
using umbraco.businesslogic;
using umbraco.interfaces;
namespace umbraco.BusinessLogic
{
@@ -21,12 +18,29 @@ namespace umbraco.BusinessLogic
public class ApplicationTree
{
private const string CACHE_KEY = "ApplicationTreeCache";
private const string CacheKey = "ApplicationTreeCache";
internal const string TreeConfigFileName = "trees.config";
private static string _treeConfig;
private static readonly object Locker = new object();
private static readonly string _appTreeConfig =
IOHelper.MapPath(SystemDirectories.Config + "/trees.config");
private static readonly object m_Locker = new object();
/// <summary>
/// gets/sets the trees.config file path
/// </summary>
/// <remarks>
/// The setter is generally only going to be used in unit tests, otherwise it will attempt to resolve it using the IOHelper.MapPath
/// </remarks>
internal static string TreeConfigFilePath
{
get
{
if (string.IsNullOrWhiteSpace(_treeConfig))
{
_treeConfig = IOHelper.MapPath(SystemDirectories.Config + "/" + TreeConfigFileName);
}
return _treeConfig;
}
set { _treeConfig = value; }
}
/// <summary>
/// The cache storage for all application trees
@@ -36,13 +50,12 @@ namespace umbraco.BusinessLogic
get
{
//ensure cache exists
if (HttpRuntime.Cache[CACHE_KEY] == null)
ReCache();
return HttpRuntime.Cache[CACHE_KEY] as List<ApplicationTree>;
EnsureCache();
return HttpRuntime.Cache[CacheKey] as List<ApplicationTree>;
}
set
{
HttpRuntime.Cache.Insert(CACHE_KEY, value);
HttpRuntime.Cache.Insert(CacheKey, value);
}
}
@@ -175,14 +188,6 @@ namespace umbraco.BusinessLogic
set { _action = value; }
}
/// <summary>
/// A static constructor that will cache all application trees
/// </summary>
static ApplicationTree()
{
Cache();
}
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationTree"/> class.
/// </summary>
@@ -236,22 +241,22 @@ namespace umbraco.BusinessLogic
public static void MakeNew(bool silent, bool initialize, byte sortOrder, string applicationAlias, string alias, string title, string iconClosed, string iconOpened, string assemblyName, string type, string action)
{
// SqlHelper.ExecuteNonQuery(@"insert into umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle,
// treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType, action)
// values(@treeSilent, @treeInitialize, @treeSortOrder, @appAlias, @treeAlias, @treeTitle, @treeIconClosed, @treeIconOpen, @treeHandlerAssembly, @treeHandlerType, @action)"
// ,
// SqlHelper.CreateParameter("@treeSilent", silent),
// SqlHelper.CreateParameter("@treeInitialize", initialize),
// SqlHelper.CreateParameter("@treeSortOrder", sortOrder),
// SqlHelper.CreateParameter("@treeAlias", alias),
// SqlHelper.CreateParameter("@appAlias", applicationAlias),
// SqlHelper.CreateParameter("@treeTitle", title),
// SqlHelper.CreateParameter("@treeIconClosed", iconClosed),
// SqlHelper.CreateParameter("@treeIconOpen", iconOpened),
// SqlHelper.CreateParameter("@treeHandlerAssembly", assemblyName),
// SqlHelper.CreateParameter("@treeHandlerType", type),
// SqlHelper.CreateParameter("@action", action)
// );
// SqlHelper.ExecuteNonQuery(@"insert into umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle,
// treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType, action)
// values(@treeSilent, @treeInitialize, @treeSortOrder, @appAlias, @treeAlias, @treeTitle, @treeIconClosed, @treeIconOpen, @treeHandlerAssembly, @treeHandlerType, @action)"
// ,
// SqlHelper.CreateParameter("@treeSilent", silent),
// SqlHelper.CreateParameter("@treeInitialize", initialize),
// SqlHelper.CreateParameter("@treeSortOrder", sortOrder),
// SqlHelper.CreateParameter("@treeAlias", alias),
// SqlHelper.CreateParameter("@appAlias", applicationAlias),
// SqlHelper.CreateParameter("@treeTitle", title),
// SqlHelper.CreateParameter("@treeIconClosed", iconClosed),
// SqlHelper.CreateParameter("@treeIconOpen", iconOpened),
// SqlHelper.CreateParameter("@treeHandlerAssembly", assemblyName),
// SqlHelper.CreateParameter("@treeHandlerType", type),
// SqlHelper.CreateParameter("@action", action)
// );
LoadXml(doc =>
{
@@ -275,27 +280,27 @@ namespace umbraco.BusinessLogic
/// </summary>
public void Save()
{
// SqlHelper.ExecuteNonQuery(@"Update umbracoAppTree set treeSilent = @treeSilent, treeInitialize = @treeInitialize, treeSortOrder = @treeSortOrder, treeTitle = @treeTitle,
// treeIconClosed = @treeIconClosed, treeIconOpen = @treeIconOpen, treeHandlerAssembly = @treeHandlerAssembly, treeHandlerType = @treeHandlerType, action = @action
// where treeAlias = @treeAlias AND appAlias = @appAlias",
// SqlHelper.CreateParameter("@treeSilent", this.Silent),
// SqlHelper.CreateParameter("@treeInitialize", this.Initialize),
// SqlHelper.CreateParameter("@treeSortOrder", this.SortOrder),
// SqlHelper.CreateParameter("@treeTitle", this.Title),
// SqlHelper.CreateParameter("@treeIconClosed", this.IconClosed),
// SqlHelper.CreateParameter("@treeIconOpen", this.IconOpened),
// SqlHelper.CreateParameter("@treeHandlerAssembly", this.AssemblyName),
// SqlHelper.CreateParameter("@treeHandlerType", this.Type),
// SqlHelper.CreateParameter("@treeAlias", this.Alias),
// SqlHelper.CreateParameter("@appAlias", this.ApplicationAlias),
// SqlHelper.CreateParameter("@action", this.Action)
// );
// SqlHelper.ExecuteNonQuery(@"Update umbracoAppTree set treeSilent = @treeSilent, treeInitialize = @treeInitialize, treeSortOrder = @treeSortOrder, treeTitle = @treeTitle,
// treeIconClosed = @treeIconClosed, treeIconOpen = @treeIconOpen, treeHandlerAssembly = @treeHandlerAssembly, treeHandlerType = @treeHandlerType, action = @action
// where treeAlias = @treeAlias AND appAlias = @appAlias",
// SqlHelper.CreateParameter("@treeSilent", this.Silent),
// SqlHelper.CreateParameter("@treeInitialize", this.Initialize),
// SqlHelper.CreateParameter("@treeSortOrder", this.SortOrder),
// SqlHelper.CreateParameter("@treeTitle", this.Title),
// SqlHelper.CreateParameter("@treeIconClosed", this.IconClosed),
// SqlHelper.CreateParameter("@treeIconOpen", this.IconOpened),
// SqlHelper.CreateParameter("@treeHandlerAssembly", this.AssemblyName),
// SqlHelper.CreateParameter("@treeHandlerType", this.Type),
// SqlHelper.CreateParameter("@treeAlias", this.Alias),
// SqlHelper.CreateParameter("@appAlias", this.ApplicationAlias),
// SqlHelper.CreateParameter("@action", this.Action)
// );
LoadXml(doc =>
{
var el = doc.Root.Elements("add").SingleOrDefault(x => x.Attribute("alias").Value == this.Alias && x.Attribute("application").Value == this.ApplicationAlias);
if(el != null)
if (el != null)
{
el.RemoveAttributes();
@@ -326,7 +331,7 @@ namespace umbraco.BusinessLogic
LoadXml(doc =>
{
doc.Root.Elements("add").Where(x => x.Attribute("application") != null && x.Attribute("application").Value == this.ApplicationAlias &&
doc.Root.Elements("add").Where(x => x.Attribute("application") != null && x.Attribute("application").Value == this.ApplicationAlias &&
x.Attribute("alias") != null && x.Attribute("alias").Value == this.Alias).Remove();
}, true);
}
@@ -393,82 +398,81 @@ namespace umbraco.BusinessLogic
/// </summary>
private static void ReCache()
{
HttpRuntime.Cache.Remove(CACHE_KEY);
Cache();
HttpRuntime.Cache.Remove(CacheKey);
EnsureCache();
}
/// <summary>
/// Read all ApplicationTree data and store it in cache.
/// </summary>
private static void Cache()
private static void EnsureCache()
{
//don't query the database if the cache is not null
if (HttpRuntime.Cache[CACHE_KEY] == null)
if (HttpRuntime.Cache[CacheKey] != null)
return;
lock (Locker)
{
lock (m_Locker)
if (HttpRuntime.Cache[CacheKey] == null)
{
if (HttpRuntime.Cache[CACHE_KEY] == null)
var list = new List<ApplicationTree>();
// using (IRecordsReader dr = SqlHelper.ExecuteReader(@"Select treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed,
// treeIconOpen, treeHandlerAssembly, treeHandlerType, action from umbracoAppTree order by treeSortOrder"))
// {
// while (dr.Read())
// {
// list.Add(new ApplicationTree(
// dr.GetBoolean("treeSilent"),
// dr.GetBoolean("treeInitialize"),
// dr.GetByte("treeSortOrder"),
// dr.GetString("appAlias"),
// dr.GetString("treeAlias"),
// dr.GetString("treeTitle"),
// dr.GetString("treeIconClosed"),
// dr.GetString("treeIconOpen"),
// dr.GetString("treeHandlerAssembly"),
// dr.GetString("treeHandlerType"),
// dr.GetString("action")));
// }
// }
LoadXml(doc =>
{
List<ApplicationTree> list = new List<ApplicationTree>();
// using (IRecordsReader dr = SqlHelper.ExecuteReader(@"Select treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed,
// treeIconOpen, treeHandlerAssembly, treeHandlerType, action from umbracoAppTree order by treeSortOrder"))
// {
// while (dr.Read())
// {
// list.Add(new ApplicationTree(
// dr.GetBoolean("treeSilent"),
// dr.GetBoolean("treeInitialize"),
// dr.GetByte("treeSortOrder"),
// dr.GetString("appAlias"),
// dr.GetString("treeAlias"),
// dr.GetString("treeTitle"),
// dr.GetString("treeIconClosed"),
// dr.GetString("treeIconOpen"),
// dr.GetString("treeHandlerAssembly"),
// dr.GetString("treeHandlerType"),
// dr.GetString("action")));
// }
// }
LoadXml(doc =>
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
{
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
{
var sortOrderAttr = x.Attribute("sortOrder");
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
}))
{
list.Add(new ApplicationTree(
addElement.Attribute("silent") != null ? Convert.ToBoolean(addElement.Attribute("silent").Value) : false,
addElement.Attribute("initialize") != null ? Convert.ToBoolean(addElement.Attribute("initialize").Value) : true,
addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
addElement.Attribute("application").Value,
addElement.Attribute("alias").Value,
addElement.Attribute("title").Value,
addElement.Attribute("iconClosed").Value,
addElement.Attribute("iconOpen").Value,
addElement.Attribute("assembly").Value,
addElement.Attribute("type").Value,
addElement.Attribute("action") != null ? addElement.Attribute("action").Value : ""));
}
}, false);
var sortOrderAttr = x.Attribute("sortOrder");
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
}))
{
list.Add(new ApplicationTree(
addElement.Attribute("silent") != null ? Convert.ToBoolean(addElement.Attribute("silent").Value) : false,
addElement.Attribute("initialize") != null ? Convert.ToBoolean(addElement.Attribute("initialize").Value) : true,
addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
addElement.Attribute("application").Value,
addElement.Attribute("alias").Value,
addElement.Attribute("title").Value,
addElement.Attribute("iconClosed").Value,
addElement.Attribute("iconOpen").Value,
addElement.Attribute("assembly").Value,
addElement.Attribute("type").Value,
addElement.Attribute("action") != null ? addElement.Attribute("action").Value : ""));
}
}, false);
AppTrees = list;
}
AppTrees = list;
}
}
}
internal static void LoadXml(Action<XDocument> callback, bool saveAfterCallback)
{
lock (m_Locker)
lock (Locker)
{
var doc = File.Exists(_appTreeConfig)
? XDocument.Load(_appTreeConfig)
var doc = File.Exists(TreeConfigFilePath)
? XDocument.Load(TreeConfigFilePath)
: XDocument.Parse("<?xml version=\"1.0\"?><trees />");
if (doc.Root != null)
{
@@ -476,7 +480,9 @@ namespace umbraco.BusinessLogic
if (saveAfterCallback)
{
doc.Save(_appTreeConfig);
Directory.CreateDirectory(Path.GetDirectoryName(TreeConfigFilePath));
doc.Save(TreeConfigFilePath);
ReCache();
}
@@ -484,86 +490,4 @@ namespace umbraco.BusinessLogic
}
}
}
public class ApplicationTreeRegistrar : ApplicationStartupHandler
{
private ISqlHelper _sqlHelper;
protected ISqlHelper SqlHelper
{
get
{
if (_sqlHelper == null)
{
try
{
_sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
}
catch { }
}
return _sqlHelper;
}
}
public ApplicationTreeRegistrar()
{
// Load all Applications by attribute and add them to the XML config
var types = TypeFinder.FindClassesOfType<ITree>()
.Where(x => x.GetCustomAttributes(typeof(TreeAttribute), false).Any());
var items = types.Select(x => new Tuple<Type, TreeAttribute>(x,
(TreeAttribute)x.GetCustomAttributes(typeof(TreeAttribute), false).Single()))
.Where(x => ApplicationTree.getByAlias(x.Item2.Alias) == null);
var allAliases = ApplicationTree.getAll().Select(x => x.Alias).Concat(items.Select(x => x.Item2.Alias));
var inString = "'" + string.Join("','", allAliases) + "'";
ApplicationTree.LoadXml(doc =>
{
foreach (var tuple in items)
{
var type = tuple.Item1;
var attr = tuple.Item2;
var typeParts = type.AssemblyQualifiedName.Split(',');
var assemblyName = typeParts[1].Trim();
var typeName = typeParts[0].Substring(assemblyName.Length + 1).Trim();
doc.Root.Add(new XElement("add",
new XAttribute("silent", attr.Silent),
new XAttribute("initialize", attr.Initialize),
new XAttribute("sortOrder", attr.SortOrder),
new XAttribute("alias", attr.Alias),
new XAttribute("application", attr.ApplicationAlias),
new XAttribute("title", attr.Title),
new XAttribute("iconClosed", attr.IconClosed),
new XAttribute("iconOpen", attr.IconOpen),
new XAttribute("assembly", assemblyName),
new XAttribute("type", typeName),
new XAttribute("action", attr.Action)));
}
var dbTrees = SqlHelper.ExecuteReader("SELECT * FROM umbracoAppTree WHERE treeAlias NOT IN (" + inString + ")");
while(dbTrees.Read())
{
var action = dbTrees.GetString("action");
doc.Root.Add(new XElement("add",
new XAttribute("silent", dbTrees.GetBoolean("treeSilent")),
new XAttribute("initialize", dbTrees.GetBoolean("treeInitialize")),
new XAttribute("sortOrder", dbTrees.GetByte("treeSortOrder")),
new XAttribute("alias", dbTrees.GetString("treeAlias")),
new XAttribute("application", dbTrees.GetString("appAlias")),
new XAttribute("title", dbTrees.GetString("treeTitle")),
new XAttribute("iconClosed", dbTrees.GetString("treeIconClosed")),
new XAttribute("iconOpen", dbTrees.GetString("treeIconOpen")),
new XAttribute("assembly", dbTrees.GetString("treeHandlerAssembly")),
new XAttribute("type", dbTrees.GetString("treeHandlerType")),
new XAttribute("action", string.IsNullOrEmpty(action) ? "" : action)));
}
}, true);
//SqlHelper.ExecuteNonQuery("DELETE FROM umbracoAppTree");
}
}
}

View File

@@ -140,8 +140,11 @@
<Compile Include="ApplicationAttribute.cs" />
<Compile Include="ApplicationBase.cs" />
<Compile Include="ApplicationDefinitions.cs" />
<Compile Include="ApplicationRegistrar.cs" />
<Compile Include="ApplicationStartupHandler.cs" />
<Compile Include="ApplicationTree.cs" />
<Compile Include="ApplicationTreeRegistrar.cs" />
<Compile Include="DefaultApps.cs" />
<Compile Include="TreeAttribute.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>

View File

@@ -22,7 +22,7 @@
<Examine configSource="config\ExamineSettings.config" />
<ExamineLuceneIndexSets configSource="config\ExamineIndex.config" />
<appSettings>
<add key="umbracoDbDSN" value="datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\Umbraco.sdf" />
<add key="umbracoDbDSN" value="server=.\SQLEXPRESS2008;database=dbUmb4x;user id=sa;password=D3gr4d3" />
<add key="umbracoConfigurationStatus" value="4.8.0" />
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
<add key="umbracoReservedPaths" value="~/umbraco,~/install/" />
@@ -33,7 +33,7 @@
<add key="umbracoHideTopLevelNodeFromPath" value="true" />
<add key="umbracoEditXhtmlMode" value="true" />
<add key="umbracoUseDirectoryUrls" value="false" />
<add key="umbracoDebugMode" value="false" />
<add key="umbracoDebugMode" value="true" />
<add key="umbracoTimeOutInMinutes" value="20" />
<add key="umbracoVersionCheckPeriod" value="7" />
<add key="umbracoDisableXsltExtensions" value="true" />
@@ -65,7 +65,7 @@
</connectionStrings>
<system.web>
<customErrors mode="RemoteOnly" />
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
<xhtmlConformance mode="Strict" />
@@ -104,7 +104,7 @@
<!-- SPELL CHECKER -->
<add verb="GET,HEAD,POST" path="GoogleSpellChecker.ashx" type="umbraco.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco" />
</httpHandlers>
<compilation defaultLanguage="c#" batch="false" targetFramework="4.0">
<compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0">
<assemblies>
<!-- ASP.NET 4.0 Assemblies -->
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />