mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
5
.hgtags
5
.hgtags
@@ -13,3 +13,8 @@ d2cca954cbf94750946a6325e5ec23e267430bd2 perf snapshot 1
|
|||||||
5cc01ad95f11fcd241163685effaf01ef4b6cb02 1.0
|
5cc01ad95f11fcd241163685effaf01ef4b6cb02 1.0
|
||||||
5cc01ad95f11fcd241163685effaf01ef4b6cb02 1.0
|
5cc01ad95f11fcd241163685effaf01ef4b6cb02 1.0
|
||||||
16f874f7c4f38ed92ec2e40bd5a9cc7b1ee87407 1.0
|
16f874f7c4f38ed92ec2e40bd5a9cc7b1ee87407 1.0
|
||||||
|
6d7b973415c94482a417ba025a4c823d5c2d6630 1.1
|
||||||
|
6d7b973415c94482a417ba025a4c823d5c2d6630 1.1
|
||||||
|
48aedbdcebb174eb37534df9c7401fa35da22bbd 1.1
|
||||||
|
48aedbdcebb174eb37534df9c7401fa35da22bbd 1.1
|
||||||
|
97186e9f4536562febcdecf3da481231d375b0c7 1.1
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Orchard.Blogs.Drivers {
|
|||||||
|
|
||||||
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
|
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
|
||||||
|
|
||||||
return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part.ContentItem, ContentItems: blogPostList));
|
return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part.ContentItem, ContentItems: blogPostList, Blog: blog));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<#@ template language="C#" HostSpecific="True" #>
|
||||||
|
<#
|
||||||
|
MvcTextTemplateHost mvcHost = (MvcTextTemplateHost)(Host);
|
||||||
|
#>
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard;
|
||||||
|
|
||||||
|
namespace <#= mvcHost.Namespace #>
|
||||||
|
{
|
||||||
|
public class <#= mvcHost.ControllerName #> : Controller
|
||||||
|
{
|
||||||
|
public IOrchardServices Services { get; set; }
|
||||||
|
|
||||||
|
public <#= mvcHost.ControllerName #>(IOrchardServices services) {
|
||||||
|
Services = services;
|
||||||
|
T = NullLocalizer.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
<#
|
||||||
|
if(mvcHost.AddActionMethods) {
|
||||||
|
#>
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Details(int id)
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Create()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Create(FormCollection collection)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: Add insert logic here
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Edit(int id)
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Edit(int id, FormCollection collection)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: Add update logic here
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Delete(int id)
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Delete(int id, FormCollection collection)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: Add delete logic here
|
||||||
|
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<#
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{$$ModuleProjectGuid$$}</ProjectGuid>
|
<ProjectGuid>{$$ModuleProjectGuid$$}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
<ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>$$ModuleName$$</RootNamespace>
|
<RootNamespace>$$ModuleName$$</RootNamespace>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
"", "Content", "Styles", "Scripts", "Views", "Zones"
|
"", "Content", "Styles", "Scripts", "Views", "Zones"
|
||||||
};
|
};
|
||||||
private static readonly string[] _moduleDirectories = new [] {
|
private static readonly string[] _moduleDirectories = new [] {
|
||||||
"", "Properties", "Controllers", "Views", "Models", "Scripts", "Styles"
|
"", "Properties", "Controllers", "Views", "Models", "Scripts", "Styles", "CodeTemplates/AddController"
|
||||||
};
|
};
|
||||||
|
|
||||||
private const string ModuleName = "CodeGeneration";
|
private const string ModuleName = "CodeGeneration";
|
||||||
@@ -210,6 +210,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
string propertiesPath = modulePath + "Properties";
|
string propertiesPath = modulePath + "Properties";
|
||||||
var content = new HashSet<string>();
|
var content = new HashSet<string>();
|
||||||
var folders = new HashSet<string>();
|
var folders = new HashSet<string>();
|
||||||
|
var contentNoDeploy = new HashSet<string>();
|
||||||
|
|
||||||
foreach(var folder in _moduleDirectories) {
|
foreach(var folder in _moduleDirectories) {
|
||||||
Directory.CreateDirectory(modulePath + folder);
|
Directory.CreateDirectory(modulePath + folder);
|
||||||
@@ -226,6 +227,8 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
content.Add(modulePath + "Scripts\\Web.config");
|
content.Add(modulePath + "Scripts\\Web.config");
|
||||||
File.WriteAllText(modulePath + "Styles\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt"));
|
File.WriteAllText(modulePath + "Styles\\Web.config", File.ReadAllText(_codeGenTemplatePath + "StaticFilesWebConfig.txt"));
|
||||||
content.Add(modulePath + "Styles\\Web.config");
|
content.Add(modulePath + "Styles\\Web.config");
|
||||||
|
File.WriteAllText(modulePath + "CodeTemplates\\AddController\\Controller.tt", File.ReadAllText(_codeGenTemplatePath + "Controller.tt."));
|
||||||
|
contentNoDeploy.Add(modulePath + "CodeTemplates\\AddController\\Controller.tt");
|
||||||
|
|
||||||
string templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleAssemblyInfo.txt");
|
string templateText = File.ReadAllText(_codeGenTemplatePath + "ModuleAssemblyInfo.txt");
|
||||||
templateText = templateText.Replace("$$ModuleName$$", moduleName);
|
templateText = templateText.Replace("$$ModuleName$$", moduleName);
|
||||||
@@ -238,7 +241,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
File.WriteAllText(modulePath + "Module.txt", templateText);
|
File.WriteAllText(modulePath + "Module.txt", templateText);
|
||||||
content.Add(modulePath + "Module.txt");
|
content.Add(modulePath + "Module.txt");
|
||||||
|
|
||||||
var itemGroup = CreateProjectItemGroup(modulePath, content, folders);
|
var itemGroup = CreateProjectItemGroup(modulePath, content, folders, contentNoDeploy);
|
||||||
|
|
||||||
File.WriteAllText(modulePath + moduleName + ".csproj", CreateCsProject(moduleName, projectGuid, itemGroup));
|
File.WriteAllText(modulePath + moduleName + ".csproj", CreateCsProject(moduleName, projectGuid, itemGroup));
|
||||||
}
|
}
|
||||||
@@ -321,7 +324,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
|
|
||||||
// create new csproj for the theme
|
// create new csproj for the theme
|
||||||
if (projectGuid != null) {
|
if (projectGuid != null) {
|
||||||
var itemGroup = CreateProjectItemGroup(themePath, createdFiles, createdFolders);
|
var itemGroup = CreateProjectItemGroup(themePath, createdFiles, createdFolders, null);
|
||||||
string projectText = CreateCsProject(themeName, projectGuid, itemGroup);
|
string projectText = CreateCsProject(themeName, projectGuid, itemGroup);
|
||||||
File.WriteAllText(themePath + "\\" + themeName + ".csproj", projectText);
|
File.WriteAllText(themePath + "\\" + themeName + ".csproj", projectText);
|
||||||
}
|
}
|
||||||
@@ -329,7 +332,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
if (includeInSolution) {
|
if (includeInSolution) {
|
||||||
if (projectGuid == null) {
|
if (projectGuid == null) {
|
||||||
// include in solution but dont create a project: just add the references to Orchard.Themes project
|
// include in solution but dont create a project: just add the references to Orchard.Themes project
|
||||||
var itemGroup = CreateProjectItemGroup(HostingEnvironment.MapPath("~/Themes/"), createdFiles, createdFolders);
|
var itemGroup = CreateProjectItemGroup(HostingEnvironment.MapPath("~/Themes/"), createdFiles, createdFolders, null);
|
||||||
AddFilesToOrchardThemesProject(output, itemGroup);
|
AddFilesToOrchardThemesProject(output, itemGroup);
|
||||||
TouchSolution(output);
|
TouchSolution(output);
|
||||||
}
|
}
|
||||||
@@ -356,7 +359,8 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CreateProjectItemGroup(string relativeFromPath, HashSet<string> content, HashSet<string> folders) {
|
private static string CreateProjectItemGroup(string relativeFromPath, HashSet<string> content, HashSet<string> folders, HashSet<string> contentNoDeploy)
|
||||||
|
{
|
||||||
var contentInclude = "";
|
var contentInclude = "";
|
||||||
if (relativeFromPath != null && !relativeFromPath.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) {
|
if (relativeFromPath != null && !relativeFromPath.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) {
|
||||||
relativeFromPath += "\\";
|
relativeFromPath += "\\";
|
||||||
@@ -374,6 +378,10 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
contentInclude += "\r\n" + string.Join("\r\n", from folder in folders
|
contentInclude += "\r\n" + string.Join("\r\n", from folder in folders
|
||||||
select " <Folder Include=\"" + folder.Replace(relativeFromPath, "") + "\" />");
|
select " <Folder Include=\"" + folder.Replace(relativeFromPath, "") + "\" />");
|
||||||
}
|
}
|
||||||
|
if (contentNoDeploy != null && contentNoDeploy.Count > 0) {
|
||||||
|
contentInclude += "\r\n" + string.Join("\r\n", from file in contentNoDeploy
|
||||||
|
select " <None Include=\"" + file.Replace(relativeFromPath, "") + "\" />");
|
||||||
|
}
|
||||||
return string.Format(CultureInfo.InvariantCulture, "<ItemGroup>\r\n{0}\r\n </ItemGroup>\r\n ", contentInclude);
|
return string.Format(CultureInfo.InvariantCulture, "<ItemGroup>\r\n{0}\r\n </ItemGroup>\r\n ", contentInclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="CodeGenerationTemplates\Placement.info" />
|
<Content Include="CodeGenerationTemplates\Placement.info" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="CodeGenerationTemplates\Controller.tt" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.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.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
@@ -14,3 +14,8 @@ Features:
|
|||||||
Name: Url Alternates
|
Name: Url Alternates
|
||||||
Category: Designer
|
Category: Designer
|
||||||
Description: Adds shape alternates for specific urls
|
Description: Adds shape alternates for specific urls
|
||||||
|
WidgetAlternates:
|
||||||
|
Name: Widget Alternates
|
||||||
|
Category: Designer
|
||||||
|
Description: Adds shape alternates for content types stereotyped as widgets, allowing to customize shapes by widget and zone
|
||||||
|
Dependencies: Orchard.Widgets
|
||||||
|
|||||||
@@ -100,6 +100,10 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Orchard.Widgets\Orchard.Widgets.csproj">
|
||||||
|
<Project>{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}</Project>
|
||||||
|
<Name>Orchard.Widgets</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Controllers\AlternateController.cs" />
|
<Compile Include="Controllers\AlternateController.cs" />
|
||||||
@@ -107,6 +111,7 @@
|
|||||||
<Compile Include="Services\TemplatesFilter.cs" />
|
<Compile Include="Services\TemplatesFilter.cs" />
|
||||||
<Compile Include="Services\ShapeTracingFactory.cs" />
|
<Compile Include="Services\ShapeTracingFactory.cs" />
|
||||||
<Compile Include="Services\UrlAlternatesFactory.cs" />
|
<Compile Include="Services\UrlAlternatesFactory.cs" />
|
||||||
|
<Compile Include="Services\WidgetAlternatesFactory.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\ShapeTracingWrapper.cshtml" />
|
<Content Include="Views\ShapeTracingWrapper.cshtml" />
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Orchard.DisplayManagement.Implementation;
|
||||||
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Widgets.Models;
|
||||||
|
|
||||||
|
namespace Orchard.DesignerTools.Services {
|
||||||
|
[OrchardFeature("WidgetAlternates")]
|
||||||
|
public class WidgetAlternatesFactory : ShapeDisplayEvents {
|
||||||
|
public override void Displaying(ShapeDisplayingContext context) {
|
||||||
|
context.ShapeMetadata.OnDisplaying(displayedContext => {
|
||||||
|
// We don't want the "Widget" content item itself, but the content item that consists of the Widget part (e.g. Parts.Blogs.RecentBlogPosts)
|
||||||
|
if (displayedContext.ShapeMetadata.Type != "Widget") {
|
||||||
|
ContentItem contentItem = displayedContext.Shape.ContentItem;
|
||||||
|
if (contentItem != null) {
|
||||||
|
// Is the contentItem a widget? (we could probably test for the stereotype setting, don't know if that is more efficient than selecting the WidgetPart)
|
||||||
|
var widgetPart = contentItem.As<WidgetPart>();
|
||||||
|
if (widgetPart != null) {
|
||||||
|
var zoneName = widgetPart.Zone;
|
||||||
|
var shapeName = displayedContext.ShapeMetadata.Type;
|
||||||
|
var contentTypeName = contentItem.ContentType;
|
||||||
|
|
||||||
|
// Add 2 alternates for flexible widget shape naming:
|
||||||
|
// [ShapeName]-[ZoneName].cshtml: (e.g. "Parts.Blogs.RecentBlogPosts-myZoneName.cshtml")
|
||||||
|
// [ContentTypeName]-[ZoneName].cshtml: (e.g. "RecentBlogPosts-myZoneName.cshtml")
|
||||||
|
displayedContext.ShapeMetadata.Alternates.Add(contentTypeName + "__" + zoneName);
|
||||||
|
displayedContext.ShapeMetadata.Alternates.Add(shapeName + "__" + zoneName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
foreach (string key in input.Keys) {
|
foreach (string key in input.Keys) {
|
||||||
if (key.StartsWith("Checkbox.") && input[key] == "true") {
|
if (key.StartsWith("Checkbox.") && input[key] == "true") {
|
||||||
string folderName = key.Substring("Checkbox.".Length);
|
string folderName = key.Substring("Checkbox.".Length);
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't delete media folder")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
_mediaService.DeleteFolder(folderName);
|
_mediaService.DeleteFolder(folderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Core.Common.Models;
|
|
||||||
using Orchard.Core.Contents.Controllers;
|
using Orchard.Core.Contents.Controllers;
|
||||||
using Orchard.Core.Settings.Models;
|
using Orchard.Core.Settings.Models;
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Users.Events;
|
||||||
using Orchard.Users.Models;
|
using Orchard.Users.Models;
|
||||||
using Orchard.Users.Services;
|
using Orchard.Users.Services;
|
||||||
using Orchard.Users.ViewModels;
|
using Orchard.Users.ViewModels;
|
||||||
@@ -24,6 +24,7 @@ namespace Orchard.Users.Controllers {
|
|||||||
public class AdminController : Controller, IUpdateModel {
|
public class AdminController : Controller, IUpdateModel {
|
||||||
private readonly IMembershipService _membershipService;
|
private readonly IMembershipService _membershipService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
|
private readonly IEnumerable<IUserEventHandler> _userEventHandlers;
|
||||||
private readonly ISiteService _siteService;
|
private readonly ISiteService _siteService;
|
||||||
|
|
||||||
public AdminController(
|
public AdminController(
|
||||||
@@ -31,10 +32,12 @@ namespace Orchard.Users.Controllers {
|
|||||||
IMembershipService membershipService,
|
IMembershipService membershipService,
|
||||||
IUserService userService,
|
IUserService userService,
|
||||||
IShapeFactory shapeFactory,
|
IShapeFactory shapeFactory,
|
||||||
|
IEnumerable<IUserEventHandler> userEventHandlers,
|
||||||
ISiteService siteService) {
|
ISiteService siteService) {
|
||||||
Services = services;
|
Services = services;
|
||||||
_membershipService = membershipService;
|
_membershipService = membershipService;
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
|
_userEventHandlers = userEventHandlers;
|
||||||
_siteService = siteService;
|
_siteService = siteService;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
@@ -311,6 +314,9 @@ namespace Orchard.Users.Controllers {
|
|||||||
if ( user != null ) {
|
if ( user != null ) {
|
||||||
user.As<UserPart>().RegistrationStatus = UserStatus.Approved;
|
user.As<UserPart>().RegistrationStatus = UserStatus.Approved;
|
||||||
Services.Notifier.Information(T("User {0} approved", user.UserName));
|
Services.Notifier.Information(T("User {0} approved", user.UserName));
|
||||||
|
foreach (var userEventHandler in _userEventHandlers) {
|
||||||
|
userEventHandler.Approved(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Orchard.Users.Events {
|
|||||||
void LoggedIn(IUser user);
|
void LoggedIn(IUser user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a user explicitly logs out (as opposed to one whos session cookie simply expires)
|
/// Called when a user explicitly logs out (as opposed to one whose session cookie simply expires)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void LoggedOut(IUser user);
|
void LoggedOut(IUser user);
|
||||||
|
|
||||||
@@ -42,6 +42,11 @@ namespace Orchard.Users.Events {
|
|||||||
/// Called after a user has confirmed their email address
|
/// Called after a user has confirmed their email address
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ConfirmedEmail(IUser user);
|
void ConfirmedEmail(IUser user);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called after a user has been approved
|
||||||
|
/// </summary>
|
||||||
|
void Approved(IUser user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ namespace Orchard.Users.Services {
|
|||||||
|
|
||||||
foreach ( var userEventHandler in _userEventHandlers ) {
|
foreach ( var userEventHandler in _userEventHandlers ) {
|
||||||
userEventHandler.Created(userContext);
|
userEventHandler.Created(userContext);
|
||||||
|
if (user.RegistrationStatus == UserStatus.Approved) {
|
||||||
|
userEventHandler.Approved(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( registrationSettings != null && registrationSettings.UsersAreModerated && registrationSettings.NotifyModeration && !createUserParams.IsApproved ) {
|
if ( registrationSettings != null && registrationSettings.UsersAreModerated && registrationSettings.NotifyModeration && !createUserParams.IsApproved ) {
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ namespace Orchard.DisplayManagement.Shapes {
|
|||||||
public virtual IEnumerable<dynamic> Items { get { return _items; } }
|
public virtual IEnumerable<dynamic> Items { get { return _items; } }
|
||||||
|
|
||||||
public virtual Shape Add(object item, string position = DefaultPosition) {
|
public virtual Shape Add(object item, string position = DefaultPosition) {
|
||||||
|
// pszmyd: Ignoring null shapes
|
||||||
|
if (item == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// todo: (sebros) this is a temporary implementation to prevent common known scenarios throwing exceptions. The final solution would need to filter based on the fact that it is a Shape instance
|
// todo: (sebros) this is a temporary implementation to prevent common known scenarios throwing exceptions. The final solution would need to filter based on the fact that it is a Shape instance
|
||||||
if ( item is MvcHtmlString ||
|
if ( item is MvcHtmlString ||
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ namespace Orchard.UI {
|
|||||||
public virtual string ZoneName { get; set; }
|
public virtual string ZoneName { get; set; }
|
||||||
|
|
||||||
public IZone Add(Action<HtmlHelper> action, string position) {
|
public IZone Add(Action<HtmlHelper> action, string position) {
|
||||||
throw new NotImplementedException();
|
// pszmyd: Replaced the NotImplementedException with simply doing nothing
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ namespace Orchard.UI.Zones {
|
|||||||
public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) {
|
public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) {
|
||||||
var argsCount = args.Count();
|
var argsCount = args.Count();
|
||||||
if (name == "Add" && (argsCount == 1 || argsCount == 2)) {
|
if (name == "Add" && (argsCount == 1 || argsCount == 2)) {
|
||||||
|
// pszmyd: Ignore null shapes
|
||||||
|
if (args.First() == null)
|
||||||
|
return _parent;
|
||||||
|
|
||||||
dynamic parent = _parent;
|
dynamic parent = _parent;
|
||||||
|
|
||||||
dynamic zone = _zoneFactory();
|
dynamic zone = _zoneFactory();
|
||||||
|
|||||||
Reference in New Issue
Block a user