--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-10-15 17:25:10 -07:00
58 changed files with 513 additions and 420 deletions

View File

@@ -5,6 +5,10 @@ namespace Orchard.Core.Contents {
public class Shapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Content")
.OnCreated(created => {
var content = created.Shape;
content.Child.Add(created.New.PlaceChildContent(Source: content));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
@@ -16,6 +20,9 @@ namespace Orchard.Core.Contents {
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);
//Content.Summary-Page
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);
if (!displaying.ShapeMetadata.DisplayType.Contains("Admin"))
displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
}
});

View File

@@ -0,0 +1,11 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Contents;
@if (AuthorizedFor(Permissions.EditContent)) {
<div class="content-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Child)
</div>
}
else {
@Display(Model.Child)
}

View File

@@ -394,6 +394,7 @@
<Content Include="Dashboard\Views\Helper\Index.cshtml" />
<None Include="Common\Placement.info" />
<None Include="Contents\Placement.info" />
<None Include="Contents\Views\Content.ControlWrapper.cshtml" />
<None Include="Localization\Placement.info" />
<None Include="PublishLater\Placement.info" />
<None Include="Routable\Views\Parts\RoutableTitle.cshtml" />

View File

@@ -138,11 +138,11 @@
<Content Include="Views\Parts\Blogs.BlogPost.List.Admin.cshtml">
<SubType>Code</SubType>
</Content>
<Content Include="Views\Items\Blog.cshtml" />
<Content Include="Views\Items\BlogPost.cshtml" />
<Content Include="Views\Items\Blog.Summary.cshtml" />
<Content Include="Views\Items\BlogPost.Summary.cshtml" />
<Content Include="Views\Items\Blog.SummaryAdmin.cshtml" />
<Content Include="Views\Items\Content-Blog.cshtml" />
<Content Include="Views\Items\Content-BlogPost.cshtml" />
<Content Include="Views\Items\Content-Blog.Summary.cshtml" />
<Content Include="Views\Items\Content-BlogPost.Summary.cshtml" />
<Content Include="Views\Items\Content-Blog.SummaryAdmin.cshtml" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
@@ -165,10 +165,10 @@
<None Include="Views\Parts\Blogs.BlogArchives.cshtml" />
<None Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
<None Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
<None Include="Views\Items\Blog.DetailAdmin.cshtml" />
<None Include="Views\Items\Blog.Editor.cshtml" />
<None Include="Views\Items\BlogPost.Editor.cshtml" />
<None Include="Views\Items\BlogPost.SummaryAdmin.cshtml" />
<None Include="Views\Items\Content-Blog.DetailAdmin.cshtml" />
<None Include="Views\Items\Content-Blog.Editor.cshtml" />
<None Include="Views\Items\Content-BlogPost.Editor.cshtml" />
<None Include="Views\Items\Content-BlogPost.SummaryAdmin.cshtml" />
<None Include="Views\Parts\Blogs.BlogPost.List.cshtml" />
<None Include="Views\Parts\Blogs.Blog.Pager.cshtml" />
<None Include="Views\Parts\Blogs.RecentBlogPosts.cshtml" />

View File

@@ -80,6 +80,10 @@
<Compile Include="Services\IContentDefinitionService.cs" />
<Compile Include="ViewModels\AddFieldViewModel.cs" />
<Compile Include="ViewModels\CreatePartViewModel.cs" />
<Compile Include="ViewModels\EditFieldViewModel.cs" />
<Compile Include="ViewModels\EditPartFieldViewModel.cs" />
<Compile Include="ViewModels\EditPartViewModel.cs" />
<Compile Include="ViewModels\EditTypePartViewModel.cs" />
<Compile Include="ViewModels\ListContentPartsViewModel.cs" />
<Compile Include="ViewModels\RemoveFieldViewModel.cs" />
<Compile Include="ViewModels\RemovePartViewModel.cs" />

View File

