--HG--
branch : autoroute
This commit is contained in:
randompete
2012-01-27 05:44:13 +00:00
13 changed files with 84 additions and 32 deletions

View File

@@ -3,7 +3,7 @@ bce623c333ca90f0f815843c04c8d124f2c7b6d9 src/Orchard.Web/Modules/Orchard.Autorou
67bf9897ee9dd9483369aece729ad7c6f042941c src/Orchard.Web/Modules/Orchard.Forms
6033664adc404a22f311029b69fbf1e34dc4ff2a src/Orchard.Web/Modules/Orchard.Projections
a1ef39ba4e2d0cd78b3c91d6150e841793acb34b src/Orchard.Web/Modules/Orchard.Routable
f2a3984789ebe5caf2822ccb9e1d2c953add9c35 src/Orchard.Web/Modules/Orchard.Rules
204bdef384f41bb5e463bed6b98a056945a7d839 src/Orchard.Web/Modules/Orchard.Rules
ce578373f907c0a55fd91229a344f0755f290174 src/Orchard.Web/Modules/Orchard.TaskLease
42d34730d8bb22052585ca94e3e945111aea3b9d src/Orchard.Web/Modules/Orchard.Tokens
08eadecb5e5fae52e8b4c7d1c60f29e51c63b2ca src/orchard.web/modules/Orchard.Fields

View File

@@ -8,7 +8,7 @@
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
<div class="properties">
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
<h3>@Html.ItemAdminLink(contentItem)</h3> - <div class="contentType">@contentItem.ContentType</div>
<h3>@Html.ItemAdminLink(contentItem)</h3> - <div class="contentType">@contentItem.TypeDefinition.DisplayName</div>
@if (Model.Header != null) {
<div class="header">@Display(Model.Header)</div>
}

View File

