mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Reports module
- Stores service management reports - Use IReportsCoordinator to write message to the same report through multiple components - Views to display reports --HG-- branch : dev
This commit is contained in:
@@ -82,11 +82,16 @@
|
||||
<Compile Include="Contents\ViewModels\EditItemViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
|
||||
<Compile Include="Reports\AdminMenu.cs" />
|
||||
<Compile Include="Reports\Controllers\AdminController.cs" />
|
||||
<Compile Include="Reports\Routes.cs" />
|
||||
<Compile Include="Localization\Controllers\AdminController.cs" />
|
||||
<Compile Include="Localization\DataMigrations\LocalizationDataMigration.cs" />
|
||||
<Compile Include="Localization\ViewModels\ContentTranslationsViewModel.cs" />
|
||||
<Compile Include="Localization\Drivers\LocalizationDriver.cs" />
|
||||
<Compile Include="Navigation\DataMigrations\NavigationDataMigration.cs" />
|
||||
<Compile Include="Reports\ViewModels\DisplayReportViewModel.cs" />
|
||||
<Compile Include="Reports\ViewModels\ReportsAdminIndexViewModel.cs" />
|
||||
<Compile Include="Routable\Controllers\ItemController.cs" />
|
||||
<Compile Include="Routable\Drivers\RoutableDriver.cs" />
|
||||
<Compile Include="Routable\Handlers\RoutableHandler.cs" />
|
||||
@@ -234,6 +239,9 @@
|
||||
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\Item\Preview.aspx" />
|
||||
<Content Include="Contents\Views\Item\Display.aspx" />
|
||||
<Content Include="Reports\Module.txt" />
|
||||
<Content Include="Reports\Views\Admin\Display.aspx" />
|
||||
<Content Include="Reports\Views\Admin\Index.aspx" />
|
||||
<Content Include="Localization\Module.txt" />
|
||||
<Content Include="Localization\Views\Admin\Translate.ascx" />
|
||||
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.SummaryAdmin.ascx" />
|
||||
@@ -300,6 +308,7 @@
|
||||
<Content Include="Contents\Views\Web.config" />
|
||||
<Content Include="Routable\Views\Web.config" />
|
||||
<Content Include="Localization\Views\Web.config" />
|
||||
<Content Include="Reports\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
15
src/Orchard.Web/Core/Reports/AdminMenu.cs
Normal file
15
src/Orchard.Web/Core/Reports/AdminMenu.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Reports {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
public Localizer T { get; set; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.Add(T("Site Configuration"), "0",
|
||||
menu => menu.Add(T("Reports"), "0", item => item.Action("Index", "Admin", new { area = "Reports" }).Permission(StandardPermissions.AccessAdminPanel)));
|
||||
}
|
||||
}
|
||||
}
|
28
src/Orchard.Web/Core/Reports/Controllers/AdminController.cs
Normal file
28
src/Orchard.Web/Core/Reports/Controllers/AdminController.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Core.Reports.ViewModels;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Reports.Services;
|
||||
|
||||
namespace Orchard.Core.Reports.Controllers {
|
||||
public class AdminController : Controller {
|
||||
private readonly IReportsManager _reportsManager;
|
||||
|
||||
public AdminController(IReportsManager reportsManager) {
|
||||
_reportsManager = reportsManager;
|
||||
}
|
||||
|
||||
public ActionResult Index() {
|
||||
var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() };
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public ActionResult Display(int id) {
|
||||
var model = new DisplayReportViewModel { Report = _reportsManager.Get(id) };
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
11
src/Orchard.Web/Core/Reports/Module.txt
Normal file
11
src/Orchard.Web/Core/Reports/Module.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
name: Reports
|
||||
antiforgery: enabled
|
||||
author: The Orchard Team
|
||||
website: http://orchardproject.net
|
||||
version: 0.1
|
||||
orchardversion: 0.1.2010.0312
|
||||
description: The dashboard module is providing the reports screen of the application.
|
||||
features:
|
||||
Dashboard:
|
||||
Description: Reports management.
|
||||
Category: Core
|
33
src/Orchard.Web/Core/Reports/Routes.cs
Normal file
33
src/Orchard.Web/Core/Reports/Routes.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Core.Reports {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"Admin/Reports",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"},
|
||||
{"controller", "Admin"},
|
||||
{"action", "Index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Reports;
|
||||
|
||||
namespace Orchard.Core.Reports.ViewModels {
|
||||
public class DisplayReportViewModel : BaseViewModel {
|
||||
public Report Report { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Reports;
|
||||
|
||||
namespace Orchard.Core.Reports.ViewModels {
|
||||
public class ReportsAdminIndexViewModel : BaseViewModel {
|
||||
public IList<Report> Reports { get; set; }
|
||||
}
|
||||
}
|
40
src/Orchard.Web/Core/Reports/Views/Admin/Display.aspx
Normal file
40
src/Orchard.Web/Core/Reports/Views/Admin/Display.aspx
Normal file
@@ -0,0 +1,40 @@
|
||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<DisplayReportViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Reports.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Display Report").ToString())%></h1>
|
||||
<% using(Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<fieldset>
|
||||
<table class="items" summary="<%: T("This is a table of the reports in your application") %>">
|
||||
<colgroup>
|
||||
<col id="Col1" />
|
||||
<col id="Col2" />
|
||||
<col id="Col3" />
|
||||
<col id="Col4" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%: T("Type")%></th>
|
||||
<th scope="col"><%: T("Message")%></th>
|
||||
<th scope="col"><%: T("Date")%></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%
|
||||
foreach (var reportEntry in Model.Report.Entries) {
|
||||
%>
|
||||
<tr>
|
||||
<td>
|
||||
<%:reportEntry.Type %>
|
||||
</td>
|
||||
<td>
|
||||
<%:reportEntry.Message %>
|
||||
</td>
|
||||
<td>
|
||||
<%:reportEntry.Utc.ToLocalTime().ToShortDateString()%> <%:reportEntry.Utc.ToLocalTime().ToShortTimeString()%>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
}%>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% } %>
|
40
src/Orchard.Web/Core/Reports/Views/Admin/Index.aspx
Normal file
40
src/Orchard.Web/Core/Reports/Views/Admin/Index.aspx
Normal file
@@ -0,0 +1,40 @@
|
||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ReportsAdminIndexViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Reports.ViewModels"%>
|
||||
<h1><%: Html.TitleForPage(T("Manage Reports").ToString())%></h1>
|
||||
<% using(Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%: Html.ValidationSummary() %>
|
||||
<fieldset>
|
||||
<table class="items" summary="<%: T("This is a table of the reports in your application") %>">
|
||||
<colgroup>
|
||||
<col id="Col1" />
|
||||
<col id="Col2" />
|
||||
<col id="Col3" />
|
||||
<col id="Col4" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%: T("Name")%></th>
|
||||
<th scope="col"><%: T("Title")%></th>
|
||||
<th scope="col"><%: T("Date")%></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%
|
||||
foreach (var report in Model.Reports) {
|
||||
%>
|
||||
<tr>
|
||||
<td>
|
||||
<%: Html.ActionLink(Html.Encode(report.ActivityName), "Display", new {id = report.ReportId}) %>
|
||||
</td>
|
||||
<td>
|
||||
<%:report.Title%>
|
||||
</td>
|
||||
<td>
|
||||
<%:report.Utc.ToLocalTime().ToShortDateString()%> <%:report.Utc.ToLocalTime().ToShortTimeString()%>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
}%>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% } %>
|
34
src/Orchard.Web/Core/Reports/Views/Web.config
Normal file
34
src/Orchard.Web/Core/Reports/Views/Web.config
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add path="*" verb="*"
|
||||
type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
@@ -21,6 +21,7 @@ using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Localization.Services;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Themes;
|
||||
@@ -68,6 +69,7 @@ namespace Orchard.Setup.Services {
|
||||
"Common",
|
||||
"Contents",
|
||||
"Dashboard",
|
||||
"Reports",
|
||||
"Feeds",
|
||||
"HomePage",
|
||||
"Navigation",
|
||||
@@ -111,6 +113,9 @@ namespace Orchard.Setup.Services {
|
||||
using (var environment = new StandaloneEnvironment(bootstrapLifetimeScope)) {
|
||||
|
||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>() );
|
||||
var reportsCoordinator = environment.Resolve<IReportsCoordinator>();
|
||||
|
||||
reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation");
|
||||
|
||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
|
Reference in New Issue
Block a user