@@ -0,0 +1,16 @@
using Orchard.ContentManagement.MetaData.Models;
namespace Orchard.ContentTypes.ViewModels {
public class EditFieldViewModel {
public EditFieldViewModel() { }
public EditFieldViewModel(ContentFieldDefinition contentFieldDefinition) {
Name = contentFieldDefinition.Name;
_Definition = contentFieldDefinition;
}
public string Name { get; set; }
public ContentFieldDefinition _Definition { get; private set; }
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.ContentTypes.ViewModels {
public class EditPartFieldViewModel {
public EditPartFieldViewModel() {
Settings = new SettingsDictionary();
}
public EditPartFieldViewModel(int index, ContentPartFieldDefinition field) {
Index = index;
Name = field.Name;
FieldDefinition = new EditFieldViewModel(field.FieldDefinition);
Settings = field.Settings;
_Definition = field;
}
public int Index { get; set; }
public string Prefix { get { return "Fields[" + Index + "]"; } }
public EditPartViewModel Part { get; set; }
public string Name { get; set; }
public IEnumerable<TemplateViewModel> Templates { get; set; }
public EditFieldViewModel FieldDefinition { get; set; }
public SettingsDictionary Settings { get; set; }
public ContentPartFieldDefinition _Definition { get; private set; }
}
}

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
using Orchard.Utility.Extensions;
using Orchard.ContentTypes.Extensions;
namespace Orchard.ContentTypes.ViewModels {
public class EditPartViewModel {
public EditPartViewModel() {
Fields = new List<EditPartFieldViewModel>();
Settings = new SettingsDictionary();
}
public EditPartViewModel(ContentPartDefinition contentPartDefinition) {
Name = contentPartDefinition.Name;
Fields = contentPartDefinition.Fields.Select((f, i) => new EditPartFieldViewModel(i, f) { Part = this }).ToList();
Settings = contentPartDefinition.Settings;
_Definition = contentPartDefinition;
}
public string Prefix { get { return "PartDefinition"; } }
public string Name { get; set; }
private string _displayName;
public string DisplayName {
get { return !string.IsNullOrWhiteSpace(_displayName) ? _displayName : Name.TrimEnd("Part").CamelFriendly(); }
set { _displayName = value; }
}
public IEnumerable<TemplateViewModel> Templates { get; set; }
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
public SettingsDictionary Settings { get; set; }
public ContentPartDefinition _Definition { get; private set; }
}
}

View File

@@ -0,0 +1,26 @@
using System.Collections.Generic;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.ContentTypes.ViewModels {
public class EditTypePartViewModel {
public EditTypePartViewModel() {
Settings = new SettingsDictionary();
}
public EditTypePartViewModel(int index, ContentTypePartDefinition part) {
Index = index;
PartDefinition = new EditPartViewModel(part.PartDefinition);
Settings = part.Settings;
_Definition = part;
}
public int Index { get; set; }
public string Prefix { get { return "Parts[" + Index + "]"; } }
public EditPartViewModel PartDefinition { get; set; }
public SettingsDictionary Settings { get; set; }
public EditTypeViewModel Type { get; set; }
public IEnumerable<TemplateViewModel> Templates { get; set; }
public ContentTypePartDefinition _Definition { get; private set; }
}
}

View File

@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
using Orchard.ContentTypes.Extensions;
using Orchard.Utility.Extensions;
namespace Orchard.ContentTypes.ViewModels {
public class EditTypeViewModel {
@@ -46,87 +44,4 @@ namespace Orchard.ContentTypes.ViewModels {
}
}
public class EditTypePartViewModel {
public EditTypePartViewModel() {
Settings = new SettingsDictionary();
}
public EditTypePartViewModel(int index, ContentTypePartDefinition part) {
Index = index;
PartDefinition = new EditPartViewModel(part.PartDefinition);
Settings = part.Settings;
_Definition = part;
}
public int Index { get; set; }
public string Prefix { get { return "Parts[" + Index + "]"; } }
public EditPartViewModel PartDefinition { get; set; }
public SettingsDictionary Settings { get; set; }
public EditTypeViewModel Type { get; set; }
public IEnumerable<TemplateViewModel> Templates { get; set; }
public ContentTypePartDefinition _Definition { get; private set; }
}
public class EditPartViewModel {
public EditPartViewModel() {
Fields = new List<EditPartFieldViewModel>();
Settings = new SettingsDictionary();
}
public EditPartViewModel(ContentPartDefinition contentPartDefinition) {
Name = contentPartDefinition.Name;
Fields = contentPartDefinition.Fields.Select((f, i) => new EditPartFieldViewModel(i, f) { Part = this }).ToList();
Settings = contentPartDefinition.Settings;
_Definition = contentPartDefinition;
}
public string Prefix { get { return "PartDefinition"; } }
public string Name { get; set; }
private string _displayName;
public string DisplayName {
get { return !string.IsNullOrWhiteSpace(_displayName) ? _displayName : Name.TrimEnd("Part").CamelFriendly(); }
set { _displayName = value; }
}
public IEnumerable<TemplateViewModel> Templates { get; set; }
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
public SettingsDictionary Settings { get; set; }
public ContentPartDefinition _Definition { get; private set; }
}
public class EditPartFieldViewModel {
public EditPartFieldViewModel() {
Settings = new SettingsDictionary();
}
public EditPartFieldViewModel(int index, ContentPartFieldDefinition field) {
Index = index;
Name = field.Name;
FieldDefinition = new EditFieldViewModel(field.FieldDefinition);
Settings = field.Settings;
_Definition = field;
}
public int Index { get; set; }
public string Prefix { get { return "Fields[" + Index + "]"; } }
public EditPartViewModel Part { get; set; }
public string Name { get; set; }
public IEnumerable<TemplateViewModel> Templates { get; set; }
public EditFieldViewModel FieldDefinition { get; set; }
public SettingsDictionary Settings { get; set; }
public ContentPartFieldDefinition _Definition { get; private set; }
}
public class EditFieldViewModel {
public EditFieldViewModel() { }
public EditFieldViewModel(ContentFieldDefinition contentFieldDefinition) {
Name = contentFieldDefinition.Name;
_Definition = contentFieldDefinition;
}
public string Name { get; set; }
public ContentFieldDefinition _Definition { get; private set; }
}
}

View File

@@ -1,4 +1,5 @@
@model Orchard.ContentTypes.ViewModels.EditPartViewModel
@{ Style.Require("ContentTypesAdmin"); }
<h1>@Html.TitleForPage(T("Edit Part").ToString())</h1>
<p class="breadcrumb">@Html.ActionLink(T("Content Types").Text, "index")@T(" &#62; ")@Html.ActionLink(T("Content Parts").Text, "listparts")@T(" &#62; ")@T("Edit Part")</p>
@@ -6,19 +7,30 @@
@Html.ValidationSummary()
<fieldset>
<label for="Name">@T("Name")</label>
@* has unintended consequences (renamging the part) - changing the name creates a new part of that name *@
@* has unintended consequences (renaming the part) - changing the name creates a new part of that name *@
@Html.TextBoxFor(m => m.Name, new {@class = "textMedium", disabled = "disabled"})
@Html.HiddenFor(m => m.Name)
</fieldset>
<div class="manage-part">
<div class="settings">
@DisplayChildren(Model.Templates)
@{ Html.RenderTemplates(Model.Templates); }
</div>
<h2>@T("Fields")</h2>
<div class="manage add-to-type">@Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })</div>
@DisplayChildren(Model.Fields)
@Html.EditorFor(m => m.Fields, "Fields", "")
</div>
<fieldset class="action">
<button class="primaryAction" type="submit">@T("Save")</button>
</fieldset>
}
@using(Script.Foot()){
<script type="text/javascript">
//<![CDATA[
(function ($) {
$(".manage-field h3,.manage-part h3").expandoControl(function (controller) { return controller.nextAll(".details"); }, { collapse: true, remember: false });
$(".manage-field h4").expandoControl(function (controller) { return controller.nextAll(".settings"); }, { collapse: true, remember: false });
})(jQuery);
//]]>
</script>
}

View File

@@ -1,7 +1,7 @@
@model Orchard.ContentTypes.ViewModels.EditPartFieldViewModel
<fieldset class="manage-field">
<h4>@Model.Name <span>(@Model.FieldDefinition.Name)</span></h4>@if (Model.Templates.Any()) {
<div class="settings">@Html.RenderTemplates(Model.Templates);
<div class="settings">@{Html.RenderTemplates(Model.Templates);}
</div>}
@Html.HiddenFor(m => m.Name)@Html.HiddenFor(m => m.FieldDefinition.Name)@Html.HiddenFor(m => m.Index)
</fieldset>

