mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using JetBrains.Annotations;
|
||||
@@ -9,7 +8,6 @@ using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Settings;
|
||||
using Orchard.Core.Common.ViewModels;
|
||||
using Orchard.Core.ContentsLocation.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Services;
|
||||
|
||||
@@ -49,10 +47,6 @@ namespace Orchard.Core.Common.Drivers {
|
||||
);
|
||||
}
|
||||
|
||||
private string IfThen(bool predicate, string value) {
|
||||
return predicate ? value : null;
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BodyPart part, dynamic shapeHelper) {
|
||||
var model = BuildEditorViewModel(part);
|
||||
return ContentShape("Parts_Common_Body_Edit",
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.ViewModels;
|
||||
using Orchard.Core.ContentsLocation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.Services;
|
||||
@@ -48,8 +47,8 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
protected override DriverResult Editor(CommonPart part, dynamic shapeHelper) {
|
||||
return Combined(
|
||||
OwnerEditor(part, null),
|
||||
ContainerEditor(part, null));
|
||||
OwnerEditor(part, null, shapeHelper),
|
||||
ContainerEditor(part, null, shapeHelper));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(CommonPart instance, IUpdateModel updater, dynamic shapeHelper) {
|
||||
@@ -58,11 +57,11 @@ namespace Orchard.Core.Common.Drivers {
|
||||
instance.VersionModifiedUtc = _clock.UtcNow;
|
||||
|
||||
return Combined(
|
||||
OwnerEditor(instance, updater),
|
||||
ContainerEditor(instance, updater));
|
||||
OwnerEditor(instance, updater, shapeHelper),
|
||||
ContainerEditor(instance, updater, shapeHelper));
|
||||
}
|
||||
|
||||
DriverResult OwnerEditor(CommonPart part, IUpdateModel updater) {
|
||||
DriverResult OwnerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var currentUser = _authenticationService.GetAuthenticatedUser();
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
|
||||
return null;
|
||||
@@ -87,10 +86,11 @@ namespace Orchard.Core.Common.Drivers {
|
||||
}
|
||||
}
|
||||
|
||||
return ContentPartTemplate(model, "Parts/Common.Owner", TemplatePrefix).Location(part.GetLocation("Editor"));
|
||||
return ContentShape("Parts_Common_Owner_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Common.Owner", Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
DriverResult ContainerEditor(CommonPart part, IUpdateModel updater) {
|
||||
DriverResult ContainerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var currentUser = _authenticationService.GetAuthenticatedUser();
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
|
||||
return null;
|
||||
@@ -115,7 +115,8 @@ namespace Orchard.Core.Common.Drivers {
|
||||
}
|
||||
}
|
||||
|
||||
return ContentPartTemplate(model, "Parts/Common.Container", TemplatePrefix).Location(part.GetLocation("Editor"));
|
||||
return ContentShape("Parts_Common_Container_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Common.Container", Model: model, Prefix: Prefix));
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,39 +2,32 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Fields;
|
||||
using Orchard.Core.ContentsLocation.Models;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class TextFieldDriver : ContentFieldDriver<TextField> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
private const string TemplateName = "Fields/Common.TextField";
|
||||
|
||||
public TextFieldDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
}
|
||||
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
private static string GetPrefix(TextField field, ContentPart part) {
|
||||
return part.PartDefinition.Name + "." + field.Name;
|
||||
}
|
||||
|
||||
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
|
||||
var location = field.GetLocation(displayType, "Primary", "1");
|
||||
|
||||
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
|
||||
.Location(location);
|
||||
protected override DriverResult Display(ContentPart part, TextField field, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Common_Text", () => shapeHelper.Fields_Common_Text(ContentField: field, Name: field.Name, Value: field.Value));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, TextField field) {
|
||||
var location = field.GetLocation("Editor", "Primary", "1");
|
||||
|
||||
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
|
||||
.Location(location);
|
||||
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Common_Text_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Fields/Common.Text.Edit", Model: field, Prefix: GetPrefix(field, part)));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) {
|
||||
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(field, GetPrefix(field, part), null, null);
|
||||
return Editor(part, field);
|
||||
return Editor(part, field, shapeHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,16 +1,24 @@
|
||||
<Placement>
|
||||
<!-- available display shapes -->
|
||||
<!--
|
||||
Parts_Common_Body
|
||||
Parts_Common_Body_Summary
|
||||
Parts_Common_Metadata
|
||||
Parts_Common_Metadata_Summary
|
||||
Parts_Common_Metadata_SummaryAdmin
|
||||
Fields_Common_Text
|
||||
-->
|
||||
<!-- edit shape just get default placement -->
|
||||
<!-- edit shapes getting default placements -->
|
||||
<!-- edit "shape" -->
|
||||
<Place Parts_Common_Body_Edit="Primary:2"/>
|
||||
<Place Parts_Common_Owner_Edit="Primary:20"/>
|
||||
<Place Parts_Common_Container_Edit="Primary:20"/>
|
||||
<Place Fields_Common_Text_Edit="Primary:2.5"/>
|
||||
<!-- default positioning -->
|
||||
<!-- show summary for all DisplayType by default -->
|
||||
<Place Parts_Common_Body_Summary="Content:5"/>
|
||||
<!-- with text fields a little before -->
|
||||
<Place Fields_Common_Text="Content:2.5"/>
|
||||
<Match DisplayType="Detail">
|
||||
<!-- hide summary, show full content, for Detail -->
|
||||
<Place Parts_Common_Body_Summary="-"
|
||||
|
@@ -1,9 +0,0 @@
|
||||
using System.Web;
|
||||
using Orchard.Core.Common.Models;
|
||||
|
||||
namespace Orchard.Core.Common.ViewModels {
|
||||
public class BodyDisplayViewModel {
|
||||
public BodyPart BodyPart { get; set; }
|
||||
public IHtmlString Html { get; set; }
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Core.Common.ViewModels {
|
||||
public class CommonMetadataViewModel {
|
||||
private readonly CommonPart _commonPart;
|
||||
|
||||
public CommonMetadataViewModel(CommonPart commonPart) {
|
||||
_commonPart = commonPart;
|
||||
}
|
||||
|
||||
public IUser Creator { get { return _commonPart.Owner; } }
|
||||
|
||||
public DateTime? CreatedUtc { get { return _commonPart.CreatedUtc; } }
|
||||
public DateTime? PublishedUtc { get { return _commonPart.PublishedUtc; } }
|
||||
public DateTime? ModifiedUtc { get { return _commonPart.ModifiedUtc; } }
|
||||
|
||||
public DateTime? VersionCreatedUtc { get { return _commonPart.VersionCreatedUtc; } }
|
||||
public DateTime? VersionPublishedUtc { get { return _commonPart.VersionPublishedUtc; } }
|
||||
public DateTime? VersionModifiedUtc { get { return _commonPart.VersionModifiedUtc; } }
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
@model Orchard.Core.Common.Fields.TextField
|
||||
@using Orchard.Utility.Extensions;
|
||||
<p class="text-field"><span class="name">@Model.Name.CamelFriendly():</span> @Model.Value</p>
|
@@ -1 +0,0 @@
|
||||
@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel
|
@@ -1,5 +0,0 @@
|
||||
@model BodyDisplayViewModel
|
||||
@using Orchard.Core.Common.ViewModels;
|
||||
<div class="manage">
|
||||
@Html.ItemEditLinkWithReturnUrl(T("Edit").ToString(), Model.BodyPart.ContentItem)
|
||||
</div>
|
@@ -1 +0,0 @@
|
||||
@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel
|
@@ -1,7 +0,0 @@
|
||||
@model BodyDisplayViewModel
|
||||
@using Orchard.Core.Common.ViewModels;
|
||||
@* begin: knowingly broken HTML (hence the ManageWrapperPre and ManageWrapperPost templates)
|
||||
we need "wrapper templates" (among other functionality) in the future of UI composition
|
||||
please do not delete or the front end will be broken when the user is authenticated. *@
|
||||
</div>
|
||||
@* begin: knowingly broken HTML *@
|
@@ -1 +0,0 @@
|
||||
@model Orchard.Core.Common.ViewModels.BodyDisplayViewModel
|
@@ -1,3 +0,0 @@
|
||||
@model BodyDisplayViewModel
|
||||
@using Orchard.Core.Common.ViewModels;
|
||||
<div class="managewrapper">
|
@@ -0,0 +1,8 @@
|
||||
@using Orchard.Utility.Extensions;
|
||||
@{
|
||||
string name = Model.Name;
|
||||
string value = Model.Value;
|
||||
}
|
||||
@if (HasText(name) && HasText(value)) {
|
||||
<p class="text-field"><span class="name">@name.CamelFriendly():</span> <span class="value">@value</span></p>
|
||||
}
|
@@ -9,6 +9,7 @@ using Orchard.Messaging.Services;
|
||||
namespace Orchard.Core.Messaging.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class MessageSettingsPartDriver : ContentPartDriver<MessageSettingsPart> {
|
||||
private const string TemplateName = "Parts/MessageSettings";
|
||||
private readonly IMessageManager _messageQueueManager;
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Orchard.Core.Messaging.Drivers {
|
||||
MessageSettings = part
|
||||
};
|
||||
|
||||
return ContentPartTemplate(model, "Parts/Messaging.MessageSettings");
|
||||
return ContentShape("Parts_MessageSettings_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MessageSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
@@ -37,10 +38,9 @@ namespace Orchard.Core.Messaging.Drivers {
|
||||
MessageSettings = part
|
||||
};
|
||||
|
||||
if (updater.TryUpdateModel(model, Prefix, null, null)) {
|
||||
}
|
||||
updater.TryUpdateModel(model, Prefix, null, null);
|
||||
|
||||
return ContentPartTemplate(model, "Parts/Messaging.MessageSettings");
|
||||
return ContentShape("Parts_MessageSettings_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,8 +6,9 @@ namespace Orchard.Core.Messaging {
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("MessageSettingsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("DefaultChannelService")
|
||||
.Column<string>("DefaultChannelService", c => c.WithLength(64))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,10 @@
|
||||
using Orchard.ContentManagement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Core.Messaging.Models {
|
||||
public class MessageSettingsPart : ContentPart<MessageSettingsPartRecord> {
|
||||
|
||||
[StringLength(MessageSettingsPartRecord.DefaultChannelServiceLength)]
|
||||
public string DefaultChannelService {
|
||||
get { return Record.DefaultChannelService; }
|
||||
set { Record.DefaultChannelService = value; }
|
||||
|
@@ -1,10 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Core.Messaging.Models {
|
||||
public class MessageSettingsPartRecord : ContentPartRecord {
|
||||
public const ushort DefaultChannelServiceLength = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Default service used for messages
|
||||
/// </summary>
|
||||
[StringLength(DefaultChannelServiceLength)]
|
||||
public virtual string DefaultChannelService { get; set; }
|
||||
|
||||
}
|
||||
|
3
src/Orchard.Web/Core/Messaging/Placement.info
Normal file
3
src/Orchard.Web/Core/Messaging/Placement.info
Normal file
@@ -0,0 +1,3 @@
|
||||
<Placement>
|
||||
<Place Parts_MessageSettings_Edit="Primary:10"/>
|
||||
</Placement>
|
@@ -82,7 +82,6 @@
|
||||
<Compile Include="ContentsLocation\Models\LocationSettings.cs" />
|
||||
<Compile Include="ContentsLocation\Settings\LocationSettingsEditorEvents.cs" />
|
||||
<Compile Include="ContentsLocation\ViewModels\LocationSettingsViewModel.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" />
|
||||
@@ -148,7 +147,6 @@
|
||||
<Compile Include="Common\Models\BodyPart.cs" />
|
||||
<Compile Include="Common\Models\BodyPartRecord.cs" />
|
||||
<Compile Include="Common\Models\CommonPartRecord.cs" />
|
||||
<Compile Include="Common\ViewModels\BodyDisplayViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\BodyEditorViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\OwnerEditorViewModel.cs" />
|
||||
<Compile Include="Contents\AdminMenu.cs" />
|
||||
@@ -255,11 +253,8 @@
|
||||
<Content Include="Common\Module.txt" />
|
||||
<Content Include="Common\Views\DefinitionTemplates\BodyTypePartSettings.cshtml" />
|
||||
<Content Include="Common\Views\DefinitionTemplates\BodyPartSettings.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Fields\Common.TextField.cshtml" />
|
||||
<Content Include="Common\Views\Fields\Common.Text.cshtml" />
|
||||
<Content Include="Common\Views\Parts\Common.Body.SummaryAdmin.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.Manage.SummaryAdmin.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPost.SummaryAdmin.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPre.SummaryAdmin.cshtml" />
|
||||
<Content Include="Common\Views\Parts\Common.Metadata.cshtml" />
|
||||
<Content Include="Common\Views\Parts\Common.Metadata.SummaryAdmin.cshtml" />
|
||||
<Content Include="ContentsLocation\Module.txt" />
|
||||
@@ -273,7 +268,7 @@
|
||||
<Content Include="Contents\Views\Parts\Contents.Publish.cshtml" />
|
||||
<Content Include="Contents\Views\Parts\Contents.Publish.SummaryAdmin.cshtml" />
|
||||
<Content Include="Messaging\Module.txt" />
|
||||
<Content Include="Messaging\Views\EditorTemplates\Parts\Messaging.MessageSettings.cshtml" />
|
||||
<Content Include="Messaging\Views\EditorTemplates\Parts\MessageSettings.cshtml" />
|
||||
<Content Include="PublishLater\Content\Admin\images\draft.gif" />
|
||||
<Content Include="PublishLater\Content\Admin\images\offline.gif" />
|
||||
<Content Include="PublishLater\Content\Admin\images\online.gif" />
|
||||
@@ -281,7 +276,7 @@
|
||||
<Content Include="PublishLater\Content\Admin\images\scheduled.gif" />
|
||||
<Content Include="PublishLater\Views\Parts\PublishLater.Metadata.cshtml" />
|
||||
<Content Include="PublishLater\Views\Parts\PublishLater.Metadata.SummaryAdmin.cshtml" />
|
||||
<Content Include="Common\Views\EditorTemplates\Fields\Common.TextField.cshtml" />
|
||||
<Content Include="Common\Views\EditorTemplates\Fields\Common.Text.Edit.cshtml" />
|
||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.cshtml" />
|
||||
<Content Include="Common\Views\EditorTemplates\PlainTextEditor.cshtml" />
|
||||
<Content Include="Contents\Module.txt" />
|
||||
@@ -359,9 +354,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Common\Views\Parts\Common.Body.Summary.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPost.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ManageWrapperPre.cshtml" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.Manage.cshtml" />
|
||||
<Content Include="Dashboard\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
@@ -390,8 +382,14 @@
|
||||
<None Include="Contents\Placement.info" />
|
||||
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||
<Content Include="Contents\Views\Item\Display.cshtml" />
|
||||
<None Include="Contents\Views\Items\Content.Edit.cshtml" />
|
||||
<None Include="Localization\Placement.info" />
|
||||
<None Include="PublishLater\Placement.info" />
|
||||
<Content Include="Messaging\Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="PublishLater\Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Routable\Views\Parts\RoutableTitle.cshtml" />
|
||||
<None Include="PublishLater\Views\Parts\PublishLater.Metadata.Summary.cshtml" />
|
||||
<Content Include="Routable\Views\Item\Display.cshtml" />
|
||||
|
@@ -29,22 +29,26 @@ namespace ArchiveLater.Drivers {
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
protected override DriverResult Display(ArchiveLaterPart part, string displayType, dynamic shapeHelper) {
|
||||
var metadata = shapeHelper.Parts_ArchiveLater_Metadata(ContentPart: part, ScheduledArchiveUtc: part.ScheduledArchiveUtc.Value);
|
||||
if (!string.IsNullOrWhiteSpace(displayType))
|
||||
metadata.Metadata.Type = string.Format("{0}.{1}", metadata.Metadata.Type, displayType);
|
||||
var location = part.GetLocation(displayType);
|
||||
return ContentShape(metadata).Location(location);
|
||||
return ContentShape("Parts_ArchiveLater_Metadata_SummaryAdmin",
|
||||
shape => {
|
||||
part.ScheduledArchiveUtc.Value = DateTime.UtcNow.AddDays(5);
|
||||
|
||||
return shape
|
||||
.ContentPart(part)
|
||||
.ScheduledArchiveUtc(part.ScheduledArchiveUtc.Value)
|
||||
.IsPublished(part.ContentItem.VersionRecord != null && part.ContentItem.VersionRecord.Published);
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ArchiveLaterPart part, dynamic shapeHelper) {
|
||||
return ArchiveEditor(part, null);
|
||||
return ArchiveEditor(part, null, shapeHelper);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ArchiveLaterPart instance, IUpdateModel updater, dynamic shapeHelper) {
|
||||
return ArchiveEditor(instance, updater);
|
||||
return ArchiveEditor(instance, updater, shapeHelper);
|
||||
}
|
||||
|
||||
DriverResult ArchiveEditor(ArchiveLaterPart part, IUpdateModel updater) {
|
||||
DriverResult ArchiveEditor(ArchiveLaterPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var model = new ArchiveLaterViewModel(part);
|
||||
|
||||
if ( updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null) ) {
|
||||
@@ -53,14 +57,14 @@ namespace ArchiveLater.Drivers {
|
||||
if (DateTime.TryParse(string.Format("{0} {1}", model.ScheduledArchiveDate, model.ScheduledArchiveTime), out scheduled))
|
||||
model.ScheduledArchiveUtc = scheduled.ToUniversalTime();
|
||||
_archiveLaterService.ArchiveLater(model.ContentItem, model.ScheduledArchiveUtc.HasValue ? model.ScheduledArchiveUtc.Value : DateTime.MaxValue);
|
||||
//Services.Notifier.Information(T("{0} has been scheduled for publishing!", model.ContentItem.TypeDefinition.DisplayName));
|
||||
}
|
||||
else {
|
||||
//_archiveLaterService.RemoveArchiveLaterTasks(model.ContentItem);
|
||||
_archiveLaterService.RemoveArchiveLaterTasks(model.ContentItem);
|
||||
}
|
||||
}
|
||||
|
||||
return ContentPartTemplate(model, "Parts/ArchiveLater", TemplatePrefix).Location(part.GetLocation("Editor"));
|
||||
return ContentShape("Parts_ArchiveLater_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/ArchiveLater", Model: model, Prefix: Prefix));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ArchiveLater.Models;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.ArchiveLater {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
public int Create() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(ArchiveLaterPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Default", new ContentLocation { Zone = "metadata", Position = "2" }},
|
||||
{"Editor", new ContentLocation { Zone = "secondary", Position = "2" }}
|
||||
}));
|
||||
ContentDefinitionManager.AlterPartDefinition("ArchiveLaterPart", builder => builder.Attachable());
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterPartDefinition("ArchiveLaterPart", builder => builder.Attachable());
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -98,10 +98,14 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Parts\ArchiveLater.Metadata.cshtml" />
|
||||
<Content Include="Views\Parts\ArchiveLater.Metadata.SummaryAdmin.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\ArchiveLater.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</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,6 @@
|
||||
<Placement>
|
||||
<Match DisplayType="SummaryAdmin">
|
||||
<Place Parts_ArchiveLater_Metadata_SummaryAdmin="Meta:2"/>
|
||||
</Match>
|
||||
<Place Parts_ArchiveLater_Edit="Secondary:2"/>
|
||||
</Placement>
|
@@ -1,14 +1,11 @@
|
||||
@model Orchard.ArchiveLater.ViewModels.ArchiveLaterViewModel
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.Mvc.Html;
|
||||
|
||||
@if ((Model.IsPublished && Model.ScheduledArchiveUtc.HasValue && Model.ScheduledArchiveUtc.Value > DateTime.UtcNow)) {
|
||||
@if ((Model.IsPublished && Model.ScheduledArchiveUtc != null && Model.ScheduledArchiveUtc > DateTime.UtcNow)) {
|
||||
<ul class="pageStatus">
|
||||
<li>
|
||||
<img class="icon" src="@ResolveUrl("~/Modules/ArchiveLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for archiving")" />@T("Unpublish on")
|
||||
@Html.DateTime(Model.ScheduledArchiveUtc.Value.ToLocalTime(), T("M/d/yyyy h:mm tt"))
|
||||
<img class="icon" src="@Href("~/Modules/Orchard.ArchiveLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for archiving")" />@T("Unpublish on")
|
||||
@Html.DateTime((DateTime)Model.ScheduledArchiveUtc.ToLocalTime(), T("M/d/yyyy h:mm tt"))
|
||||
|
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1 +0,0 @@
|
||||
@model Orchard.ArchiveLater.ViewModels.ArchiveLaterViewModel
|
@@ -47,7 +47,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Blogs_RecentBlogPosts_Editor",
|
||||
return ContentShape("Parts_Blogs_RecentBlogPosts_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Blogs.RecentBlogPosts", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
|
@@ -20,13 +20,13 @@ namespace Orchard.Email.Drivers {
|
||||
protected override string Prefix { get { return "SmtpSettings"; } }
|
||||
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_SmtpSettings_Editor",
|
||||
return ContentShape("Parts_SmtpSettings_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(SmtpSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(part, Prefix, null, null);
|
||||
return ContentShape("Parts_SmtpSettings_Editor",
|
||||
return ContentShape("Parts_SmtpSettings_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<Placement>
|
||||
<Place Parts_SmtpSettings_Editor="Primary:10"/>
|
||||
<Place Parts_SmtpSettings_Edit="Primary:10"/>
|
||||
</Placement>
|
||||
|
@@ -103,7 +103,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Admin\images\disabled.gif" />
|
||||
<Content Include="Content\Admin\images\enabled.gif" />
|
||||
<Content Include="styles\admin.css" />
|
||||
<Content Include="Styles\admin.css" />
|
||||
<Content Include="Views\Admin\Features.cshtml" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
|
@@ -220,7 +220,7 @@ namespace Orchard.Modules.Services {
|
||||
Category = TryLocalize(f.Name + " Category", f.Category, localizer),
|
||||
Dependencies = f.Dependencies,
|
||||
Description = TryLocalize(f.Name + " Description", f.Description, localizer),
|
||||
DisplayName = TryLocalize(f.Name + " Name", f.Description, localizer),
|
||||
DisplayName = TryLocalize(f.Name + " Name", f.DisplayName, localizer),
|
||||
Extension = f.Extension,
|
||||
Name = f.Name,
|
||||
})
|
||||
|
@@ -36,7 +36,7 @@ namespace Orchard.Tags.Drivers {
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part))
|
||||
return null;
|
||||
|
||||
return ContentShape("Parts_Tags_Editor",
|
||||
return ContentShape("Parts_Tags_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: BuildEditorViewModel(part), Prefix: Prefix));
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Orchard.Tags.Drivers {
|
||||
_tagService.UpdateTagsForContentItem(part.ContentItem.Id, tagNames);
|
||||
}
|
||||
|
||||
return ContentShape("Parts_Tags_Editor",
|
||||
return ContentShape("Parts_Tags_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
|
@@ -119,7 +119,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Items\User.Editor.cshtml">
|
||||
<Content Include="Views\Items\User.Edit.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
@@ -4,4 +4,4 @@ Description: It's a *really* good theme, yo.
|
||||
Version: 0.1
|
||||
Tags: Awesome
|
||||
Website: http://orchardproject.net
|
||||
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond
|
||||
Zones: Header, Navigation, Featured, BeforeMain, AsideFirst, Messages, BeforeContent, Content, AfterContent, AsideSecond, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer
|
@@ -3,22 +3,23 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.ContentManagement.Drivers {
|
||||
public abstract class ContentFieldDriver<TField> : IContentFieldDriver where TField : ContentField, new() {
|
||||
protected virtual string Prefix { get { return ""; } }
|
||||
protected virtual string Zone { get { return "body"; } }
|
||||
protected virtual string Zone { get { return "Content"; } }
|
||||
|
||||
DriverResult IContentFieldDriver.BuildDisplayShape(BuildDisplayContext context) {
|
||||
return Process(context.ContentItem, (part, field) => Display(part, field, context.DisplayType));
|
||||
return Process(context.ContentItem, (part, field) => Display(part, field, context.DisplayType, context.New));
|
||||
}
|
||||
|
||||
DriverResult IContentFieldDriver.BuildEditorShape(BuildEditorContext context) {
|
||||
return Process(context.ContentItem, Editor);
|
||||
return Process(context.ContentItem, (part, field) => Editor(part, field, context.New));
|
||||
}
|
||||
|
||||
DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) {
|
||||
return Process(context.ContentItem, (part, field) => Editor(part, field, context.Updater));
|
||||
return Process(context.ContentItem, (part, field) => Editor(part, field, context.Updater, context.New));
|
||||
}
|
||||
|
||||
DriverResult Process(ContentItem item, Func<ContentPart, TField, DriverResult> effort) {
|
||||
@@ -43,19 +44,44 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
}
|
||||
|
||||
|
||||
protected virtual DriverResult Display(ContentPart part, TField field, string displayType) { return null; }
|
||||
protected virtual DriverResult Editor(ContentPart part, TField field) { return null; }
|
||||
protected virtual DriverResult Editor(ContentPart part, TField field, IUpdateModel updater) { return null; }
|
||||
protected virtual DriverResult Display(ContentPart part, TField field, string displayType, dynamic shapeHelper) { return null; }
|
||||
protected virtual DriverResult Editor(ContentPart part, TField field, dynamic shapeHelper) { return null; }
|
||||
protected virtual DriverResult Editor(ContentPart part, TField field, IUpdateModel updater, dynamic shapeHelper) { return null; }
|
||||
|
||||
public ContentShapeResult ContentShape(string shapeType, Func<dynamic> factory) {
|
||||
return ContentShapeImplementation(shapeType, null, ctx => factory());
|
||||
}
|
||||
|
||||
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic> factory) {
|
||||
return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory());
|
||||
}
|
||||
|
||||
public ContentShapeResult ContentShape(string shapeType, Func<dynamic, dynamic> factory) {
|
||||
return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType)));
|
||||
}
|
||||
|
||||
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic, dynamic> factory) {
|
||||
return ContentShapeImplementation(shapeType, defaultLocation, factory);
|
||||
}
|
||||
|
||||
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<BuildShapeContext, object> shapeBuilder) {
|
||||
return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation);
|
||||
}
|
||||
|
||||
private object CreateShape(BuildShapeContext context, string shapeType) {
|
||||
IShapeFactory shapeFactory = context.New;
|
||||
return shapeFactory.Create(shapeType);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public ContentTemplateResult ContentFieldTemplate(object model) {
|
||||
return new ContentTemplateResult(model, null, Prefix).Location(Zone);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public ContentTemplateResult ContentFieldTemplate(object model, string template) {
|
||||
return new ContentTemplateResult(model, template, Prefix).Location(Zone);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public ContentTemplateResult ContentFieldTemplate(object model, string template, string prefix) {
|
||||
return new ContentTemplateResult(model, template, prefix).Location(Zone);
|
||||
}
|
||||
@@ -64,4 +90,4 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
return new CombinedResult(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ using Orchard.DisplayManagement;
|
||||
namespace Orchard.ContentManagement.Drivers {
|
||||
public abstract class ContentPartDriver<TContent> : IContentPartDriver where TContent : ContentPart, new() {
|
||||
protected virtual string Prefix { get { return ""; } }
|
||||
protected virtual string Zone { get { return "Primary"; } }
|
||||
protected virtual string Zone { get { return "Content"; } }
|
||||
|
||||
DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) {
|
||||
var part = context.ContentItem.As<TContent>();
|
||||
@@ -45,7 +45,6 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType)));
|
||||
}
|
||||
|
||||
|
||||
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic, dynamic> factory) {
|
||||
return ContentShapeImplementation(shapeType, defaultLocation, factory);
|
||||
}
|
||||
|
Reference in New Issue
Block a user