- Adding an ~/App_Data write access check up front in the setup process

- Adding some notification style to the setup theme's css

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-02-10 14:34:20 -08:00
parent c37e857e4a
commit 16a93f77ec
2 changed files with 65 additions and 1 deletions

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,10 @@ namespace Orchard.Setup.Controllers {
private Localizer T { get; set; }
public ActionResult Index(SetupViewModel model) {
if(!CanWriteTo(Server.MapPath("~/App_Data"))) {
_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!"));
}
return View(model ?? new SetupViewModel { AdminUsername = "admin" });
}
@@ -112,5 +117,17 @@ namespace Orchard.Setup.Controllers {
return Index(model);
}
}
static bool CanWriteTo(string path) {
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);
return true;
} catch {
return false;
}
}
}
}

View File

@@ -60,7 +60,7 @@ h5 {font-size: 105%;}
#main {
margin:0 auto;
margin:0 auto 40px;
width:600px;
}
@@ -148,4 +148,51 @@ button:focus, .button:focus {
html.dyn fieldset.data div span {
display:none;
}
/* Confirmations, Messages and the like
----------------------------------------------------------*/
.message, .validation-summary-errors {
margin:10px 0 4px 0;
padding:4px;
white-space:pre-wrap;
}
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 {
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 » ";
}