Merge branch '1.8.x' into 1.x

Conflicts:
	src/Orchard.Web/Web.config
This commit is contained in:
Sebastien Ros
2014-07-31 17:44:16 -07:00
31 changed files with 168 additions and 95 deletions

View File

@@ -1,9 +1,10 @@
if "%WindowsSdkDir%" neq "" goto build
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11
if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8Dev12
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12
if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11
echo "Unable to detect suitable environment. Build may not succeed."
goto build

View File

@@ -7,6 +7,8 @@
<autofac defaultAssembly="Orchard.Framework">
<components>
<component instance-scope="single-instance" type="Orchard.Localization.Services.CultureDateTimeFormatProvider, Orchard.Framework" service="Orchard.Localization.Services.IDateTimeFormatProvider"></component>
<!-- Configure Orchard to store shell settings in Windows Azure Blob Storage. -->
<component instance-scope="single-instance" type="Orchard.FileSystems.Media.ConfigurationMimeTypeProvider, Orchard.Framework" service="Orchard.FileSystems.Media.IMimeTypeProvider"></component>

View File

@@ -81,5 +81,18 @@
</Properties>
</Component>
</Components>
<Component Type="Orchard.Data.SessionConfigurationCache">
<Properties>
<!-- Set Value="true" to disable session configuration cache (mappings.bin). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Alias.Implementation.Updater">
<Properties>
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
</Components>
</HostComponents>

View File

