--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-10-18 14:37:55 -07:00
63 changed files with 304 additions and 718 deletions

View File

@@ -1,8 +0,0 @@
using Orchard.Localization;
namespace Orchard.Core.ContentsLocation.Models {
public class LocationDefinition {
public string Name { get; set; }
public LocalizedString DisplayName { get; set; }
}
}

View File

@@ -1,69 +0,0 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
namespace Orchard.Core.ContentsLocation.Models {
public class LocationSettings : Dictionary<string, ContentLocation> {
public LocationSettings() { }
public LocationSettings(LocationSettings value)
: base(value) {
}
public ContentLocation Get(string location) {
return Get(location, null, null);
}
public ContentLocation Get(string location, string defaultZone, string defaultPosition) {
ContentLocation result;
if (this.TryGetValue(location, out result)) {
return result;
}
return new ContentLocation { Zone = defaultZone, Position = defaultPosition };
}
}
public static class LocationSettingsExtensions {
public static ContentLocation GetLocation<TContent>(this TContent part, string locationName) where TContent : ContentPart {
return part.GetLocation(locationName, null, null);
}
public static ContentLocation GetLocation(this ContentPart part, string locationName, string defaultZone, string defaultPosition) {
// Get the specific location from the part in the type context
var location = part.TypePartDefinition.Settings.GetModel<LocationSettings>().Get(locationName);
if (location.Position != null || location.Zone != null)
return location;
// Get the "Default" location from the part in the type context
location = part.TypePartDefinition.Settings.GetModel<LocationSettings>().Get("Default");
if (location.Position != null || location.Zone != null)
return location;
// Get the specific location from the part definition
location = part.PartDefinition.Settings.GetModel<LocationSettings>().Get(locationName);
if (location.Position != null || location.Zone != null)
return location;
// Get the "Default" location from the part definition
location = part.PartDefinition.Settings.GetModel<LocationSettings>().Get("Default");
if (location.Position != null || location.Zone != null)
return location;
return new ContentLocation { Zone = defaultZone, Position = defaultPosition };
}
public static ContentLocation GetLocation(this ContentField field, string locationName, string defaultZone, string defaultPosition) {
// Get the specific location from the part in the type context
var location = field.PartFieldDefinition.Settings.GetModel<LocationSettings>().Get(locationName);
if (location.Position != null || location.Zone != null)
return location;
// Get the "Default" location from the part in the type context
location = field.PartFieldDefinition.Settings.GetModel<LocationSettings>().Get("Default");
if (location.Position != null || location.Zone != null)
return location;
return new ContentLocation { Zone = defaultZone, Position = defaultPosition };
}
}
}

View File

@@ -1,12 +0,0 @@
Name: ContentsLocation
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 0.8.0
OrchardVersion: 0.8.0
Description: The "Contents Location" module introduces settings for part and field to fine tune the location of contents.
Features:
ContentsLocation:
Description: Contents location settings management
Dependencies: Settings
Category: Core

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.UI.Resources;
namespace Orchard.Core.ContentsLocation {
public class ResourceManifest : IResourceManifestProvider {
public void BuildManifests(ResourceManifestBuilder builder) {
builder.Add().DefineStyle("ContentsLocationAdmin").SetUrl("admin.css");
}
}
}

View File

@@ -1,120 +0,0 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Core.ContentsLocation.ViewModels;
using Orchard.Localization;
namespace Orchard.Core.ContentsLocation.Settings {
public class LocationSettingsEditorEvents : ContentDefinitionEditorEventsBase {
public LocationSettingsEditorEvents() {
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
private IEnumerable<LocationDefinition> GetPredefinedLocations() {
yield return new LocationDefinition { Name = "Default", DisplayName = T("Default location (i.e. fallback if no specific override)") };
yield return new LocationDefinition { Name = "Detail", DisplayName = T("\"Detail\" display location") };
yield return new LocationDefinition { Name = "Editor", DisplayName = T("\"Editor\" display location") };
yield return new LocationDefinition { Name = "Summary", DisplayName = T("\"Summary\" (front-end) display location") };
yield return new LocationDefinition { Name = "SummaryAdmin", DisplayName = T("\"Summary\" (admin) display location") };
}
private LocationSettings MergeSettings(LocationSettings partSettings, LocationSettings partDefinitionSettings) {
return partSettings;
//var result = new LocationSettings(partSettings);
//foreach (var entry in partDefinitionSettings) {
// if (!partSettings.ContainsKey(entry.Key))
// partSettings[entry.Key] = entry.Value;
//}
//return result;
}
#region Standalone part definition
public override IEnumerable<TemplateViewModel> PartEditor(ContentPartDefinition definition) {
var settings = definition.Settings.GetModel<LocationSettings>();
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel {
Definition = location,
Location = settings.Get(location.Name),
DefaultLocation = new ContentLocation()
};
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
}
public override IEnumerable<TemplateViewModel> PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel) {
var settings = new LocationSettings();
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel();
updateModel.TryUpdateModel(viewModel, location.Name, null, null);
settings[location.Name] = viewModel.Location;
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
builder.WithLocation(settings);
}
#endregion
#region Part in the context of a content type
public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) {
// Look for the setting in the most specific settings first (part definition in type)
// then in the global part definition.
var partSettings = definition.Settings.GetModel<LocationSettings>();
var partDefinitionSettings = definition.PartDefinition.Settings.GetModel<LocationSettings>();
var settings = MergeSettings(partSettings, partDefinitionSettings);
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel {
Definition = location,
Location = settings.Get(location.Name),
DefaultLocation = partDefinitionSettings.Get(location.Name)
};
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
}
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) {
var settings = new LocationSettings();
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel();
updateModel.TryUpdateModel(viewModel, location.Name, null, null);
settings[location.Name] = viewModel.Location;
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
builder.WithLocation(settings);
}
#endregion
#region Field within a content part
public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition) {
var settings = definition.Settings.GetModel<LocationSettings>();
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel {
Definition = location,
Location = settings.Get(location.Name),
DefaultLocation = new ContentLocation { Zone = "Primary", Position = "1" }
};
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
}
public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
var settings = new LocationSettings();
foreach (var location in GetPredefinedLocations()) {
var viewModel = new LocationSettingsViewModel();
updateModel.TryUpdateModel(viewModel, location.Name, null, null);
settings[location.Name] = viewModel.Location;
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}
builder.WithLocation(settings);
}
#endregion
}
}

