--HG--
branch : dev
This commit is contained in:
Suha Can
2010-02-10 16:27:11 -08:00
5 changed files with 127 additions and 12 deletions

View File

@@ -1,3 +1,44 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<NavigationIndexViewModel>" %>
<%@ Import Namespace="Orchard.Core.Navigation.ViewModels"%>
<h1><%=Html.TitleForPage(T("Edit Main Menu").ToString())%></h1>
<h1><%=Html.TitleForPage(T("Edit Main Menu").ToString())%></h1><%
using (Html.BeginFormAntiForgeryPost()) { %>
<table>
<thead>
<tr>
<td>Text</td>
<td>Position</td>
<td>Url</td>
<td></td>
</tr>
</thead>
<tbody>
<%-- loop over menu items --%>
<tr>
<td><input type="text" name="text" /></td>
<td><input type="text" name="position" /></td>
<td><input type="text" name="url" /></td>
<td>Delete Button</td>
</tr>
<%-- end loop --%>
<tr>
<td></td>
<td></td>
<td></td>
<td>Update All Button</td>
</tr>
</tbody>
</table><%
}
using (Html.BeginFormAntiForgeryPost()) { %>
<table>
<tbody>
<tr>
<td><input type="text" name="addtext" /></td>
<td><input type="text" name="addposition" /></td>
<td><input type="text" name="addurl" /></td>
<td>Add Button</td>
</tr>
</tbody>
</table><%
} %>

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Web.Mvc;
using Orchard.Comments.Models;
using Orchard.ContentManagement;
@@ -36,6 +37,14 @@ namespace Orchard.Setup.Controllers {
private Localizer T { get; set; }
public ActionResult Index(SetupViewModel model) {
string message = "";
if(!CanWriteTo(Server.MapPath("~/App_Data"), out message)) {
_notifier.Error(
T(
"Hey, it looks like I can't write to the App_Data folder in the root of this application and that's where I need to save some of the information you're about to enter.\r\n\r\nPlease give me (the machine account this application is running under) write access to App_Data so I can get this app all set up for you.\r\n\r\nThanks!\r\n\r\n----\r\n{0}",
message));
}
return View(model ?? new SetupViewModel { AdminUsername = "admin" });
}
@@ -112,5 +121,21 @@ namespace Orchard.Setup.Controllers {
return Index(model);
}
}
static bool CanWriteTo(string path, out string message) {
try {
var systemCheckPath = Path.Combine(path, "_systemcheck.txt");
System.IO.File.WriteAllText(systemCheckPath, "Communicator check one two one two");
System.IO.File.AppendAllText(systemCheckPath, "\r\nThis is Bones McCoy on a line to Sulu");
System.IO.File.Delete(systemCheckPath);
message = "";
return true;
} catch (Exception ex) {
message = ex.Message.Replace("_systemcheck.txt", "");
return false;
}
}
}
}

View File

@@ -4,11 +4,11 @@ using Orchard.Mvc.ViewModels;
namespace Orchard.Setup.ViewModels {
public class SetupViewModel : BaseViewModel {
[Required, StringLength(70)]
[Required(ErrorMessage = "Site name is required."), StringLength(70, ErrorMessage = "Site name can be no longer than 70 characters.")]
public string SiteName { get; set; }
[Required, StringLengthMin(3), StringLength(25)]
[Required(ErrorMessage = "User name is required."), StringLengthMin(3, ErrorMessage = "User name must be longer than 3 characters."), StringLength(25, ErrorMessage = "User name can be no longer than 25 characters.")]
public string AdminUsername { get; set; }
[Required, StringLengthMin(6), StringLength(50)]
[Required(ErrorMessage = "Password is required."), StringLengthMin(6, ErrorMessage = "Password must be longer than 6 characters."), StringLength(50, ErrorMessage = "Password can be no longer than 50 characters.")]
public string AdminPassword { get; set; }
[SqlDatabaseConnectionString]
public string DatabaseConnectionString { get; set; }

View File

@@ -10,28 +10,25 @@ using (Html.BeginFormAntiForgeryPost()) { %>
<div>
<label for="SiteName"><%=_Encoded("What is the name of your site?") %></label>
<%=Html.EditorFor(svm => svm.SiteName) %>
<%=Html.ValidationMessage("SiteName", "*") %>
</div>
<div>
<label for="AdminUsername"><%=_Encoded("Choose a user name:") %></label>
<%=Html.EditorFor(svm => svm.AdminUsername)%>
<%=Html.ValidationMessage("AdminUsername", "*")%>
</div>
<div>
<label for="AdminPassword"><%=_Encoded("Choose a password:") %></label>
<%=Html.PasswordFor(svm => svm.AdminPassword) %>
<%=Html.ValidationMessage("AdminPassword", "*") %>
</div>
</fieldset>
<fieldset class="data">
<fieldset class="data<%=Model.DatabaseOptions ? " builtin" : " sql" %>">
<legend><%=_Encoded("How would you like to store your data?") %></legend>
<%=Html.ValidationMessage("DatabaseOptions", "Unable to setup data storage") %>
<div>
<input type="radio" name="databaseOptions" id="builtin" value="true" checked="checked" />
<%=Html.RadioButtonFor(svm => svm.DatabaseOptions, true, new { id = "builtin" })%>
<label for="builtin" class="forcheckbox"><%=_Encoded("Use built-in data storage (SQL Lite)") %></label>
</div>
<div>
<input type="radio" name="databaseOptions" id="sql" value="false" />
<%=Html.RadioButtonFor(svm => svm.DatabaseOptions, false, new { id = "sql" })%>
<label for="sql" class="forcheckbox"><%=_Encoded("Use an existing SQL Server (or SQL Express) database") %></label>
<span>
<label for="DatabaseConnectionString"><%=_Encoded("Connection string") %></label>

View File

@@ -60,7 +60,7 @@ h5 {font-size: 105%;}
#main {
margin:0 auto;
margin:0 auto 40px;
width:600px;
}
@@ -146,6 +146,58 @@ button:focus, .button:focus {
text-decoration:none;
}
html.dyn fieldset.data div span {
html.dyn fieldset.data.builtin div span {
display:none;
}
/* Confirmations, Messages and the like
----------------------------------------------------------*/
.message, .validation-summary-errors {
margin:10px 0 4px 0;
padding:4px;
white-space:pre-wrap;
}
form .message, form .validation-summary-errors {
margin:0 10px;
white-space:inherit;
}
span.message {
display:block;
margin:4px 0 4px 4px;
}
.message a {
font-weight:bold;
}
.confirmation.message {
background:#e6f1c9; /* green */
border:1px solid #cfe493;
}
.warning.message {
background:#fdf5bc; /* yellow */
border:1px solid #ffea9b;
}
/* todo: (heskew) what else (other inputs) needs this? */
.critical.message, .validation-summary-errors,
.input-validation-error.text-box, .input-validation-error.text,
input[type="password"].input-validation-error {
border:1px solid #990808;
}
.critical.message, .validation-summary-errors {
background:#e68585; /* red */
color:#fff;
}
.info.message {
background:#fff; /* orange :P */
border:1px dashed #D2D6C6;
}
.debug.message {
background:#eee;
border:1px dashed #D2D6C6;
color:#7a7a7a;
margin:20px 0 14px 0;
}
.debug.message:before {
content:"DEBUG » ";
}