mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Starting the new queried content list module.
Everything for the new part, content type and widget are there except for what makes them useful (back-end logic & data and complete shape templates) --HG-- branch : dev
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentQueries.Models;
|
||||
|
||||
namespace Orchard.ContentQueries.Drivers {
|
||||
public class ContentQueryPartDriver : ContentPartDriver<ContentQueryPart> {
|
||||
protected override DriverResult Display(ContentQueryPart part, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_QueriedContents",
|
||||
list => {
|
||||
var contentItems = shapeHelper.List();
|
||||
//contentItems.AddRange(theContentItems);
|
||||
|
||||
list.ContentItems(contentItems);
|
||||
|
||||
if (true) // pager
|
||||
list.Pager(/* pager configuration */);
|
||||
|
||||
return list;
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentQueryPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_ContentQueries_Configuration",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/ContentQueries.Configuration", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentQueryPart part, ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
}
|
||||
}
|
33
src/Orchard.Web/Modules/Orchard.ContentQueries/Migrations.cs
Normal file
33
src/Orchard.Web/Modules/Orchard.ContentQueries/Migrations.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.ContentQueries {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
public int Create() {
|
||||
//SchemaBuilder.CreateTable("ContentQueryPartRecord",
|
||||
// table => table
|
||||
// .ContentPartRecord()
|
||||
// );
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("ContentQuery",
|
||||
cfg => cfg
|
||||
.WithPart("ContentQueryPart")
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("RoutePart")
|
||||
.WithPart("MenuPart")
|
||||
.Creatable()
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("ContentQueryWidget",
|
||||
cfg => cfg
|
||||
.WithPart("ContentQueryPart")
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("WidgetPart")
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.ContentQueries.Models {
|
||||
public class ContentQueryPart : ContentPart<ContentQueryPartRecord> {}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.ContentQueries.Models {
|
||||
public class ContentQueryPartRecord : ContentPartRecord {}
|
||||
}
|
12
src/Orchard.Web/Modules/Orchard.ContentQueries/Module.txt
Normal file
12
src/Orchard.Web/Modules/Orchard.ContentQueries/Module.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
Name: Content Queries
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 0.8.0
|
||||
OrchardVersion: 0.8.0
|
||||
Features:
|
||||
Orchard.ContentQueries:
|
||||
Name: Queried Content Lists
|
||||
Description: Use simple queries to create orderd lists of content items with optional paging support.
|
||||
Dependencies: Contents
|
||||
Category: Content
|
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{848126A0-9C88-415A-868F-F5F03449D0B6}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.ContentQueries</RootNamespace>
|
||||
<AssemblyName>Orchard.ContentQueries</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Mvc">
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drivers\ContentQueryPartDriver.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Models\ContentQueryPart.cs" />
|
||||
<Compile Include="Models\ContentQueryPartRecord.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Placement.info">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Views\EditorTemplates\Parts\ContentQueries.Configuration.cshtml" />
|
||||
<None Include="Views\Parts\QueriedContents.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>57372</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
@@ -0,0 +1,19 @@
|
||||
<Placement>
|
||||
<!-- available display shapes -->
|
||||
<!--
|
||||
Parts_QueriedContents
|
||||
-->
|
||||
<!-- edit "shape" -->
|
||||
<Place Parts_ContentQueries_Configuration="Primary:2"/>
|
||||
<!-- default positioning -->
|
||||
<Match ContentType="ContentQuery">
|
||||
<Match DisplayType="Detail">
|
||||
<Place Parts_QueriedContents="Content"/>
|
||||
</Match>
|
||||
</Match>
|
||||
<Match ContentType="ContentQueryWidget">
|
||||
<Match DisplayType="Detail">
|
||||
<Place Parts_QueriedContents="Content"/>
|
||||
</Match>
|
||||
</Match>
|
||||
</Placement>
|
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.ContentQueries")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0003600f-7634-43b0-9a63-68ee7c247db3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.8.0")]
|
||||
[assembly: AssemblyFileVersion("0.8.0")]
|
@@ -0,0 +1 @@
|
||||
<p>content query config here -> x</p>
|
@@ -0,0 +1,14 @@
|
||||
@{
|
||||
IEnumerable<object> queriedContents = Model.ContentItems;
|
||||
Model.ContentItems.Classes.Add("content-items");
|
||||
Model.ContentItems.Classes.Add("queried-contents");
|
||||
}
|
||||
@if (queriedContents != null && queriedContents.Count() > 0) {
|
||||
@Display(Model.ContentItems)
|
||||
if (Model.Pager != null) {
|
||||
@Display(Model.Pager)
|
||||
}
|
||||
}
|
||||
else {
|
||||
<p>@T("There are no contents.")</p>
|
||||
}
|
32
src/Orchard.Web/Modules/Orchard.ContentQueries/Web.config
Normal file
32
src/Orchard.Web/Modules/Orchard.ContentQueries/Web.config
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35, processorArchitecture=MSIL"/>
|
||||
</assemblies>
|
||||
</compilation>
|
||||
|
||||
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web>
|
||||
<system.web.extensions/>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@@ -94,7 +94,8 @@ namespace Orchard.Setup.Services {
|
||||
"Orchard.Tags",
|
||||
"Orchard.Media",
|
||||
"Orchard.Widgets",
|
||||
"Orchard.jQuery"
|
||||
"Orchard.jQuery",
|
||||
"Orchard.ContentQueries"
|
||||
};
|
||||
|
||||
context.EnabledFeatures = hardcoded;
|
||||
|
@@ -93,6 +93,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Themes", "Orchard.Web\Theme
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.PublishLater", "Orchard.Web\Modules\Orchard.PublishLater\Orchard.PublishLater.csproj", "{C889167C-E52C-4A65-A419-224B3D1B957D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentQueries", "Orchard.Web\Modules\Orchard.ContentQueries\Orchard.ContentQueries.csproj", "{848126A0-9C88-415A-868F-F5F03449D0B6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CodeCoverage|Any CPU = CodeCoverage|Any CPU
|
||||
@@ -492,6 +494,16 @@ Global
|
||||
{C889167C-E52C-4A65-A419-224B3D1B957D}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{C889167C-E52C-4A65-A419-224B3D1B957D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C889167C-E52C-4A65-A419-224B3D1B957D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -521,6 +533,7 @@ Global
|
||||
{AB3C207C-0126-4143-8D62-1119DF80D366} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{C889167C-E52C-4A65-A419-224B3D1B957D} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{848126A0-9C88-415A-868F-F5F03449D0B6} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
|
Reference in New Issue
Block a user