View File

@@ -1,25 +0,0 @@
fieldset.location-setting {
overflow:auto;
}
fieldset.location-setting legend {
font-weight:normal;
margin:0;
padding-bottom:0;
}
fieldset.location-setting label {
display:inline;
}
fieldset.location-setting input.text-box {
display:block;
width:24em;
}
fieldset.location-setting fieldset {
clear:none;
float:left;
margin-right:1em;
margin-top:.5em;
}
fieldset.location-setting .default {
font-size:1.2em;
font-style:italic;
}

View File

@@ -1,10 +0,0 @@
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
namespace Orchard.Core.ContentsLocation.ViewModels {
public class LocationSettingsViewModel {
public LocationDefinition Definition { get; set; }
public ContentLocation Location { get; set; }
public ContentLocation DefaultLocation { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
@model Orchard.Core.ContentsLocation.ViewModels.LocationSettingsViewModel
@{ Style.Require("ContentsLocationAdmin"); }
<fieldset class="location-setting">
<legend>@T("{0}", Model.Definition.DisplayName)</legend>
<fieldset>
<label for="@Html.FieldIdFor(m => m.Location.Zone)">@T("Zone name (e.g. body, primary)")</label>
@if (!string.IsNullOrWhiteSpace(Model.DefaultLocation.Zone)) {
<span class="default">@T(" - default: {0}", Model.DefaultLocation.Zone)</span>
}
@Html.EditorFor(m => m.Location.Zone)
@Html.ValidationMessageFor(m => m.Location.Zone)
</fieldset>
<fieldset>
<label for="@Html.FieldIdFor(m => m.Location.Position)">
@T("Position in zone (e.g. 1, 1.0, 2.5.1)")</label>
@if (!string.IsNullOrWhiteSpace(Model.DefaultLocation.Zone)) {
<span class="default">@T(" - default: {0}", Model.DefaultLocation.Position)</span>
}
@Html.EditorFor(m => m.Location.Position)
</fieldset>@Html.ValidationMessageFor(m => m.Location.Position)
</fieldset>

View File

@@ -1,42 +0,0 @@
<?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=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" 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>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -3,7 +3,6 @@ using System.Linq;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Core.Localization.Models;
using Orchard.Core.Localization.Services;
using Orchard.Core.Localization.ViewModels;
@@ -43,7 +42,8 @@ namespace Orchard.Core.Localization.Drivers {
ContentLocalizations = new ContentLocalizationsViewModel(part) { Localizations = localizations }
};
return ContentPartTemplate(model, "Parts/Localization.Translation", TemplatePrefix).Location(part.GetLocation("Editor"));
// TODO: andrerod convert to new shape API. Location code kept for reference.
return ContentPartTemplate(model, "Parts/Localization.Translation", TemplatePrefix); //.Location(part.GetLocation("Editor"));
}
protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -16,14 +16,11 @@ namespace Orchard.Core.Navigation.Drivers {
}
protected override DriverResult Editor(MenuItemPart itemPart, IUpdateModel updater, dynamic shapeHelper) {
//todo: (heskew) need context
var currentUser = _workContextAccessor.GetContext().CurrentUser;
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, currentUser, itemPart))
return null;
updater.TryUpdateModel(itemPart, Prefix, null, null);
return null;
}
}

View File

@@ -1,8 +1,6 @@
using System;
using JetBrains.Annotations;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Localization;
using Orchard.Security;
@@ -28,25 +26,23 @@ namespace Orchard.Core.Navigation.Drivers {
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
return null;
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor"));
return ContentShape("Parts_Navigation_Menu_Edit",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Navigation.Menu.Edit", Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(MenuPart part, IUpdateModel updater, dynamic shapeHelper) {
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part)) {
if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part))
return null;
}
if (string.IsNullOrEmpty(part.MenuPosition)) {
if (string.IsNullOrEmpty(part.MenuPosition))
part.MenuPosition = Position.GetNext(_navigationManager.BuildMenu("main"));
}
updater.TryUpdateModel(part, Prefix, null, null);
if (part.OnMainMenu && string.IsNullOrEmpty(part.MenuText)) {
if (part.OnMainMenu && string.IsNullOrEmpty(part.MenuText))
updater.AddModelError("MenuText", T("The MenuText field is required"));
}
return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor"));
return Editor(part, shapeHelper);
}
}
}

View File

@@ -0,0 +1,3 @@
<Placement>
<Place Parts_Navigation_Menu_Edit="Primary:9"/>
</Placement>

View File

@@ -1,6 +1,5 @@
@model MenuPart
@using Orchard.Core.Navigation.Models;
@using Orchard.Core.Navigation.ViewModels;
@{
Script.Require("ShapesBase");
}

View File

