Adding orchard.experimental and removing orchard.devtools

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues 2010-09-29 16:15:41 -07:00
parent d0d60f2c1f
commit 145ed957c4
54 changed files with 166 additions and 810 deletions

View File

@ -0,0 +1,15 @@
using NUnit.Framework;
using Orchard.CodeGeneration.Commands;
using Orchard.Environment.Extensions;
namespace Orchard.Tests.Modules.CodeGeneration.Commands {
[TestFixture]
public class CodeGenerationCommandsTests {
[Test]
public void CreateDataMigrationTest() {
//ExtensionManager extensionManager = new ExtensionManager();
//CodeGenerationCommands codeGenerationCommands = new CodeGenerationCommands();
}
}
}

View File

@ -1,211 +0,0 @@
using System;
using System.IO;
using System.Linq;
using System.Web.Hosting;
using Orchard.Commands;
using Orchard.Data.Migration.Generator;
using Orchard.DevTools.Services;
using Orchard.Environment.Extensions;
namespace Orchard.DevTools.Commands {
[OrchardFeature("Scaffolding")]
public class ScaffoldingCommands : DefaultOrchardCommandHandler {
private readonly IExtensionManager _extensionManager;
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
public ScaffoldingCommands(
IExtensionManager extensionManager,
ISchemaCommandGenerator schemaCommandGenerator) {
_extensionManager = extensionManager;
_schemaCommandGenerator = schemaCommandGenerator;
}
[OrchardSwitch]
public bool IncludeInSolution { get; set; }
[CommandHelp("scaffolding create datamigration <feature-name> \r\n\t" + "Create a new Data Migration class")]
[CommandName("scaffolding create datamigration")]
public void CreateDataMigration(string featureName) {
Context.Output.WriteLine(T("Creating Data Migration for {0}", featureName));
foreach ( var extension in _extensionManager.AvailableExtensions() ) {
if ( extension.ExtensionType == "Module" && extension.Features.Any(f => String.Equals(f.Name, featureName, StringComparison.OrdinalIgnoreCase)) ) {
string dataMigrationsPath = HostingEnvironment.MapPath("~/Modules/" + extension.Name + "/DataMigrations/");
string dataMigrationPath = dataMigrationsPath + extension.DisplayName + "DataMigration.cs";
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard.DevTools/ScaffoldingTemplates/");
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extension.Name));
if ( !Directory.Exists(dataMigrationsPath) ) {
Directory.CreateDirectory(dataMigrationsPath);
}
if ( File.Exists(dataMigrationPath) ) {
Context.Output.WriteLine(T("Data migration already exists in target Module {0}.", extension.Name));
return;
}
var commands = _schemaCommandGenerator.GetCreateFeatureCommands(featureName, false).ToList();
var stringWriter = new StringWriter();
var interpreter = new ScaffoldingCommandInterpreter(stringWriter);
foreach ( var command in commands ) {
interpreter.Visit(command);
stringWriter.WriteLine();
}
string dataMigrationText = File.ReadAllText(templatesPath + "DataMigration.txt");
dataMigrationText = dataMigrationText.Replace("$$FeatureName$$", featureName);
dataMigrationText = dataMigrationText.Replace("$$ClassName$$", extension.DisplayName);
dataMigrationText = dataMigrationText.Replace("$$Commands$$", stringWriter.ToString());
File.WriteAllText(dataMigrationPath, dataMigrationText);
string projectFileText = File.ReadAllText(moduleCsProjPath);
// The string searches in solution/project files can be made aware of comment lines.
if ( projectFileText.Contains("<Compile Include") ) {
string compileReference = string.Format("<Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extension.DisplayName + "DataMigration.cs");
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("<Compile Include"), compileReference);
}
else {
string itemGroupReference = string.Format("</ItemGroup>\r\n <ItemGroup>\r\n <Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extension.DisplayName + "DataMigration.cs");
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("</ItemGroup>"), itemGroupReference);
}
File.WriteAllText(moduleCsProjPath, projectFileText);
TouchSolution();
Context.Output.WriteLine(T("Data migration created successfully in Module {0}", extension.Name));
return;
}
}
Context.Output.WriteLine(T("Creating data migration failed: target Feature {0} could not be found.", featureName));
}
[CommandHelp("scaffolding create module <module-name> [/IncludeInSolution:true|false]\r\n\t" + "Create a new Orchard module")]
[CommandName("scaffolding create module")]
[OrchardSwitches("IncludeInSolution")]
public void CreateModule(string moduleName) {
Context.Output.WriteLine(T("Creating Module {0}", moduleName));
if ( _extensionManager.AvailableExtensions().Any(extension => extension.ExtensionType == "Module" && String.Equals(moduleName, extension.DisplayName, StringComparison.OrdinalIgnoreCase)) ) {
Context.Output.WriteLine(T("Creating Module {0} failed: a module of the same name already exists", moduleName));
return;
}
IntegrateModule(moduleName);
Context.Output.WriteLine(T("Module {0} created successfully", moduleName));
}
[CommandHelp("scaffolding create controller <module-name> <controller-name>\r\n\t" + "Create a new Orchard controller in a module")]
[CommandName("scaffolding create controller")]
public void CreateController(string moduleName, string controllerName) {
Context.Output.WriteLine(T("Creating Controller {0} in Module {1}", controllerName, moduleName));
foreach (var extension in _extensionManager.AvailableExtensions()) {
if (extension.ExtensionType == "Module" && String.Equals(moduleName, extension.DisplayName, StringComparison.OrdinalIgnoreCase)) {
string moduleControllersPath = HostingEnvironment.MapPath("~/Modules/" + extension.Name + "/Controllers/");
string controllerPath = moduleControllersPath + controllerName + ".cs";
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extension.Name));
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard.DevTools/ScaffoldingTemplates/");
if (!Directory.Exists(moduleControllersPath)) {
Directory.CreateDirectory(moduleControllersPath);
}
if (File.Exists(controllerPath)) {
Context.Output.WriteLine(T("Controller {0} already exists in target Module {1}.", controllerName, moduleName));
return;
}
string controllerText = File.ReadAllText(templatesPath + "Controller.txt");
controllerText = controllerText.Replace("$$ModuleName$$", moduleName);
controllerText = controllerText.Replace("$$ControllerName$$", controllerName);
File.WriteAllText(controllerPath, controllerText);
string projectFileText = File.ReadAllText(moduleCsProjPath);
// The string searches in solution/project files can be made aware of comment lines.
if (projectFileText.Contains("<Compile Include")) {
string compileReference = string.Format("<Compile Include=\"{0}\" />\r\n ", "Controllers\\" + controllerName + ".cs");
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("<Compile Include"), compileReference);
}
else {
string itemGroupReference = string.Format("</ItemGroup>\r\n <ItemGroup>\r\n <Compile Include=\"{0}\" />\r\n ", "Controllers\\" + controllerName + ".cs");
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("</ItemGroup>"), itemGroupReference);
}
File.WriteAllText(moduleCsProjPath, projectFileText);
Context.Output.WriteLine(T("Controller {0} created successfully in Module {1}", controllerName, moduleName));
TouchSolution();
return;
}
}
Context.Output.WriteLine(T("Creating Controller {0} failed: target Module {1} could not be found.", controllerName, moduleName));
}
private void IntegrateModule(string moduleName) {
string rootWebProjectPath = HostingEnvironment.MapPath("~/Orchard.Web.csproj");
string projectGuid = Guid.NewGuid().ToString().ToUpper();
CreateFilesFromTemplates(moduleName, projectGuid);
// The string searches in solution/project files can be made aware of comment lines.
if (IncludeInSolution) {
// Add project to Orchard.sln
string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln";
if (File.Exists(solutionPath)) {
string projectReference = string.Format(
"EndProject\r\nProject(\"{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}\") = \"{0}\", \"Orchard.Web\\Modules\\{0}\\{0}.csproj\", \"{{{1}}}\"\r\n",
moduleName, projectGuid);
string projectConfiguationPlatforms = string.Format(
"GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{{{0}}}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{{{0}}}.Release|Any CPU.Build.0 = Release|Any CPU\r\n",
projectGuid);
string solutionText = File.ReadAllText(solutionPath);
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference);
solutionText = solutionText.Replace("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n", projectConfiguationPlatforms);
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}\r\n\t");
File.WriteAllText(solutionPath, solutionText);
TouchSolution();
}
else {
Context.Output.WriteLine(T("Warning: Solution file could not be found at {0}", solutionPath));
}
}
}
private static void CreateFilesFromTemplates(string moduleName, string projectGuid) {
string modulePath = HostingEnvironment.MapPath("~/Modules/" + moduleName + "/");
string propertiesPath = modulePath + "Properties";
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard.DevTools/ScaffoldingTemplates/");
Directory.CreateDirectory(modulePath);
Directory.CreateDirectory(propertiesPath);
Directory.CreateDirectory(modulePath + "Controllers");
Directory.CreateDirectory(modulePath + "Views");
File.WriteAllText(modulePath + "\\Views\\Web.config", File.ReadAllText(templatesPath + "ViewsWebConfig.txt"));
Directory.CreateDirectory(modulePath + "Models");
Directory.CreateDirectory(modulePath + "Scripts");
string templateText = File.ReadAllText(templatesPath + "ModuleAssemblyInfo.txt");
templateText = templateText.Replace("$$ModuleName$$", moduleName);
templateText = templateText.Replace("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString());
File.WriteAllText(propertiesPath + "\\AssemblyInfo.cs", templateText);
File.WriteAllText(modulePath + "\\Web.config", File.ReadAllText(templatesPath + "ModuleWebConfig.txt"));
templateText = File.ReadAllText(templatesPath + "ModuleManifest.txt");
templateText = templateText.Replace("$$ModuleName$$", moduleName);
File.WriteAllText(modulePath + "\\Module.txt", templateText);
templateText = File.ReadAllText(templatesPath + "\\ModuleCsProj.txt");
templateText = templateText.Replace("$$ModuleName$$", moduleName);
templateText = templateText.Replace("$$ModuleProjectGuid$$", projectGuid);
File.WriteAllText(modulePath + "\\" + moduleName + ".csproj", templateText);
}
private void TouchSolution() {
string rootWebProjectPath = HostingEnvironment.MapPath("~/Orchard.Web.csproj");
string solutionPath = Directory.GetParent(rootWebProjectPath).Parent.FullName + "\\Orchard.sln";
if (!File.Exists(solutionPath)) {
Context.Output.WriteLine(T("Warning: Solution file could not be found at {0}", solutionPath));
return;
}
try {
File.SetLastWriteTime(solutionPath, DateTime.Now);
}
catch {
Context.Output.WriteLine(T("An unexpected error occured while trying to refresh the Visual Studio solution. Please reload it."));
}
}
}
}

