diff --git a/config templates/config/applications.config b/config templates/config/applications.config new file mode 100644 index 0000000000..5ce62749e5 --- /dev/null +++ b/config templates/config/applications.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/config templates/config/trees.config b/config templates/config/trees.config new file mode 100644 index 0000000000..45e82d2f9d --- /dev/null +++ b/config templates/config/trees.config @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/umbraco.businesslogic/Application.cs b/src/umbraco.businesslogic/Application.cs index 367d022f20..7ccabe5cc6 100644 --- a/src/umbraco.businesslogic/Application.cs +++ b/src/umbraco.businesslogic/Application.cs @@ -3,8 +3,12 @@ using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.IO; +using System.Linq; using System.Web; +using System.Xml.Linq; using umbraco.DataLayer; +using umbraco.IO; using umbraco.interfaces; using umbraco.BusinessLogic.Utils; using System.Runtime.CompilerServices; @@ -46,6 +50,7 @@ namespace umbraco.BusinessLogic private string _name; private string _alias; private string _icon; + private int _sortOrder; /// @@ -90,10 +95,22 @@ namespace umbraco.BusinessLogic /// The application alias. /// The application icon. public Application(string name, string alias, string icon) + : this(name, alias, icon, 0) + { } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// The alias. + /// The icon. + /// The sort order. + public Application(string name, string alias, string icon, int sortOrder) { this.name = name; this.alias = alias; this.icon = icon; + this.sortOrder = sortOrder; } /// @@ -124,7 +141,19 @@ namespace umbraco.BusinessLogic { get { return _icon; } set { _icon = value; } - } + } + + /// + /// Gets or sets the sort order. + /// + /// + /// The sort order. + /// + public int sortOrder + { + get { return _sortOrder; } + set { _sortOrder = value; } + } /// /// Creates a new applcation if no application with the specified alias is found. @@ -134,6 +163,19 @@ namespace umbraco.BusinessLogic /// The application icon, which has to be located in umbraco/images/tray folder. [MethodImpl(MethodImplOptions.Synchronized)] public static void MakeNew(string name, string alias, string icon) + { + MakeNew(name, alias, icon, (1 + SqlHelper.ExecuteScalar("SELECT MAX(sortOrder) FROM umbracoApp"))); + } + + /// + /// Makes the new. + /// + /// The name. + /// The alias. + /// The icon. + /// The sort order. + [MethodImpl(MethodImplOptions.Synchronized)] + public static void MakeNew(string name, string alias, string icon, int sortOrder) { bool exist = false; foreach (Application app in getAll()) @@ -144,8 +186,6 @@ namespace umbraco.BusinessLogic if (!exist) { - int sortOrder = (1 + SqlHelper.ExecuteScalar("SELECT MAX(sortOrder) FROM umbracoApp")); - SqlHelper.ExecuteNonQuery(@" insert into umbracoApp (appAlias,appIcon,appName, sortOrder) @@ -157,7 +197,6 @@ namespace umbraco.BusinessLogic ReCache(); } - } @@ -265,12 +304,30 @@ namespace umbraco.BusinessLogic { List tmp = new List(); - using (IRecordsReader dr = - SqlHelper.ExecuteReader("Select appAlias, appIcon, appName from umbracoApp")) + //using (IRecordsReader dr = + // SqlHelper.ExecuteReader("Select appAlias, appIcon, appName from umbracoApp")) + //{ + // while (dr.Read()) + // { + // tmp.Add(new Application(dr.GetString("appName"), dr.GetString("appAlias"), dr.GetString("appIcon"))); + // } + //} + + var configPath = IOHelper.MapPath(Path.Combine(IOHelper.ResolveUrl(SystemDirectories.Config), "applications.config")); + var config = XDocument.Load(configPath); + if (config.Root != null) { - while (dr.Read()) + foreach (var addElement in config.Root.Elements("add").OrderBy(x => + { + var sortOrderAttr = x.Attribute("sortOrder"); + return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0; + })) { - tmp.Add(new Application(dr.GetString("appName"), dr.GetString("appAlias"), dr.GetString("appIcon"))); + var sortOrderAttr = addElement.Attribute("sortOrder"); + tmp.Add(new Application(addElement.Attribute("name").Value, + addElement.Attribute("alias").Value, + addElement.Attribute("icon").Value, + sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0)); } } diff --git a/src/umbraco.businesslogic/User.cs b/src/umbraco.businesslogic/User.cs index 9ae56fc223..7a7574e230 100644 --- a/src/umbraco.businesslogic/User.cs +++ b/src/umbraco.businesslogic/User.cs @@ -256,17 +256,16 @@ namespace umbraco.BusinessLogic if (!_isInitialized) setupUser(_id); + var allApps = Application.getAll(); var apps = new List(); - using (IRecordsReader appIcons = SqlHelper.ExecuteReader("select appAlias, appIcon, appname from umbracoApp app join umbracoUser2app u2a on u2a.app = app.appAlias and u2a.[user] = @userID order by app.sortOrder", SqlHelper.CreateParameter("@userID", this.Id))) + using (IRecordsReader appIcons = SqlHelper.ExecuteReader("select app from umbracoUser2app where [user] = @userID", SqlHelper.CreateParameter("@userID", this.Id))) { while (appIcons.Read()) { - Application tmp = new Application(); - tmp.name = appIcons.GetString("appName"); - tmp.icon = appIcons.GetString("appIcon"); - tmp.alias = appIcons.GetString("appAlias"); - apps.Add(tmp); + var app = allApps.SingleOrDefault(x => x.alias == appIcons.GetString("app")); + if(app != null) + apps.Add(app); } } diff --git a/src/umbraco.presentation/config/Dashboard.config b/src/umbraco.presentation/config/Dashboard.config index 7ebb37c8a6..3cc7f041af 100644 --- a/src/umbraco.presentation/config/Dashboard.config +++ b/src/umbraco.presentation/config/Dashboard.config @@ -111,4 +111,12 @@ /usercontrols/dashboards/EmailAFriendForm_logs.ascx +
+ + content + + + /usercontrols/blog/CommentModeration.ascx + +
\ No newline at end of file diff --git a/src/umbraco.presentation/config/applications.config b/src/umbraco.presentation/config/applications.config new file mode 100644 index 0000000000..5ce62749e5 --- /dev/null +++ b/src/umbraco.presentation/config/applications.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/umbraco.presentation/config/restExtensions.config b/src/umbraco.presentation/config/restExtensions.config index 991dde0bc7..88aa956085 100644 --- a/src/umbraco.presentation/config/restExtensions.config +++ b/src/umbraco.presentation/config/restExtensions.config @@ -10,4 +10,8 @@ --> + + + + \ No newline at end of file diff --git a/src/umbraco.presentation/config/trees.config b/src/umbraco.presentation/config/trees.config new file mode 100644 index 0000000000..45e82d2f9d --- /dev/null +++ b/src/umbraco.presentation/config/trees.config @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/umbraco.presentation/config/xsltExtensions.config b/src/umbraco.presentation/config/xsltExtensions.config index 21f1b80526..ec28d3d403 100644 --- a/src/umbraco.presentation/config/xsltExtensions.config +++ b/src/umbraco.presentation/config/xsltExtensions.config @@ -2,4 +2,8 @@ + + + + \ No newline at end of file diff --git a/src/umbraco.presentation/umbraco/umbraco.aspx.cs b/src/umbraco.presentation/umbraco/umbraco.aspx.cs index c4517b3e5b..59cd2077f5 100644 --- a/src/umbraco.presentation/umbraco/umbraco.aspx.cs +++ b/src/umbraco.presentation/umbraco/umbraco.aspx.cs @@ -45,7 +45,7 @@ namespace umbraco.cms.presentation PlaceHolderAppIcons.Text = ui.Text("main", "sections", base.getUser()); plcIcons.Text = ""; - foreach (BusinessLogic.Application a in apps) + foreach (BusinessLogic.Application a in apps.OrderBy(x => x.sortOrder)) { string appClass = a.icon.StartsWith(".") ? a.icon.Substring(1, a.icon.Length - 1) : a.alias; diff --git a/src/umbraco.presentation/web.config b/src/umbraco.presentation/web.config index d6b9b88172..92e2c15308 100644 --- a/src/umbraco.presentation/web.config +++ b/src/umbraco.presentation/web.config @@ -44,8 +44,8 @@ - - + + diff --git a/src/umbraco.sln b/src/umbraco.sln index 7c4cfef841..aa2f0e6a44 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -62,6 +62,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nant", "Nant", "{17E547B1-D ..\build\Nant\umbraco.build = ..\build\Nant\umbraco.build EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config Templates", "Config Templates", "{BF7C59D8-3C53-4257-B055-DAC4EED705DA}" + ProjectSection(SolutionItems) = preProject + ..\config templates\config\404handlers.config = ..\config templates\config\404handlers.config + ..\config templates\config\applications.config = ..\config templates\config\applications.config + ..\config templates\config\ClientDependency.config = ..\config templates\config\ClientDependency.config + ..\config templates\config\Dashboard.config = ..\config templates\config\Dashboard.config + ..\config templates\config\ExamineIndex.config = ..\config templates\config\ExamineIndex.config + ..\config templates\config\ExamineSettings.config = ..\config templates\config\ExamineSettings.config + ..\config templates\config\feedProxy.config = ..\config templates\config\feedProxy.config + ..\config templates\config\formHandlers.config = ..\config templates\config\formHandlers.config + ..\config templates\config\metablogConfig.config = ..\config templates\config\metablogConfig.config + ..\config templates\config\restExtensions.config = ..\config templates\config\restExtensions.config + ..\config templates\config\scripting.config = ..\config templates\config\scripting.config + ..\config templates\config\tinyMceConfig.config = ..\config templates\config\tinyMceConfig.config + ..\config templates\config\trees.config = ..\config templates\config\trees.config + ..\config templates\config\umbracoSettings.config = ..\config templates\config\umbracoSettings.config + ..\config templates\config\UrlRewriting.config = ..\config templates\config\UrlRewriting.config + ..\config templates\web.config = ..\config templates\web.config + ..\config templates\config\xsltExtensions.config = ..\config templates\config\xsltExtensions.config + EndProjectSection +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = umbraco2.vsmdi