mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Shifting RegistrationSettingsPart
This commit is contained in:
@@ -8,11 +8,10 @@ using Orchard.Users.Models;
|
||||
namespace Orchard.Users.Handlers {
|
||||
[UsedImplicitly]
|
||||
public class RegistrationSettingsPartHandler : ContentHandler {
|
||||
public RegistrationSettingsPartHandler(IRepository<RegistrationSettingsPartRecord> repository) {
|
||||
public RegistrationSettingsPartHandler() {
|
||||
T = NullLocalizer.Instance;
|
||||
Filters.Add(new ActivatingFilter<RegistrationSettingsPart>("Site"));
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
Filters.Add(new TemplateFilterForRecord<RegistrationSettingsPartRecord>("RegistrationSettings", "Parts/Users.RegistrationSettings", "users"));
|
||||
Filters.Add(new TemplateFilterForPart<RegistrationSettingsPart>("RegistrationSettings", "Parts/Users.RegistrationSettings", "users"));
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
@@ -21,19 +21,6 @@ namespace Orchard.Users {
|
||||
.Column<string>("EmailChallengeToken")
|
||||
);
|
||||
|
||||
SchemaBuilder.CreateTable("RegistrationSettingsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("UsersCanRegister", c => c.WithDefault(false))
|
||||
.Column<bool>("UsersMustValidateEmail", c => c.WithDefault(false))
|
||||
.Column<string>("ValidateEmailRegisteredWebsite", c => c.WithLength(255))
|
||||
.Column<string>("ValidateEmailContactEMail", c => c.WithLength(255))
|
||||
.Column<bool>("UsersAreModerated", c => c.WithDefault(false))
|
||||
.Column<bool>("NotifyModeration", c => c.WithDefault(false))
|
||||
.Column<string>("NotificationsRecipients", c => c.Unlimited())
|
||||
.Column<bool>("EnableLostPassword", c => c.WithDefault(false))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Users.Models {
|
||||
public class RegistrationSettingsPart : ContentPart<RegistrationSettingsPartRecord> {
|
||||
public class RegistrationSettingsPart : ContentPart {
|
||||
public bool UsersCanRegister {
|
||||
get { return Record.UsersCanRegister; }
|
||||
set { Record.UsersCanRegister = value; }
|
||||
get { return this.Retrieve(x => x.UsersCanRegister); }
|
||||
set { this.Store(x => x.UsersCanRegister, value); }
|
||||
}
|
||||
|
||||
public bool UsersMustValidateEmail {
|
||||
get { return Record.UsersMustValidateEmail; }
|
||||
set { Record.UsersMustValidateEmail = value; }
|
||||
get { return this.Retrieve(x => x.UsersMustValidateEmail); }
|
||||
set { this.Store(x => x.UsersMustValidateEmail, value); }
|
||||
}
|
||||
|
||||
public string ValidateEmailRegisteredWebsite {
|
||||
get { return Record.ValidateEmailRegisteredWebsite; }
|
||||
set { Record.ValidateEmailRegisteredWebsite = value; }
|
||||
get { return this.Retrieve(x => x.ValidateEmailRegisteredWebsite); }
|
||||
set { this.Store(x => x.ValidateEmailRegisteredWebsite, value); }
|
||||
}
|
||||
|
||||
public string ValidateEmailContactEMail {
|
||||
get { return Record.ValidateEmailContactEMail; }
|
||||
set { Record.ValidateEmailContactEMail = value; }
|
||||
get { return this.Retrieve(x => x.ValidateEmailContactEMail); }
|
||||
set { this.Store(x => x.ValidateEmailContactEMail, value); }
|
||||
}
|
||||
|
||||
public bool UsersAreModerated {
|
||||
get { return Record.UsersAreModerated; }
|
||||
set { Record.UsersAreModerated = value; }
|
||||
get { return this.Retrieve(x => x.UsersAreModerated); }
|
||||
set { this.Store(x => x.UsersAreModerated, value); }
|
||||
}
|
||||
|
||||
public bool NotifyModeration {
|
||||
get { return Record.NotifyModeration; }
|
||||
set { Record.NotifyModeration = value; }
|
||||
get { return this.Retrieve(x => x.NotifyModeration); }
|
||||
set { this.Store(x => x.NotifyModeration, value); }
|
||||
}
|
||||
|
||||
public string NotificationsRecipients {
|
||||
get { return Record.NotificationsRecipients; }
|
||||
set { Record.NotificationsRecipients = value; }
|
||||
get { return this.Retrieve(x => x.NotificationsRecipients); }
|
||||
set { this.Store(x => x.NotificationsRecipients, value); }
|
||||
}
|
||||
|
||||
public bool EnableLostPassword {
|
||||
get { return Record.EnableLostPassword; }
|
||||
set { Record.EnableLostPassword = value; }
|
||||
get { return this.Retrieve(x => x.EnableLostPassword); }
|
||||
set { this.Store(x => x.EnableLostPassword, value); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Users.Models {
|
||||
public class RegistrationSettingsPartRecord : ContentPartRecord {
|
||||
public virtual bool UsersCanRegister { get; set; }
|
||||
public virtual bool UsersMustValidateEmail { get; set; }
|
||||
[StringLength(255)]
|
||||
public virtual string ValidateEmailRegisteredWebsite { get; set; }
|
||||
[StringLength(255)]
|
||||
public virtual string ValidateEmailContactEMail { get; set; }
|
||||
|
||||
public virtual bool UsersAreModerated { get; set; }
|
||||
public virtual bool NotifyModeration { get; set; }
|
||||
public virtual string NotificationsRecipients { get; set; }
|
||||
|
||||
public virtual bool EnableLostPassword { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,6 @@
|
||||
<Compile Include="Events\IUserEventHandler.cs" />
|
||||
<Compile Include="Models\MessageTypes.cs" />
|
||||
<Compile Include="Models\RegistrationSettingsPart.cs" />
|
||||
<Compile Include="Models\RegistrationSettingsPartRecord.cs" />
|
||||
<Compile Include="Models\UserPart.cs" />
|
||||
<Compile Include="Handlers\UserPartHandler.cs" />
|
||||
<Compile Include="Models\UserPartRecord.cs" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Orchard.Users.Models.RegistrationSettingsPartRecord
|
||||
@model Orchard.Users.Models.RegistrationSettingsPart
|
||||
@using Orchard.Messaging.Services;
|
||||
|
||||
@{
|
||||
|
||||
@@ -146,6 +146,21 @@ namespace Upgrade.Controllers {
|
||||
|
||||
_upgradeService.ExecuteReader("DROP TABLE " + _upgradeService.GetPrefixedTableName("Orchard_Search_SearchSettingsPartRecord"), null);
|
||||
|
||||
// RegistrationSettingsPartRecord
|
||||
_upgradeService.ExecuteReader("SELECT * FROM " + _upgradeService.GetPrefixedTableName("Orchard_Users_RegistrationSettingsPartRecord"),
|
||||
(reader, connection) => {
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "UsersCanRegister", (bool)reader["UsersCanRegister"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "UsersMustValidateEmail", (bool)reader["UsersMustValidateEmail"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "UsersCanRegister", (bool)reader["UsersCanRegister"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "ValidateEmailRegisteredWebsite", (bool)reader["ValidateEmailRegisteredWebsite"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "ValidateEmailContactEMail", (bool)reader["ValidateEmailContactEMail"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "UsersAreModerated", (bool)reader["UsersAreModerated"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "NotifyModeration", (bool)reader["NotifyModeration"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "NotificationsRecipients", (bool)reader["NotificationsRecipients"]);
|
||||
site.As<InfosetPart>().Store("RegistrationSettingsPart", "EnableLostPassword", (bool)reader["EnableLostPassword"]);
|
||||
});
|
||||
_upgradeService.ExecuteReader("DROP TABLE " + _upgradeService.GetPrefixedTableName("Orchard_Users_RegistrationSettingsPartRecord"), null);
|
||||
|
||||
_orchardServices.Notifier.Information(T("Site Settings migrated successfully"));
|
||||
|
||||
return View();
|
||||
|
||||
Reference in New Issue
Block a user