View File

@ -1,39 +0,0 @@
using System;
using System.Web.Mvc;
using Orchard.Data.Migration.Generator;
using Orchard.Localization;
using Orchard.UI.Admin;
using Orchard.UI.Notify;
namespace Orchard.DevTools.Controllers {
[ValidateInput(false)]
[Admin]
public class DatabaseUpdateController : Controller {
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
public DatabaseUpdateController(ISchemaCommandGenerator schemaCommandGenerator, IOrchardServices orchardServices) {
_schemaCommandGenerator = schemaCommandGenerator;
Services = orchardServices;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public ActionResult Index() {
return View();
}
public ActionResult UpdateDatabase() {
try {
_schemaCommandGenerator.UpdateDatabase();
Services.Notifier.Information(T("Database updated successfuly"));
}
catch (Exception ex) {
Services.Notifier.Error(T("An error occured while updating the database: {0}", ex.Message));
}
return RedirectToAction("Index");
}
}
}

View File

@ -1,22 +0,0 @@
name: DevTools
antiforgery: enabled
author: The Orchard Team
website: http://orchardproject.net
version: 0.5.0
orchardversion: 0.5.0
description: This module is not activated by default and should only be used in a development environment. It contains various debugging and tracing tools that can display information about your content types.
features:
Orchard.DevTools:
Description: An assortment of debugging tools.
Category: Developer
Scaffolding:
Description: Tools to create Orchard components.
Category: Developer
Dependencies: Orchard.DevTools
Profiling:
Description: Tools to help profile Orchard.
Category: Developer
Dependencies: Orchard.DevTools
Orchard.DevTools.WebCommandLine:
Description: Enables site administrators to execute Orchard.exe commands via web interface
Category: Developer

View File

@ -1,16 +0,0 @@
using System.Web.Mvc;
using Orchard.Localization;
using Orchard;
namespace $$ModuleName$$.Controllers {
public class $$ControllerName$$ : Controller {
public IOrchardServices Services { get; set; }
public $$ControllerName$$(IOrchardServices services) {
Services = services;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace $$FeatureName$$.DataMigrations {
public class $$ClassName$$DataMigration : DataMigrationImpl {
public int Create() {
$$Commands$$
return 1;
}
}
}

View File

@ -1,34 +0,0 @@
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("$$ModuleName$$")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[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("$$ModuleTypeLibGuid$$")]
// 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,130 +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>{$$ModuleProjectGuid$$}</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>$$ModuleName$$</RootNamespace>
<AssemblyName>$$ModuleName$$</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=3.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="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
<Folder Include="Models\" />
<Folder Include="Scripts\" />
<Folder Include="Content\" />
</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>
<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" DependsOnTargets="AfterBuildCompiler">
<PropertyGroup>
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
</PropertyGroup>
<!-- If this is an area child project, uncomment the following line:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
-->
<!-- If this is an area parent project, uncomment the following lines:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
-->
</Target>
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>45979</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,10 +0,0 @@
name: $$ModuleName$$
antiforgery: enabled
author: The Orchard Team
website: http://orchardproject.net
version: 0.5.0
orchardversion: 0.5.0
description: Description for the module
features:
$$ModuleName$$:
Description: Description for feature $$ModuleName$$.

View File

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</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/>
</configuration>

View File

@ -1,112 +0,0 @@
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using Orchard.Data.Migration.Interpreters;
using Orchard.Data.Migration.Schema;
namespace Orchard.DevTools.Services {
public class ScaffoldingCommandInterpreter : AbstractDataMigrationInterpreter {
private readonly TextWriter _output;
public ScaffoldingCommandInterpreter(TextWriter output) {
_output = output;
}
public override void Visit(CreateTableCommand command) {
_output.WriteLine("\t\t\t// Creating table {0}", command.Name);
_output.WriteLine("\t\t\tSchemaBuilder.CreateTable(\"{0}\", table => table", command.Name);
var matchContentPartRecord = command.TableCommands.OfType<CreateColumnCommand>().Any(
c =>
c.IsPrimaryKey
&& c.ColumnName == "Id"
&& !c.IsIdentity
&& c.DbType == DbType.Int32);
var matchContentPartVersionRecord = matchContentPartRecord && command.TableCommands.OfType<CreateColumnCommand>().Any(
c =>
c.ColumnName == "ContentItemRecord_id"
&& c.DbType == DbType.Int32);
if ( matchContentPartVersionRecord ) {
_output.WriteLine("\t\t\t\t.ContentPartVersionRecord()");
}
else if ( matchContentPartRecord ) {
_output.WriteLine("\t\t\t\t.ContentPartRecord()");
}
foreach ( var createColumn in command.TableCommands.OfType<CreateColumnCommand>() ) {
if(createColumn.ColumnName == "Id" && matchContentPartRecord) {
continue;
}
if(createColumn.ColumnName == "ContentItemRecord_id" && matchContentPartVersionRecord) {
continue;
}
var type = createColumn.DbType.ToString();
var field = createColumn.ColumnName;
var options = new List<string>();
if ( createColumn.IsPrimaryKey ) {
options.Add("PrimaryKey()");
}
if ( createColumn.IsIdentity ) {
options.Add("Identity()");
}
if ( createColumn.IsUnique ) {
options.Add("Unique()");
}
if ( createColumn.IsNotNull ) {
options.Add("NotNull()");
}
if ( createColumn.Length.HasValue ) {
if ( createColumn.Length == 10000 ) {
options.Add("Unlimited()");
}
else {
options.Add(string.Format("WithLength({0})", createColumn.Length));
}
}
if ( createColumn.Precision > 0 ) {
options.Add(string.Format("WithPrecision({0})", createColumn.Precision));
options.Add(string.Format("WithScale({0})", createColumn.Scale));
}
_output.WriteLine("\t\t\t\t.Column(\"{0}\", DbType.{1}{2})", field, type, options.Any() ? ", column => column." + string.Join(".", options) : string.Empty);
}
_output.WriteLine("\t\t\t);");
}
public override void Visit(AlterTableCommand command) {
_output.WriteLine("// Altering table {0}", command.Name);
}
public override void Visit(DropTableCommand command) {
_output.WriteLine("// Dropping table {0}", command.Name);
_output.WriteLine("\t\t\tSchemaBuilder.DropTable(\"{0}\", command.Name);");
}
public override void Visit(SqlStatementCommand command) {
_output.WriteLine("// Executing sql statement\n\n {0}", command.Sql);
}
public override void Visit(CreateForeignKeyCommand command) {
_output.WriteLine("// Creating foreign key {0}", command.Name);
}
public override void Visit(DropForeignKeyCommand command) {
_output.WriteLine("// Dropping foreign key {0}", command.Name);
}
}
}

View File

@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.DevTools.Models" %>
<div class="debug message"><%=T(
"DevTools: displaying {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.DevTools", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>

View File

@ -1,8 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.DevTools.Models" %>
<% if (Model.ContentItem.Id > 0) { %>
<div class="debug message"><%=T(
"DevTools: editing {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.DevTools", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>
<% } %>

View File

@ -1,42 +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=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" 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>
<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>

View File

@ -1,7 +1,8 @@
using Orchard.Localization;
using Orchard.UI.Navigation;
namespace Orchard.DevTools {
namespace Orchard.Experimental {
public class AdminMenu : INavigationProvider {
public string MenuName { get { return "admin"; } }
public Localizer T { get; set; }
@ -9,7 +10,7 @@ namespace Orchard.DevTools {
public void GetNavigation(NavigationBuilder builder) {
builder.Add(T("Site Configuration"), "11",
menu => menu
.Add(T("Developer Tools"), "10.0", item => item.Action("Index", "Home", new { area = "Orchard.DevTools" })
.Add(T("Experimental"), "10.0", item => item.Action("Index", "Home", new { area = "Orchard.Experimental" })
));
}
}

View File

@ -7,7 +7,8 @@ using Orchard.Core.Routable.Models;
using Orchard.Environment.Extensions;
using Orchard.Security;
namespace Orchard.DevTools.Commands {
namespace Orchard.Experimental.Commands {
[OrchardFeature("Profiling")]
public class ProfilingCommands : DefaultOrchardCommandHandler {
private readonly IContentManager _contentManager;

View File

@ -3,13 +3,13 @@ using System.IO;
using System.Linq;
using System.Web.Mvc;
using Orchard.Commands;
using Orchard.DevTools.ViewModels;
using Orchard.Experimental.ViewModels;
using Orchard.Environment.Extensions;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.DevTools.Controllers {
[Themed, Admin, OrchardFeature("Orchard.DevTools.WebCommandLine")]
namespace Orchard.Experimental.Controllers {
[Themed, Admin, OrchardFeature("Orchard.Experimental.WebCommandLine")]
public class CommandsController : Controller {
private readonly ICommandManager _commandManager;

View File

@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Orchard.Data;
using Orchard.DevTools.ViewModels;
using Orchard.Experimental.ViewModels;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
using Orchard.DisplayManagement;
namespace Orchard.DevTools.Controllers {
namespace Orchard.Experimental.Controllers {
public class ContentController : Controller {
private readonly IRepository<ContentTypeRecord> _contentTypeRepository;
private readonly IContentManager _contentManager;
@ -34,6 +34,7 @@ namespace Orchard.DevTools.Controllers {
var model = new ContentDetailsViewModel {
Item = version == null ? _contentManager.Get(id) : _contentManager.Get(id, VersionOptions.Number((int)version))
};
model.PartTypes = model.Item.ContentItem.Parts
.Select(x => x.GetType())
.SelectMany(x => AllTypes(x))
@ -50,6 +51,7 @@ namespace Orchard.DevTools.Controllers {
yield return scan;
scan = scan.BaseType;
}
foreach (var itf in type.GetInterfaces()) {
yield return itf;
}

View File

@ -1,14 +1,14 @@
using System;
using System.Web;
using System.Web.Mvc;
using Orchard.DevTools.Models;
using Orchard.Experimental.Models;
using Orchard.DisplayManagement;
using Orchard.Localization;
using Orchard.Themes;
using Orchard.UI.Notify;
using Orchard.UI.Admin;
namespace Orchard.DevTools.Controllers {
namespace Orchard.Experimental.Controllers {
[Themed]
[Admin]
public class HomeController : Controller {

View File

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.DevTools.Controllers {
namespace Orchard.Experimental.Controllers {
[Themed, Admin]
public class InventoryController : Controller {
private readonly IShapeTableManager _shapeTableManager;

View File

@ -3,9 +3,9 @@ using System.Web.Mvc;
using System.Xml;
using System.Xml.Linq;
using Orchard.ContentManagement.MetaData;
using Orchard.DevTools.ViewModels;
using Orchard.Experimental.ViewModels;
namespace Orchard.DevTools.Controllers {
namespace Orchard.Experimental.Controllers {
[ValidateInput(false)]
public class MetadataController : Controller {
private readonly IContentDefinitionManager _contentDefinitionManager;

View File

@ -7,7 +7,7 @@ using System.Xml;
using Orchard.DisplayManagement.Shapes;
using Orchard.Mvc.Filters;
namespace Orchard.DevTools {
namespace Orchard.Experimental {
public class DebugFilter : FilterProvider, IActionFilter {
public void OnActionExecuting(ActionExecutingContext filterContext) {
}
@ -39,8 +39,7 @@ namespace Orchard.DevTools {
Writer = writer;
var model = _viewResultBase.ViewData.Model;
Accept(model);
}
finally {
} finally {
Writer = null;
}
}
@ -63,4 +62,4 @@ namespace Orchard.DevTools {
}
}
}
}
}

View File

@ -1,17 +1,17 @@
using JetBrains.Annotations;
using Orchard.ContentManagement.Handlers;
using Orchard.DevTools.Models;
using Orchard.Experimental.Models;
namespace Orchard.DevTools.Handlers {
namespace Orchard.Experimental.Handlers {
[UsedImplicitly]
public class DebugLinkHandler : ContentHandler {
protected override void BuildDisplayShape(BuildDisplayModelContext context) {
var devToolsSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.DevToolsSettings>();
if (devToolsSettings.ShowDebugLinks)
var experimentalSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.ExperimentalSettings>();
if (experimentalSettings.ShowDebugLinks)
context.Model.Zones["Recap"].Add(new ShowDebugLink { ContentItem = context.ContentItem }, "9999");
}
protected override void BuildEditorShape(BuildEditorModelContext context) {
var devToolsSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.DevToolsSettings>();
var devToolsSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.ExperimentalSettings>();
if (devToolsSettings.ShowDebugLinks)
context.Model.Zones["Recap"].Add(new ShowDebugLink { ContentItem = context.ContentItem }, "9999");
}

View File

@ -1,6 +1,6 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement;
namespace Orchard.DevTools.Models {
namespace Orchard.Experimental.Models {
public class ShowDebugLink {
public ContentItem ContentItem { get; set; }
}

View File

@ -1,4 +1,5 @@
namespace Orchard.DevTools.Models {
namespace Orchard.Experimental.Models {
public class Simple {
public string Title { get; set; }
public int Quantity { get; set; }

View File

@ -0,0 +1,18 @@
Name: Experimental module
antiforgery: enabled
author: The Orchard Team
website: http://orchardproject.net
version: 0.1.0
orchardversion: 0.6.0
description:
features:
Profiling:
Description: Tools to help profile Orchard.
Category: Developer
Dependencies: Orchard.Experimental
Orchard.Experimental.WebCommandLine:
Description: Enables site administrators to execute Orchard.exe commands via web interface
Category: Developer
Orchard.Experimental:
Description: An assortment of debugging tools.
Category: Developer

View File

@ -3,21 +3,17 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectGuid>{AB3C207C-0126-4143-8D62-1119DF80D366}</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.DevTools</RootNamespace>
<AssemblyName>Orchard.DevTools</AssemblyName>
<RootNamespace>Orchard.Experimental</RootNamespace>
<AssemblyName>Orchard.Experimental</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>
@ -27,7 +23,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -36,46 +31,50 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="HibernatingRhinos.Profiler.Appender, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0774796e73ebf640, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="HibernatingRhinos.Profiler.Appender">
<HintPath>..\..\..\..\lib\nhprof\HibernatingRhinos.Profiler.Appender.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<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.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<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.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<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="Commands\ProfilingCommands.cs" />
<Compile Include="Commands\ScaffoldingCommands.cs" />
<Compile Include="Controllers\CommandsController.cs" />
<Compile Include="Controllers\ContentController.cs" />
<Compile Include="Controllers\DatabaseUpdateController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\InventoryController.cs" />
<Compile Include="Controllers\MetadataController.cs" />
@ -85,37 +84,34 @@
<Compile Include="Models\Simple.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="ScaffoldingTemplates\DataMigration.txt" />
<Compile Include="Services\ScaffoldingCommandInterpreter.cs" />
<Compile Include="Settings\DevToolsSettings.cs" />
<Compile Include="Settings\ExperimentalSettings.cs" />
<Compile Include="Shapes.cs" />
<Compile Include="ViewModels\CommandsExecuteViewModel.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\MetadataIndexViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="ScaffoldingTemplates\Controller.txt" />
<Content Include="ScaffoldingTemplates\ModuleAssemblyInfo.txt" />
<Content Include="ScaffoldingTemplates\ModuleCsProj.txt" />
<Content Include="ScaffoldingTemplates\ModuleManifest.txt" />
<Content Include="ScaffoldingTemplates\ModuleWebConfig.txt" />
<Content Include="ScaffoldingTemplates\ViewsWebConfig.txt" />
<Content Include="Views\Commands\Execute.ascx" />
<Content Include="Views\DatabaseUpdate\Index.aspx" />
<Content Include="Views\DefinitionTemplates\DevToolsSettings.ascx" />
<Content Include="Views\Home\_RenderableAction.ascx" />
<Content Include="Views\Home\Simple.aspx" />
<Content Include="Views\Content\Details.aspx" />
<Content Include="Views\Content\Index.aspx" />
<Content Include="Views\DefinitionTemplates\ExperimentalSettings.aspx" />
<Content Include="Views\EditorTemplates\Parts\Experimental.ShowDebugLink.ascx" />
<Content Include="Views\Home\Index.aspx" />
<Content Include="Views\DisplayTemplates\Parts\DevTools.ShowDebugLink.ascx" />
<Content Include="Views\EditorTemplates\Parts\DevTools.ShowDebugLink.ascx" />
<Content Include="Views\Home\Simple.aspx" />
<Content Include="Views\Home\_RenderableAction.ascx" />
<Content Include="Views\DatabaseUpdate\Index.aspx" />
<Content Include="Views\Metadata\Index.aspx" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\DisplayTemplates\Parts\Experimental.ShowDebugLink.ascx" />
<None Include="Views\HackScript.cshtml" />
<None Include="Views\HackStyle.cshtml" />
<None Include="Views\ThinBorder.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
@ -127,13 +123,14 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Views\HackScript.cshtml" />
<Content Include="Views\HackStyle.cshtml" />
<Content Include="Views\ThinBorder.cshtml" />
<Content Include="Views\Home\FormShapes.cshtml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\UsingShapes.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Inventory\ShapeTable.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
@ -142,20 +139,8 @@
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
<PropertyGroup>
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
</PropertyGroup>
<!-- If this is an area child project, uncomment the following line:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
-->
<!-- If this is an area parent project, uncomment the following lines:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
-->
</Target>
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
@ -163,13 +148,14 @@
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>1231</DevelopmentServerPort>
<DevelopmentServerPort>55620</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>True</UseCustomServer>
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>

View File

@ -1,13 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Orchard.DevTools {
namespace Orchard.Experimental {
public class Permissions : IPermissionProvider {
public static readonly Permission DebugShowAllMenuItems = new Permission { Description = "DevTools: Show all menu items", Name = "DebugShowAllMenuItems" };
public static readonly Permission DebugShowAllMenuItems = new Permission { Description = "Experimental: Show all menu items", Name = "DebugShowAllMenuItems" };
public virtual Feature Feature { get; set; }
@ -22,4 +20,4 @@ namespace Orchard.DevTools {
}
}
}
}

View File

@ -1,11 +1,10 @@
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.DevTools")]
[assembly: AssemblyTitle("Orchard.Experimental")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Orchard")]
@ -19,7 +18,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c185e02c-ccf9-4976-bdaa-1fd7e12c1296")]
[assembly: Guid("dedeaad6-f97c-4db1-b544-8e72496aa5ed")]
// Version information for an assembly consists of the following four values:
//
@ -31,4 +30,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]

View File

@ -5,26 +5,25 @@ using Orchard.ContentManagement.MetaData.Builders;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.DevTools.Settings {
public class DevToolsSettings {
namespace Orchard.Experimental.Settings {
public class ExperimentalSettings {
public bool ShowDebugLinks { get; set; }
}
public class DevToolsSettingsHooks : ContentDefinitionEditorEventsBase {
public class ExperimentalSettingsHooks : ContentDefinitionEditorEventsBase {
public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
var model = definition.Settings.GetModel<DevToolsSettings>();
var model = definition.Settings.GetModel<ExperimentalSettings>();
yield return DefinitionTemplate(model);
}
public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
var model = new DevToolsSettings();
updateModel.TryUpdateModel(model, "DevToolsSettings", null, null);
var model = new ExperimentalSettings();
updateModel.TryUpdateModel(model, "ExperimentalSettings", null, null);
builder
.WithSetting("DevToolsSettings.ShowDebugLinks", model.ShowDebugLinks ? true.ToString() : null);
.WithSetting("ExperimentalSettings.ShowDebugLinks", model.ShowDebugLinks ? true.ToString() : null);
yield return DefinitionTemplate(model);
}
}
}
}

View File

@ -1,9 +1,9 @@
using Orchard.DisplayManagement.Implementation;
namespace Orchard.DevTools {
namespace Orchard.Experimental {
public class Shapes : IShapeFactoryEvents {
public void Creating(ShapeCreatingContext context) {
}
public void Created(ShapeCreatedContext context) {
@ -15,4 +15,4 @@ namespace Orchard.DevTools {
}
}
}
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Orchard.Experimental.ViewModels {
namespace Orchard.DevTools.ViewModels {
public class CommandsExecuteViewModel {
public string[] History { get; set; }
public string CommandLine { get; set; }

View File

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.ContentManagement.ViewModels;
using Orchard.UI.Zones;
namespace Orchard.DevTools.ViewModels {
namespace Orchard.Experimental.ViewModels {
public class ContentDetailsViewModel {
public IContent Item { get; set; }

View File

@ -2,7 +2,8 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
namespace Orchard.DevTools.ViewModels {
namespace Orchard.Experimental.ViewModels {
public class ContentIndexViewModel {
public IEnumerable<ContentTypeRecord> Types { get; set; }
public IEnumerable<ContentItem> Items { get; set; }

View File

@ -1,7 +1,8 @@
using System.Collections.Generic;
using Orchard.ContentManagement.MetaData.Models;
namespace Orchard.DevTools.ViewModels {
namespace Orchard.Experimental.ViewModels {
public class MetadataIndexViewModel {
public IEnumerable<ContentTypeDefinition> TypeDefinitions { get; set; }
public IEnumerable<ContentPartDefinition> PartDefinitions { get; set; }

View File

@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.DevTools.ViewModels.CommandsExecuteViewModel>" %>
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Experimental.ViewModels.CommandsExecuteViewModel>" %>
<h1>
<%: Html.TitleForPage(T("Command line").ToString()) %></h1>
<div>

View File

@ -1,5 +1,5 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ContentDetailsViewModel>" %>
<%@ Import Namespace="Orchard.DevTools.ViewModels"%>
<%@ Import Namespace="Orchard.Experimental.ViewModels"%>
<%@ Import Namespace="Orchard.ContentManagement"%>
<%@ Import Namespace="System.Reflection" %>
<h1><%: Html.TitleForPage(T("{0} Content Type", Model.Item.ContentItem.ContentType).ToString(), T("Content").ToString())%></h1>

View File

@ -1,5 +1,5 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ContentIndexViewModel>" %>
<%@ Import Namespace="Orchard.DevTools.ViewModels"%>
<%@ Import Namespace="Orchard.Experimental.ViewModels"%>
<h1><%: Html.TitleForPage(T("Content").ToString()) %></h1>
<h2><%: T("Content Types")%></h2>
<ul>

View File

@ -1,4 +1,4 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<BaseViewModel>"%>
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<BaseViewModel>"%>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<h1><%: Html.TitleForPage(T("Data Migration").ToString()) %></h1>
<p><%: Html.ActionLink(T("Update Database").ToString(), "UpdateDatabase", "DatabaseUpdate") %></p>

View File

@ -1,4 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.DevTools.Settings.DevToolsSettings>" %>
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Experimental.Settings.ExperimentalSettings>" %>
<fieldset>
<%:Html.EditorFor(m=>m.ShowDebugLinks) %>
<label for="<%:Html.FieldIdFor(m => m.ShowDebugLinks) %>" class="forcheckbox"><%:T("Show debug links") %></label>

View File

@ -0,0 +1,6 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<div class="debug message"><%=T(
"DevTools: displaying {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>

View File

@ -0,0 +1,8 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<% if (Model.ContentItem.Id > 0) { %>
<div class="debug message"><%=T(
"DevTools: editing {0}",
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
) %></div>
<% } %>

View File

@ -1,6 +1,6 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Simple>" %>
<%@ Import Namespace="Orchard.DevTools.Models" %>
<%@ Import Namespace="Orchard.Experimental.Models" %>
<h1>
<%= H(Model.Title) %></h1>
<p>

View File

@ -1,6 +1,6 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<MetadataIndexViewModel>" %>
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Orchard.Experimental.ViewModels.MetadataIndexViewModel>" %>
<%@ Import Namespace="Orchard.DevTools.ViewModels" %>
<%@ Import Namespace="Orchard.Experimental.ViewModels" %>
<style title="text/css">
ul
{

View File

@ -1,9 +1,9 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<add path="*" verb="*"
type="System.Web.HttpNotFoundHandler"/>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<!--
@ -25,10 +25,11 @@
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<configuration>
<system.web>