diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs new file mode 100644 index 000000000..0b4066ca7 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Controllers/AdminController.cs @@ -0,0 +1,10 @@ +using System.Web.Mvc; + +namespace Orchard.Dashboards.Controllers { + public class AdminController : Controller { + + public ActionResult Index() { + return View(); + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs new file mode 100644 index 000000000..2f0c86cce --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Elements/DashboardSiteSettingsPartDriver.cs @@ -0,0 +1,48 @@ +using System; +using System.Linq; +using Orchard.ContentManagement; +using Orchard.ContentManagement.Drivers; +using Orchard.Dashboards.Models; +using Orchard.Dashboards.ViewModels; + +namespace Orchard.Dashboards.Elements { + public class DashboardSiteSettingsPartDriver : ContentPartDriver { + private readonly IContentManager _contentManager; + + public DashboardSiteSettingsPartDriver(IContentManager contentManager) { + _contentManager = contentManager; + } + + protected override DriverResult Editor(DashboardSiteSettingsPart part, dynamic shapeHelper) { + return Editor(part, null, shapeHelper); + } + + protected override DriverResult Editor(DashboardSiteSettingsPart part, IUpdateModel updater, dynamic shapeHelper) { + return ContentShape("Parts_DashboardSettings", () => { + var viewModel = new DashboardSiteSettingsViewModel { + SelectedDashboardId = part.DefaultDashboardId.ToString(), + }; + + if (updater != null) { + if (updater.TryUpdateModel(viewModel, Prefix, null, new[] { "SelectedDashboard" })) { + part.DefaultDashboardId = ParseContentId(viewModel.SelectedDashboardId); + } + } + + viewModel.SelectedDashboard = part.DefaultDashboardId != null ? _contentManager.Get(part.DefaultDashboardId.Value) : default(ContentItem); + return shapeHelper.EditorTemplate(TemplateName: "Parts.DashboardSettings", Model: viewModel, Prefix: Prefix); + }).OnGroup("Dashboard"); + } + + private int? ParseContentId(string value) { + if (String.IsNullOrWhiteSpace(value)) + return null; + + var items = value.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); + if (!items.Any()) + return null; + + return XmlHelper.Parse(items.First()); + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Handlers/DashboardSiteSettingsPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Handlers/DashboardSiteSettingsPartHandler.cs new file mode 100644 index 000000000..4980ac1f8 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Handlers/DashboardSiteSettingsPartHandler.cs @@ -0,0 +1,17 @@ +using Orchard.ContentManagement; +using Orchard.ContentManagement.Handlers; +using Orchard.Dashboards.Models; +using Orchard.Localization; + +namespace Orchard.Dashboards.Handlers { + public class DashboardSiteSettingsPartHandler : ContentHandler { + public DashboardSiteSettingsPartHandler() { + Filters.Add(new ActivatingFilter("Site")); + OnGetContentItemMetadata((context, part) => context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Dashboard")))); + + T = NullLocalizer.Instance; + } + + public Localizer T { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs new file mode 100644 index 000000000..0d55e3635 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Migrations.cs @@ -0,0 +1,22 @@ +using Orchard.ContentManagement.MetaData; +using Orchard.Core.Contents.Extensions; +using Orchard.Data.Migration; + +namespace Orchard.Dashboards { + public class Migrations : DataMigrationImpl { + public int Create() { + ContentDefinitionManager.AlterPartDefinition("DashboardPart", part => part + .WithDescription("Turns your content type into an admin Dashboard.")); + + ContentDefinitionManager.AlterTypeDefinition("Dashboard", type => type + .WithPart("CommonPart") + .WithPart("IdentityPart") + .WithPart("TitlePart") + .WithPart("LayoutPart", p => p + .WithSetting("LayoutTypePartSettings.DefaultLayoutData", "{\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Canvas\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Grid\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Row\",\"data\":\"\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":0,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eGet+up+and+running%3c%2fh2%3e%0d%0a%3cp%3eStart+by+exploring+the+menu+on+the+left+and+familiarize+yourself+with+Orchard.+As+for+the+basics%2c+we+suggest+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fThemes%22%3echanging+the+theme%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fContents%2fCreate%2fPage%22%3eadding+some+pages%3c%2fa%3e%2c+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fBlogs%2fCreate%22%3esetup+up+a+blog%3c%2fa%3e%2c+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fAdmin%2fSettings%2fIndex%22%3econfiguring+basic+settings%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":1,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e&Content=%3ch2%3eGet+more+goodies%3c%2fh2%3e%0d%0a%3cp%3eChange+the+way+your+site+works+and+looks+with+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fThemes%22%3ethemes%3c%2fa%3e+and+%3ca+href%3d%22http%3a%2f%2flocalhost%3a30321%2fOrchardLocal%2fPackaging%2fGallery%2fModules%22%3emodules%3c%2fa%3e.+There%26rsquo%3bs+plenty+to+choose+from+in+the+%3ca+href%3d%22http%3a%2f%2fgallery.orchardproject.net%2f%22%3eOrchard+Gallery%3c%2fa%3e.+We%26rsquo%3bre+always+adding+things%2c+so+be+sure+to+check+back+often+to+see+what%26rsquo%3bs+new.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":2,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e&Content=%3ch2%3eRead+the+docs%3c%2fh2%3e%0d%0a%3cp%3eAre+you+ready+to+go+deeper+and+become+an+Orchard+expert%3f+Take+a+look+at+the+%3ca+href%3d%22http%3a%2f%2fdocs.orchardproject.net%2f%22%3eOrchard+Documentation%3c%2fa%3e+to+learn+about+how+everything+connects+together+and+what+makes+Orchard+tick.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":3,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e&Content=%3ch2%3eMake+friends%3c%2fh2%3e%0d%0a%3cp%3eFind+friends+that+share+your+interest+of+Orchard.+There+are+a+couple+ways+that+you+can+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fdiscussions%22%3ediscuss+and+get+connected%3c%2fa%3e+to+the+project+including+mailing+lists%2c+forums+and+IRC.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":4,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e&Content=%3ch2%3eContribute+back%3c%2fh2%3e%0d%0a%3cp%3eHelp+grow+Orchard.+We+encourage+contributions+of+all+sorts%2c+including+code+submissions%2c+documentation%2c+translations%2c+feature+recommendations%2c+and+more.+Here+are+some+ways+to+%3ca+href%3d%22http%3a%2f%2forchardproject.net%2fcontribution%22%3egive+back+to+the+project%3c%2fa%3e.%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null},{\"typeName\":\"Orchard.Layouts.Elements.Column\",\"data\":\"Width=2&Offset=0&Collapsible=null\",\"exportableData\":\"\",\"index\":5,\"elements\":[{\"typeName\":\"Orchard.Layouts.Elements.Html\",\"data\":\"TypeName=Orchard.Layouts.Elements.Html&Text=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e&Content=%3ch2%3eStay+up+to+date%3c%2fh2%3e%0d%0a%3cp%3e%3ciframe+width%3d%22100%25%22+height%3d%22100%25%22+scrolling%3d%22no%22+frameborder%3d%220%22+src%3d%22http%3a%2f%2fwww.orchardproject.net%2fadvisory%22+id%3d%22advisory%22%3e%0d%0a+%26lt%3bp%26gt%3bYour+browser+does+not+support+iframes.+You+can%27t+see+advisory+messages.%26lt%3b%2fp%26gt%3b%3c%2fiframe%3e%3c%2fp%3e\",\"exportableData\":\"\",\"index\":0,\"elements\":[],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":null,\"htmlClass\":null,\"htmlStyle\":null,\"rule\":null}],\"isTemplated\":false,\"htmlId\":\"\",\"htmlClass\":\"\",\"htmlStyle\":\"\",\"rule\":\"\"}]}")) + .WithPart("DashboardPart")); + + return 1; + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Models/DashboardSiteSettingsPart.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Models/DashboardSiteSettingsPart.cs new file mode 100644 index 000000000..e6fdffae4 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Models/DashboardSiteSettingsPart.cs @@ -0,0 +1,10 @@ +using Orchard.ContentManagement; + +namespace Orchard.Dashboards.Models { + public class DashboardSiteSettingsPart : ContentPart { + public int? DefaultDashboardId { + get { return this.Retrieve(x => x.DefaultDashboardId); } + set { this.Store(x => x.DefaultDashboardId, value); } + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt b/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt new file mode 100644 index 000000000..f1eddfd30 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Module.txt @@ -0,0 +1,13 @@ +Name: Dashboards +AntiForgery: enabled +Author: The Orchard Team +Website: http://orchardproject.net +Version: 1.0 +OrchardVersion: 1.9 +Description: The Dashboards module enables administrators to customize the dashboard screen of the administration UI of the application. +Features: + Orchard.Dashboards: + Name: Dashboards + Description: The Dashboards module enables administrators to customize the dashboard screen of the administration UI of the application. + Category: Admin + Dependencies: Orchard.Layouts, Orchard.ContentPicker \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj new file mode 100644 index 000000000..211001a18 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Orchard.Dashboards.csproj @@ -0,0 +1,152 @@ + + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Orchard.Dashboards + Orchard.Dashboards + v4.5.1 + false + + + 4.0 + + + false + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + AllRules.ruleset + false + + + + + + + 3.5 + + + + False + ..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll + + + + + + + + + + + + + + + + + + + + + {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} + Orchard.Framework + false + + + {9916839C-39FC-4CEB-A5AF-89CA7E87119F} + Orchard.Core + false + + + + + + + + + + + + + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + $(ProjectDir)\..\Manifests + + + + + + + + + + + + False + True + 45979 + / + + + False + True + http://orchard.codeplex.com + False + + + + + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info b/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info new file mode 100644 index 000000000..e93ed5019 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Placement.info @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..8e7c239f9 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Orchard.Dashboards")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("Orchard")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("01af036a-6a2f-419c-aa20-1defce2f5b3f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Routes.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Routes.cs new file mode 100644 index 000000000..4c07b3910 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Routes.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Web.Mvc; +using System.Web.Routing; +using Orchard.Mvc.Routes; + +namespace Orchard.Dashboards { + public class Routes : IRouteProvider { + public void GetRoutes(ICollection routes) { + foreach (var routeDescriptor in GetRoutes()) + routes.Add(routeDescriptor); + } + + public IEnumerable GetRoutes() { + yield return new RouteDescriptor { + Priority = -4, + Route = new Route( + "Admin", + new RouteValueDictionary { + {"area", "Orchard.Dashboards"}, + {"controller", "Admin"}, + {"action", "Index"} + }, + new RouteValueDictionary(), + new RouteValueDictionary { + {"area", "Orchard.Dashboards"} + }, + new MvcRouteHandler()) + }; + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Scripts/Web.config b/src/Orchard.Web/Modules/Orchard.Dashboards/Scripts/Web.config new file mode 100644 index 000000000..817198995 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Scripts/Web.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs new file mode 100644 index 000000000..9345c8ebd --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DashboardSelectorResult.cs @@ -0,0 +1,8 @@ +using Orchard.ContentManagement; + +namespace Orchard.Dashboards.Services { + public class DashboardSelectorResult { + public int Priority { get; set; } + public IContent Dashboard { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs new file mode 100644 index 000000000..314fde30c --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/DefaultDashboardSelector.cs @@ -0,0 +1,18 @@ +using System; +using Orchard.ContentManagement; +using Orchard.Dashboards.Models; + +namespace Orchard.Dashboards.Services { + public class DefaultDashboardSelector : IDashboardSelector { + private readonly IOrchardServices _services; + public DefaultDashboardSelector(IOrchardServices services) { + _services = services; + } + + public DashboardSelectorResult GetDashboard() { + var settings = _services.WorkContext.CurrentSite.As(); + var dashboardId = settings.DefaultDashboardId; + var dashboard = dashboardId != null ? _services.ContentManager.Get(dashboardId.Value) : default(ContentItem); + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs new file mode 100644 index 000000000..2bb524b6b --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Services/IDashboardSelector.cs @@ -0,0 +1,5 @@ +namespace Orchard.Dashboards.Services { + public interface IDashboardSelector : IDependency { + DashboardSelectorResult GetDashboard(); + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Web.config b/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Web.config new file mode 100644 index 000000000..817198995 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Styles/Web.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/ViewModels/DashboardSiteSettingsViewModel.cs b/src/Orchard.Web/Modules/Orchard.Dashboards/ViewModels/DashboardSiteSettingsViewModel.cs new file mode 100644 index 000000000..23924c338 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/ViewModels/DashboardSiteSettingsViewModel.cs @@ -0,0 +1,8 @@ +using Orchard.ContentManagement; + +namespace Orchard.Dashboards.ViewModels { + public class DashboardSiteSettingsViewModel { + public string SelectedDashboardId { get; set; } + public ContentItem SelectedDashboard { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml new file mode 100644 index 000000000..369ded8ff --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/Admin/Index.cshtml @@ -0,0 +1,38 @@ +@model dynamic +@{ Layout.Title = T("Welcome to my Custom Dashboard").ToString(); } +
+
+

@T("Get up and running")

+

@T("Start by exploring the menu on the left and familiarize yourself with Orchard. As for the basics, we suggest changing the theme, adding some pages, setup up a blog, and configuring basic settings.", + Url.Action("Index", "Admin", new { area = "Orchard.Themes" }), + Url.Action("Create", "Admin", new { area = "Contents", id = "Page" }), + Url.Action("Create", "BlogAdmin", new { area = "Orchard.Blogs" }), + Url.Action("Index", "Admin", new { area = "Settings", groupInfoId = "Index" }))

+
+
+ +

@T("Change the way your site works and looks with themes and modules. There’s plenty to choose from in the Orchard Gallery. We’re always adding things, so be sure to check back often to see what’s new.", + Url.Action("Themes", "Gallery", new { area = "Orchard.Packaging" }), + Url.Action("Modules", "Gallery", new { area = "Orchard.Packaging" })) +

+
+
+

@T("Read the Docs")

+

@T("Are you ready to go deeper and become an Orchard expert? Take a look at the Orchard Documentation to learn about how everything connects together and what makes Orchard tick.")

+
+
+

@T("Make friends")

+

@T("Find friends that share your interest of Orchard. There are a couple ways that you can discuss and get connected to the project including mailing lists, forums and IRC.")

+
+
+

@T("Contribute back")

+

@T("Help grow Orchard. We encourage contributions of all sorts, including code submissions, documentation, translations, feature recommendations, and more. Here are some ways to give back to the project.")

+
+ +
+

@T("Stay up to date")

+ +
+
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml new file mode 100644 index 000000000..d6771bd77 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Views/EditorTemplates/Parts.DashboardSettings.cshtml @@ -0,0 +1,14 @@ +@using Orchard.ContentManagement +@model Orchard.Dashboards.ViewModels.DashboardSiteSettingsViewModel +@{ + Layout.Title = T("Dashboard Settings").ToString(); +} +
+
+ @Display.ContentPicker_Edit( + DisplayName: T("Default Dashboard").Text, + SelectedItemsFieldName: Html.FieldNameFor(m => m.SelectedDashboardId), + ContentItems: Model.SelectedDashboard != null ? new[] { Model.SelectedDashboard } : Enumerable.Empty(), + Hint: T("Select the content item to use as the dashboard.").Text) +
+
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config b/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config new file mode 100644 index 000000000..798f7fd30 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Dashboards/Web.config @@ -0,0 +1,43 @@ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.sln b/src/Orchard.sln index cb6a0aa9d..5366790bf 100644 --- a/src/Orchard.sln +++ b/src/Orchard.sln @@ -261,6 +261,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution WebEssentials-Settings.json = WebEssentials-Settings.json EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Dashboards", "Orchard.Web\Modules\Orchard.Dashboards\Orchard.Dashboards.csproj", "{BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeCoverage|Any CPU = CodeCoverage|Any CPU @@ -1063,6 +1065,16 @@ Global {82190F52-2901-46D6-8A4C-34649959483F}.FxCop|Any CPU.Build.0 = Release|Any CPU {82190F52-2901-46D6-8A4C-34649959483F}.Release|Any CPU.ActiveCfg = Release|Any CPU {82190F52-2901-46D6-8A4C-34649959483F}.Release|Any CPU.Build.0 = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Coverage|Any CPU.ActiveCfg = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Coverage|Any CPU.Build.0 = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.FxCop|Any CPU.ActiveCfg = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.FxCop|Any CPU.Build.0 = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1146,5 +1158,6 @@ Global {2C5EB8B3-A313-413D-BAA0-5C21D2A6EC6E} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} {6BD8B2FA-F2E3-4AC8-A4C3-2925A653889A} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} {82190F52-2901-46D6-8A4C-34649959483F} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} + {BAC82DB9-F4C4-4DD1-ABDB-F70E6229E6B0} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5} EndGlobalSection EndGlobal