@@ -74,14 +74,9 @@
<Compile Include="Common\Fields\TextField.cs" />
<Compile Include="Contents\Security\AuthorizationEventHandler.cs" />
<Compile Include="Common\Services\BbcodeFilter.cs" />
<Compile Include="ContentsLocation\ResourceManifest.cs" />
<Compile Include="ContentsLocation\Models\LocationDefinition.cs" />
<Compile Include="Common\Services\ICommonService.cs" />
<Compile Include="Common\Services\CommonService.cs" />
<Compile Include="Common\Settings\BodySettings.cs" />
<Compile Include="ContentsLocation\Models\LocationSettings.cs" />
<Compile Include="ContentsLocation\Settings\LocationSettingsEditorEvents.cs" />
<Compile Include="ContentsLocation\ViewModels\LocationSettingsViewModel.cs" />
<Compile Include="Common\ViewModels\ContainerEditorViewModel.cs" />
<Compile Include="Common\ViewModels\TextContentFieldDisplayViewModel.cs" />
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
@@ -257,9 +252,6 @@
<Content Include="Common\Views\Parts\Common.Body.SummaryAdmin.cshtml" />
<Content Include="Common\Views\Parts\Common.Metadata.cshtml" />
<Content Include="Common\Views\Parts\Common.Metadata.SummaryAdmin.cshtml" />
<Content Include="ContentsLocation\Module.txt" />
<Content Include="ContentsLocation\Styles\admin.css" />
<Content Include="ContentsLocation\Views\DefinitionTemplates\LocationSettings.cshtml" />
<Content Include="Contents\Views\Admin\Create.cshtml" />
<Content Include="Contents\Views\Admin\Edit.cshtml" />
<Content Include="Contents\Views\Admin\List.cshtml" />
@@ -349,7 +341,7 @@
<Content Include="Dashboard\Views\Admin\Index.cshtml" />
<Content Include="HomePage\Module.txt" />
<Content Include="Navigation\Views\Admin\Index.cshtml" />
<Content Include="Navigation\Views\EditorTemplates\Parts\Navigation.EditMenuPart.cshtml" />
<Content Include="Navigation\Views\EditorTemplates\Parts\Navigation.Menu.Edit.cshtml" />
<Content Include="Navigation\Views\Web.config" />
</ItemGroup>
<ItemGroup>
@@ -365,7 +357,6 @@
<Content Include="Localization\Views\Web.config" />
<Content Include="Reports\Views\Web.config" />
<Content Include="PublishLater\Views\Web.config" />
<Content Include="ContentsLocation\Views\Web.config" />
<Content Include="Messaging\Views\Web.config" />
<Content Include="Contents\Views\Items\Content.cshtml" />
<Content Include="Contents\Views\Items\Content.SummaryAdmin.cshtml" />
@@ -382,11 +373,13 @@
<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" />
<Content Include="Messaging\Placement.info">
<SubType>Designer</SubType>
</Content>
<None Include="Navigation\Placement.info">
<SubType>Designer</SubType>
</None>
<None Include="PublishLater\Placement.info">
<SubType>Designer</SubType>
</None>

View File

