mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Merge with 1.x
--HG-- branch : autoroute
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
c54cb640d6bc14c51b9fb9bd78231bb0facec067 src/Orchard.Web/Modules/Orchard.Forms
|
||||
204bdef384f41bb5e463bed6b98a056945a7d839 src/Orchard.Web/Modules/Orchard.Rules
|
||||
ce578373f907c0a55fd91229a344f0755f290174 src/Orchard.Web/Modules/Orchard.TaskLease
|
||||
c6a4d1a5603381cbfc1d694e9525f42fd5ecdb79 src/Orchard.Web/Modules/Orchard.Tokens
|
||||
3b89a9bff14afc209274459d642d4bfe5d314117 src/Orchard.Web/Modules/Orchard.Tokens
|
||||
8375c8c10297aa9b66f792354bed25268184cd08 src/orchard.web/modules/Orchard.Alias
|
||||
114e75928872042f092b0cc7cafa1a58c208d8ae src/orchard.web/modules/Orchard.Fields
|
||||
913ced6d47a208394f8149d1573c2f2d61240d24 src/orchard.web/modules/orchard.Projections
|
||||
|
||||
@@ -212,7 +212,11 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
[HttpPost, ActionName("Create")]
|
||||
[FormValueRequired("submit.Publish")]
|
||||
public ActionResult CreateAndPublishPOST(string id, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't create content")))
|
||||
|
||||
// pass a dummy content to the authorization check to check for "own" variations
|
||||
var dummyContent = _contentManager.New(id);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, dummyContent, T("Couldn't create content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
return CreatePOST(id, returnUrl, contentItem => _contentManager.Publish(contentItem));
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
</span>
|
||||
<span class="user-actions">
|
||||
@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }, new { rel = "nofollow" })
|
||||
@Html.ActionLink(T("Dashboard").ToString(), "Index", new { Area = "Dashboard", Controller = "Admin" })
|
||||
@if (AuthorizedFor(Orchard.Security.StandardPermissions.AccessAdminPanel)) {
|
||||
@Html.ActionLink(T("Dashboard").ToString(), "Index", new {Area = "Dashboard", Controller = "Admin"})
|
||||
}
|
||||
</span>
|
||||
} else {
|
||||
<span class="user-actions">@Html.ActionLink(T("Sign In").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = (Request.QueryString["ReturnUrl"] ?? Request.RawUrl) }, new { rel = "nofollow" })</span>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Core.XmlRpc.Models;
|
||||
@@ -29,8 +31,10 @@ namespace Orchard.Core.XmlRpc.Controllers {
|
||||
if (methodResponse == null)
|
||||
throw new HttpException(500, "TODO: xmlrpc fault");
|
||||
|
||||
var content = _writer.MapMethodResponse(methodResponse).ToString();
|
||||
return Content(content, "text/xml");
|
||||
var content = new StringBuilder();
|
||||
_writer.MapMethodResponse(methodResponse).Save(new StringWriter(content));
|
||||
|
||||
return Content(content.ToString(), "text/xml");
|
||||
}
|
||||
|
||||
private XRpcMethodResponse Dispatch(XRpcMethodCall request) {
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<Compile Include="Models\CommentsPartRecord.cs" />
|
||||
<Compile Include="Services\CreateCommentContext.cs" />
|
||||
<Compile Include="Services\ICommentService.cs" />
|
||||
<Compile Include="Tokens\CommentTokens.cs" />
|
||||
<Compile Include="ViewModels\CommentCountViewModel.cs" />
|
||||
<Compile Include="Models\CommentSettingsPart.cs" />
|
||||
<Compile Include="Handlers\CommentSettingsPartHandler.cs" />
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Events;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Comments.Tokens {
|
||||
public interface ITokenProvider : IEventHandler {
|
||||
void Describe(dynamic context);
|
||||
void Evaluate(dynamic context);
|
||||
}
|
||||
|
||||
public class CommentTokens : ITokenProvider {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public CommentTokens(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Describe(dynamic context) {
|
||||
context.For("Content", T("Content Items"), T("Content Items"))
|
||||
.Token("CommentedOn", T("Commented On"), T("The content item this comment was created on."))
|
||||
.Token("CommentMessage", T("Comment Message"), T("The text of the comment itself"))
|
||||
.Token("CommentAuthor", T("Comment Author"), T("The author of the comment."))
|
||||
;
|
||||
}
|
||||
|
||||
public void Evaluate(dynamic context) {
|
||||
context.For<IContent>("Content")
|
||||
.Token("CommentedOn", (Func<IContent, object>)(content => content.As<CommentPart>().Record.CommentedOn))
|
||||
.Chain("CommentedOn", "Content", (Func<IContent, object>)(content => _contentManager.Get(content.As<CommentPart>().Record.CommentedOn)))
|
||||
.Token("CommentMessage", (Func<IContent, object>)(content => content.As<CommentPart>().Record.CommentText))
|
||||
.Token("CommentAuthor", (Func<IContent, object>)CommentAuthor)
|
||||
;
|
||||
}
|
||||
|
||||
private static string CommentAuthor(IContent comment) {
|
||||
var commentPart = comment.As<CommentPart>();
|
||||
return String.IsNullOrWhiteSpace(commentPart.Record.UserName) ? commentPart.Record.Author : commentPart.Record.UserName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,8 +65,13 @@ namespace Orchard.Media.Services {
|
||||
var name = file.Optional<string>("name");
|
||||
var bits = file.Optional<byte[]>("bits");
|
||||
|
||||
string directoryName = Path.GetDirectoryName(name);
|
||||
if (string.IsNullOrWhiteSpace(directoryName)) { // Some clients only pass in a name path that does not contain a directory component.
|
||||
directoryName = "media";
|
||||
}
|
||||
|
||||
try {
|
||||
// delete the file if it already exists, e.g. and updated image in a blog post
|
||||
// delete the file if it already exists, e.g. an updated image in a blog post
|
||||
// it's safe to delete the file as each content item gets a specific folder
|
||||
_mediaService.DeleteFile(Path.GetDirectoryName(name), Path.GetFileName(name));
|
||||
}
|
||||
@@ -74,8 +79,11 @@ namespace Orchard.Media.Services {
|
||||
// current way to delete a file if it exists
|
||||
}
|
||||
|
||||
string publicUrl = _mediaService.UploadMediaFile(Path.GetDirectoryName(name), Path.GetFileName(name), bits, false);
|
||||
return new XRpcStruct().Set("url", url.MakeAbsolute(publicUrl));
|
||||
string publicUrl = _mediaService.UploadMediaFile(directoryName, Path.GetFileName(name), bits, true);
|
||||
return new XRpcStruct() // Some clients require all optional attributes to be declared Wordpress responds in this way as well.
|
||||
.Set("file", publicUrl)
|
||||
.Set("url", url.MakeAbsolute(publicUrl))
|
||||
.Set("type", file.Optional<string>("type"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
@@ -76,12 +77,24 @@ namespace Orchard.Widgets.Drivers {
|
||||
if (zone != null) {
|
||||
part.Zone = zone;
|
||||
}
|
||||
|
||||
var renderTitle = context.Attribute(part.PartDefinition.Name, "RenderTitle");
|
||||
if (!string.IsNullOrWhiteSpace(renderTitle)) {
|
||||
part.RenderTitle = Convert.ToBoolean(renderTitle);
|
||||
}
|
||||
|
||||
var name = context.Attribute(part.PartDefinition.Name, "Name");
|
||||
if (name != null) {
|
||||
part.Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(WidgetPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Position", part.Position);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Zone", part.Zone);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("RenderTitle", part.RenderTitle);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("Name", part.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,11 +63,6 @@
|
||||
<HintPath>..\..\lib\autofac\Autofac.Configuration.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Web, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\autofac\Autofac.Integration.Web.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\Castle Windsor 2.0\bin\Castle.Core.dll</HintPath>
|
||||
@@ -78,10 +73,6 @@
|
||||
<HintPath>..\..\lib\Castle Windsor 2.0\bin\Castle.DynamicProxy2.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Services.Logging.Log4netIntegration">
|
||||
<HintPath>..\..\lib\Castle Windsor 2.0\bin\Castle.Services.Logging.Log4netIntegration.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\claysharp\ClaySharp.dll</HintPath>
|
||||
@@ -98,9 +89,6 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure">
|
||||
<HintPath>..\..\lib\aspnetmvc\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\fluentnhibernate\NHibernate.dll</HintPath>
|
||||
@@ -112,7 +100,6 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@@ -144,10 +131,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor">
|
||||
<HintPath>..\..\lib\aspnetmvc\System.Web.WebPages.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
Reference in New Issue
Block a user