mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
Moved Angularjs+DORM sample in contrib folder
This commit is contained in:
parent
7dee9dc90d
commit
18c81e212e
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1736,4 +1736,4 @@ END
|
||||
|
||||
/* D:\DEV\dmvcframework\samples\authenticationauthorization\WebModuleUnit1.dfm */
|
||||
/* D:\DEV\dmvcframework\samples\authenticationauthorization\AuthenticateAuthorize.res */
|
||||
/* C:\Users\Daniele\AppData\Local\Temp\dtf1172.tmp */
|
||||
/* C:\Users\Daniele\AppData\Local\Temp\dtf49B8.tmp */
|
||||
|
@ -1,94 +1,94 @@
|
||||
unit ToDoBO;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
dorm.Mappings,
|
||||
MVCFramework.Commons,
|
||||
system.Rtti,
|
||||
dorm.ObjectStatus,
|
||||
system.SysUtils,
|
||||
ObjectsMappers,
|
||||
Generics.Collections;
|
||||
|
||||
type
|
||||
TBaseBO = class abstract
|
||||
private
|
||||
FObjVersion: Int64;
|
||||
FID : Integer;
|
||||
FObjStatus : TdormObjectStatus;
|
||||
procedure SetID(const Value: Integer);
|
||||
procedure SetObjStatus(const Value: TdormObjectStatus);
|
||||
|
||||
protected
|
||||
procedure ThrowException(
|
||||
const AMessage : string;
|
||||
const ADetailedMessage: string = '');
|
||||
|
||||
public
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
property ID: Integer read FID write SetID;
|
||||
[Transient]
|
||||
property ObjStatus: TdormObjectStatus read FObjStatus write SetObjStatus;
|
||||
end;
|
||||
|
||||
[MapperJSONNaming(JSONNameLowerCase)]
|
||||
[Entity('TODO')]
|
||||
TToDo = class(TBaseBO)
|
||||
private
|
||||
FDescription: string;
|
||||
FDateTime : TDateTime;
|
||||
procedure SetDateTime(const Value: TDateTime);
|
||||
procedure SetDescription(const Value: string);
|
||||
|
||||
public
|
||||
[Column('DESCRIPTION')]
|
||||
property Description: string read FDescription write SetDescription;
|
||||
[Column('DATETIME')]
|
||||
property DateTime: TDateTime read FDateTime write SetDateTime;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TBPBaseBO }
|
||||
|
||||
constructor TBaseBO.Create;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TBaseBO.Destroy;
|
||||
begin
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.SetID(const Value: Integer);
|
||||
begin
|
||||
FID := Value;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.SetObjStatus(const Value: TdormObjectStatus);
|
||||
begin
|
||||
FObjStatus := Value;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.ThrowException(const AMessage, ADetailedMessage: string);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TToDoBO }
|
||||
|
||||
procedure TToDo.SetDateTime(const Value: TDateTime);
|
||||
begin
|
||||
FDateTime := Value;
|
||||
end;
|
||||
|
||||
procedure TToDo.SetDescription(const Value: string);
|
||||
begin
|
||||
FDescription := Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
unit ToDoBO;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
dorm.Mappings,
|
||||
MVCFramework.Commons,
|
||||
system.Rtti,
|
||||
dorm.ObjectStatus,
|
||||
system.SysUtils,
|
||||
ObjectsMappers,
|
||||
Generics.Collections;
|
||||
|
||||
type
|
||||
TBaseBO = class abstract
|
||||
private
|
||||
FObjVersion: Int64;
|
||||
FID : Integer;
|
||||
FObjStatus : TdormObjectStatus;
|
||||
procedure SetID(const Value: Integer);
|
||||
procedure SetObjStatus(const Value: TdormObjectStatus);
|
||||
|
||||
protected
|
||||
procedure ThrowException(
|
||||
const AMessage : string;
|
||||
const ADetailedMessage: string = '');
|
||||
|
||||
public
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
property ID: Integer read FID write SetID;
|
||||
[Transient]
|
||||
property ObjStatus: TdormObjectStatus read FObjStatus write SetObjStatus;
|
||||
end;
|
||||
|
||||
[MapperJSONNaming(JSONNameLowerCase)]
|
||||
[Entity('TODO')]
|
||||
TToDo = class(TBaseBO)
|
||||
private
|
||||
FDescription: string;
|
||||
FDateTime : TDateTime;
|
||||
procedure SetDateTime(const Value: TDateTime);
|
||||
procedure SetDescription(const Value: string);
|
||||
|
||||
public
|
||||
[Column('DESCRIPTION')]
|
||||
property Description: string read FDescription write SetDescription;
|
||||
[Column('DATETIME')]
|
||||
property DateTime: TDateTime read FDateTime write SetDateTime;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TBPBaseBO }
|
||||
|
||||
constructor TBaseBO.Create;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TBaseBO.Destroy;
|
||||
begin
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.SetID(const Value: Integer);
|
||||
begin
|
||||
FID := Value;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.SetObjStatus(const Value: TdormObjectStatus);
|
||||
begin
|
||||
FObjStatus := Value;
|
||||
end;
|
||||
|
||||
procedure TBaseBO.ThrowException(const AMessage, ADetailedMessage: string);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TToDoBO }
|
||||
|
||||
procedure TToDo.SetDateTime(const Value: TDateTime);
|
||||
begin
|
||||
FDateTime := Value;
|
||||
end;
|
||||
|
||||
procedure TToDo.SetDescription(const Value: string);
|
||||
begin
|
||||
FDescription := Value;
|
||||
end;
|
||||
|
||||
end.
|
@ -1,123 +1,123 @@
|
||||
unit ToDoControllerU;
|
||||
|
||||
interface
|
||||
|
||||
uses MVCFramework,
|
||||
MVCFramework.Logger,
|
||||
dorm, //this sample requires DORM
|
||||
dorm.Mappings,
|
||||
dorm.loggers,
|
||||
Web.HTTPApp;
|
||||
|
||||
type
|
||||
|
||||
[MVCPath('/todo')]
|
||||
TToDoController = class(TMVCController)
|
||||
strict private
|
||||
FdormSession: TSession;
|
||||
|
||||
private
|
||||
function GetdormSession: dorm.TSession;
|
||||
|
||||
protected
|
||||
property dormSession: dorm.TSession read GetdormSession;
|
||||
|
||||
public
|
||||
[MVCPath]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetAllToDo(ctx: TWebContext);
|
||||
|
||||
[MVCPath('/($todoid)')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetToDo(ctx: TWebContext);
|
||||
|
||||
[MVCPath]
|
||||
[MVCHTTPMethod([httpPUT])]
|
||||
procedure UpdateToDo(ctx: TWebContext);
|
||||
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses ObjectsMappers,
|
||||
Generics.Collections,
|
||||
dorm.ObjectStatus,
|
||||
dorm.Utils,
|
||||
dorm.Commons,
|
||||
ToDoBO,
|
||||
{$IF CompilerVersion <= 27}
|
||||
DATA.DBXJSON,
|
||||
{$ELSE}
|
||||
System.JSON,
|
||||
{$ENDIF}
|
||||
System.SysUtils;
|
||||
|
||||
{ TApp1MainController }
|
||||
|
||||
destructor TToDoController.Destroy;
|
||||
begin
|
||||
FdormSession.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TToDoController.GetAllToDo(ctx: TWebContext);
|
||||
var
|
||||
ToDos: TObjectList<TToDo>;
|
||||
begin
|
||||
ToDos := dormSession.LoadList<TToDo>();
|
||||
try
|
||||
RenderListAsProperty<TToDo>('todos', ToDos, false);
|
||||
finally
|
||||
ToDos.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TToDoController.GetdormSession: dorm.TSession;
|
||||
begin
|
||||
if not Assigned(FdormSession) then
|
||||
begin
|
||||
FdormSession := TSession.CreateConfigured('dorm.conf',
|
||||
// {$IFDEF TEST}TdormEnvironment.deTest{$ENDIF}
|
||||
TdormEnvironment.deDevelopment
|
||||
// {$IFDEF RELEASE}TdormEnvironment.deRelease{$ENDIF}
|
||||
);
|
||||
end;
|
||||
Result := FdormSession;
|
||||
end;
|
||||
|
||||
procedure TToDoController.GetToDo(ctx: TWebContext);
|
||||
var
|
||||
Todo: TToDo;
|
||||
ID: Integer;
|
||||
begin
|
||||
ID := ctx.Request.Params['todoid'].ToInteger;
|
||||
Todo := dormSession.Load<TToDo>(ID);
|
||||
try
|
||||
Render(Todo, false);
|
||||
finally
|
||||
Todo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TToDoController.UpdateToDo(ctx: TWebContext);
|
||||
var
|
||||
ToDos: TObjectList<TToDo>;
|
||||
begin
|
||||
if not Context.Request.ThereIsRequestBody then
|
||||
raise Exception.Create('Invalid request: Expected request body');
|
||||
if Context.Request.BodyAsJSONObject = nil then
|
||||
raise Exception.Create('Invalid request, Missing JSON object in parameter');
|
||||
|
||||
ToDos := Mapper.JSONArrayToObjectList<TToDo>(ctx.Request.BodyAsJSONObject.Get('todos')
|
||||
.JsonValue as TJSONArray, false);
|
||||
try
|
||||
dormSession.PersistCollection(ToDos);
|
||||
Render(200, 'update ok');
|
||||
finally
|
||||
ToDos.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
unit ToDoControllerU;
|
||||
|
||||
interface
|
||||
|
||||
uses MVCFramework,
|
||||
MVCFramework.Logger,
|
||||
dorm, //this sample requires DORM
|
||||
dorm.Mappings,
|
||||
dorm.loggers,
|
||||
Web.HTTPApp;
|
||||
|
||||
type
|
||||
|
||||
[MVCPath('/todo')]
|
||||
TToDoController = class(TMVCController)
|
||||
strict private
|
||||
FdormSession: TSession;
|
||||
|
||||
private
|
||||
function GetdormSession: dorm.TSession;
|
||||
|
||||
protected
|
||||
property dormSession: dorm.TSession read GetdormSession;
|
||||
|
||||
public
|
||||
[MVCPath]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetAllToDo(ctx: TWebContext);
|
||||
|
||||
[MVCPath('/($todoid)')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure GetToDo(ctx: TWebContext);
|
||||
|
||||
[MVCPath]
|
||||
[MVCHTTPMethod([httpPUT])]
|
||||
procedure UpdateToDo(ctx: TWebContext);
|
||||
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses ObjectsMappers,
|
||||
Generics.Collections,
|
||||
dorm.ObjectStatus,
|
||||
dorm.Utils,
|
||||
dorm.Commons,
|
||||
ToDoBO,
|
||||
{$IF CompilerVersion <= 27}
|
||||
DATA.DBXJSON,
|
||||
{$ELSE}
|
||||
System.JSON,
|
||||
{$ENDIF}
|
||||
System.SysUtils;
|
||||
|
||||
{ TApp1MainController }
|
||||
|
||||
destructor TToDoController.Destroy;
|
||||
begin
|
||||
FdormSession.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TToDoController.GetAllToDo(ctx: TWebContext);
|
||||
var
|
||||
ToDos: TObjectList<TToDo>;
|
||||
begin
|
||||
ToDos := dormSession.LoadList<TToDo>();
|
||||
try
|
||||
RenderListAsProperty<TToDo>('todos', ToDos, false);
|
||||
finally
|
||||
ToDos.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TToDoController.GetdormSession: dorm.TSession;
|
||||
begin
|
||||
if not Assigned(FdormSession) then
|
||||
begin
|
||||
FdormSession := TSession.CreateConfigured('dorm.conf',
|
||||
// {$IFDEF TEST}TdormEnvironment.deTest{$ENDIF}
|
||||
TdormEnvironment.deDevelopment
|
||||
// {$IFDEF RELEASE}TdormEnvironment.deRelease{$ENDIF}
|
||||
);
|
||||
end;
|
||||
Result := FdormSession;
|
||||
end;
|
||||
|
||||
procedure TToDoController.GetToDo(ctx: TWebContext);
|
||||
var
|
||||
Todo: TToDo;
|
||||
ID: Integer;
|
||||
begin
|
||||
ID := ctx.Request.Params['todoid'].ToInteger;
|
||||
Todo := dormSession.Load<TToDo>(ID);
|
||||
try
|
||||
Render(Todo, false);
|
||||
finally
|
||||
Todo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TToDoController.UpdateToDo(ctx: TWebContext);
|
||||
var
|
||||
ToDos: TObjectList<TToDo>;
|
||||
begin
|
||||
if not Context.Request.ThereIsRequestBody then
|
||||
raise Exception.Create('Invalid request: Expected request body');
|
||||
if Context.Request.BodyAsJSONObject = nil then
|
||||
raise Exception.Create('Invalid request, Missing JSON object in parameter');
|
||||
|
||||
ToDos := Mapper.JSONArrayToObjectList<TToDo>(ctx.Request.BodyAsJSONObject.Get('todos')
|
||||
.JsonValue as TJSONArray, false);
|
||||
try
|
||||
dormSession.PersistCollection(ToDos);
|
||||
Render(200, 'update ok');
|
||||
finally
|
||||
ToDos.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
@ -1,60 +1,60 @@
|
||||
program WebClientSample;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
Winapi.Windows,
|
||||
Winapi.ShellAPI,
|
||||
Web.WebReq,
|
||||
Web.WebBroker,
|
||||
IdHTTPWebBrokerBridge,
|
||||
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule} ,
|
||||
WebSiteControllerU in 'WebSiteControllerU.pas',
|
||||
ToDoControllerU in 'ToDoControllerU.pas',
|
||||
ToDoBO in 'ToDoBO.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
procedure RunServer(APort: Integer);
|
||||
var
|
||||
LInputRecord: TInputRecord;
|
||||
LEvent: DWord;
|
||||
LHandle: THandle;
|
||||
LServer: TIdHTTPWebBrokerBridge;
|
||||
begin
|
||||
Writeln(Format('Starting HTTP Server or port %d', [APort]));
|
||||
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||||
try
|
||||
LServer.DefaultPort := APort;
|
||||
LServer.Active := True;
|
||||
ShellExecute(0, 'open', pChar('http://localhost:' + inttostr(APort) +
|
||||
'/index.html'), nil, nil, SW_SHOWMAXIMIZED);
|
||||
Writeln('Press ESC to stop the server');
|
||||
LHandle := GetStdHandle(STD_INPUT_HANDLE);
|
||||
while True do
|
||||
begin
|
||||
Win32Check(ReadConsoleInput(LHandle, LInputRecord, 1, LEvent));
|
||||
if (LInputRecord.EventType = KEY_EVENT) and
|
||||
LInputRecord.Event.KeyEvent.bKeyDown and
|
||||
(LInputRecord.Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then
|
||||
break;
|
||||
end;
|
||||
finally
|
||||
LServer.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
ReportMemoryLeaksOnShutdown := True;
|
||||
try
|
||||
if WebRequestHandler <> nil then
|
||||
WebRequestHandler.WebModuleClass := WebModuleClass;
|
||||
WebRequestHandlerProc.MaxConnections := 1024;
|
||||
RunServer(3000);
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end
|
||||
|
||||
end.
|
||||
program WebClientSample;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
Winapi.Windows,
|
||||
Winapi.ShellAPI,
|
||||
Web.WebReq,
|
||||
Web.WebBroker,
|
||||
IdHTTPWebBrokerBridge,
|
||||
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule} ,
|
||||
WebSiteControllerU in 'WebSiteControllerU.pas',
|
||||
ToDoControllerU in 'ToDoControllerU.pas',
|
||||
ToDoBO in 'ToDoBO.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
procedure RunServer(APort: Integer);
|
||||
var
|
||||
LInputRecord: TInputRecord;
|
||||
LEvent: DWord;
|
||||
LHandle: THandle;
|
||||
LServer: TIdHTTPWebBrokerBridge;
|
||||
begin
|
||||
Writeln(Format('Starting HTTP Server or port %d', [APort]));
|
||||
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||||
try
|
||||
LServer.DefaultPort := APort;
|
||||
LServer.Active := True;
|
||||
ShellExecute(0, 'open', pChar('http://localhost:' + inttostr(APort) +
|
||||
'/index.html'), nil, nil, SW_SHOWMAXIMIZED);
|
||||
Writeln('Press ESC to stop the server');
|
||||
LHandle := GetStdHandle(STD_INPUT_HANDLE);
|
||||
while True do
|
||||
begin
|
||||
Win32Check(ReadConsoleInput(LHandle, LInputRecord, 1, LEvent));
|
||||
if (LInputRecord.EventType = KEY_EVENT) and
|
||||
LInputRecord.Event.KeyEvent.bKeyDown and
|
||||
(LInputRecord.Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then
|
||||
break;
|
||||
end;
|
||||
finally
|
||||
LServer.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
ReportMemoryLeaksOnShutdown := True;
|
||||
try
|
||||
if WebRequestHandler <> nil then
|
||||
WebRequestHandler.WebModuleClass := WebModuleClass;
|
||||
WebRequestHandlerProc.MaxConnections := 1024;
|
||||
RunServer(3000);
|
||||
except
|
||||
on E: Exception do
|
||||
Writeln(E.ClassName, ': ', E.Message);
|
||||
end
|
||||
|
||||
end.
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
||||
object WebModule1: TWebModule1
|
||||
OldCreateOrder = False
|
||||
OnCreate = WebModuleCreate
|
||||
OnDestroy = WebModuleDestroy
|
||||
Actions = <
|
||||
item
|
||||
Default = True
|
||||
Name = 'DefaultHandler'
|
||||
PathInfo = '/'
|
||||
end>
|
||||
Height = 230
|
||||
Width = 415
|
||||
end
|
||||
object WebModule1: TWebModule1
|
||||
OldCreateOrder = False
|
||||
OnCreate = WebModuleCreate
|
||||
OnDestroy = WebModuleDestroy
|
||||
Actions = <
|
||||
item
|
||||
Default = True
|
||||
Name = 'DefaultHandler'
|
||||
PathInfo = '/'
|
||||
end>
|
||||
Height = 230
|
||||
Width = 415
|
||||
end
|
@ -1,46 +1,46 @@
|
||||
unit WebModuleUnit1;
|
||||
|
||||
interface
|
||||
|
||||
uses System.SysUtils,
|
||||
System.Classes,
|
||||
Web.HTTPApp,
|
||||
MVCFramework;
|
||||
|
||||
type
|
||||
TWebModule1 = class(TWebModule)
|
||||
procedure WebModuleCreate(Sender: TObject);
|
||||
procedure WebModuleDestroy(Sender: TObject);
|
||||
|
||||
private
|
||||
MVC: TMVCEngine;
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
WebModuleClass: TComponentClass = TWebModule1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
||||
uses WebSiteControllerU,
|
||||
ToDoControllerU;
|
||||
|
||||
procedure TWebModule1.WebModuleCreate(Sender: TObject);
|
||||
begin
|
||||
MVC := TMVCEngine.Create(Self);
|
||||
MVC.Config['view_path'] := '..\..\www';
|
||||
MVC.Config['document_root'] := '..\..\www';
|
||||
MVC.AddController(TToDoController).AddController(TApp1MainController);
|
||||
end;
|
||||
|
||||
procedure TWebModule1.WebModuleDestroy(Sender: TObject);
|
||||
begin
|
||||
MVC.free;
|
||||
end;
|
||||
|
||||
end.
|
||||
unit WebModuleUnit1;
|
||||
|
||||
interface
|
||||
|
||||
uses System.SysUtils,
|
||||
System.Classes,
|
||||
Web.HTTPApp,
|
||||
MVCFramework;
|
||||
|
||||
type
|
||||
TWebModule1 = class(TWebModule)
|
||||
procedure WebModuleCreate(Sender: TObject);
|
||||
procedure WebModuleDestroy(Sender: TObject);
|
||||
|
||||
private
|
||||
MVC: TMVCEngine;
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
WebModuleClass: TComponentClass = TWebModule1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
||||
uses WebSiteControllerU,
|
||||
ToDoControllerU;
|
||||
|
||||
procedure TWebModule1.WebModuleCreate(Sender: TObject);
|
||||
begin
|
||||
MVC := TMVCEngine.Create(Self);
|
||||
MVC.Config['view_path'] := '..\..\www';
|
||||
MVC.Config['document_root'] := '..\..\www';
|
||||
MVC.AddController(TToDoController).AddController(TApp1MainController);
|
||||
end;
|
||||
|
||||
procedure TWebModule1.WebModuleDestroy(Sender: TObject);
|
||||
begin
|
||||
MVC.free;
|
||||
end;
|
||||
|
||||
end.
|
@ -1,33 +1,33 @@
|
||||
unit WebSiteControllerU;
|
||||
|
||||
interface
|
||||
|
||||
uses MVCFramework,
|
||||
MVCFramework.Logger,
|
||||
Web.HTTPApp;
|
||||
|
||||
type
|
||||
|
||||
[MVCPath('/')]
|
||||
TApp1MainController = class(TMVCController)
|
||||
public
|
||||
[MVCPath('/')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure Index(ctx: TWebContext);
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Data.DBXJSON,
|
||||
System.SysUtils;
|
||||
|
||||
{ TApp1MainController }
|
||||
|
||||
procedure TApp1MainController.Index(ctx: TWebContext);
|
||||
begin
|
||||
Redirect('/index.html');
|
||||
end;
|
||||
|
||||
end.
|
||||
unit WebSiteControllerU;
|
||||
|
||||
interface
|
||||
|
||||
uses MVCFramework,
|
||||
MVCFramework.Logger,
|
||||
Web.HTTPApp;
|
||||
|
||||
type
|
||||
|
||||
[MVCPath('/')]
|
||||
TApp1MainController = class(TMVCController)
|
||||
public
|
||||
[MVCPath('/')]
|
||||
[MVCHTTPMethod([httpGET])]
|
||||
procedure Index(ctx: TWebContext);
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Data.DBXJSON,
|
||||
System.SysUtils;
|
||||
|
||||
{ TApp1MainController }
|
||||
|
||||
procedure TApp1MainController.Index(ctx: TWebContext);
|
||||
begin
|
||||
Redirect('/index.html');
|
||||
end;
|
||||
|
||||
end.
|
2021
samples/contribsamples/angularjs/Win32/Debug/WebClientSample.drc
Normal file
2021
samples/contribsamples/angularjs/Win32/Debug/WebClientSample.drc
Normal file
File diff suppressed because it is too large
Load Diff
149288
samples/contribsamples/angularjs/Win32/Debug/WebClientSample.map
Normal file
149288
samples/contribsamples/angularjs/Win32/Debug/WebClientSample.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
||||
{
|
||||
"persistence": {
|
||||
"development": {
|
||||
"database_adapter": "dorm.adapter.UIB.Firebird.TUIBFirebirdPersistStrategy",
|
||||
"database_connection_string": "..//..//SAMPLETODO.FDB",
|
||||
"key_type": "integer",
|
||||
"null_key_value": "0",
|
||||
"keys_generator": "dorm.adapter.UIB.Firebird.TUIBFirebirdTableSequence",
|
||||
"username": "sysdba",
|
||||
"password":"masterkey"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"logger_class_name": "dorm.loggers.FileLog.TdormFileLog"
|
||||
}
|
||||
{
|
||||
"persistence": {
|
||||
"development": {
|
||||
"database_adapter": "dorm.adapter.UIB.Firebird.TUIBFirebirdPersistStrategy",
|
||||
"database_connection_string": "..//..//SAMPLETODO.FDB",
|
||||
"key_type": "integer",
|
||||
"null_key_value": "0",
|
||||
"keys_generator": "dorm.adapter.UIB.Firebird.TUIBFirebirdTableSequence",
|
||||
"username": "sysdba",
|
||||
"password":"masterkey"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"logger_class_name": "dorm.loggers.FileLog.TdormFileLog"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
@ -1,95 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" ng-app="myApp">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="bootstrap/assets/ico/favicon.png">
|
||||
<title>DMVCFramework Sample - Using AngularJS</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="lib/bootstrap_directive/bootstrap-notify.css" rel="stylesheet">
|
||||
|
||||
|
||||
<link href="css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="lib/bootstrap/assets/js/html5shiv.js"></script>
|
||||
<script src="lib/bootstrap/assets/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">TODO List DEMO</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<!--<li><a href="#/movies"><span class="glyphicon glyphicon-film"></span> Movies</a></li>-->
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div><!--/.navbar-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
<img src="/img/dmvcframework_logobig.png">
|
||||
<div id="wrap">
|
||||
<bootstrap-notify></bootstrap-notify>
|
||||
<div ng-view></div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div class="container">
|
||||
<h2>DelphiMVCFramework Sample - TODO List</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="lib/bootstrap/assets/js/jquery.js"></script>
|
||||
<script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<script src="lib/bootstrap/js/button.js"></script>
|
||||
<script src="lib/angular/angular.min.js"></script>
|
||||
|
||||
|
||||
<script src="lib/angular/angular-resource.min.js"></script>
|
||||
<script src="lib/angular/angular-route.js"></script>
|
||||
<script src="lib/bootstrap_directive/bootstrap-notify.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--my js-->
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/services/proxy.js"></script>
|
||||
<script src="js/services/services.js"></script>
|
||||
<script src="js/controllers/controllers.js"></script>
|
||||
<script src="js/directives/directives.js"></script>
|
||||
<script src="js/directives/pagination.js"></script>
|
||||
<script src="js/directives/notify.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" ng-app="myApp">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="bootstrap/assets/ico/favicon.png">
|
||||
<title>DMVCFramework Sample - Using AngularJS</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="lib/bootstrap_directive/bootstrap-notify.css" rel="stylesheet">
|
||||
|
||||
|
||||
<link href="css/app.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="lib/bootstrap/assets/js/html5shiv.js"></script>
|
||||
<script src="lib/bootstrap/assets/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">TODO List DEMO</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<!--<li><a href="#/movies"><span class="glyphicon glyphicon-film"></span> Movies</a></li>-->
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div><!--/.navbar-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
<img src="/img/dmvcframework_logobig.png">
|
||||
<div id="wrap">
|
||||
<bootstrap-notify></bootstrap-notify>
|
||||
<div ng-view></div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div class="container">
|
||||
<h2>DelphiMVCFramework Sample - TODO List</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="lib/bootstrap/assets/js/jquery.js"></script>
|
||||
<script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<script src="lib/bootstrap/js/button.js"></script>
|
||||
<script src="lib/angular/angular.min.js"></script>
|
||||
|
||||
|
||||
<script src="lib/angular/angular-resource.min.js"></script>
|
||||
<script src="lib/angular/angular-route.js"></script>
|
||||
<script src="lib/bootstrap_directive/bootstrap-notify.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--my js-->
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/services/proxy.js"></script>
|
||||
<script src="js/services/services.js"></script>
|
||||
<script src="js/controllers/controllers.js"></script>
|
||||
<script src="js/directives/directives.js"></script>
|
||||
<script src="js/directives/pagination.js"></script>
|
||||
<script src="js/directives/notify.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,7 @@
|
||||
<div class="notify">
|
||||
<div class='notifications top-right'></div>
|
||||
<div class='notifications bottom-right'></div>
|
||||
<div class='notifications top-left'></div>
|
||||
<div class='notifications bottom-left'></div>
|
||||
<div class='notifications center'></div>
|
||||
<div class="notify">
|
||||
<div class='notifications top-right'></div>
|
||||
<div class='notifications bottom-right'></div>
|
||||
<div class='notifications top-left'></div>
|
||||
<div class='notifications bottom-left'></div>
|
||||
<div class='notifications center'></div>
|
||||
</div>
|
@ -1,23 +1,23 @@
|
||||
//PROXY RESTFULL
|
||||
|
||||
//{ 'get': {method:'GET'},
|
||||
// 'save': {method:'POST'},
|
||||
// 'query': {method:'GET', isArray:true},
|
||||
// 'remove': {method:'DELETE'},
|
||||
// 'delete': {method:'DELETE'} };
|
||||
|
||||
|
||||
/**
|
||||
* GET
|
||||
* POST (insert new movie)
|
||||
* PUT (update movie ) @id params
|
||||
*/
|
||||
app.factory('PXTODO', ['$resource', function($resource) {
|
||||
var resource = $resource('todo' ,{},
|
||||
{
|
||||
put: {method: 'PUT' }
|
||||
}
|
||||
);
|
||||
return resource;
|
||||
}]);
|
||||
|
||||
//PROXY RESTFULL
|
||||
|
||||
//{ 'get': {method:'GET'},
|
||||
// 'save': {method:'POST'},
|
||||
// 'query': {method:'GET', isArray:true},
|
||||
// 'remove': {method:'DELETE'},
|
||||
// 'delete': {method:'DELETE'} };
|
||||
|
||||
|
||||
/**
|
||||
* GET
|
||||
* POST (insert new movie)
|
||||
* PUT (update movie ) @id params
|
||||
*/
|
||||
app.factory('PXTODO', ['$resource', function($resource) {
|
||||
var resource = $resource('todo' ,{},
|
||||
{
|
||||
put: {method: 'PUT' }
|
||||
}
|
||||
);
|
||||
return resource;
|
||||
}]);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user