@@ -26,7 +26,8 @@ namespace Orchard.Core.Containers.Handlers {
_containerService = containerService;
Filters.Add(StorageFilter.For(repository));
OnInitializing<ContainerPart>((context, part) => {
part.Record.ItemsShown = true;
part.Record.ItemsShown = part.Settings.GetModel<ContainerTypePartSettings>().ItemsShownDefault
?? part.PartDefinition.Settings.GetModel<ContainerPartSettings>().ItemsShownDefault;
part.Record.PageSize = part.Settings.GetModel<ContainerTypePartSettings>().PageSizeDefault
?? part.PartDefinition.Settings.GetModel<ContainerPartSettings>().PageSizeDefault;
part.Record.Paginated = part.Settings.GetModel<ContainerTypePartSettings>().PaginatedDefault

View File

@@ -11,12 +11,23 @@ using Orchard.Core.Containers.ViewModels;
namespace Orchard.Core.Containers.Settings {
public class ContainerPartSettings {
public const bool ItemsShownDefaultDefault = true;
public const int PageSizeDefaultDefault = 10;
public const bool PaginatedDefaultDefault = true;
private bool? _itemsShownDefault;
private int? _pageSizeDefault;
private bool? _paginiatedDefault;
public bool ItemsShownDefault {
get {
return _itemsShownDefault != null
? (bool)_itemsShownDefault
: ItemsShownDefaultDefault;
}
set { _itemsShownDefault = value; }
}
public int PageSizeDefault {
get {
return _pageSizeDefault != null
@@ -37,6 +48,7 @@ namespace Orchard.Core.Containers.Settings {
}
public class ContainerTypePartSettings {
public bool? ItemsShownDefault { get; set; }
public int? PageSizeDefault { get; set; }
public bool? PaginatedDefault { get; set; }
public string RestrictedItemContentTypes { get; set; }
@@ -62,6 +74,9 @@ namespace Orchard.Core.Containers.Settings {
var model = definition.Settings.GetModel<ContainerTypePartSettings>();
var partModel = definition.PartDefinition.Settings.GetModel<ContainerPartSettings>();
if (model.ItemsShownDefault == null)
model.ItemsShownDefault = partModel.ItemsShownDefault;
if (model.PageSizeDefault == null)
model.PageSizeDefault = partModel.PageSizeDefault;
@@ -70,6 +85,7 @@ namespace Orchard.Core.Containers.Settings {
model.PaginatedDefault = partModel.PaginatedDefault;
var viewModel = new ContainerTypePartSettingsViewModel {
ItemsShownDefault = model.ItemsShownDefault,
PageSizeDefault = model.PageSizeDefault,
PaginatedDefault = model.PaginatedDefault,
RestrictedItemContentTypes = _contentDefinitionManager.ParseContentTypeDefinitions(model.RestrictedItemContentTypes).Select(x => x.Name).ToList(),
@@ -99,6 +115,7 @@ namespace Orchard.Core.Containers.Settings {
AvailableItemContentTypes = _containerService.GetContainableTypes().ToList()
};
updateModel.TryUpdateModel(viewModel, "ContainerTypePartSettingsViewModel", null, new[] { "AvailableItemContentTypes" });
builder.WithSetting("ContainerTypePartSettings.ItemsShownDefault", viewModel.ItemsShownDefault.ToString());
builder.WithSetting("ContainerTypePartSettings.PageSizeDefault", viewModel.PageSizeDefault.ToString());
builder.WithSetting("ContainerTypePartSettings.PaginatedDefault", viewModel.PaginatedDefault.ToString());
builder.WithSetting("ContainerTypePartSettings.RestrictedItemContentTypes", viewModel.RestrictedItemContentTypes != null ? string.Join(",", viewModel.RestrictedItemContentTypes) : "");
@@ -114,6 +131,7 @@ namespace Orchard.Core.Containers.Settings {
var model = new ContainerPartSettings();
updateModel.TryUpdateModel(model, "ContainerPartSettings", null, null);
builder.WithSetting("ContainerPartSettings.ItemsShownDefault", model.ItemsShownDefault.ToString());
builder.WithSetting("ContainerPartSettings.PageSizeDefault", model.PageSizeDefault.ToString());
builder.WithSetting("ContainerPartSettings.PaginatedDefault", model.PaginatedDefault.ToString());
yield return DefinitionTemplate(model);

View File

@@ -5,6 +5,7 @@ using Orchard.Core.Containers.Services;
namespace Orchard.Core.Containers.ViewModels {
public class ContainerTypePartSettingsViewModel {
public bool? ItemsShownDefault { get; set; }
public int? PageSizeDefault { get; set; }
public bool? PaginatedDefault { get; set; }
public bool RestrictItemContentTypes { get; set; }

View File

@@ -2,6 +2,10 @@
@{
Script.Require("ShapesBase");
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.ItemsShownDefault)">@T("Default Items Shown")</label>
@Html.EditorFor(m => m.ItemsShownDefault)
</fieldset>
<fieldset>
<label for="@Html.FieldIdFor(m => m.PageSizeDefault)">@T("Default Page Size")</label>
@Html.EditorFor(m => m.PageSizeDefault)

View File

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

View File

@@ -23,9 +23,11 @@
@if (Model.Settings.AllowCustomPattern) {
<span>@Url.MakeAbsolute("/")@urlPrefix</span>
<span>@Html.TextBoxFor(m => m.CurrentUrl, new {@class = "text"})</span>
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}", defaultPattern.Name, defaultPattern.Description)</span>
}
else {
<span>@Url.MakeAbsolute("/")@urlPrefix</span>
<span class="hint">@T("Save the current item and the url will be generated using the pattern {0} e.g., {1}", defaultPattern.Name, defaultPattern.Description)</span>
}
@if (!String.IsNullOrEmpty(Model.CurrentUrl)) {
<span>
@@ -36,8 +38,6 @@
</span>
}
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}", defaultPattern.Name, defaultPattern.Description)</span>
</fieldset>
if (AuthorizedFor(Permissions.SetHomePage)) {
<fieldset>

View File

@@ -57,9 +57,9 @@ namespace Orchard.Azure.Services.Caching {
public override int GetHashCode() {
int hash = 37;
hash = hash * 23 + HostIdentifier.GetHashCode();
hash = hash * 23 + CacheName.GetHashCode();
hash = hash * 23 + AuthorizationToken.GetHashCode();
hash = hash * 23 + (HostIdentifier != null ? HostIdentifier.GetHashCode() : 0);
hash = hash * 23 + (CacheName != null ? CacheName.GetHashCode() : 0);
hash = hash * 23 + (AuthorizationToken != null ? AuthorizationToken.GetHashCode() : 0);
hash = hash * 23 + CompressionIsEnabled.GetHashCode();
return hash;
}

View File

@@ -69,7 +69,7 @@ namespace Orchard.Azure.Services.FileSystems {
// The container is named with DNS naming restrictions (i.e. all lower case)
_container = _blobClient.GetContainerReference(ContainerName);
_container.CreateIfNotExists(_isPrivate ? BlobContainerPublicAccessType.Off : BlobContainerPublicAccessType.Container);
_container.CreateIfNotExists(_isPrivate ? BlobContainerPublicAccessType.Off : BlobContainerPublicAccessType.Blob);
}
private static string ConvertToRelativeUriPath(string path) {

View File

@@ -224,6 +224,12 @@ namespace Orchard.Forms.Shapes {
return DisplayShapeAsInput(Display, Shape, "text");
}
[Shape]
public IHtmlString Password(dynamic Display, dynamic Shape) {
Shape.Classes.Add("password");
return DisplayShapeAsInput(Display, Shape, "password");
}
[Shape]
public void Textarea(
TextWriter Output,

View File

@@ -4,6 +4,7 @@ using Orchard.ContentManagement;
using Orchard.Core.Containers.Models;
using Orchard.Core.Containers.Services;
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Navigation;
using Orchard.Utility.Extensions;
@@ -11,10 +12,19 @@ namespace Orchard.Lists {
public class AdminMenu : INavigationProvider {
private readonly IContainerService _containerService;
private readonly IContentManager _contentManager;
public AdminMenu(IContainerService containerService, IContentManager contentManager) {
private readonly IAuthorizationService _authorizationService;
private readonly IWorkContextAccessor _workContextAccessor;
public AdminMenu(
IContainerService containerService,
IContentManager contentManager,
IAuthorizationService authorizationService,
IWorkContextAccessor workContextAccessor
) {
_containerService = containerService;
_contentManager = contentManager;
_authorizationService = authorizationService;
_workContextAccessor = workContextAccessor;
}
public Localizer T { get; set; }
@@ -29,12 +39,17 @@ namespace Orchard.Lists {
private void CreateListManagementMenuItem(NavigationBuilder builder) {
builder.Add(T("Lists"), "11", item => item
.Action("Index", "Admin", new {area = "Orchard.Lists"})
.Action("Index", "Admin", new {area = "Orchard.Lists"}).Permission(Permissions.ManageLists)
);
}
private void CreateListMenuItems(NavigationBuilder builder) {
var containers = _containerService.GetContainersQuery(VersionOptions.Latest).Where<ContainerPartRecord>(x => x.ShowOnAdminMenu).List().ToList();
var containers = _containerService
.GetContainersQuery(VersionOptions.Latest)
.Where<ContainerPartRecord>(x => x.ShowOnAdminMenu)
.List()
.Where(x => _authorizationService.TryCheckAccess(Orchard.Core.Contents.Permissions.EditContent, _workContextAccessor.GetContext().CurrentUser, x))
.ToList();
foreach (var container in containers) {
var closureContainer = container;

View File

@@ -129,7 +129,7 @@ namespace Orchard.Lists.Controllers {
break;
case ContentsBulkAction.PublishNow:
foreach (var item in checkedContentItems) {
if (!_services.Authorizer.Authorize(Permissions.PublishContent, item, T("Couldn't publish selected lists."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.PublishContent, item, T("Couldn't publish selected lists."))) {
_transactionManager.Cancel();
return new HttpUnauthorizedResult();
}
@@ -139,7 +139,7 @@ namespace Orchard.Lists.Controllers {
break;
case ContentsBulkAction.Unpublish:
foreach (var item in checkedContentItems) {
if (!_services.Authorizer.Authorize(Permissions.PublishContent, item, T("Couldn't unpublish selected lists."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.PublishContent, item, T("Couldn't unpublish selected lists."))) {
_transactionManager.Cancel();
return new HttpUnauthorizedResult();
}
@@ -149,7 +149,7 @@ namespace Orchard.Lists.Controllers {
break;
case ContentsBulkAction.Remove:
foreach (var item in checkedContentItems) {
if (!_services.Authorizer.Authorize(Permissions.DeleteContent, item, T("Couldn't remove selected lists."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.DeleteContent, item, T("Couldn't remove selected lists."))) {
_transactionManager.Cancel();
return new HttpUnauthorizedResult();
}
@@ -240,10 +240,7 @@ namespace Orchard.Lists.Controllers {
.ContainerDisplayName(model.ContainerDisplayName)
.ContainerContentType(container.ContentType)
.ItemContentTypes(container.As<ContainerPart>().ItemContentTypes.ToList())
.OtherLists(_contentManager.Query<ContainerPart>(VersionOptions.Latest).List()
.Select(part => part.ContentItem)
.Where(item => item != container)
.OrderBy(item => item.As<CommonPart>().VersionPublishedUtc));
;
if (containerPart.Is<ContainablePart>()) {
viewModel.ListNavigation(_services.New.ListNavigation(ContainablePart: containerPart.As<ContainablePart>()));
@@ -435,7 +432,7 @@ namespace Orchard.Lists.Controllers {
var selectedItems = _contentManager.GetMany<ContainablePart>(selectedIds, VersionOptions.Latest, QueryHints.Empty);
foreach (var item in selectedItems) {
if (!_services.Authorizer.Authorize(Permissions.EditContent, item, T("Couldn't move selected content."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.EditContent, item, T("Couldn't move selected content."))) {
return false;
}
@@ -455,7 +452,7 @@ namespace Orchard.Lists.Controllers {
private bool BulkRemoveFromList(IEnumerable<int> itemIds) {
var selectedItems = _contentManager.GetMany<ContainablePart>(itemIds, VersionOptions.Latest, QueryHints.Empty);
foreach (var item in selectedItems) {
if (!_services.Authorizer.Authorize(Permissions.EditContent, item, T("Couldn't remove selected content from the list."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.EditContent, item, T("Couldn't remove selected content from the list."))) {
_services.TransactionManager.Cancel();
return false;
}
@@ -468,7 +465,7 @@ namespace Orchard.Lists.Controllers {
private bool BulkRemove(IEnumerable<int> itemIds) {
foreach (var item in itemIds.Select(itemId => _contentManager.GetLatest(itemId))) {
if (!_services.Authorizer.Authorize(Permissions.DeleteContent, item, T("Couldn't remove selected content."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.DeleteContent, item, T("Couldn't remove selected content."))) {
_services.TransactionManager.Cancel();
return false;
}
@@ -481,7 +478,7 @@ namespace Orchard.Lists.Controllers {
private bool BulkUnpublish(IEnumerable<int> itemIds) {
foreach (var item in itemIds.Select(itemId => _contentManager.GetLatest(itemId))) {
if (!_services.Authorizer.Authorize(Permissions.PublishContent, item, T("Couldn't unpublish selected content."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.PublishContent, item, T("Couldn't unpublish selected content."))) {
_services.TransactionManager.Cancel();
return false;
}
@@ -494,7 +491,7 @@ namespace Orchard.Lists.Controllers {
private bool BulkPublishNow(IEnumerable<int> itemIds) {
foreach (var item in itemIds.Select(itemId => _contentManager.GetLatest(itemId))) {
if (!_services.Authorizer.Authorize(Permissions.PublishContent, item, T("Couldn't publish selected content."))) {
if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.PublishContent, item, T("Couldn't publish selected content."))) {
_services.TransactionManager.Cancel();
return false;
}

View File

@@ -66,6 +66,7 @@
<Compile Include="AdminMenu.cs" />
<Compile Include="Drivers\ContainerPartDriver.cs" />
<Compile Include="Drivers\ContainablePartDriver.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Projections\ListSortCriteria.cs" />
<Compile Include="Services\IFormProvider.cs" />
<Compile Include="Forms\ListFilterForm.cs" />

View File

@@ -0,0 +1,42 @@
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Orchard.Lists {
public class Permissions : IPermissionProvider {
public static readonly Permission ManageLists = new Permission { Description = "Manage lists", Name = "ManageLists" };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] {
ManageLists,
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {ManageLists}
},
new PermissionStereotype {
Name = "Editor",
Permissions = new[] {ManageLists}
},
new PermissionStereotype {
Name = "Moderator",
},
new PermissionStereotype {
Name = "Author",
},
new PermissionStereotype {
Name = "Contributor",
},
};
}
}
}

View File

@@ -71,16 +71,6 @@
};
var bindActions = function () {
$("#layout-content").on("change", "#publishActions", function () {
var value = $(this).val();
var target = $("#TargetContainerId");
if (value === "MoveToList") {
target.css("display", "inline");
} else {
target.css("display", "none");
}
});
$("#layout-content").on("change", "#listOperations", function () {
var value = $(this).val();
var sortBy = $("#SortBy");

View File

@@ -1,2 +1,4 @@
(function(n){var t=function(t,i,r,u,f,e){var o=n("#ajaxError");o.hide(),NProgress.start(),NProgress.set(.4),n.ajax({type:e,url:t,data:i,cache:!1}).done(function(n){NProgress.set(.9),u&&u(n)}).fail(function(){r&&r(),o.show()}).always(function(){f&&f(),NProgress.done()})},i=function(i,r,u,f,e){r=n.extend(r,{__RequestVerificationToken:n("[name='__RequestVerificationToken']").val()}),t(i,r,u,f,e,"POST")},u=function(n,i,r,u,f){t(n,i,r,u,f,"GET")},f=function(t){var r=n("#listManagement").data("insert-url"),u={itemId:t};i(r,u,null,function(t){n("#main").replaceWith(n("#main",n.parseHTML(t))),n(window).trigger("reinitialize")})},e=function(){var t=n("#listManagement").data("refresh-url");u(t,null,null,function(t){n("#main").replaceWith(n("#main",n.parseHTML(t))),n(window).trigger("reinitialize")})},o=function(t,r,u,f){if(u!=r){var e=n("#listManagement").data("update-url"),o={itemId:t,oldIndex:r,newIndex:u};i(e,o,f)}},s=function(){n("#layout-content").on("change","#publishActions",function(){var i=n(this).val(),t=n("#TargetContainerId");i==="MoveToList"?t.css("display","inline"):t.css("display","none")});n("#layout-content").on("change","#listOperations",function(){var r=n(this).val(),t=n("#SortBy"),i=n("#SortByDirection");r==="Sort"?(t.css("display","inline"),i.css("display","inline")):(t.css("display","none"),i.css("display","none"))})},h=function(){n("#layout-content").on("click","#chooseItems",function(t){t.preventDefault(),n("form:first").trigger("orchard-admin-contentpicker-open",{types:n("#listManagement").data("itemtypes"),callback:function(n){var t=parseInt(n.id);f(t)},baseUrl:n("#listManagement").data("baseurl")})})},c=function(){n("#layout-content").on("click",".create-content",function(t){var i=n(this).attr("href");n.colorbox({href:i,iframe:!0,reposition:!0,width:"100%",height:"100%",initialWidth:"100%",initialHeight:"100%",onLoad:function(){n("html, body").css("overflow","hidden"),n("#cboxClose").remove()},onClosed:function(){n("html, body").css("overflow","auto"),e()}}),t.preventDefault()})},r=function(){var r=n("#listManagement").data("dragdrop"),t,i;r&&(t=-1,i=function(){n("table.content-list tbody").sortable("cancel")},n("table.content-list tbody").sortable({handle:"td:first",start:function(n,i){t=i.item.index()},stop:function(n,r){var u=r.item.index(),f=r.item.data("content-id");o(f,t,u,i)}}).disableSelection())},l=function(){n("#layout-content").on("change","table.content-list thead .toggle-all",function(){var t=n(this).parents("table:first").find("tbody");t.find("input[type='checkbox']").prop("checked",n(this).is(":checked"))})},a=function(){n("#layout-content").on("click",".switch-button",function(){n(".switch-button").removeClass("active"),n(this).addClass("active"),n("#listViewName").prop("checked",!0).val(n(this).data("listviewname")),n(this).parents("form:first").submit()})};NProgress.configure({showSpinner:!1}),s(),r(),l(),h(),c(),a();n(window).on("reinitialize",function(){r()})})(jQuery);
//@ sourceMappingURL=orchard-lists-admin.min.js.map
(function(n){var t=function(t,i,r,u,f,e){var o=n("#ajaxError");o.hide();NProgress.start();NProgress.set(.4);n.ajax({type:e,url:t,data:i,cache:!1}).done(function(n){NProgress.set(.9);u&&u(n)}).fail(function(){r&&r();o.show()}).always(function(){f&&f();NProgress.done()})},i=function(i,r,u,f,e){r=n.extend(r,{__RequestVerificationToken:n("[name='__RequestVerificationToken']").val()});t(i,r,u,f,e,"POST")},u=function(n,i,r,u,f){t(n,i,r,u,f,"GET")},f=function(t){var r=n("#listManagement").data("insert-url"),u={itemId:t};i(r,u,null,function(t){n("#main").replaceWith(n("#main",n.parseHTML(t)));n(window).trigger("reinitialize")})},e=function(){var t=n("#listManagement").data("refresh-url");u(t,null,null,function(t){n("#main").replaceWith(n("#main",n.parseHTML(t)));n(window).trigger("reinitialize")})},o=function(t,r,u,f){if(u!=r){var e=n("#listManagement").data("update-url"),o={itemId:t,oldIndex:r,newIndex:u};i(e,o,f)}},s=function(){n("#layout-content").on("change","#listOperations",function(){var r=n(this).val(),t=n("#SortBy"),i=n("#SortByDirection");r==="Sort"?(t.css("display","inline"),i.css("display","inline")):(t.css("display","none"),i.css("display","none"))})},h=function(){n("#layout-content").on("click","#chooseItems",function(t){t.preventDefault();n("form:first").trigger("orchard-admin-contentpicker-open",{types:n("#listManagement").data("itemtypes"),callback:function(n){var t=parseInt(n.id);f(t)},baseUrl:n("#listManagement").data("baseurl")})})},c=function(){n("#layout-content").on("click",".create-content",function(t){var i=n(this).attr("href");n.colorbox({href:i,iframe:!0,reposition:!0,width:"100%",height:"100%",initialWidth:"100%",initialHeight:"100%",onLoad:function(){n("html, body").css("overflow","hidden");n("#cboxClose").remove()},onClosed:function(){n("html, body").css("overflow","auto");e()}});t.preventDefault()})},r=function(){var r=n("#listManagement").data("dragdrop"),t,i;r&&(t=-1,i=function(){n("table.content-list tbody").sortable("cancel")},n("table.content-list tbody").sortable({handle:"td:first",start:function(n,i){t=i.item.index()},stop:function(n,r){var u=r.item.index(),f=r.item.data("content-id");o(f,t,u,i)}}).disableSelection())},l=function(){n("#layout-content").on("change","table.content-list thead .toggle-all",function(){var t=n(this).parents("table:first").find("tbody");t.find("input[type='checkbox']").prop("checked",n(this).is(":checked"))})},a=function(){n("#layout-content").on("click",".switch-button",function(){n(".switch-button").removeClass("active");n(this).addClass("active");n("#listViewName").prop("checked",!0).val(n(this).data("listviewname"));n(this).parents("form:first").submit()})};NProgress.configure({showSpinner:!1});s();r();l();h();c();a();n(window).on("reinitialize",function(){r()})})(jQuery);
/*
//# sourceMappingURL=orchard-lists-admin.min.js.map
*/

File diff suppressed because one or more lines are too long

View File

@@ -32,7 +32,7 @@
ContainerId: containerId,
ItemContentTypes: itemContentTypes)
@using (Html.BeginFormAntiForgeryPost()) {
@Display.Parts_Container_BulkActions(Options: Model.Options, OtherLists: Model.OtherLists, Container: container)
@Display.Parts_Container_BulkActions(Options: Model.Options, Container: container)
@Display.ListViewButtons(Providers: Model.ListViewProviders, ActiveProvider: Model.ListViewProvider)
@Display(Model.ListView)
}

View File

@@ -6,12 +6,6 @@
@{
var container = (ContainerPart) Model.Container;
var options = (ContentOptions)Model.Options;
var lists = ((IEnumerable<ContentItem>)Model.OtherLists).Select(
contentItem => new SelectListItem {
Text = contentItem.ContentType + ": " + contentItem.ContentManager.GetItemMetadata(contentItem).DisplayText,
Value = contentItem.Id.ToString(System.Globalization.CultureInfo.InvariantCulture)
}).ToList();
lists.Insert(0, new SelectListItem { Text = T("Move to...").ToString(), Value = "" });
}
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
@@ -21,9 +15,7 @@
@Html.SelectOption(options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
@Html.SelectOption(options.BulkAction, ContentsBulkAction.Remove, T("Delete").ToString())
@Html.SelectOption(options.BulkAction, ContentsBulkAction.RemoveFromList, T("Remove from List").ToString())
@Html.SelectOption(options.BulkAction, ContentsBulkAction.MoveToList, T("Move to List...").ToString())
</select>
@Html.DropDownList("TargetContainerId", lists, new { id = "TargetContainerId" })
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
</fieldset>
@if (container.EnablePositioning) {

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.IO;
using System.Web.Mvc;
@@ -40,7 +41,7 @@ namespace Orchard.MediaLibrary.Controllers {
var filename = Path.GetFileName(file.FileName);
// if the file has been pasted, provide a default name
if (filename == "blob") {
if (file.ContentType.Equals("image/png", StringComparison.InvariantCultureIgnoreCase) && !filename.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase)) {
filename = "clipboard.png";
}

View File

@@ -161,7 +161,7 @@ namespace Orchard.Packaging.Controllers {
}
}
catch (OrchardException e) {
Services.Notifier.Error(T("Package uploading and installation failed: ", e.Message));
Services.Notifier.Error(T("Package uploading and installation failed: {0}", e.Message));
return View("InstallPackageFailed");
}
catch (Exception) {

View File

@@ -94,10 +94,6 @@
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Tools\Orchard\Orchard.csproj">
<Project>{33B1BC8D-E292-4972-A363-22056B207156}</Project>
<Name>Orchard</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Packaging\Orchard.Packaging.csproj">
<Project>{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059}</Project>
<Name>Orchard.Packaging</Name>

View File

@@ -2,26 +2,6 @@
/* Helper functions
**********************************************************************/
var parseTerms = function (text) {
var tuples = text.split(",");
var terms = [];
for (var i = 0; i < tuples.length; i++) {
var tuple = tuples[i].split("\t");
var value = parseInt(tuple[1]);
var levels = parseInt(tuple[2]);
var tag = {
label: tuple[0],
value: value,
levels: !isNaN(levels) ? levels : 0,
disabled: tuple[3] == "True"
};
terms.push(tag);
}
return terms;
};
var addTag = function ($plugin, label) {
$plugin.tagit("add", label);
};
@@ -168,13 +148,13 @@
/* Initialization
**********************************************************************/
$(".terms-editor").each(function () {
var allTerms = parseTerms($(this).data("all-terms"));
var selectedTerms = parseTerms($(this).data("selected-terms"));
var allTerms = $(this).data("all-terms");
var selectedTerms = $(this).data("selected-terms");
var $tagit = $("> ul", this).tagit({
tagSource: allTerms,
initialTags: selectedTerms,
triggerKeys: ['enter', 'comma', 'tab'],
triggerKeys: ['enter', 'tab'], // default is ['enter', 'space', 'comma', 'tab'] but we remove comma and space to allow them in the terms
allowNewTags: $(this).data("allow-new-terms"),
tagsChanged: onTagsChanged,
caseSensitive: false,

View File

@@ -26,8 +26,8 @@
}
}
@{
var allTerms = string.Join(",", Model.Terms.Select(x => string.Format("{0}\t{1}\t{2}\t{3}", x.Name, x.Id, x.GetLevels(), IsTermDisabled(x))));
var selectedTerms = string.Join(",", Model.Terms.Where(x => x.IsChecked).Select(x => string.Format("{0}\t{1}", x.Name, x.Id)));
var allTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Select(x => new { label = x.Name, value = x.Id, levels = x.GetLevels(), disabled = IsTermDisabled(x)}));
var selectedTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Where(x => x.IsChecked).Select(x => new { label = x.Name, value = x.Id, levels = 0, disabled = true }));
}
<fieldset class="taxonomy-wrapper" data-name-prefix="@Html.FieldNameFor(m => m)" data-id-prefix="@Html.FieldIdFor(m => m)">
<legend @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.DisplayName.CamelFriendly()</legend>

View File

@@ -13,7 +13,6 @@ namespace Orchard.Widgets.Handlers {
Filters.Add(StorageFilter.For(widgetsRepository));
OnInitializing<WidgetPart>((context, part) => part.RenderTitle = true);
OnIndexing<TitlePart>((context, part) => context.DocumentIndex.Add("title", part.Title).RemoveTags().Analyze());
}
protected override void GetItemMetadata(GetContentItemMetadataContext context) {

View File

@@ -1,11 +1,15 @@
@using Orchard.ContentManagement;
@using Orchard.Widgets;
@if (AuthorizedFor(Permissions.ManageWidgets)) {
<div class="widget-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Child)
</div>
}
else {
@Display(Model.Child)
@{
var contentItem = (ContentItem)Model.ContentItem;
if (AuthorizedFor(Permissions.ManageWidgets, contentItem)) {
<div class="widget-control">
<div class="manage-actions">
@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, contentItem)</div>
@Display(Model.Child)
</div>
}
else {
@Display(Model.Child)
}
}

View File

@@ -100,7 +100,7 @@
<modules runAllManagedModulesForAllRequests="false">
<remove name="WarmupHttpModule"/>
<add name="WarmupHttpModule" type="Orchard.WarmupStarter.WarmupHttpModule, Orchard.WarmupStarter, Version=1.8, Culture=neutral"/>
<add name="WarmupHttpModule" type="Orchard.WarmupStarter.WarmupHttpModule, Orchard.WarmupStarter, Version=1.8.1, Culture=neutral"/>
</modules>
<handlers accessPolicy="Script">

View File

@@ -29,7 +29,7 @@ namespace Orchard.Environment {
/// <summary>
/// Can be used to build an temporary self-contained instance of a shell's configured code.
/// Services may be resolved from within this instance to configure and initialize it's storage.
/// Services may be resolved from within this instance to configure and initialize its storage.
/// </summary>
IWorkContextScope CreateStandaloneEnvironment(ShellSettings shellSettings);
}

View File

@@ -173,6 +173,10 @@ namespace Orchard.Mvc.ViewEngines.Razor {
return Authorizer.Authorize(permission);
}
public bool AuthorizedFor(Permission permission, IContent content) {
return Authorizer.Authorize(permission, content);
}
public bool HasText(object thing) {
return !string.IsNullOrWhiteSpace(Convert.ToString(thing));
}