mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Compare commits
18 Commits
issue/8232
...
issue/8830
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6b177c563 | ||
|
|
14d19b9ccc | ||
|
|
2b410d808e | ||
|
|
971a97874c | ||
|
|
8851f622a3 | ||
|
|
e22be0b1ce | ||
|
|
8a6e89d1af | ||
|
|
5e44b013cd | ||
|
|
0063c18f7f | ||
|
|
0de919d36f | ||
|
|
b14c29503b | ||
|
|
d310fb56e1 | ||
|
|
4c463287ca | ||
|
|
3561be6e37 | ||
|
|
5c3d045aa1 | ||
|
|
32c5f1e821 | ||
|
|
d26e8e47f1 | ||
|
|
1c40b8ba93 |
27
.github/workflows/build-crowdin-translation-packages.yml
vendored
Normal file
27
.github/workflows/build-crowdin-translation-packages.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Build Crowdin Translation Packages
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
|
||||
jobs:
|
||||
build-crowdin-translation-packages:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Orchard CMS
|
||||
uses: andrii-bodnar/crowdin-request-action@ee7a2af9564d8934b5b4a8427185aaaffee0165e # v0.3.0
|
||||
with:
|
||||
route: POST /projects/{projectId}/translations/builds
|
||||
projectId: 46524
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
|
||||
|
||||
- name: Orchard CMS Gallery
|
||||
uses: andrii-bodnar/crowdin-request-action@ee7a2af9564d8934b5b4a8427185aaaffee0165e # v0.3.0
|
||||
with:
|
||||
route: POST /projects/{projectId}/translations/builds
|
||||
projectId: 63766
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
|
||||
37
.github/workflows/compile.yml
vendored
37
.github/workflows/compile.yml
vendored
@@ -13,17 +13,17 @@ jobs:
|
||||
name: Compile .NET solution
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
runs-on: windows-latest
|
||||
shell: cmd
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Compile
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /p:MvcBuildViews=true
|
||||
@@ -32,11 +32,13 @@ jobs:
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Test
|
||||
|
||||
- name: Test Setup with SpecFlow
|
||||
shell: pwsh
|
||||
run: |
|
||||
$nunitConsole = (Get-ChildItem -Path 'src/packages' -Recurse -Filter 'nunit-console.exe' | Select-Object -Last 1).FullName
|
||||
& $nunitConsole 'build/Compile/Orchard.Specs.dll' /xml='build/Orchard.Specs.xml' /run=Orchard.Specs.SetupFeature.RootAndSetupFolderShowsSetupScreenAndFormValuesAreValidated
|
||||
|
||||
- name: Run Orchard Setup with Orchard.exe
|
||||
shell: pwsh
|
||||
run: |
|
||||
$commandFile = 'src/Orchard.Web/bin/setup-commands.txt'
|
||||
New-Item -Path $commandFile -ItemType File -Force
|
||||
@@ -44,6 +46,7 @@ jobs:
|
||||
& 'src/Orchard.Web/bin/Orchard.exe' @$commandFile
|
||||
|
||||
- name: Run Code Generation
|
||||
shell: pwsh
|
||||
run: |
|
||||
$commandFile = 'src/Orchard.Web/bin/codegen-commands.txt'
|
||||
New-Item -Path $commandFile -ItemType File -Force
|
||||
@@ -62,31 +65,37 @@ jobs:
|
||||
name: Compile Client-side Assets
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
runs-on: windows-latest
|
||||
shell: cmd
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup NodeJS
|
||||
uses: actions/setup-node@v4.0.2
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
||||
with:
|
||||
node-version: '7'
|
||||
node-version: 7
|
||||
|
||||
- name: Setup NPM Packages
|
||||
- name: Install Gulp Globally
|
||||
working-directory: ./src
|
||||
shell: pwsh
|
||||
run: |
|
||||
npm install --loglevel warn
|
||||
|
||||
# Install gulp globally to be able to run the rebuild task, using the same version as in the project.
|
||||
$gulpVersion = (Get-Content Package.json -Raw | ConvertFrom-Json).devDependencies.gulp
|
||||
Start-Process npm -NoNewWindow -Wait -ArgumentList "install gulp@$gulpVersion -g --loglevel warn"
|
||||
|
||||
- name: Install NPM Packages
|
||||
working-directory: ./src
|
||||
run: npm install --loglevel warn
|
||||
|
||||
- name: Rebuild Client-side Assets
|
||||
working-directory: ./src
|
||||
run: |
|
||||
gulp rebuild
|
||||
run: gulp rebuild
|
||||
|
||||
- name: Check Client-side Assets
|
||||
working-directory: ./src
|
||||
shell: pwsh
|
||||
run: |
|
||||
git add . # To make line ending changes "disappear".
|
||||
$gitStatus = (git status --porcelain)
|
||||
if ($gitStatus)
|
||||
|
||||
39
.github/workflows/release-package.yml
vendored
Normal file
39
.github/workflows/release-package.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Release Package
|
||||
# Builds the release package and uploads it as an artifact.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release-package:
|
||||
name: Release Package
|
||||
runs-on: Windows-2025
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Build Precompiled Application
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Precompiled
|
||||
|
||||
- name: Generate Release Package Name
|
||||
id: package-name
|
||||
shell: pwsh
|
||||
run: |
|
||||
$packageName = "Orchard-$('${{ github.ref_name }}'.Replace('/', '_'))-${{ github.sha }}"
|
||||
"package-name=$packageName" >> $Env:GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Release Package
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ${{ steps.package-name.outputs.package-name }}
|
||||
path: .\build\Precompiled
|
||||
if-no-files-found: error
|
||||
59
.github/workflows/specflow.yml
vendored
Normal file
59
.github/workflows/specflow.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: SpecFlow Tests
|
||||
# Compiles the solution and runs unit tests, as well the SpecFlow tests on the main development branches.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 1.10.x
|
||||
- dev
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Every Monday midnight.
|
||||
|
||||
jobs:
|
||||
define-matrix:
|
||||
name: Define Strategy Matrix
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
branches: ${{ steps.branches.outputs.branches }}
|
||||
steps:
|
||||
- name: Define Branches
|
||||
id: branches
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
echo 'branches=["1.10.x", "dev"]' >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo 'branches=["${{ github.ref_name }}"]' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
compile:
|
||||
name: SpecFlow Tests
|
||||
needs: define-matrix
|
||||
runs-on: windows-2025
|
||||
strategy:
|
||||
matrix:
|
||||
branch: ${{ fromJSON(needs.define-matrix.outputs.branches) }}
|
||||
fail-fast: false
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
ref: ${{ matrix.branch }}
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Compile
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
|
||||
|
||||
- name: Test
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Test
|
||||
|
||||
- name: Spec
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Spec
|
||||
@@ -26,6 +26,22 @@
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -38,6 +38,26 @@
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<specFlow>
|
||||
|
||||
@@ -42,6 +42,22 @@
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -30,6 +30,26 @@
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
93
src/Orchard.Web/Core/Containers/AdminMenu.cs
Normal file
93
src/Orchard.Web/Core/Containers/AdminMenu.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System.Linq;
|
||||
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;
|
||||
|
||||
namespace Orchard.Core.Containers {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
private readonly IContainerService _containerService;
|
||||
private readonly 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; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.AddImageSet("container");
|
||||
|
||||
var containers = _containerService
|
||||
.GetContainersQuery(VersionOptions.Latest)
|
||||
.Where<ContainerPartRecord>(x => x.ShowOnAdminMenu)
|
||||
.List()
|
||||
.Where(content => _authorizationService.TryCheckAccess(
|
||||
Contents.Permissions.EditContent,
|
||||
_workContextAccessor.GetContext().CurrentUser,
|
||||
content))
|
||||
.ToList();
|
||||
|
||||
foreach (var container in containers) {
|
||||
var closureContainer = container;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(container.AdminMenuImageSet)) {
|
||||
builder.AddImageSet(container.AdminMenuImageSet.Trim());
|
||||
}
|
||||
|
||||
builder.Add(T(container.AdminMenuText), container.AdminMenuPosition, item => {
|
||||
var containedItems = _containerService.GetContentItems(closureContainer.Id, VersionOptions.Latest).ToList();
|
||||
var actualContainer = closureContainer;
|
||||
var position = 0;
|
||||
|
||||
// If the list has just a single item that happens to be a container itself,
|
||||
// we will treat that one as the actual container to provide a nice & quick way to manage that list.
|
||||
if (containedItems.Count == 1) {
|
||||
var containedItem = containedItems.First().As<ContainerPart>();
|
||||
|
||||
if (containedItem != null) {
|
||||
actualContainer = containedItem;
|
||||
foreach (var itemContentType in containedItem.ItemContentTypes) {
|
||||
var closureItemContentType = itemContentType;
|
||||
item.Add(T("New {0}", itemContentType.DisplayName), string.Format("1.{0}", position++), subItem => subItem
|
||||
.Action("Create", "Admin", new {
|
||||
id = closureItemContentType.Name,
|
||||
containerid = containedItem.Id,
|
||||
area = "Contents"
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.Action(_contentManager.GetItemMetadata(actualContainer).AdminRouteValues)
|
||||
.AddClass("section-container")
|
||||
.AddClass(closureContainer.AdminMenuText.HtmlClassify())
|
||||
.LinkToFirstChild(false);
|
||||
|
||||
foreach (var itemContentType in closureContainer.ItemContentTypes) {
|
||||
var closureItemContentType = itemContentType;
|
||||
item.Add(T("New {0}", itemContentType.DisplayName), string.Format("1.{0}", position++), subItem => subItem
|
||||
.Action("Create", "Admin", new {
|
||||
id = closureItemContentType.Name,
|
||||
containerid = container.Id,
|
||||
area = "Contents"
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/Orchard.Web/Core/Containers/Styles/Web.config
Normal file
12
src/Orchard.Web/Core/Containers/Styles/Web.config
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<staticContent>
|
||||
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
|
||||
</staticContent>
|
||||
<handlers accessPolicy="Script,Read">
|
||||
<!-- For any request to a file exists on disk, return it via native http module. AccessPolicy="Script" above is to allow for a managed 404 page. -->
|
||||
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 998 B |
@@ -0,0 +1,7 @@
|
||||
.menu-admin > .section-container > h3 > a {
|
||||
background-image: url(images/menu.container.png) !important;
|
||||
}
|
||||
|
||||
.menu-admin > .section-container > h3 > a:hover {
|
||||
background-position: 0 -30px !important;
|
||||
}
|
||||
@@ -352,6 +352,32 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return EditPOST(id, returnUrl, contentItem => _contentManager.Publish(contentItem));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This action is specific to the submit button of the edit form.
|
||||
/// Unpublish logic is the same of the Unpublish action, which is called by the content list.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="returnUrl"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[Mvc.FormValueRequired("submit.Unpublish")]
|
||||
public ActionResult EditUnpublishPOST(int id, string returnUrl) {
|
||||
return Unpublish(id, returnUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This action is specific to the submit button of the edit form.
|
||||
/// Delete logic is the same of the Remove action, which is called by the content list.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="returnUrl"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[Mvc.FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditDeletePOST(int id, string returnUrl) {
|
||||
return Remove(id, returnUrl);
|
||||
}
|
||||
|
||||
private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
|
||||
|
||||
|
||||
@@ -21,8 +21,14 @@ namespace Orchard.Core.Contents.Drivers {
|
||||
protected override DriverResult Editor(ContentPart part, dynamic shapeHelper) {
|
||||
var results = new List<DriverResult> { ContentShape("Content_SaveButton", saveButton => saveButton) };
|
||||
|
||||
if (part.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
|
||||
if (part.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable) {
|
||||
results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
|
||||
results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
|
||||
}
|
||||
|
||||
if (part.Id > 0) {
|
||||
results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
|
||||
}
|
||||
|
||||
return Combined(results.ToArray());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
Parts_Contents_Publish_SummaryAdmin
|
||||
-->
|
||||
<!-- edit "shape" -->
|
||||
<Place Content_PublishButton="Sidebar:24"/>
|
||||
<Place Content_SaveButton="Sidebar:23"/>
|
||||
<Place Content_PublishButton="Sidebar:24"/>
|
||||
<Place Content_UnpublishButton="Sidebar:25"/>
|
||||
<Place Content_DeleteButton="Sidebar:26"/>
|
||||
<Match DisplayType="Detail">
|
||||
<Place Parts_Contents_Publish="Content:5"/>
|
||||
</Match>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Core.Contents;
|
||||
|
||||
@if (Authorizer.Authorize(Permissions.DeleteContent, (IContent)Model.ContentItem)) {
|
||||
<fieldset class="delete-button">
|
||||
<button type="submit" name="submit.Delete" value="submit.Delete" itemprop="RemoveUrl">@T("Delete")</button>
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.ContentManagement;
|
||||
@using Orchard.Core.Contents;
|
||||
|
||||
@{
|
||||
var contentItem = Model.ContentItem as IContent;
|
||||
}
|
||||
|
||||
@if (Authorizer.Authorize(Permissions.PublishContent, contentItem) && contentItem.IsPublished()) {
|
||||
<fieldset class="unpublish-button">
|
||||
<button type="submit" name="submit.Unpublish" value="submit.Unpublish">@T("Unpublish")</button>
|
||||
</fieldset>
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
@@ -14,6 +13,7 @@ using Orchard.Data;
|
||||
using Orchard.Exceptions;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Mvc.Extensions;
|
||||
using Orchard.Mvc.Html;
|
||||
using Orchard.Security;
|
||||
@@ -131,11 +131,15 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
return RedirectToAction("Index", new { menuId });
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditDeletePOST(int id) => Delete(id);
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id) {
|
||||
|
||||
MenuPart menuPart = _menuService.Get(id);
|
||||
int? menuId = null;
|
||||
|
||||
if (!_authorizer.Authorize(
|
||||
Permissions.ManageMenus,
|
||||
menuPart == null ? null : _menuService.GetMenu(menuPart.Menu.Id),
|
||||
@@ -152,7 +156,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
.ToList();
|
||||
|
||||
foreach (var menuItem in menuItems.Concat(new[] { menuPart })) {
|
||||
// if the menu item is a concrete content item, don't delete it, just unreference the menu
|
||||
// if the menu item is a concrete content item, don't delete it, just remove the menu reference
|
||||
if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype")
|
||||
|| menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") {
|
||||
menuPart.Menu = null;
|
||||
@@ -162,6 +166,11 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
_notifier.Information(T.Plural(
|
||||
"The menu item '{1}' has been deleted.",
|
||||
"The menu item '{1}' and its children have been deleted.",
|
||||
menuItems.Count() + 1,
|
||||
menuPart.MenuText));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index", new { menuId });
|
||||
@@ -172,7 +181,8 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
// create a new temporary menu item
|
||||
var menuPart = _contentManager.New<MenuPart>(id);
|
||||
var contentItem = _contentManager.New(id);
|
||||
var menuPart = contentItem.As<MenuPart>();
|
||||
|
||||
if (menuPart == null)
|
||||
return HttpNotFound();
|
||||
@@ -187,7 +197,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
// filter the content items for this specific menu
|
||||
menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
|
||||
menuPart.Menu = menu;
|
||||
var model = _contentManager.BuildEditor(menuPart);
|
||||
var model = _contentManager.BuildEditor(contentItem);
|
||||
|
||||
return View(model);
|
||||
}
|
||||
@@ -206,23 +216,32 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
public ActionResult CreateMenuItemPost(string id, int menuId, string returnUrl) {
|
||||
if (!_authorizer.Authorize(Permissions.ManageMenus, _menuService.GetMenu(menuId), T("Couldn't manage the menu")))
|
||||
return new HttpUnauthorizedResult();
|
||||
var menuPart = _contentManager.New<MenuPart>(id);
|
||||
|
||||
var contentItem = _contentManager.New(id);
|
||||
var menuPart = contentItem.As<MenuPart>();
|
||||
|
||||
if (menuPart == null)
|
||||
return HttpNotFound();
|
||||
|
||||
// load the menu
|
||||
var menu = _contentManager.Get(menuId);
|
||||
if (menu == null)
|
||||
return HttpNotFound();
|
||||
|
||||
_contentManager.Create(contentItem);
|
||||
|
||||
menuPart.Menu = menu;
|
||||
var model = _contentManager.UpdateEditor(menuPart, this);
|
||||
menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
|
||||
_contentManager.Create(menuPart);
|
||||
|
||||
var model = _contentManager.UpdateEditor(contentItem, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
return View(model);
|
||||
}
|
||||
_notifier.Information(T("Your {0} has been added.", menuPart.TypeDefinition.DisplayName));
|
||||
|
||||
_notifier.Information(T("Your {0} has been added.", contentItem.TypeDefinition.DisplayName));
|
||||
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
}
|
||||
|
||||
@@ -308,7 +327,8 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
}
|
||||
|
||||
private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
|
||||
var menuPart = _contentManager.GetDraftRequired<MenuPart>(id);
|
||||
var contentItem = _contentManager.GetLatest(id);
|
||||
var menuPart = contentItem.As<MenuPart>();
|
||||
|
||||
if (menuPart == null)
|
||||
return HttpNotFound();
|
||||
@@ -316,8 +336,6 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
if (!_authorizer.Authorize(Permissions.ManageMenus, menuPart.Menu, T("Couldn't manage the menu")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentItem = menuPart.ContentItem;
|
||||
|
||||
string previousRoute = null;
|
||||
if (contentItem.Has<IAliasAspect>()
|
||||
&& !string.IsNullOrWhiteSpace(returnUrl)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Orchard.Core.Navigation.Services {
|
||||
}
|
||||
|
||||
public IContent GetMenu(string menuName) {
|
||||
if(string.IsNullOrWhiteSpace(menuName)) {
|
||||
if (string.IsNullOrWhiteSpace(menuName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace Orchard.Core.Navigation.Services {
|
||||
}
|
||||
|
||||
public IContent GetMenu(int menuId) {
|
||||
return _contentManager.Get(menuId, VersionOptions.Published);
|
||||
return _contentManager.Get(menuId, VersionOptions.Published);
|
||||
}
|
||||
|
||||
public MenuPart Get(int menuPartId) {
|
||||
return _contentManager.Get<MenuPart>(menuPartId);
|
||||
return _contentManager.Get<MenuPart>(menuPartId, VersionOptions.Latest);
|
||||
}
|
||||
|
||||
public IContent Create(string name) {
|
||||
|
||||
if(string.IsNullOrWhiteSpace(name)) {
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name)) {
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
|
||||
|
||||
var menu = _contentManager.Create("Menu");
|
||||
menu.As<TitlePart>().Title = name;
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<Compile Include="Common\ViewModels\DateTimeEditor.cs" />
|
||||
<Compile Include="Common\ViewModels\TextFieldDriverViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\TextFieldSettingsEventsViewModel.cs" />
|
||||
<Compile Include="Containers\AdminMenu.cs" />
|
||||
<Compile Include="Containers\Controllers\ItemController.cs" />
|
||||
<Compile Include="Containers\Drivers\ContainablePartDriver.cs" />
|
||||
<Compile Include="Containers\Drivers\ContainerPartDriver.cs" />
|
||||
@@ -318,6 +319,8 @@
|
||||
<Content Include="Common\Views\Parts.Common.Metadata.cshtml" />
|
||||
<Content Include="Common\Views\CommonMetadataLastModified.cshtml" />
|
||||
<Content Include="Containers\Module.txt" />
|
||||
<Content Include="Containers\Styles\images\menu.container.png" />
|
||||
<Content Include="Containers\Styles\menu.container-admin.css" />
|
||||
<Content Include="Shapes\Scripts\admin-localnavigation.js" />
|
||||
<Content Include="Contents\Styles\images\menu.content.png" />
|
||||
<Content Include="Contents\Styles\menu.content-admin.css" />
|
||||
@@ -610,9 +613,16 @@
|
||||
<Content Include="Navigation\Views\Admin\Edit.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Contents\Views\Content.UnpublishButton.cshtml" />
|
||||
<Content Include="Contents\Views\Content.DeleteButton.cshtml" />
|
||||
<None Include="packages.config" />
|
||||
<Content Include="Title\Views\DefinitionTemplates\TitlePartSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Containers\Styles\Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
||||
@@ -62,20 +62,20 @@
|
||||
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
@@ -231,4 +231,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -68,6 +68,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
|
||||
</packages>
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Models;
|
||||
@@ -138,6 +137,12 @@ namespace Orchard.Blogs.Controllers {
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[Mvc.FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditDeletePOST(int blogId, int postId, string returnUrl) {
|
||||
return Delete(blogId, postId);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[FormValueRequired("submit.Publish")]
|
||||
public ActionResult EditAndPublishPOST(int blogId, int postId, string returnUrl) {
|
||||
@@ -156,6 +161,12 @@ namespace Orchard.Blogs.Controllers {
|
||||
return EditPOST(blogId, postId, returnUrl, contentItem => Services.ContentManager.Publish(contentItem));
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[Mvc.FormValueRequired("submit.Unpublish")]
|
||||
public ActionResult EditUnpublishPOST(int blogId, int postId, string returnUrl) {
|
||||
return Unpublish(blogId, postId);
|
||||
}
|
||||
|
||||
public ActionResult EditPOST(int blogId, int postId, string returnUrl, Action<ContentItem> conditionallyPublish) {
|
||||
var blog = _blogService.Get(blogId, VersionOptions.Latest);
|
||||
if (blog == null)
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -8,4 +8,8 @@ namespace Orchard.Caching.Services {
|
||||
void Remove(string key);
|
||||
void Clear();
|
||||
}
|
||||
|
||||
public interface ICacheStorageProviderWithKeyPrefix : ICacheStorageProvider {
|
||||
void Clear(string key);
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -69,6 +69,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -71,6 +71,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -55,8 +55,11 @@
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MailKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MailKit.3.1.1\lib\net48\MailKit.dll</HintPath>
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MailKit, Version=4.9.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MailKit.4.9.0\lib\net48\MailKit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\lib\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
|
||||
@@ -65,23 +68,42 @@
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MimeKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MimeKit.3.1.1\lib\net48\MimeKit.dll</HintPath>
|
||||
<Reference Include="MimeKit, Version=4.9.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\MimeKit.4.9.0\lib\net48\MimeKit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Formats.Asn1, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
|
||||
@@ -69,6 +69,18 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MailKit" version="3.1.1" targetFramework="net48" />
|
||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net48" />
|
||||
<package id="MailKit" version="4.9.0" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="MimeKit" version="3.1.1" targetFramework="net48" />
|
||||
<package id="MimeKit" version="4.9.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Formats.Asn1" version="8.0.1" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -4,41 +4,46 @@ using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Fields.Fields;
|
||||
using Orchard.Fields.Settings;
|
||||
using Orchard.Localization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Fields.Drivers {
|
||||
public class EnumerationFieldDriver : ContentFieldDriver<EnumerationField> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
private const string TemplateName = "Fields/Enumeration.Edit";
|
||||
|
||||
public EnumerationFieldDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
private static string GetPrefix(ContentField field, ContentPart part) =>
|
||||
part.PartDefinition.Name + "." + field.Name;
|
||||
private static string GetPrefix(ContentField field, ContentPart part) {
|
||||
return part.PartDefinition.Name + "." + field.Name;
|
||||
}
|
||||
|
||||
private static string GetDifferentiator(EnumerationField field) => field.Name;
|
||||
private static string GetDifferentiator(EnumerationField field, ContentPart part) {
|
||||
return field.Name;
|
||||
}
|
||||
|
||||
protected override DriverResult Display(ContentPart part, EnumerationField field, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Enumeration", GetDifferentiator(field), () => shapeHelper.Fields_Enumeration());
|
||||
return ContentShape("Fields_Enumeration", GetDifferentiator(field, part),
|
||||
() => shapeHelper.Fields_Enumeration());
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, EnumerationField field, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field), () => {
|
||||
if (part.IsNew() && string.IsNullOrEmpty(field.Value)) {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
if (!string.IsNullOrWhiteSpace(settings.DefaultValue)) {
|
||||
field.SelectedValues = new string[] { settings.DefaultValue };
|
||||
return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field, part),
|
||||
() => {
|
||||
if (part.IsNew() && String.IsNullOrEmpty(field.Value)) {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
|
||||
field.Value = settings.DefaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
|
||||
});
|
||||
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, EnumerationField field, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
||||
@@ -7,16 +7,28 @@ namespace Orchard.Fields.Fields {
|
||||
private const char Separator = ';';
|
||||
|
||||
public string Value {
|
||||
get => Storage.Get<string>()?.Trim(Separator) ?? "";
|
||||
set => Storage.Set(string.IsNullOrWhiteSpace(value)
|
||||
? string.Empty
|
||||
// It is now the responsibility of this field to (re-)add the separators.
|
||||
: Separator + value.Trim(Separator) + Separator);
|
||||
get { return Storage.Get<string>(); }
|
||||
set { Storage.Set(value ?? String.Empty); }
|
||||
}
|
||||
|
||||
public string[] SelectedValues {
|
||||
get => Value?.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];
|
||||
set => Value = value?.Length > 0 ? string.Join(Separator.ToString(), value) : "";
|
||||
get {
|
||||
var value = Value;
|
||||
if(string.IsNullOrWhiteSpace(value)) {
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
return value.Split(new [] { Separator }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
set {
|
||||
if (value == null || value.Length == 0) {
|
||||
Value = String.Empty;
|
||||
}
|
||||
else {
|
||||
Value = Separator + string.Join(Separator.ToString(), value) + Separator;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,10 +169,6 @@
|
||||
<Compile Include="ViewModels\NumericFieldViewModel.cs" />
|
||||
<Compile Include="ViewModels\DateTimeFieldViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Fields\Input.cshtml" />
|
||||
</ItemGroup>
|
||||
@@ -223,4 +219,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -4,30 +4,48 @@
|
||||
|
||||
@{
|
||||
var settings = Model.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ? settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None) : new string[] { T("Select an option").ToString() };
|
||||
string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ?
|
||||
settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None)
|
||||
: new string[] { T("Select an option").ToString() };
|
||||
}
|
||||
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@Model.DisplayName</label>
|
||||
@switch (settings.ListMode) {
|
||||
case ListMode.Dropdown:
|
||||
@Html.DropDownListFor(m => m.Value, new SelectList(options, Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)
|
||||
@Html.DropDownListFor(
|
||||
m => m.Value,
|
||||
new SelectList(options, Model.SelectedValues.FirstOrDefault()),
|
||||
settings.Required ? new { required = "required" } : null)
|
||||
break;
|
||||
|
||||
case ListMode.Radiobutton:
|
||||
foreach (var option in options) {
|
||||
if (string.IsNullOrWhiteSpace(option)) {
|
||||
<label>@Html.RadioButton("Value", "", string.IsNullOrWhiteSpace(Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)<i>@T("unset")</i></label>
|
||||
<label>@Html.RadioButton(
|
||||
"Value",
|
||||
"",
|
||||
string.IsNullOrWhiteSpace(Model.SelectedValues.FirstOrDefault()),
|
||||
settings.Required ? new { required = "required" } : null)<i>@T("unset")</i>
|
||||
</label>
|
||||
}
|
||||
else {
|
||||
<label>@Html.RadioButton("Value", option, (option == Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)@option</label>
|
||||
<label>@Html.RadioButton(
|
||||
"Value",
|
||||
option,
|
||||
option == Model.SelectedValues.FirstOrDefault(),
|
||||
settings.Required ? new { required = "required" } : null)@option
|
||||
</label>
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ListMode.Listbox:
|
||||
<input name="@Html.FieldNameFor(m => m.SelectedValues)" type="hidden" />
|
||||
@Html.ListBoxFor(m => m.SelectedValues, new MultiSelectList(options, Model.SelectedValues), settings.Required ? new { required = "required" } : null)
|
||||
@Html.ListBoxFor(
|
||||
m => m.SelectedValues,
|
||||
new MultiSelectList(options, Model.SelectedValues),
|
||||
settings.Required ? new { required = "required" } : null)
|
||||
break;
|
||||
|
||||
case ListMode.Checkbox:
|
||||
@@ -37,7 +55,9 @@
|
||||
index++;
|
||||
if (!string.IsNullOrWhiteSpace(option)) {
|
||||
<div>
|
||||
<input type="checkbox" name="@Html.FieldNameFor(m => m.SelectedValues)" value="@option" @((Model.SelectedValues != null && Model.SelectedValues.Contains(option)) ? "checked=\"checked\"" : "") class="check-box" id="@Html.FieldIdFor(m => m.SelectedValues)-@index" />
|
||||
<input type="checkbox" name="@Html.FieldNameFor(m => m.SelectedValues)" value="@option"
|
||||
@((Model.SelectedValues != null && Model.SelectedValues.Contains(option)) ? "checked=\"checked\"" : "")
|
||||
class="check-box" id="@Html.FieldIdFor(m => m.SelectedValues)-@index" />
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.SelectedValues)-@index">@option</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Indexing.Services;
|
||||
using Orchard.Tasks.Indexing;
|
||||
using Orchard.Utility.Extensions;
|
||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||
|
||||
namespace Orchard.Indexing.Commands {
|
||||
public class IndexingCommands : DefaultOrchardCommandHandler {
|
||||
@@ -38,27 +38,22 @@ namespace Orchard.Indexing.Commands {
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (index.ToSafeName() != index) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
var indexProvider = _indexManager.GetSearchIndexProvider();
|
||||
if (indexProvider == null) {
|
||||
Context.Output.WriteLine(T("No indexing service was found. Please enable a module like Lucene."));
|
||||
}
|
||||
else {
|
||||
var indexProvider = _indexManager.GetSearchIndexProvider();
|
||||
if(indexProvider == null) {
|
||||
Context.Output.WriteLine(T("No indexing service was found. Please enable a module like Lucene."));
|
||||
if (indexProvider.Exists(index)) {
|
||||
Context.Output.WriteLine(T("The specified index already exists."));
|
||||
}
|
||||
else {
|
||||
if (indexProvider.Exists(index)) {
|
||||
Context.Output.WriteLine(T("The specified index already exists."));
|
||||
}
|
||||
else {
|
||||
_indexManager.GetSearchIndexProvider().CreateIndex(index);
|
||||
Context.Output.WriteLine(T("New index has been created successfully."));
|
||||
}
|
||||
_indexManager.GetSearchIndexProvider().CreateIndex(index);
|
||||
Context.Output.WriteLine(T("New index has been created successfully."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +61,7 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandName("index update")]
|
||||
[CommandHelp("index update <index>\r\n\t" + "Updates the specified index")]
|
||||
public void Update(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +73,7 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandName("index rebuild")]
|
||||
[CommandHelp("index rebuild <index> \r\n\t" + "Rebuilds the specified index")]
|
||||
public void Rebuild(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -91,24 +86,24 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandHelp("index query <index> /Query:<query>\r\n\t" + "Searches the specified <query> terms in the specified index")]
|
||||
[OrchardSwitches("Query")]
|
||||
public void Search(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !_indexManager.HasIndexProvider() ) {
|
||||
if (!_indexManager.HasIndexProvider()) {
|
||||
Context.Output.WriteLine(T("No index available"));
|
||||
return;
|
||||
}
|
||||
var searchBuilder = _indexManager.GetSearchIndexProvider().CreateSearchBuilder(index);
|
||||
var results = searchBuilder.Parse( new [] {"body", "title"}, Query).Search();
|
||||
var results = searchBuilder.Parse(new[] { "body", "title" }, Query).Search();
|
||||
|
||||
Context.Output.WriteLine("{0} result{1}\r\n-----------------\r\n", results.Count(), results.Count() > 0 ? "s" : "");
|
||||
|
||||
Context.Output.WriteLine("┌──────────────────────────────────────────────────────────────┬────────┐");
|
||||
Context.Output.WriteLine("│ {0} │ {1,6} │", "Title" + new string(' ', 60 - "Title".Length), "Score");
|
||||
Context.Output.WriteLine("├──────────────────────────────────────────────────────────────┼────────┤");
|
||||
foreach ( var searchHit in results ) {
|
||||
foreach (var searchHit in results) {
|
||||
var contentItem = _contentManager.Get(searchHit.ContentItemId);
|
||||
var metadata = _contentManager.GetItemMetadata(contentItem);
|
||||
var title = String.IsNullOrWhiteSpace(metadata.DisplayText) ? "- no title -" : metadata.DisplayText;
|
||||
@@ -126,12 +121,12 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandHelp("index stats <index>\r\n\t" + "Displays some statistics about the search index")]
|
||||
[OrchardSwitches("IndexName")]
|
||||
public void Stats(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !_indexManager.HasIndexProvider() ) {
|
||||
if (!_indexManager.HasIndexProvider()) {
|
||||
Context.Output.WriteLine(T("No index available"));
|
||||
return;
|
||||
}
|
||||
@@ -140,11 +135,10 @@ namespace Orchard.Indexing.Commands {
|
||||
}
|
||||
|
||||
[CommandName("index refresh")]
|
||||
[CommandHelp("index refresh /ContentItem:<content item id> \r\n\t" + "Refreshes the index for the specifed <content item id>")]
|
||||
[CommandHelp("index refresh /ContentItem:<content item id> \r\n\t" + "Refreshes the index for the specified <content item id>")]
|
||||
[OrchardSwitches("ContentItem")]
|
||||
public void Refresh() {
|
||||
int contentItemId;
|
||||
if ( !int.TryParse(ContentItem, out contentItemId) ) {
|
||||
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||
return;
|
||||
}
|
||||
@@ -152,19 +146,18 @@ namespace Orchard.Indexing.Commands {
|
||||
var contentItem = _contentManager.Get(contentItemId);
|
||||
_indexingTaskManager.CreateUpdateIndexTask(contentItem);
|
||||
|
||||
Context.Output.WriteLine(T("Content Item marked for reindexing"));
|
||||
Context.Output.WriteLine(T("Content Item marked for re-indexing"));
|
||||
}
|
||||
|
||||
[CommandName("index delete")]
|
||||
[CommandHelp("index delete /ContentItem:<content item id>\r\n\t" + "Deletes the specifed <content item id> from the index")]
|
||||
[CommandHelp("index delete /ContentItem:<content item id>\r\n\t" + "Deletes the specified <content item id> from the index")]
|
||||
[OrchardSwitches("ContentItem")]
|
||||
public void Delete() {
|
||||
int contentItemId;
|
||||
if(!int.TryParse(ContentItem, out contentItemId)) {
|
||||
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var contentItem = _contentManager.Get(contentItemId);
|
||||
_indexingTaskManager.CreateDeleteIndexTask(contentItem);
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Indexing.Services;
|
||||
using Orchard.Indexing.ViewModels;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Security;
|
||||
using Orchard.Indexing.ViewModels;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.Utility.Extensions;
|
||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||
|
||||
namespace Orchard.Indexing.Controllers {
|
||||
public class AdminController : Controller {
|
||||
@@ -15,7 +15,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
private readonly IIndexManager _indexManager;
|
||||
|
||||
public AdminController(
|
||||
IIndexingService indexingService,
|
||||
IIndexingService indexingService,
|
||||
IOrchardServices services,
|
||||
IIndexManager indexManager) {
|
||||
_indexingService = indexingService;
|
||||
@@ -34,23 +34,21 @@ namespace Orchard.Indexing.Controllers {
|
||||
IndexEntries = Enumerable.Empty<IndexEntry>(),
|
||||
IndexProvider = _indexManager.GetSearchIndexProvider()
|
||||
};
|
||||
|
||||
|
||||
if (_indexManager.HasIndexProvider()) {
|
||||
viewModel.IndexEntries = _indexManager.GetSearchIndexProvider().List().Select(x => {
|
||||
try {
|
||||
return _indexingService.GetIndexEntry(x);
|
||||
}
|
||||
catch(Exception e) {
|
||||
catch (Exception e) {
|
||||
Logger.Error(e, "Index couldn't be read: " + x);
|
||||
return new IndexEntry {
|
||||
return new IndexEntry {
|
||||
IndexName = x,
|
||||
IndexingStatus = IndexingStatus.Unavailable
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Services.Notifier.Information(T("The index might be corrupted. If you can't recover click on Rebuild."));
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
@@ -59,7 +57,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
return View("Create", String.Empty);
|
||||
return View("Create");
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -68,7 +66,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var provider = _indexManager.GetSearchIndexProvider();
|
||||
if (String.IsNullOrWhiteSpace(id) || id.ToSafeName() != id) {
|
||||
if (!IsValidIndexName(id)) {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
return View("Create", id);
|
||||
}
|
||||
@@ -82,9 +80,9 @@ namespace Orchard.Indexing.Controllers {
|
||||
provider.CreateIndex(id);
|
||||
Services.Notifier.Information(T("Index named {0} created successfully", id));
|
||||
}
|
||||
catch(Exception e) {
|
||||
catch (Exception e) {
|
||||
Services.Notifier.Error(T("An error occurred while creating the index: {0}", id));
|
||||
Logger.Error("An error occurred while creatign the index " + id, e);
|
||||
Logger.Error("An error occurred while creating the index " + id, e);
|
||||
return View("Create", id);
|
||||
}
|
||||
|
||||
@@ -96,7 +94,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_indexingService.UpdateIndex(id);
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.UpdateIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@@ -106,7 +109,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_indexingService.RebuildIndex(id);
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.RebuildIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@@ -116,7 +124,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_indexingService.DeleteIndex(id);
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.DeleteIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Indexing.Helpers {
|
||||
public static class IndexingHelpers {
|
||||
public static bool IsValidIndexName(string name) =>
|
||||
!string.IsNullOrWhiteSpace(name) && name.ToSafeName() == name;
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Commands\IndexingCommands.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Helpers\IndexingHelpers.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Handlers\CreateIndexingTaskHandler.cs" />
|
||||
<Compile Include="Handlers\InfosetFieldIndexingHandler.cs" />
|
||||
@@ -180,4 +181,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1101,17 +1101,17 @@ html.dyn #submit-pager, html.dyn .apply-bulk-actions-auto { display:none; }
|
||||
padding:0;
|
||||
}
|
||||
|
||||
fieldset.publish-button, fieldset.delete-button, fieldset.save-button {
|
||||
fieldset.publish-button, fieldset.delete-button, fieldset.save-button, fieldset.unpublish-button {
|
||||
clear:none;
|
||||
float:left;
|
||||
}
|
||||
fieldset.save-button {
|
||||
clear:left;
|
||||
}
|
||||
fieldset.publish-button {
|
||||
fieldset.publish-button, fieldset.unpublish-button {
|
||||
margin: 0 12px 0 0;
|
||||
padding: 0 12px;
|
||||
border-right:1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
fieldset.delete-button {
|
||||
margin: 0 0 0 12px;
|
||||
|
||||
@@ -69,6 +69,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -1,98 +1,15 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Containers.Services;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Lists {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
private readonly IContainerService _containerService;
|
||||
private readonly 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; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.AddImageSet("list");
|
||||
|
||||
CreateListManagementMenuItem(builder);
|
||||
CreateListMenuItems(builder);
|
||||
}
|
||||
|
||||
private void CreateListManagementMenuItem(NavigationBuilder builder) {
|
||||
builder.Add(T("Lists"), "11", item => item
|
||||
.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()
|
||||
.Where(x => _authorizationService.TryCheckAccess(Orchard.Core.Contents.Permissions.EditContent, _workContextAccessor.GetContext().CurrentUser, x))
|
||||
.ToList();
|
||||
|
||||
foreach (var container in containers) {
|
||||
var closureContainer = container;
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(container.AdminMenuImageSet)) {
|
||||
builder.AddImageSet(container.AdminMenuImageSet.Trim());
|
||||
}
|
||||
|
||||
builder.Add(T(container.AdminMenuText), container.AdminMenuPosition, item => {
|
||||
var containedItems = _containerService.GetContentItems(closureContainer.Id, VersionOptions.Latest).ToList();
|
||||
var actualContainer = closureContainer;
|
||||
var position = 0;
|
||||
|
||||
// If the list has just a single item that happens to be a container itself,
|
||||
// we will treat that one as the actual container to provide a nice & quick way to manage that list.
|
||||
if (containedItems.Count == 1) {
|
||||
var containedItem = containedItems.First().As<ContainerPart>();
|
||||
|
||||
if (containedItem != null) {
|
||||
actualContainer = containedItem;
|
||||
foreach (var itemContentType in containedItem.ItemContentTypes) {
|
||||
var closureItemContentType = itemContentType;
|
||||
item.Add(T("New {0}", itemContentType.DisplayName), String.Format("1.{0}", position++), subItem => subItem
|
||||
.Action("Create", "Admin", new { id = closureItemContentType.Name, containerid = containedItem.Id, area = "Contents" }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var containerMetadata = _contentManager.GetItemMetadata(actualContainer);
|
||||
item.Action(containerMetadata.AdminRouteValues);
|
||||
|
||||
item.Action(containerMetadata.AdminRouteValues);
|
||||
item.AddClass("nav-list");
|
||||
item.AddClass(closureContainer.AdminMenuText.HtmlClassify());
|
||||
item.LinkToFirstChild(false);
|
||||
|
||||
foreach (var itemContentType in closureContainer.ItemContentTypes) {
|
||||
var closureItemContentType = itemContentType;
|
||||
item.Add(T("New {0}", itemContentType.DisplayName), String.Format("1.{0}", position++), subItem => subItem
|
||||
.Action("Create", "Admin", new { id = closureItemContentType.Name, containerid = container.Id, area = "Contents" }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public void GetNavigation(NavigationBuilder builder) =>
|
||||
builder
|
||||
.AddImageSet("lists")
|
||||
.Add(T("Lists"), "11", item => item
|
||||
.Action("Index", "Admin", new { area = "Orchard.Lists" }).Permission(Permissions.ManageLists));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
<Content Include="Styles\images\icons.png" />
|
||||
<Content Include="Styles\images\view.default.png" />
|
||||
<Content Include="Styles\images\view.condensed.png" />
|
||||
<Content Include="Styles\menu.lists-admin.css" />
|
||||
<Content Include="Styles\nprogress.css" />
|
||||
<Content Include="Scripts\nprogress.js" />
|
||||
<Content Include="Scripts\orchard-lists-admin.js" />
|
||||
@@ -143,16 +144,14 @@
|
||||
<Content Include="Scripts\orchard-lists-admin.min.js">
|
||||
<DependentUpon>orchard-lists-admin.js</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Styles\images\menu.list-definition.png" />
|
||||
<Content Include="Styles\images\menu.lists.png" />
|
||||
<Content Include="Styles\images\move.gif" />
|
||||
<Content Include="Styles\images\offline.gif" />
|
||||
<Content Include="Styles\images\online.gif" />
|
||||
<Content Include="Styles\list-admin.css" />
|
||||
<Content Include="Styles\images\menu.list.png" />
|
||||
<Content Include="Styles\list-admin.min.css">
|
||||
<DependentUpon>list-admin.css</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Styles\menu.list-admin.css" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config">
|
||||
@@ -272,4 +271,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,22 +0,0 @@
|
||||
.navicon-list,
|
||||
.navicon-lists,
|
||||
.section-new .subnavicon-list,
|
||||
.nav-list > h3 > a,
|
||||
.nav-list-definition > h3 > a {
|
||||
background-image:url(images/menu.list.png) !important;
|
||||
}
|
||||
|
||||
.navicon-list:hover,
|
||||
.navicon-lists:hover,
|
||||
.nav-list > h3 > a:hover,
|
||||
.nav-list-definition > h3 > a:hover {
|
||||
background-position:0 -30px !important;
|
||||
}
|
||||
|
||||
.navicon-lists {
|
||||
background-image:url(images/menu.list.png) !important;
|
||||
}
|
||||
|
||||
.navicon-lists:hover {
|
||||
background-position:0 -30px !important;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
.navicon-lists {
|
||||
background-image: url(images/menu.lists.png) !important;
|
||||
}
|
||||
|
||||
.navicon-lists:hover {
|
||||
background-position: 0 -30px !important;
|
||||
}
|
||||
@@ -17,12 +17,16 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
[Admin, Themed(false)]
|
||||
public class OEmbedController : Controller {
|
||||
private readonly IMediaLibraryService _mediaLibraryService;
|
||||
private readonly IOEmbedService _oEmbedService;
|
||||
|
||||
public OEmbedController(
|
||||
IOrchardServices services,
|
||||
IMediaLibraryService mediaManagerService) {
|
||||
_mediaLibraryService = mediaManagerService;
|
||||
IMediaLibraryService mediaManagerService,
|
||||
IOEmbedService oEmbedService) {
|
||||
|
||||
Services = services;
|
||||
_mediaLibraryService = mediaManagerService;
|
||||
_oEmbedService = oEmbedService;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@@ -78,39 +82,9 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
var webClient = new WebClient { Encoding = Encoding.UTF8 };
|
||||
try {
|
||||
// <link rel="alternate" href="http://vimeo.com/api/oembed.xml?url=http%3A%2F%2Fvimeo.com%2F23608259" type="text/xml+oembed">
|
||||
viewModel.Content = _oEmbedService.DownloadMediaData(url);
|
||||
|
||||
var source = webClient.DownloadString(url);
|
||||
|
||||
// seek type="text/xml+oembed" or application/xml+oembed
|
||||
var oembedSignature = source.IndexOf("type=\"text/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
if (oembedSignature == -1) {
|
||||
oembedSignature = source.IndexOf("type=\"application/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
if (oembedSignature != -1) {
|
||||
var tagStart = source.Substring(0, oembedSignature).LastIndexOf('<');
|
||||
var tagEnd = source.IndexOf('>', oembedSignature);
|
||||
var tag = source.Substring(tagStart, tagEnd - tagStart);
|
||||
var matches = new Regex("href=\"([^\"]+)\"").Matches(tag);
|
||||
if (matches.Count > 0) {
|
||||
var href = matches[0].Groups[1].Value;
|
||||
try {
|
||||
var content = webClient.DownloadString(Server.HtmlDecode(href));
|
||||
viewModel.Content = XDocument.Parse(content);
|
||||
}
|
||||
catch {
|
||||
// bubble exception
|
||||
}
|
||||
}
|
||||
}
|
||||
if (viewModel.Content == null) {
|
||||
viewModel.Content = new XDocument(
|
||||
new XDeclaration("1.0", "utf-8", "yes"),
|
||||
new XElement("oembed")
|
||||
);
|
||||
}
|
||||
var root = viewModel.Content.Root;
|
||||
if (!String.IsNullOrWhiteSpace(url)) {
|
||||
root.El("url", url);
|
||||
|
||||
@@ -200,7 +200,9 @@
|
||||
<Compile Include="Security\MediaAuthorizationEventHandler.cs" />
|
||||
<Compile Include="Services\IMediaLibraryService.cs" />
|
||||
<Compile Include="Providers\IMediaFolderProvider.cs" />
|
||||
<Compile Include="Services\IOEmbedService.cs" />
|
||||
<Compile Include="Services\MediaLibraryService.cs" />
|
||||
<Compile Include="Services\OEmbedService.cs" />
|
||||
<Compile Include="Services\Shapes.cs" />
|
||||
<Compile Include="Services\XmlRpcHandler.cs" />
|
||||
<Compile Include="Settings\MediaLibraryPickerFieldEditorEvents.cs" />
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Orchard.MediaLibrary.Services {
|
||||
public interface IOEmbedService : IDependency {
|
||||
XDocument DownloadMediaData(string url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Orchard.MediaLibrary.Services {
|
||||
public class OEmbedService : IOEmbedService {
|
||||
public XDocument DownloadMediaData(string url) {
|
||||
var webClient = new WebClient { Encoding = Encoding.UTF8 };
|
||||
XDocument doc = null;
|
||||
try {
|
||||
// <link rel="alternate" href="http://vimeo.com/api/oembed.xml?url=http%3A%2F%2Fvimeo.com%2F23608259" type="text/xml+oembed">
|
||||
var source = webClient.DownloadString(url);
|
||||
|
||||
// seek type="text/xml+oembed" or application/xml+oembed
|
||||
var oembedSignature = source.IndexOf("type=\"text/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
if (oembedSignature == -1) {
|
||||
oembedSignature = source.IndexOf("type=\"application/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
if (oembedSignature != -1) {
|
||||
var tagStart = source.Substring(0, oembedSignature).LastIndexOf('<');
|
||||
var tagEnd = source.IndexOf('>', oembedSignature);
|
||||
var tag = source.Substring(tagStart, tagEnd - tagStart);
|
||||
var matches = new Regex("href=\"([^\"]+)\"").Matches(tag);
|
||||
if (matches.Count > 0) {
|
||||
var href = matches[0].Groups[1].Value;
|
||||
try {
|
||||
var content = webClient.DownloadString(HttpUtility.HtmlDecode(href));
|
||||
doc = XDocument.Parse(content);
|
||||
} catch {
|
||||
// bubble exception
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
doc = null;
|
||||
}
|
||||
|
||||
if (doc == null) {
|
||||
doc = new XDocument(
|
||||
new XDeclaration("1.0", "utf-8", "yes"),
|
||||
new XElement("oembed")
|
||||
);
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,9 @@ using StackExchange.Redis;
|
||||
using System;
|
||||
|
||||
namespace Orchard.Redis.Caching {
|
||||
|
||||
[OrchardFeature("Orchard.Redis.Caching")]
|
||||
[OrchardSuppressDependency("Orchard.Caching.Services.DefaultCacheStorageProvider")]
|
||||
public class RedisCacheStorageProvider : Component, ICacheStorageProvider {
|
||||
public class RedisCacheStorageProvider : Component, ICacheStorageProviderWithKeyPrefix {
|
||||
public const string ConnectionStringKey = "Orchard.Redis.Cache";
|
||||
|
||||
private readonly ShellSettings _shellSettings;
|
||||
@@ -61,6 +60,10 @@ namespace Orchard.Redis.Caching {
|
||||
_connectionMultiplexer.KeyDeleteWithPrefix(GetLocalizedKey("*"));
|
||||
}
|
||||
|
||||
public void Clear(string key) {
|
||||
_connectionMultiplexer.KeyDeleteWithPrefix(GetLocalizedKey($"{_shellSettings.Name}:{key}"));
|
||||
}
|
||||
|
||||
private string GetLocalizedKey(string key) {
|
||||
return _shellSettings.Name + ":Cache:" + key;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -33,30 +33,25 @@ namespace Orchard.Widgets.Drivers {
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Widgets.LayerPart", Model: layerPart, Prefix: Prefix))
|
||||
};
|
||||
|
||||
if (layerPart.Id > 0)
|
||||
results.Add(ContentShape("Widget_DeleteButton",
|
||||
deleteButton => deleteButton));
|
||||
|
||||
return Combined(results.ToArray());
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
if(updater.TryUpdateModel(layerPart, Prefix, null, null)) {
|
||||
if (updater.TryUpdateModel(layerPart, Prefix, null, null)) {
|
||||
if (String.IsNullOrWhiteSpace(layerPart.LayerRule)) {
|
||||
layerPart.LayerRule = "true";
|
||||
}
|
||||
|
||||
if (_widgetsService.GetLayers()
|
||||
.Any(l =>
|
||||
.Any(l =>
|
||||
l.Id != layerPart.Id
|
||||
&& String.Equals(l.Name, layerPart.Name, StringComparison.InvariantCultureIgnoreCase))) {
|
||||
&& String.Equals(l.Name, layerPart.Name, StringComparison.InvariantCultureIgnoreCase))) {
|
||||
updater.AddModelError("Name", T("A Layer with the same name already exists"));
|
||||
}
|
||||
|
||||
try {
|
||||
_conditionManager.Matches(layerPart.LayerRule);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
updater.AddModelError("Description", T("The rule is not valid: {0}", e.Message));
|
||||
}
|
||||
}
|
||||
@@ -82,7 +77,7 @@ namespace Orchard.Widgets.Drivers {
|
||||
|
||||
var rule = context.Attribute(part.PartDefinition.Name, "LayerRule");
|
||||
if (rule != null) {
|
||||
part.LayerRule = rule;
|
||||
part.LayerRule = rule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,26 +35,22 @@ namespace Orchard.Widgets.Drivers {
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Widgets.WidgetPart", Model: widgetPart, Prefix: Prefix))
|
||||
};
|
||||
|
||||
if (widgetPart.Id > 0)
|
||||
results.Add(ContentShape("Widget_DeleteButton",
|
||||
deleteButton => deleteButton));
|
||||
|
||||
return Combined(results.ToArray());
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(widgetPart, Prefix, null, null);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(widgetPart.Title)) {
|
||||
if (string.IsNullOrWhiteSpace(widgetPart.Title)) {
|
||||
updater.AddModelError("Title", T("Title can't be empty."));
|
||||
}
|
||||
|
||||
|
||||
// if there is a name, ensure it's unique
|
||||
if(!string.IsNullOrWhiteSpace(widgetPart.Name)) {
|
||||
if (!string.IsNullOrWhiteSpace(widgetPart.Name)) {
|
||||
widgetPart.Name = widgetPart.Name.ToHtmlName();
|
||||
|
||||
var widgets = _contentManager.Query<WidgetPart, WidgetPartRecord>().Where(x => x.Name == widgetPart.Name && x.Id != widgetPart.Id).Count();
|
||||
if(widgets > 0) {
|
||||
if (widgets > 0) {
|
||||
updater.AddModelError("Name", T("A Widget with the same Name already exists."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,9 +207,6 @@
|
||||
<Content Include="Views\EditorTemplates\Parts.Widgets.LayerPart.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts.Widgets.WidgetPart.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Widget.DeleteButton.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<Placement>
|
||||
<Place Widget_DeleteButton="Sidebar:25"/>
|
||||
<Place Parts_Widgets_LayerPart="Content:1"/>
|
||||
<Place Parts_Widgets_WidgetPart="Content:1"/>
|
||||
<Place Parts_Widgets_WidegetBagPart="Content:5"/>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<fieldset class="delete-button">
|
||||
<button type="submit" name="submit.Delete" value="@T("Delete")" itemprop="RemoveUrl">@T("Delete")</button>
|
||||
</fieldset>
|
||||
@@ -68,6 +68,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -70,6 +70,18 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -88,8 +88,8 @@
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
@@ -100,19 +100,19 @@
|
||||
<HintPath>..\..\lib\sqlce\System.Data.SqlServerCe.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -91,6 +91,22 @@
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
|
||||
@@ -227,6 +227,26 @@
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<!-- Registering Roslyn as a compiler for Dynamic Compilation. -->
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
<package id="Npgsql" version="4.0.17" targetFramework="net48" />
|
||||
<package id="Orchard.NuGet.Core" version="1.1.0.0" targetFramework="net48" />
|
||||
<package id="Owin" version="1.0" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
|
||||
</packages>
|
||||
16
src/Orchard/Data/Conventions/LazyLoadConvention.cs
Normal file
16
src/Orchard/Data/Conventions/LazyLoadConvention.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
|
||||
namespace Orchard.Data.Conventions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class LazyLoadAttribute : Attribute {
|
||||
}
|
||||
|
||||
public class LazyLoadConvention : AttributePropertyConvention<LazyLoadAttribute> {
|
||||
protected override void Apply(LazyLoadAttribute attribute, IPropertyInstance instance) {
|
||||
instance.LazyLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,6 +147,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
||||
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
||||
<Compile Include="Data\Conventions\LazyLoadConvention.cs" />
|
||||
<Compile Include="Data\MapAsRecordAttribute.cs" />
|
||||
<Compile Include="Data\Migration\Interpreters\PostgreSqlCommandInterpreter.cs" />
|
||||
<Compile Include="DisplayManagement\Descriptors\ShapePlacementStrategy\DefaultPlacementParseMatchProviders.cs" />
|
||||
|
||||
Reference in New Issue
Block a user