@@ -5,7 +5,6 @@ using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Core.Routable.Models;
using Orchard.Core.Routable.Services;
using Orchard.Core.Routable.ViewModels;
@@ -70,9 +69,10 @@ namespace Orchard.Core.Routable.Drivers {
: "";
}
var location = part.GetLocation("Editor");
// TODO: andrerod convert to new shape API. Location code kept for reference.
//var location = part.GetLocation("Editor");
model.PromoteToHomePage = model.Id != 0 && part.Path != null && _routableHomePageProvider != null && CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id);
return ContentPartTemplate(model, TemplateName, Prefix).Location(location);
return ContentPartTemplate(model, TemplateName, Prefix); //.Location(location);
}
protected override DriverResult Editor(RoutePart part, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -6,7 +6,6 @@ using Orchard.ArchiveLater.ViewModels;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Services;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Localization;
namespace ArchiveLater.Drivers {

View File

@@ -1,3 +1,7 @@
@{
Model.ContentItems.Classes.Add("content-items");
Model.ContentItems.Classes.Add("blogs");
}
@Display(Model.ContentItems)
@if (Model.ContentItems.Items.Count < 1) {
<p>@T("No blogs found.")</p>

View File

@@ -1,6 +1,7 @@
@{
IEnumerable<object> blogPosts = Model.ContentItems;
Model.ContentItems.Classes.Add("content-items");
Model.ContentItems.Classes.Add("blog-posts");
}
@Display(Model.ContentItems)
@if (blogPosts == null || blogPosts.Count() < 1) {

View File

@@ -7,8 +7,12 @@ using Orchard.Experimental.ViewModels;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
using Orchard.DisplayManagement;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[Themed, Admin]
public class ContentController : Controller {
private readonly IRepository<ContentTypeRecord> _contentTypeRepository;
private readonly IContentManager _contentManager;
@@ -43,7 +47,7 @@ namespace Orchard.Experimental.Controllers {
model.DisplayShape = _contentManager.BuildDisplay(model.Item, "Detail");
model.EditorShape = _contentManager.BuildEditor(model.Item);
return View(Shape.Model(model));
return View(model);
}
static IEnumerable<Type> AllTypes(Type type) {

View File

@@ -9,8 +9,8 @@ using Orchard.UI.Notify;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[Themed]
[Admin]
[Themed, Admin]
public class HomeController : Controller {
private readonly INotifier _notifier;

View File

@@ -4,9 +4,11 @@ using System.Xml;
using System.Xml.Linq;
using Orchard.ContentManagement.MetaData;
using Orchard.Experimental.ViewModels;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[ValidateInput(false)]
[ValidateInput(false), Themed, Admin]
public class MetadataController : Controller {
private readonly IContentDefinitionManager _contentDefinitionManager;
private readonly IContentDefinitionWriter _contentDefinitionWriter;

View File

@@ -93,20 +93,20 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Views\Commands\Execute.ascx" />
<Content Include="Views\Content\Details.aspx" />
<Content Include="Views\Content\Index.aspx" />
<Content Include="Views\DefinitionTemplates\ExperimentalSettings.aspx" />
<Content Include="Views\EditorTemplates\Parts\Experimental.ShowDebugLink.ascx" />
<Content Include="Views\Home\Index.aspx" />
<Content Include="Views\Home\Simple.aspx" />
<Content Include="Views\Home\_RenderableAction.ascx" />
<Content Include="Views\Metadata\Index.aspx" />
<None Include="Views\Commands\Execute.cshtml" />
<None Include="Views\Content\Details.cshtml" />
<None Include="Views\Content\Index.cshtml" />
<None Include="Views\DefinitionTemplates\ExperimentalSettings.cshtml" />
<None Include="Views\EditorTemplates\Parts\Experimental.ShowDebugLink.cshtml" />
<None Include="Views\Home\Index.cshtml" />
<None Include="Views\Home\Simple.cshtml" />
<None Include="Views\Home\_RenderableAction.cshtml" />
<None Include="Views\Metadata\Index.cshtml" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\DisplayTemplates\Parts\Experimental.ShowDebugLink.ascx" />
<None Include="Views\Parts\Experimental.ShowDebugLink.cshtml" />
<Content Include="Views\DumpShapeTable.cshtml" />
<Content Include="Views\HackScript.cshtml" />
<Content Include="Views\HackStyle.cshtml" />
@@ -133,6 +133,7 @@
<ItemGroup>
<Content Include="Views\ShapeTable\ShapeTable.cshtml" />
</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.

View File

@@ -28,11 +28,15 @@ namespace Orchard.Experimental.ViewModels {
ZoneName = x.ZoneName,
});
#else
return null;
return new List<TemplateViewModel>();
#endif
}
}
public IEnumerable<TemplateViewModel> Displays {
get { return new List<TemplateViewModel>(); }
}
public object Locate(Type type) {
return Item.ContentItem.Get(type);
}

View File

@@ -1,19 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Experimental.ViewModels.CommandsExecuteViewModel>" %>
<h1>
<%: Html.TitleForPage(T("Command line").ToString()) %></h1>
<div>
<% using (Html.BeginFormAntiForgeryPost(Url.Action("Execute"))) {%>
<%:Html.ValidationSummary()%>
<ul>
<%for (int index = 0; index != (Model.History ?? new string[0]).Length; ++index) {%><li>
<%:Model.History[index]%>
<%:Html.HiddenFor(m => m.History[index])%>
</li>
<%
}%></ul>
<%:Html.LabelFor(m => m.CommandLine)%>
<%:Html.TextBoxFor(m => m.CommandLine, new { style = "width:100%;" })%>
<%:Html.ValidationMessageFor(m => m.CommandLine)%>
<pre><%: Model.Results%></pre>
<%}%>
</div>

View File

@@ -0,0 +1,20 @@
<h1>
@Html.TitleForPage(T("Command line").ToString())
</h1>
<div>
@using (Html.BeginFormAntiForgeryPost(Url.Action("Execute"))) {
Html.ValidationSummary()
<ul>
@for (int index = 0; index != (Model.History ?? new string[0]).Length; ++index) {
<li>
@Model.History[index]
@Html.HiddenFor(m => m.History[index])
</li>
}
</ul>
@Html.LabelFor(m => m.CommandLine)
@Html.TextBoxFor(m => m.CommandLine, new { style = "width:100%;" })
@Html.ValidationMessageFor(m => m.CommandLine)
<pre>@Model.Results</pre>
}
</div>

View File

@@ -1,107 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ContentDetailsViewModel>" %>
<%@ Import Namespace="Orchard.Experimental.ViewModels"%>
<%@ Import Namespace="Orchard.ContentManagement"%>
<%@ Import Namespace="System.Reflection" %>
<h1><%: Html.TitleForPage(T("{0} Content Type", Model.Item.ContentItem.ContentType).ToString(), T("Content").ToString())%></h1>
<h2><%: T("Content Item")%></h2>
<p>
<%: T("Id:")%>
<%=Model.Item.ContentItem.Id %><br />
<%: T("Version:")%>
<%=Model.Item.ContentItem.Version %><br />
<%: T("ContentType:")%>
<%=Model.Item.ContentItem.ContentType %><br />
<%: T("DisplayText:")%>
<%: Html.ItemDisplayText(Model.Item) %><br />
<%: T("Links:")%>
<%: Html.ItemDisplayLink(T("view").ToString(), Model.Item) %> <%: Html.ItemEditLink(T("edit").ToString(), Model.Item) %>
</p>
<h2><%: T("Content Item Parts")%></h2>
<ul>
<%foreach (var partType in Model.PartTypes.OrderBy(x => x.Name)) {%>
<li><span style="font-weight: bold;">
<%if (partType.IsGenericType) {%><%: partType.Name +" "+partType.GetGenericArguments().First().Name %>
<%: " (" + partType.GetGenericArguments().First().Namespace + ")" %><%}
else {%><%: partType.Name %>
<%: " (" + partType.Namespace + ")" %><%
}
%></span>
<ul style="margin-left: 20px">
<%foreach (var prop in partType.GetProperties().Where(x => x.DeclaringType == partType)) {
var value = prop.GetValue(Model.Locate(partType), null);%>
<li style="font-weight: normal;">
<%: prop.Name %>:
<%: value %>
<%var valueItem = value as ContentItem;
if (valueItem == null && value is IContent) {
valueItem = (value as IContent).ContentItem;
}
if (valueItem != null) {
%><%: Html.ActionLink(T("{0} #{1} v{2}", valueItem.ContentType, valueItem.Id, valueItem.Version).ToString(), "details", new { valueItem.Id }, new { })%><%
}
%>
<ul style="margin-left: 20px">
<%if (value == null || prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string) || prop.PropertyType == typeof(DateTime?)) { }
else if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType)) {
foreach (var item in value as IEnumerable) {
%>
<li><%: item.GetType().Name %>:<%: item %></li>
<%
}
}
else {%>
<%foreach (var prop2 in value.GetType().GetProperties().Where(x => x.GetIndexParameters().Count() == 0)) {%>
<li>
<%: prop2.Name %>
<%: prop2.GetValue(value, null) %></li>
<%} %>
<%} %>
</ul>
</li>
<%} %>
</ul>
</li>
<%}%>
</ul>
<h3>Displays</h3>
<ul>
<%foreach (var display in Model.Displays) {%>
<li><span style="font-weight: bold">
<%: display.Prefix %></span>
<%: display.Model.GetType().Name %>
(<%: display.Model.GetType().Namespace %>)
Template:<%: display.TemplateName ?? "(null)" %>
Prefix:<%: display.Prefix ?? "(null)" %>
Zone:<%: display.ZoneName ?? "(null)" %>
Position:<%: display.Position ?? "(null)" %>
<div style="margin-left: 20px; border: solid 1px black;">
<%: Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)%>
</div>
</li>
<%
}%>
</ul>
<h3>Editors</h3>
<ul>
<%foreach (var editor in Model.Editors) {%>
<li><span style="font-weight: bold">
<%: editor.Prefix %></span>
<%: editor.Model.GetType().Name %>
(<%: editor.Model.GetType().Namespace %>)
Template:<%: editor.TemplateName ?? "(null)" %>
Prefix:<%: editor.Prefix ?? "(null)" %>
Zone:<%: editor.ZoneName ?? "(null)" %>
Position:<%: editor.Position??"(null)" %>
<div style="margin-left: 20px; border: solid 1px black;">
<%: Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix) %>
</div>
</li>
<%
}%>
</ul>

