mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Starting to give more attention to generic content management (wip)
--HG-- branch : dev
This commit is contained in:
@@ -28,10 +28,10 @@ namespace Orchard.Core.Common.Drivers {
|
||||
var model = new BodyDisplayViewModel { BodyAspect = part, Text = BbcodeReplace(part.Text) };
|
||||
|
||||
return Combined(
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.ManageWrapperPre").Location("primary", "5") : null,
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.Manage").Location("primary", "5") : null,
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.ManageWrapperPre").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5") : null,
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.Manage").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5") : null,
|
||||
ContentPartTemplate(model, TemplateName, Prefix).LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5"),
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.ManageWrapperPost").Location("primary", "5") : null);
|
||||
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.ManageWrapperPost").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5") : null);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BodyAspect part) {
|
||||
|
@@ -30,6 +30,13 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override DriverResult Display(CommonAspect part, string displayType) {
|
||||
var model = new CommonMetadataViewModel(part);
|
||||
return Combined(
|
||||
ContentPartTemplate(model, "Parts/Common.Metadata").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("metadata"),
|
||||
ContentPartTemplate(model, "Parts/Common.Publish").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("secondary"));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(CommonAspect part) {
|
||||
return Combined(OwnerEditor(part, null), ContainerEditor(part, null));
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization;
|
||||
using Orchard.ContentManagement;
|
||||
@@ -15,6 +16,7 @@ namespace Orchard.Core.Common.Handlers {
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IMembershipService _membershipService;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly ICommonService _commonService;
|
||||
|
||||
public CommonAspectHandler(
|
||||
IRepository<CommonRecord> commonRepository,
|
||||
@@ -23,13 +25,15 @@ namespace Orchard.Core.Common.Handlers {
|
||||
IAuthenticationService authenticationService,
|
||||
IAuthorizationService authorizationService,
|
||||
IMembershipService membershipService,
|
||||
IContentManager contentManager) {
|
||||
IContentManager contentManager,
|
||||
ICommonService commonService) {
|
||||
|
||||
_clock = clock;
|
||||
_authenticationService = authenticationService;
|
||||
_authorizationService = authorizationService;
|
||||
_membershipService = membershipService;
|
||||
_contentManager = contentManager;
|
||||
_commonService = commonService;
|
||||
T = NullLocalizer.Instance;
|
||||
|
||||
Filters.Add(StorageFilter.For(commonRepository));
|
||||
@@ -120,6 +124,7 @@ namespace Orchard.Core.Common.Handlers {
|
||||
// add handlers that will load content for id's just-in-time
|
||||
aspect.OwnerField.Loader(() => _contentManager.Get<IUser>(aspect.Record.OwnerId));
|
||||
aspect.ContainerField.Loader(() => aspect.Record.Container == null ? null : _contentManager.Get(aspect.Record.Container.Id));
|
||||
aspect.ScheduledPublishUtc.Loader(() => _commonService.GetScheduledPublishUtc(context.ContentItem));
|
||||
}
|
||||
|
||||
static void PropertySetHandlers(InitializingContentContext context, CommonAspect aspect) {
|
||||
|
@@ -8,11 +8,14 @@ namespace Orchard.Core.Common.Models {
|
||||
public class CommonAspect : ContentPart<CommonRecord>, ICommonAspect {
|
||||
private readonly LazyField<IUser> _owner = new LazyField<IUser>();
|
||||
private readonly LazyField<IContent> _container = new LazyField<IContent>();
|
||||
private readonly LazyField<DateTime?> _scheduledPublishUtc = new LazyField<DateTime?>();
|
||||
|
||||
public LazyField<IUser> OwnerField { get { return _owner; } }
|
||||
|
||||
public LazyField<IContent> ContainerField { get { return _container; } }
|
||||
|
||||
public LazyField<DateTime?> ScheduledPublishUtc { get { return _scheduledPublishUtc; } }
|
||||
|
||||
public IUser Owner {
|
||||
get { return _owner.Value; }
|
||||
set { _owner.Value = value; }
|
||||
|
18
src/Orchard.Web/Core/Common/Services/CommonService.cs
Normal file
18
src/Orchard.Web/Core/Common/Services/CommonService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Tasks.Scheduling;
|
||||
|
||||
namespace Orchard.Core.Common.Services {
|
||||
public class CommonService : ICommonService {
|
||||
private readonly IPublishingTaskManager _publishingTaskManager;
|
||||
|
||||
public CommonService(IPublishingTaskManager publishingTaskManager) {
|
||||
_publishingTaskManager = publishingTaskManager;
|
||||
}
|
||||
|
||||
public DateTime? GetScheduledPublishUtc(ContentItem contentItem) {
|
||||
var task = _publishingTaskManager.GetPublishTask(contentItem);
|
||||
return (task == null ? null : task.ScheduledUtc);
|
||||
}
|
||||
}
|
||||
}
|
8
src/Orchard.Web/Core/Common/Services/ICommonService.cs
Normal file
8
src/Orchard.Web/Core/Common/Services/ICommonService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Core.Common.Services {
|
||||
public interface ICommonService : IDependency {
|
||||
DateTime? GetScheduledPublishUtc(ContentItem contentItem);
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Core.Common.ViewModels {
|
||||
public class CommonMetadataViewModel {
|
||||
private readonly CommonAspect _commonAspect;
|
||||
|
||||
public CommonMetadataViewModel(CommonAspect commonAspect) {
|
||||
_commonAspect = commonAspect;
|
||||
}
|
||||
|
||||
public IUser Creator { get { return _commonAspect.Owner; } }
|
||||
public ContentItem ContentItem { get { return _commonAspect.ContentItem; } }
|
||||
|
||||
public DateTime? CreatedUtc { get { return _commonAspect.CreatedUtc; } }
|
||||
public DateTime? PublishedUtc { get { return _commonAspect.PublishedUtc; } }
|
||||
public DateTime? ModifiedUtc { get { return _commonAspect.ModifiedUtc; } }
|
||||
|
||||
public DateTime? VersionCreatedUtc { get { return _commonAspect.VersionCreatedUtc; } }
|
||||
public DateTime? VersionPublishedUtc { get { return _commonAspect.VersionPublishedUtc; } }
|
||||
public DateTime? VersionModifiedUtc { get { return _commonAspect.VersionModifiedUtc; } }
|
||||
|
||||
public DateTime? ScheduledPublishUtc { get { return _commonAspect.ScheduledPublishUtc.Value; } }
|
||||
|
||||
public bool IsPublished {
|
||||
get { return ContentItem.VersionRecord != null && ContentItem.VersionRecord.Published; }
|
||||
}
|
||||
|
||||
public bool HasDraft {
|
||||
get {
|
||||
return (
|
||||
(ContentItem.VersionRecord != null)
|
||||
&& ((ContentItem.VersionRecord.Published == false)
|
||||
|| (ContentItem.VersionRecord.Published && ContentItem.VersionRecord.Latest == false)));
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasPublished {
|
||||
get { return IsPublished || ContentItem.ContentManager.Get(ContentItem.Id, VersionOptions.Published) != null; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.BodyDisplayViewModel>" %>
|
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.BodyDisplayViewModel>" %>
|
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.BodyDisplayViewModel>" %>
|
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.BodyDisplayViewModel>" %>
|
@@ -0,0 +1,34 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.CommonMetadataViewModel>" %>
|
||||
<ul class="pageStatus">
|
||||
<li><%
|
||||
// Published or not
|
||||
if (Model.HasPublished) { %>
|
||||
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.Pages/Content/Admin/images/online.gif") %>" alt="<%:T("Online") %>" title="<%:T("The page is currently online") %>" /> <%:T("Published") %> | <%
|
||||
}
|
||||
else { %>
|
||||
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.Pages/Content/Admin/images/offline.gif") %>" alt="<%:T("Offline") %>" title="<%:T("The page is currently offline") %>" /> <%:T("Not Published") %> | <%
|
||||
} %>
|
||||
</li>
|
||||
<li><%
|
||||
// Does the page have a draft
|
||||
if (Model.HasDraft) { %>
|
||||
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.Pages/Content/Admin/images/draft.gif") %>" alt="<%:T("Draft") %>" title="<%:T("The page has a draft") %>" /><%:T("Draft") %> | <%
|
||||
}
|
||||
else { %>
|
||||
<%:T("No Draft") %> | <%
|
||||
} %>
|
||||
</li>
|
||||
<li><%
|
||||
if (Model.ScheduledPublishUtc.HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) { %>
|
||||
<img class="icon" src="<%=ResolveUrl("~/Modules/Orchard.Pages/Content/Admin/images/scheduled.gif") %>" alt="<%:T("Scheduled") %>" title="<%:T("The page is scheduled for publishing") %>" /><%:T("Scheduled") %>
|
||||
<%:Html.DateTime(Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt")) %><%
|
||||
}
|
||||
else if (Model.IsPublished && Model.VersionPublishedUtc.HasValue) { %>
|
||||
<%:T("Published: {0}", Html.DateTimeRelative(Model.VersionPublishedUtc.Value, T)) %><%
|
||||
}
|
||||
else if (Model.ModifiedUtc.HasValue) { %>
|
||||
<%:T("Last modified: {0}", Html.DateTimeRelative(Model.ModifiedUtc.Value, T)) %><%
|
||||
} %> |
|
||||
</li>
|
||||
<li><%:T("By {0}", Model.Creator.UserName) %></li>
|
||||
</ul>
|
@@ -1,5 +1,4 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Pages.Models.Page>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.CommonMetadataViewModel>" %>
|
||||
<div class="metadata">
|
||||
<div class="posted"><%: T("Published by {0}", Model.Creator != null ? Model.Creator.UserName : T("nobody(?)").ToString())%></div>
|
||||
</div>
|
@@ -0,0 +1,12 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.CommonMetadataViewModel>" %>
|
||||
<% // todo: make this all work
|
||||
if (Model.HasPublished) { %>
|
||||
<%:Html.ActionLink("View", "Item", new { controller = "Page", slug = "foo" /*Model.PublishedSlug*/ }, new { title = T("View") }) %><%:T(" | ") %><%
|
||||
if (Model.HasDraft) { %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Publish Draft") %>"><%:T("Publish Draft") %></a><%:T(" | ") %><%
|
||||
} %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Unpublish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Unpublish") %>"><%:T("Unpublish") %></a><%:T(" | ") %><%
|
||||
}
|
||||
else { %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Publish")%>"><%:T("Publish") %></a><%:T(" | ") %><%
|
||||
} %>
|
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.ViewModels.CommonMetadataViewModel>" %>
|
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.Core.Contents.ViewModels;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization;
|
||||
@@ -41,9 +39,6 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
|
||||
#region Content
|
||||
|
||||
public ActionResult List(ListContentsViewModel model) {
|
||||
const int pageSize = 20;
|
||||
var skip = (Math.Max(model.Page ?? 0, 1) - 1) * pageSize;
|
||||
@@ -72,7 +67,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
var entry = new ListContentsViewModel.Entry {
|
||||
ContentItem = contentItem,
|
||||
ContentItemMetadata = _contentManager.GetItemMetadata(contentItem),
|
||||
ViewModel = _contentManager.BuildDisplayModel(contentItem, "List"),
|
||||
ViewModel = _contentManager.BuildDisplayModel(contentItem, "SummaryAdmin"),
|
||||
};
|
||||
if (string.IsNullOrEmpty(entry.ContentItemMetadata.DisplayText)) {
|
||||
entry.ContentItemMetadata.DisplayText = string.Format("[{0}#{1}]", contentItem.ContentType, contentItem.Id);
|
||||
@@ -180,7 +175,5 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) {
|
||||
ModelState.AddModelError(key, errorMessage.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
10
src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
Normal file
10
src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
|
||||
namespace Orchard.Core.Contents.Drivers {
|
||||
public class ContentsDriver : ContentItemDriver<ContentPart> {
|
||||
protected override DriverResult Display(ContentPart part, string displayType) {
|
||||
return ContentItemTemplate("Items/Contents.Item").LongestMatch(displayType, "Summary", "SummaryAdmin");
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
|
||||
namespace Orchard.Core.Contents.Handlers {
|
||||
public class ContentsModuleHandler : ContentHandlerBase {
|
||||
public class ContentsHandler : ContentHandlerBase {
|
||||
public override void GetContentItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.Metadata.CreateRouteValues == null) {
|
||||
context.Metadata.CreateRouteValues = new RouteValueDictionary {
|
@@ -1,37 +1,9 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement.Aspects"%>
|
||||
<%@ Import Namespace="Orchard.ContentManagement"%>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<h1><%:Html.TitleForPage(T("Manage {0} Content", !string.IsNullOrEmpty(Model.TypeDisplayName) ? Model.TypeDisplayName : T("all").Text).ToString())%></h1>
|
||||
<div class="manage">
|
||||
<%:Html.ActionLink(!string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Add new {0} content", Model.TypeDisplayName).Text : T("Add new content").Text, "Create", new { }, new { @class = "button primaryAction" })%>
|
||||
</div>
|
||||
<ul class="contentItems"><%
|
||||
foreach (var entry in Model.Entries) { %>
|
||||
<li>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:entry.ContentItem.Is<IRoutableAspect>()
|
||||
? Html.ActionLink(entry.ContentItem.As<IRoutableAspect>().Title, "Edit", new { id = entry.ContentItem.Id })
|
||||
: MvcHtmlString.Create(string.Format("[title display template needed] (content type == \"{0}\")", entry.ContentItem.TypeDefinition.Name)) %></h3>
|
||||
<ul class="pageStatus">
|
||||
<li>
|
||||
<%:T("Last modified: {0}",
|
||||
entry.ContentItem.Is<ICommonAspect>() && entry.ContentItem.As<ICommonAspect>().ModifiedUtc.HasValue
|
||||
? Html.DateTimeRelative(entry.ContentItem.As<ICommonAspect>().ModifiedUtc.Value, T)
|
||||
: T("unknown"))%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="related">
|
||||
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new { id = entry.ContentItem.Id }, new { title = T("Edit").ToString() })%><%: T(" | ")%>
|
||||
<% using (Html.BeginFormAntiForgeryPost(Url.Action("Remove", new { id = entry.ContentItem.Id }), FormMethod.Post, new { @class = "inline link" })) { %>
|
||||
<button type="submit" class="linkButton" title="<%: T("Remove") %>"><%: T("Remove") %></button>
|
||||
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())%><%
|
||||
} %>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</li><%
|
||||
} %>
|
||||
</ul>
|
||||
<%:Html.UnorderedList(
|
||||
Model.Entries,
|
||||
(entry, i) => Html.DisplayForItem(entry.ViewModel),
|
||||
"contentItems") %>
|
@@ -0,0 +1,17 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement.Aspects" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement" %>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:Html.ActionLink(Model.Item.Is<IRoutableAspect>() ? Model.Item.As<IRoutableAspect>().Title : string.Format("[title for this {0}]", Model.Item.TypeDefinition.DisplayName), "Edit", new { id = Model.Item.Id }) %></h3><%
|
||||
Html.Zone("metadata"); %>
|
||||
</div>
|
||||
<div class="related"><%
|
||||
Html.Zone("secondary"); %>
|
||||
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new { id = Model.Item.Id }, new { title = T("Edit Page").ToString() })%><%:T(" | ") %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Delete", new {id = Model.Item.Id})) %>" title="<%:T("Remove Page") %>"><%:T("Remove") %></a>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<% Html.Zone("primary"); %>
|
||||
</div>
|
@@ -1,9 +1,24 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common;
|
||||
using Orchard.Core.Localization.Models;
|
||||
using Orchard.Core.Localization.ViewModels;
|
||||
|
||||
namespace Orchard.Core.Localization.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class LocalizedDriver : ContentPartDriver<Localized> {
|
||||
public LocalizedDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
}
|
||||
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
protected override DriverResult Display(Localized part, string displayType) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ChangeOwner))
|
||||
return null;
|
||||
|
||||
var model = new ContentTranslationsViewModel(part);
|
||||
return ContentPartTemplate(model, "Parts/Localized.ContentTranslations").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("primary", "5");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Orchard.Core.Localization.Models;
|
||||
|
||||
namespace Orchard.Core.Localization.ViewModels {
|
||||
public class ContentTranslationsViewModel {
|
||||
public ContentTranslationsViewModel(Localized part) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Localization.ViewModels.ContentTranslationsViewModel>" %>
|
||||
<div class="content-translations">
|
||||
[translate content]
|
||||
</div>
|
34
src/Orchard.Web/Core/Localization/Views/Web.config
Normal file
34
src/Orchard.Web/Core/Localization/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>
|
@@ -69,16 +69,21 @@
|
||||
<Compile Include="Common\Drivers\TextFieldDriver.cs" />
|
||||
<Compile Include="Common\Fields\TextField.cs" />
|
||||
<Compile Include="Common\Handlers\RoutableAspectHandler.cs" />
|
||||
<Compile Include="Common\Services\ICommonService.cs" />
|
||||
<Compile Include="Common\Services\CommonService.cs" />
|
||||
<Compile Include="Common\Settings\BodySettings.cs" />
|
||||
<Compile Include="Common\ViewModels\CommonMetadataViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\ContainerEditorViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\TextContentFieldDisplayViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
|
||||
<Compile Include="Contents\Controllers\ItemController.cs" />
|
||||
<Compile Include="Contents\Handlers\ContentsModuleHandler.cs" />
|
||||
<Compile Include="Contents\Drivers\ContentsDriver.cs" />
|
||||
<Compile Include="Contents\Handlers\ContentsHandler.cs" />
|
||||
<Compile Include="Contents\ViewModels\EditItemViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
|
||||
<Compile Include="Localization\DataMigrations\LocalizationDataMigration.cs" />
|
||||
<Compile Include="Localization\ViewModels\ContentTranslationsViewModel.cs" />
|
||||
<Compile Include="Localization\Drivers\LocalizedDriver.cs" />
|
||||
<Compile Include="Navigation\DataMigrations\NavigationDataMigration.cs" />
|
||||
<Compile Include="Routable\Controllers\ItemController.cs" />
|
||||
@@ -206,6 +211,14 @@
|
||||
<Content Include="Common\Views\DefinitionTemplates\BodyTypePartSettings.ascx" />
|
||||
<Content Include="Common\Views\DefinitionTemplates\BodyPartSettings.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Fields\Common.TextField.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.Manage.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPost.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPre.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Metadata.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Metadata.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Publish.SummaryAdmin.ascx" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Publish.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\Fields\Common.TextField.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\PlainTextEditor.ascx" />
|
||||
@@ -215,10 +228,12 @@
|
||||
<Content Include="Contents\Views\Admin\Create.aspx" />
|
||||
<Content Include="Contents\Views\Admin\List.ascx" />
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.SummaryAdmin.ascx" />
|
||||
<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="Localization\Module.txt" />
|
||||
<Content Include="Localization\Views\DisplayTemplates\Parts\Localized.ContentTranslations.SummaryAdmin.ascx" />
|
||||
<Content Include="Routable\Module.txt" />
|
||||
<Content Include="Routable\Scripts\jquery.slugify.js" />
|
||||
<Content Include="Routable\Views\EditorTemplates\Parts\Routable.IsRoutable.ascx" />
|
||||
@@ -280,6 +295,7 @@
|
||||
<None Include="App_Data\Localization\fr-FR\orchard.core.po" />
|
||||
<Content Include="Contents\Views\Web.config" />
|
||||
<Content Include="Routable\Views\Web.config" />
|
||||
<Content Include="Localization\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -1,33 +1,23 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Services;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Pages.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Pages.Services;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Pages.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class PageDriver : ContentItemDriver<Page> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
private readonly IPageService _pageService;
|
||||
private readonly IRoutableService _routableService;
|
||||
|
||||
public readonly static ContentType ContentType = new ContentType {
|
||||
Name = "Page",
|
||||
DisplayName = "Page"
|
||||
};
|
||||
|
||||
public PageDriver(IOrchardServices services, IPageService pageService, IRoutableService routableService) {
|
||||
public PageDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
_pageService = pageService;
|
||||
_routableService = routableService;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@@ -70,9 +60,7 @@ namespace Orchard.Pages.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Display(Page page, string displayType) {
|
||||
return Combined(
|
||||
ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin"),
|
||||
ContentPartTemplate(page, "Parts/Pages.Page.Metadata").Location("primary:metadata"));
|
||||
return ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin");
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(Page page) {
|
||||
|
@@ -1,25 +1,19 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Services;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Pages.Drivers;
|
||||
using Orchard.Pages.Models;
|
||||
using Orchard.Pages.Services;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Pages.Handlers {
|
||||
[UsedImplicitly]
|
||||
public class PageHandler : ContentHandler {
|
||||
private readonly IPageService _pageService;
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
|
||||
public PageHandler(IPageService pageService, IOrchardServices orchardServices) {
|
||||
public PageHandler(IPageService pageService) {
|
||||
_pageService = pageService;
|
||||
_orchardServices = orchardServices;
|
||||
T = NullLocalizer.Instance;
|
||||
|
||||
Filters.Add(new ActivatingFilter<Page>(PageDriver.ContentType.Name));
|
||||
|
@@ -123,9 +123,9 @@
|
||||
<Content Include="Styles\jquery-ui-1.7.2.custom.css" />
|
||||
<Content Include="Styles\ui.datepicker.css" />
|
||||
<Content Include="Styles\ui.timepickr.css" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Pages.Page.SummaryAdmin.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Pages.Page.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Pages.Page.Publish.ascx" />
|
||||
<Content Include="Views\Admin\Create.ascx" />
|
||||
@@ -145,6 +145,7 @@
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -0,0 +1,25 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<Orchard.Pages.Models.Page>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels" %>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:Html.ActionLink(Model.Item.Title, "Edit", new { id = Model.Item.Id }) %></h3><%
|
||||
Html.Zone("metadata"); %>
|
||||
</div>
|
||||
<div class="related"><%
|
||||
if (Model.Item.HasPublished) { %>
|
||||
<%:Html.ActionLink("View", "Item", new { controller = "Page", slug = Model.Item.PublishedSlug }, new { title = T("View Page") }) %><%:T(" | ") %><%
|
||||
if (Model.Item.HasDraft) { %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.Item.Id})) %>" title="<%:T("Publish Draft") %>"><%:T("Publish Draft") %></a><%:T(" | ") %><%
|
||||
} %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Unpublish", new {id = Model.Item.Id})) %>" title="<%:T("Unpublish Page") %>"><%:T("Unpublish") %></a><%:T(" | ") %><%
|
||||
}
|
||||
else { %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.Item.Id})) %>" title="<%:T("Publish Page")%>"><%:T("Publish") %></a><%:T(" | ") %><%
|
||||
} %>
|
||||
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new { id = Model.Item.Id }, new { title = T("Edit Page").ToString() })%><%:T(" | ") %>
|
||||
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Delete", new {id = Model.Item.Id})) %>" title="<%:T("Remove Page") %>"><%:T("Remove") %></a>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<% Html.Zone("primary"); %>
|
||||
</div>
|
@@ -677,11 +677,14 @@ table .button {
|
||||
.contentItems .properties {
|
||||
float:left;
|
||||
}
|
||||
.contentItems h3 {
|
||||
padding-top:0;
|
||||
}
|
||||
.contentItems .properties li {
|
||||
border:0;
|
||||
float:left;
|
||||
font-size:1.4em;
|
||||
padding:.8em 0;
|
||||
padding:0 0 .1em 0;
|
||||
}
|
||||
.contentItems .properties .icon {
|
||||
margin:0 .2em -.2em;
|
||||
|
Reference in New Issue
Block a user