From d983fc2acaafb325f74bd372614bc4f4e63d8f61 Mon Sep 17 00:00:00 2001 From: secretgeek Date: Fri, 27 Aug 2010 08:16:55 -0400 Subject: [PATCH] initial commit of DoD --- Content/Logo.png | Bin 0 -> 1074 bytes Controllers/Home/Index.bat | 33 +++ Controllers/_actionMissing.bat | 25 ++ Controllers/_controllerMissing.bat | 16 ++ Default.aspx | 3 + Default.aspx.cs | 16 ++ DosOnDope.csproj | 113 +++++++++ Global.asax | 1 + Global.asax.cs | 177 +++++++++++++ Models/split.vbs | 8 + Properties/AssemblyInfo.cs | 33 +++ Views/Shared/_header.bat | 19 ++ Web.config | 152 +++++++++++ dope.bat | 392 +++++++++++++++++++++++++++++ favicon.ico | Bin 0 -> 822 bytes h/ToLower.cmd | 8 + h/a.bat | 2 + h/h1.bat | 2 + h/h2.bat | 2 + h/h3.bat | 2 + h/p.bat | 2 + 21 files changed, 1006 insertions(+) create mode 100644 Content/Logo.png create mode 100644 Controllers/Home/Index.bat create mode 100644 Controllers/_actionMissing.bat create mode 100644 Controllers/_controllerMissing.bat create mode 100644 Default.aspx create mode 100644 Default.aspx.cs create mode 100644 DosOnDope.csproj create mode 100644 Global.asax create mode 100644 Global.asax.cs create mode 100644 Models/split.vbs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Views/Shared/_header.bat create mode 100644 Web.config create mode 100644 dope.bat create mode 100644 favicon.ico create mode 100644 h/ToLower.cmd create mode 100644 h/a.bat create mode 100644 h/h1.bat create mode 100644 h/h2.bat create mode 100644 h/h3.bat create mode 100644 h/p.bat diff --git a/Content/Logo.png b/Content/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ee1042e6acffb06e7eb6650d34559f8611eb9321 GIT binary patch literal 1074 zcmV-21kL-2P)pI)Ja4^RA@u(SUZbTQ4r2eb~`I=EYe8w z1MCg>4`d5}frYgQLWCuRbr*sxvZX?>vfMI-tq`%bTx26#q_EM-%H0^hIB+t1=DhF8 zN~Z~U3cF+Fm675_DTEQW@oXT0BkP(@%*#)slGYyFLss& zx$Th=+c1Cx_h}e5Od$opmJD7lZ3_TzC?rCnUu7sH>k?tE3;@__#84#w&69_cX;lJX z%#+Fh(A=*YNM!)n%G6eu(W}2#uv=1}_it+iE@zi?dn@!x1&oQycQgawc5e`a(Ryus z%9aD!BW4^fLZ{KAS4TWd-XN?YVldq}x>}Q1GkUkN>)?8naA3~x2%rbs&Mny}6cw>R z3`)$A%2ohTERyl@vMv^bZQiz02sL;*a~$0OsifS{ekJB9p<(7Oz0!nRvgq?^PWl5QscPl_s-{faYxQmF@(k zShY4H)nPZ?HbY~JsnX+ad{VBX zaWy#^qbXVBkjE!Uo?JaqGtWBAX%#?@nU29O`{9O1U{!ysaKPH&P=-9DRv9h-m{>^! zH2!26r)^~_sEksta8IV74c(IcWyUIRd0m{j=sG+&4of7_GjxTq&g(zB7T$loZ_j(RZnrxcjpV{S05rX@ zUZxX3x=kk~tyT-q!C-*rXyEPB6yf zF@6CIdQn$&4q&D7E_bu>M@RC^<})KI%7J#f4Gfe6fB_6&-k#tc)&s-dqrFl9!rjRw z&%T{0hTz2p;NtrQzETq38+?4)`-&hS0x$n`iABJ0{Q7vQxnv)ST8>@M|6eG$s&i{E z_yhrB(a&ZZ_q*DCJdwe~D_nfj6bhw90IO6IlZlQ?MF8Z1*q!M$d0s}>3LqJ|V_|d^ sT7?m1blw0c + +<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%> diff --git a/Default.aspx.cs b/Default.aspx.cs new file mode 100644 index 0000000..201348a --- /dev/null +++ b/Default.aspx.cs @@ -0,0 +1,16 @@ +using System.Web; +using System.Web.Mvc; +using System.Web.UI; + +namespace DosOnDope +{ + public partial class _Default : Page + { + public void Page_Load(object sender, System.EventArgs e) + { + HttpContext.Current.RewritePath(Request.ApplicationPath, false); + IHttpHandler httpHandler = new MvcHttpHandler(); + httpHandler.ProcessRequest(HttpContext.Current); + } + } +} diff --git a/DosOnDope.csproj b/DosOnDope.csproj new file mode 100644 index 0000000..12f42c4 --- /dev/null +++ b/DosOnDope.csproj @@ -0,0 +1,113 @@ + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {80FA3DFC-363C-4B35-AAA5-0FD3C17B8ECB} + {603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + DosOnDope + DosOnDope + v3.5 + false + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + + False + ..\..\..\..\Program Files\Microsoft ASP.NET\ASP.NET MVC RC\Assemblies\System.Web.Routing.dll + 3.5 + + + + + + + Default.aspx + ASPXCodeBehind + + + Global.asax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + True + 13174 + / + + + False + False + + + + + \ No newline at end of file diff --git a/Global.asax b/Global.asax new file mode 100644 index 0000000..19ec3a9 --- /dev/null +++ b/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="DosOnDope.MvcApplication" Language="C#" %> diff --git a/Global.asax.cs b/Global.asax.cs new file mode 100644 index 0000000..648177d --- /dev/null +++ b/Global.asax.cs @@ -0,0 +1,177 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; + +namespace DosOnDope +{ + public class MvcApplication : System.Web.HttpApplication + { + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + routes.IgnoreRoute("favicon.ico"); + routes.IgnoreRoute("Content/{*pathInfo}"); + + routes.Add(new Route("{controller}/{action}/{*id}", new DosOnDopeRouteHandler()) + { + Defaults = new RouteValueDictionary(new + { + controller = "Home", + action = "Index", + id = "" + }) + }); + } + + protected void Application_Start() + { + RegisterRoutes(RouteTable.Routes); + } + } + + public class DosOnDopeRouteHandler : IRouteHandler + { + public IHttpHandler GetHttpHandler(RequestContext requestContext) + { + return new DosOnDopeHttpHandler(requestContext); + } + } + + public class DosOnDopeHttpHandler : IHttpHandler + { + public RequestContext requestContext { get; set; } + public DosOnDopeHttpHandler(RequestContext requestContext) + { + this.requestContext = requestContext; + } + + public bool IsReusable {get { return false; } } + + public void ProcessRequest(HttpContext context) + { + var controller = this.requestContext.RouteData.Values["controller"] as string; + var action = this.requestContext.RouteData.Values["action"] as string; + string[] args = { this.requestContext.RouteData.Values["id"] as string }; + int httpStatus; + if (context.Request.RequestType == "POST") + { + var result = Execute(controller, action, context.Request.Form.ToString().Split('&'), out httpStatus, true); + if (httpStatus == 301) + context.Response.Redirect(result.Trim("\r\n".ToCharArray())); + else + context.Response.Write(result); + } + else + { + context.Response.Write(Execute(controller, action, args, out httpStatus, false )); + } + context.Response.StatusCode = httpStatus; + } + + public string Execute(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost) + { + var controllerPath = Path.Combine(requestContext.HttpContext.Server.MapPath("~/Controllers"), controllerName); + + if (!Directory.Exists(controllerPath)) + { + return ControllerNotFound(controllerName, actionName, newArgs, out httpStatus, isPost); + } + + var actionFileName = Path.Combine(controllerPath, actionName + ".bat"); + + if (!File.Exists(actionFileName)) + { + return ActionNotFound(controllerName, actionName, newArgs, out httpStatus, isPost); + } + + return Execute(controllerPath, actionName, Join(" ", newArgs), out httpStatus, isPost); + } + + private string Execute(string path, string file, string args, out int httpStatus, bool isPost) + { + var errorLevel = 50; + var result = string.Empty; + + using (var proc = new Process()) + { + proc.EnableRaisingEvents = false; + + proc.StartInfo.FileName = Path.Combine(path, file + (isPost? ".cmd" : ".bat")); + if (args != null) + { + proc.StartInfo.Arguments = args; + } + proc.StartInfo.WorkingDirectory = path; + proc.StartInfo.UseShellExecute = false; + proc.StartInfo.CreateNoWindow = true;// false; + proc.StartInfo.RedirectStandardOutput = true; + proc.Start(); + string output = proc.StandardOutput.ReadToEnd(); + result = Dope(output); + proc.WaitForExit(); + errorLevel = proc.ExitCode; + } + httpStatus = ConvertErrorlevelToHttpStatus(errorLevel); + return result; + } + + private string ActionNotFound(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost) + { + var controllerPath = Path.Combine(requestContext.HttpContext.Server.MapPath("~/Controllers"), controllerName); + + if (!File.Exists(Path.Combine(controllerPath, "_actionMissing" + ".bat"))) + { + controllerPath = requestContext.HttpContext.Server.MapPath("~/Controllers"); + } + + return Execute(controllerPath, "_ActionMissing", controllerName + " " + actionName + " " + Join(" ", newArgs), out httpStatus, false); + } + + private string ControllerNotFound(string controllerName, string actionName, string[] newArgs, out int httpStatus, bool isPost) + { + var controllerPath = requestContext.HttpContext.Server.MapPath("~/Controllers"); + return Execute(controllerPath, "_ControllerMissing", controllerName + " " + actionName + " " + Join(" ", newArgs), out httpStatus, false); + } + + + private int ConvertErrorlevelToHttpStatus(int errorLevel) + { + if (errorLevel == 0) return 200; + return ((errorLevel / 10) * 100) + (errorLevel % 10); + } + + + private string Join(string separator, params string[] strings) + { + if (strings == null) return string.Empty; + return string.Join(separator, strings); + } + + /// + /// Dopes the input. + /// i.e: + /// Turns square brackets into angle brackets + /// Turns pluses into spaces. + /// Escapes angle brackets + /// Turns escaped square brackets into regular square brackets + /// Turns url encoded CR/LF into spaces + /// + /// The undoped. + /// + private string Dope(string undoped) + { + if (undoped.IndexOf("[[") >= 0 || undoped.IndexOf("]]") >= 0) + { + var gOpen = Guid.NewGuid().ToString(); + var gClose = Guid.NewGuid().ToString(); + undoped = undoped.Replace("[[", gOpen).Replace("]]", gClose); + undoped = Dope(undoped); + return undoped.Replace(gOpen, "[").Replace(gClose, "]"); + } + return undoped.Replace("<","<").Replace(">",">").Replace("[", "<").Replace("]", ">").Replace("+"," ").Replace("%0d"," ").Replace("%0a"," "); + } + } +} \ No newline at end of file diff --git a/Models/split.vbs b/Models/split.vbs new file mode 100644 index 0000000..435907e --- /dev/null +++ b/Models/split.vbs @@ -0,0 +1,8 @@ +Set objFS = CreateObject("Scripting.FileSystemObject") +Set objArgs = WScript.Arguments +str1 = objArgs(0) +s=Split(str1,"`") +For i=LBound(s) To UBound(s) + WScript.Echo s(i) + ' WScript.Echo s(9) ' get the 10th element +Next \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..362500f --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of mad attributes. Change these attribute values to modify the information +// associated with an assembly. If. You. Dare. +[assembly: AssemblyTitle("DosOnDope")] +[assembly: AssemblyDescription("Built with DosOnDope")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("secretGeek")] +[assembly: AssemblyProduct("DosOnDope")] +[assembly: AssemblyCopyright("Copyright © Leon Bambrick 2010")] +[assembly: AssemblyTrademark("DosOnDope")] +[assembly: AssemblyCulture("")] + +// COM is for old people. +[assembly: ComVisible(false)] + +// This is my GUID. Mess with it: and I will hurt your face. +[assembly: Guid("667ff6b2-8224-45e2-b13d-0d02685520a3")] + +// Version information for an assembly consists of the following five values: +// +// Major Version +// Minor Version +// Guild Number +// Karma points +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' wild-card. Are you wild? I'm not wild. I program. +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Views/Shared/_header.bat b/Views/Shared/_header.bat new file mode 100644 index 0000000..7e74926 --- /dev/null +++ b/Views/Shared/_header.bat @@ -0,0 +1,19 @@ +@echo off +echo [html] +echo [head] +echo [style]body{background-color:#000;color:#AAA;font-family:monospace}input,textarea{background-color:#222;color:#FFF}[/style] + +IF x"%*"==x"" GOTO DEFAULT + +echo [title]%*[/title] + +goto END + +:DEFAULT +echo [title]DosOnDope[/title] +goto END + +:END +echo [/head] +echo [body] +echo [img src='Content/Logo.png' style='float:right' /] \ No newline at end of file diff --git a/Web.config b/Web.config new file mode 100644 index 0000000..fc163da --- /dev/null +++ b/Web.config @@ -0,0 +1,152 @@ + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dope.bat b/dope.bat new file mode 100644 index 0000000..d3a989b --- /dev/null +++ b/dope.bat @@ -0,0 +1,392 @@ +@echo off + +SET LOCN="%~dp0" + +if x'%2'==x'/?' goto COMMAND_HELP +if x'%2'==x'?'goto COMMAND_HELP +if x'%2'==x'-?'goto COMMAND_HELP +if x'%2'==x'--?'goto COMMAND_HELP + +if x'%1'==x'' goto UNKNOWN +if '%1'=='site' goto SITE +if '%1'=='controller' goto CONTROLLER +if '%1'=='gen' goto GEN +if '%1'=='help' goto HELP +if '%1'=='?' goto HELP +if '%1'=='/?' goto HELP +if '%1'=='-?' goto HELP +if '%1'=='--?' goto HELP +if '%1'=='SITE' goto SITE +if '%1'=='CONTROLLER' goto CONTROLLER +if '%1'=='GEN' goto GEN +if '%1'=='HELP' goto HELP +if '%1'=='Help' goto HELP + +goto UNKNOWN + +:COMMAND_HELP +if '%1'=='site' goto HELP_SITE +if '%1'=='controller' goto HELP_CONTROLLER +if '%1'=='model' goto HELP_MODEL +if '%1'=='gen' goto HELP_GEN +if '%1'=='help' goto HELP +if '%1'=='SITE' goto HELP_SITE +if '%1'=='CONTROLLER' goto HELP_CONTROLLER +if '%1'=='MODEL' goto HELP_MODEL +if '%1'=='GEN' goto HELP_GEN +if '%1'=='HELP' goto HELP + +ECHO Unknown command %1 +GOTO HELP + +:HELP_SITE + +echo dope SITE [[name]] +echo will create a SITE named 'name' +echo in the current folder. +echo e.g: +echo dope SITE Blog +echo will create a site named 'Blog' +echo. +echo The site will, by default, include +echo sufficient files (styles, helpers etc) +echo to get you started. +echo. +echo A good next step is to create a controller +echo using the 'dope CONTROLLER' command + +goto EXIT +:HELP_CONTROLLER + +echo dope CONTROLLER [[name]] +echo Create a CONTROLLER named 'name' +echo in the SITE\Controllers\ folder +echo e.g. +echo dope CONTROLLER About +echo Creates a controller folder named 'About' +echo in the current site's 'Controllers' folder +echo containing a default action, 'Index.bat' +echo To navigate to the new action goto +echo http://YourSite/About/ +echo or +echo http://YourSite/About/Index +echo. +echo To create more actions, navigate into +echo the newly created folder and create more +echo batch files. No wiring required. +goto EXIT +:HELP_GEN + +echo dope GEN [[name]] [[controller]] +echo Generate actions for the model named 'name' +echo (singular) in the controller specified. +echo. +echo (The controller name is optional. If no +echo controller is specified, the default +echo controller, 'home', will be used.) +echo. +echo Before generating the actions, you need +echo to create the model file. +goto HELP_MODEL + + +goto EXIT + +:HELP_MODEL +echo. +echo A model file is a CSV file in the models +echo folder. The first line of the file is a +echo lists of fields, separated with backtick ` +echo characters, e.g. Emails.csv might contain: +echo ID`FirstName`LastName`Age`Email +echo. +echo The file name is plural. + +goto EXIT +:SITE +echo Creating SITE... %2 +if not exist %2 MD %2 +echo ...Created Content folder (for CSS and images) +if not exist %2\Content MD %2\Content +echo ...Created Controllers folder (for Controllers) +if not exist %2\Controllers MD %2\Controllers +echo ...Created Controllers\Home folder (Default Controller) +if not exist %2\Controllers\Home MD %2\Controllers\Home +echo ...Created h folder (for html helpers) +if not exist %2\h MD %2\h +echo ...Created Models folder (for Models) +if not exist %2\Models MD %2\Models +echo ...Created Scripts folder (for javascript) +if not exist %2\Scripts MD %2\Scripts +echo ...Created Views folder (for views) +if not exist %2\Views MD %2\Views +echo ...Created Views\Shared folder (for Shared views) +if not exist %2\Views\Shared MD %2\Views\Shared +echo ...Created bin folder +if not exist %2\bin MD %2\bin + +echo ...adding Web.config +Copy %LOCN%Web.config %2%\web.config + +echo ...adding Default.aspx +Copy %LOCN%Default.aspx %2%\Default.aspx + +echo ...adding Global.asax +Copy %LOCN%Global.asax %2%\Global.asax + +echo ...adding logo and favicon +Copy %LOCN%Content\logo.png %2%\Content\logo.png +Copy %LOCN%favicon.ico %2%\favicon.ico + +echo ...adding partial for header +Copy %LOCN%Views\Shared\_header.bat %2%\Views\Shared\_header.bat + +echo ...adding handlers for 'action missing' and 'controller missing' +Copy %LOCN%Controllers\_actionMissing.bat %2%\Controllers\_actionMissing.bat +Copy %LOCN%Controllers\_controllerMissing.bat %2%\Controllers\_controllerMissing.bat + +echo ...adding default action (Index) +Copy %LOCN%Controllers\Home\Index.bat %2%\Controllers\Home\Index.bat + +echo ...adding binaries +Copy %LOCN%bin\*.dll %2%\bin\ + + +echo ...adding html helper functions +Copy %LOCN%h\*.bat %2%\h\ + +echo Registering http://localhost/%2 with webserver + +echo SITE created. + +goto EXIT + +:CONTROLLER + +REM First determine our location... tricky! + +pushd %cd% + +if NOT EXIST ..\Controllers goto NOT_IN_CONTROLLERS +if NOT EXIST ..\Models goto NOT_IN_CONTROLLERS +if NOT EXIST ..\Views goto NOT_IN_CONTROLLERS + +cd ..\Controllers + +goto Make_Controller + +:NOT_IN_CONTROLLERS + +if EXIST Controllers goto IN_ROOT +if EXIST Models goto IN_ROOT +if EXIST Views goto IN_ROOT + +ECHO This command must be run from the root +ECHO of your website, or from the Controllers +ECHO folder. +popd +goto :EOF + +goto Make_Controller + +:IN_ROOT + +cd Controllers +goto Make_Controller + +:Make_Controller + +echo Creating CONTROLLER %2... +IF NOT EXIST %2 md %2 + +echo Creating default action (index.bat)... + +Copy %LOCN%\Controllers\Home\Index.bat %2%\Index.bat + +popd + +goto EXIT + +:GEN + + +SET controller=%3 +if x%3==x SET controller=Home + + +echo Generating actions for MODEL %2 in Controller %controller%... + +REM First determine our location... tricky! + +pushd %cd% + +if NOT EXIST ..\..\Controllers goto KeepLooking +if NOT EXIST ..\..\Models goto KeepLooking +if NOT EXIST ..\..\Views goto KeepLooking + +cd ..\..\Models + +goto Gen_Model + +:KeepLooking + +if NOT EXIST ..\Controllers goto NOT_IN_MODELS +if NOT EXIST ..\Models goto NOT_IN_MODELS +if NOT EXIST ..\Views goto NOT_IN_MODELS + +cd ..\Models + +goto Gen_Model + +:NOT_IN_MODELS + +if EXIST Controllers goto IN_ROOT2 +if EXIST Models goto IN_ROOT2 +if EXIST Views goto IN_ROOT2 + +ECHO This command must be run from the root +ECHO of your website, or from the Models +ECHO or Controllers folder + +popd + +goto :EOF + +goto Gen_Model + +:IN_ROOT2 + +cd Models + +goto Gen_Model + +:Gen_Model + +FOR /F "eol=; tokens=1,* delims=`" %%A in (%2s.csv) DO ( + (SET FIELDS=%%B) + GOTO DETAILS +) + +:DETAILS + +cscript /nologo split.vbs %FIELDS% > "%2s.fields" + +echo @echo off > ..\Controllers\%controller%\add.bat +echo call ..\..\Views\Shared\_header New %2 >> ..\Controllers\%controller%\add.bat +echo call ..\..\h\h1 New %2 >> ..\Controllers\%controller%\add.bat +echo echo [form method='POST' action='add'] >> ..\Controllers\%controller%\add.bat +echo echo [input type='hidden' id='title' name='ID' value='%2'][/input] >> ..\Controllers\%controller%\add.bat + +SET /A ID=1 +SET outy=".." +for /F %%C in (%2s.fields) do ( + echo echo %%C >> ..\Controllers\%controller%\add.bat + echo echo [br /] >> ..\Controllers\%controller%\add.bat + echo echo [input type='textbox' id='%%C' name='%%C' value='%2' style='width:350px'][/input] >> ..\Controllers\%controller%\add.bat + echo echo [br /] >> ..\Controllers\%controller%\add.bat + SET /A ID=%ID+1 + (SET outy=%outy%+""+%ID%) +) + +echo echo [input type='submit' value='submit' /] >> ..\Controllers\%controller%\add.bat +echo echo [/form] >> ..\Controllers\%controller%\add.bat +echo echo [hr /] >> ..\Controllers\%controller%\add.bat +echo echo [a href='index']back[/a] >> ..\Controllers\%controller%\add.bat + +echo @echo off > ..\Controllers\%controller%\add.cmd +echo REM Determine the next ID value... >> ..\Controllers\%controller%\add.cmd +echo SET /A ID=1 >> ..\Controllers\%controller%\add.cmd +echo FOR /F "eol=; tokens=1,2,3,* skip=2 delims=`" %%%%i in (..\..\Models\Posts.csv) do ( >> ..\Controllers\%controller%\add.cmd +echo (SET /A ID=%%ID+1) >> ..\Controllers\%controller%\add.cmd +echo ) >> ..\Controllers\%controller%\add.cmd + +set rst=%%ID%% +SET /A UPPER=(%ID%-1)*2+1 + +for /L %%i in (3,2,%UPPER%) do call :Loop2 %%i + +goto :EchoResults +:Loop2 +Set RST=%RST%`%%~%1 +goto :EOF + +:EchoResults +echo ECHO %RST% ^>^> ..\..\Models\%2s.csv >> ..\Controllers\%controller%\add.cmd +echo ECHO View/%%ID%% >> ..\Controllers\%controller%\add.cmd +echo EXIT 31 >> ..\Controllers\%controller%\add.cmd + +echo @echo off > ..\Controllers\%controller%\view.bat +echo IF x"%%1"==x"" GOTO EMPTY >> ..\Controllers\%controller%\view.bat +echo FOR /F "eol=; tokens=1-20 skip=2 delims=`" %%%%1 in (..\..\Models\%2s.csv) do ( >> ..\Controllers\%controller%\view.bat +echo IF %%%%1==%%1 ( >> ..\Controllers\%controller%\view.bat +echo call ..\..\Views\Shared\_header %%%%2 >> ..\Controllers\%controller%\view.bat +echo call ..\..\h\h1 %%%%2 >> ..\Controllers\%controller%\view.bat +for /L %%i in (3,1,%ID%) do ( +echo ECHO [p]%%%%%%i[/p] >> ..\Controllers\%controller%\view.bat +) + +echo ) >> ..\Controllers\%controller%\view.bat +echo ) >> ..\Controllers\%controller%\view.bat +echo GOTO EXIT >> ..\Controllers\%controller%\view.bat +echo :EMPTY >> ..\Controllers\%controller%\view.bat +echo call ..\..\Views\Shared\_header Invalid ID >> ..\Controllers\%controller%\view.bat +echo call ..\..\h\h1 Invalid ID >> ..\Controllers\%controller%\view.bat +echo GOTO EXIT >> ..\Controllers\%controller%\view.bat +echo :EXIT >> ..\Controllers\%controller%\view.bat +echo ECHO [a href='/%controller%/index']back...[/a] >> ..\Controllers\%controller%\view.bat + +echo @echo off > ..\Controllers\%controller%\index.bat +echo call ..\..\Views\Shared\_header %controller% %2s >> ..\Controllers\%controller%\index.bat +echo call ..\..\h\h1 %controller% %2S >> ..\Controllers\%controller%\index.bat +echo echo [blink][em]Built with DOS on Dope[/em][/blink] >> ..\Controllers\%controller%\index.bat +echo FOR /F "eol=; tokens=1-20 skip=2 delims=`" %%%%1 in (..\..\Models\%2s.csv) do ( >> ..\Controllers\%controller%\index.bat + +echo call ..\..\h\h1 %%%%2 >> ..\Controllers\%controller%\index.bat +for /L %%i in (3,1,%ID%) do ( +echo ECHO [p]%%%%%%i[/p] >> ..\Controllers\%controller%\index.bat +) +echo ECHO [a href='view/%%%%1']more...[/a] >> ..\Controllers\%controller%\index.bat +echo ECHO [hr /] >> ..\Controllers\%controller%\index.bat +echo ) >> ..\Controllers\%controller%\index.bat +echo echo. >> ..\Controllers\%controller%\index.bat +echo echo [a href='add']Add[/a] >> ..\Controllers\%controller%\index.bat + +popd + +goto EXIT + +:HELP + + +if '%2'=='site' goto HELP_SITE +if '%2'=='controller' goto HELP_CONTROLLER +if '%2'=='model' goto HELP_MODEL +if '%2'=='gen' goto HELP_GEN + +echo. +echo ******************* +echo *** DOS ON DOPE *** +echo *** The MVC web *** +echo *** frame work *** +echo *** built on *** +echo *** batch files *** +echo ******************* +echo. +echo Commands are: +echo dope SITE [[name]] -- to create a SITE named 'name' +echo dope CONTROLLER [[name]] -- to create a CONTROLLER named 'name' +echo dope GEN [[name]] -- to generate controllers and action for a model named 'name' (singular) +echo dope HELP [[command]] -- to request HELP on 'command' + +echo ** Always keep Dope in your Path. ** + +goto exit + +:UNKNOWN + +echo ERROR: Unknown command. %1 +GOTO HELP + +goto EXIT + +:EXIT \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..271195bbad6bf4d6614b97ed71ddc6ab61850dca GIT binary patch literal 822 zcmdUpu?@mN3`Gs3MwAq!K@^!F15k&3u0|P#7U@P{7CJVFIKJ}Hmvu)3l! ~%%B ^& DIR /L /B ~%%B') DO ( + SET LoCaseText=%%A + DEL /Q ~%%B + ) +) +ECHO %LoCaseText% \ No newline at end of file diff --git a/h/a.bat b/h/a.bat new file mode 100644 index 0000000..d8587ff --- /dev/null +++ b/h/a.bat @@ -0,0 +1,2 @@ +@echo off +echo [a href='%~1']%~2[/a] diff --git a/h/h1.bat b/h/h1.bat new file mode 100644 index 0000000..d7c3d7f --- /dev/null +++ b/h/h1.bat @@ -0,0 +1,2 @@ +@echo off +echo [h1]%*[/h1] diff --git a/h/h2.bat b/h/h2.bat new file mode 100644 index 0000000..43c6910 --- /dev/null +++ b/h/h2.bat @@ -0,0 +1,2 @@ +@echo off +echo [h2]%*[/h2] diff --git a/h/h3.bat b/h/h3.bat new file mode 100644 index 0000000..964f406 --- /dev/null +++ b/h/h3.bat @@ -0,0 +1,2 @@ +@echo off +echo [h3]%*[/h3] diff --git a/h/p.bat b/h/p.bat new file mode 100644 index 0000000..d36bfab --- /dev/null +++ b/h/p.bat @@ -0,0 +1,2 @@ +@echo off +echo [p]%*[/p]