View File

@@ -0,0 +1,103 @@
@model ContentDetailsViewModel
@using Orchard.Experimental.ViewModels;
@using Orchard.ContentManagement;
@using System.Collections;
<h1>@Html.TitleForPage(T("{0} Content Type", Model.Item.ContentItem.ContentType).ToString(), T("Content").ToString())</h1>
<h2>@T("Content Item")</h2>
<p>@T("Id:") @Model.Item.ContentItem.Id<br />
@T("Version:") @Model.Item.ContentItem.Version<br />
@T("ContentType:") @Model.Item.ContentItem.ContentType<br />
@T("DisplayText:") @Html.ItemDisplayText(Model.Item)<br />
@T("Links:") @Html.ItemDisplayLink(T("view").ToString(), Model.Item) @Html.ItemEditLink(T("edit").ToString(), Model.Item)
</p>
<h2>@T("Content Item Parts")</h2>
<ul>
@foreach (var partType in Model.PartTypes.OrderBy(x => x.Name)) {
<li>
<span style="font-weight: bold;">
@if (partType.IsGenericType) {
@:@partType.Name @partType.GetGenericArguments().First().Name (@partType.GetGenericArguments().First().Namespace)
}
else {
@:@partType.Name (@partType.Namespace)
}
</span>
<ul style="margin-left: 20px">
@foreach (var prop in partType.GetProperties().Where(x => x.DeclaringType == partType)) {
var value = prop.GetValue(Model.Locate(partType), null);
<li style="font-weight: normal;">
@prop.Name
@value
@{var valueItem = value as ContentItem; }
@if (valueItem == null && value is IContent) {
valueItem = (value as IContent).ContentItem;
}
@if (valueItem != null) {
Html.ActionLink(T("{0} #{1} v{2}", valueItem.ContentType, valueItem.Id, valueItem.Version).ToString(), "details", new { valueItem.Id }, new { });
}
<ul style="margin-left: 20px">
@if (value == null || prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string) || prop.PropertyType == typeof(DateTime?)) { }
else if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType)) {
foreach (var item in value as IEnumerable) {
<li>@item.GetType().Name : @item</li>
}
}
else {
foreach (var prop2 in value.GetType().GetProperties().Where(x => x.GetIndexParameters().Count() == 0)) {
<li>
@prop2.Name
@prop2.GetValue(value, null)
</li>
}
}
</ul>
</li>
}
</ul>
</li>
}
</ul>
<h3>Displays</h3>
<ul>
@foreach (var display in Model.Displays) {
<li>
<span style="font-weight: bold">@display.Prefix</span>
@display.Model.GetType().Name
(@display.Model.GetType().Namespace)
Template: @display.TemplateName ?? "(null)"
Prefix: @display.Prefix ?? "(null)"
Zone: @display.ZoneName ?? "(null)"
Position: @display.Position ?? "(null)"
<div style="margin-left: 20px; border: solid 1px black;">
@Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)
</div>
</li>
}
</ul>
<h3>Editors</h3>
<ul>
@foreach (var editor in Model.Editors) {
<li>
<span style="font-weight: bold">@editor.Prefix</span>
@editor.Model.GetType().Name
(@editor.Model.GetType().Namespace)
Template: @editor.TemplateName ?? "(null)"
Prefix: @editor.Prefix ?? "(null)"
Zone: @editor.ZoneName ?? "(null)"
Position: @editor.Position ?? "(null)"
<div style="margin-left: 20px; border: solid 1px black;">
@Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix)
</div>
</li>
}
</ul>

View File

@@ -1,19 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ContentIndexViewModel>" %>
<%@ Import Namespace="Orchard.Experimental.ViewModels"%>
<h1><%: Html.TitleForPage(T("Content").ToString()) %></h1>
<h2><%: T("Content Types")%></h2>
<ul>
<%foreach(var item in Model.Types.OrderBy(x=>x.Name)){%>
<li><%: item.Name %></li>
<%}%>
</ul>
<h2><%: T("Content Items")%></h2>
<ul>
<%foreach(var item in Model.Items.OrderBy(x=>x.Id)){%>
<li>
<%: Html.ActionLink(T("{0}: {1}", item.Id, item.ContentType).ToString(), "details", "content", new{item.Id},new{}) %>
<%: Html.ItemDisplayLink(T("view").ToString(), item) %>
<%: Html.ItemEditLink(T("edit").ToString(), item) %>
</li>
<%}%>
</ul>

View File

@@ -0,0 +1,23 @@
@model ContentIndexViewModel
@using Orchard.Experimental.ViewModels;
<h1>@Html.TitleForPage(T("Content").ToString())</h1>
<h2>@T("Content Types")</h2>
<ul>
@foreach(var item in Model.Types.OrderBy(x=>x.Name)) {
<li>@item.Name</li>
}
</ul>
<h2>@T("Content Items")</h2>
<ul>
@foreach(var item in Model.Items.OrderBy(x=>x.Id)) {
<li>
@Html.ActionLink(T("{0}: {1}", item.Id, item.ContentType).ToString(), "details", "content", new{item.Id},new{})
@Html.ItemDisplayLink(T("view").ToString(), item)
@Html.ItemEditLink(T("edit").ToString(), item)
</li>
}
</ul>

View File