View File

@@ -9,6 +9,8 @@ namespace Orchard.Email.Drivers {
// Thus the encryption/decryption will be done when accessing the part's property
public class SmtpSettingsPartDriver : ContentPartDriver<SmtpSettingsPart> {
private const string TemplateName = "Parts/SmtpSettings";
public SmtpSettingsPartDriver() {
T = NullLocalizer.Instance;
}
@@ -18,12 +20,14 @@ namespace Orchard.Email.Drivers {
protected override string Prefix { get { return "SmtpSettings"; } }
protected override DriverResult Editor(SmtpSettingsPart part, dynamic shapeHelper) {
return ContentPartTemplate(part, "Parts/Smtp.SiteSettings");
return ContentShape("Parts_SmtpSettings_Editor",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(SmtpSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
updater.TryUpdateModel(part, Prefix, null, null);
return Editor(part, shapeHelper);
return ContentShape("Parts_SmtpSettings_Editor",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: part, Prefix: Prefix));
}
}
}

View File

@@ -82,7 +82,7 @@
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Parts\Smtp.SiteSettings.cshtml" />
<Content Include="Views\EditorTemplates\Parts\SmtpSettings.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
@@ -98,6 +98,9 @@
<Name>Orchard.Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Placement.info" />
</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

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

View File

@@ -18,6 +18,7 @@ namespace Orchard.Roles.Drivers {
private readonly INotifier _notifier;
private readonly IAuthenticationService _authenticationService;
private readonly IAuthorizationService _authorizationService;
private const string TemplateName = "Parts/Roles.UserRoles";
public UserRolesPartDriver(
IRepository<UserRolesPartRecord> userRolesRepository,
@@ -46,20 +47,19 @@ namespace Orchard.Roles.Drivers {
if (!_authorizationService.TryCheckAccess(Permissions.ApplyRoles, _authenticationService.GetAuthenticatedUser(), userRolesPart))
return null;
var roles =
_roleService.GetRoles().Select(
x => new UserRoleEntry {
RoleId = x.Id,
Name = x.Name,
Granted = userRolesPart.Roles.Contains(x.Name)
});
var model = new UserRolesViewModel {
User = userRolesPart.As<IUser>(),
UserRoles = userRolesPart,
Roles = roles.ToList(),
};
return ContentPartTemplate(model, "Parts/Roles.UserRoles");
return ContentShape("Parts_Roles_UserRoles_Edit",
() => {
var roles =_roleService.GetRoles().Select(x => new UserRoleEntry {
RoleId = x.Id,
Name = x.Name,
Granted = userRolesPart.Roles.Contains(x.Name)});
var model = new UserRolesViewModel {
User = userRolesPart.As<IUser>(),
UserRoles = userRolesPart,
Roles = roles.ToList(),
};
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix);
});
}
protected override DriverResult Editor(UserRolesPart userRolesPart, IUpdateModel updater, dynamic shapeHelper) {
@@ -67,29 +67,26 @@ namespace Orchard.Roles.Drivers {
if (!_authorizationService.TryCheckAccess(Permissions.ApplyRoles, _authenticationService.GetAuthenticatedUser(), userRolesPart))
return null;
var model = new UserRolesViewModel {
User = userRolesPart.As<IUser>(),
UserRoles = userRolesPart,
};
var model = BuildEditorViewModel(userRolesPart);
if (updater.TryUpdateModel(model, Prefix, null, null)) {
var currentUserRoleRecords = _userRolesRepository.Fetch(x => x.UserId == model.User.Id);
var currentRoleRecords = currentUserRoleRecords.Select(x => x.Role);
var targetRoleRecords = model.Roles.Where(x => x.Granted).Select(x => _roleService.GetRole(x.RoleId));
foreach (var addingRole in targetRoleRecords.Where(x => !currentRoleRecords.Contains(x))) {
_notifier.Warning(T("Adding role {0} to user {1}", addingRole.Name, userRolesPart.As<IUser>().UserName));
_userRolesRepository.Create(new UserRolesPartRecord { UserId = model.User.Id, Role = addingRole });
}
foreach (var removingRole in currentUserRoleRecords.Where(x => !targetRoleRecords.Contains(x.Role))) {
_notifier.Warning(T("Removing role {0} from user {1}", removingRole.Role.Name, userRolesPart.As<IUser>().UserName));
_userRolesRepository.Delete(removingRole);
}
}
return ContentPartTemplate(model, "Parts/Roles.UserRoles");
return ContentShape("Parts_Roles_UserRoles_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}
private static UserRolesViewModel BuildEditorViewModel(UserRolesPart userRolesPart) {
return new UserRolesViewModel { User = userRolesPart.As<IUser>(), UserRoles = userRolesPart };
}
}
}

View File

@@ -39,6 +39,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ComponentModel.DataAnnotations">
@@ -108,6 +109,9 @@
<Name>Orchard.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Placement.info" />
</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

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

View File

@@ -24,8 +24,8 @@ namespace Orchard.Search.Drivers {
protected override string Prefix { get { return "SearchSettings"; } }
protected override DriverResult Editor(SearchSettingsPart part, dynamic shapeHelper) {
var model = new SearchSettingsViewModel();
var searchedFields = part.SearchedFields;
SearchSettingsViewModel model = new SearchSettingsViewModel();
String [] searchedFields = part.SearchedFields;
if (_indexManager.HasIndexProvider()) {
model.Entries = new List<SearchSettingsEntry>();
@@ -34,13 +34,14 @@ namespace Orchard.Search.Drivers {
}
}
return ContentPartTemplate(model, "Parts/Search.SiteSettings");
return ContentShape("Parts_Search_SiteSettings",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Search.SiteSettings", Model: model));
}
protected override DriverResult Editor(SearchSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
var model = new SearchSettingsViewModel();
if(updater.TryUpdateModel(model, Prefix, null, null)) {
SearchSettingsViewModel model = new SearchSettingsViewModel();
if (updater.TryUpdateModel(model, Prefix, null, null)) {
part.SearchedFields = model.Entries.Where(e => e.Selected).Select(e => e.Field).ToArray();
}

View File

@@ -106,6 +106,9 @@
<ItemGroup>
<Content Include="Views\Parts\Search.SearchForm.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Placement.info" />
</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

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

View File

@@ -4,18 +4,16 @@
<fieldset>
<legend>@T("Search")</legend>
<div>
@{var entryIndex = 0;}
@if (Model.Entries != null && Model.Entries.Any()) {
foreach(var modelEntry in Model.Entries) {
if(Model.Entries[entryIndex].Selected) {
<input type="checkbox" value="true" checked="checked" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/>
foreach(SearchSettingsEntry modelEntry in Model.Entries) {
if(modelEntry.Selected) {
<input type="checkbox" value="true" checked="checked" name="@Html.FieldNameFor(m => modelEntry.Selected)" id="@Html.FieldIdFor(m => modelEntry.Selected)"/>
}
else {
<input type="checkbox" value="true" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/>
<input type="checkbox" value="true" name="@Html.FieldNameFor(m => modelEntry.Selected)" id="@Html.FieldIdFor(m => modelEntry.Selected)"/>
}
@Html.HiddenFor(m => m.Entries[entryIndex].Field)
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)">@Model.Entries[entryIndex].Field</label>
entryIndex = entryIndex + 1;
@Html.HiddenFor(m => modelEntry.Field)
<label class="forcheckbox" for="@Html.FieldIdFor(m => modelEntry.Selected)">@modelEntry.Field</label>
}
}
else {

View File

@@ -15,6 +15,7 @@ using Orchard.Data.Migration.Interpreters;
using Orchard.Data.Migration.Schema;
using Orchard.Environment;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
@@ -28,6 +29,7 @@ using Orchard.Themes;
using Orchard.Environment.State;
using Orchard.Data.Migration;
using Orchard.Widgets.Models;
using Orchard.Widgets;
namespace Orchard.Setup.Services {
public class SetupService : ISetupService {
@@ -163,113 +165,7 @@ namespace Orchard.Setup.Services {
shellSettings.State = new TenantState("Running");
using (var environment = _orchardHost.CreateStandaloneEnvironment(shellSettings)) {
try {
// create superuser
var membershipService = environment.Resolve<IMembershipService>();
var user =
membershipService.CreateUser(new CreateUserParams(context.AdminUsername, context.AdminPassword,
String.Empty, String.Empty, String.Empty,
true));
// set site name and settings
var siteService = environment.Resolve<ISiteService>();
var siteSettings = siteService.GetSiteSettings().As<SiteSettingsPart>();
siteSettings.Record.SiteSalt = Guid.NewGuid().ToString("N");
siteSettings.Record.SiteName = context.SiteName;
siteSettings.Record.SuperUser = context.AdminUsername;
siteSettings.Record.PageTitleSeparator = " - ";
siteSettings.Record.SiteCulture = "en-US";
// set site theme
var themeService = environment.Resolve<IThemeService>();
themeService.SetSiteTheme("TheThemeMachine");
// add default culture
var cultureManager = environment.Resolve<ICultureManager>();
cultureManager.AddCulture("en-US");
var contentManager = environment.Resolve<IContentManager>();
// this needs to exit the standalone environment? rework this process entirely?
// simulate installation-time module activation events
//var hackInstallationGenerator = environment.Resolve<IHackInstallationGenerator>();
//hackInstallationGenerator.GenerateInstallEvents();
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
//todo: (heskew) pull these definitions (and initial content creation) out into more appropriate modules
contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
.WithPart("CommentsPart")
.WithPart("TagsPart")
.WithPart("LocalizationPart")
.Indexed()
);
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
.WithPart("CommonPart")
.WithPart("PublishLaterPart")
.WithPart("RoutePart")
.WithPart("BodyPart")
.WithPart("TagsPart")
.WithPart("LocalizationPart")
.Creatable()
.Indexed()
);
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
// add a layer for the homepage
var homepageLayer = contentManager.Create("Layer");
homepageLayer.As<LayerPart>().Name = "TheHomepage";
homepageLayer.As<LayerPart>().LayerRule = "url \"~/\"";
contentManager.Publish(homepageLayer);
// and three more for the tripel...really need this elsewhere...
var tripelFirst = contentManager.Create("HtmlWidget");
tripelFirst.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelFirst.As<WidgetPart>().Title = T("First Leader Aside").Text;
tripelFirst.As<WidgetPart>().Zone = "TripelFirst";
tripelFirst.As<WidgetPart>().Position = "5";
tripelFirst.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
tripelFirst.As<CommonPart>().Owner = user;
contentManager.Publish(tripelFirst);
var tripelSecond = contentManager.Create("HtmlWidget");
tripelSecond.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelSecond.As<WidgetPart>().Title = T("Second Leader Aside").Text;
tripelSecond.As<WidgetPart>().Zone = "TripelSecond";
tripelSecond.As<WidgetPart>().Position = "5";
tripelSecond.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
tripelSecond.As<CommonPart>().Owner = user;
contentManager.Publish(tripelSecond);
var tripelThird = contentManager.Create("HtmlWidget");
tripelThird.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelThird.As<WidgetPart>().Title = T("Third Leader Aside").Text;
tripelThird.As<WidgetPart>().Zone = "TripelThird";
tripelThird.As<WidgetPart>().Position = "5";
tripelThird.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
tripelThird.As<CommonPart>().Owner = user;
contentManager.Publish(tripelThird);
// create a welcome page that's promoted to the home page
var page = contentManager.Create("Page");
page.As<RoutePart>().Title = T("Welcome to Orchard!").Text;
page.As<BodyPart>().Text = "<p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"/Admin/Contents/Edit/7\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
page.As<CommonPart>().Owner = user;
contentManager.Publish(page);
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
// add a menu item for the shiny new home page
var menuItem = contentManager.Create("MenuItem");
menuItem.As<MenuPart>().MenuPosition = "1";
menuItem.As<MenuPart>().MenuText = T("Home").ToString();
menuItem.As<MenuPart>().OnMainMenu = true;
menuItem.As<MenuItemPart>().Url = "";
//Temporary fix for running setup on command line
if (HttpContext.Current != null) {
var authenticationService = environment.Resolve<IAuthenticationService>();
authenticationService.SignIn(user, true);
}
CreateTenantData(context, environment);
}
catch {
environment.Resolve<ITransactionManager>().Cancel();
@@ -279,5 +175,123 @@ namespace Orchard.Setup.Services {
_shellSettingsManager.SaveSettings(shellSettings);
}
private void CreateTenantData(SetupContext context, IWorkContextScope environment) {
// create superuser
var membershipService = environment.Resolve<IMembershipService>();
var user =
membershipService.CreateUser(new CreateUserParams(context.AdminUsername, context.AdminPassword,
String.Empty, String.Empty, String.Empty,
true));
// set superuser as current user for request (it will be set as the owner of all content items)
var authenticationService = environment.Resolve<IAuthenticationService>();
authenticationService.SetAuthenticatedUserForRequest(user);
// set site name and settings
var siteService = environment.Resolve<ISiteService>();
var siteSettings = siteService.GetSiteSettings().As<SiteSettingsPart>();
siteSettings.Record.SiteSalt = Guid.NewGuid().ToString("N");
siteSettings.Record.SiteName = context.SiteName;
siteSettings.Record.SuperUser = context.AdminUsername;
siteSettings.Record.PageTitleSeparator = " - ";
siteSettings.Record.SiteCulture = "en-US";
// set site theme
var themeService = environment.Resolve<IThemeService>();
themeService.SetSiteTheme("TheThemeMachine");
// add default culture
var cultureManager = environment.Resolve<ICultureManager>();
cultureManager.AddCulture("en-US");
var contentManager = environment.Resolve<IContentManager>();
// this needs to exit the standalone environment? rework this process entirely?
// simulate installation-time module activation events
//var hackInstallationGenerator = environment.Resolve<IHackInstallationGenerator>();
//hackInstallationGenerator.GenerateInstallEvents();
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
//todo: (heskew) pull these definitions (and initial content creation) out into more appropriate modules
contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
.WithPart("CommentsPart")
.WithPart("TagsPart")
.WithPart("LocalizationPart")
.Indexed()
);
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
.WithPart("CommonPart")
.WithPart("PublishLaterPart")
.WithPart("RoutePart")
.WithPart("BodyPart")
.WithPart("TagsPart")
.WithPart("LocalizationPart")
.Creatable()
.Indexed()
);
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
// If "Orchard.Widgets" is enabled, setup default layers and widgets
var extensionManager = environment.Resolve<IExtensionManager>();
var shellDescriptor = environment.Resolve<ShellDescriptor>();
if (extensionManager.EnabledFeatures(shellDescriptor).Where(d => d.Name == "Orchard.Widgets").Any()) {
// Create default layers
var layerInitializer = environment.Resolve<IDefaultLayersInitializer>();
layerInitializer.CreateDefaultLayers();
// add a layer for the homepage
var homepageLayer = contentManager.Create("Layer");
homepageLayer.As<LayerPart>().Name = "TheHomepage";
homepageLayer.As<LayerPart>().LayerRule = "url \"~/\"";
contentManager.Publish(homepageLayer);
// and three more for the tripel...really need this elsewhere...
var tripelFirst = contentManager.Create("HtmlWidget");
tripelFirst.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelFirst.As<WidgetPart>().Title = T("First Leader Aside").Text;
tripelFirst.As<WidgetPart>().Zone = "TripelFirst";
tripelFirst.As<WidgetPart>().Position = "5";
tripelFirst.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
contentManager.Publish(tripelFirst);
var tripelSecond = contentManager.Create("HtmlWidget");
tripelSecond.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelSecond.As<WidgetPart>().Title = T("Second Leader Aside").Text;
tripelSecond.As<WidgetPart>().Zone = "TripelSecond";
tripelSecond.As<WidgetPart>().Position = "5";
tripelSecond.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
contentManager.Publish(tripelSecond);
var tripelThird = contentManager.Create("HtmlWidget");
tripelThird.As<WidgetPart>().LayerPart = homepageLayer.As<LayerPart>();
tripelThird.As<WidgetPart>().Title = T("Third Leader Aside").Text;
tripelThird.As<WidgetPart>().Zone = "TripelThird";
tripelThird.As<WidgetPart>().Position = "5";
tripelThird.As<BodyPart>().Text = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
contentManager.Publish(tripelThird);
}
// create a welcome page that's promoted to the home page
var page = contentManager.Create("Page");
page.As<RoutePart>().Title = T("Welcome to Orchard!").Text;
page.As<BodyPart>().Text = "<p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"/Admin/Contents/Edit/7\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
contentManager.Publish(page);
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
// add a menu item for the shiny new home page
var menuItem = contentManager.Create("MenuItem");
menuItem.As<MenuPart>().MenuPosition = "1";
menuItem.As<MenuPart>().MenuText = T("Home").ToString();
menuItem.As<MenuPart>().OnMainMenu = true;
menuItem.As<MenuItemPart>().Url = "";
//null check: temporary fix for running setup in command line
if (HttpContext.Current != null) {
authenticationService.SignIn(user, true);
}
}
}
}

View File

@@ -36,12 +36,8 @@ namespace Orchard.Tags.Drivers {
if (!_authorizationService.TryCheckAccess(Permissions.ApplyTag, CurrentUser, part))
return null;
var model = new EditTagsViewModel {
Tags = string.Join(", ", part.CurrentTags.Select((t, i) => t.TagName).ToArray())
};
return ContentShape("Parts_Tags_Editor",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: BuildEditorViewModel(part), Prefix: Prefix));
}
protected override DriverResult Editor(TagsPart part, IUpdateModel updater, dynamic shapeHelper) {
@@ -59,5 +55,11 @@ namespace Orchard.Tags.Drivers {
return ContentShape("Parts_Tags_Editor",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}
private static EditTagsViewModel BuildEditorViewModel(TagsPart part) {
return new EditTagsViewModel {
Tags = string.Join(", ", part.CurrentTags.Select((t, i) => t.TagName).ToArray())
};
}
}
}

View File

@@ -113,7 +113,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Placement.info" />
<Content Include="Placement.info">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -5,14 +5,11 @@ using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
using Orchard.Environment.Configuration;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.State;
using Orchard.Events;
using Orchard.Widgets.Models;
namespace Orchard.Widgets {
public interface IDefaultLayersInitializer : IEventHandler {
public interface IDefaultLayersInitializer : IDependency {
void CreateDefaultLayers();
}
@@ -34,16 +31,6 @@ namespace Orchard.Widgets {
}
public class WidgetsDataMigration : DataMigrationImpl {
private readonly IProcessingEngine _processingEngine;
private readonly ShellSettings _shellSettings;
private readonly ShellDescriptor _shellDescriptor;
public WidgetsDataMigration(IProcessingEngine processingEngine, ShellSettings shellSettings, ShellDescriptor shellDescriptor) {
_processingEngine = processingEngine;
_shellSettings = shellSettings;
_shellDescriptor = shellDescriptor;
}
public int Create() {
SchemaBuilder.CreateTable("LayerPartRecord", table => table
.ContentPartRecord()
@@ -73,8 +60,6 @@ namespace Orchard.Widgets {
.WithSetting("Stereotype", "Widget")
);
CreateDefaultLayers();
return 1;
}
@@ -108,13 +93,5 @@ namespace Orchard.Widgets {
);
return 2;
}
private void CreateDefaultLayers() {
_processingEngine.AddTask(
_shellSettings,
_shellDescriptor,
"IDefaultLayersInitializer.CreateDefaultLayers",
new Dictionary<string, object>());
}
}
}

View File

@@ -8,13 +8,13 @@ namespace Orchard.Widgets {
builder.Describe("Widget")
.Configure(descriptor => {
// todo: have "alternates" for chrome
//todo: (heskew) something...this still doesn't feel right
descriptor.Wrappers.Add("Widget_ControlWrapper");
// todo: (heskew) something...this still doesn't feel right
descriptor.Wrappers.Add("Widget_Wrapper");
descriptor.Wrappers.Add("Widget_ControlWrapper");
})
.OnCreated(created => {
var widget = created.Shape;
widget.Main.Add(created.New.PlaceChildContent(Source: widget));
widget.Child.Add(created.New.PlaceChildContent(Source: widget));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;

View File

@@ -1,16 +1,16 @@
@model Orchard.Widgets.Models.LayerPart
<fieldset>
@Html.LabelFor(layer => layer.Name)
@Html.TextBoxFor(layer => layer.Name)
@Html.LabelFor(layer => layer.Name)
@Html.TextBoxFor(layer => layer.Name)
</fieldset>
<fieldset>
@Html.LabelFor(layer => layer.Description)
@Html.TextAreaFor(layer => layer.Description)
@Html.LabelFor(layer => layer.Description)
@Html.TextAreaFor(layer => layer.Description)
</fieldset>
<fieldset>
@Html.LabelFor(layer => layer.LayerRule)
@Html.TextAreaFor(layer => layer.LayerRule)
@Html.LabelFor(layer => layer.LayerRule)
@Html.TextAreaFor(layer => layer.LayerRule)
</fieldset>

View File

@@ -2,7 +2,7 @@
<fieldset>
@Html.LabelFor(widget => widget.Zone)
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
</fieldset>
<fieldset>

View File

@@ -1,2 +1 @@
@Display(Model.Header)
@Display(Model.Content)
@Display(Model.Content)

View File

@@ -3,9 +3,9 @@
@if (AuthorizedFor(Permissions.ManageWidgets)) {
<div class="widget-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Main)
@Display(Model.Child)
</div>
}
else {
@Display(Model.Main)
@Display(Model.Child)
}

View File

@@ -1,3 +1,17 @@
<div class="widget">
@Display.PlaceChildContent(Source: Model)
</div>
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<article class="widget">
<header>
<h1>@title</h1>
@Display(Model.Header)
</header>
@Display(Model.Child)
@if(Model.Footer != null) {
<footer>
@Display(Model.Footer)
</footer>
}
</article>

View File

@@ -298,7 +298,8 @@
return match && match[0].toLowerCase() || typeof(i);
},
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/string/pad [v1.0]
// the @ sign next to "//" is interpreted by IE when using cc<underscore>on! Inserted a space.
// @ http://jsfromhell.com/string/pad [v1.0]
__pad: function(str, l, s, t){
var p = s || ' ';
var o = str;

View File

@@ -125,25 +125,9 @@
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="Refresh.html" />
<None Include="Themes\Classic\Placement.info">
<SubType>Designer</SubType>
</None>
<Content Include="Themes\TheAdmin\Scripts\admin.js" />
<Content Include="Themes\TheAdmin\Styles\ie.css" />
<Content Include="Themes\TheAdmin\Styles\images\menuClosed.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuClosedHover.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuOpen.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuOpenHover.gif" />
<Content Include="Themes\TheThemeMachine\draft.html" />
<Content Include="Themes\TheThemeMachine\Styles\Site.css" />
<Content Include="Themes\TheThemeMachine\Theme.png" />
<Content Include="Themes\TheThemeMachine\Theme.txt" />
<None Include="Themes\Classic\App_Data\Localization\fr-FR\orchard.theme.po" />
<Content Include="Themes\TheThemeMachine\Views\Items\Widget-HtmlWidget.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Themes\TheThemeMachine\Views\User.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
@@ -163,48 +147,12 @@
<Content Include="Config\Diagnostics.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Themes\TheAdmin\Styles\images\icons.png" />
<Content Include="Themes\TheAdmin\Styles\images\tableHeaderBackgroundRed.gif" />
<Content Include="Themes\TheAdmin\Styles\site.css" />
<Content Include="Themes\TheAdmin\Theme.txt" />
<Content Include="Themes\SafeMode\Views\Document.cshtml" />
<Content Include="Themes\TheAdmin\Views\Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Config\Sample.Host.config" />
<None Include="Themes\TheAdmin\Styles\images\icons.psd" />
<Content Include="Themes\Classic\Content\Images\sidebarBackground.gif" />
<Content Include="Themes\Classic\Zones\Sidebar.html" />
<Content Include="Themes\Classic\Styles\blog.css" />
<Content Include="Themes\Classic\Styles\site.css" />
<Content Include="Themes\Classic\Theme.png" />
<Content Include="Themes\Classic\Theme.txt" />
<Content Include="Themes\Classic\Views\Footer.cshtml" />
<Content Include="Themes\Classic\Views\Layout.cshtml" />
<Content Include="Themes\SafeMode\Content\orchard.ico" />
<Content Include="Themes\SafeMode\Styles\ie6.css" />
<Content Include="Themes\SafeMode\Styles\images\backgroundHeader.gif" />
<Content Include="Themes\SafeMode\Styles\images\backgroundVines.gif" />
<Content Include="Themes\SafeMode\Styles\images\orchardLogo.gif" />
<Content Include="Themes\SafeMode\Styles\site.css" />
<Content Include="Themes\SafeMode\Theme.png" />
<Content Include="Themes\SafeMode\Theme.txt" />
<Content Include="Themes\SafeMode\Views\Layout.cshtml" />
<Content Include="Themes\TheAdmin\Styles\ie6.css" />
<Content Include="Themes\TheAdmin\Styles\images\backgroundGradient.gif" />
<Content Include="Themes\TheAdmin\Styles\images\backgroundHeader.gif" />
<Content Include="Themes\TheAdmin\Styles\images\orchardLogo.gif" />
<Content Include="Themes\TheAdmin\Theme.png" />
<Content Include="Themes\TheAdmin\Views\User.cshtml" />
<Content Include="Themes\TheAdmin\Views\Header.cshtml" />
<Content Include="Themes\TheThemeMachine\Web.config" />
<Content Include="Themes\TheThemeMachine\Views\Items\Content.Blog.cshtml" />
<Content Include="Themes\TheThemeMachine\Views\Items\Widget-Content.cshtml" />
<None Include="Themes\TheThemeMachine\Views\Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Themes\SafeMode\Content\Images\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -64,7 +64,6 @@
<Content Include="TheThemeMachine\Styles\Site.css" />
<Content Include="TheThemeMachine\Theme.png" />
<Content Include="TheThemeMachine\Theme.txt" />
<Content Include="TheThemeMachine\Views\Items_Widget-HtmlWidget.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@@ -218,8 +217,6 @@
<Content Include="TheAdmin\Theme.png" />
<Content Include="TheAdmin\Views\User.cshtml" />
<Content Include="TheAdmin\Views\Header.cshtml" />
<Content Include="TheThemeMachine\Views\Items\Content.Blog.cshtml" />
<Content Include="TheThemeMachine\Views\Items_Widget-Content.cshtml" />
<None Include="TheThemeMachine\Views\Layout.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@@ -259,13 +259,13 @@ nav ul
***************************************************************/
/* Has Aside */
.has-aside #layout-content
.has-aside-two #layout-content
{
width: 600px;
float: left;
}
.has-aside .aside-second
.has-aside-two .aside-second
{
width: 360px;
float: right;
@@ -276,6 +276,11 @@ nav ul
float: right;
}
.has-aside-one .aside-first {
width: 360px;
float: left;
}
.has-asides #layout-content
{
width: 600px;
@@ -412,7 +417,6 @@ button:focus, .button:focus {
}
ul.comments, form.comment {
margin:1.2em 0 1.2em 1.8em;
list-style: none;
}
@@ -440,16 +444,12 @@ article.comment p.text {
display:inline;
}
.aside.third {
/*.aside.third {
border-top:1px solid #dbdbdb;
clear:both;
}
}*/
#layout-tripel div > div {
float:left;
width:316px;
/*padding:12px 6px 0 6px;*/
}
#footer-quad div.zone {
float:left;
@@ -483,14 +483,86 @@ article.comment p.text {
/*border:1px solid #ff0000;*/
}
/* If zone 1 is empty and 2, 3, 4 are not */
/* Tripel */
#layout-tripel div {
float:left;
/*padding:12px 6px 0 6px;*/
}
/*1 zone on */
.tripel-1 #tripel-first { width:960px; }
/*2 zone on */
.tripel-2 #tripel-second { width:960px; }
/*3 zone on */
.tripel-3 #tripel-third { width:960px; }
/*2 zones on */
/* If zones 1, 2 are on */
.tripel-12 #tripel-first, .tripel-12 #tripel-second { width:480px; }
/* If zones 2, 3 are on */
.tripel-23 #tripel-second, .tripel-23 #tripel-third { width:480px; }
/* If zones 1, 3 are on */
.tripel-13 #tripel-first, .tripel-13 #tripel-third { width:480px; }
/*3 zones on */
/* If zones 1, 2, 3 are on */
.tripel-123 #tripel-first, .tripel-123 #tripel-second, .tripel-123 #tripel-third { width:320px; }
/* Quad */
/*1 zone on */
/* If zone 1 is on */
.split-1 #footer-quad-first div.zone { width:960px; }
/* If zone 2 is on */
.split-2 #footer-quad-second div.zone { width:960px; }
/* If zone 3 is on */
.split-3 #footer-quad-third div.zone { width:960px; }
/* If zone 4 is on */
.split-4 #footer-quad-fourth div.zone { width:960px; }
/*2 zones on */
/* If zones 1, 2 are on */
.split-12 #footer-quad-first div.zone, .split-12 #footer-quad-second div.zone { width:480px; }
/* If zones 1, 3 are on */
.split-13 #footer-quad-first div.zone, .split-13 #footer-quad-third div.zone { width:480px; }
/* If zones 1, 4 are on */
.split-14 #footer-quad-first div.zone, .split-14 #footer-quad-fourth div.zone { width:480px; }
/* If zones 2, 3 are on */
.split-23 #footer-quad-second div.zone, .split-23 #footer-quad-third div.zone { width:480px; }
/* If zones 2, 4 are on */
.split-24 #footer-quad-second div.zone, .split-24 #footer-quad-fourth div.zone { width:480px; }
/* If zones 3, 4 are on */
.split-34 #footer-quad-third div.zone, .split-34 #footer-quad-fourth div.zone { width:480px; }
/*3 zones on */
/* If zones 2, 3, 4 are on */
.split-234 #footer-quad-second div.zone { width:480px; }
/* If zone 2 is empty and 1, 3, 4 are not */
/* If zones 1, 3, 4 are on */
.split-134 #footer-quad-first div.zone { width:480px; }
/* If zone 3 is empty and 1, 2, 4 are not */
/* If zones 1, 2, 4 are on */
.split-124 #footer-quad-fourth div.zone { width:480px; }
/* If zone 4 is empty and 1, 2, 3 are not */
/* If zones 1, 2, 3 are on */
.split-123 #footer-quad-third div.zone { width:480px; }

View File

@@ -4,4 +4,4 @@ Description: It's a *really* good theme, yo.
Version: 0.1
Tags: Awesome
Website: http://orchardproject.net
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond, AsideThird
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond

View File

@@ -1,10 +0,0 @@
@using Orchard.Blogs.Extensions;
@using Orchard.UI.Resources;
@{
RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest((string)Model.Slug) });
RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd((string)Model.Slug) });
}
<h1>@Html.TitleForPage((string)Model.Title)</h1>
@Display(Model.manage)
@Display(Model.metadata)
@Display(Model.Primary)

View File

@@ -1,17 +0,0 @@
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<article>
<header>
<h1>@title</h1>
@Display(Model.Header)
</header>
@Display(Model.Content)
@if(Model.Footer != null) {
<footer>
@Display(Model.Footer)
</footer>
}
</article>

View File

@@ -1,11 +0,0 @@
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<div>
<h1>@title</h1>
@Display(Model.Header)
@Display(Model.Content)
@Display(Model.Footer)
</div>

View File

@@ -1,4 +1,12 @@
@{
@functions {
string CalcuClassify(string[] zoneNames, string classNamePrefix)
{
var zoneCounter = 0;
var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
}
}
@{
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
Style.Include("site.css");
@@ -28,22 +36,20 @@
// {WorkContext.Layout.FooterQuadThird.Add("3 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
//Add classes to the wrapper div to toggle quad widget zones on and off
var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-");
if (HasText(tripelClass)) {
Model.Classes.Add(tripelClass);
}
if (Model.FooterQuadFirst == null && Model.FooterQuadSecond != null && Model.FooterQuadThird != null && Model.FooterQuadFourth != null) {
Model.Classes.Add("split-234");
//Add classes to the wrapper div to toggle quad widget zones on and off
var footerQuadClass = CalcuClassify(new [] {"FooterQuadFirst", "FooterQuadSecond", "FooterQuadThird", "FooterQuadFourth"}, "split-");
if (HasText(footerQuadClass)) {
Model.Classes.Add(footerQuadClass);
}
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond == null && Model.FooterQuadThird != null && Model.FooterQuadFourth != null) {
Model.Classes.Add("split-134");
}
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond != null && Model.FooterQuadThird == null && Model.FooterQuadFourth != null) {
Model.Classes.Add("split-124");
}
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond != null && Model.FooterQuadThird != null && Model.FooterQuadFourth == null) {
Model.Classes.Add("split-123");
}
else {
}
<span>debug: </span>
<span>tripelClass:@tripelClass</span><br />
<span>footerQuadClass:@footerQuadClass</span>
Model.Id = "layout-wrapper";
var tag = Tag (Model, "div");

View File

@@ -6,7 +6,7 @@ namespace Orchard.ContentManagement.Handlers {
public class ContentItemTemplates<TContent> : TemplateFilterBase<TContent> where TContent : class, IContent {
private readonly string _templateName;
// todo: (heskew) use _prefix?
private readonly string _prefix;
//private readonly string _prefix;
private readonly string[] _displayTypes;
private Action<UpdateEditorContext, IContent> _updater;

View File

@@ -163,6 +163,4 @@ namespace Orchard.Environment {
}
}
}
}

View File

@@ -42,7 +42,6 @@ namespace Orchard {
ex is StackOverflowException ||
ex is AccessViolationException ||
ex is AppDomainUnloadedException ||
ex is ExecutionEngineException ||
ex is ThreadAbortException ||
ex is SecurityException ||
ex is SEHException;

View File

@@ -36,6 +36,21 @@ namespace Orchard.Mvc.Html {
return id.Replace('[', '_').Replace(']', '_');
}
public static IHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, LocalizedString labelText) {
return LabelFor(html, expression, labelText.ToString());
}
public static IHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string labelText) {
if (String.IsNullOrEmpty(labelText)) {
return MvcHtmlString.Empty;
}
var htmlFieldName = ExpressionHelper.GetExpressionText(expression);
var tag = new TagBuilder("label");
tag.Attributes.Add("for", html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldId(htmlFieldName));
tag.SetInnerText(labelText);
return MvcHtmlString.Create(tag.ToString(TagRenderMode.Normal));
}
public static MvcHtmlString SelectOption<T>(this HtmlHelper html, T currentValue, T optionValue, string text) {
return SelectOption(html, optionValue, object.Equals(optionValue, currentValue), text);
}

View File

@@ -14,6 +14,7 @@ namespace Orchard.Mvc {
ScriptRegister Script { get; }
ResourceRegister Style { get; }
dynamic Display { get; }
dynamic Layout { get; }
IHtmlString DisplayChildren(object shape);
WorkContext WorkContext { get; }
IDisposable Capture(Action<IHtmlString> callback);

View File

@@ -2,6 +2,7 @@
public interface IAuthenticationService : IDependency {
void SignIn(IUser user, bool createPersistentCookie);
void SignOut();
void SetAuthenticatedUserForRequest(IUser user);
IUser GetAuthenticatedUser();
}
}

View File

@@ -11,6 +11,7 @@ namespace Orchard.Security.Providers {
private readonly IClock _clock;
private readonly IContentManager _contentManager;
private readonly IHttpContextAccessor _httpContextAccessor;
private IUser _signedInUser;
public FormsAuthenticationService(IClock clock, IContentManager contentManager, IHttpContextAccessor httpContextAccessor) {
_clock = clock;
@@ -52,13 +53,22 @@ namespace Orchard.Security.Providers {
var httpContext = _httpContextAccessor.Current();
httpContext.Response.Cookies.Add(cookie);
_signedInUser = user;
}
public void SignOut() {
_signedInUser = null;
FormsAuthentication.SignOut();
}
public void SetAuthenticatedUserForRequest(IUser user) {
_signedInUser = user;
}
public IUser GetAuthenticatedUser() {
if (_signedInUser != null)
return _signedInUser;
var httpContext = _httpContextAccessor.Current();
if (!httpContext.Request.IsAuthenticated || !(httpContext.User.Identity is FormsIdentity)) {
return null;