--HG--
branch : 1.x
This commit is contained in:
Andre Rodrigues
2011-03-28 12:55:24 -07:00
2 changed files with 9 additions and 7 deletions

View File

@@ -6,10 +6,10 @@
<fieldset>
<div>
@Html.LabelFor(m => m.Slug, T("For Blog"))
<select id="@Html.FieldIdFor(m => m.Slug)" name="@Html.FieldNameFor(m => m.Slug)">
@Html.LabelFor(m => m.Path, T("For Blog"))
<select id="@Html.FieldIdFor(m => m.Path)" name="@Html.FieldNameFor(m => m.Path)">
@foreach(BlogPart blog in Model.Blogs) {
@Html.SelectOption(Model.Slug, blog.As<RoutePart>().Slug, blog.Name)
@Html.SelectOption(Model.Path, blog.As<RoutePart>().Slug, blog.Name)
}
</select>
<span class="hint">@T("Select which blog you want to display the archives for")</span>

View File

@@ -16,6 +16,8 @@ namespace Orchard.CodeGeneration.Commands {
public class CodeGenerationCommands : DefaultOrchardCommandHandler {
private readonly IExtensionManager _extensionManager;
private readonly ISchemaCommandGenerator _schemaCommandGenerator;
private const string SolutionDirectoryModules = "E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5";
private const string SolutionDirectoryThemes = "74492CBC-7201-417E-BC29-28B4C25A58B0";
private static readonly string[] _themeDirectories = new [] {
"", "Content", "Styles", "Scripts", "Views", "Zones"
@@ -191,7 +193,7 @@ namespace Orchard.CodeGeneration.Commands {
CreateFilesFromTemplates(moduleName, projectGuid);
// The string searches in solution/project files can be made aware of comment lines.
if (IncludeInSolution) {
AddToSolution(Context.Output, moduleName, projectGuid, "Modules");
AddToSolution(Context.Output, moduleName, projectGuid, "Modules", SolutionDirectoryModules);
}
}
@@ -333,13 +335,13 @@ namespace Orchard.CodeGeneration.Commands {
}
else {
// create a project (already done) and add it to the solution
AddToSolution(output, themeName, projectGuid, "Themes");
AddToSolution(output, themeName, projectGuid, "Themes", SolutionDirectoryThemes);
}
}
}
private void AddToSolution(TextWriter output, string projectName, string projectGuid, string containingFolder) {
private void AddToSolution(TextWriter output, string projectName, string projectGuid, string containingFolder, string solutionFolderGuid) {
if (!string.IsNullOrEmpty(projectGuid)) {
var solutionPath = Directory.GetParent(_orchardWebProj).Parent.FullName + "\\Orchard.sln";
if (File.Exists(solutionPath)) {
@@ -347,7 +349,7 @@ namespace Orchard.CodeGeneration.Commands {
var 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);
var solutionText = File.ReadAllText(solutionPath);
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference).Replace("GlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n", projectConfiguationPlatforms);
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}\r\n\t");
solutionText = solutionText.Insert(solutionText.LastIndexOf("EndGlobalSection"), "\t{" + projectGuid + "} = {" + solutionFolderGuid + "}\r\n\t");
File.WriteAllText(solutionPath, solutionText);
TouchSolution(output);
}