@@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Experimental.Settings.ExperimentalSettings>" %>
<fieldset>
<%:Html.EditorFor(m=>m.ShowDebugLinks) %>
<label for="<%:Html.FieldIdFor(m => m.ShowDebugLinks) %>" class="forcheckbox"><%:T("Show debug links") %></label>
<%:Html.ValidationMessageFor(m=>m.ShowDebugLinks) %>
</fieldset>

View File

@@ -0,0 +1,6 @@
@model Orchard.Experimental.Settings.ExperimentalSettings
<fieldset>
@Html.EditorFor(m=>m.ShowDebugLinks)
<label for="@Html.FieldIdFor(m => m.ShowDebugLinks)" class="forcheckbox">@T("Show debug links")</label>
@Html.ValidationMessageFor(m=>m.ShowDebugLinks)
</fieldset>

View File

@@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<div class="debug message"><%=T(
"Experimental: displaying {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>

View File

@@ -1,8 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<% if (Model.ContentItem.Id > 0) { %>
<div class="debug message"><%=T(
"Experimental: editing {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>
<% } %>

View File

@@ -0,0 +1,6 @@
@model Orchard.Experimental.Models.ShowDebugLink
@if (Model.ContentItem.Id > 0) {
<div class="debug message">
@T("Experimental: editing {0}", Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { }))
</div>
}

View File

@@ -1,6 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<BaseViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<h1><%: Html.TitleForPage(T("Experimental").ToString()) %></h1>
<p><%: Html.ActionLink(T("Contents").ToString(), "Index", "Content") %></p>
<p><%: Html.ActionLink(T("Metadata").ToString(), "Index", "Metadata") %></p>
<p><%: Html.ActionLink(T("Test Unauthorized Request").ToString(), "NotAuthorized", "Home")%></p>

View File

@@ -0,0 +1,4 @@
<h1>@Html.TitleForPage(T("Experimental").ToString())</h1>
<p>@Html.ActionLink(T("Contents").ToString(), "Index", "Content")</p>
<p>@Html.ActionLink(T("Metadata").ToString(), "Index", "Metadata")</p>
<p>@Html.ActionLink(T("Test Unauthorized Request").ToString(), "NotAuthorized", "Home")</p>

View File

@@ -1,12 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Simple>" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<h1>
<%= H(Model.Title) %></h1>
<p>
Quantity:
<%= Model.Quantity %></p>
<div style="border: solid 1px #ccc;">
<% Html.RenderAction("_RenderableAction"); %></div>
<p>
<%: Html.ActionLink("Test Messages", "SimpleMessage")%></p>

View File

@@ -0,0 +1,6 @@
<h1>@H(Model.Title)</h1>
<p>Quantity: @Model.Quantity</p>
<div style="border: solid 1px #ccc;">
@Html.RenderAction("_RenderableAction")
</div>
<p>@Html.ActionLink("Test Messages", "SimpleMessage")</p>

View File

@@ -1,2 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<string>" %>
<h3><%=H(Model)%></h3>

View File

@@ -0,0 +1 @@
<h3>@H(Model)</h3>

View File

@@ -1,44 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Orchard.Experimental.ViewModels.MetadataIndexViewModel>" %>
<%@ Import Namespace="Orchard.Experimental.ViewModels" %>
<style title="text/css">
ul
{
margin-left: 12px;
}
</style>
<h1>
Metadata</h1>
<h2>
Content Type Definitions</h2>
<ul>
<%foreach (var type in Model.TypeDefinitions) {%>
<li>
<%:type.Name %>
<ul>
<%foreach (var part in type.Parts) {%>
<li>
<%:part.PartDefinition.Name %></li>
<%
}%>
</ul>
</li>
<%
}%>
</ul>
<h2>
Content Part Definitions</h2>
<ul>
<%foreach (var part in Model.PartDefinitions) {%>
<li>
<%:part.Name %></li>
<%
}%>
</ul>
<h2>
Exported as xml</h2>
<% using (Html.BeginFormAntiForgeryPost()) { %>
<%:Html.TextAreaFor(m=>m.ExportText, new{style="width:100%;height:640px;"}) %>
<br />
<input class="button primaryAction" type="submit" value="<%: T("Merge Changes") %>" />
<%} %>

View File

@@ -0,0 +1,45 @@
@model MetadataIndexViewModel
@using Orchard.Experimental.ViewModels;
<style title="text/css">
ul
{
margin-left: 12px;
}
</style>
<h1>Metadata</h1>
<h2>Content Type Definitions</h2>
<ul>
@foreach (var type in Model.TypeDefinitions) {
<li>
@type.Name
<ul>
@foreach (var part in type.Parts) {
<li>
@part.PartDefinition.Name
</li>
}
</ul>
</li>
}
</ul>
<h2>Content Part Definitions</h2>
<ul>
@foreach (var part in Model.PartDefinitions) {
<li>
@part.Name
</li>
}
</ul>
<h2>Exported as xml</h2>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.TextAreaFor(m=>m.ExportText, new{style="width:100%;height:640px;"})
<br />
<input class="button primaryAction" type="submit" value="@T("Merge Changes")" />
}

View File

@@ -0,0 +1,5 @@
@using Orchard.Experimental.Models;
<div class="debug message">
Experimental: displaying @Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { }))
</div>

View File

@@ -1,18 +0,0 @@
using JetBrains.Annotations;
using Orchard.ContentManagement.Handlers;
using Orchard.Data;
using Orchard.Media.Models;
namespace Orchard.Media.Handlers {
[UsedImplicitly]
public class MediaSettingsPartHandler : ContentHandler {
public MediaSettingsPartHandler(IRepository<MediaSettingsPartRecord> repository) {
Filters.Add(StorageFilter.For(repository) );
OnInitializing<MediaSettingsPart>(DefaultSettings);
}
private static void DefaultSettings(InitializingContentContext context, MediaSettingsPart settingsPart) {
settingsPart.Record.RootMediaFolder = "~/Media";
}
}
}

View File

