├── .gitignore ├── run.bat ├── .tmbuild ├── .hgignore ├── .DS_Store ├── thx └── src │ ├── thx │ ├── graph │ │ ├── Edge.hx │ │ ├── Node.hx │ │ ├── OneCycleRemover.hx │ │ ├── TwoCycleRemover.hx │ │ ├── GraphElement.hx │ │ ├── HeaviestNodeLayer.hx │ │ ├── LongestPathLayer.hx │ │ └── EdgeSplitter.hx │ ├── util │ │ ├── Result.hx │ │ ├── Results.hx │ │ ├── Imports.hx │ │ ├── TypeLocator.hx │ │ └── Message.hx │ ├── sys │ │ ├── db │ │ │ ├── Mysql.hx │ │ │ ├── Object.hx │ │ │ ├── Sqlite.hx │ │ │ ├── ResultSet.hx │ │ │ ├── Connection.hx │ │ │ ├── Transaction.hx │ │ │ └── Manager.hx │ │ ├── io │ │ │ ├── Path.hx │ │ │ ├── Process.hx │ │ │ ├── File.hx │ │ │ ├── FileInput.hx │ │ │ └── FileOutput.hx │ │ ├── Lib.hx │ │ ├── Sys.hx │ │ ├── Web.hx │ │ └── FileSystem.hx │ ├── validation │ │ ├── Option.hx │ │ ├── IValidator.hx │ │ ├── Validator.hx │ │ ├── SingleLineValidator.hx │ │ ├── UrlValidator.hx │ │ ├── PatternValidator.hx │ │ ├── IncrementValidator.hx │ │ ├── CustomValidator.hx │ │ ├── StringLengthValidator.hx │ │ ├── RangeValidator.hx │ │ ├── EmailValidator.hx │ │ └── DateRangeValidator.hx │ ├── xml │ │ ├── ValueFormat.hx │ │ ├── NormalizeNewlineValueFormat.hx │ │ ├── AttributeFormat.hx │ │ ├── NormalizeWhitespaceValueFormat.hx │ │ └── NodeFormat.hx │ ├── math │ │ ├── EaseMode.hx │ │ ├── scale │ │ │ ├── IScale.hx │ │ │ ├── LinearInt.hx │ │ │ └── Quantize.hx │ │ ├── Ease.hx │ │ ├── Random.hx │ │ └── Const.hx │ ├── html │ │ ├── HtmlVersion.hx │ │ ├── HtmlNodeFormat.hx │ │ ├── CloseSelfHtmlNodeFormat.hx │ │ ├── HtmlAttributeFormat.hx │ │ ├── Attribute.hx │ │ ├── HtmlHandler.hx │ │ ├── UnquotedHtmlAttributeFormat.hx │ │ ├── XHtmlFormat.hx │ │ ├── TextHandler.hx │ │ ├── DomHandler.hx │ │ └── HtmlFormat.hx │ ├── geo │ │ ├── IProjection.hx │ │ └── Mercator.hx │ ├── translation │ │ ├── ITranslation.hx │ │ └── EmptyTranslation.hx │ ├── type │ │ └── Metas.hx │ ├── text │ │ └── ERegs.hx │ ├── error │ │ ├── AbstractMethod.hx │ │ ├── NotImplemented.hx │ │ └── Error.hx │ ├── svg │ │ ├── LineInterpolator.hx │ │ └── LineInterpolators.hx │ ├── culture │ │ ├── Info.hx │ │ ├── Language.hx │ │ ├── core │ │ │ └── NumberInfo.hx │ │ └── FormatParams.hx │ ├── languages │ │ ├── It.hx │ │ ├── Ko.hx │ │ ├── Th.hx │ │ ├── Ur.hx │ │ ├── Ar.hx │ │ ├── Ca.hx │ │ ├── Cs.hx │ │ ├── Da.hx │ │ ├── De.hx │ │ ├── El.hx │ │ ├── En.hx │ │ ├── Es.hx │ │ ├── Et.hx │ │ ├── Eu.hx │ │ ├── Fa.hx │ │ ├── Fi.hx │ │ ├── Fr.hx │ │ ├── Gl.hx │ │ ├── He.hx │ │ ├── Hi.hx │ │ ├── Ja.hx │ │ ├── Kk.hx │ │ ├── Kn.hx │ │ ├── Ky.hx │ │ ├── Mr.hx │ │ ├── No.hx │ │ ├── Pa.hx │ │ ├── Pl.hx │ │ ├── Ro.hx │ │ ├── Ru.hx │ │ ├── Sq.hx │ │ ├── Sr.hx │ │ ├── Sv.hx │ │ ├── Ta.hx │ │ ├── Te.hx │ │ ├── Tr.hx │ │ ├── Tt.hx │ │ ├── Uz.hx │ │ ├── Af.hx │ │ ├── Az.hx │ │ ├── Be.hx │ │ ├── Bg.hx │ │ ├── Dv.hx │ │ ├── Fo.hx │ │ ├── Gu.hx │ │ ├── Hr.hx │ │ ├── Hu.hx │ │ ├── Hy.hx │ │ ├── Is.hx │ │ ├── Ka.hx │ │ ├── Kok.hx │ │ ├── Lt.hx │ │ ├── Lv.hx │ │ ├── Mn.hx │ │ ├── Nl.hx │ │ ├── Pt.hx │ │ ├── Sa.hx │ │ ├── Sk.hx │ │ ├── Sl.hx │ │ ├── Sw.hx │ │ ├── Syr.hx │ │ ├── Uk.hx │ │ ├── Ms.hx │ │ ├── Vi.hx │ │ ├── Id.hx │ │ ├── Mk.hx │ │ ├── ZhHans.hx │ │ └── ZhHant.hx │ ├── ini │ │ └── Ini.hx │ ├── collection │ │ ├── Sets.hx │ │ └── Set.hx │ ├── data │ │ └── IDataHandler.hx │ ├── json │ │ ├── Json.hx │ │ └── GeoJson.hx │ ├── color │ │ └── Categories.hx │ └── cultures │ │ └── IuCansCA.hx │ ├── DynamicsT.hx │ ├── Enums.hx │ └── IntHashes.hx ├── src ├── ufront │ ├── web │ │ ├── .DS_Store │ │ ├── UrlDirection.hx │ │ ├── mvc │ │ │ ├── ActionDescriptor.hx │ │ │ ├── IExceptionFilter.hx │ │ │ ├── IViewHelper.hx │ │ │ ├── IResultFilter.hx │ │ │ ├── IDependencyResolver.hx │ │ │ ├── IModelBinder.hx │ │ │ ├── IController.hx │ │ │ ├── IValueProvider.hx │ │ │ ├── IViewEngine.hx │ │ │ ├── ModelBinders.hx │ │ │ ├── attributes │ │ │ │ └── FilterAttribute.hx │ │ │ ├── IActionInvoker.hx │ │ │ ├── IView.hx │ │ │ ├── IAuthorizationFilter.hx │ │ │ ├── EmptyResult.hx │ │ │ ├── IActionFilter.hx │ │ │ ├── ActionResult.hx │ │ │ ├── FormValueProvider.hx │ │ │ ├── HttpUnauthorizedResult.hx │ │ │ ├── IControllerFactory.hx │ │ │ ├── RouteDataValueProvider.hx │ │ │ ├── QueryStringValueProvider.hx │ │ │ ├── ValueProviderFactory.hx │ │ │ ├── ViewEngineResult.hx │ │ │ ├── view │ │ │ │ ├── HTemplateView.hx │ │ │ │ ├── ITemplateViewEngine.hx │ │ │ │ ├── TranslationHelper.hx │ │ │ │ ├── ErazorView.hx │ │ │ │ ├── ITemplateView.hx │ │ │ │ ├── HashHelper.hx │ │ │ │ ├── XHtmlHelper.hx │ │ │ │ └── FormatHelper.hx │ │ │ ├── DependencyResolver.hx │ │ │ ├── ResultExecutingContext.hx │ │ │ ├── ResultExecutedContext.hx │ │ │ ├── BytesResult.hx │ │ │ ├── ValueProviderUtil.hx │ │ │ ├── RouteDataValueProviderFactory.hx │ │ │ ├── ValueProviderFactories.hx │ │ │ ├── FormValueProviderFactory.hx │ │ │ ├── ActionExecutingContext.hx │ │ │ ├── ContentResult.hx │ │ │ ├── QueryStringValueProviderFactory.hx │ │ │ ├── JsonResult.hx │ │ │ ├── ActionExecutedContext.hx │ │ │ ├── AuthorizationContext.hx │ │ │ ├── ModelBindingContext.hx │ │ │ ├── DetoxResult.hx │ │ │ ├── ParameterDescriptor.hx │ │ │ ├── ValueProviderFactoryCollection.hx │ │ │ ├── DefaultDependencyResolver.hx │ │ │ ├── ForwardResult.hx │ │ │ ├── ViewEngines.hx │ │ │ ├── FilePathResult.hx │ │ │ ├── JsonPResult.hx │ │ │ ├── FileResult.hx │ │ │ ├── RedirectResult.hx │ │ │ ├── ValueProviderCollection.hx │ │ │ ├── ControllerBuilder.hx │ │ │ ├── ExceptionContext.hx │ │ │ ├── ControllerContext.hx │ │ │ └── ImageResult.hx │ │ ├── error │ │ │ ├── BadRequestError.hx │ │ │ ├── PageNotFoundError.hx │ │ │ ├── UnauthorizedError.hx │ │ │ ├── InternalServerError.hx │ │ │ ├── MethodNotAllowedError.hx │ │ │ ├── UnprocessableEntityError.hx │ │ │ └── HttpError.hx │ │ ├── routing │ │ │ ├── RouteValueDefault.hx │ │ │ ├── EmptyRoute.hx │ │ │ ├── IRouteHandler.hx │ │ │ ├── IRouteConstraint.hx │ │ │ ├── RouteBase.hx │ │ │ ├── RequestContext.hx │ │ │ ├── RouteData.hx │ │ │ └── RouteCollection.hx │ │ ├── IHttpModule.hx │ │ ├── module │ │ │ ├── ITraceModule.hx │ │ │ └── TraceToFileModule.hx │ │ ├── IUrlFilter.hx │ │ ├── IHttpUploadHandler.hx │ │ ├── EmptyUploadHandler.hx │ │ ├── IHttpSessionState.hx │ │ ├── session │ │ │ └── FileSession.hx │ │ ├── VirtualUrl.hx │ │ ├── DirectoryUrlFilter.hx │ │ ├── AppConfiguration.hx │ │ ├── HttpContextImpl.hx │ │ └── SaveToDirectoryUploadHandler.hx │ ├── auth │ │ ├── IAuthAdapter.hx │ │ ├── IAuthStorage.hx │ │ ├── AuthResultMessage.hx │ │ ├── AuthResult.hx │ │ ├── storage │ │ │ ├── MemoryStorage.hx │ │ │ └── SessionStorage.hx │ │ └── Auth.hx │ ├── events │ │ └── ReverseDispatcher.hx │ └── external │ │ └── mvc │ │ ├── UnjectDependencyResolver.hx │ │ └── ThxDependencyResolver.hx └── neko │ └── ufront │ └── web │ └── FileSession.hx ├── test ├── ufront │ ├── web │ │ ├── mvc │ │ │ ├── .DS_Store │ │ │ ├── test │ │ │ │ └── MockController.hx │ │ │ ├── view │ │ │ │ └── Helper.hx │ │ │ ├── MockController.hx │ │ │ ├── attributes │ │ │ │ ├── AuthFailAttribute.hx │ │ │ │ ├── TestAction2Attribute.hx │ │ │ │ ├── TestActionAttribute.hx │ │ │ │ ├── TestResult2Attribute.hx │ │ │ │ ├── TestResultAttribute.hx │ │ │ │ └── HandleExceptionAttribute.hx │ │ │ ├── ControllerTest.hx │ │ │ └── TestViewResult.hx │ │ ├── HttpResponseMock.hx │ │ ├── HttpContextMock.hx │ │ ├── TestAll.hx │ │ ├── routing │ │ │ ├── TestAll.hx │ │ │ ├── BaseTest.hx │ │ │ └── TestPatternConstraint.hx │ │ ├── TestHttpResponse.hx │ │ ├── HttpSessionStateMock.hx │ │ └── TestHttpCookie.hx │ ├── acl │ │ └── TestAll.hx │ ├── TestAll.hx │ └── auth │ │ └── TestAll.hx └── TestAll.hx ├── doc.bat ├── bundle.sh ├── ufront.php.hxml ├── release.bat ├── doc.hxml ├── haxelib.json ├── src-exp └── nodejs │ └── ufront │ └── web │ ├── FileSession.hx │ └── HttpResponse.hx └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | bin 3 | doc 4 | -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | cd bin 2 | neko index.n 3 | pause -------------------------------------------------------------------------------- /.tmbuild: -------------------------------------------------------------------------------- 1 | /Users/francoponticelli/Projects/ufront/build.php.hxml -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | bin 2 | .DS_Store 3 | .tmbuild 4 | .hgignore 5 | doc/html 6 | doc/tmp -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufront/ufront-mvc-classic/master/.DS_Store -------------------------------------------------------------------------------- /thx/src/thx/graph/Edge.hx: -------------------------------------------------------------------------------- 1 | package thx.graph; 2 | 3 | typedef Edge = { 4 | a : String, 5 | b : String 6 | } -------------------------------------------------------------------------------- /src/ufront/web/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufront/ufront-mvc-classic/master/src/ufront/web/.DS_Store -------------------------------------------------------------------------------- /test/ufront/web/mvc/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ufront/ufront-mvc-classic/master/test/ufront/web/mvc/.DS_Store -------------------------------------------------------------------------------- /thx/src/thx/util/Result.hx: -------------------------------------------------------------------------------- 1 | package thx.util; 2 | 3 | enum Result 4 | { 5 | Ok; 6 | Failure(messages : Array); 7 | } -------------------------------------------------------------------------------- /doc.bat: -------------------------------------------------------------------------------- 1 | chxdoc.exe --config=cfg.chxdoc --policy=deny --allow=neko.ufront.* --allow=php.ufront.* --allow=ufront.* -f ufront.xml 2 | -------------------------------------------------------------------------------- /src/ufront/auth/IAuthAdapter.hx: -------------------------------------------------------------------------------- 1 | package ufront.auth; 2 | 3 | interface IAuthAdapter 4 | { 5 | public function authenticate() : AuthResult; 6 | } -------------------------------------------------------------------------------- /thx/src/thx/graph/Node.hx: -------------------------------------------------------------------------------- 1 | package thx.graph; 2 | 3 | typedef Node = { 4 | vertex : String, 5 | edgesn : Array, 6 | edgesp : Array 7 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Mysql.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Mysql = php.db.Mysql; 5 | #elseif neko 6 | typedef Mysql = neko.db.Mysql; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Object.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Object = php.db.Object; 5 | #elseif neko 6 | typedef Object = neko.db.Object; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Sqlite.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Sqlite = php.db.Sqlite; 5 | #elseif neko 6 | typedef Sqlite = neko.db.Sqlite; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/db/ResultSet.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef ResultSet = php.db.ResultSet; 5 | #elseif neko 6 | typedef ResultSet = neko.db.ResultSet; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Connection.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Connection = php.db.Connection; 5 | #elseif neko 6 | typedef Connection = neko.db.Connection; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Transaction.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Transaction = php.db.Transaction; 5 | #elseif neko 6 | typedef Transaction = neko.db.Transaction; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/io/Path.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.io; 2 | 3 | #if neko 4 | typedef Path = neko.io.Path; 5 | #elseif php 6 | typedef Path = php.io.Path; 7 | #elseif cpp 8 | typedef Path = cpp.io.Path; 9 | #end -------------------------------------------------------------------------------- /src/ufront/web/UrlDirection.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web; 7 | 8 | enum UrlDirection 9 | { 10 | IncomingUrlRequest; 11 | UrlGeneration; 12 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/db/Manager.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.db; 2 | 3 | #if php 4 | typedef Manager = php.db.Manager; 5 | #elseif neko 6 | typedef Manager = neko.db.Manager; 7 | #end -------------------------------------------------------------------------------- /thx/src/thx/validation/Option.hx: -------------------------------------------------------------------------------- 1 | package thx.validation; 2 | 3 | /** 4 | * ... 5 | * @author Franco Ponticelli 6 | */ 7 | 8 | typedef Option = 9 | { 10 | label : String, 11 | value : T 12 | } -------------------------------------------------------------------------------- /thx/src/thx/xml/ValueFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.xml; 2 | 3 | class ValueFormat 4 | { 5 | public function new(){} 6 | 7 | public function format(value : String) 8 | { 9 | return value; 10 | } 11 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/io/Process.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.io; 2 | 3 | #if neko 4 | typedef Process = neko.io.Process; 5 | #elseif php 6 | typedef Process = php.io.Process; 7 | #elseif cpp 8 | typedef Process = cpp.io.Process; 9 | #end -------------------------------------------------------------------------------- /thx/src/thx/math/EaseMode.hx: -------------------------------------------------------------------------------- 1 | package thx.math; 2 | 3 | /** 4 | * ... 5 | * @author Franco Ponticelli 6 | */ 7 | 8 | enum EaseMode 9 | { 10 | EaseIn; 11 | EaseOut; 12 | EaseInEaseOut; 13 | EaseOutEaseIn; 14 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/ActionDescriptor.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * ... 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class ActionDescriptor 9 | { 10 | public function new() 11 | { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | libname='ufront-mvc-classic' 4 | rm -f "${libname}.zip" 5 | zip -r "${libname}.zip" haxelib.json src LICENSE.txt README.md 6 | cd thx 7 | zip -r "../${libname}.zip" src 8 | cd .. 9 | echo "Saved as ${libname}.zip" 10 | -------------------------------------------------------------------------------- /src/ufront/auth/IAuthStorage.hx: -------------------------------------------------------------------------------- 1 | package ufront.auth; 2 | 3 | interface IAuthStorage 4 | { 5 | public function isEmpty() : Bool; 6 | public function read() : T; 7 | public function write(contents : T) : Void; 8 | public function clear() : Void; 9 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IExceptionFilter.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** Defines the methods that are required for an exception filter. */ 4 | interface IExceptionFilter 5 | { 6 | function onException(filterContext : ExceptionContext) : Void; 7 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/Lib.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.sys; 7 | 8 | #if neko 9 | typedef Lib = neko.Lib; 10 | #elseif php 11 | typedef Lib = php.Lib; 12 | #elseif cpp 13 | typedef Lib = cpp.Lib; 14 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/Sys.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.sys; 7 | 8 | #if neko 9 | typedef Sys = neko.Sys; 10 | #elseif php 11 | typedef Sys = php.Sys; 12 | #elseif cpp 13 | typedef Sys = cpp.Sys; 14 | #end -------------------------------------------------------------------------------- /ufront.php.hxml: -------------------------------------------------------------------------------- 1 | -cp src 2 | -cp test 3 | -cp ../core/src 4 | -cp ../htemplate/src 5 | -cp ../utest/src 6 | -cp ../erazor/src 7 | -lib hxevents 8 | #-lib hxculture 9 | -lib hscript 10 | -lib umock 11 | -php bin 12 | -main TestAll 13 | -------------------------------------------------------------------------------- /src/ufront/web/error/BadRequestError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class BadRequestError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(400, "Bad Request", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /src/ufront/web/error/PageNotFoundError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class PageNotFoundError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(404, "Page Not Found", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /src/ufront/web/routing/RouteValueDefault.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web.routing; 7 | 8 | enum RouteValueDefault 9 | { 10 | Value(v : Dynamic); 11 | Optional(t : Type.ValueType); 12 | } -------------------------------------------------------------------------------- /thx/src/thx/html/HtmlVersion.hx: -------------------------------------------------------------------------------- 1 | package thx.html; 2 | 3 | enum HtmlVersion 4 | { 5 | Html401Strict; 6 | Html401Transitional; 7 | Html401Frameset; 8 | Html5; 9 | XHtml10Transitional; 10 | XHtml10Strict; 11 | XHtml10Frameset; 12 | XHtml11; 13 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/Web.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.sys; 7 | 8 | #if neko 9 | typedef Web = neko.Web; 10 | #elseif php 11 | typedef Web = php.Web; 12 | #elseif cpp 13 | //typedef Web = cpp.Web; 14 | #end -------------------------------------------------------------------------------- /thx/src/thx/sys/io/File.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.io; 2 | 3 | #if haxe3 4 | typedef File = sys.io.File; 5 | #elseif neko 6 | typedef File = neko.io.File; 7 | #elseif php 8 | typedef File = php.io.File; 9 | #elseif cpp 10 | typedef File = cpp.io.File; 11 | #end -------------------------------------------------------------------------------- /src/ufront/web/routing/EmptyRoute.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.routing; 2 | 3 | class EmptyRoute extends RouteBase 4 | { 5 | public static var instance(default, null) : RouteBase; 6 | public function new(){} 7 | static function __init__() instance = new EmptyRoute(); 8 | } -------------------------------------------------------------------------------- /src/ufront/web/IHttpModule.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web; 7 | 8 | interface IHttpModule 9 | { 10 | public function init(application : HttpApplication) : Void; 11 | public function dispose() : Void; 12 | } -------------------------------------------------------------------------------- /src/ufront/web/error/UnauthorizedError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class UnauthorizedError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(401, "Unauthorized Access", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /src/ufront/web/error/InternalServerError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class InternalServerError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(500, "Internal Server Error", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IViewHelper.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | import haxe.ds.StringMap; 4 | 5 | /** 6 | * ... 7 | * @author Franco Ponticelli 8 | */ 9 | 10 | interface IViewHelper 11 | { 12 | public function register(data : StringMap) : Void; 13 | } -------------------------------------------------------------------------------- /src/ufront/web/error/MethodNotAllowedError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class MethodNotAllowedError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(405, "Method Not Allowed", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /thx/src/thx/geo/IProjection.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.geo; 7 | 8 | interface IProjection 9 | { 10 | public function project(coords : Array) : Array; 11 | public function invert(coords : Array) : Array; 12 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/io/FileInput.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.io; 2 | 3 | #if haxe3 4 | typedef FileInput = sys.io.FileInput; 5 | #if neko 6 | typedef FileInput = neko.io.FileInput; 7 | #elseif php 8 | typedef FileInput = php.io.FileInput; 9 | #elseif cpp 10 | typedef FileInput = cpp.io.FileInput; 11 | #end -------------------------------------------------------------------------------- /src/ufront/auth/AuthResultMessage.hx: -------------------------------------------------------------------------------- 1 | package ufront.auth; 2 | import thx.util.Message; 3 | 4 | enum AuthResultMessage 5 | { 6 | Success; 7 | Failure(?msg : Message); 8 | IdentityNotFound(?msg : Message); 9 | IdentityAmbiguous(?msg : Message); 10 | InvalidCredential(?msg : Message); 11 | } -------------------------------------------------------------------------------- /src/ufront/web/module/ITraceModule.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.module; 2 | 3 | import haxe.PosInfos; 4 | import ufront.web.HttpApplication; 5 | import ufront.web.IHttpModule; 6 | 7 | interface ITraceModule extends IHttpModule 8 | { 9 | public function trace(msg : Dynamic, ?pos : PosInfos) : Void; 10 | } -------------------------------------------------------------------------------- /src/ufront/web/error/UnprocessableEntityError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | 4 | class UnprocessableEntityError extends HttpError 5 | { 6 | public function new(?pos : PosInfos) 7 | { 8 | super(422, "Unprocessable Entity", pos); 9 | } 10 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/io/FileOutput.hx: -------------------------------------------------------------------------------- 1 | package thx.sys.io; 2 | 3 | #if haxe3 4 | typedef FileOutput = sys.io.FileOutput; 5 | #elseif neko 6 | typedef FileOutput = neko.io.FileOutput; 7 | #elseif php 8 | typedef FileOutput = php.io.FileOutput; 9 | #elseif cpp 10 | typedef FileOutput = cpp.io.FileOutput; 11 | #end -------------------------------------------------------------------------------- /thx/src/thx/validation/IValidator.hx: -------------------------------------------------------------------------------- 1 | package thx.validation; 2 | 3 | /** 4 | * ... 5 | * @author Franco Ponticelli 6 | */ 7 | 8 | import thx.util.Result; 9 | 10 | interface IValidator 11 | { 12 | public function validate(value : T) : Result; 13 | public function isValid(value : T) : Bool; 14 | } -------------------------------------------------------------------------------- /release.bat: -------------------------------------------------------------------------------- 1 | haxe doc.hxml 2 | rmdir /S /Q release 3 | rmdir release.zip 4 | mkdir release 5 | xcopy src release /S 6 | xcopy haxelib.xml release 7 | xcopy haxedoc.xml release 8 | cd release 9 | 7z a -tzip ..\release.zip * 10 | cd .. 11 | rmdir /S /Q release 12 | haxelib submit release.zip 13 | pause -------------------------------------------------------------------------------- /src/ufront/web/IUrlFilter.hx: -------------------------------------------------------------------------------- 1 | package ufront.web; 2 | import ufront.web.HttpRequest; 3 | import ufront.web.UrlDirection; 4 | 5 | interface IUrlFilter 6 | { 7 | public function filterIn(url : PartialUrl, request : HttpRequest) : Void; 8 | public function filterOut(url : VirtualUrl, request : HttpRequest) : Void; 9 | } -------------------------------------------------------------------------------- /thx/src/thx/translation/ITranslation.hx: -------------------------------------------------------------------------------- 1 | package thx.translation; 2 | 3 | interface ITranslation 4 | { 5 | public var domain(get, set) : String; 6 | public function singular(id : String, ?domain : String) : String; 7 | public function plural(ids : String, idp : String, quantifier : Int, ?domain : String) : String; 8 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IResultFilter.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** Defines the methods that are required for a result filter. */ 4 | interface IResultFilter 5 | { 6 | function onResultExecuting(filterContext : ResultExecutingContext) : Void; 7 | function onResultExecuted(filterContext : ResultExecutedContext) : Void; 8 | } -------------------------------------------------------------------------------- /thx/src/thx/math/scale/IScale.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.math.scale; 7 | 8 | interface IScale 9 | { 10 | public function scale(x : TDomain) : TRange; 11 | public function getDomain() : Array; 12 | public function getRange() : Array; 13 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IDependencyResolver.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Defines the methods that simplify service location and dependency resolution. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | interface IDependencyResolver 9 | { 10 | function getService(serviceType : Class) : T; 11 | } 12 | -------------------------------------------------------------------------------- /src/ufront/web/mvc/IModelBinder.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Defines the methods that are required for a model binder. 5 | * @author Andreas Soderlund 6 | */ 7 | interface IModelBinder 8 | { 9 | function bindModel(controllerContext : ControllerContext, bindingContext : ModelBindingContext) : Dynamic; 10 | } -------------------------------------------------------------------------------- /thx/src/thx/html/HtmlNodeFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.html; 2 | 3 | import thx.xml.NodeFormat; 4 | 5 | class HtmlNodeFormat extends NodeFormat 6 | { 7 | override public function formatEmptyElement(node : Xml) 8 | { 9 | return 10 | "<" 11 | + node.nodeName 12 | + attributeFormat.formatAttributes(node) 13 | + ">"; 14 | } 15 | } -------------------------------------------------------------------------------- /src/ufront/web/routing/IRouteHandler.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web.routing; 7 | import ufront.web.IHttpHandler; 8 | import ufront.web.routing.RequestContext; 9 | 10 | interface IRouteHandler 11 | { 12 | public function getHttpHandler(requestContext : RequestContext) : IHttpHandler; 13 | } -------------------------------------------------------------------------------- /thx/src/thx/type/Metas.hx: -------------------------------------------------------------------------------- 1 | package thx.type; 2 | 3 | import haxe.rtti.Meta; 4 | 5 | class Metas 6 | { 7 | public static function getFieldInfo(cls : Class, field : String) 8 | { 9 | var fields = Meta.getFields(cls); 10 | if(null == fields) 11 | return null; 12 | else 13 | return Reflect.field(fields, field); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ufront/web/mvc/IController.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | import ufront.web.routing.RequestContext; 3 | 4 | /** Defines the methods that are required for a controller. */ 5 | interface IController 6 | { 7 | public function execute(requestContext : RequestContext, async : hxevents.Async) : Void; 8 | public function getViewHelpers() : Array; 9 | } -------------------------------------------------------------------------------- /thx/src/thx/sys/FileSystem.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.sys; 7 | 8 | #if haxe3 9 | typedef FileSystem = sys.FileSystem; 10 | #elseif neko 11 | typedef FileSystem = neko.FileSystem; 12 | #elseif php 13 | typedef FileSystem = php.FileSystem; 14 | #elseif cpp 15 | typedef FileSystem = cpp.FileSystem; 16 | #end -------------------------------------------------------------------------------- /src/ufront/web/mvc/IValueProvider.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Defines the methods that are required for a value provider in Ufront 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | interface IValueProvider 9 | { 10 | function containsPrefix(prefix : String) : Bool; 11 | function getValue(key : String) : ValueProviderResult; 12 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IViewEngine.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** Defines the methods that are required for a view engine. */ 4 | interface IViewEngine 5 | { 6 | public function findView(controllerContext : ControllerContext, viewName : String) : ViewEngineResult; 7 | public function releaseView(controllerContext : ControllerContext, view : IView) : Void; 8 | } -------------------------------------------------------------------------------- /thx/src/thx/text/ERegs.hx: -------------------------------------------------------------------------------- 1 | package thx.text; 2 | 3 | class ERegs 4 | { 5 | static var _escapePattern = ~/[\*\+\?\|\{\[\(\)\^\$\.# \\]/g; 6 | public static function escapeERegChars(s : String) 7 | { 8 | if (_escapePattern.match(s)) 9 | return _escapePattern.map(s, function(e : EReg) return "\\" + e.matched(0)); 10 | else 11 | return s; 12 | } 13 | } -------------------------------------------------------------------------------- /test/ufront/web/HttpResponseMock.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web; 7 | 8 | import haxe.io.BytesOutput; 9 | import ufront.web.HttpResponse; 10 | import haxe.io.Output; 11 | 12 | class HttpResponseMock extends HttpResponse 13 | { 14 | public function new() 15 | { 16 | super(); 17 | } 18 | } -------------------------------------------------------------------------------- /thx/src/thx/error/AbstractMethod.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.error; 7 | 8 | import haxe.PosInfos; 9 | 10 | class AbstractMethod extends Error 11 | { 12 | public function new(?posInfo : PosInfos) 13 | { 14 | super("method {0}.{1}() is abstract", [posInfo.className, posInfo.methodName], posInfo); 15 | } 16 | } -------------------------------------------------------------------------------- /thx/src/thx/html/CloseSelfHtmlNodeFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.html; 2 | 3 | import thx.xml.NodeFormat; 4 | 5 | class CloseSelfHtmlNodeFormat extends HtmlNodeFormat 6 | { 7 | override public function formatCloseElement(node : Xml) 8 | { 9 | if(Element.isCloseSelf(node.nodeName)) 10 | return ""; 11 | else 12 | return ""; 13 | } 14 | } -------------------------------------------------------------------------------- /thx/src/thx/error/NotImplemented.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package thx.error; 7 | import haxe.PosInfos; 8 | 9 | class NotImplemented extends Error 10 | { 11 | public function new(?posInfo : PosInfos) 12 | { 13 | super("method {0}.{1}() needs to be implemented", [posInfo.className, posInfo.methodName], posInfo); 14 | } 15 | } -------------------------------------------------------------------------------- /thx/src/thx/html/HtmlAttributeFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.html; 2 | 3 | import thx.xml.AttributeFormat; 4 | 5 | class HtmlAttributeFormat extends AttributeFormat 6 | { 7 | override public function formatAttribute(name : String, value : String) 8 | { 9 | if(Attribute.isFill(name)) 10 | return name; 11 | else 12 | return name + '="' + value + '"'; 13 | } 14 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/ModelBinders.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Provides global access to the model binders for the application. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class ModelBinders 9 | { 10 | /** Gets the model binders for the application. */ 11 | public static var binders : ModelBinderDictionary = new ModelBinderDictionary(); 12 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/attributes/FilterAttribute.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc.attributes; 2 | import thx.error.Error; 3 | 4 | /** Represents the base class for action and result filter attributes. */ 5 | class FilterAttribute 6 | { 7 | /** Gets or sets the order in which the action filters are executed. */ 8 | public var order : Int; 9 | public function new() { order = -1; } 10 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IActionInvoker.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Defines the contract for an action invoker, which is used to invoke an action in response to an HTTP request. 5 | * @author Andreas Soderlund 6 | */ 7 | interface IActionInvoker 8 | { 9 | function invokeAction(controllerContext : ControllerContext, actionName : String, async : hxevents.Async) : Void; 10 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IView.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | import haxe.ds.StringMap; 4 | 5 | /** Defines the methods that are required for a view. */ 6 | interface IView 7 | { 8 | // TODO outputData should be removed if not needed anymore after HtmlViewResult has been moved to filter 9 | public function render(viewContext : ViewContext, outputData : StringMap) : String; 10 | } -------------------------------------------------------------------------------- /src/ufront/events/ReverseDispatcher.hx: -------------------------------------------------------------------------------- 1 | package ufront.events; 2 | import hxevents.Dispatcher; 3 | 4 | /** 5 | * ... 6 | * @author Andreas Soderlund 7 | */ 8 | class ReverseDispatcher extends Dispatcher 9 | { 10 | public function new() { super(); } 11 | 12 | override public function add(h : T -> Void) : T -> Void { 13 | handlers.unshift(h); 14 | return h; 15 | } 16 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IAuthorizationFilter.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | import hxevents.Dispatcher; 4 | 5 | /** Defines the methods that are required for an authorization filter. */ 6 | interface IAuthorizationFilter 7 | { 8 | function onAuthorization(filterContext : AuthorizationContext) : Void; 9 | //public var onFailedAuthorization(default, null) : Dispatcher; 10 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/EmptyResult.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents a result that does nothing, such as a controller action method that returns nothing. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class EmptyResult extends ActionResult 9 | { 10 | public function new(){} 11 | 12 | override public function executeResult(controllerContext : ControllerContext){} 13 | } -------------------------------------------------------------------------------- /src/ufront/web/IHttpUploadHandler.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web; 7 | import haxe.io.Bytes; 8 | 9 | interface IHttpUploadHandler 10 | { 11 | public function uploadStart(name : String, filename : String) : Void; 12 | public function uploadProgress(bytes : Bytes, pos : Int, len : Int) : Void; 13 | public function uploadEnd() : Void; 14 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IActionFilter.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | import hxevents.Dispatcher; 4 | import ufront.events.ReverseDispatcher; 5 | 6 | /** Defines the methods that are used in an action filter. */ 7 | interface IActionFilter 8 | { 9 | function onActionExecuting(filterContext : ActionExecutingContext) : Void; 10 | function onActionExecuted(filterContext : ActionExecutedContext) : Void; 11 | } -------------------------------------------------------------------------------- /src/ufront/web/error/HttpError.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.error; 2 | import haxe.PosInfos; 3 | import thx.error.Error; 4 | 5 | class HttpError extends Error 6 | { 7 | public var code : Int; 8 | public function new(code : Int, message : String, ?params : Array, ?param : Dynamic, ?pos : PosInfos) 9 | { 10 | super("Error " + code + ": " + message, params, param, pos); 11 | this.code = code; 12 | } 13 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/ActionResult.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method. */ 4 | class ActionResult 5 | { 6 | /** Enables processing of the result of an action method by a custom type that inherits from the ActionResult class. */ 7 | public function executeResult(controllerContext : ControllerContext){} 8 | } -------------------------------------------------------------------------------- /thx/src/thx/svg/LineInterpolator.hx: -------------------------------------------------------------------------------- 1 | package thx.svg; 2 | 3 | /** 4 | * Based on D3.js by Michael Bostock 5 | * @author Franco Ponticelli 6 | */ 7 | 8 | enum LineInterpolator 9 | { 10 | Linear; 11 | Step; 12 | StepBefore; 13 | StepAfter; 14 | Basis; 15 | BasisOpen; 16 | BasisClosed; 17 | Cardinal(?tension : Float); 18 | CardinalOpen(?tension : Float); 19 | CardinalClosed(?tension : Float); 20 | Monotone; 21 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/FormValueProvider.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents a value provider for form values that are contained in a HashValueCollection object. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class FormValueProvider extends HashValueProvider 9 | { 10 | public function new(controllerContext : ControllerContext) 11 | { 12 | super(controllerContext.request.post); 13 | } 14 | } -------------------------------------------------------------------------------- /test/ufront/web/mvc/test/MockController.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc.test; 2 | import ufront.web.routing.RequestContext; 3 | import ufront.web.mvc.Controller; 4 | 5 | class MockController extends Controller { 6 | public var disposed : Bool; 7 | public function new() 8 | { 9 | super(); 10 | disposed = false; 11 | } 12 | 13 | override function execute(requestContext : RequestContext, async : hxevents.Async) : Void{} 14 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/HttpUnauthorizedResult.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents the result of an unauthorized HTTP request. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class HttpUnauthorizedResult extends ActionResult 9 | { 10 | public function new(){} 11 | 12 | override function executeResult(context : ControllerContext) 13 | { 14 | context.httpContext.response.status = 401; 15 | } 16 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/IControllerFactory.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | import ufront.web.routing.RequestContext; 3 | 4 | /** Provides fine-grained control over how controllers are instantiated using dependency injection. */ 5 | interface IControllerFactory 6 | { 7 | public function createController(requestContext : RequestContext, controllerName : String) : IController; 8 | public function releaseController(controller : IController) : Void; 9 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/RouteDataValueProvider.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents a value provider for route data that is contained in a HashValueProvider object. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class RouteDataValueProvider extends HashValueProvider 9 | { 10 | public function new(controllerContext : ControllerContext) 11 | { 12 | super(controllerContext.routeData.data); 13 | } 14 | } -------------------------------------------------------------------------------- /src/ufront/web/EmptyUploadHandler.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | package ufront.web; 7 | import haxe.io.Bytes; 8 | 9 | class EmptyUploadHandler implements IHttpUploadHandler 10 | { 11 | public function new(){} 12 | public function uploadStart(name : String, filename : String) : Void{} 13 | public function uploadProgress(bytes : Bytes, pos : Int, len : Int) : Void{} 14 | public function uploadEnd() : Void{} 15 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/QueryStringValueProvider.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents a value provider for query strings that are contained in a HashValueProvider object. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class QueryStringValueProvider extends HashValueProvider 9 | { 10 | public function new(controllerContext : ControllerContext) 11 | { 12 | super(controllerContext.request.query); 13 | } 14 | } -------------------------------------------------------------------------------- /test/TestAll.hx: -------------------------------------------------------------------------------- 1 | import utest.Runner; 2 | import utest.ui.Report; 3 | 4 | class TestAll 5 | { 6 | public static function addTests(runner : Runner) 7 | { 8 | ufront.TestAll.addTests(runner); 9 | } 10 | 11 | public static function main() 12 | { 13 | try { 14 | var runner = new Runner(); 15 | addTests(runner); 16 | Report.create(runner); 17 | runner.run(); 18 | } catch(e : Dynamic) { 19 | trace(e); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/ValueProviderFactory.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Represents a factory for creating value-provider objects. 5 | * @author Andreas Soderlund 6 | */ 7 | 8 | class ValueProviderFactory 9 | { 10 | private function new() { } 11 | 12 | public function getValueProvider(controllerContext : ControllerContext) : IValueProvider 13 | { 14 | return throw "Abstract method, must be overridden in subclass."; 15 | } 16 | } -------------------------------------------------------------------------------- /thx/src/thx/validation/Validator.hx: -------------------------------------------------------------------------------- 1 | package thx.validation; 2 | import thx.error.AbstractMethod; 3 | import thx.util.Result; 4 | /** 5 | * ... 6 | * @author Franco Ponticelli 7 | */ 8 | 9 | class Validator implements IValidator 10 | { 11 | public function validate(value : T) : Result 12 | { 13 | return throw new AbstractMethod(); 14 | } 15 | 16 | public function isValid(value : T) : Bool 17 | { 18 | return Type.enumEq(validate(value), Ok); 19 | } 20 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/ViewEngineResult.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** Represents the result of locating a view engine. */ 4 | class ViewEngineResult 5 | { 6 | /** Gets the view */ 7 | public var view(default, null) : IView; 8 | 9 | /** Gets the view engine */ 10 | public var viewEngine(default, null) : IViewEngine; 11 | 12 | public function new(view : IView, viewEngine : IViewEngine) 13 | { 14 | this.view = view; 15 | this.viewEngine = viewEngine; 16 | } 17 | } -------------------------------------------------------------------------------- /thx/src/thx/xml/NormalizeNewlineValueFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.xml; 2 | 3 | class NormalizeNewlineValueFormat extends ValueFormat 4 | { 5 | var _newLineReplace : EReg; 6 | var _newline : String; 7 | public function new(newline = "\n") 8 | { 9 | super(); 10 | _newline = newline; 11 | _newLineReplace = ~/(\r\n|\n\r|\n|\r)/m; 12 | } 13 | 14 | override public function format(value : String) 15 | { 16 | return _newLineReplace.replace(value, _newline); 17 | } 18 | } -------------------------------------------------------------------------------- /test/ufront/acl/TestAll.hx: -------------------------------------------------------------------------------- 1 | package ufront.acl; 2 | 3 | import utest.Runner; 4 | import utest.ui.Report; 5 | 6 | import ufront.acl.Acl; 7 | 8 | class TestAll 9 | { 10 | public static function addTests(runner : Runner) 11 | { 12 | TestAcl.addTests(runner); 13 | TestRegistry.addTests(runner); 14 | } 15 | 16 | public static function main() 17 | { 18 | var runner = new Runner(); 19 | addTests(runner); 20 | Report.create(runner); 21 | runner.run(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/ufront/auth/AuthResult.hx: -------------------------------------------------------------------------------- 1 | package ufront.auth; 2 | 3 | class AuthResult 4 | { 5 | public var isvalid(default, null) : Bool; 6 | public var message(default, null) : AuthResultMessage; 7 | public var identity(default, null) : T; 8 | public function new(msg : AuthResultMessage, ?identity : T) 9 | { 10 | switch(msg) 11 | { 12 | case Success: isvalid = true; 13 | default: isvalid = false; 14 | } 15 | message = msg; 16 | this.identity = identity; 17 | } 18 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/view/HTemplateView.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc.view; 2 | 3 | #if htemplate 4 | import htemplate.Template; 5 | import haxe.ds.StringMap; 6 | 7 | class HTemplateView extends TemplateView 8 | { 9 | override public function executeTemplate(template : Template, data : StringMap) : String 10 | { 11 | return template.execute(data); 12 | } 13 | 14 | override public function data() 15 | { 16 | return template.variables; 17 | } 18 | } 19 | #end -------------------------------------------------------------------------------- /thx/src/DynamicsT.hx: -------------------------------------------------------------------------------- 1 | /** 2 | * ... 3 | * @author Franco Ponticelli 4 | */ 5 | 6 | class DynamicsT 7 | { 8 | public static function toHash(ob : Dynamic) : Map 9 | { 10 | var Map = new Map (); 11 | return copyToHash(ob, Map ); 12 | } 13 | 14 | public static function copyToHash(ob : Dynamic, hash : Map) : Map 15 | { 16 | for (field in Reflect.fields(ob)) 17 | hash.set(field, Reflect.field(ob, field)); 18 | return hash; 19 | } 20 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/DependencyResolver.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc; 2 | 3 | /** 4 | * Provides a registration point for dependency resolvers that implement IDependencyResolver or the Common Service Locator IServiceLocator interface. 5 | * 6 | * @author Andreas Soderlund 7 | */ 8 | 9 | class DependencyResolver 10 | { 11 | /** Gets or sets the implementation of the dependency resolver. */ 12 | public static var current : IDependencyResolver = new DefaultDependencyResolver(); 13 | } 14 | -------------------------------------------------------------------------------- /thx/src/thx/xml/AttributeFormat.hx: -------------------------------------------------------------------------------- 1 | package thx.xml; 2 | 3 | class AttributeFormat 4 | { 5 | public function new(){} 6 | 7 | public function formatAttributes(node : Xml) 8 | { 9 | var buf = new StringBuf(); 10 | for(name in node.attributes()) 11 | { 12 | buf.add(" "); 13 | buf.add(formatAttribute(name, node.get(name))); 14 | } 15 | return buf.toString(); 16 | } 17 | 18 | public function formatAttribute(name : String, value : String) 19 | { 20 | return name + '="' + value + '"'; 21 | } 22 | } -------------------------------------------------------------------------------- /src/ufront/web/mvc/view/ITemplateViewEngine.hx: -------------------------------------------------------------------------------- 1 | package ufront.web.mvc.view; 2 | import ufront.web.mvc.IViewEngine; 3 | import haxe.ds.StringMap; 4 | 5 | /** 6 | * ... 7 | * @author Franco Ponticelli 8 | */ 9 | 10 | interface ITemplateViewEngine