Orchard.MetaData module now known as Orchard.ContentTypes

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-07-04 14:15:50 -07:00
parent 7e9c238847
commit 25c35ece69
12 changed files with 0 additions and 564 deletions

View File

@@ -1,21 +0,0 @@

using Orchard.Localization;
using Orchard.UI.Navigation;
namespace Orchard.MetaData {
public class AdminMenu : INavigationProvider {
public Localizer T { get; set; }
public string MenuName { get { return "admin"; } }
public void GetNavigation(NavigationBuilder builder)
{
builder.Add(T("Site Configuration"), "11",
menu => menu
.Add(T("Content Types (metadata)"), "3.1", item => item.Action("ContentTypeList", "Admin", new { area = "Orchard.MetaData" }).Permission(Permissions.ManageMetaData))
);
}
}
}

View File

@@ -1,82 +0,0 @@
using System.Web.Mvc;
using Orchard.ContentManagement.MetaData;
using Orchard.Localization;
using Orchard.MetaData.ViewModels;
namespace Orchard.MetaData.Controllers {
public class AdminController : Controller {
private readonly IContentDefinitionManager _contentDefinitionManager;
public IOrchardServices Services { get; set; }
public AdminController(IOrchardServices services, IContentDefinitionManager contentDefinitionManager) {
_contentDefinitionManager = contentDefinitionManager;
Services = services;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
//
// GET: /ContentTypeList/
public ActionResult ContentTypeList(string id) {
if (!Services.Authorizer.Authorize(Permissions.ManageMetaData, T("Not allowed to manage MetaData")))
return new HttpUnauthorizedResult();
var contentTypes = _contentDefinitionManager.ListTypeDefinitions();
var contentParts = _contentDefinitionManager.ListPartDefinitions();
var model = new ContentTypesIndexViewModel();
foreach (var contentType in contentTypes) {
var contentTypeEntry = new ContentTypeEntry { Name = contentType.Name, DisplayName = contentType.Name };
if (contentType.Name == id) {
foreach (var contentTypePartNameRecord in contentParts) {
var contentTypePartEntry = new ContentTypePartEntry { Name = contentTypePartNameRecord.Name };
foreach (var contentTypePartEntryTest in contentType.Parts) {
if (contentTypePartEntryTest.PartDefinition.Name == contentTypePartEntry.Name) {
contentTypePartEntry.Selected = true;
}
}
model.ContentTypeParts.Add(contentTypePartEntry);
}
model.SelectedContentType = contentTypeEntry;
}
model.ContentTypes.Add(contentTypeEntry);
}
return View(model);
}
//
// POST: /ContentTypeList/Save
[HttpPost]
public ActionResult Save(string id, FormCollection collection) {
if (!Services.Authorizer.Authorize(Permissions.ManageMetaData, T("Not allowed to manage MetaData")))
return new HttpUnauthorizedResult();
var existingDefinition = _contentDefinitionManager.GetTypeDefinition(id);
_contentDefinitionManager.AlterTypeDefinition(id, alter => {
foreach(var part in existingDefinition.Parts) {
alter.RemovePart(part.PartDefinition.Name);
}
foreach (var formKey in collection.AllKeys) {
if (formKey.Contains("part_")) {
var partName = formKey.Replace("part_", "");
alter.WithPart(partName);
}
}
});
return RedirectToAction("ContentTypeList", new { id });
}
}
}

View File

@@ -1,8 +0,0 @@
name: MetaData
antiforgery: enabled
description: The MetaData module enables the management of the content type meta data, which describes how content types are built from parts and parts from fields.
features:
Orchard.MetaData:
Description: Module for managing Orchard MetaData
Dependencies: Common, XmlRpc
Category: MetaData

View File

@@ -1,120 +0,0 @@
<?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>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{23E04990-2A8D-41B8-9908-6DDB71EA3B23}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.MetaData</RootNamespace>
<AssemblyName>Orchard.MetaData</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</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>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</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>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\ContentTypesViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Web.config" />
<Content Include="Views\Admin\ContentTypeList.ascx" />
</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>
<Content Include="Styles\ContentTypes.css" />
<Content Include="Views\Web.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>33002</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -1,33 +0,0 @@
using System.Collections.Generic;
using Orchard.Security.Permissions;
namespace Orchard.MetaData {
public class Permissions : IPermissionProvider {
public static readonly Permission ManageMetaData = new Permission { Description = "Manage MetaData", Name = "ManageMetaData" };//q: Should edit_MetaData be ManageMetaData?
public string ModuleName {
get {
return "MetaData";
}
}
public IEnumerable<Permission> GetPermissions() {
return new Permission[] {
ManageMetaData,
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return new[] {
new PermissionStereotype {
Name = "Administrator",
Permissions = new[] {ManageMetaData}
},
};
}
}
}

View File

@@ -1,34 +0,0 @@
using System.Reflection;
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.MetaData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Orchard")]
[assembly: AssemblyCopyright("Copyright © CodePlex Foundation 2009")]
[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("9b958fbe-1d0d-4975-9a1b-7e3ff5bed510")]
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,35 +0,0 @@

.ContentTypeList
{
width: 100px;
float:left;
}
.ContentTypePartList
{
width: 200px;
float: left;
margin-left: 20px;
}
.ContentTypePartListRow
{
height:5px;
padding:0px;
}
.ContentTypePartListRowItem
{
background:#EAEAEA;
padding:0px;
vertical-align:top;
margin:1px;
padding-top: 5px;
}
.SelectedContentPart {
background:#D1F2A5;
border-color:#BCD994;
}
.UnSelectedContentPart {
background:#EAEAEA;
border-color:#CCC;
}

View File

@@ -1,31 +0,0 @@
using System.Collections.Generic;
using Orchard.Mvc.ViewModels;
namespace Orchard.MetaData.ViewModels
{
public class ContentTypesIndexViewModel : BaseViewModel {
public IList<ContentTypeEntry> ContentTypes { get; set; }
public IList<ContentTypePartEntry> ContentTypeParts { get; set; }
public ContentTypesIndexViewModel() {
ContentTypes=new List<ContentTypeEntry>();
ContentTypeParts = new List<ContentTypePartEntry>();
}
public ContentTypeEntry SelectedContentType { get; set; }
}
public class ContentTypeEntry {
public string Name { get; set; }
public string DisplayName { get; set; }
public IList<ContentTypePartEntry> ContentTypeParts { get; set; }
public ContentTypeEntry(){
ContentTypeParts = new List<ContentTypePartEntry>();
}
}
public class ContentTypePartEntry {
public string Name { get; set; }
public bool Selected { get; set; }
}
}

View File

@@ -1,79 +0,0 @@

<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentTypesIndexViewModel>" %>
<%@ Import Namespace="Orchard.MetaData.ViewModels"%>
<% Html.RegisterStyle("ContentTypes.css"); %>
<div class="ContentTypeList">
<table>
<tr>
<th>
Content Types
</th>
</tr>
<% foreach (var item in Model.ContentTypes) { %>
<%
var contentTypeClass = "";
if (Model.SelectedContentType!=null && Model.SelectedContentType.Name == item.Name)
{
contentTypeClass = "SelectedContentPart";
}else{
contentTypeClass = "UnSelectedContentPart";
}
%>
<tr class="<%=contentTypeClass %>">
<td>
<%: Html.ActionLink(string.IsNullOrWhiteSpace(item.Name) ? "unkwn" : item.Name, "ContentTypeList", new {id=item.Name})%>
</td>
</tr>
<% } %>
</table>
</div>
<%if (Model.SelectedContentType!=null) {%>
<div class="ContentTypePartList">
<table>
<tr>
<th>
</th>
<th>
Included Content Part
</th>
</tr>
<%
using (Html.BeginFormAntiForgeryPost(Url.Action("Save",new {id=Model.SelectedContentType.Name}))) { %>
<% foreach (var item in Model.ContentTypeParts) { %>
<tr class="ContentTypePartListRow">
<td class="ContentTypePartListRowItem">
<%if (item.Selected)
{%>
<input name="<%="part_" + item.Name%>" type="checkbox" checked="checked" /><%}
else {%>
<input name="<%="part_" + item.Name%>" type="checkbox" /><%}%>
</td>
<td class="ContentTypePartListRowItem">
<%: item.Name%>
</td>
</tr>
<% } %>
</table>
<p>
<input type="submit" value="<%: T("Save") %>" />
</p>
<% } %>
</div>
<%} %>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<add path="*" verb="*"
type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
</handlers>
</system.webServer>
</configuration>

View File

@@ -1,80 +0,0 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<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"/>
<add namespace="Orchard.Mvc"/>
</namespaces>
</pages>
<httpHandlers>
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
</system.web>
<system.web.extensions/>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="MvcHttpHandler"/>
<remove name="UrlRoutingHandler"/>
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -63,8 +63,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.MetaData", "Orchard.Web\Modules\Orchard.MetaData\Orchard.MetaData.csproj", "{23E04990-2A8D-41B8-9908-6DDB71EA3B23}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Search", "Orchard.Web\Modules\Orchard.Search\Orchard.Search.csproj", "{4BE4EB01-AC56-4048-924E-2CA77F509ABA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Indexing", "Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj", "{EA2B9121-EF54-40A6-A53E-6593C86EE696}"
@@ -187,10 +185,6 @@ Global
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.Build.0 = Release|Any CPU
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Release|Any CPU.Build.0 = Release|Any CPU
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -226,7 +220,6 @@ Global
{72457126-E118-4171-A08F-9A709EE4B7FC} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{CDE24A24-01D3-403C-84B9-37722E18DFB7} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{17F86780-9A1F-4AA1-86F1-875EEC2730C7} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{23E04990-2A8D-41B8-9908-6DDB71EA3B23} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{0E7646E8-FE8F-43C1-8799-D97860925EC4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}