@@ -1,22 +0,0 @@
using Orchard.Data.Migration;
namespace Orchard.Media {
public class MediaDataMigration : DataMigrationImpl {
public int Create() {
//CREATE TABLE Orchard_Media_MediaSettingsRecord (Id INTEGER not null, RootMediaFolder TEXT, primary key (Id));
SchemaBuilder.CreateTable("MediaSettingsPartRecord", table => table
.ContentPartRecord()
.Column<string>("RootMediaFolder")
);
return 1;
}
public int UpdateFrom1() {
// Filters.Add(new ActivatingFilter<MediaSettingsPart>("Site"));
return 2;
}
}
}

View File

@@ -1,6 +0,0 @@
using Orchard.ContentManagement;
namespace Orchard.Media.Models {
public class MediaSettingsPart : ContentPart<MediaSettingsPartRecord> {
}
}

View File

@@ -1,7 +0,0 @@
using Orchard.ContentManagement.Records;
namespace Orchard.Media.Models {
public class MediaSettingsPartRecord : ContentPartRecord {
public virtual string RootMediaFolder { get; set; }
}
}

View File

@@ -72,11 +72,7 @@
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="ResourceManifest.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="Helpers\MediaHelpers.cs" />
<Compile Include="Models\MediaSettingsPart.cs" />
<Compile Include="Handlers\MediaSettingsPartHandler.cs" />
<Compile Include="Models\MediaSettingsPartRecord.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Models\FolderNavigation.cs" />
<Compile Include="Models\MediaFile.cs" />
@@ -117,7 +113,6 @@
<Content Include="Views\Admin\EditMedia.cshtml" />
<Content Include="Views\Admin\EditProperties.cshtml" />
<Content Include="Views\Admin\Index.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Media.SiteSettings.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -35,7 +35,7 @@ namespace Orchard.Media.Services {
Name = folder.GetName(),
Size = folder.GetSize(),
LastUpdated = folder.GetLastUpdated(),
MediaPath = folder.GetPath(),
MediaPath = folder.GetPath()
};
mediaFolders.Add(mediaFolder);
}

View File

@@ -7,9 +7,7 @@
<div class="breadCrumbs">
<p>@Html.ActionLink(T("Media Folders").ToString(), "Index") &#62;
@foreach (FolderNavigation navigation in MediaHelpers.GetFolderNavigationHierarchy(Model.MediaPath)) {
@Html.ActionLink(navigation.FolderName, "Edit",
new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) &#62;
@Html.ActionLink(navigation.FolderName, "Edit", new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) <text>&#62;</text>
}
@T("Add Media")</p>
</div>

View File

@@ -8,8 +8,7 @@
<div class="breadCrumbs">
<p>@Html.ActionLink(T("Media Folders").ToString(), "Index") &#62;
@foreach (FolderNavigation navigation in MediaHelpers.GetFolderNavigationHierarchy(Model.MediaPath)) {
@Html.ActionLink(navigation.FolderName, "Edit",
new {name = navigation.FolderName, mediaPath = navigation.FolderPath})
@Html.ActionLink(navigation.FolderName, "Edit", new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) <text>&#62;</text>
}
@T("Manage Folder")</p>
</div>
@@ -68,7 +67,7 @@
folderName = mediaFile.FolderName,
mediaPath = Model.MediaPath })
</td>
<td>@T("Orchard User")</td>
<td>@mediaFile.User</td>
<td>@mediaFile.LastUpdated</td>
<td>@mediaFile.Type</td>
<td>@mediaFile.Size</td>
@@ -85,7 +84,7 @@
<img src="<%=ResolveUrl("~/Modules/Orchard.Media/Content/Admin/images/folder.gif")%>" height="16" width="16" class="mediaTypeIcon" alt="@T("Folder")" />
@Html.ActionLink(mediaFolder.Name, "Edit", new { name = mediaFolder.Name, mediaPath = mediaFolder.MediaPath})
</td>
<td>@T("Orchard User")</td>
<td>@mediaFolder.User</td>
<td>@mediaFolder.LastUpdated</td>
<td>@T("Folder")</td>
<td>@mediaFolder.Size</td>

View File

@@ -9,7 +9,7 @@
<p>@Html.ActionLink(T("Media Folders").ToString(), "Index") &#62;
@foreach (FolderNavigation navigation in MediaHelpers.GetFolderNavigationHierarchy(Model.MediaPath)) {
@Html.ActionLink(navigation.FolderName, "Edit",
new {name = navigation.FolderName, mediaPath = navigation.FolderPath})
new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) <text>&#62; </text>
}
@T("Edit Media")</p>
</div>
@@ -22,17 +22,17 @@
<img src="@Model.PublicUrl" class="previewImage" alt="@Model.Caption" />
</div>
<fieldset>
<%-- todo: make these real (including markup) --%>
@* todo: make these real (including markup) *@
<div>
<label>@T("Dimensions: <span>500 x 375 pixels</span>")</label>
@* <label>@T("Dimensions: <span>500 x 375 pixels</span>")</label> *@
<label>@T("Size: <span>{0}</span>", Model.Size)</label>
<label>@T("Added on: <span>{0} by Orchard User</span>", Model.LastUpdated)</label>
<label>@T("Added on: <span>{0}</span>", Model.LastUpdated)</label>
</div>
<div>
<label for="embedPath">@T("Embed:")</label>
<input id="embedPath" class="textMedium" name="embedPath" type="text" readonly="readonly" value="<%: string.Format("<img src=\"{0}\" width=\"{1}\" height=\"{2}\" alt=\"{3}\" />", ResolveUrl("~/Media/" + Model.RelativePath + "/" + Model.Name), 500, 375, Model.Caption)%>" />
<input id="embedPath" class="textMedium" name="embedPath" type="text" readonly="readonly" value="&lt;img src=&quot;@Href("~/Media/" + Model.RelativePath + "/" + Model.Name)&quot; @* width=&quot;500&quot; height=&quot;375&quot; *@ alt=&quot;@Model.Caption&quot; /&gt;" />
<span class="hint">@T("Copy this html to add this image to your site.")</span>
</div>
@@ -55,11 +55,12 @@
<input type="submit" class="button primaryAction" name="submit.Save" value="@T("Save")" />
</fieldset>
</div>
<%--<div class="secondary" style="border:1px solid #ff0000;">
@*
<div class="secondary" style="border:1px solid #ff0000;">
<h2>@T("Preview")</h2>
<div><img src="<%=ResolveUrl("~/Media/" + Html.Encode(Model.RelativePath + "/" + Model.Name))%>" class="previewImage" alt="@Model.Caption" /></div>
<div><img src="@Href("~/Media/" + Html.Encode(Model.RelativePath + "/" + Model.Name))" class="previewImage" alt="@Model.Caption" /></div>
<ul>
<%-- todo: make these real (including markup)
@// todo: make these real (including markup)
<li><label>@T("Dimensions: <span>500 x 375 pixels</span>")</label></li>
<li><label>@T("Size: <span>{0}</span>", Model.Size)</label></li>
<li><label>@T("Added on: <span>{0} by Orchard User</span>", Model.LastUpdated)</label></li>
@@ -69,6 +70,7 @@
<span class="hint">@T("Copy this html to add this image to your site.")</p>
</li>
</ul>
</div>--%>
</div>
*@
}
</div>