@@ -1,7 +1,9 @@
(function () {
var marker = '<!-- markdown -->';
var converter = Markdown.getSanitizingConverter();
var editor = new Markdown.Editor(converter, "", function () { alert("Do you need help?"); });
var editor = new Markdown.Editor(converter, "", {
handler: function () { window.open("http://daringfireball.net/projects/markdown/syntax"); }
});
editor.hooks.set("insertImageDialog", function (callback) {
// see if there's an image selected that they intend on editing

View File

@@ -6,6 +6,7 @@ using Orchard.Blogs.Models;
using Orchard.Blogs.Services;
using Orchard.Environment.Extensions;
using Orchard.Logging;
using Orchard.Mvc.Extensions;
namespace Orchard.Blogs.Controllers {
[OrchardFeature("Orchard.Blogs.RemotePublishing")]
@@ -32,7 +33,7 @@ namespace Orchard.Blogs.Controllers {
const string manifestUri = "http://archipelago.phrasewise.com/rsd";
var urlHelper = new UrlHelper(ControllerContext.RequestContext, _routeCollection);
var url = urlHelper.Action("", "", new { Area = "XmlRpc" });
var url = urlHelper.AbsoluteAction("", "", new { Area = "XmlRpc" });
var options = new XElement(
XName.Get("service", manifestUri),

View File

@@ -159,13 +159,7 @@ namespace Orchard.ContentTypes.Controllers {
if (typeViewModel == null)
return HttpNotFound();
_contentDefinitionManager.DeleteTypeDefinition(id);
// delete all content items (but keep versions)
var contentItems = Services.ContentManager.Query(id).List();
foreach (var contentItem in contentItems) {
Services.ContentManager.Remove(contentItem);
}
_contentDefinitionService.RemoveType(id, true);
Services.Notifier.Information(T("\"{0}\" has been removed.", typeViewModel.DisplayName));
@@ -348,7 +342,8 @@ namespace Orchard.ContentTypes.Controllers {
if (partViewModel == null)
return HttpNotFound();
_contentDefinitionManager.DeletePartDefinition(id);
_contentDefinitionService.RemovePart(id);
Services.Notifier.Information(T("\"{0}\" has been removed.", partViewModel.DisplayName));
return RedirectToAction("ListParts");
@@ -434,15 +429,15 @@ namespace Orchard.ContentTypes.Controllers {
}
try {
_contentDefinitionService.AddFieldToPart(viewModel.Name, viewModel.FieldTypeName, partViewModel.Name);
_contentDefinitionService.AddFieldToPart(viewModel.Name, viewModel.DisplayName, viewModel.FieldTypeName, partViewModel.Name);
}
catch (Exception ex) {
Services.Notifier.Information(T("The \"{0}\" field was not added. {1}", viewModel.Name, ex.Message));
Services.Notifier.Information(T("The \"{0}\" field was not added. {1}", viewModel.DisplayName, ex.Message));
Services.TransactionManager.Cancel();
return AddFieldTo(id);
}
Services.Notifier.Information(T("The \"{0}\" field has been added.", viewModel.Name));
Services.Notifier.Information(T("The \"{0}\" field has been added.", viewModel.DisplayName));
if (typeViewModel != null) {
return RedirectToAction("Edit", new {id});

View File

@@ -145,8 +145,30 @@ namespace Orchard.ContentTypes.Services {
});
}
public void RemoveType(string name) {
throw new NotImplementedException();
public void RemoveType(string name, bool deleteContent) {
// first remove all attached parts
var typeDefinition = _contentDefinitionManager.GetTypeDefinition(name);
var partDefinitions = typeDefinition.Parts.ToArray();
foreach (var partDefinition in partDefinitions) {
RemovePartFromType(partDefinition.PartDefinition.Name, name);
// delete the part if it's its own part
if(partDefinition.PartDefinition.Name == name) {
RemovePart(name);
}
}
_contentDefinitionManager.DeleteTypeDefinition(name);
// delete all content items (but keep versions)
if (deleteContent) {
var contentItems = Services.ContentManager.Query(name).List();
foreach (var contentItem in contentItems) {
Services.ContentManager.Remove(contentItem);
}
}
}
public void AddPartToType(string partName, string typeName) {
@@ -211,7 +233,13 @@ namespace Orchard.ContentTypes.Services {
}
public void RemovePart(string name) {
throw new NotImplementedException();
var partDefinition = _contentDefinitionManager.GetPartDefinition(name);
var fieldDefinitions = partDefinition.Fields.ToArray();
foreach(var fieldDefinition in fieldDefinitions) {
RemoveFieldFromPart(fieldDefinition.Name, name);
}
_contentDefinitionManager.DeletePartDefinition(name);
}
public IEnumerable<ContentFieldInfo> GetFields() {
@@ -219,12 +247,16 @@ namespace Orchard.ContentTypes.Services {
}
public void AddFieldToPart(string fieldName, string fieldTypeName, string partName) {
AddFieldToPart(fieldName, fieldName, fieldTypeName, partName);
}
public void AddFieldToPart(string fieldName, string displayName, string fieldTypeName, string partName) {
fieldName = fieldName.ToSafeName();
if (string.IsNullOrEmpty(fieldName)) {
throw new OrchardException(T("Fields must have a name containing no spaces or symbols."));
}
_contentDefinitionManager.AlterPartDefinition(partName,
partBuilder => partBuilder.WithField(fieldName, fieldBuilder => fieldBuilder.OfType(fieldTypeName)));
partBuilder => partBuilder.WithField(fieldName, fieldBuilder => fieldBuilder.OfType(fieldTypeName).WithDisplayName(displayName)));
}
public void RemoveFieldFromPart(string fieldName, string partName) {

View File

@@ -10,7 +10,7 @@ namespace Orchard.ContentTypes.Services {
EditTypeViewModel GetType(string name);
ContentTypeDefinition AddType(string name, string displayName);
void AlterType(EditTypeViewModel typeViewModel, IUpdateModel updater);
void RemoveType(string name);
void RemoveType(string name, bool deleteContent);
void AddPartToType(string partName, string typeName);
void RemovePartFromType(string partName, string typeName);
string GenerateContentTypeNameFromDisplayName(string displayName);
@@ -24,6 +24,7 @@ namespace Orchard.ContentTypes.Services {
IEnumerable<ContentFieldInfo> GetFields();
void AddFieldToPart(string fieldName, string fieldTypeName, string partName);
void AddFieldToPart(string fieldName, string displayName, string fieldTypeName, string partName);
void RemoveFieldFromPart(string fieldName, string partName);
}
}

View File

@@ -21,6 +21,8 @@ namespace Orchard.DesignerTools.Services {
private readonly IThemeManager _themeManager;
private readonly IWebSiteFolder _webSiteFolder;
private readonly IAuthorizer _authorizer;
private bool _processing;
private int _shapeId;
public ShapeTracingFactory(
@@ -57,6 +59,13 @@ namespace Orchard.DesignerTools.Services {
return;
}
// prevent reentrance as some methods could create new shapes, and trigger this event
if(_processing) {
return;
}
_processing = true;
if (context.ShapeType != "Layout"
&& context.ShapeType != "DocumentZone"
&& context.ShapeType != "PlaceChildContent"
@@ -66,16 +75,19 @@ namespace Orchard.DesignerTools.Services {
&& context.ShapeType != "DateTimeRelative") {
var shapeMetadata = (ShapeMetadata)context.Shape.Metadata;
var currentTheme = _themeManager.GetRequestTheme(_workContext.HttpContext.Request.RequestContext);
var currentTheme = _workContext.CurrentTheme;
var shapeTable = _shapeTableManager.GetShapeTable(currentTheme.Id);
if (!shapeTable.Descriptors.ContainsKey(shapeMetadata.Type)) {
_processing = false;
return;
}
shapeMetadata.Wrappers.Add("ShapeTracingWrapper");
shapeMetadata.OnDisplaying(OnDisplaying);
}
_processing = false;
}
public void Displaying(ShapeDisplayingContext context) {}

View File

@@ -36,8 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NuGet.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="NuGet.Core, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\lib\nuget\NuGet.Core.dll</HintPath>
<Private>True</Private>
</Reference>

View File

@@ -4,6 +4,10 @@ using Orchard.ContentManagement.Drivers;
using Orchard.Users.Models;
namespace Orchard.Users.Drivers {
/// <summary>
/// This class intentionnaly has no Display method to prevent external access to this information through standard
/// Content Item display methods.
/// </summary>
public class UserPartDriver : ContentPartDriver<UserPart> {
protected override void Importing(UserPart part, ContentManagement.Handlers.ImportContentContext context) {

View File

@@ -16,7 +16,5 @@ namespace Orchard.Users.ViewModels {
[Required, DataType(DataType.Password)]
public string ConfirmPassword { get; set; }
public IContent User { get; set; }
}
}

View File

@@ -59,6 +59,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\fluentnhibernate\NHibernate.ByteCode.Castle.dll</HintPath>
</Reference>
<Reference Include="NuGet.Core, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\lib\nuget\NuGet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>

View File

@@ -10,15 +10,19 @@ namespace Orchard.Utility {
public static string GetNext(IEnumerable<MenuItem> menuItems) {
var maxMenuItem = menuItems.Where(mi => PositionHasMajorNumber(mi)).OrderByDescending(mi => mi.Position, new FlatPositionComparer()).FirstOrDefault();
var positionParts = maxMenuItem.Position.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Trim().Length > 0);
if (positionParts.Count() > 0) {
int result;
if (int.TryParse(positionParts.ElementAt(0), out result)) {
return (result + 1).ToString();
// are there any menu item ?
if (maxMenuItem != null) {
var positionParts = maxMenuItem.Position.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Trim().Length > 0).ToList();
if (positionParts.Any()) {
int result;
if (int.TryParse(positionParts.ElementAt(0), out result)) {
return (result + 1).ToString(CultureInfo.InvariantCulture);
}
}
}
return "1";
}
@@ -30,7 +34,7 @@ namespace Orchard.Utility {
// first one in this major position number
return majorStr;
}
var positionParts = maxMenuItem.Position.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Trim().Length > 0);
var positionParts = maxMenuItem.Position.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Trim().Length > 0).ToList();
if (positionParts.Count() > 1) {
int result;
if (int.TryParse(positionParts.ElementAt(1), out result)) {