View File

@@ -23,6 +23,6 @@
</fieldset>
<fieldset>
<input type="submit" class="button primaryAction" name="submit.Save" value="@T("Save")" />
<%--<input type="submit" class="button buttonFocus roundCorners" name="submit.Delete" value="@T("Remove")" />--%>
<input type="submit" class="button buttonFocus roundCorners" name="submit.Delete" value="@T("Delete")" />
</fieldset>
}

View File

@@ -36,12 +36,12 @@
@foreach (var mediaFolder in Model.MediaFolders) {
<tr>
<td><input type="checkbox" value="true" name="@T("Checkbox.{0}", mediaFolder.Name)"/></td>
<%-- todo: (heskew) this URL needs to be determined from current module location --%>
@* todo: (heskew) this URL needs to be determined from current module location *@
<td>
<img src="<%=ResolveUrl("~/Modules/Orchard.Media/Content/Admin/images/folder.gif")%>" height="16" width="16" class="mediaTypeIcon" alt="@T("Folder")" />
<img src="@Href("~/Modules/Orchard.Media/Content/Admin/images/folder.gif")" height="16" width="16" class="mediaTypeIcon" alt="@T("Folder")" />
@Html.ActionLink(mediaFolder.Name, "Edit", new { name = mediaFolder.Name, mediaPath = mediaFolder.MediaPath })
</td>
<td>@T("Orchard User")</td>
<td>@mediaFolder.User</td>
<td>@mediaFolder.LastUpdated</td>
<td>@T("Folder")</td>
<td>@mediaFolder.Size</td>

View File

@@ -1,10 +0,0 @@
@model Orchard.Media.Models.MediaSettingsPartRecord
<fieldset>
<legend>@T("Media")</legend>
<div>
<label for="MediaSettings_RootMediaFolder">Media folder</label>
@Html.EditorFor(x=>x.RootMediaFolder)
@Html.ValidationMessage("RootMediaFolder", "*")
</div>
</fieldset>

View File

@@ -1,7 +1,6 @@
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Widgets.Models;
namespace Orchard.Widgets.Drivers {
@@ -10,8 +9,8 @@ namespace Orchard.Widgets.Drivers {
public class LayerPartDriver : ContentPartDriver<LayerPart> {
protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) {
ContentLocation location = layerPart.GetLocation("Editor");
return ContentPartTemplate(layerPart, "Parts/Widgets.LayerPart").Location(location);
return ContentShape("Parts_Widgets_LayerPart",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.LayerPart", Model: layerPart));
}
protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -1,16 +1,13 @@
using JetBrains.Annotations;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Widgets.Models;
namespace Orchard.Widgets.Drivers {
[UsedImplicitly]
public class WidgetBagPartDriver : ContentPartDriver<WidgetBagPart> {
private const string TemplateName = "Parts/Widgets.WidgetBagPart";
protected override DriverResult Editor(WidgetBagPart part, dynamic shapeHelper) {
var location = part.GetLocation("Editor");
return ContentPartTemplate("", TemplateName, Prefix).Location(location);
return ContentShape("Parts_Widgets_WidegetBagPart",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.WidgetBagPart", Model: part));
}
}
}

View File

@@ -1,7 +1,6 @@
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
using Orchard.Widgets.Models;
using Orchard.Widgets.Services;
@@ -18,8 +17,8 @@ namespace Orchard.Widgets.Drivers {
protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) {
widgetPart.AvailableZones = _widgetsService.GetZones();
ContentLocation location = widgetPart.GetLocation("Editor");
return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart").Location(location);
return ContentShape("Parts_Widgets_WidgetPart",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.WidgetPart", Model: widgetPart));
}
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -64,26 +64,6 @@ namespace Orchard.Widgets {
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(LayerPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetBagPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation {Zone = "Primary", Position = "5"}}
})
);
ContentDefinitionManager.AlterTypeDefinition("WidgetPage",
cfg => cfg
.WithPart("CommonPart")

View File

@@ -97,7 +97,9 @@
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Placement.info" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>

View File

@@ -0,0 +1,5 @@
<Placement>
<Place Parts_Widgets_LayerPart="Primary:1"/>
<Place Parts_Widgets_WidgetPart="Primary:1"/>
<Place Parts_Widgets_WidegetBagPart="Primary:5"/>
</Placement>

View File

@@ -15,7 +15,7 @@ namespace Orchard.UI {
var xParts = x.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
var yParts = y.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
for (var i = 0; i < xParts.Count(); i++) {
if (yParts.Length < i - 1) // x is further defined meaning it comes after y (e.g. x == 1.2.3 and y == 1.2)
if (yParts.Length < i+1) // x is further defined meaning it comes after y (e.g. x == 1.2.3 and y == 1.2)
return 1;
int xPos;