├── .gitignore
├── DW.CORE.Cache.pas
├── DW.CORE.DWApplication.pas
├── DW.CORE.DWClientConnection.pas
├── DW.CORE.DWHandlers.pas
├── DW.CORE.DWHttpServer.pas
├── DW.CORE.DWThread.pas
├── DW.CORE.MergeSort.pas
├── DW.CORE.MergeSortFunc.pas
├── DW.CORE.Server.pas
├── DW.CORE.UserSession.dfm
├── DW.CORE.UserSession.pas
├── DW.CORE.UserSessionold.dfm
├── DW.DESIGN.AccordionEditor.pas
├── DW.DESIGN.AppWizard.pas
├── DW.DESIGN.DataModuleWizard.pas
├── DW.DESIGN.FormWizard.pas
├── DW.DESIGN.FrameWizard.pas
├── DW.DESIGN.MainForm.pas
├── DW.DESIGN.TabControlEditor.pas
├── DW.DESIGN.UserSessionWizard.pas
├── DW.HTML.Page.pas
├── DW.JSON.JsonData.pas
├── DW.Server.pas
├── DW.VCL.Accordion.pas
├── DW.VCL.BaseControl.pas
├── DW.VCL.ButtonGroup.pas
├── DW.VCL.Buttons.pas
├── DW.VCL.Common.pas
├── DW.VCL.Component.pas
├── DW.VCL.Container.pas
├── DW.VCL.Control.pas
├── DW.VCL.CustomForm.pas
├── DW.VCL.CustomInput.pas
├── DW.VCL.CustomRegion.pas
├── DW.VCL.DBControl.pas
├── DW.VCL.DataLink.pas
├── DW.VCL.DataModule.dfm
├── DW.VCL.DataModule.pas
├── DW.VCL.Edit.pas
├── DW.VCL.FIREDAC.Register.pas
├── DW.VCL.FIREDAC.Search.pas
├── DW.VCL.Frame.pas
├── DW.VCL.GlyphIcons.pas
├── DW.VCL.Iframe.pas
├── DW.VCL.Image.pas
├── DW.VCL.Input.pas
├── DW.VCL.InputForm.pas
├── DW.VCL.InputGroup.pas
├── DW.VCL.InputMoney.pas
├── DW.VCL.Interfaces.pas
├── DW.VCL.JQGrid.pas
├── DW.VCL.Labels.pas
├── DW.VCL.List.pas
├── DW.VCL.Modal.pas
├── DW.VCL.NavBar.pas
├── DW.VCL.Region.pas
├── DW.VCL.ScriptEvents.pas
├── DW.VCL.ScriptParams.pas
├── DW.VCL.Select2.pas
├── DW.VCL.StyleRenderOptions.pas
├── DW.VCL.TabControl.pas
├── DW.VCL.Table.pas
├── DW.VCL.Validator.pas
├── DW.VCl.Dialogs.pas
├── DW.XHR.CallBackResp.pas
├── DWCallbacks.pas
├── DWElementTag.pas
├── DWFiredacUtils.pas
├── DWForm.pas
├── DWGlobal.pas
├── DWHttpServer.pas
├── DWLayoutRender.pas
├── DWMarkupLinguageTag.pas
├── DWRegister.pas
├── DWRenderStream.pas
├── DWTypes.pas
├── DWUrlHandlerBase.pas
├── DWUrlHandlerForms.pas
├── DWUrlHandlerHome.pas
├── DWUrlHandlerRest.pas
├── DWUtils.pas
├── DelphiWeb_Design.res
├── DelphiWeb_Design_Seattle.dpk
├── DelphiWeb_Design_Seattle.dproj
├── DelphiWeb_Design_Seattle.res
├── DelphiWeb_Firedac_Seattle.dpk
├── DelphiWeb_Firedac_Seattle.dproj
├── DelphiWeb_Firedac_Seattle.res
├── DelphiWeb_runtime.res
├── DelphiWeb_runtime_Seattle.dpk
├── DelphiWeb_runtime_Seattle.dproj
├── DelphiWeb_runtime_Seattle.res
├── Demo
├── DelphiWeb.dpr
├── DelphiWeb.dproj
├── DelphiWeb.res
├── Win32
│ └── Debug
│ │ └── wwwroot
│ │ └── dwlib
│ │ ├── css
│ │ ├── bootstrap.css
│ │ ├── bootstrap_theme.css
│ │ └── dw.css
│ │ ├── dwAjax.js
│ │ ├── dwBrowser.js
│ │ ├── dwControl.js
│ │ ├── dwControls.js
│ │ ├── dwDebug.js
│ │ ├── dwFunctions.js
│ │ ├── dwMain.js
│ │ ├── dyntabs
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bootstrap-dynamic-tabs.css
│ │ ├── bootstrap-dynamic-tabs.js
│ │ ├── bootstrap-dynamic-tabs.min.js
│ │ └── jquery-ui-1.9.2.custom.min.js
│ │ ├── js
│ │ ├── bootstrap.js
│ │ └── jquery-3.1.1.js
│ │ ├── lixeira
│ │ ├── dwDom.js
│ │ └── dwEvents.js
│ │ ├── maskedinput
│ │ ├── jquery.maskedinput.js
│ │ └── jquery.maskedinput.min.js
│ │ └── validator
│ │ ├── validator.js
│ │ └── validator.min.js
├── uDWSessionData.dfm
├── uDWSessionData.pas
├── uServerMainForm.dfm
├── uServerMainForm.pas
├── uWebMainForm.dfm
└── uWebMainForm.pas
├── IDE
└── Formatter_Profile.config
├── Include
└── Overbyte
│ ├── Include
│ ├── Ics.InterlockedApi.inc
│ ├── OverbyteIcsDefs.inc
│ ├── OverbyteIcsSslDefs.inc
│ ├── OverbyteIcsWinsockImpl.inc
│ ├── OverbyteIcsWinsockTypes.inc
│ └── OverbyteIcsZlib.inc
│ ├── OverByteIcsFtpSrvT.pas
│ ├── OverbyteIcsAvlTrees.pas
│ ├── OverbyteIcsCRC.pas
│ ├── OverbyteIcsCharsetUtils.pas
│ ├── OverbyteIcsCsc.pas
│ ├── OverbyteIcsDES.pas
│ ├── OverbyteIcsDigestAuth.pas
│ ├── OverbyteIcsFtpSrv.dcr
│ ├── OverbyteIcsFtpSrv.pas
│ ├── OverbyteIcsHttpAppServer.pas
│ ├── OverbyteIcsHttpSrv.dcr
│ ├── OverbyteIcsHttpSrv.pas
│ ├── OverbyteIcsLIBEAY.pas
│ ├── OverbyteIcsLogger.dcr
│ ├── OverbyteIcsLogger.pas
│ ├── OverbyteIcsMD4.pas
│ ├── OverbyteIcsMD5.pas
│ ├── OverbyteIcsMLang.pas
│ ├── OverbyteIcsMimeUtils.dcr
│ ├── OverbyteIcsMimeUtils.pas
│ ├── OverbyteIcsNtlmMsgs.pas
│ ├── OverbyteIcsNtlmSsp.pas
│ ├── OverbyteIcsOneTimePw.pas
│ ├── OverbyteIcsSSLEAY.pas
│ ├── OverbyteIcsSha1.pas
│ ├── OverbyteIcsSocketUtils.pas
│ ├── OverbyteIcsSspi.pas
│ ├── OverbyteIcsStreams.pas
│ ├── OverbyteIcsThreadTimer.pas
│ ├── OverbyteIcsTimeList.dcr
│ ├── OverbyteIcsTimeList.pas
│ ├── OverbyteIcsTypes.pas
│ ├── OverbyteIcsUtils.pas
│ ├── OverbyteIcsWSockBuf.pas
│ ├── OverbyteIcsWSocket.dcr
│ ├── OverbyteIcsWSocket.pas
│ ├── OverbyteIcsWSocketS.dcr
│ ├── OverbyteIcsWSocketS.pas
│ ├── OverbyteIcsWebSession.pas
│ ├── OverbyteIcsWinnls.pas
│ ├── OverbyteIcsWinsock.pas
│ ├── OverbyteIcsWndControl.pas
│ ├── OverbyteIcsZLibDll.pas
│ ├── OverbyteIcsZLibObj.pas
│ ├── OverbyteIcsZlibHigh.pas
│ └── zobj125
│ ├── adler32.obj
│ ├── compress.obj
│ ├── crc32.obj
│ ├── deflate.obj
│ ├── infback.obj
│ ├── inffast.obj
│ ├── inflate.obj
│ ├── inftrees.obj
│ ├── trees.obj
│ ├── uncompr.obj
│ ├── win64
│ ├── adler32.obj
│ ├── compress.obj
│ ├── crc32.obj
│ ├── deflate.obj
│ ├── infback.obj
│ ├── inffast.obj
│ ├── inflate.obj
│ ├── inftrees.obj
│ ├── trees.obj
│ ├── uncompr.obj
│ └── zutil.obj
│ └── zutil.obj
├── LICENSE
├── README.md
└── dw.vcl.FluidForm.pas
/.gitignore:
--------------------------------------------------------------------------------
1 | # Uncomment these types if you want even more clean repository. But be careful.
2 | # It can make harm to an existing project source. Read explanations below.
3 | #
4 | # Resource files are binaries containing manifest, project icon and version info.
5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
6 | #*.res
7 | #
8 | # Type library file (binary). In old Delphi versions it should be stored.
9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
10 | #*.tlb
11 | #
12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
13 | # Uncomment this if you are not using diagrams or use newer Delphi version.
14 | #*.ddp
15 | #
16 | # Visual LiveBindings file. Added in Delphi XE2.
17 | # Uncomment this if you are not using LiveBindings Designer.
18 | #*.vlb
19 | #
20 | # Deployment Manager configuration file for your project. Added in Delphi XE2.
21 | # Uncomment this if it is not mobile development and you do not use remote debug feature.
22 | #*.deployproj
23 | #
24 | # C++ object files produced when C/C++ Output file generation is configured.
25 | # Uncomment this if you are not using external objects (zlib library for example).
26 | #*.obj
27 | #
28 |
29 | # Delphi compiler-generated binaries (safe to delete)
30 | *.exe
31 | *.dll
32 | *.bpl
33 | *.bpi
34 | *.dcp
35 | *.so
36 | *.apk
37 | *.drc
38 | *.map
39 | *.dres
40 | *.rsm
41 | *.tds
42 | *.dcu
43 | *.lib
44 | *.a
45 | *.o
46 | *.ocx
47 |
48 | # Delphi autogenerated files (duplicated info)
49 | *.cfg
50 | *.hpp
51 | *Resource.rc
52 |
53 | # Delphi local files (user-specific info)
54 | *.local
55 | *.identcache
56 | *.projdata
57 | *.tvsconfig
58 | *.dsk
59 |
60 | # Delphi history and backups
61 | __history/
62 | __recovery/
63 | *.~*
64 |
65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi)
66 | *.stat
67 |
--------------------------------------------------------------------------------
/DW.CORE.Cache.pas:
--------------------------------------------------------------------------------
1 | unit DW.CORE.Cache;
2 |
3 | interface
4 |
5 | uses
6 | Classes, System.SysUtils, DB, DWUrlHandlerBase, System.IOUtils;
7 |
8 | type
9 |
10 | TCacheItemBase = class(TObject)
11 | protected
12 | // FMemoryCacheStream:TMemoryStream;
13 | FFilename: string;
14 | FOwner: TComponent;
15 | FContentType: string;
16 | // FFileCachePath:string;
17 | public
18 | constructor Create(aOwner: TComponent; aFileName: string; aContentType: string);
19 | destructor Destroy; override;
20 | function URL: string;
21 | function FileName: string;
22 | end;
23 |
24 | TCacheItemMemory = class(TCacheItemBase)
25 | protected
26 | FStream: TMemoryStream;
27 | public
28 | constructor Create(aOwner: TComponent; aStream: TStream; aFileName: string;
29 | aContentType: string);
30 | destructor Destroy; override;
31 | end;
32 |
33 | TCacheItemFile = class(TCacheItemBase)
34 | private
35 | protected
36 | FPath: string;
37 | public
38 | constructor Create(aOwner: TComponent; aStream: TStream; aFileName: string;
39 | aContentType: string);
40 | destructor Destroy; override;
41 | class function GetCacheFilePath(aOwner: TComponent; aFileName: string): string;
42 | end;
43 |
44 | TDWCacheList = class(TStringList)
45 |
46 | end;
47 |
48 | TDWUrlHandlerCache = class(TDWUrlHandlerBase)
49 | public
50 | procedure Execute; override;
51 | end;
52 |
53 | TDWCache = class
54 | public
55 | class function AddStreamToGlobalMemoryCache(aOwner: TComponent; aStream: TStream;
56 | aFileName: string; aContentType: string): string;
57 | class function AddStreamToSessionMemoryCache(aOwner: TComponent; aStream: TStream;
58 | aFileName: string; aContentType: string): string;
59 | class function AddStreamToSessionFileCache(aOwner: TComponent; aStream: TStream;
60 | aFileName: string; aContentType: string): string;
61 | end;
62 |
63 | implementation
64 |
65 | uses DWUtils, DW.CORE.DWApplication, DW.CORE.DWClientConnection, OverbyteIcsStreams;
66 |
67 | type
68 | THack = class(TDWApplication);
69 |
70 | { TDWCache }
71 |
72 | class function TDWCache.AddStreamToGlobalMemoryCache(aOwner: TComponent; aStream: TStream;
73 | aFileName: string; aContentType: string): string;
74 | begin
75 | raise Exception.Create('Need to implement Global Cache. You can contribute?');
76 | end;
77 |
78 | class function TDWCache.AddStreamToSessionFileCache(aOwner: TComponent; aStream: TStream;
79 | aFileName, aContentType: string): string;
80 | var
81 | LItem: TCacheItemFile;
82 | LUrl: string;
83 | begin
84 | // Create the cache item Object
85 | LItem := TCacheItemFile.Create(aOwner, aStream, aFileName, aContentType);
86 | // Get url for get item
87 | LUrl := LItem.URL;
88 | // add item to DWApplication cache list
89 | THack(DWApplication).FCacheList.AddObject(LUrl, LItem);
90 | // Register get handler class for item url
91 | DWApplication.RegisterGetHandler(aOwner, LUrl, nil, TDWUrlHandlerCache);
92 | // return the url for get item
93 | Result := LUrl;
94 | end;
95 |
96 | class function TDWCache.AddStreamToSessionMemoryCache(aOwner: TComponent; aStream: TStream;
97 | aFileName: string; aContentType: string): string;
98 | var
99 | LItem: TCacheItemMemory;
100 | LUrl: string;
101 | begin
102 | // Create the cache item Object
103 | LItem := TCacheItemMemory.Create(aOwner, aStream, aFileName, aContentType);
104 | // Get url for get item
105 | LUrl := LItem.URL;
106 | // add item to DWApplication cache list
107 | THack(DWApplication).FCacheList.AddObject(LUrl, LItem);
108 | // Register get handler class for item url
109 | DWApplication.RegisterGetHandler(aOwner, LUrl, nil, TDWUrlHandlerCache);
110 | // return the url for get item
111 | Result := LUrl;
112 | end;
113 |
114 | { TCacheItem }
115 |
116 | constructor TCacheItemBase.Create(aOwner: TComponent; aFileName: string; aContentType: string);
117 | begin
118 | FOwner := aOwner;
119 | FContentType := aContentType;
120 | FFilename := aFileName;
121 | end;
122 |
123 | destructor TCacheItemBase.Destroy;
124 | begin
125 | inherited;
126 | end;
127 |
128 | function TCacheItemBase.FileName: string;
129 | begin
130 | Result := FFilename;
131 | end;
132 |
133 | function TCacheItemBase.URL: string;
134 | begin
135 | if FOwner <> nil then
136 | Result := FOwner.Name + FileName
137 | else
138 | Result := 'NIL.' + FileName;
139 | end;
140 |
141 | { TDWUrlHandlerCache }
142 |
143 | procedure TDWUrlHandlerCache.Execute;
144 | var
145 | Status: string;
146 | LHeader: String;
147 | LPath: string;
148 | LCacheList: TDWCacheList;
149 | Lindex: Integer;
150 | LCacheItem: TCacheItemBase;
151 | begin
152 | Status := '';
153 | LPath := TDWClientConnection(Client).Path;
154 | LCacheList := THack(DWApplication).FCacheList;
155 | if LPath <> '' then
156 | begin
157 | Lindex := LCacheList.IndexOf(LPath);
158 | if Lindex > -1 then
159 | begin
160 | LCacheItem := TCacheItemBase(LCacheList.GetObject(Lindex));
161 | LHeader := 'Content-Disposition: attachment; filename="' + LCacheItem.FileName + '"';
162 | // if is in memory cache
163 | if LCacheItem is TCacheItemMemory then
164 | begin
165 | // load buffer from memory
166 | TDWClientConnection(Client).DocStream := TCacheItemMemory(LCacheItem).FStream;
167 | // send
168 | AnswerStream(Status, LCacheItem.FContentType, LHeader);
169 | end
170 | // else if is in file cache
171 | else if LCacheItem is TCacheItemFile then
172 | begin
173 | // load buffer from File
174 | TDWClientConnection(Client).DocStream :=
175 | TIcsBufferedFileStream.Create(TCacheItemFile(LCacheItem).FPath,
176 | fmOpenRead + fmShareDenyWrite, MAX_BUFSIZE);
177 | // send
178 | AnswerStream(Status, LCacheItem.FContentType, LHeader);
179 | end
180 | end;
181 | end;
182 | Finish;
183 | end;
184 |
185 | { TCacheItemMemory }
186 |
187 | constructor TCacheItemMemory.Create(aOwner: TComponent; aStream: TStream;
188 | aFileName, aContentType: string);
189 | begin
190 | inherited Create(aOwner, aFileName, aContentType);
191 | FStream := TMemoryStream.Create;
192 | FStream.CopyFrom(aStream, 0);
193 | end;
194 |
195 | destructor TCacheItemMemory.Destroy;
196 | begin
197 | FStream.Free;
198 | inherited;
199 | end;
200 |
201 | { TCacheItemFile }
202 |
203 | constructor TCacheItemFile.Create(aOwner: TComponent; aStream: TStream;
204 | aFileName, aContentType: string);
205 | var
206 | LStream: TMemoryStream;
207 | begin
208 | inherited Create(aOwner, aFileName, aContentType);
209 | LStream.Create;
210 | try
211 | FPath := GetCacheFilePath(aOwner, aFileName);
212 | LStream.CopyFrom(aStream, 0);
213 | LStream.SaveToFile(FPath);
214 | finally
215 | LStream.Free;
216 | end;
217 | end;
218 |
219 | destructor TCacheItemFile.Destroy;
220 | begin
221 |
222 | inherited;
223 | end;
224 |
225 | class function TCacheItemFile.GetCacheFilePath(aOwner: TComponent; aFileName: string): string;
226 | begin
227 | // if is global cache
228 | if (aOwner <> nil) and (aOwner = DWServer) then
229 | // path is in base cache dir
230 | Result := DWServer.DocDir + 'Cache\' + aFileName
231 | // else if is Session Cache with Component Owner
232 | else if (aOwner <> nil) then // path is in Session dir and owner dir
233 | Result := DWServer.DocDir + 'Cache\' + DWApplication.DWAppID + '\' + aOwner.Name + '\' +
234 | aFileName
235 | // else is Session Cache without component Owner
236 | else if aOwner = nil then
237 | Result := DWServer.DocDir + 'Cache\' + DWApplication.DWAppID + '\' + aFileName;
238 | end;
239 |
240 | end.
241 |
--------------------------------------------------------------------------------
/DW.CORE.DWHandlers.pas:
--------------------------------------------------------------------------------
1 | { *******************************************************************************
2 | DW.CORE.DWApplication contains code from
3 | Project Overbyte ICS http://www.overbyte.be
4 |
5 | Delphi Web is
6 | Developped by Delcio Sbeghen @ SRP Sistemas
7 | delcio @ eavnet.com.br (remove spaces)
8 | under MIT Licence
9 | }
10 |
11 | unit DW.CORE.DWHandlers;
12 |
13 | interface
14 |
15 | uses Classes, DWUrlHandlerBase, DWTypes, OverbyteIcsHttpSrv;
16 |
17 | type
18 |
19 | THttpAllowedElement = class
20 | Path: String;
21 | Flags: TDWHttpAllowedFlag;
22 | end;
23 |
24 | THttpDispatchElement = class
25 | Path: String;
26 | Flags: THttpGetFlag;
27 | Proc: Pointer;
28 | SObjClass: TDWUrlHandlerClass;
29 | end;
30 |
31 | TDWHttpHandlerList = class(TStringList)
32 | protected
33 | function GetDisp(NItem: Integer): THttpDispatchElement;
34 | public
35 | destructor Destroy; override;
36 | property Disp[NItem: Integer]: THttpDispatchElement read GetDisp;
37 | end;
38 |
39 | TDWHttpAllowedPath = class(TStringList)
40 | protected
41 | function GetElem(NItem: Integer): THttpAllowedElement;
42 | public
43 | destructor Destroy; override;
44 | property Elem[NItem: Integer]: THttpAllowedElement read GetElem;
45 | end;
46 |
47 | implementation
48 |
49 | { TDWHttpHandlerList }
50 |
51 | destructor TDWHttpHandlerList.Destroy;
52 | var
53 | I: Integer;
54 | begin
55 | for I := Count - 1 downto 0 do
56 | begin
57 | if Assigned(Objects[I]) then
58 | begin
59 | Objects[I].Free;
60 | Objects[I] := nil;
61 | end;
62 | Self.Delete(I);
63 | end;
64 | inherited Destroy;
65 | end;
66 |
67 | function TDWHttpHandlerList.GetDisp(NItem: Integer): THttpDispatchElement;
68 | begin
69 | Result := Objects[NItem] as THttpDispatchElement;
70 | end;
71 |
72 | { TDWHttpAllowedPath }
73 |
74 | destructor TDWHttpAllowedPath.Destroy;
75 | var
76 | I: Integer;
77 | begin
78 | for I := Count - 1 downto 0 do
79 | begin
80 | if Assigned(Objects[I]) then
81 | begin
82 | Objects[I].Free;
83 | Objects[I] := nil;
84 | end;
85 | Self.Delete(I);
86 | end;
87 | inherited Destroy;
88 | end;
89 |
90 | function TDWHttpAllowedPath.GetElem(NItem: Integer): THttpAllowedElement;
91 | begin
92 | Result := Objects[NItem] as THttpAllowedElement;
93 | end;
94 |
95 | end.
96 |
--------------------------------------------------------------------------------
/DW.CORE.DWThread.pas:
--------------------------------------------------------------------------------
1 | unit DW.CORE.DWThread;
2 |
3 | { TODO 1 -oDELCIO -cClean : Remove this unit }
4 |
5 | interface
6 |
7 | implementation
8 |
9 | { TDWThread }
10 |
11 | end.
12 |
--------------------------------------------------------------------------------
/DW.CORE.MergeSort.pas:
--------------------------------------------------------------------------------
1 | unit DW.CORE.MergeSort;
2 | //try to implement this:
3 | //https://rosettacode.org/wiki/Sorting_algorithms/Merge_sort#Pascal
4 |
5 | {******************************************************************************
6 |
7 | Merge Sort for Delphi Lists
8 |
9 | Filename..........: uMergeSort.pas
10 | Version...........: 1.1
11 | Author............: Alexandre C. Machado
12 | Target compilers..: Delphi 2009 to XE7. Should probably work with older versions and newer Delphi versions as well
13 | Date..............: Feb-02-2015
14 | Description.......: Merge Sort for Delphi TList and descendants.
15 | http://alexandrecmachado.blogspot.com.br/2015/02/merge-sort-for-delphi.html
16 | Adapted from Julian Bucknall's algorithm published in "The Tomes of Delphi Algorithms and Data Structures" book.
17 | IMPORTANT NOTE:
18 | ***** The original algorithm in the book uses an "improved" insertion sort, but this algorithm breaks the merge sort stability.
19 | ***** We are using a standard insertion sort instead.
20 | ***** Thanks to dangph for pointing this and writing a test case
21 |
22 | Merge Sort algorithm is STABLE and this implementation performs even better than
23 | standard TList quick sort algorithm (~10% faster in most cases).
24 | Also implements replacements for TList and TObjectList, using this algorithm for sorting,
25 | instead of standard quick sort.
26 | Licensing stuff...: You may use this software in any kind of development,
27 | including commercial, redistribute and modify it freely.
28 | This software is provided as it is, without any kind of
29 | warranty given. Use it at Your own risk.
30 |
31 | Original test case unit written by dangph
32 | ******************************************************************************}
33 |
34 |
35 | interface
36 |
37 | uses
38 | SysUtils, Classes, Contnrs;
39 |
40 | type
41 | TListEx = class(TList)
42 | public
43 | procedure Sort(Compare: TListSortCompare);
44 | procedure MergeSort(Compare: TListSortCompare);
45 | procedure QuickSort(Compare: TListSortCompare);
46 | end;
47 |
48 | TObjectListEx = class(TObjectList)
49 | public
50 | procedure Sort(Compare: TListSortCompare);
51 | procedure MergeSort(Compare: TListSortCompare);
52 | procedure QuickSort(Compare: TListSortCompare);
53 | end;
54 |
55 | // this function may be used to merge sort any TList descendant, including TObjectList
56 | procedure MergeSortList(List: TList; CompareFunc: TListSortCompare);
57 |
58 | implementation
59 |
60 | type
61 | TPointerArray = array of Pointer;
62 | PPointerArray = ^TPointerArray;
63 |
64 | procedure DoInsertionSort(ptrList: PPointerList; FirstIndex: Integer; LastIndex: Integer;
65 | CompareFunc: TListSortCompare);
66 | var
67 | i, j: Integer;
68 | Temp: Pointer;
69 | begin
70 | for i := succ(FirstIndex) to LastIndex do begin
71 | Temp := ptrList^[i];
72 | j := i;
73 | while (j > FirstIndex) and (CompareFunc(Temp, ptrList^[j-1]) < 0) do begin
74 | ptrList^[j] := ptrList^[j-1];
75 | dec(j);
76 | end;
77 | ptrList^[j] := Temp;
78 | end;
79 | end;
80 |
81 | procedure DoMergeSort(ptrList: PPointerList; FirstIndex: Integer; LastIndex: Integer;
82 | CompareFunc: TListSortCompare; TempList: PPointerArray);
83 | const
84 | // When the list is smaller than this we use InsertionSort instead of calling MergeSort recursively.
85 | // 8 and 64 seem to be the lower and upper limits where the performance degrades, so
86 | // something between 16 and 32 probably gives the best performance
87 | MIN_LIST_SIZE = 16;
88 | var
89 | Mid: Integer;
90 | i, j: Integer;
91 | ToInx: Integer;
92 | FirstCount: Integer;
93 | begin
94 | // calculate the midpoint
95 | Mid := (FirstIndex + LastIndex) div 2;
96 | // sort the 1st half of the list, either with merge sort, or, if there are few enough items, with insertion sort
97 | if (FirstIndex < Mid) then begin
98 | if (Mid - FirstIndex) <= MIN_LIST_SIZE then begin
99 | DoInsertionSort(ptrList, FirstIndex, Mid, CompareFunc)
100 | end else begin
101 | DoMergeSort(ptrList, FirstIndex, Mid, CompareFunc, TempList);
102 | end;
103 | end;
104 | // sort the 2nd half of the list likewise
105 | if (succ(Mid) < LastIndex) then begin
106 | if (LastIndex - succ(Mid)) <= MIN_LIST_SIZE then begin
107 | DoInsertionSort(ptrList, succ(Mid), LastIndex, CompareFunc);
108 | end else begin
109 | DoMergeSort(ptrList, succ(Mid), LastIndex, CompareFunc, TempList);
110 | end;
111 | end;
112 | // copy the first half of the list to our temporary list
113 | FirstCount := succ(Mid - FirstIndex);
114 | System.Move(ptrList^[FirstIndex], TempList^[0], FirstCount * SizeOf(Pointer));
115 | // set up the indexes: i is the index for the temporary list (i.e., the
116 | // first half of the list), j is the index for the second half of the
117 | // list, ToInx is the index in the merged where items will be copied
118 | i := 0;
119 | j := succ(Mid);
120 | ToInx := FirstIndex;
121 | // now merge the two lists
122 | // repeat until one of the lists empties...
123 | while (i < FirstCount) and (j <= LastIndex) do begin
124 | // calculate the smaller item from the next items in both lists and copy it over; increment the relevant index
125 | if (CompareFunc(TempList^[i], ptrList^[j]) <= 0) then begin
126 | ptrList^[ToInx] := TempList^[i];
127 | inc(i);
128 | end else begin
129 | ptrList^[ToInx] := ptrList^[j];
130 | inc(j);
131 | end;
132 | // there's one more item in the merged list
133 | inc(ToInx);
134 | end;
135 | // if there are any more items in the first list, copy them back over
136 | if (i < FirstCount) then begin
137 | System.Move(TempList^[i], ptrList^[ToInx], (FirstCount - i) * SizeOf(Pointer));
138 | end;
139 | // if there are any more items in the second list then they're already in place and we're done; if there aren't, we're still done
140 | end;
141 |
142 | // Delphi XE2 and up declare TList's FList field as TPointerList. XE1 and below declare as PPointerList
143 | {$IF CompilerVersion > 22}
144 | {$DEFINE HAS_TPOINTERLIST}
145 | {$IFEND}
146 |
147 | procedure MergeSortList(List: TList; CompareFunc: TListSortCompare);
148 | var
149 | TempList: TPointerArray;
150 | xTempListSize: Integer;
151 | aFirst, aLast: Integer;
152 | begin
153 | if (List = nil) or (List.Count < 2) then begin
154 | Exit;
155 | end;
156 | aFirst := 0;
157 | aLast := List.Count - 1;
158 | xTempListSize := (List.Count div 2) + 1;
159 | SetLength(TempList, xTempListSize);
160 | DoMergeSort({$IFDEF HAS_TPOINTERLIST}@{$ENDIF}List.List, aFirst, aLast, CompareFunc, @TempList);
161 | end;
162 |
163 | { TListEx }
164 |
165 | procedure TListEx.MergeSort(Compare: TListSortCompare);
166 | begin
167 | MergeSortList(Self, Compare);
168 | end;
169 |
170 | procedure TListEx.QuickSort(Compare: TListSortCompare);
171 | begin
172 | inherited Sort(Compare);
173 | end;
174 |
175 | procedure TListEx.Sort(Compare: TListSortCompare);
176 | begin
177 | MergeSort(Compare); // Differently from TList, the default Sort() method uses the MergeSort algorightm
178 | end;
179 |
180 | { TObjectListEx }
181 |
182 | procedure TObjectListEx.MergeSort(Compare: TListSortCompare);
183 | begin
184 | MergeSortList(Self, Compare);
185 | end;
186 |
187 | procedure TObjectListEx.QuickSort(Compare: TListSortCompare);
188 | begin
189 | inherited Sort(Compare);
190 | end;
191 |
192 | procedure TObjectListEx.Sort(Compare: TListSortCompare);
193 | begin
194 | MergeSort(Compare); // Differently from TList, the default Sort() method uses the MergeSort algorightm
195 | end;
196 |
197 | end.
198 |
199 |
--------------------------------------------------------------------------------
/DW.CORE.MergeSortFunc.pas:
--------------------------------------------------------------------------------
1 | unit DW.CORE.MergeSortFunc;
2 |
3 | interface
4 |
5 | uses Classes, Controls;
6 |
7 | function ControlRenderingSort(AItem1: Pointer; AItem2: Pointer): Integer;
8 | function TabIndexSort(AItem1: Pointer; AItem2: Pointer): Integer;
9 |
10 | implementation
11 |
12 | uses DWGlobal, DWTypes, DW.VCL.TabControl;
13 |
14 | function TabIndexSort(AItem1: Pointer; AItem2: Pointer): Integer;
15 | var
16 | LTab1, LTab2: Integer;
17 | begin
18 | if TComponent(AItem1) is TDWTabPage then
19 | begin
20 | LTab1 := TDWTabPage(AItem1).TabIndex;
21 | end
22 | else
23 | begin
24 | LTab1 := -1;
25 | end;
26 | if TComponent(AItem2) is TDWTabPage then
27 | begin
28 | LTab2 := TDWTabPage(AItem2).TabIndex;
29 | end
30 | else
31 | begin
32 | LTab2 := -1;
33 | end;
34 | Result := LTab1 - LTab2;
35 | end;
36 |
37 | function ControlRenderingSort(AItem1: Pointer; AItem2: Pointer): Integer;
38 | var
39 | LTop1, LLeft1, LTop2, LLeft2, LIdx1, LIdx2: Integer;
40 | begin
41 | if TComponent(AItem1) is TControl then
42 | begin
43 | LTop1 := TControl(AItem1).Top;
44 | LLeft1 := TControl(AItem1).Left;
45 | LIdx1 := TControl(AItem1).ComponentIndex;
46 | end
47 | else
48 | begin
49 | LTop1 := -1;
50 | LLeft1 := -1;
51 | LIdx1 := -1;
52 | end;
53 | if TComponent(AItem2) is TControl then
54 | begin
55 | LTop2 := TControl(AItem2).Top;
56 | LLeft2 := TControl(AItem2).Left;
57 | LIdx2 := TControl(AItem2).ComponentIndex;
58 | end
59 | else
60 | begin
61 | LTop2 := -1;
62 | LLeft2 := -1;
63 | LIdx2 := -1;
64 | end;
65 |
66 | if gIWBSRenderingSortMethod = bsrmSortYX then
67 | begin
68 | Result := LTop1 - LTop2;
69 | if Abs(Result) < gIWBSRenderingGridPrecision then
70 | Result := LLeft1 - LLeft2;
71 | end
72 | else
73 | begin
74 | Result := LLeft1 - LLeft2;
75 | if Abs(Result) < gIWBSRenderingGridPrecision then
76 | Result := LTop1 - LTop2;
77 | end;
78 |
79 | if Result = 0 then
80 | Result := LIdx1 - LIdx2;
81 | end;
82 |
83 | end.
84 |
--------------------------------------------------------------------------------
/DW.CORE.UserSession.dfm:
--------------------------------------------------------------------------------
1 | object DWUserSession: TDWUserSession
2 | OldCreateOrder = True
3 | OnCreate = DataModuleCreate
4 | OnDestroy = DataModuleDestroy
5 | Height = 294
6 | Width = 396
7 | end
8 |
--------------------------------------------------------------------------------
/DW.CORE.UserSession.pas:
--------------------------------------------------------------------------------
1 | unit DW.CORE.UserSession;
2 |
3 | interface
4 |
5 | uses
6 | Classes, DW.VCL.DataModule, DW.CORE.DWApplication;
7 |
8 | type
9 |
10 | TDWUserSessionClass = class of TDWUserSession;
11 |
12 | TDWUserSession = class(TDWDataModule)
13 | private
14 | // FMainForm: TDWForm;
15 | // FOnCreate: TNotifyEvent;
16 | // FForms:TList;
17 | // FCallbacks: TDWCallBacks;
18 | // FActiveForm: TDWForm;
19 | // procedure SetMainForm(const Value: TDWForm);
20 | // procedure SetOnCreate(const Value: TNotifyEvent);
21 | // procedure SetActiveForm(const Value: TDWForm);
22 | protected
23 | // FUserCode: String;
24 | // FLogonTime: TDateTime;
25 | // FLastRequest: TDateTime; // Last request time stamp
26 | FRequestCount: Integer; // Count the requests
27 | // FIP: String; // Client IP Adress (beware of proxies)
28 | FLoginChallenge: String; // Used for secure login
29 | // FConfigPort: String; // Used for configuration process
30 | // FConfigTempDir: String; // Used for configuration process
31 | // FConfigHasLogo: Boolean; // Used for configuration process
32 | // FTempVar: Integer; // Currently used for anti-spam
33 | public
34 | // constructor Create(AOwner: TComponent); override;
35 |
36 | // constructor Create(AOwner: TComponent); override;
37 |
38 | // constructor Create(aDWAplication: TDWApplication); overload;
39 |
40 | // destructor Destroy; override;
41 |
42 | // property CallBacks:TDWCallBacks read FCallbacks;
43 | property RequestCount: Integer read FRequestCount write FRequestCount;
44 | // property LastRequest: TDateTime read FLastRequest write FLastRequest;
45 | // property IP: String read FIP write FIP;
46 | property LoginChallenge: String read FLoginChallenge write FLoginChallenge;
47 | // property ActiveForm:TDWForm read FActiveForm write SetActiveForm;
48 | published
49 | // property UserCode: String read FUserCode write FUserCode;
50 | // property LogonTime: TDateTime read FLogonTime write FLogonTime;
51 |
52 | // property ConfigPort: String read FConfigPort write FConfigPort;
53 | // property ConfigTempDir: String read FConfigTempDir write FConfigTempDir;
54 | // property ConfigHasLogo: Boolean read FConfigHasLogo write FConfigHasLogo;
55 | // property TempVar: Integer read FTempVar write FTempVar;
56 | // property MainForm:TDWForm read FMainForm write SetMainForm;
57 | // property OnCreate:TNotifyEvent read FOnCreate write SetOnCreate;
58 | end;
59 |
60 | implementation
61 |
62 | uses System.RTLConsts;
63 |
64 | //
65 |
66 | // {$R *.dfm}
67 | { TAppSrvSessionData }
68 |
69 | { constructor TDWUserSession.Create(AOwner: TComponent);
70 | begin
71 | inherited Create(AOwner);
72 | // if not OldCreateOrder then
73 | // DoCreate;
74 |
75 | // FForms:= TList.Create;
76 |
77 | // FTempVar := -1;
78 | // if Assigned(FOnCreate) then
79 | // FOnCreate(Self);
80 | end; }
81 |
82 | (* destructor TDWUserSession.Destroy;
83 | //var
84 | // I: Integer;
85 | begin
86 | { TODO 1 -oDELCIO -cVERIFY : Chech Memory leak }
87 | { for I := 0 to FForms.Count -1 do
88 | begin
89 | if Assigned(FForms[I]) then
90 | TDWForm(FForms[I]).Free;
91 | end;
92 | FForms.Free;
93 | FMainForm.Free; }
94 | inherited;
95 | end; *)
96 |
97 | (* procedure TDWUserSession.SetActiveForm(const Value: TDWForm);
98 | begin
99 | FActiveForm := Value;
100 | end;
101 |
102 |
103 | procedure TDWUserSession.SetMainForm(const Value: TDWForm);
104 | begin
105 | FMainForm := Value;
106 | end;
107 |
108 | procedure TDWUserSession.SetOnCreate(const Value: TNotifyEvent);
109 | begin
110 | FOnCreate:= Value;
111 | end; *)
112 |
113 | { TDWUserSession }
114 |
115 | (* constructor TDWUserSession.Create(aDWAplication: TDWApplication);
116 | begin
117 | inherited Create(aDWAplication);
118 | end; *)
119 |
120 | { constructor TDWUserSession.Create(AOwner: TComponent);
121 | begin
122 | inherited CreateNew(AOwner, -1);
123 | end; }
124 |
125 | initialization
126 |
127 | // RegisterClass(TDWUserSession);
128 |
129 | end.
130 |
--------------------------------------------------------------------------------
/DW.CORE.UserSessionold.dfm:
--------------------------------------------------------------------------------
1 | object DWUserSession: TDWUserSession
2 | OldCreateOrder = False
3 | Height = 294
4 | Width = 396
5 | end
6 |
--------------------------------------------------------------------------------
/DW.DESIGN.AccordionEditor.pas:
--------------------------------------------------------------------------------
1 | unit DW.DESIGN.AccordionEditor;
2 |
3 | interface
4 |
5 | uses
6 | DesignEditors, DesignIntf, Forms, DW.VCL.Accordion;
7 |
8 | type
9 |
10 | TDWAccordionEditor = class(TComponentEditor)
11 | procedure ExecuteVerb(Index: Integer); override;
12 | function GetVerb(Index: Integer): string; override;
13 | function GetVerbCount: Integer; override;
14 | end;
15 |
16 | implementation
17 |
18 | { TCSDBGridEditor }
19 |
20 | procedure TDWAccordionEditor.ExecuteVerb(Index: Integer);
21 | var
22 | Item: TDWAccordionItem;
23 | begin
24 | inherited;
25 | case Index of
26 | 0:
27 | begin
28 | Item := TDWAccordionItem(Designer.CreateChild(TDWAccordionItem, Component));
29 | TDWAccordion(Component).InsertItem(Item);
30 | // Item:= TDWAccordion(Component).CreateItem(Component);
31 | // Item.Name:= Designer.UniqueName(Item.ClassName);
32 | // TDWAccordion(Component).CreateItem(Component).Name:= Designer.UniqueName(Item.ClassName);;
33 | end;
34 | (* 1: Application.MessageBox(PChar(' TSDDBGrid' + #13#10#13#10 + '版本: 6.0'
35 | + ' (编译版本: 6.0.6.12)' + #13#10#13#10 + ''),
36 | 'About ...', 64); *)
37 | end;
38 | end;
39 |
40 | function TDWAccordionEditor.GetVerb(Index: Integer): string;
41 | begin
42 | case Index of
43 | 0:
44 | Result := 'Add Item';
45 | // 1: Result := 'Remove Item';
46 |
47 | end;
48 | end;
49 |
50 | function TDWAccordionEditor.GetVerbCount: Integer;
51 | begin
52 | Result := 1;
53 | end;
54 |
55 | end.
56 |
--------------------------------------------------------------------------------
/DW.DESIGN.TabControlEditor.pas:
--------------------------------------------------------------------------------
1 | unit DW.DESIGN.TabControlEditor;
2 |
3 | interface
4 |
5 | uses
6 | DesignEditors, DesignIntf, Forms, DW.VCL.TabControl;
7 |
8 | type
9 |
10 | TDWTabControlEditor = class(TComponentEditor)
11 | procedure ExecuteVerb(Index: Integer); override;
12 | function GetVerb(Index: Integer): string; override;
13 | function GetVerbCount: Integer; override;
14 | end;
15 |
16 | implementation
17 |
18 | { TCSDBGridEditor }
19 |
20 | procedure TDWTabControlEditor.ExecuteVerb(Index: Integer);
21 | var
22 | Tab: TDWTabPage;
23 | begin
24 | inherited;
25 | case Index of
26 | 0:
27 | begin
28 | Tab := TDWTabPage(Designer.CreateChild(TDWTabPage, Component));
29 | TDWTabControl(Component).InsertTab(Tab);
30 | // Item:= TDWAccordion(Component).CreateItem(Component);
31 | // Item.Name:= Designer.UniqueName(Item.ClassName);
32 | // TDWAccordion(Component).CreateItem(Component).Name:= Designer.UniqueName(Item.ClassName);;
33 | end;
34 | (* 1: Application.MessageBox(PChar(' TSDDBGrid' + #13#10#13#10 + '版本: 6.0'
35 | + ' (编译版本: 6.0.6.12)' + #13#10#13#10 + ''),
36 | 'About ...', 64); *)
37 | end;
38 | end;
39 |
40 | function TDWTabControlEditor.GetVerb(Index: Integer): string;
41 | begin
42 | case Index of
43 | 0:
44 | Result := 'Add TabPage';
45 | // 1: Result := 'Remove Item';
46 |
47 | end;
48 | end;
49 |
50 | function TDWTabControlEditor.GetVerbCount: Integer;
51 | begin
52 | Result := 1;
53 | end;
54 |
55 | end.
56 |
--------------------------------------------------------------------------------
/DW.DESIGN.UserSessionWizard.pas:
--------------------------------------------------------------------------------
1 | unit DW.DESIGN.UserSessionWizard;
2 |
3 | interface
4 |
5 | uses Classes, Winapi.Windows, Vcl.Dialogs, DesignIntf, ToolsAPI, TypInfo;
6 |
7 | type
8 |
9 | TDWUserSessionModuleCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator)
10 | private
11 | FOwner: IOTAModule;
12 | FImplFileName: string;
13 | FFormName: string;
14 | public
15 | constructor Create(AOwner: IOTAModule); overload;
16 | constructor Create; overload;
17 | // IOTACreator
18 | function GetCreatorType: string;
19 | function GetExisting: Boolean;
20 | function GetFileSystem: string;
21 | function GetOwner: IOTAModule;
22 | function GetUnnamed: Boolean;
23 | // IOTAModuleCreator
24 | function GetAncestorName: string;
25 | function GetImplFileName: string;
26 | function GetIntfFileName: string;
27 | function GetFormName: string;
28 | function GetMainForm: Boolean;
29 | function GetShowForm: Boolean;
30 | function GetShowSource: Boolean;
31 | function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
32 | function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
33 | function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
34 | procedure FormCreated(const FormEditor: IOTAFormEditor);
35 |
36 | end;
37 |
38 | TDWUserSessionModuleSource = class(TInterfacedObject, IOTAFile)
39 | private
40 | FModuleIdent: string;
41 | FFormIdent: string;
42 | FAncestorIdent: string;
43 | public
44 | constructor Create(const ModuleIdent, FormIdent, AncestorIdent: string);
45 | // IOTAFile
46 | function GetSource: string;
47 | function GetAge: TDateTime;
48 | end;
49 |
50 | const
51 | CrLf2 = #13#10#13#10;
52 | CrLf = #13#10;
53 |
54 | implementation
55 |
56 | uses
57 | SysUtils, System.Win.ComObj, DWForm, DW.Vcl.Labels, DW.CORE.UserSession;
58 |
59 | procedure DebugMsg(const Msg: String);
60 | begin
61 | // ShowMessage(Msg);
62 | end;
63 |
64 | constructor TDWUserSessionModuleCreator.Create;
65 | begin
66 | Create(nil);
67 | end;
68 |
69 | constructor TDWUserSessionModuleCreator.Create(AOwner: IOTAModule);
70 | begin
71 | inherited Create;
72 | FOwner := AOwner;
73 | end;
74 |
75 | procedure TDWUserSessionModuleCreator.FormCreated(const FormEditor: IOTAFormEditor);
76 | begin
77 | end;
78 |
79 | function TDWUserSessionModuleCreator.GetAncestorName: string;
80 | begin
81 | Result := 'DWUserSession';
82 | end;
83 |
84 | function TDWUserSessionModuleCreator.GetCreatorType: string;
85 | begin
86 | Result := sForm;
87 | end;
88 |
89 | function TDWUserSessionModuleCreator.GetExisting: Boolean;
90 | begin
91 | Result := False;
92 | end;
93 |
94 | function TDWUserSessionModuleCreator.GetFileSystem: string;
95 | begin
96 | Result := '';
97 | end;
98 |
99 | function TDWUserSessionModuleCreator.GetFormName: string;
100 | begin
101 | Result := 'DWSessionData';
102 | end;
103 |
104 | function TDWUserSessionModuleCreator.GetImplFileName: string;
105 | begin
106 | Result := GetCurrentDir + '\uDWSessionData.pas';
107 | end;
108 |
109 | function TDWUserSessionModuleCreator.GetIntfFileName: string;
110 | begin
111 | Result := '';
112 | end;
113 |
114 | function TDWUserSessionModuleCreator.GetMainForm: Boolean;
115 | begin
116 | Result := False;
117 | end;
118 |
119 | function TDWUserSessionModuleCreator.GetOwner: IOTAModule;
120 | begin
121 | if FOwner <> nil then
122 | Result := FOwner
123 | else
124 | Result := GetActiveProject;
125 | end;
126 |
127 | function TDWUserSessionModuleCreator.GetShowForm: Boolean;
128 | begin
129 | Result := True;
130 | end;
131 |
132 | function TDWUserSessionModuleCreator.GetShowSource: Boolean;
133 | begin
134 | Result := True;
135 | end;
136 |
137 | function TDWUserSessionModuleCreator.GetUnnamed: Boolean;
138 | begin
139 | Result := True;
140 | end;
141 |
142 | function TDWUserSessionModuleCreator.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile;
143 | begin
144 | Result := nil;
145 | end;
146 |
147 | function TDWUserSessionModuleCreator.NewImplSource(const ModuleIdent, FormIdent,
148 | AncestorIdent: string): IOTAFile;
149 | begin
150 | Result := TDWUserSessionModuleSource.Create(ModuleIdent, FormIdent, AncestorIdent);
151 | end;
152 |
153 | function TDWUserSessionModuleCreator.NewIntfSource(const ModuleIdent, FormIdent,
154 | AncestorIdent: string): IOTAFile;
155 | begin
156 | Result := nil;
157 | end;
158 |
159 | constructor TDWUserSessionModuleSource.Create(Const ModuleIdent, FormIdent, AncestorIdent: string);
160 | begin
161 | inherited Create;
162 | FModuleIdent := ModuleIdent;
163 | FFormIdent := FormIdent; // Copy(FormIdent, 2, MaxInt);
164 | FAncestorIdent := AncestorIdent; // Copy(AncestorIdent, 2,MaxInt);
165 | end;
166 |
167 | function TDWUserSessionModuleSource.GetAge: TDateTime;
168 | begin
169 | Result := -1;
170 | end;
171 |
172 | function TDWUserSessionModuleSource.GetSource: string;
173 | const
174 | cSource = 'unit %0:s;' + CrLf2 +
175 |
176 | 'interface' + CrLf2 +
177 |
178 | 'uses' + CrLf + ' DW.CORE.UserSession;' + CrLf +
179 |
180 | 'type' + CrLf +
181 |
182 | ' T%1:s = class(T%2:s)' + CrLf + ' private' + CrLf + ' { private declarations }' + CrLf +
183 | ' public' + CrLf + ' { public declarations }' + CrLf + ' end;' + CrLf2 +
184 |
185 | '{ !!! Do Not Declare Global Variables !!! }' + CrLf2 +
186 |
187 | 'implementation' + CrLf2 +
188 |
189 | ' uses' + CrLf + ' DWGlobal;' + CrLf2 +
190 | // '{'#9'%CLASSGROUP ''Vcl.Controls.TControl''}' + CrLf2 +
191 |
192 | '{$R *.dfm}' + CrLf2 + CrLf2 +
193 |
194 | 'initialization' + CrLf + ' gUserSessionClass := T%1:s;' + CrLf2 +
195 |
196 | 'end.';
197 | begin
198 | Result := Format(cSource, [FModuleIdent, FFormIdent, FAncestorIdent]);
199 | end;
200 |
201 | end.
202 |
--------------------------------------------------------------------------------
/DW.HTML.Page.pas:
--------------------------------------------------------------------------------
1 | unit DW.HTML.Page;
2 |
3 | interface
4 |
5 | uses System.Classes, DWElementTag;
6 |
7 | type
8 | TDWHTMLTag = class;
9 |
10 | TDWHeadTag = class(TDWElementTag)
11 | private
12 | FTitle: TDWElementTag;
13 | FInitScript: TDWElementTag;
14 | FFinScript: TDWElementTag;
15 | FInitComponents: TStrings;
16 | procedure Prepare;
17 | procedure SetInitComponents(const Value: TStrings);
18 | public
19 | constructor Create(aHTMLTAG: TDWHTMLTag); reintroduce;
20 | destructor Destroy; override;
21 | function Render: String; overload; override;
22 | procedure Clear;
23 | property Title: TDWElementTag read FTitle;
24 | property InitScript: TDWElementTag read FInitScript;
25 | property InitComponents: TStrings read FInitComponents write SetInitComponents;
26 | end;
27 |
28 | TDWBodyTag = class(TDWElementTag)
29 | private
30 | procedure Prepare;
31 | public
32 | constructor Create(aHTMLTAG: TDWHTMLTag); reintroduce;
33 | procedure Clear;
34 | end;
35 |
36 | TDWHTMLTag = class(TDWElementTag)
37 | private
38 | FDWHeadTag: TDWHeadTag;
39 | FDWBodyTag: TDWBodyTag;
40 | procedure SetBodyTag(const Value: TDWBodyTag);
41 | procedure SetHeadTag(const Value: TDWHeadTag);
42 | public
43 | constructor Create(AOwner: TComponent); reintroduce;
44 | procedure Clear;
45 | property HeadTag: TDWHeadTag read FDWHeadTag write SetHeadTag;
46 | property BodyTag: TDWBodyTag read FDWBodyTag write SetBodyTag;
47 | end;
48 |
49 | TDWHTMLPage = class(TComponent)
50 | private
51 | FDocType: string;
52 | FHTMLTAG: TDWHTMLTag;
53 | procedure SetHTMLTag(const Value: TDWHTMLTag);
54 | public
55 | constructor Create(AOwner: TComponent); override;
56 | procedure Clear;
57 | property DocType: string read FDocType write FDocType;
58 | property HTMLTag: TDWHTMLTag read FHTMLTAG write SetHTMLTag;
59 |
60 | end;
61 |
62 | implementation
63 |
64 | { TDWHTMLPage }
65 |
66 | procedure TDWHTMLPage.Clear;
67 | begin
68 | FHTMLTAG.Clear;
69 | end;
70 |
71 | constructor TDWHTMLPage.Create(AOwner: TComponent);
72 | begin
73 | inherited;
74 | FComponentStyle := FComponentStyle + [csTransient];
75 | FComponentStyle := FComponentStyle - [csSubComponent];
76 | FDocType := '';
77 | FHTMLTAG := TDWHTMLTag.Create(Self);
78 | end;
79 |
80 | procedure TDWHTMLPage.SetHTMLTag(const Value: TDWHTMLTag);
81 | begin
82 | FHTMLTAG := Value;
83 | end;
84 |
85 | { TDWHTMLTag }
86 |
87 | procedure TDWHTMLTag.Clear;
88 | begin
89 | FDWHeadTag.Clear;
90 | FDWBodyTag.Clear;
91 | Self.Contents.AddElemetAsObject(FDWHeadTag);
92 | Self.Contents.AddElemetAsObject(FDWBodyTag);
93 | end;
94 |
95 | constructor TDWHTMLTag.Create(AOwner: TComponent);
96 | begin
97 | inherited CreateHTMLTag('html');
98 | FDWHeadTag := TDWHeadTag.Create(Self);
99 | FDWBodyTag := TDWBodyTag.Create(Self);
100 | Self.Contents.AddElemetAsObject(FDWHeadTag);
101 | Self.Contents.AddElemetAsObject(FDWBodyTag);
102 | end;
103 |
104 | procedure TDWHTMLTag.SetBodyTag(const Value: TDWBodyTag);
105 | begin
106 | FDWBodyTag := Value;
107 | end;
108 |
109 | procedure TDWHTMLTag.SetHeadTag(const Value: TDWHeadTag);
110 | begin
111 | FDWHeadTag := Value;
112 | end;
113 |
114 | { TDWBodyTag }
115 |
116 | procedure TDWBodyTag.Clear;
117 | begin
118 | inherited Clear;
119 | Prepare;
120 | end;
121 |
122 | constructor TDWBodyTag.Create(aHTMLTAG: TDWHTMLTag);
123 | begin
124 | inherited CreateHTMLTag('body', aHTMLTAG);
125 | end;
126 |
127 | procedure TDWBodyTag.Prepare;
128 | begin
129 | AddStringParam('onload', 'Initialize();');
130 | AddStringParam('onunload', 'Finalize();');
131 | end;
132 |
133 | { TDWHeadTag }
134 |
135 | procedure TDWHeadTag.Clear;
136 | begin
137 | FTitle.Clear;
138 | FInitScript.Clear;
139 | FFinScript.Clear;
140 | FInitComponents.Clear;
141 | inherited Clear;
142 | Prepare;
143 | end;
144 |
145 | constructor TDWHeadTag.Create(aHTMLTAG: TDWHTMLTag);
146 | begin
147 | inherited CreateHTMLTag('head', aHTMLTAG);
148 | FTitle := TDWElementTag.CreateHTMLTag('title');
149 | FInitScript := TDWElementTag.CreateHTMLTag('script');
150 | FFinScript := TDWElementTag.CreateHTMLTag('script');
151 | FInitComponents := TStringList.Create;
152 | Clear;
153 | end;
154 |
155 | destructor TDWHeadTag.Destroy;
156 | begin
157 | FTitle.Free;
158 | FInitScript.Free;
159 | FInitComponents.Free;
160 | inherited;
161 | end;
162 |
163 | procedure TDWHeadTag.Prepare;
164 | begin
165 | Contents.AddElemetAsObject(FTitle, true);
166 | Contents.AddElemetAsObject(FInitScript, true);
167 | Contents.AddElemetAsObject(FFinScript, true);
168 | // Initialize
169 | FInitScript.Contents.AddText('function Initialize() {', true);
170 | FInitScript.Contents.AddText(' DW.initDW();', true);
171 | FInitScript.Contents.AddText(' DWInitComponents();', true);
172 | FInitScript.Contents.AddText('};', true);
173 | // Finalize
174 | FFinScript.Contents.AddText('function Finalize() {', true);
175 | FFinScript.Contents.AddText('};', true);
176 | end;
177 |
178 | function TDWHeadTag.Render: String;
179 | begin
180 | // Add components to be initiated in function DWInitComponents on InitScript
181 | FInitScript.Contents.AddText('function DWInitComponents() {' + #10#13);
182 | FInitScript.Contents.AddText(FInitComponents.Text);
183 | FInitScript.Contents.AddText(#10#13 + '};');
184 | // Render the tag and childs
185 | Result := inherited Render;
186 | end;
187 |
188 | procedure TDWHeadTag.SetInitComponents(const Value: TStrings);
189 | begin
190 | FInitComponents.Assign(Value);
191 | end;
192 |
193 | end.
194 |
--------------------------------------------------------------------------------
/DW.Server.pas:
--------------------------------------------------------------------------------
1 | unit DW.Server;
2 |
3 | interface
4 |
5 | uses Classes, Forms, System.SysUtils, OverbyteIcsHttpAppServer, DWHttpServer,
6 | OverbyteIcsFtpSrvT, DWForm;
7 |
8 | type
9 | TDWServerClient = class(THttpAppSrvConnection)
10 | private
11 | FResponseHeader: string;
12 | procedure SetResponseHeader(const Value: string);
13 |
14 | protected
15 |
16 | public
17 | CStartTick: longword ;
18 | CLastRead: int64 ;
19 | CLastWrite: int64 ;
20 | constructor Create(AOwner: TComponent); override;
21 | //header of response
22 | property ReplyHeader:string read FResponseHeader write SetResponseHeader;
23 | end;
24 |
25 | TDatamoduleClass = class of TDataModule;
26 |
27 | TDWServer = class(TComponent)
28 | private
29 | FHttpSrv: TDWHttpServer;
30 | FMainForm: TDWFormClass;
31 | FLibDir: string;
32 | FUrlBase: string;
33 | FRefreshCacheParam:string;
34 | FUserDataModule: TDatamoduleClass;
35 | procedure SetDocDir(const Value: string);
36 | procedure SetPort(const Value: String);
37 | procedure SetTemplateDir(const Value: string);
38 | function GetDocDir: string;
39 | function GetPort: String;
40 | function GetTemplateDir: string;
41 | procedure SetMainForm(const Value: TDWFormClass);
42 | procedure DoAddUrlHandlers;
43 | procedure SetLibDir(const Value: string);
44 | procedure SetUrlBase(const Value: string);
45 | function GetUrlBase: string;
46 | procedure HttpAppSrvBeforeProcessRequest(Sender, Client: TObject);
47 | procedure HttpAppSrvClientConnect(Sender, Client: TObject; Error: Word);
48 | procedure SetUserDataModule(const Value: TDatamoduleClass);
49 | public
50 | constructor Create(AOwner: TComponent); override;
51 | destructor Destroy; override;
52 | procedure Start;
53 | procedure Stop;
54 | function AppPath: string;
55 | class function GetDWServer: TDWServer;
56 | published
57 | property Port: String read GetPort write SetPort;
58 | property DocDir: string read GetDocDir write SetDocDir;
59 | property TemplateDir: string read GetTemplateDir write SetTemplateDir;
60 | property LibDir: string read FLibDir write SetLibDir;
61 | property MainForm: TDWFormClass read FMainForm write SetMainForm;
62 | property UrlBase: string read GetUrlBase write SetUrlBase;
63 | property RefreshCacheParam:string read FRefreshCacheParam;
64 | property UserDataModule:TDatamoduleClass read FUserDataModule write SetUserDataModule;
65 | property HttpServer:TDWHttpServer read FHttpSrv;
66 | end;
67 |
68 | implementation
69 |
70 | uses DWUrlHandlerForms;
71 |
72 | var
73 | gDWServer: TDWServer;
74 |
75 | { TDWServer }
76 |
77 | function TDWServer.AppPath: string;
78 | begin
79 | Result := ExtractFilePath(Application.ExeName);
80 | end;
81 |
82 | constructor TDWServer.Create(AOwner: TComponent);
83 | begin
84 | inherited;
85 | FHttpSrv := TDWHttpServer.Create(Self);
86 | with FHttpSrv do
87 | begin
88 | ClientClass:= TDWServerClient;
89 | Port := '80';
90 | DocDir := AppPath + 'wwwroot';
91 | TemplateDir := AppPath + 'wwwroot\templates';
92 | DefaultDoc:= 'index.html';
93 | AddGetAllowedPath('/', afBeginBy);
94 | ForceDirectories(AppPath + 'wwwroot');
95 | ForceDirectories(AppPath + 'wwwroot\templates');
96 | DoAddUrlHandlers;
97 | OnBeforeProcessRequest:= HttpAppSrvBeforeProcessRequest;
98 | OnClientConnect:= HttpAppSrvClientConnect;
99 | end;
100 | gDWServer := Self;
101 | FLibDir := AppPath + 'wwwroot\dwlib';
102 | FUrlBase := '';
103 | end;
104 |
105 | destructor TDWServer.Destroy;
106 | begin
107 | FHttpSrv.Stop;
108 | FHttpSrv.Free;
109 | inherited;
110 | end;
111 |
112 | procedure TDWServer.DoAddUrlHandlers;
113 | begin
114 | // Add all dynamic webpage handlers
115 |
116 |
117 | end;
118 |
119 | class function TDWServer.GetDWServer: TDWServer;
120 | begin
121 | Result := gDWServer;
122 | end;
123 |
124 | function TDWServer.GetDocDir: string;
125 | begin
126 | Result := FHttpSrv.DocDir;
127 | end;
128 |
129 | function TDWServer.GetPort: String;
130 | begin
131 | Result := FHttpSrv.Port;
132 | end;
133 |
134 | function TDWServer.GetTemplateDir: string;
135 | begin
136 | Result := FHttpSrv.TemplateDir;
137 | end;
138 |
139 | function TDWServer.GetUrlBase: string;
140 | begin
141 | if FUrlbase <> '' then
142 | Result:= FUrlBase
143 | else
144 | begin
145 | if FHttpSrv.Addr <> '' then
146 | begin
147 | Result:= 'http://'+ FHttpSrv.Addr + ':' + FHttpSrv.Port;
148 | end;
149 | end;
150 | end;
151 |
152 |
153 | procedure TDWServer.SetDocDir(const Value: string);
154 | begin
155 | if FHttpSrv.DocDir <> Value then
156 | FHttpSrv.DocDir := Value;
157 | end;
158 |
159 | procedure TDWServer.SetLibDir(const Value: string);
160 | begin
161 | FLibDir := Value;
162 | end;
163 |
164 | procedure TDWServer.SetMainForm(const Value: TDWFormClass);
165 | begin
166 | FMainForm := Value;
167 | end;
168 |
169 | procedure TDWServer.SetPort(const Value: String);
170 | begin
171 | if FHttpSrv.Port <> Value then
172 | FHttpSrv.Port := Value;
173 | end;
174 |
175 | procedure TDWServer.SetTemplateDir(const Value: string);
176 | begin
177 | if FHttpSrv.TemplateDir <> Value then
178 | FHttpSrv.TemplateDir := Value;
179 | end;
180 |
181 | procedure TDWServer.SetUrlBase(const Value: string);
182 | begin
183 | FUrlBase := Value;
184 | end;
185 |
186 | procedure TDWServer.SetUserDataModule(const Value: TDatamoduleClass);
187 | begin
188 | FUserDataModule := Value;
189 | end;
190 |
191 | procedure TDWServer.Start;
192 | begin
193 | FRefreshCacheParam:= FormatDateTime('yyyymmddhhnnsszzz', now);
194 | FHttpSrv.Start;
195 | end;
196 |
197 | procedure TDWServer.Stop;
198 | begin
199 | FHttpSrv.Stop;
200 | end;
201 |
202 | procedure TDWServer.HttpAppSrvBeforeProcessRequest(Sender, Client: TObject);
203 | var
204 | RemoteClient: TDWServerClient;
205 | begin
206 | RemoteClient := TDWServerClient(Client) ;
207 | RemoteClient.CStartTick := IcsGetTickCountX ;
208 | RemoteClient.CLastWrite := RemoteClient.WriteCount ;
209 | end;
210 |
211 | procedure TDWServer.HttpAppSrvClientConnect(Sender, Client: TObject;
212 | Error: Word);
213 | var
214 | ClientCnx : THttpAppSrvConnection;
215 | begin
216 | ClientCnx := Client as THttpAppSrvConnection;
217 | ClientCnx.WSessionCookie := 'OverbyteIcsWebAppServer' + FHttpSrv.Port;
218 |
219 | end;
220 |
221 |
222 | { TAppHttpConnection }
223 |
224 | constructor TDWServerClient.Create(AOwner: TComponent);
225 | begin
226 | inherited Create(AOwner);
227 | { keep alive means connection may be used for multiple requests so we must track how much
228 | data is sent before and after each request }
229 | CLastRead := 0 ;
230 | CLastWrite := 0 ;
231 | FResponseHeader:='';
232 | end;
233 |
234 | procedure TDWServerClient.SetResponseHeader(const Value: string);
235 | begin
236 | FResponseHeader := Value;
237 | end;
238 |
239 | end.
240 |
--------------------------------------------------------------------------------
/DW.VCL.Accordion.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Accordion;
2 |
3 | interface
4 |
5 | uses System.Classes, Controls, System.StrUtils, DW.VCL.Region, DWElementTag;
6 |
7 | type
8 |
9 | TDWAccordion = class;
10 |
11 | TDWAccordionItem = class(TDWRegion)
12 | private
13 | FAccordion: TDWAccordion;
14 | FCaption: string;
15 | FID: Integer;
16 | // FHTMLResult:TDWElementTag;
17 | procedure SetAccordion(const Value: TDWAccordion);
18 | procedure SetCaption(const Value: string);
19 | procedure SetID(const Value: Integer);
20 | protected
21 | procedure RenderComponents(aTagParent: TDWElementTag); override;
22 | public
23 | constructor Create(AOwner: TComponent); override;
24 | destructor Destroy; override;
25 | published
26 | property Accordion: TDWAccordion read FAccordion write SetAccordion;
27 | property Caption: string read FCaption write SetCaption;
28 | property ID: Integer read FID write SetID;
29 | end;
30 |
31 | TDWAccordionItems = class(TCollection)
32 |
33 | end;
34 |
35 | TDWAccordion = class(TDWRegion)
36 | private
37 | FItems: TList;
38 | FItemsPadding: string;
39 | procedure SetItemsPadding(const Value: string);
40 | protected
41 | function RenderHTML: TDWElementTag; override;
42 | public
43 | constructor Create(AOwner: TComponent); override;
44 | destructor Destroy; override;
45 | function CreateItem(AOwner: TComponent): TDWAccordionItem;
46 | procedure InsertItem(Item: TDWAccordionItem);
47 | procedure RemoveItem(Item: TDWAccordionItem);
48 |
49 | published
50 | property ItemsPadding: string read FItemsPadding write SetItemsPadding;
51 | end;
52 |
53 | implementation
54 |
55 | uses
56 | System.SysUtils;
57 |
58 | { TDWAccordion }
59 |
60 | constructor TDWAccordion.Create(AOwner: TComponent);
61 | begin
62 | inherited;
63 | FItems := TList.Create;
64 | end;
65 |
66 | function TDWAccordion.CreateItem(AOwner: TComponent): TDWAccordionItem;
67 | begin
68 | Result := TDWAccordionItem.Create(AOwner);
69 | Result.Parent := Self;
70 | Result.Accordion := Self;
71 | end;
72 |
73 | destructor TDWAccordion.Destroy;
74 | begin
75 | inherited;
76 | end;
77 |
78 | procedure TDWAccordion.InsertItem(Item: TDWAccordionItem);
79 | begin
80 | FItems.Add(Item);
81 | Item.FAccordion := Self;
82 | Item.Parent := Self;
83 | Item.Top := 0;
84 | { TODO 1 -oDELCIO -cVerify : verify insert item position in accordion }
85 | {
86 | if FItems.Count = 1 then
87 | Item.Top := 0
88 | else
89 | Item.Top := VertScrollBar.Range; }
90 | Item.Left := 0;
91 | Item.Align := alTop;
92 | { if not (csLoading in ComponentState) then
93 | AutoScrollInView(Item); }
94 | end;
95 |
96 | procedure TDWAccordion.RemoveItem(Item: TDWAccordionItem);
97 | begin
98 | Item.FAccordion := nil;
99 | FItems.Remove(Item);
100 | RemoveControl(Item);
101 | end;
102 |
103 | function TDWAccordion.RenderHTML: TDWElementTag;
104 | begin
105 | Result := inherited;
106 | Result.AddClassParam('panel-group');
107 | end;
108 |
109 | procedure TDWAccordion.SetItemsPadding(const Value: string);
110 | begin
111 | if FItemsPadding <> Value then
112 | begin
113 | if (Value <> '') and ((Copy(Value, Length(Value) - 1, 2) <> 'px') and
114 | (Copy(Value, Length(Value), 1) <> '%')) then
115 | raise Exception.Create('ItemsPadding must be of the format: 1px or 1%');
116 | FItemsPadding := Value;
117 | end;
118 | end;
119 |
120 | { TIBSAccordionItem }
121 |
122 | constructor TDWAccordionItem.Create(AOwner: TComponent);
123 | begin
124 | inherited;
125 | Height := 30;
126 | end;
127 |
128 | destructor TDWAccordionItem.Destroy;
129 | begin
130 |
131 | inherited;
132 | end;
133 |
134 | procedure TDWAccordionItem.RenderComponents(aTagParent: TDWElementTag);
135 | var
136 | aComponents: string;
137 | i: Integer;
138 | aBody: TDWElementTag;
139 | aHeader: TDWElementTag;
140 | begin
141 | // Render children componentes inside Item
142 | inherited;
143 | // Extract children components of Item
144 | for i := 0 to aTagParent.Contents.Count - 1 do
145 | begin
146 | aComponents := aComponents + aTagParent.Contents.Items[i].Render;
147 | end;
148 | // Clear Item
149 | aTagParent.Contents.Clear;
150 | // Add class css to Item
151 | aTagParent.AddClassParam('panel-default');
152 | // Create the Header
153 | aHeader := TDWElementTag.CreateHTMLTag('div');
154 | aHeader.AddClassParam('panel-heading');
155 | aHeader.Contents.AddText('
');
158 | // Add the Header to Item
159 | aTagParent.Contents.AddElemetAsObject(aHeader);
160 | // Create the Body
161 | aBody := TDWElementTag.CreateHTMLTag('div');
162 | aBody.AddClassParam('panel-collapse');
163 | aBody.AddClassParam('collapse');
164 | aBody.AddStringParam('id', 'collapse' + HTMLName);
165 | if FAccordion.ItemsPadding <> '' then
166 | aBody.AddStringParam('padding', FAccordion.ItemsPadding);
167 | if FAccordion = nil then
168 | raise Exception.Create('Accordion Property for Item ' + Self.Name + ' is not set.');
169 |
170 | aBody.Contents.AddText
171 | ( { '' + }
172 | '
'',
173 | ' style="padding:' + FAccordion.ItemsPadding + ';"', '') + '>' + aComponents +
174 | { <-- Add Components to Body }
175 | '
' { +
176 | '
' } );
177 | // Add Body(and components) to Item
178 | aTagParent.Contents.AddElemetAsObject(aBody);
179 | end;
180 |
181 | procedure TDWAccordionItem.SetAccordion(const Value: TDWAccordion);
182 | var
183 | LRecreating: Boolean;
184 | begin
185 | if FAccordion <> Value then
186 | begin
187 | LRecreating := False;
188 | if not(csLoading in ComponentState) then
189 | begin
190 | LRecreating := csRecreating in ControlState;
191 | if not LRecreating then
192 | UpdateRecreatingFlag(True);
193 | end;
194 |
195 | try
196 | if FAccordion <> nil then
197 | FAccordion.RemoveItem(Self);
198 | Parent := Value;
199 | if Value <> nil then
200 | begin
201 | Value.InsertItem(Self);
202 | if not(csLoading in ComponentState) and not LRecreating then
203 | RecreateWnd;
204 | end;
205 | finally
206 | if not(csLoading in ComponentState) and not LRecreating then
207 | UpdateRecreatingFlag(False);
208 | end;
209 | end;
210 | end;
211 |
212 | procedure TDWAccordionItem.SetCaption(const Value: string);
213 | begin
214 | FCaption := Value;
215 | end;
216 |
217 | procedure TDWAccordionItem.SetID(const Value: Integer);
218 | begin
219 | FID := Value;
220 | end;
221 |
222 | initialization
223 |
224 | RegisterClass(TDWAccordionItem);
225 |
226 | end.
227 |
--------------------------------------------------------------------------------
/DW.VCL.BaseControl.pas:
--------------------------------------------------------------------------------
1 | // this unit to be removed
2 |
3 | unit DW.VCL.BaseControl;
4 |
5 | interface
6 |
7 | uses Classes, Controls;
8 |
9 | type
10 |
11 | TDWBaseControl = class(TControl)
12 |
13 | end;
14 |
15 | implementation
16 |
17 | end.
18 |
--------------------------------------------------------------------------------
/DW.VCL.ButtonGroup.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.ButtonGroup;
2 |
3 | interface
4 |
5 | uses
6 | SysUtils, Classes, Controls, StrUtils,
7 | DW.VCL.CustomRegion, DWTypes;
8 |
9 | type
10 | TDWButtonGroup = class(TDWCustomRegion)
11 | private
12 | FVertical: boolean;
13 | FJustified: boolean;
14 | FSize: TDWSize;
15 | procedure SetJustified(const Value: boolean);
16 | procedure SetSize(const Value: TDWSize);
17 | procedure SetVertical(const Value: boolean);
18 | protected
19 | procedure InternalRenderCss(var ACss: string); override;
20 | public
21 | constructor Create(AOwner: TComponent); override;
22 | function GetRoleString: string; override;
23 | published
24 | property BSVertical: boolean read FVertical write SetVertical default false;
25 | property BSJustified: boolean read FJustified write SetJustified default false;
26 | property BSButtonSize: TDWSize read FSize write SetSize default bsszDefault;
27 | end;
28 |
29 | implementation
30 |
31 | uses DW.VCL.NavBar, DW.VCL.Common;
32 |
33 | constructor TDWButtonGroup.Create(AOwner: TComponent);
34 | begin
35 | inherited;
36 | FVertical := false;
37 | FJustified := false;
38 | FSize := bsszDefault;
39 | end;
40 |
41 | function TDWButtonGroup.GetRoleString: string;
42 | begin
43 | Result := 'group';
44 | end;
45 |
46 | procedure TDWButtonGroup.InternalRenderCss(var ACss: string);
47 | begin
48 | if FVertical then
49 | TDWBSCommon.AddCssClass(ACss, 'btn-group-vertical')
50 | else
51 | TDWBSCommon.AddCssClass(ACss, 'btn-group');
52 | if FSize <> bsszDefault then
53 | TDWBSCommon.AddCssClass(ACss, 'btn-group-' + aDWSize[FSize]);
54 | if FJustified then
55 | TDWBSCommon.AddCssClass(ACss, 'btn-group-justified');
56 | if Parent is TDWNavBarBase then
57 | TDWBSCommon.AddCssClass(ACss, 'navbar-btn');
58 | inherited;
59 | end;
60 |
61 | procedure TDWButtonGroup.SetJustified(const Value: boolean);
62 | begin
63 | FJustified := Value;
64 | AsyncRefreshControl;
65 | end;
66 |
67 | procedure TDWButtonGroup.SetSize(const Value: TDWSize);
68 | begin
69 | FSize := Value;
70 | AsyncRefreshControl;
71 | end;
72 |
73 | procedure TDWButtonGroup.SetVertical(const Value: boolean);
74 | begin
75 | FVertical := Value;
76 | AsyncRefreshControl;
77 | end;
78 |
79 | end.
80 |
--------------------------------------------------------------------------------
/DW.VCL.Component.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Component;
2 |
3 | interface
4 |
5 | uses Classes;
6 |
7 | type
8 | TDWVCLComponent = class(TComponent)
9 |
10 | end;
11 |
12 | implementation
13 |
14 | end.
15 |
--------------------------------------------------------------------------------
/DW.VCL.CustomForm.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.CustomForm;
2 |
3 | interface
4 |
5 | uses Classes, Forms, Controls, DW.HTML.Page, DWRenderStream, DWCallbacks,
6 | DW.VCL.Container;
7 |
8 | type
9 |
10 | TDWCustomForm = class(TDWModuleContainer)
11 | private
12 | FHTMLPage: TDWHTMLPage;
13 | FCaption: string;
14 | FOnRender: TNotifyEvent;
15 | FOnShow: TNotifyEvent;
16 | procedure SetCaption(const Value: string);
17 | procedure SetOnRender(const Value: TNotifyEvent);
18 | procedure SetOnShow(const Value: TNotifyEvent);
19 | protected
20 | procedure DoOnRender; virtual;
21 | public
22 | constructor Create(AOwner: TComponent); override;
23 | destructor Destroy; override;
24 | function HTMLPage: TDWHTMLPage;
25 | procedure ExecuteCallBack(aParams: TStringList; aCallBack: TDWCallBack); virtual; abstract;
26 | Function Render: TDWStream; virtual;
27 | procedure Show;
28 | published
29 | property Caption: string read FCaption write SetCaption;
30 | property OnRender: TNotifyEvent read FOnRender write SetOnRender;
31 | property OnShow: TNotifyEvent read FOnShow write SetOnShow;
32 |
33 | end;
34 |
35 | implementation
36 |
37 | uses
38 | System.RTLConsts, DWUtils;
39 |
40 | { TDWCustomForm }
41 |
42 | constructor TDWCustomForm.Create(AOwner: TComponent);
43 | begin
44 | inherited;
45 | if (ClassType <> TDWCustomForm) and not(csDesignInstance in ComponentState) then
46 | begin
47 | if not InitInheritedComponent(Self, TDWCustomForm) then
48 | raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
49 | end
50 | else
51 | begin
52 | Width := 320;
53 | Height := 240;
54 | end;
55 | FHTMLPage := TDWHTMLPage.Create(Self);
56 | // to avoid store FHTMLPage to dfm
57 | if csDesigning in ComponentState then
58 | RemoveComponent(FHTMLPage);
59 | FHTMLPage.Name := 'HTMLPage';
60 | ControlStyle := ControlStyle + [csAcceptsControls];
61 | DoOnCreate;
62 | end;
63 |
64 | destructor TDWCustomForm.Destroy;
65 | begin
66 | inherited;
67 | end;
68 |
69 | function TDWCustomForm.HTMLPage: TDWHTMLPage;
70 | begin
71 | Result := FHTMLPage;
72 | end;
73 |
74 | function TDWCustomForm.Render: TDWStream;
75 | begin
76 | DoOnRender;
77 | end;
78 |
79 | procedure TDWCustomForm.SetCaption(const Value: string);
80 | begin
81 | FCaption := Value;
82 | end;
83 |
84 | procedure TDWCustomForm.SetOnRender(const Value: TNotifyEvent);
85 | begin
86 | FOnRender := Value;
87 | end;
88 |
89 | procedure TDWCustomForm.SetOnShow(const Value: TNotifyEvent);
90 | begin
91 | FOnShow := Value;
92 | end;
93 |
94 | procedure TDWCustomForm.Show;
95 | begin
96 | DWApplication.ActiveForm := Self;
97 | DWApplication.AddForm(Self);
98 | if Assigned(FOnShow) then
99 | FOnShow(Self);
100 | end;
101 |
102 | procedure TDWCustomForm.DoOnRender;
103 | begin
104 | if Assigned(FOnRender) then
105 | FOnRender(Self);
106 | end;
107 |
108 | end.
109 |
--------------------------------------------------------------------------------
/DW.VCL.DBControl.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.DBControl;
2 |
3 | interface
4 |
5 | uses
6 | Classes, System.SysUtils, DW.VCL.Control, DB, DWElementTag, DW.VCL.DataLink;
7 |
8 | type
9 | // Base class for DW data aware controls
10 | TDWCustomDbControl = class(TDWInputControl)
11 | private
12 | FMaxLength: Integer;
13 | procedure SetMaxLength(const AValue: Integer);
14 | protected
15 | FDataLink: TDWDataLink;
16 | FDataField: string;
17 | FDataSource: TDataSource;
18 | procedure CheckData; virtual;
19 | procedure Notification(AComponent: TComponent; AOperation: TOperation); override;
20 | procedure SetDataField(const AValue: string); virtual;
21 | procedure SetDataSource(const Value: TDataSource); virtual;
22 | property MaxLength: Integer read FMaxLength write SetMaxLength;
23 | public
24 | constructor Create(AOwner: TComponent); override;
25 | destructor Destroy; override;
26 | procedure InternalRenderCss(var ACss: string); override;
27 | function RenderAsync: TDWElementXHTMLTag; override;
28 | function RenderHTML: TDWElementTag; override;
29 | published
30 | property DataSource: TDataSource read FDataSource write SetDataSource;
31 | property DataField: string read FDataField write SetDataField;
32 | end;
33 |
34 | implementation
35 |
36 | uses
37 | DWUtils;
38 | { TIWBSCustomDbControl }
39 |
40 | procedure TDWCustomDbControl.CheckData;
41 | begin
42 | //
43 | end;
44 |
45 | constructor TDWCustomDbControl.Create(AOwner: TComponent);
46 | begin
47 | inherited;
48 | FDataLink := nil;
49 | FDataField := '';
50 | end;
51 |
52 | destructor TDWCustomDbControl.Destroy;
53 | begin
54 | FreeAndNil(FDataLink);
55 | inherited;
56 | end;
57 |
58 | procedure TDWCustomDbControl.InternalRenderCss(var ACss: string);
59 | begin
60 | inherited;
61 |
62 | end;
63 |
64 | procedure TDWCustomDbControl.Notification(AComponent: TComponent; AOperation: TOperation);
65 | begin
66 | inherited Notification(AComponent, AOperation);
67 | if AOperation = opRemove then
68 | if FDataSource = AComponent then
69 | SetDataSource(nil);
70 | end;
71 |
72 | function TDWCustomDbControl.RenderAsync: TDWElementXHTMLTag;
73 | begin
74 | CheckData;
75 | Result := inherited;
76 | end;
77 |
78 | function TDWCustomDbControl.RenderHTML: TDWElementTag;
79 | begin
80 | CheckData;
81 | Result := inherited;
82 | end;
83 |
84 | procedure TDWCustomDbControl.SetDataField(const AValue: string);
85 | var
86 | xFld: TField;
87 | begin
88 | if not SameText(AValue, FDataField) then
89 | begin
90 | FDataField := AValue;
91 | MaxLength := 0;
92 | if FDataField <> '' then
93 | begin
94 | xFld := GetDataSourceField(FDataSource, FDataField);
95 | if Assigned(xFld) and (xFld is TStringField) then
96 | MaxLength := TStringField(xFld).Size;
97 | end;
98 | Invalidate;
99 | end;
100 | end;
101 |
102 | procedure TDWCustomDbControl.SetDataSource(const Value: TDataSource);
103 | begin
104 | if Value <> FDataSource then
105 | begin
106 | FDataSource := Value;
107 | if Value = nil then
108 | begin
109 | FDataField := '';
110 | FreeAndNil(FDataLink);
111 | end
112 | else
113 | begin
114 | if FDataLink = nil then
115 | FDataLink := TDWDataLink.Create(Self);
116 | FDataLink.DataSource := FDataSource;
117 | end;
118 | Invalidate;
119 | end;
120 | end;
121 |
122 | procedure TDWCustomDbControl.SetMaxLength(const AValue: Integer);
123 | begin
124 | if FMaxLength <> AValue then
125 | begin
126 | FMaxLength := AValue;
127 | AsyncRefreshControl;
128 | end;
129 | end;
130 |
131 | end.
132 |
--------------------------------------------------------------------------------
/DW.VCL.DataLink.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.DataLink;
2 |
3 | interface
4 |
5 | uses
6 | Classes, DB, DW.VCL.Control;
7 |
8 | type
9 | TDWDatalink = class(TDataLink)
10 | private
11 | FControl: TDWControl;
12 | procedure UpdateControlState;
13 | protected
14 | procedure ActiveChanged; override;
15 | procedure EditingChanged; override;
16 | procedure LayoutChanged; override;
17 | procedure DataEvent(Event: TDataEvent; Info: NativeInt); override;
18 | property Control: TDWControl read FControl;
19 | public
20 | constructor Create(AControl: TDWControl); reintroduce;
21 | end;
22 |
23 | implementation
24 |
25 | { TDWDatalink }
26 |
27 | procedure TDWDatalink.ActiveChanged;
28 | begin
29 | UpdateControlState;
30 | inherited;
31 | end;
32 |
33 | constructor TDWDatalink.Create(AControl: TDWControl);
34 | begin
35 | inherited Create;
36 | FControl := AControl;
37 | end;
38 |
39 | procedure TDWDatalink.DataEvent(Event: TDataEvent; Info: NativeInt);
40 | begin
41 | inherited;
42 | end;
43 |
44 | procedure TDWDatalink.EditingChanged;
45 | begin
46 | UpdateControlState;
47 | inherited;
48 | end;
49 |
50 | procedure TDWDatalink.LayoutChanged;
51 | begin
52 | UpdateControlState;
53 | inherited;
54 | end;
55 |
56 | procedure TDWDatalink.UpdateControlState;
57 | begin
58 | if FControl <> nil then
59 | FControl.Invalidate;
60 | end;
61 |
62 | end.
63 |
--------------------------------------------------------------------------------
/DW.VCL.DataModule.dfm:
--------------------------------------------------------------------------------
1 | object DWDataModule: TDWDataModule
2 | Left = 0
3 | Top = 0
4 | ClientHeight = 379
5 | ClientWidth = 432
6 | Color = clBtnFace
7 | Font.Charset = DEFAULT_CHARSET
8 | Font.Color = clWindowText
9 | Font.Height = -11
10 | Font.Name = 'Tahoma'
11 | Font.Style = []
12 | OldCreateOrder = False
13 | PixelsPerInch = 96
14 | TextHeight = 13
15 | end
16 |
--------------------------------------------------------------------------------
/DW.VCL.DataModule.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.DataModule;
2 |
3 | interface
4 |
5 | uses Classes, Controls, system.Types, system.RTLConsts;
6 |
7 | type
8 |
9 | TDWDataModule = class(TDataModule)
10 |
11 | end;
12 |
13 | implementation
14 |
15 | { %CLASSGROUP 'Vcl.Controls.TControl }
16 |
17 | // {$R *.dfm}
18 |
19 | initialization
20 |
21 | // RegisterClass(TDWDatamodule);
22 |
23 | end.
24 |
--------------------------------------------------------------------------------
/DW.VCL.FIREDAC.Register.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.FIREDAC.Register;
2 |
3 | interface
4 | uses Classes;
5 |
6 | procedure Register;
7 |
8 |
9 | implementation
10 | uses
11 | DW.VCL.FIREDAC.Search;
12 |
13 |
14 | procedure Register;
15 | begin
16 | RegisterComponents('DelphiWeb Firedac', [TDWFSearch]);
17 | end;
18 |
19 |
20 | end.
21 |
--------------------------------------------------------------------------------
/DW.VCL.FIREDAC.Search.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DW.VCL.FIREDAC.Search.pas
--------------------------------------------------------------------------------
/DW.VCL.Frame.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Frame;
2 |
3 | interface
4 |
5 | uses Classes, VCL.Controls, DW.VCL.Region, DWElementTag;
6 |
7 | type
8 |
9 | TDWCustomFrameClass = class of TDWCustomFrame;
10 |
11 | TDWCustomFrame = class(TDWRegion)
12 | private
13 | FOnDestroy: TNotifyEvent;
14 | FOnCreate: TNotifyEvent;
15 | procedure SetOnCreate(const Value: TNotifyEvent);
16 | procedure SetOnDestroy(const Value: TNotifyEvent);
17 | protected
18 | procedure AfterConstruction; override;
19 | procedure BeforeDestruction; override;
20 | public
21 | constructor Create(AOwner: TComponent); override;
22 | destructor Destroy; override;
23 | published
24 | property OnCreate: TNotifyEvent read FOnCreate write SetOnCreate;
25 | property OnDestroy: TNotifyEvent read FOnDestroy write SetOnDestroy;
26 | end;
27 |
28 | TDWFrame = class(TDWCustomFrame)
29 |
30 | end;
31 |
32 | implementation
33 |
34 | uses
35 | DW.VCL.Common, System.RTLConsts;
36 |
37 | { TDWFrame }
38 |
39 | procedure TDWCustomFrame.AfterConstruction;
40 | begin
41 | inherited;
42 | if Assigned(FOnCreate) then
43 | FOnCreate(Self);
44 | end;
45 |
46 | procedure TDWCustomFrame.BeforeDestruction;
47 | begin
48 | inherited;
49 | if Assigned(FOnDestroy) then
50 | FOnDestroy(Self);
51 | end;
52 |
53 | constructor TDWCustomFrame.Create(AOwner: TComponent);
54 | begin
55 | inherited;
56 | ControlStyle := ControlStyle + [csAcceptsControls];
57 | if (ClassType <> TDWCustomFrame) and not(csDesignInstance in ComponentState) then
58 | begin
59 | if not InitInheritedComponent(Self, TDWCustomFrame) then
60 | raise EResNotFound.CreateFmt(SResNotFound, [ClassName]);
61 | end
62 | else
63 | begin
64 | Width := 320;
65 | Height := 240;
66 | end;
67 | end;
68 |
69 | destructor TDWCustomFrame.Destroy;
70 | begin
71 | inherited;
72 | end;
73 |
74 | procedure TDWCustomFrame.SetOnCreate(const Value: TNotifyEvent);
75 | begin
76 | FOnCreate := Value;
77 | end;
78 |
79 | procedure TDWCustomFrame.SetOnDestroy(const Value: TNotifyEvent);
80 | begin
81 | FOnDestroy := Value;
82 | end;
83 |
84 | end.
85 |
--------------------------------------------------------------------------------
/DW.VCL.Iframe.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Iframe;
2 |
3 | interface
4 |
5 | uses Classes, DWElementTag, DW.VCL.CustomRegion;
6 |
7 | type
8 | TDWIFrame = class(TDWCustomRegion)
9 | private
10 | FSrc: string;
11 | procedure SetSrc(const Value: string);
12 | protected
13 | FOldSrc: string;
14 | function RenderAsync: TDWElementXHTMLTag; override;
15 | function RenderHTML: TDWElementTag; override;
16 | public
17 | constructor Create(AOwner: TComponent); override;
18 | destructor Destroy; override;
19 | published
20 | property Src: string read FSrc write SetSrc;
21 |
22 | end;
23 |
24 | implementation
25 |
26 | uses
27 | DW.VCL.Common;
28 |
29 | { TDWIFrame }
30 |
31 | constructor TDWIFrame.Create(AOwner: TComponent);
32 | begin
33 | inherited;
34 | FTagName := 'iframe'
35 | end;
36 |
37 | destructor TDWIFrame.Destroy;
38 | begin
39 |
40 | inherited;
41 | end;
42 |
43 | function TDWIFrame.RenderAsync: TDWElementXHTMLTag;
44 | var
45 | xHTMLName: string;
46 | begin
47 | Result := nil;
48 | xHTMLName := HTMLName;
49 |
50 | if (FAsyncRefreshControl) or (not FRendered) or (FOldSrc <> FSrc) then
51 | begin
52 | TDWRegionCommon.CancelChildAsyncRender(Self);
53 | TDWBSCommon.RenderAsync(xHTMLName, Self);
54 | end
55 | else
56 | begin
57 | TDWBSCommon.SetAsyncClass(xHTMLName, RenderCSSClass, FOldCss);
58 | TDWBSCommon.SetAsyncStyle(xHTMLName, RenderStyle, FOldStyle);
59 | TDWBSCommon.SetAsyncVisible(FMainID, Visible, FOldVisible);
60 |
61 | if Assigned(OnAfterAsyncChange) then
62 | OnAfterAsyncChange(Self);
63 | { TODO 1 -oDELCIO -cIMPLEMENT : Global event OnAfterAsyncChange }
64 | { if Assigned(gIWBSOnAfterAsyncChange) then
65 | gIWBSOnAfterAsyncChange(Self, xHTMLName); }
66 | end;
67 | end;
68 |
69 | function TDWIFrame.RenderHTML: TDWElementTag;
70 | begin
71 | FOldCss := RenderCSSClass;
72 | FOldStyle := RenderStyle;
73 | FOldVisible := Visible;
74 | FOldSrc := FSrc;
75 |
76 | FRegionDiv := TDWElementTag.CreateHTMLTag(FTagName);
77 | FRegionDiv.AddStringParam('id', HTMLName);
78 | FRegionDiv.AddClassParam(FOldCss);
79 | FRegionDiv.AddStringParam('src', FOldSrc);
80 | // FRegionDiv.AddStringParam('role',GetRoleString);
81 | FRegionDiv.AddStringParam('style', RenderStyle);
82 |
83 | TDWBSCommon.RenderScript(Self, FRegionDiv);
84 | FMainID := FRegionDiv.Params.Values['id'];
85 |
86 | Result := FRegionDiv;
87 |
88 | FAsyncRefreshControl := False;
89 | FRendered := True;
90 | end;
91 |
92 | procedure TDWIFrame.SetSrc(const Value: string);
93 | begin
94 | if FSrc <> Value then
95 | begin
96 | FSrc := Value;
97 | AsyncRefreshControl;
98 | end;
99 | end;
100 |
101 | end.
102 |
--------------------------------------------------------------------------------
/DW.VCL.InputGroup.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.InputGroup;
2 |
3 | interface
4 |
5 | uses
6 | Classes, DW.VCL.Container;
7 |
8 | implementation
9 |
10 | end.
11 |
--------------------------------------------------------------------------------
/DW.VCL.InputMoney.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DW.VCL.InputMoney.pas
--------------------------------------------------------------------------------
/DW.VCL.Interfaces.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Interfaces;
2 |
3 | interface
4 |
5 | uses Classes, Controls, DW.VCL.ScriptParams, DWElementTag;
6 |
7 | type
8 |
9 | // interface for all DWControls and Containers
10 | IDWControl = interface(IInterfaceComponentReference)
11 | ['{01D165DB-3058-4A07-89B3-54D1EC895366}']
12 | function GetScriptParams: TDWScriptParams;
13 | procedure SetScriptParams(const Value: TDWScriptParams);
14 | function GetScriptInsideTag: Boolean;
15 | procedure SetScriptInsideTag(const Value: Boolean);
16 | function GetScript: TStringList;
17 | procedure SetScript(const Value: TStringList);
18 | // Free the Control on next thread loop
19 | procedure Release;
20 | procedure InternalRenderScript(const AHTMLName: string; AScript: TStringList);
21 |
22 | // Return name of element in HTML.
23 | // If RootParent is an TDWCustomForm, HTMLName is same as Name,
24 | // else if RootParent is an TDWFrame, HTMLName is FrameName_ComponentName
25 | // this is necessary because one frame can be placed into one Form,
26 | // and this can cause duplicate names in same HTML Page
27 | function HTMLName: string;
28 | // Render AsyncEvents(ClallBacks)
29 | function RenderAsyncEvents: string;
30 | // Render control on full form load or on FRendered = false
31 | // Return one TDWElementTag with element HTML
32 | function RenderHTML: TDWElementTag;
33 | // Render HTML "class" tag property
34 | function RenderCSSClass: string;
35 | // Render control on form Async Calls
36 | // Return one TDWElementXHTMLTag with element XHTML
37 | function RenderAsync: TDWElementXHTMLTag;
38 | // Get Form where Component it is
39 | function Form: TControl;
40 | // return true if control is in DWAppplication release list
41 | // and waiting to be released in next DWApplication Loop
42 | function IsReleased: Boolean;
43 | // Params that will be replaced in scripts and in some controls content, for example in TDWText. @br
44 | // Params are specified in scripts as: {%param%}.
45 | property ScriptParams: TDWScriptParams read GetScriptParams write SetScriptParams;
46 | // Specifies if the script will be rendered inside the control tag or not. @br
47 | // If true the script will be rendered inside the tag. @br
48 | // If false a new div will be created to surround the control and the script will be rendered in this div, outside the control tag. @br
49 | // this is necessary script can't be placed inside the tag, for example in input controls.
50 | property ScriptInsideTag: Boolean read GetScriptInsideTag write SetScriptInsideTag;
51 | // User Defined Scripts
52 | property Script: TStringList read GetScript write SetScript;
53 | end;
54 |
55 | IDWInput = interface(IDWControl)
56 | ['{6078F30A-F033-40F6-8043-7042DAA5995A}']
57 | procedure SetValue(const AValue: string);
58 | end;
59 |
60 | implementation
61 |
62 | end.
63 |
--------------------------------------------------------------------------------
/DW.VCL.List.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.List;
2 |
3 | interface
4 |
5 | uses
6 | SysUtils, Classes, Controls, StrUtils, DW.VCL.CustomRegion, DW.VCL.Control,
7 | DWElementTag;
8 |
9 | type
10 | TIWBSListType = (bsltNone, bsltDropDownMenu, bsltGroup, bsltInline, bsltNav, bsltPager,
11 | bsltPagination, bsltPaginationLg, bsltPaginationSm, bsltBreadcrumb);
12 |
13 | const
14 | aIWBSListType: array [bsltNone .. bsltBreadcrumb] of string = ('', 'dropdown-menu', 'list-group',
15 | 'list-inline', 'nav navbar-nav', 'pager', 'pagination', 'pagination pagination-lg',
16 | 'pagination pagination-sm', 'breadcrumb');
17 |
18 | type
19 | TDWList = class(TDWCustomRegion)
20 | private
21 | FListType: TIWBSListType;
22 | procedure SetListType(const Value: TIWBSListType);
23 | protected
24 | procedure InternalRenderCss(var ACss: string); override;
25 | procedure SetParent(AParent: TWinControl); override;
26 | public
27 | constructor Create(AOwner: TComponent); override;
28 |
29 | class procedure WrapItem(AControl: TDWControl; var AHTMLTag: TDWElementTag);
30 | published
31 | property BSListType: TIWBSListType read FListType write SetListType default bsltNone;
32 | end;
33 |
34 | implementation
35 |
36 | uses
37 | DW.VCL.Common, DW.VCL.NavBar, DW.VCL.Region, DWTypes;
38 |
39 | constructor TDWList.Create(AOwner: TComponent);
40 | begin
41 | inherited;
42 | FTagName := 'ul';
43 | end;
44 |
45 | procedure TDWList.InternalRenderCss(var ACss: string);
46 | begin
47 | TDWBSCommon.AddCssClass(ACss, aIWBSListType[FListType]);
48 | inherited;
49 | end;
50 |
51 | procedure TDWList.SetListType(const Value: TIWBSListType);
52 | begin
53 | if Parent is TDWNavBarBase then
54 | FListType := bsltNav
55 | else
56 | FListType := Value;
57 | Invalidate;
58 | end;
59 |
60 | procedure TDWList.SetParent(AParent: TWinControl);
61 | begin
62 | inherited;
63 | if (AParent is TDWNavBarBase) then
64 | FListType := bsltNav
65 | else if (AParent is TDWRegion) and (TDWRegion(Parent).BSRegionType = bsrtDropDown) then
66 | FListType := bsltDropDownMenu;
67 | end;
68 |
69 | class procedure TDWList.WrapItem(AControl: TDWControl; var AHTMLTag: TDWElementTag);
70 | var
71 | xHTMLTag: TDWElementTag;
72 | begin
73 | if AControl.Parent is TDWList then
74 | begin
75 | xHTMLTag := TDWElementTag.CreateHTMLTag('li');
76 |
77 | case TDWList(AControl.Parent).BSListType of
78 | bsltGroup:
79 | xHTMLTag.AddClassParam('list-group-item');
80 | end;
81 |
82 | xHTMLTag.Contents.AddElemetAsObject(AHTMLTag);
83 | AHTMLTag := xHTMLTag;
84 | end;
85 | end;
86 |
87 | end.
88 |
--------------------------------------------------------------------------------
/DW.VCL.Modal.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Modal;
2 |
3 | interface
4 |
5 | uses
6 | SysUtils, Classes, Controls, StrUtils, DW.VCL.CustomRegion, DWTypes, DWElementTag;
7 |
8 | type
9 | TDWModal = class(TDWCustomRegion)
10 | private
11 | FWrapperSuffix: string;
12 | FDestroyOnHide: boolean;
13 | FDialogSize: TDWSize;
14 | FFade: boolean;
15 | FModalVisible: boolean;
16 | FOnAsyncShow: TDWAsyncProcedure;
17 | FOnAsyncHide: TDWAsyncProcedure;
18 | protected
19 | function GetShowScript: string;
20 | function GetHideScript: string;
21 | procedure SetModalVisible(AValue: boolean);
22 | procedure DoOnAsyncShow(AParams: TStringList); virtual;
23 | procedure DoOnAsyncHide(AParams: TStringList); virtual;
24 | procedure InternalRenderCss(var ACss: string); override;
25 | procedure InternalRenderScript(const AHTMLName: string; AScript: TStringList); override;
26 | public
27 | constructor Create(AOwner: TComponent); override;
28 | destructor Destroy; override;
29 | function GetRoleString: string; override;
30 | function RenderHTML: TDWElementTag; override;
31 | published
32 | property BSFade: boolean read FFade write FFade default false;
33 | property BSDialogSize: TDWSize read FDialogSize write FDialogSize default bsszDefault;
34 | property ModalVisible: boolean read FModalVisible write SetModalVisible default false;
35 | property DestroyOnHide: boolean read FDestroyOnHide write FDestroyOnHide default false;
36 | property OnAsyncShow: TDWAsyncProcedure read FOnAsyncShow write FOnAsyncShow;
37 | property OnAsyncHide: TDWAsyncProcedure read FOnAsyncHide write FOnAsyncHide;
38 | end;
39 |
40 | implementation
41 |
42 | uses
43 | DW.VCL.Common, DWUtils;
44 |
45 | constructor TDWModal.Create(AOwner: TComponent);
46 | begin
47 | inherited;
48 | FDestroyOnHide := false;
49 | FDialogSize := bsszDefault;
50 | FFade := false;
51 | FModalVisible := false;
52 | FWrapperSuffix := '_wrp';
53 | end;
54 |
55 | destructor TDWModal.Destroy;
56 | begin
57 | SetModalVisible(false);
58 | inherited;
59 | end;
60 |
61 | procedure TDWModal.InternalRenderCss(var ACss: string);
62 | begin
63 | TDWBSCommon.AddCssClass(ACss, 'modal-dialog');
64 | if FDialogSize in [bsszLg, bsszSm] then
65 | TDWBSCommon.AddCssClass(ACss, 'modal-' + aDWSize[FDialogSize]);
66 | inherited;
67 | end;
68 |
69 | function TDWModal.GetRoleString: string;
70 | begin
71 | Result := 'dialog';
72 | end;
73 |
74 | function TDWModal.GetShowScript: string;
75 | begin
76 | Result := '$("#' + HTMLName + FWrapperSuffix +
77 | '").modal({backdrop: "static", "keyboard": true});';
78 | end;
79 |
80 | function TDWModal.GetHideScript: string;
81 | begin
82 | Result := '$("#' + HTMLName + FWrapperSuffix + '").modal("hide");';
83 | end;
84 |
85 | procedure TDWModal.InternalRenderScript(const AHTMLName: string; AScript: TStringList);
86 | var
87 | LCallBackName: string;
88 | begin
89 | AScript.Add('$("#' + AHTMLName + FWrapperSuffix +
90 | '").off("shown.bs.modal").on("shown.bs.modal", function() { var elem; elem = $(this).find("[autofocus]"); if (elem.length !== 0) {elem.focus();} else {$(this).find("button:last").focus(); } });');
91 | if Assigned(FOnAsyncShow) then
92 | begin
93 | // AScript.Add('$("#'+AHTMLName+FWrapperSuffix+'").off("show.bs.modal").on("show.bs.modal", function(e){ executeAjaxEvent("", null, "'+AHTMLName+'.DoOnAsyncShow", true, null, true); });');
94 | // DWApplication.RegisterCallBack(Self, ae_show, DoOnAsyncShow);
95 |
96 | LCallBackName := DWApplication.RegisterCallBack(self, ae_click, DoOnAsyncShow);
97 | AScript.Add('$("#' + AHTMLName + FWrapperSuffix +
98 | '").off("show.bs.modal").on("show.bs.modal", ' + 'function (e) {' +
99 | 'executeAjaxCallBack("", ' + JQSelector + '[0], "' + LCallBackName + '");' + '})');
100 | end;
101 | // AScript.Add('$("#'+AHTMLName+FWrapperSuffix+'").off("hidden.bs.modal").on("hidden.bs.modal", function(e){ executeAjaxEvent("", null, "'+AHTMLName+'.DoOnAsyncHide", true, null, true); });');
102 | // AContext.WebApplication.RegisterCallBack(AHTMLName+'.DoOnAsyncHide', DoOnAsyncHide);
103 | LCallBackName := DWApplication.RegisterCallBack(self, ae_hidden_bs_modal, DoOnAsyncHide);
104 | AScript.Add('$("#' + AHTMLName + FWrapperSuffix +
105 | '").off("hidden.bs.modal").on("hidden.bs.modal", ' + 'function (e) {' +
106 | 'executeAjaxCallBack("", ' + JQSelector + '[0], "' + LCallBackName + '");' + '})');
107 |
108 | if FModalVisible then
109 | AScript.Add(GetShowScript);
110 | inherited;
111 | end;
112 |
113 | function TDWModal.RenderHTML: TDWElementTag;
114 | var
115 | lCss: string;
116 | begin
117 | Result := inherited;
118 |
119 | FMainID := HTMLName + FWrapperSuffix;
120 |
121 | Result := TDWElementTag.CreateHTMLTag('div');
122 | Result.Contents.AddElemetAsObject(FRegionDiv);
123 | Result.AddStringParam('id', FMainID);
124 | lCss := 'modal';
125 | if FFade then
126 | TDWBSCommon.AddCssClass(lCss, 'fade');
127 | Result.AddClassParam(lCss);
128 | end;
129 |
130 | procedure TDWModal.SetModalVisible(AValue: boolean);
131 | begin
132 | if AValue <> FModalVisible then
133 | begin
134 | if not(csDesigning in ComponentState) and not(csLoading in ComponentState) then
135 | if AValue then
136 | DWApplication.CallBackResp.AddScriptToExecute(GetShowScript, True)
137 | else
138 | DWApplication.CallBackResp.AddScriptToExecute(GetHideScript, True);
139 | FModalVisible := AValue;
140 | end;
141 | end;
142 |
143 | procedure TDWModal.DoOnAsyncShow(AParams: TStringList);
144 | begin
145 | FOnAsyncShow(self, AParams);
146 | end;
147 |
148 | procedure TDWModal.DoOnAsyncHide(AParams: TStringList);
149 | begin
150 | FModalVisible := false;
151 | if Assigned(FOnAsyncHide) then
152 | FOnAsyncHide(self, AParams);
153 | if FDestroyOnHide then
154 | begin
155 | AsyncRemoveControl;
156 | Release;
157 | end;
158 | end;
159 |
160 | end.
161 |
--------------------------------------------------------------------------------
/DW.VCL.NavBar.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.NavBar;
2 |
3 | interface
4 |
5 | uses
6 | SysUtils, Classes, StrUtils, DW.VCL.CustomRegion, DWElementTag;
7 |
8 | type
9 |
10 | TDWNavBarFixed = (bsnvfxNone, bsnvfxTop, bsnvfxBottom);
11 |
12 | TDWNavBarBase = class(TDWCustomRegion);
13 |
14 | TDWNavBar = class(TDWNavBarBase)
15 | private
16 | FFluid: boolean;
17 | FFixed: TDWNavBarFixed;
18 | FInverse: boolean;
19 | protected
20 | procedure InternalRenderCss(var ACss: string); override;
21 | public
22 | constructor Create(AOwner: TComponent); override;
23 | function RenderHTML: TDWElementTag; override;
24 | published
25 | property BSFluid: boolean read FFluid write FFluid default False;
26 | property BSInverse: boolean read FInverse write FInverse default False;
27 | property BSFixed: TDWNavBarFixed read FFixed write FFixed default bsnvfxNone;
28 | end;
29 |
30 | TDWNavBarHeader = class(TDWNavBarBase)
31 | protected
32 | procedure InternalRenderCss(var ACss: string); override;
33 | end;
34 |
35 | TDWNavBarCollapse = class(TDWNavBarBase)
36 | protected
37 | procedure InternalRenderCss(var ACss: string); override;
38 | end;
39 |
40 | implementation
41 |
42 | uses
43 | DW.VCL.Common, DWUtils;
44 |
45 | { TDWNavBar }
46 |
47 | constructor TDWNavBar.Create(AOwner: TComponent);
48 | begin
49 | inherited;
50 | FFluid := False;
51 | FFixed := bsnvfxNone;
52 | FInverse := False;
53 | FTagName := 'nav';
54 | end;
55 |
56 | procedure TDWNavBar.InternalRenderCss(var ACss: string);
57 | begin
58 | TDWBSCommon.AddCssClass(ACss, 'navbar navbar-' + iif(FInverse, 'inverse', 'default'));
59 | if FFixed = bsnvfxTop then
60 | TDWBSCommon.AddCssClass(ACss, 'navbar-fixed-top')
61 | else if FFixed = bsnvfxBottom then
62 | TDWBSCommon.AddCssClass(ACss, ' navbar-fixed-bottom');
63 | inherited;
64 | end;
65 |
66 | function TDWNavBar.RenderHTML: TDWElementTag;
67 | begin
68 | Result := Inherited;
69 |
70 | FRegionDiv := Result.Contents.AddElement('div');
71 | FRegionDiv.AddClassParam('container' + iif(FFluid, '-fluid', ''));
72 | end;
73 |
74 | { TDWNavBarHeader }
75 |
76 | procedure TDWNavBarHeader.InternalRenderCss(var ACss: string);
77 | begin
78 | TDWBSCommon.AddCssClass(ACss, 'navbar-header');
79 | inherited;
80 | end;
81 |
82 | { TDWNavBarCollapse }
83 |
84 | procedure TDWNavBarCollapse.InternalRenderCss(var ACss: string);
85 | begin
86 | TDWBSCommon.AddCssClass(ACss, 'navbar-collapse');
87 | TDWBSCommon.AddCssClass(ACss, 'collapse');
88 | inherited;
89 | end;
90 |
91 | end.
92 |
--------------------------------------------------------------------------------
/DW.VCL.Region.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.Region;
2 |
3 | interface
4 |
5 | uses
6 | Classes, DW.VCL.CustomRegion, DW.VCL.Common, DWTypes;
7 |
8 | type
9 | TDWRegion = class(TDWCustomRegion)
10 | private
11 | FBackground: TDWRegionBack;
12 | FRegionType: TDWRegionType;
13 | FTagType: TDWRegionTagType;
14 | procedure SetRegionType(AValue: TDWRegionType);
15 | procedure SetBackground(AValue: TDWRegionBack);
16 | procedure SetTagType(const Value: TDWRegionTagType);
17 | protected
18 | procedure InternalRenderCss(var ACss: string); override;
19 | public
20 | function GetRoleString: string; override;
21 | published
22 | property BSBackground: TDWRegionBack read FBackground write SetBackground default bsrbDefault;
23 | property BSRegionType: TDWRegionType read FRegionType write SetRegionType default bsrtNone;
24 | property TagType: TDWRegionTagType read FTagType write SetTagType default bsttDiv;
25 | end;
26 |
27 | implementation
28 |
29 | uses DW.VCL.NavBar;
30 |
31 | procedure TDWRegion.InternalRenderCss(var ACss: string);
32 | begin
33 | TDWBSCommon.AddCssClass(ACss, aDWRegionType[FRegionType]);
34 |
35 | if (FRegionType = bsrtPanel) then
36 | TDWBSCommon.AddCssClass(ACss, 'panel-' + aDWRegionBack[FBackground])
37 | else if (FRegionType in [bsrtWell, bsrtWellLarge, bsrtWellSmall]) and (FBackground <> bsrbDefault)
38 | then
39 | TDWBSCommon.AddCssClass(ACss, 'well-' + aDWRegionBack[FBackground])
40 | else if (FBackground <> bsrbDefault) then
41 | TDWBSCommon.AddCssClass(ACss, 'bg-' + aDWRegionBack[FBackground])
42 | else if (Parent is TDWNavBar) then
43 | if TagType = bsttDiv then
44 | TDWBSCommon.AddCssClass(ACss, 'navbar-btn')
45 | else
46 | TDWBSCommon.AddCssClass(ACss, 'navbar-text');
47 |
48 | inherited;
49 | end;
50 |
51 | function TDWRegion.GetRoleString: string;
52 | begin
53 | if FRegionType = bsrtButtonToolbar then
54 | Result := 'toolbar'
55 | else
56 | Result := '';
57 | end;
58 |
59 | procedure TDWRegion.SetRegionType(AValue: TDWRegionType);
60 | begin
61 | FRegionType := AValue;
62 | Invalidate;
63 | end;
64 |
65 | procedure TDWRegion.SetTagType(const Value: TDWRegionTagType);
66 | begin
67 | FTagType := Value;
68 | FTagName := aDWRegionTagType[Value];
69 | AsyncRefreshControl;
70 | end;
71 |
72 | procedure TDWRegion.SetBackground(AValue: TDWRegionBack);
73 | begin
74 | FBackground := AValue;
75 | Invalidate;
76 | end;
77 |
78 | end.
79 |
--------------------------------------------------------------------------------
/DW.VCL.ScriptEvents.pas:
--------------------------------------------------------------------------------
1 | { *******************************************************************************
2 | DW.VCL(Delphi Web Visual Component Library) is Based on
3 | IWBootsTrap Framework : http://kattunga.github.io/IWBootstrapFramework/
4 |
5 | Delphi Web is
6 | Developped by Delcio Sbeghen @ SRP Sistemas
7 | delcio @ eavnet.com.br (remove spaces)
8 | and Colaborators
9 | under MIT Licence
10 | }
11 |
12 | unit DW.VCL.ScriptEvents;
13 |
14 | interface
15 |
16 | uses Classes, System.SysUtils, System.StrUtils, DWTypes;
17 |
18 | type
19 |
20 | // This class permit to add JavaScript to execute when events occurs in Browser
21 | TDWScriptEvent = class(TCollectionItem)
22 | private
23 | // type of Event, see Unit DWTypes
24 | FEventType: TDWAsyncEventType;
25 | // JavaScript to Execute
26 | FJavaScriptCode: TStringList;
27 | procedure SetJavaScriptCode(const Value: TStringList);
28 | protected
29 | // Only for Delphi Object Inspector display name of this
30 | function GetDisplayName: string; override;
31 | public
32 | constructor Create(Collection: TCollection; aEventType: TDWAsyncEventType); reintroduce;
33 | destructor Destroy; override;
34 | procedure Assign(Source: TPersistent); override;
35 | // Return the javascript code
36 | function GetScript(ASemiColon: boolean = True): string;
37 | // Return name of Event
38 | function EventName: string;
39 | published
40 | // type of Event, see Unit DWTypes
41 | property EventType: TDWAsyncEventType read FEventType write FEventType;
42 | // JavaScript to Execute on Browser
43 | property JavaScriptCode: TStringList read FJavaScriptCode write SetJavaScriptCode;
44 | end;
45 |
46 | TDWScriptEvents = class(TOwnedCollection)
47 | private
48 | function GetItems(I: Integer): TDWScriptEvent;
49 | procedure SetItems(I: Integer; const Value: TDWScriptEvent);
50 | public
51 | constructor Create(AOwner: TPersistent);
52 | function ByName(const AEventName: string): TDWScriptEvent;
53 | property Items[I: Integer]: TDWScriptEvent read GetItems write SetItems; default;
54 | end;
55 |
56 | implementation
57 |
58 | { TDWScriptEvent }
59 |
60 | procedure TDWScriptEvent.Assign(Source: TPersistent);
61 | begin
62 | if Source is TDWScriptEvent then
63 | begin
64 | Self.FEventType := (Source as TDWScriptEvent).FEventType;
65 | Self.FJavaScriptCode := (Source as TDWScriptEvent).FJavaScriptCode;
66 | end
67 | else
68 | inherited;
69 | end;
70 |
71 | constructor TDWScriptEvent.Create(Collection: TCollection; aEventType: TDWAsyncEventType);
72 | begin
73 | inherited Create(Collection);
74 | FJavaScriptCode.Create;
75 | end;
76 |
77 | destructor TDWScriptEvent.Destroy;
78 | begin
79 | FJavaScriptCode.Free;
80 | inherited;
81 | end;
82 |
83 | function TDWScriptEvent.EventName: string;
84 | begin
85 | Result := AsyncEventTypeToName(FEventType);
86 | end;
87 |
88 | function TDWScriptEvent.GetDisplayName: string;
89 | begin
90 | Result := EventName;
91 | if Result = '' then
92 | Result := inherited GetDisplayName;
93 | end;
94 |
95 | function TDWScriptEvent.GetScript(ASemiColon: boolean): string;
96 | begin
97 | Result := FJavaScriptCode.Text;
98 | if ASemiColon then
99 | Result := Result + ';';
100 | end;
101 |
102 | procedure TDWScriptEvent.SetJavaScriptCode(const Value: TStringList);
103 | begin
104 | FJavaScriptCode := Value;
105 | end;
106 |
107 | { TDWAsyncEvents }
108 |
109 | function TDWScriptEvents.ByName(const AEventName: string): TDWScriptEvent;
110 | var
111 | I: Integer;
112 | begin
113 | Result := nil;
114 | for I := 0 to Count - 1 do
115 | begin
116 | if SameText(Items[I].EventName, AEventName) then
117 | begin
118 | Result := Items[I];
119 | Break;
120 | end;
121 | end;
122 | end;
123 |
124 | constructor TDWScriptEvents.Create(AOwner: TPersistent);
125 | begin
126 | inherited Create(AOwner, TDWScriptEvent);
127 | end;
128 |
129 | function TDWScriptEvents.GetItems(I: Integer): TDWScriptEvent;
130 | begin
131 | Result := TDWScriptEvent(inherited Items[I]);
132 | end;
133 |
134 | procedure TDWScriptEvents.SetItems(I: Integer; const Value: TDWScriptEvent);
135 | begin
136 | inherited SetItem(I, Value);
137 | end;
138 |
139 | end.
140 |
--------------------------------------------------------------------------------
/DW.VCL.ScriptParams.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.ScriptParams;
2 |
3 | interface
4 |
5 | uses Classes, DW.JSON.JsonData;
6 |
7 | type
8 |
9 | TDWScriptParams = class(TStringList)
10 | private
11 | function GetJson(const Name: string): TJsonObject;
12 | procedure SetJson(const Name: string; const Value: TJsonObject);
13 | public
14 | constructor Create;
15 | property JSON[const Name: string]: TJsonObject read GetJson write SetJson;
16 | end;
17 |
18 | implementation
19 |
20 | constructor TDWScriptParams.Create;
21 | begin
22 | inherited;
23 | Duplicates := dupError;
24 | OwnsObjects := True;
25 | end;
26 |
27 | function TDWScriptParams.GetJson(const Name: string): TJsonObject;
28 | var
29 | i: integer;
30 | begin
31 | i := IndexOf(Name);
32 | if i < 0 then
33 | begin
34 | Result := TJsonObject.Create;
35 | AddObject(Name, Result);
36 | end
37 | else if Objects[i] = nil then
38 | begin
39 | Result := TJsonObject.Create;
40 | Objects[i] := Result;
41 | end
42 | else
43 | Result := TJsonObject(Objects[i]);
44 | end;
45 |
46 | procedure TDWScriptParams.SetJson(const Name: string; const Value: TJsonObject);
47 | begin
48 | JSON[Name].Assign(Value);
49 | end;
50 |
51 | end.
52 |
--------------------------------------------------------------------------------
/DW.VCL.Select2.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DW.VCL.Select2.pas
--------------------------------------------------------------------------------
/DW.VCL.StyleRenderOptions.pas:
--------------------------------------------------------------------------------
1 | unit DW.VCL.StyleRenderOptions;
2 |
3 | interface
4 |
5 | uses Classes;
6 |
7 | type
8 |
9 | TDWRenderOptions = class(TComponent)
10 | protected
11 | FRenderOptions: array [0 .. 9] of Boolean;
12 | procedure SetRenderOptions(Index: Integer; const Value: Boolean);
13 | public
14 | constructor Create(AOwner: TComponent); override;
15 | procedure Assign(Source: TPersistent); override;
16 | published
17 | property RenderSize: Boolean index 0 read FRenderOptions[0] write SetRenderOptions
18 | default False;
19 | property RenderPosition: Boolean index 1 read FRenderOptions[1] write SetRenderOptions
20 | default False;
21 | property RenderFont: Boolean index 2 read FRenderOptions[2] write SetRenderOptions
22 | default False;
23 | property RenderZIndex: Boolean index 3 read FRenderOptions[3] write SetRenderOptions
24 | default False;
25 | property RenderVisibility: Boolean index 4 read FRenderOptions[4] write SetRenderOptions
26 | default False;
27 | property RenderStatus: Boolean index 5 read FRenderOptions[5] write SetRenderOptions
28 | default False;
29 | property RenderAbsolute: Boolean index 6 read FRenderOptions[6] write SetRenderOptions
30 | default False;
31 | property RenderPadding: Boolean index 7 read FRenderOptions[7] write SetRenderOptions
32 | default False;
33 | property RenderBorder: Boolean index 8 read FRenderOptions[8] write SetRenderOptions
34 | default False;
35 | property UseDisplay: Boolean index 9 read FRenderOptions[9] write SetRenderOptions
36 | default False;
37 | end;
38 |
39 | implementation
40 |
41 | uses DW.VCL.Control;
42 |
43 | { TDWRenderOptions }
44 |
45 | procedure TDWRenderOptions.Assign(Source: TPersistent);
46 | begin
47 | inherited;
48 |
49 | end;
50 |
51 | constructor TDWRenderOptions.Create(AOwner: TComponent);
52 | begin
53 | inherited;
54 |
55 | end;
56 |
57 | procedure TDWRenderOptions.SetRenderOptions(Index: Integer; const Value: Boolean);
58 | begin
59 | if FRenderOptions[Index] <> Value then
60 | begin
61 | FRenderOptions[Index] := Value;
62 | TDWControl(Owner).Invalidate;
63 | end;
64 | end;
65 |
66 | end.
67 |
--------------------------------------------------------------------------------
/DW.XHR.CallBackResp.pas:
--------------------------------------------------------------------------------
1 | unit DW.XHR.CallBackResp;
2 |
3 | interface
4 |
5 | uses Classes, DWElementTag;
6 |
7 | type
8 | TDWXhrCallbackResp = class
9 | FDWApplication: TObject;
10 | FExecuteFirstTag: TDWElementXHTMLTag;
11 | FUpdateTag: TDWElementXHTMLTag;
12 | FExecuteTag: TDWElementXHTMLTag;
13 | public
14 | constructor Create(aDWApplication: TObject);
15 | destructor Destroy; override;
16 | procedure Clear;
17 | function Render: string;
18 | procedure AddScriptToExecute(aScript: string; AsCDATA: Boolean = True);
19 | procedure AddScriptToUpdate(aScript: string; AsCDATA: Boolean = True);
20 | procedure AddScriptToExecuteFirst(aScript: string; AsCDATA: Boolean = True);
21 |
22 | end;
23 |
24 | implementation
25 |
26 | uses DW.CORE.DWApplication, DWUtils;
27 |
28 | { TDWXhrCallbackResp }
29 |
30 | procedure TDWXhrCallbackResp.AddScriptToExecute(aScript: string; AsCDATA: Boolean);
31 | var
32 | LTag: TDWElementXHTMLTag;
33 | begin
34 | if not DWApplication.IsCallBack then
35 | Exit;
36 | LTag := TDWElementXHTMLTag.CreateHTMLTag('item', FExecuteTag, AsCDATA);
37 | LTag.Contents.AddText(aScript);
38 | FExecuteTag.Contents.AddElemetAsObject(LTag, True);
39 | end;
40 |
41 | procedure TDWXhrCallbackResp.AddScriptToExecuteFirst(aScript: string; AsCDATA: Boolean);
42 | var
43 | LTag: TDWElementXHTMLTag;
44 | begin
45 | if not DWApplication.IsCallBack then
46 | Exit;
47 | LTag := TDWElementXHTMLTag.CreateHTMLTag('item', FExecuteFirstTag, AsCDATA);
48 | LTag.Contents.AddText(aScript);
49 | FExecuteFirstTag.Contents.AddElemetAsObject(LTag, True);
50 | end;
51 |
52 | procedure TDWXhrCallbackResp.AddScriptToUpdate(aScript: string; AsCDATA: Boolean);
53 | var
54 | LTag: TDWElementXHTMLTag;
55 | begin
56 | if not DWApplication.IsCallBack then
57 | Exit;
58 | LTag := TDWElementXHTMLTag.CreateHTMLTag('item', FUpdateTag, AsCDATA);
59 | LTag.Contents.AddText(aScript);
60 | FUpdateTag.Contents.AddElemetAsObject(LTag, True);
61 | end;
62 |
63 | procedure TDWXhrCallbackResp.Clear;
64 | begin
65 | FExecuteFirstTag.Clear;
66 | FUpdateTag.Clear;
67 | FExecuteTag.Clear;
68 | end;
69 |
70 | constructor TDWXhrCallbackResp.Create(aDWApplication: TObject);
71 | begin
72 | inherited Create;
73 | FDWApplication := aDWApplication;
74 | FExecuteFirstTag := TDWElementXHTMLTag.CreateHTMLTag('executefirst', nil, False);
75 | FUpdateTag := TDWElementXHTMLTag.CreateHTMLTag('update', nil, False);
76 | FExecuteTag := TDWElementXHTMLTag.CreateHTMLTag('execute', nil, False);
77 | end;
78 |
79 | destructor TDWXhrCallbackResp.Destroy;
80 | begin
81 | FExecuteFirstTag.Free;
82 | FUpdateTag.Free;
83 | FExecuteTag.Free;
84 | inherited;
85 | end;
86 |
87 | function TDWXhrCallbackResp.Render: string;
88 | begin
89 | { TODO 1 -oDELCIO -cVERIFY : check if Windows-1252 cause problems. I'm used this to avoid UTF8 encode(speed) }
90 | Result := '';
91 | Result := Result + FExecuteFirstTag.Render;
92 | Result := Result + FUpdateTag.Render;
93 | Result := Result + FExecuteTag.Render;
94 | Result := Result + '';
95 | // Result:= UTF8Encode(Result);
96 | end;
97 |
98 | end.
99 |
--------------------------------------------------------------------------------
/DWCallbacks.pas:
--------------------------------------------------------------------------------
1 | unit DWCallbacks;
2 |
3 | interface
4 |
5 | uses Classes, System.SysUtils, DWTypes;
6 |
7 | type
8 |
9 | // This Object represent one CallBack to be Handled in UserSession
10 | // on receive one POST CallBack
11 | TDWCallback = class(TObject)
12 | private
13 | protected
14 | // type of event, see DWTypes --> TDWAsyncEventType
15 | FEventType: TDWAsyncEventType;
16 | // if EventType = none, FEventName is used to compound QualifiedName;
17 | FEventName: string;
18 | // Control that will originate Callback
19 | FControl: TObject;
20 | // UserSession owner for this CallBack
21 | FSession: TObject;
22 | { Procedure to execute in Form on CallBack
23 | Note that for all callback is first called the TDWForm.ExecuteCallback method,
24 | and only then, TDWForm.ExecuteCallback event call the procedure FCallBackProc.
25 | The procedure FCallBackProc represent the DWComponent Internal Event Procedure
26 | DoOnxxxxx and this Internal Event Procedure call FOnxxxx
27 | Ex: When TDWForm.TDWEDIT Async Change Event is received on server, this is processed in
28 | this order:
29 | 1- TDWHttpServer.TriggerPostDocument (All POSTs is Handled here)
30 | 2- TDWHttpServer.PostDispatchCallback (All Callbacks is Handled here)
31 | 3- TDWForm.ExecuteCallBack (The browser changed components are updated in Form)
32 | 4- TDWEDIT.DoOnAsyncChange (internal Component code is executed)
33 | 5- TDWEDIT.FOnAsyncChange (OnAsyncChange is called and user defined code is executed) }
34 | FCallBackProc: TDWCallbackProcedure;
35 | public
36 | constructor Create(ASession: TObject; aControl: TObject; AType: TDWAsyncEventType;
37 | ACallbackProcedure: TDWCallbackProcedure); overload;
38 | constructor Create(ASession: TObject; aControl: TObject; aName: string;
39 | ACallbackProcedure: TDWCallbackProcedure); overload;
40 | destructor Destroy; override;
41 | // Return the type of event in string, ex: 'change'
42 | function TypeName: String;
43 | // Return the Qualified Name of Callback in format FormName.ControlName.EventName
44 | // if Form is nil return NIL.ControlName.EventName
45 | // if Control is nil return NIL.NIL.EventName
46 | function QualifiedName: string;
47 | // Return the CallBack procedure to be executted in this callBack
48 | property CallBackProcedure: TDWCallbackProcedure read FCallBackProc write FCallBackProc;
49 | end;
50 |
51 | // This Object mantain one list of CallBacks registered for the UserSession
52 | TDWCallBacks = class(TStringList)
53 | protected
54 | FSession: TObject;
55 | property OwnsObjects; // Hide Property OwnsObjects to avoid change
56 | public
57 | constructor Create(ASession: TObject);
58 | // Add one Callback to List and return QualifiedName
59 | function RegisterCallBack(aControl: TObject; AType: TDWAsyncEventType;
60 | ACallbackProcedure: TDWCallbackProcedure): string; overload;
61 | // Add one Callback for Custom Event to List and return QualifiedName
62 | function RegisterCallBack(aControl: TObject; aName: string;
63 | ACallbackProcedure: TDWCallbackProcedure): string; overload;
64 | // Remove One CallBack of List
65 | procedure UnregisterCallBack(const AQualifiedName: String);
66 | // Get the Callback index from Callback Qualified Name
67 | // aQualifiedName is in format(FormName.ControlName.EventTypeName)
68 | function FindCallback(const AQualifiedName: String): Integer;
69 |
70 | end;
71 |
72 | implementation
73 |
74 | uses DW.VCL.Control;
75 |
76 | { TDWCallback }
77 |
78 | constructor TDWCallback.Create(ASession: TObject; aControl: TObject; AType: TDWAsyncEventType;
79 | ACallbackProcedure: TDWCallbackProcedure);
80 | begin
81 | inherited Create;
82 | FSession := ASession;
83 | FControl := aControl;
84 | FEventType := AType;
85 | FCallBackProc := ACallbackProcedure;
86 | end;
87 |
88 | constructor TDWCallback.Create(ASession, aControl: TObject; aName: string;
89 | ACallbackProcedure: TDWCallbackProcedure);
90 | begin
91 | Create(ASession, aControl, ae_none, ACallbackProcedure);
92 | FEventName := aName;
93 | end;
94 |
95 | destructor TDWCallback.Destroy;
96 | begin
97 |
98 | inherited;
99 | end;
100 |
101 | function TDWCallback.QualifiedName: string;
102 | begin
103 | if FEventType = ae_none then
104 | Result := TDWControl(FControl).Form.Name + '.' + TDWControl(FControl).Name + '.' + FEventName
105 | else
106 | Result := TDWControl(FControl).Form.Name + '.' + TDWControl(FControl).Name + '.' + TypeName;
107 | { TODO 1 -oDELCIO -cIMPLEMENT : TDWCallback.QualifiedName in format described }
108 | // Return the Qualified Name of Callback in format FormName.ControlName.EventName
109 | // if Form is nil return NIL.ControlName.EventName
110 | // if Control is nil return NIL.NIL.EventName
111 |
112 | end;
113 |
114 | function TDWCallback.TypeName: String;
115 | begin
116 | Result := AsyncEventTypeToName(FEventType);
117 | end;
118 |
119 | { TDWCallBacks }
120 |
121 | constructor TDWCallBacks.Create(ASession: TObject);
122 | begin
123 | FSession := ASession;
124 | OwnsObjects := True;
125 | end;
126 |
127 | function TDWCallBacks.FindCallback(const AQualifiedName: String): Integer;
128 | var
129 | I: Integer;
130 | begin
131 | Result := -1;
132 | for I := 0 to Count - 1 do
133 | begin
134 | if (SameText((Objects[I] as TDWCallback).QualifiedName, AQualifiedName)) then
135 | Begin
136 | Result := I;
137 | Break;
138 | End
139 | end;
140 | end;
141 |
142 | function TDWCallBacks.RegisterCallBack(aControl: TObject; aName: string;
143 | ACallbackProcedure: TDWCallbackProcedure): string;
144 | var
145 | LCallback: TDWCallback;
146 | begin
147 | LCallback := TDWCallback.Create(Self.FSession, aControl, aName, ACallbackProcedure);
148 | AddObject(LCallback.QualifiedName, LCallback);
149 | Result := LCallback.QualifiedName;
150 | end;
151 |
152 | function TDWCallBacks.RegisterCallBack(aControl: TObject; AType: TDWAsyncEventType;
153 | ACallbackProcedure: TDWCallbackProcedure): string;
154 | var
155 | LCallback: TDWCallback;
156 | begin
157 | LCallback := TDWCallback.Create(Self.FSession, aControl, AType, ACallbackProcedure);
158 | AddObject(LCallback.QualifiedName, LCallback);
159 | Result := LCallback.QualifiedName;
160 | end;
161 |
162 | procedure TDWCallBacks.UnregisterCallBack(const AQualifiedName: String);
163 | var
164 | LIndex: Integer;
165 | begin
166 | LIndex := IndexOfName(AQualifiedName);
167 | if LIndex >= 0 then
168 | begin
169 | Delete(LIndex);
170 | // Not necessary Free because TDWCallBacks.OwnsObjects = True;
171 | end;
172 | end;
173 |
174 | end.
175 |
--------------------------------------------------------------------------------
/DWFiredacUtils.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DWFiredacUtils.pas
--------------------------------------------------------------------------------
/DWForm.pas:
--------------------------------------------------------------------------------
1 | unit DWForm;
2 |
3 | interface
4 |
5 | uses
6 | Winapi.Windows, dialogs, Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
7 | Vcl.Controls, Vcl.Forms, Vcl.StdCtrls, DW.Vcl.Control, DWElementTag, DW.HTML.Page,
8 | DWRenderStream, DWLayoutRender, DW.Vcl.CustomForm, DWCallbacks;
9 |
10 | type
11 | TDWFormClass = class of TDWForm;
12 |
13 | TDWForm = class(TdwCustomForm)
14 | private
15 | FLayoutRender: TDWLayoutRender;
16 | procedure SetLayoutRender(const Value: TDWLayoutRender);
17 | { Private declarations }
18 | protected
19 | // Hide non necessary propertys
20 | property Margins;
21 | property Left;
22 | property Top;
23 | property Hint;
24 | property HelpType;
25 | property HelpKeyword;
26 | property HelpContext;
27 | property CustomHint;
28 | property Cursor;
29 | property AlignWithMargins;
30 | property ParentCustomHint;
31 | public
32 | procedure ExecuteCallBack(aParams: TStringList; aCallBack: TDWCallBack); override;
33 | Function Render: TDWStream; override;
34 | published
35 | property LayoutRender: TDWLayoutRender read FLayoutRender write SetLayoutRender;
36 | end;
37 |
38 | implementation
39 |
40 | uses DW.Vcl.Interfaces;
41 |
42 |
43 | // {$R *.dfm}
44 |
45 | { TDWForm }
46 |
47 | type
48 | THrackRemoveThis = class(TDWInputControl);
49 |
50 | procedure TDWForm.ExecuteCallBack(aParams: TStringList; aCallBack: TDWCallBack);
51 | var
52 | C: Integer;
53 | L_IControl: IDWInput;
54 | begin
55 | // update Components values
56 | for C := 0 to ComponentCount - 1 do
57 | begin
58 | if (aParams.Values[Components[C].Name] <> '') and
59 | (Supports(Components[C], IDWInput, L_IControl)) and (L_IControl <> nil) then
60 | begin
61 | // update control value
62 | L_IControl.SetValue(aParams.Values[Components[C].Name]);
63 | // THrackRemoveThis(Components[C]).FOldText := TDWInputControl(Components[C]).Text;
64 | end;
65 | end;
66 |
67 | if Assigned(aCallBack.CallBackProcedure) then
68 | aCallBack.CallBackProcedure(aParams);
69 |
70 | FLayoutRender.ProcessFormAsync(Self);
71 |
72 | end;
73 |
74 | Function TDWForm.Render: TDWStream;
75 | begin
76 | inherited;
77 | if not Assigned(LayoutRender) then
78 | FLayoutRender := TDWLayoutRender.Create(Self);
79 | HTMLPage.Clear;
80 | FLayoutRender.ProcessForm(Self);
81 | (*
82 | for I := 0 to ComponentCount -1 do
83 | begin
84 | if Components[i].InheritsFrom(TDWControl) then
85 | begin
86 | Element:= (Components[i] as TDWControl).RenderHTML;
87 | Element.ParentElement:= HTMLPage.HTMLTag.BodyTag;
88 | end;
89 | end; *)
90 | Result := TDWStream.Create;
91 | Result.WriteString(HTMLPage.HTMLTag.Render);
92 | // Showmessage(HTMLPage.HTMLTag.Render);
93 | end;
94 |
95 | procedure TDWForm.SetLayoutRender(const Value: TDWLayoutRender);
96 | begin
97 | FLayoutRender := Value;
98 | end;
99 |
100 | end.
101 |
--------------------------------------------------------------------------------
/DWGlobal.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DWGlobal.pas
--------------------------------------------------------------------------------
/DWMarkupLinguageTag.pas:
--------------------------------------------------------------------------------
1 | unit DWMarkupLinguageTag;
2 |
3 | interface
4 |
5 | uses Classes, System.SysUtils, DWRenderStream;
6 |
7 | type
8 | TDWClosingTag = (ctdwAuto, ctdwFalse, ctdwTrue, ctdwSimpleClose);
9 |
10 | TDWCustomElement = class(TPersistent)
11 | private
12 | FParentElement: TDWCustomElement;
13 | FDestroying: System.Boolean;
14 | FChanged: Boolean;
15 | protected
16 | FClosingTag: TDWClosingTag;
17 | procedure SetParentElement(const Value: TDWCustomElement); virtual;
18 | procedure RenderElement(ABuffer: TDWStream; AIndent: Integer = 0); virtual;
19 | procedure InitializeElement(AParentElement: TDWCustomElement); virtual;
20 | public
21 | constructor Create(AParentElement: TDWCustomElement); virtual;
22 | destructor Destroy; override;
23 | procedure Assign(ASource: Classes.TPersistent); override;
24 | procedure Render(ABuffer: TDWStream); overload; virtual;
25 | function Render: String; overload; virtual;
26 | procedure Changed(aValue: Boolean = True); virtual;
27 | property Destroying: System.Boolean read FDestroying;
28 | property ParentElement: TDWCustomElement read FParentElement write SetParentElement;
29 | end;
30 |
31 | implementation
32 |
33 | { TDWMarkupLanguageElement }
34 |
35 | procedure TDWCustomElement.Assign(ASource: Classes.TPersistent);
36 | begin
37 | if ASource <> Self then
38 | begin
39 | inherited Assign(ASource);
40 | Changed;
41 | end;
42 | end;
43 |
44 | procedure TDWCustomElement.Changed(aValue: Boolean = True);
45 | begin
46 | FChanged := aValue;
47 | end;
48 |
49 | constructor TDWCustomElement.Create(AParentElement: TDWCustomElement);
50 | begin
51 | FChanged := True;
52 | FParentElement := AParentElement;
53 | end;
54 |
55 | destructor TDWCustomElement.Destroy;
56 | begin
57 |
58 | inherited;
59 | end;
60 |
61 | procedure TDWCustomElement.InitializeElement(AParentElement: TDWCustomElement);
62 | begin
63 | raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
64 | end;
65 |
66 | procedure TDWCustomElement.Render(ABuffer: TDWStream);
67 | begin
68 | raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
69 | end;
70 |
71 | function TDWCustomElement.Render: String;
72 | begin
73 | raise Exception.Create('Render not Implemented for TDWCustomElement, use descendant class');
74 | end;
75 |
76 | procedure TDWCustomElement.RenderElement(ABuffer: TDWStream; AIndent: Integer = 0);
77 | begin
78 | raise Exception.Create
79 | ('RenderElement not Implemented for TDWCustomElement, use descendant class');
80 | end;
81 |
82 | procedure TDWCustomElement.SetParentElement(const Value: TDWCustomElement);
83 | begin
84 | if FParentElement <> Value then
85 | begin
86 | FParentElement := Value;
87 | Changed;
88 | end;
89 | end;
90 |
91 | end.
92 |
--------------------------------------------------------------------------------
/DWRegister.pas:
--------------------------------------------------------------------------------
1 | unit DWRegister;
2 |
3 | interface
4 |
5 | uses
6 | Classes, Winapi.Windows, SysUtils, Dialogs, DesignEditors, DesignIntf,
7 | ToolsAPI, DMForm;
8 |
9 | type
10 |
11 | TDWFormModule = class(TCustomModule)
12 | public
13 | procedure ExecuteVerb(Index: Integer); override;
14 | function GetVerb(Index: Integer): string; override;
15 | function GetVerbCount: Integer; override;
16 | procedure ValidateComponent(Component: TComponent); override;
17 | function ValidateComponentClass(ComponentClass: TComponentClass): Boolean; override;
18 | end;
19 |
20 | TDWDatamoduleModule = class(TDataModuleCustomModule) // TDataModuleDesignerCustomModule)
21 | procedure ExecuteVerb(Index: Integer); override;
22 | function GetVerb(Index: Integer): string; override;
23 | function GetVerbCount: Integer; override;
24 | procedure ValidateComponent(Component: TComponent); override;
25 | end;
26 |
27 | procedure register;
28 |
29 | implementation
30 |
31 | uses DW.VCL.Control, DW.VCL.Labels, DW.CORE.Server, DW.VCL.Edit,
32 | DW.DESIGN.FormWizard, DW.DESIGN.AppWizard, DWForm, DW.VCL.Container,
33 | DW.HTML.Page, DW.CORE.UserSession, DW.VCL.DataModule, DW.VCL.Input,
34 | DW.VCL.Region, DW.VCL.Buttons, DW.VCL.Modal, DW.VCL.Accordion,
35 | DW.DESIGN.AccordionEditor, DW.VCL.TabControl, DW.DESIGN.TabControlEditor,
36 | DW.VCL.JQGrid, DW.VCL.FluidForm, DW.VCL.Table, DW.VCL.Iframe, DW.VCL.Validator,
37 | DW.VCL.InputMoney, DW.VCL.Select2, DW.VCL.Image, DW.DESIGN.FrameWizard,
38 | DW.VCL.Frame, DW.VCL.InputForm, DW.DESIGN.DataModuleWizard;
39 |
40 | procedure register;
41 | begin
42 | RegisterComponents('DelphiWeb', [TDWServer]);
43 | RegisterComponents('DelphiWeb', [TDWLabel]);
44 | RegisterComponents('DelphiWeb', [TDWEdit]);
45 | // Bootstrap Inputs
46 | RegisterComponents('DelphiWeb', [TDWInput]);
47 | RegisterComponents('DelphiWeb', [TDWMemo]);
48 | RegisterComponents('DelphiWeb', [TDWCheckBox]);
49 | RegisterComponents('DelphiWeb', [TDWRadioButton]);
50 | RegisterComponents('DelphiWeb', [TDWSelect]);
51 | RegisterComponents('DelphiWeb', [TDWRadioGroup]);
52 | RegisterComponents('DelphiWeb', [TDWInputMoney]);
53 | RegisterComponents('DelphiWeb', [TDWSelect2]);
54 | RegisterComponents('DelphiWeb', [TDWInputGroup]);
55 | // others
56 | RegisterComponents('DelphiWeb', [TDWButton]);
57 | RegisterComponents('DelphiWeb', [TDWModal]);
58 | RegisterComponents('DelphiWeb', [TDWAccordion]);
59 | RegisterComponentEditor(TDWAccordion, TDWAccordionEditor);
60 | RegisterComponents('DelphiWeb', [TDWTabControl]);
61 | RegisterComponentEditor(TDWTabControl, TDWTabControlEditor);
62 | RegisterComponents('DelphiWeb', [TDWJQGrid]);
63 | RegisterComponents('DelphiWeb', [TDWTable]);
64 | RegisterComponents('DelphiWeb', [TDWValidator]);
65 | RegisterComponents('DelphiWeb', [TDWImage]);
66 |
67 | // Bootstrap Regions
68 | RegisterComponents('DelphiWeb', [TDWRegion]);
69 | RegisterComponents('DelphiWeb', [TDWFluidForm]);
70 | RegisterComponents('DelphiWeb', [TDWIFrame]);
71 |
72 | // DelphiWeb Wizards
73 | RegisterCustomModule(TDWForm, TDWFormModule);
74 | RegisterCustomModule(TDWFrame, TDWFormModule);
75 | RegisterCustomModule(TDWUserSession, TDataModuleCustomModule);
76 | // UnlistPublishedProperty(TDWUserSession, 'OldCreateOrder');
77 | // UnlistPublishedProperty(TDWUserSession, 'OnCreate');
78 | // UnlistPublishedProperty(TDWUserSession, 'OnDestroy');
79 | RegisterCustomModule(TDWDatamodule, TDataModuleCustomModule);
80 | RegisterPackageWizard(TDWAppWizard.Create);
81 | RegisterPackageWizard(TDWFormWizard.Create);
82 | RegisterPackageWizard(TDWFrameWizard.Create);
83 | RegisterPackageWizard(TDWDataModuleWizard.Create);
84 | end;
85 |
86 | { TDWFormModule }
87 |
88 | procedure TDWFormModule.ExecuteVerb(Index: Integer);
89 | var
90 | NewName: string;
91 | begin
92 | if Index = 0 then
93 | begin
94 | NewName := Root.Name;
95 | if InputQuery('Panel Module Editor', 'New panel name:', NewName) then
96 | Root.Name := NewName;
97 | end;
98 |
99 | end;
100 |
101 | function TDWFormModule.GetVerb(Index: Integer): string;
102 | begin
103 | if Index = 0 then
104 | Result := 'Rename...';
105 | end;
106 |
107 | function TDWFormModule.GetVerbCount: Integer;
108 | begin
109 | Result := 1;
110 | end;
111 |
112 | procedure TDWFormModule.ValidateComponent(Component: TComponent);
113 | begin
114 | if (not Component.InheritsFrom(TDWControl)) and (not Component.InheritsFrom(TDWContainer)) then
115 | raise Exception.Create('The DWForm can host only DWControls');
116 | end;
117 |
118 | function TDWFormModule.ValidateComponentClass(ComponentClass: TComponentClass): Boolean;
119 | begin
120 | if ComponentClass.InheritsFrom(TDWContainer) or ComponentClass.InheritsFrom(TDWControl) then
121 | Result := True
122 | else
123 | Result := False;
124 | end;
125 |
126 | { TDWDatamodule }
127 |
128 | procedure TDWDatamoduleModule.ExecuteVerb(Index: Integer);
129 | begin
130 | inherited;
131 |
132 | end;
133 |
134 | function TDWDatamoduleModule.GetVerb(Index: Integer): string;
135 | begin
136 | Result := inherited;
137 | end;
138 |
139 | function TDWDatamoduleModule.GetVerbCount: Integer;
140 | begin
141 | Result := inherited;
142 | end;
143 |
144 | procedure TDWDatamoduleModule.ValidateComponent(Component: TComponent);
145 | begin
146 | inherited;
147 | end;
148 |
149 | end.
150 |
--------------------------------------------------------------------------------
/DWRenderStream.pas:
--------------------------------------------------------------------------------
1 | unit DWRenderStream;
2 |
3 | interface
4 |
5 | uses System.Classes;
6 |
7 | type
8 | TDWStream = class(TStringStream)
9 |
10 | end;
11 |
12 | implementation
13 |
14 | end.
15 |
--------------------------------------------------------------------------------
/DWUrlHandlerBase.pas:
--------------------------------------------------------------------------------
1 | unit DWUrlHandlerBase;
2 |
3 | interface
4 |
5 | uses
6 | {$IFDEF MSWINDOWS}
7 | Windows,
8 | {$ENDIF}
9 | Classes, SysUtils,
10 | OverbyteIcsMD5,
11 | OverbyteIcsUtils,
12 | DWTypes,
13 | OverbyteIcsHttpSrv;
14 |
15 | type
16 | TDWUrlHandlerClass = class of TDWUrlHandlerBase;
17 |
18 | TDWUrlHandlerBase = class(TComponent)
19 | private
20 |
21 | protected
22 | FClient: TObject;
23 | FFlags: THttpGetFlag;
24 | FMsg_WM_FINISH: UINT;
25 | FWndHandle: HWND;
26 | FMethod: TDWHttpMethod;
27 | FProcedure: Pointer;
28 | procedure ClientDestroying(Sender: TObject);
29 | public
30 | procedure Execute; virtual;
31 | procedure AnswerStream(const Status: String; const ContType: String; const Header: String);
32 | procedure AnswerString(const Status: String; const ContType: String; const Header: String;
33 | Body: string);
34 | procedure Finish;
35 |
36 | published
37 | property Client: TObject read FClient;
38 |
39 | end;
40 |
41 | const
42 | CRLF = #13#10;
43 |
44 | implementation
45 |
46 | uses DWUtils, DW.CORE.DWClientConnection;
47 |
48 | { TDWUrlHandlerBase }
49 |
50 | procedure TDWUrlHandlerBase.AnswerStream(const Status, ContType, Header: String);
51 | begin
52 | if Assigned(Client) then
53 | TDWClientConnection(Client).AnswerStream(FFlags, Status, ContType, Header);
54 | end;
55 |
56 | procedure TDWUrlHandlerBase.Execute;
57 | begin
58 | // Nothing to do here, just to allow overriden method
59 | end;
60 |
61 | procedure TDWUrlHandlerBase.Finish;
62 | begin
63 | // We need to destroy the server object, but we can't do it safely from
64 | // one of his methods. Delaying the detroy until all queued events are
65 | // processed is better. This is why we use an intermediate message.
66 | if (FWndHandle <> 0) and (FMsg_WM_FINISH > 0) then
67 | PostMessage(FWndHandle, FMsg_WM_FINISH, 0, LPARAM(Self));
68 | end;
69 |
70 | procedure TDWUrlHandlerBase.AnswerString(const Status, ContType, Header: String; Body: string);
71 | begin
72 | if Assigned(Client) then
73 | TDWClientConnection(Client).AnswerString(FFlags, Status, ContType, Header, Body);
74 | end;
75 |
76 | procedure TDWUrlHandlerBase.ClientDestroying(Sender: TObject);
77 | begin
78 | if FClient = Sender then
79 | FClient := nil;
80 | end;
81 |
82 | end.
83 |
--------------------------------------------------------------------------------
/DWUrlHandlerForms.pas:
--------------------------------------------------------------------------------
1 | unit DWUrlHandlerForms;
2 |
3 | interface
4 |
5 | uses
6 | {$IFDEF MSWINDOWS}
7 | Windows,
8 | {$ENDIF}
9 | Classes, SysUtils,
10 | System.StrUtils,
11 | OverbyteIcsHttpSrv,
12 | OverbyteIcsHttpAppServer,
13 | DWUrlHandlerBase, DWUtils;
14 |
15 | type
16 |
17 | TUrlHandlerForms = class(TDWUrlHandlerBase)
18 | public
19 | procedure Execute; override;
20 | end;
21 |
22 | implementation
23 |
24 | uses DW.CORE.Server, DWForm, DW.CORE.DWClientConnection, DW.CORE.DWApplication;
25 |
26 | procedure TUrlHandlerForms.Execute;
27 | var
28 | LDWApplication: TDWApplication;
29 | GetUrl: string;
30 | I: Integer;
31 | LForm, auxForm: TDWForm;
32 | Location: string;
33 | Status: string;
34 | begin
35 |
36 | Status := '';
37 |
38 | GetUrl := (Client as TDWClientConnection).Path;
39 |
40 | LDWApplication := DWApplication;
41 |
42 | if LDWApplication = nil then
43 | Exit;
44 |
45 | { TODO 1 -oDELCIO -cIMPLEMENT : Change to render DWApplication.Active Form (by DWForm.Show) }
46 | if LDWApplication.MainForm = nil then // if MainForm not exists
47 | begin // Create and redirect to it
48 | LDWApplication.MainForm := LDWApplication.MainFormClass.Create(DWApplication);
49 | LDWApplication.MainForm.Show; // LDWApplication.ActiveForm:= LDWApplication.MainForm;
50 | // LDWApplication.AddForm(LDWApplication.MainForm);
51 | TDWClientConnection(Client).DocStream := LDWApplication.MainForm.Render;
52 | Location := '/' + LDWApplication.MainForm.Name;
53 | end
54 | else
55 | begin
56 | // check if url represent one created form
57 | LForm := nil;
58 | for I := 0 to LDWApplication.Forms.Count - 1 do
59 | begin
60 | auxForm := TDWForm(LDWApplication.Forms[I]);
61 |
62 | if AnsiEndsText(auxForm.Name, GetUrl) then
63 | begin
64 | LForm := auxForm;
65 | Break;
66 | end;
67 | end;
68 | if LForm <> nil then // if form found
69 | begin
70 | LForm.Show; // LDWApplication.ActiveForm:= LForm;
71 | TDWClientConnection(Client).DocStream := LForm.Render; // render form
72 | Location := '/' + LForm.Name;
73 | end
74 | else
75 | begin
76 | LDWApplication.MainForm.Show; // LDWApplication.ActiveForm:= LDWApplication.MainForm;
77 | TDWClientConnection(Client).DocStream := LDWApplication.MainForm.Render;
78 | // render main form
79 | Location := '/' + LDWApplication.MainForm.Name;
80 | end;
81 | end;
82 | if Location <> GetUrl then
83 | begin
84 | Status := '302 moved';
85 | TDWClientConnection(Client).ReplyHeader := TDWClientConnection(Client).ReplyHeader +
86 | 'Location: ' + Location;
87 | end;
88 |
89 | AnswerStream(Status, '', TDWClientConnection(Client).ReplyHeader);
90 |
91 | Finish;
92 | end;
93 |
94 | end.
95 |
--------------------------------------------------------------------------------
/DWUrlHandlerHome.pas:
--------------------------------------------------------------------------------
1 | unit DWUrlHandlerHome;
2 |
3 | interface
4 |
5 | uses
6 | {$IFDEF MSWINDOWS}
7 | Windows,
8 | {$ENDIF}
9 | Classes, SysUtils,
10 | OverbyteIcsHttpSrv,
11 | OverbyteIcsHttpAppServer,
12 | DWUrlHandlerBase;
13 |
14 | type
15 | TUrlHandlerDefaultDoc = class(TDWUrlHandlerBase)
16 | public
17 | procedure Execute; override;
18 | end;
19 |
20 | TUrlHandlerHomePageHtml = class(TDWUrlHandlerBase)
21 | public
22 | procedure Execute; override;
23 | end;
24 |
25 | implementation
26 | uses DWMainServer, DWUserSessionUnit, DWForm;
27 |
28 |
29 | procedure TUrlHandlerDefaultDoc.Execute;
30 | var
31 | Headers:string;
32 | begin
33 | if CheckSession(Headers) = nil then
34 | Exit;
35 | raise Exception.Create('Aqui');
36 | //Relocate(UrlHomePage);
37 | end;
38 |
39 | procedure TUrlHandlerHomePageHtml.Execute;
40 | var
41 | UserSession:TDWUserSession;
42 | Headers:string;
43 | begin
44 | UserSession:= CheckSession(Headers);
45 | if UserSession = nil then
46 | Exit;
47 | if UserSession.MainForm = nil then
48 | UserSession.MainForm:= TDWForm(FrmDwServer.MainForm.Create(UserSession));
49 |
50 |
51 | UserSession.MainForm.UserSession:= UserSession;
52 | Client.DocStream:= UserSession.MainForm.Render;
53 | AnswerStream('','',Headers);
54 | Finish;
55 |
56 |
57 |
58 | end;
59 |
60 |
61 | end.
62 |
--------------------------------------------------------------------------------
/DWUrlHandlerRest.pas:
--------------------------------------------------------------------------------
1 | unit DWUrlHandlerRest;
2 |
3 | interface
4 |
5 | uses
6 | Classes, SysUtils, StrUtils, DWUrlHandlerBase;
7 |
8 | type
9 | TDWRestHandlerRest = class(TDWUrlHandlerBase)
10 | protected
11 | //
12 | public
13 | procedure Execute; override;
14 | end;
15 |
16 | TDWRestCallBackFunction = procedure(aParams: TStrings; var aReply: string) of object;
17 |
18 | implementation
19 |
20 | uses
21 | DW.CORE.DWClientConnection;
22 |
23 | procedure TDWRestHandlerRest.Execute;
24 | var
25 | Status: string;
26 | LReply: string;
27 | begin
28 | Status := '';
29 | LReply := '';
30 |
31 | if FProcedure <> nil then
32 | begin
33 | TDWRestCallBackFunction(FProcedure^)(TDWClientConnection(FClient).ParamList, LReply);
34 | end;
35 | if LReply <> '' then
36 | begin
37 | AnswerString(Status, '', TDWClientConnection(Client).ReplyHeader, LReply);
38 | end;
39 | Finish;
40 | end;
41 |
42 | end.
43 |
--------------------------------------------------------------------------------
/DelphiWeb_Design.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DelphiWeb_Design.res
--------------------------------------------------------------------------------
/DelphiWeb_Design_Seattle.dpk:
--------------------------------------------------------------------------------
1 | // JCL_DEBUG_EXPERT_GENERATEJDBG ON
2 | // JCL_DEBUG_EXPERT_INSERTJDBG ON
3 | package DelphiWeb_Design_Seattle;
4 |
5 | {$R *.res}
6 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
7 | {$ALIGN 8}
8 | {$ASSERTIONS ON}
9 | {$BOOLEVAL OFF}
10 | {$DEBUGINFO OFF}
11 | {$EXTENDEDSYNTAX ON}
12 | {$IMPORTEDDATA ON}
13 | {$IOCHECKS ON}
14 | {$LOCALSYMBOLS ON}
15 | {$LONGSTRINGS ON}
16 | {$OPENSTRINGS ON}
17 | {$OPTIMIZATION OFF}
18 | {$OVERFLOWCHECKS OFF}
19 | {$RANGECHECKS OFF}
20 | {$REFERENCEINFO ON}
21 | {$SAFEDIVIDE OFF}
22 | {$STACKFRAMES ON}
23 | {$TYPEDADDRESS OFF}
24 | {$VARSTRINGCHECKS ON}
25 | {$WRITEABLECONST OFF}
26 | {$MINENUMSIZE 1}
27 | {$IMAGEBASE $400000}
28 | {$DEFINE DEBUG}
29 | {$ENDIF IMPLICITBUILDING}
30 | {$IMPLICITBUILD ON}
31 |
32 | requires
33 | rtl,
34 | vcl,
35 | designide,
36 | ExpertsCreators,
37 | dbrtl,
38 | Jcl;
39 |
40 | contains
41 | DW.DESIGN.FormWizard in 'DW.DESIGN.FormWizard.pas',
42 | DWRegister in 'DWRegister.pas',
43 | DW.DESIGN.AppWizard in 'DW.DESIGN.AppWizard.pas',
44 | DW.DESIGN.MainForm in 'DW.DESIGN.MainForm.pas',
45 | DW.DESIGN.UserSessionWizard in 'DW.DESIGN.UserSessionWizard.pas',
46 | DW.DESIGN.AccordionEditor in 'DW.DESIGN.AccordionEditor.pas',
47 | DW.DESIGN.TabControlEditor in 'DW.DESIGN.TabControlEditor.pas',
48 | DW.DESIGN.FrameWizard in 'DW.DESIGN.FrameWizard.pas',
49 | DW.DESIGN.DataModuleWizard in 'DW.DESIGN.DataModuleWizard.pas';
50 |
51 | end.
52 |
53 |
--------------------------------------------------------------------------------
/DelphiWeb_Design_Seattle.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DelphiWeb_Design_Seattle.res
--------------------------------------------------------------------------------
/DelphiWeb_Firedac_Seattle.dpk:
--------------------------------------------------------------------------------
1 | package DelphiWeb_Firedac_Seattle;
2 |
3 | {$R *.res}
4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO OFF}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS ON}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION OFF}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO ON}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES ON}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DEFINE DEBUG}
27 | {$ENDIF IMPLICITBUILDING}
28 | {$IMPLICITBUILD ON}
29 |
30 | requires
31 | rtl,
32 | vcl,
33 | dbrtl,
34 | FireDAC,
35 | FireDACCommonDriver,
36 | FireDACCommon,
37 | DelphiWeb_Design_Seattle;
38 |
39 | contains
40 | DW.VCL.FIREDAC.Search in 'DW.VCL.FIREDAC.Search.pas',
41 | DWFiredacUtils in 'DWFiredacUtils.pas',
42 | DW.VCL.FIREDAC.Register in 'DW.VCL.FIREDAC.Register.pas';
43 |
44 | end.
45 |
--------------------------------------------------------------------------------
/DelphiWeb_Firedac_Seattle.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DelphiWeb_Firedac_Seattle.res
--------------------------------------------------------------------------------
/DelphiWeb_runtime.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DelphiWeb_runtime.res
--------------------------------------------------------------------------------
/DelphiWeb_runtime_Seattle.dpk:
--------------------------------------------------------------------------------
1 | // JCL_DEBUG_EXPERT_GENERATEJDBG ON
2 | // JCL_DEBUG_EXPERT_INSERTJDBG ON
3 | package DelphiWeb_runtime_Seattle;
4 |
5 | {$R *.res}
6 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
7 | {$ALIGN 8}
8 | {$ASSERTIONS ON}
9 | {$BOOLEVAL OFF}
10 | {$DEBUGINFO OFF}
11 | {$EXTENDEDSYNTAX ON}
12 | {$IMPORTEDDATA ON}
13 | {$IOCHECKS ON}
14 | {$LOCALSYMBOLS ON}
15 | {$LONGSTRINGS ON}
16 | {$OPENSTRINGS ON}
17 | {$OPTIMIZATION OFF}
18 | {$OVERFLOWCHECKS OFF}
19 | {$RANGECHECKS OFF}
20 | {$REFERENCEINFO ON}
21 | {$SAFEDIVIDE OFF}
22 | {$STACKFRAMES ON}
23 | {$TYPEDADDRESS OFF}
24 | {$VARSTRINGCHECKS ON}
25 | {$WRITEABLECONST OFF}
26 | {$MINENUMSIZE 1}
27 | {$IMAGEBASE $400000}
28 | {$DEFINE DEBUG}
29 | {$ENDIF IMPLICITBUILDING}
30 | {$RUNONLY}
31 | {$IMPLICITBUILD ON}
32 |
33 | requires
34 | rtl,
35 | vcl,
36 | dbrtl,
37 | Jcl;
38 |
39 | contains
40 | DWGlobal in 'DWGlobal.pas',
41 | DW.CORE.Server in 'DW.CORE.Server.pas',
42 | DWUrlHandlerForms in 'DWUrlHandlerForms.pas',
43 | DWUrlHandlerBase in 'DWUrlHandlerBase.pas',
44 | DW.CORE.UserSession in 'DW.CORE.UserSession.pas',
45 | DWLayoutRender in 'DWLayoutRender.pas',
46 | DWUtils in 'DWUtils.pas',
47 | DW.VCL.Component in 'DW.VCL.Component.pas',
48 | DW.VCL.Control in 'DW.VCL.Control.pas',
49 | DW.VCL.Labels in 'DW.VCL.Labels.pas',
50 | DWMarkupLinguageTag in 'DWMarkupLinguageTag.pas',
51 | DWRenderStream in 'DWRenderStream.pas',
52 | DWElementTag in 'DWElementTag.pas',
53 | DW.HTML.Page in 'DW.HTML.Page.pas',
54 | DW.VCL.CustomForm in 'DW.VCL.CustomForm.pas',
55 | DWForm in 'DWForm.pas',
56 | DW.VCL.Edit in 'DW.VCL.Edit.pas',
57 | DW.VCL.BaseControl in 'DW.VCL.BaseControl.pas',
58 | DW.VCL.Container in 'DW.VCL.Container.pas',
59 | DWCallbacks in 'DWCallbacks.pas',
60 | DW.VCL.Interfaces in 'DW.VCL.Interfaces.pas',
61 | DW.VCL.ScriptEvents in 'DW.VCL.ScriptEvents.pas',
62 | DWTypes in 'DWTypes.pas',
63 | DW.VCL.StyleRenderOptions in 'DW.VCL.StyleRenderOptions.pas',
64 | DW.CORE.DWThread in 'DW.CORE.DWThread.pas',
65 | DW.CORE.DWApplication in 'DW.CORE.DWApplication.pas',
66 | DW.CORE.DWHttpServer in 'DW.CORE.DWHttpServer.pas',
67 | DW.CORE.DWClientConnection in 'DW.CORE.DWClientConnection.pas',
68 | DW.CORE.DWHandlers in 'DW.CORE.DWHandlers.pas',
69 | DW.XHR.CallBackResp in 'DW.XHR.CallBackResp.pas',
70 | DW.VCL.ScriptParams in 'DW.VCL.ScriptParams.pas',
71 | DW.JSON.JsonData in 'DW.JSON.JsonData.pas',
72 | DW.VCL.Common in 'DW.VCL.Common.pas',
73 | DW.VCL.Frame in 'DW.VCL.Frame.pas',
74 | DW.VCL.DataModule in 'DW.VCL.DataModule.pas',
75 | DW.VCL.InputGroup in 'DW.VCL.InputGroup.pas',
76 | DW.VCL.InputForm in 'DW.VCL.InputForm.pas',
77 | DW.VCL.Region in 'DW.VCL.Region.pas',
78 | DW.VCL.ButtonGroup in 'DW.VCL.ButtonGroup.pas',
79 | DW.VCL.CustomRegion in 'DW.VCL.CustomRegion.pas',
80 | DW.VCL.NavBar in 'DW.VCL.NavBar.pas',
81 | DW.VCL.DBControl in 'DW.VCL.DBControl.pas',
82 | DW.CORE.Cache in 'DW.CORE.Cache.pas',
83 | DW.VCL.CustomInput in 'DW.VCL.CustomInput.pas',
84 | DW.VCL.Validator in 'DW.VCL.Validator.pas',
85 | DW.VCL.Input in 'DW.VCL.Input.pas',
86 | DW.VCL.DataLink in 'DW.VCL.DataLink.pas',
87 | DW.VCL.GlyphIcons in 'DW.VCL.GlyphIcons.pas',
88 | DW.VCL.Buttons in 'DW.VCL.Buttons.pas',
89 | DW.VCL.Modal in 'DW.VCL.Modal.pas',
90 | DW.VCL.List in 'DW.VCL.List.pas',
91 | DW.VCL.Accordion in 'DW.VCL.Accordion.pas',
92 | DW.VCL.TabControl in 'DW.VCL.TabControl.pas',
93 | DW.CORE.MergeSort in 'DW.CORE.MergeSort.pas',
94 | DW.CORE.MergeSortFunc in 'DW.CORE.MergeSortFunc.pas',
95 | DW.VCl.Dialogs in 'DW.VCl.Dialogs.pas',
96 | DW.VCL.JQGrid in 'DW.VCL.JQGrid.pas',
97 | DWUrlHandlerRest in 'DWUrlHandlerRest.pas',
98 | dw.vcl.FluidForm in 'dw.vcl.FluidForm.pas',
99 | DW.VCL.Table in 'DW.VCL.Table.pas',
100 | DW.VCL.Iframe in 'DW.VCL.Iframe.pas',
101 | DW.VCL.InputMoney in 'DW.VCL.InputMoney.pas',
102 | DW.VCL.Select2 in 'DW.VCL.Select2.pas',
103 | DW.VCL.Image in 'DW.VCL.Image.pas',
104 | OverbyteIcsAvlTrees in 'Include\Overbyte\OverbyteIcsAvlTrees.pas',
105 | OverbyteIcsCharsetUtils in 'Include\Overbyte\OverbyteIcsCharsetUtils.pas',
106 | OverbyteIcsCRC in 'Include\Overbyte\OverbyteIcsCRC.pas',
107 | OverbyteIcsCsc in 'Include\Overbyte\OverbyteIcsCsc.pas',
108 | OverbyteIcsDES in 'Include\Overbyte\OverbyteIcsDES.pas',
109 | OverbyteIcsDigestAuth in 'Include\Overbyte\OverbyteIcsDigestAuth.pas',
110 | OverbyteIcsFtpSrv in 'Include\Overbyte\OverbyteIcsFtpSrv.pas',
111 | OverByteIcsFtpSrvT in 'Include\Overbyte\OverByteIcsFtpSrvT.pas',
112 | OverbyteIcsHttpAppServer in 'Include\Overbyte\OverbyteIcsHttpAppServer.pas',
113 | OverbyteIcsHttpSrv in 'Include\Overbyte\OverbyteIcsHttpSrv.pas',
114 | OverbyteIcsLIBEAY in 'Include\Overbyte\OverbyteIcsLIBEAY.pas',
115 | OverbyteIcsLogger in 'Include\Overbyte\OverbyteIcsLogger.pas',
116 | OverbyteIcsMD4 in 'Include\Overbyte\OverbyteIcsMD4.pas',
117 | OverbyteIcsMD5 in 'Include\Overbyte\OverbyteIcsMD5.pas',
118 | OverbyteIcsMimeUtils in 'Include\Overbyte\OverbyteIcsMimeUtils.pas',
119 | OverbyteIcsMLang in 'Include\Overbyte\OverbyteIcsMLang.pas',
120 | OverbyteIcsNtlmMsgs in 'Include\Overbyte\OverbyteIcsNtlmMsgs.pas',
121 | OverbyteIcsNtlmSsp in 'Include\Overbyte\OverbyteIcsNtlmSsp.pas',
122 | OverbyteIcsOneTimePw in 'Include\Overbyte\OverbyteIcsOneTimePw.pas',
123 | OverbyteIcsSha1 in 'Include\Overbyte\OverbyteIcsSha1.pas',
124 | OverbyteIcsSocketUtils in 'Include\Overbyte\OverbyteIcsSocketUtils.pas',
125 | OverbyteIcsSSLEAY in 'Include\Overbyte\OverbyteIcsSSLEAY.pas',
126 | OverbyteIcsSspi in 'Include\Overbyte\OverbyteIcsSspi.pas',
127 | OverbyteIcsStreams in 'Include\Overbyte\OverbyteIcsStreams.pas',
128 | OverbyteIcsThreadTimer in 'Include\Overbyte\OverbyteIcsThreadTimer.pas',
129 | OverbyteIcsTimeList in 'Include\Overbyte\OverbyteIcsTimeList.pas',
130 | OverbyteIcsTypes in 'Include\Overbyte\OverbyteIcsTypes.pas',
131 | OverbyteIcsUtils in 'Include\Overbyte\OverbyteIcsUtils.pas',
132 | OverbyteIcsWebSession in 'Include\Overbyte\OverbyteIcsWebSession.pas',
133 | OverbyteIcsWinnls in 'Include\Overbyte\OverbyteIcsWinnls.pas',
134 | OverbyteIcsWinsock in 'Include\Overbyte\OverbyteIcsWinsock.pas',
135 | OverbyteIcsWndControl in 'Include\Overbyte\OverbyteIcsWndControl.pas',
136 | OverbyteIcsWSockBuf in 'Include\Overbyte\OverbyteIcsWSockBuf.pas',
137 | OverbyteIcsWSocket in 'Include\Overbyte\OverbyteIcsWSocket.pas',
138 | OverbyteIcsWSocketS in 'Include\Overbyte\OverbyteIcsWSocketS.pas',
139 | OverbyteIcsZLibDll in 'Include\Overbyte\OverbyteIcsZLibDll.pas',
140 | OverbyteIcsZlibHigh in 'Include\Overbyte\OverbyteIcsZlibHigh.pas',
141 | OverbyteIcsZLibObj in 'Include\Overbyte\OverbyteIcsZLibObj.pas';
142 |
143 | end.
144 |
--------------------------------------------------------------------------------
/DelphiWeb_runtime_Seattle.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/DelphiWeb_runtime_Seattle.res
--------------------------------------------------------------------------------
/Demo/DelphiWeb.dpr:
--------------------------------------------------------------------------------
1 | program DelphiWeb;
2 |
3 | uses
4 | Vcl.Forms,
5 | uServerMainForm in 'uServerMainForm.pas' {FrmServerMain},
6 | uWebMainForm in 'uWebMainForm.pas' {WebMainForm: TDWForm},
7 | uDWSessionData in 'uDWSessionData.pas' {DWSessionData: TDWUserSession};
8 |
9 | {$R *.res}
10 |
11 | var
12 | FrmServerMain:TFrmServerMain;
13 | begin
14 | Application.Initialize;
15 | Application.MainFormOnTaskbar := True;
16 | Application.CreateForm(TFrmServerMain, FrmServerMain);
17 | Application.Run;
18 | end.
--------------------------------------------------------------------------------
/Demo/DelphiWeb.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Demo/DelphiWeb.res
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/css/dw.css:
--------------------------------------------------------------------------------
1 | /**** alerts ***********/
2 | .flyover {
3 | position: fixed;
4 | width: 50%;
5 | z-index: 1000000;
6 | }
7 |
8 | .flyover-right-top {
9 | right: 1em;
10 | top: 1em;
11 | }
12 |
13 | .flyover-right-center {
14 | right: 1em;
15 | top: 50%;
16 | }
17 |
18 | .flyover-right-bottom {
19 | right: 1em;
20 | bottom: 1em;
21 | }
22 |
23 | @media only screen and (max-width: 767px) {
24 | .flyover {
25 | width: auto;
26 | left: 1em;
27 | }
28 | }
29 |
30 | /**** dropdown-submenu ***/
31 | .dropdown-submenu > .dropdown-menu {
32 | left: 100%;
33 | margin-top: -6px;
34 | margin-left: -1px;
35 | -webkit-border-radius: 0 6px 6px 6px;
36 | -moz-border-radius: 0 6px 6px 6px;
37 | border-radius: 0 6px 6px 6px;
38 | }
39 |
40 | .dropdown-submenu > .dropdown-menu-right{
41 | left: -100%;
42 | margin-top: -6px;
43 | margin-right: 100%;
44 | -webkit-border-radius: 0 6px 6px 6px;
45 | -moz-border-radius: 0 6px 6px 6px;
46 | border-radius: 0 6px 6px 6px;
47 | }
48 |
49 | @media (max-width: 767px) {
50 | .navbar-nav .open .dropdown-submenu > .dropdown-menu {
51 | padding-left: 15px;
52 | }
53 | }
54 |
55 | .caret-right {
56 | color: black;
57 | border-bottom: 4px solid transparent;
58 | border-top: 4px solid transparent;
59 | border-left: 4px solid;
60 | display: inline-block;
61 | height: 0;
62 | vertical-align: middle;
63 | width: 0;
64 | margin-left: 10px;
65 | }
66 |
67 | .caret-left {
68 | color: black;
69 | border-bottom: 4px solid transparent;
70 | border-top: 4px solid transparent;
71 | border-right: 4px solid;
72 | display: inline-block;
73 | height: 0;
74 | vertical-align: middle;
75 | width: 0;
76 | margin-left: 10px;
77 | }
78 |
79 | /**** select plugin ***/
80 | .form-control.disabled > button, .form-control.disabled > button:hover {
81 | background-color: #eee;
82 | opacity: 1;
83 | }
84 |
85 | /**** Tab Close Button ***/
86 | .tab-close-btn {
87 | float: right;
88 | cursor: pointer;
89 | width: 16px;
90 | height: 16px;
91 | display: inline-block;
92 | margin-top: 1px;
93 | margin-right: 2px;
94 | position: relative;
95 | text-indent: 3px;
96 | color: #feffff;
97 | background-color: #a1a1cc;
98 | z-index: 1000;
99 | border-radius: 0 6px 0 0;
100 | }
101 |
102 | .tab-content > .active {
103 | display: inline-block;
104 | width: 100%; /* JqGrid Bug*/
105 | }
106 |
107 | .dynamic-tab.has-error {
108 | border-width: 2px;
109 | border-style: solid;
110 | border-radius: 6px;
111 | border-color: #a94442;
112 | -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
113 | box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
114 | }
115 |
116 | /* Select2 */
117 | .select2 {
118 | width:100% !important;
119 | }
120 |
121 | /* IWBSFluidForm */
122 | .iwbs-form-fluid label{
123 | display:flex;
124 | top:0;
125 | }
126 | .iwbs-form-fluid div{
127 | /*display:inherit;*/
128 | margin-left: 4px;
129 | display: inline-block;
130 | margin-top: 4px;
131 | margin-bottom: 0;
132 | vertical-align: top;
133 | }
134 |
135 | .iwbs-form-fluid .panel-heading {
136 | width:95%!important;
137 | }
138 |
139 | .iwbs-form-fluid label,select,input:not([type="radio"]){
140 | width: 100% !important;
141 | }
142 |
143 | .iwbs-form-fluid .radio{
144 | display: block;
145 | margin-top: 0px;
146 | padding: 4px;
147 | border: 1px solid #ccc;
148 | border-radius: 4px;
149 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
150 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
151 | -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
152 | -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
153 | transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
154 | }
155 | .iwbs-form-fluid .radio br{
156 | display:none;
157 | }
158 |
159 |
160 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwBrowser.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * DelphiWeb Framework
3 | * Author:SRP Sistemas - Delcio Sbeghen
4 | *
5 | * Original: jQuery Browser Plugin 0.1.0
6 | * https://github.com/gabceb/jquery-browser-plugin
7 | */
8 |
9 | function DWInitBrowser() {
10 | //already created
11 | if (DW && DW.browser) {
12 | return DW.browser;
13 | }
14 |
15 |
16 | function uaMatch( ua ) {
17 | // If an UA is not provided, default to the current browser UA.
18 | if ( ua === undefined ) {
19 | ua = window.navigator.userAgent;
20 | }
21 | ua = ua.toLowerCase();
22 |
23 | var match = /(edge)\/([\w.]+)/.exec( ua ) ||
24 | /(opr)[\/]([\w.]+)/.exec( ua ) ||
25 | /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
26 | /(iemobile)[\/]([\w.]+)/.exec( ua ) ||
27 | /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
28 | /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
29 | /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
30 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
31 | /(msie) ([\w.]+)/.exec( ua ) ||
32 | ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
33 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
34 | [];
35 |
36 | var platform_match = /(ipad)/.exec( ua ) ||
37 | /(ipod)/.exec( ua ) ||
38 | /(windows phone)/.exec( ua ) ||
39 | /(iphone)/.exec( ua ) ||
40 | /(kindle)/.exec( ua ) ||
41 | /(silk)/.exec( ua ) ||
42 | /(android)/.exec( ua ) ||
43 | /(win)/.exec( ua ) ||
44 | /(mac)/.exec( ua ) ||
45 | /(linux)/.exec( ua ) ||
46 | /(cros)/.exec( ua ) ||
47 | /(playbook)/.exec( ua ) ||
48 | /(bb)/.exec( ua ) ||
49 | /(blackberry)/.exec( ua ) ||
50 | [];
51 |
52 | var browser = {},
53 | matched = {
54 | browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
55 | version: match[ 2 ] || match[ 4 ] || "0",
56 | versionNumber: match[ 4 ] || match[ 2 ] || "0",
57 | platform: platform_match[ 0 ] || ""
58 | };
59 |
60 | if ( matched.browser ) {
61 | browser[ matched.browser ] = true;
62 | browser.version = matched.version;
63 | browser.versionNumber = parseInt(matched.versionNumber, 10);
64 | }
65 |
66 | if ( matched.platform ) {
67 | browser[ matched.platform ] = true;
68 | }
69 |
70 | // These are all considered mobile platforms, meaning they run a mobile browser
71 | if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
72 | browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
73 | browser.mobile = true;
74 | }
75 |
76 | // These are all considered desktop platforms, meaning they run a desktop browser
77 | if ( browser.cros || browser.mac || browser.linux || browser.win ) {
78 | browser.desktop = true;
79 | }
80 |
81 | // Chrome, Opera 15+ and Safari are webkit based browsers
82 | if ( browser.chrome || browser.opr || browser.safari ) {
83 | browser.webkit = true;
84 | }
85 |
86 | // IE11 has a new token so we will assign it msie to avoid breaking changes
87 | if ( browser.rv || browser.iemobile) {
88 | var ie = "msie";
89 |
90 | matched.browser = ie;
91 | browser[ie] = true;
92 | }
93 |
94 | // Edge is officially known as Microsoft Edge, so rewrite the key to match
95 | if ( browser.edge ) {
96 | delete browser.edge;
97 | var msedge = "msedge";
98 |
99 | matched.browser = msedge;
100 | browser[msedge] = true;
101 | }
102 |
103 | // Blackberry browsers are marked as Safari on BlackBerry
104 | if ( browser.safari && browser.blackberry ) {
105 | var blackberry = "blackberry";
106 |
107 | matched.browser = blackberry;
108 | browser[blackberry] = true;
109 | }
110 |
111 | // Playbook browsers are marked as Safari on Playbook
112 | if ( browser.safari && browser.playbook ) {
113 | var playbook = "playbook";
114 |
115 | matched.browser = playbook;
116 | browser[playbook] = true;
117 | }
118 |
119 | // BB10 is a newer OS version of BlackBerry
120 | if ( browser.bb ) {
121 | var bb = "blackberry";
122 |
123 | matched.browser = bb;
124 | browser[bb] = true;
125 | }
126 |
127 | // Opera 15+ are identified as opr
128 | if ( browser.opr ) {
129 | var opera = "opera";
130 |
131 | matched.browser = opera;
132 | browser[opera] = true;
133 | }
134 |
135 | // Stock Android browsers are marked as Safari on Android.
136 | if ( browser.safari && browser.android ) {
137 | var android = "android";
138 |
139 | matched.browser = android;
140 | browser[android] = true;
141 | }
142 |
143 | // Kindle browsers are marked as Safari on Kindle
144 | if ( browser.safari && browser.kindle ) {
145 | var kindle = "kindle";
146 |
147 | matched.browser = kindle;
148 | browser[kindle] = true;
149 | }
150 |
151 | // Kindle Silk browsers are marked as Safari on Kindle
152 | if ( browser.safari && browser.silk ) {
153 | var silk = "silk";
154 |
155 | matched.browser = silk;
156 | browser[silk] = true;
157 | }
158 |
159 | // Assign the name and platform variable
160 | browser.name = matched.browser;
161 | browser.platform = matched.platform;
162 | return browser;
163 | }
164 |
165 | // Run the matching process, also assign the function to the returned object
166 | // for manual, DW-free use if desired
167 | window.DWBrowser = uaMatch( window.navigator.userAgent );
168 | window.DWBrowser.uaMatch = uaMatch;
169 |
170 | // Only assign to DW.browser if DW is loaded
171 | if ( DW ) {
172 | DW.browser = window.DWBrowser;
173 | }
174 | };
175 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwControl.js:
--------------------------------------------------------------------------------
1 | //Initialize Control Object
2 | function DWInitControl(AOwner, AId, AVisibility, ASupportsInput){
3 |
4 | var Item = $("#" + AId)[0];
5 |
6 | if(Item != null) {
7 | if (ASupportsInput) {
8 | DWSetSupportsInput(Item, true);
9 | }
10 | }
11 | return
12 | }
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwControls.js:
--------------------------------------------------------------------------------
1 | //DWControls Class
2 | function DWControls(){
3 | var FItems = [];
4 |
5 | //array of DWControl Objects
6 | this.Items = FItems;
7 |
8 | //Get the DWObject for an element
9 | this.GetControlByElement = function (aElement){
10 | if (!aElement) {
11 | return null;
12 | }
13 | var lControl;
14 | do {
15 | lControl = this.FItems[aElement.id + "DWC"];
16 | if (lControl != null) {
17 | return lControl;
18 | } else {
19 | aElement = aElement.parentNode;
20 | }
21 | }
22 | while (aElement != null);
23 | }
24 | }
25 |
26 | //Create the DW.controls Object
27 | function DWInitControls(){
28 | var controls = null;
29 | //check if already created
30 | if (DW) {
31 | controls = DW.controls;
32 | if (!controls){
33 | controls = new DWControls;
34 | }
35 | DW.controls = controls;
36 | }
37 | }
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwDebug.js:
--------------------------------------------------------------------------------
1 | //the DW Logger Class
2 | function DWLogger() {
3 | //define if show debug log messages
4 | this.DebugEnable = true;
5 |
6 | //write debug messages to console if DebugEnable
7 | this.debugMessage = function (aMessage) {
8 | if (this.DebugEnable) {
9 | try {
10 | if (window.console && window.console.log) {
11 | console.log(aMessage);
12 | }
13 | } catch (e) {
14 | //ignore log error
15 | }
16 | }
17 | };
18 |
19 | //write error messages in console(always)
20 | this.consoleError = function (aMessage) {
21 | if (window.console && window.console.error) {
22 | console.error(aMessage);
23 | return true;
24 | } else {
25 | return consoleWrite(aMessage);
26 | }
27 | };
28 |
29 | //write log messages in console(always)
30 | this.consoleWrite = function (aMessage) {
31 | if (window.console && window.console.log) {
32 | console.log(aMessage);
33 | return true;
34 | } else {
35 | return false;
36 | }
37 | };
38 | }
39 |
40 | //Create DW.logger Object
41 | function DWInitLogger(){
42 | var logger = null;
43 | //already created
44 | if (DW){
45 | logger = DW.logger;
46 |
47 | if (!logger){
48 | logger = new DWLogger;
49 | }
50 | DW.logger = logger;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwFunctions.js:
--------------------------------------------------------------------------------
1 | //DWForm Class declaration
2 | function DWFormClass(){
3 | //public propertyes for DW.form
4 |
5 | }
6 |
7 | //Initialize DW.form Object
8 | function DWInitForm(){
9 | DWReleaseForm();
10 | DWCreateForm();
11 | }
12 |
13 | //Release DW.form Object
14 | // !!!!**** Do not call this directly, always call DW.form.DWRelease ****!!!!
15 | function DWReleaseForm(){
16 | frm = DW.form;
17 | if (frm) {
18 | var i;
19 | for (i = 0; i < frm.OwnedComps.length; i++) {
20 | if (frm.OwnedComps[i].DWRelease) {
21 | frm.OwnedComps[i].DWRelease();
22 | }
23 | frm.OwnedComps[i] = null;
24 | }
25 | if (frm.oldCursors) {
26 | for (i = 0; i < frm.oldCursors.length; i++) {
27 | frm.oldCursors[i] = null;
28 | }
29 |
30 | for (i = 0; i < frm.HTMLelements.length; i++) {
31 | frm.HTMLelements[i] = null;
32 | }
33 | }
34 | }
35 | frm = null;
36 | DW.form = null;
37 | }
38 |
39 | //Create DW.form Object
40 | // !!!!**** Do not call this directly, always call DWInitForm()****!!!!
41 | function DWCreateForm(){
42 | var frm = $("#DWAjaxForm")[0];
43 | if (DW){
44 | if(!frm){
45 | frm = new DWFormClass;
46 | }
47 | frm.Item = document.body;
48 | frm.OwnedComps = [];
49 | frm.DWRelease = DWReleaseForm;
50 | $(frm).on("submit", SubmitForm);
51 | DW.form = frm;
52 | }
53 |
54 | }
55 |
56 | //return DWObject for an HTML Element
57 | function DWFindObject(element) {
58 | if (!element) {
59 | return null;
60 | }
61 | var xObj;
62 | var el = element;
63 | do {
64 | xObj = window[el.id + "DWC"];
65 | if (xObj != null) {
66 | return xObj;
67 | } else {
68 | el = el.parentNode;
69 | }
70 | }
71 | while (el != null);
72 | }
73 |
74 | //return an form by name property
75 | function DWGetFormByName(aFormName){
76 | return window.document.forms[aFormName];
77 | }
78 |
79 | // hooks or unhook Input events of an element
80 | function DWSetSupportsInput(aControl, aValue) {
81 | $(aControl).off("change.DW", DWControlChanged);
82 | $(aControl).off("keypress.DW", DWControlChanged);
83 | $(aControl).off("click.DW", DWControlChanged);
84 | $(aControl).off("select.DW", DWControlChanged);
85 | if (aValue === true){
86 | $(aControl).on("change.DW", DWControlChanged);
87 | $(aControl).on("keypress.DW", DWControlChanged);
88 | $(aControl).on("click.DW", DWControlChanged);
89 | $(aControl).on("select.DW", DWControlChanged);
90 | }
91 | }
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dwMain.js:
--------------------------------------------------------------------------------
1 | /*------------------------------------------------------------------------------
2 | DW namespace
3 | ------------------------------------------------------------------------------*/
4 | var DW = {
5 | //DW.browser return Browser Object
6 | browser:null,
7 |
8 | //ajax submit form
9 | form:null,
10 |
11 |
12 |
13 | //log and debug
14 | logger:null,
15 |
16 |
17 | //Initialize de DW Objects
18 | initDW : function() {
19 | //init List of changed controls to submit only controls changed
20 | window.ChangedList = [];
21 | DWInitLogger();
22 | DWInitBrowser();
23 | DWInitForm();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dyntabs/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Christian Pradelli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dyntabs/README.md:
--------------------------------------------------------------------------------
1 | # Bootstrap-Dynamic-Tabs
2 |
3 | Bootstrap Dynamic Tabs automatically makes Bootstrap nav-tabs and nav pils responsive.
4 |
5 | ## Requirements
6 | - Bootstrap: 3+
7 | - jQuery: 1.9+
8 |
9 | ## Usage
10 |
11 | ```
12 |
13 |
14 |
15 | Bootstrap Dynamic Tabs
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Tabs
28 |
37 | $("#mytabid").bootstrapDynamicTabs();
38 |
39 |
40 |
41 |
42 | ```
43 |
44 | ## demo
45 | http://cdn.rawgit.com/kattunga/Bootstrap-Dynamic-Tabs/v1.0/demo.html
46 |
47 | ## Credits
48 | This proyect is based in the original proyect from: https://github.com/gabrieltomescu/bootstrap-responsive-tabs
49 |
50 | ## License
51 | The Bootstrap Responsive Tabs plugin is licensed under the MIT license. See the LICENSE file for full details.
52 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dyntabs/bootstrap-dynamic-tabs.css:
--------------------------------------------------------------------------------
1 | .dynamic-tabs {
2 | width: 100%;
3 | float: left;
4 | }
5 | .dynamic-tabs-container {
6 | position: relative;
7 | }
8 | .dynamic-tabs-container .dynamic-tabs {
9 | padding-right: 50px;
10 | }
11 | .dynamic-tabs-container .tabs-dropdown {
12 | position: absolute;
13 | right: 0;
14 | margin-right: 0 !important;
15 | }
16 | .dynamic-tabs-container .tabs-dropdown.navbar-nav {
17 | margin: 0 !important;
18 | }
19 | @media only screen and (max-width: 767px) {
20 | .dynamic-tabs-container .tabs-dropdown .dropdown-menu {
21 | position: fixed;
22 | top: 20px;
23 | right: 20px;
24 | bottom: 20px;
25 | left: 20px;
26 | padding-top: 50px;
27 | }
28 | .dynamic-tabs-container .tabs-dropdown .dropdown-menu .dropdown-header {
29 | position: fixed;
30 | left: 21px;
31 | right: 21px;
32 | background: #FFF;
33 | margin-top: -50px;
34 | padding-top: 18px;
35 | border-radius: 4px 4px 0 0;
36 | }
37 | .dynamic-tabs-container .tabs-dropdown .dropdown-menu .close {
38 | position: absolute;
39 | top: 14px;
40 | right: 20px;
41 | }
42 | .dynamic-tabs-container .tabs-dropdown .dropdown-menu .divider {
43 | margin: 0;
44 | }
45 | .dynamic-tab {
46 | width: 100%;
47 | }
48 | }
49 | .dynamic-tabs-container .tabs-dropdown .dropdown-toggle {
50 | position: relative;
51 | display: block;
52 | padding: 10px 15px;
53 | }
54 | .dynamic-tabs-container .tabs-dropdown .dropdown-toggle .count {
55 | margin-right: 5px;
56 | }
57 | .dynamic-tabs-container .tabs-dropdown .dropdown-toggle .caret {
58 | border-top: 4px solid transparent;
59 | border-bottom: 4px solid transparent;
60 | border-left: 6px solid;
61 | margin-left: 0;
62 | vertical-align: initial;
63 | }
64 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dyntabs/bootstrap-dynamic-tabs.js:
--------------------------------------------------------------------------------
1 | /*jslint browser: true*/
2 | /*global jQuery*/
3 | /*jslint vars: true*/
4 |
5 | (function ($) {
6 | $.fn.bootstrapDynamicTabs = function () {
7 |
8 | this.each(function () {
9 | var $horizontalContainer = $(this);
10 |
11 | function DynamicTabs() {
12 |
13 | // create wrapper and menu if first time
14 | if ($horizontalContainer.parent('.dynamic-tabs-container').length === 0) {
15 |
16 | // add wrapper
17 | $horizontalContainer.addClass("dynamic-tabs").wrap("");
18 |
19 | // Attach a dropdown to the right of the tabs bar
20 | // This will be toggled if tabs can't fit in a given viewport size
21 | $horizontalContainer.after(
22 | ""
23 | );
24 | }
25 |
26 | // Mark each tab with a 'tab-id' for easy access
27 | var $tabs = $horizontalContainer.children('li');
28 | $tabs.each(function (i) {
29 | $(this)
30 | .addClass("dynamic-tab")
31 | .attr("tab-id", i);
32 | });
33 |
34 | // Update tabs funtion
35 | var updateTabs = function () {
36 |
37 | var i, horizontalTab, tabId, verticalTab, tabWidth, isVisible;
38 |
39 | var availableWidth = $horizontalContainer.width();
40 | var numVisibleHorizontalTabs = 1;
41 |
42 | var activeTab = $horizontalContainer.find('.active');
43 | var activeTabIndex = activeTab.index();
44 |
45 | // active tab is always visible
46 | activeTab.toggleClass('hidden', false);
47 | availableWidth = availableWidth - activeTab.outerWidth(true);
48 |
49 | // Determine which tabs to show/hide
50 | var $tabs = $horizontalContainer.children('li');
51 |
52 | // from active to firt
53 | for (i = activeTabIndex - 1; i >= 0; i--) {
54 | horizontalTab = $tabs.eq(i);
55 | if (availableWidth > 0) {
56 | horizontalTab.toggleClass('hidden', false);
57 | tabWidth = horizontalTab.outerWidth(true);
58 | isVisible = tabWidth <= availableWidth;
59 | if (isVisible) {
60 | availableWidth = availableWidth - tabWidth;
61 | numVisibleHorizontalTabs++;
62 | } else {
63 | availableWidth = -1;
64 | }
65 | } else {
66 | isVisible = false;
67 | }
68 | horizontalTab.toggleClass('hidden', !isVisible);
69 | }
70 |
71 | // from active to last
72 | for (i = activeTabIndex + 1; i < $tabs.length; i++) {
73 | horizontalTab = $tabs.eq(i);
74 | if (availableWidth > 0) {
75 | horizontalTab.toggleClass('hidden', false);
76 | tabWidth = horizontalTab.outerWidth(true);
77 | isVisible = tabWidth <= availableWidth;
78 | if (isVisible) {
79 | availableWidth = availableWidth - tabWidth;
80 | numVisibleHorizontalTabs++;
81 | } else {
82 | availableWidth = -1;
83 | }
84 | } else {
85 | isVisible = false;
86 | }
87 | horizontalTab.toggleClass('hidden', !isVisible);
88 | }
89 |
90 | // Toggle the Tabs dropdown if there are more tabs than can fit in the tabs horizontal container
91 | var numVisibleVerticalTabs = $tabs.length - numVisibleHorizontalTabs;
92 | var hasVerticalTabs = (numVisibleVerticalTabs > 0);
93 | $horizontalContainer.siblings(".tabs-dropdown").toggleClass("hidden", !hasVerticalTabs);
94 | };
95 |
96 | // tabs dropdown event
97 | var onDropDow = function () {
98 | // Clone each tab into the dropdown
99 | var $verticalContainer = $horizontalContainer.siblings(".tabs-dropdown").find(".dropdown-menu");
100 |
101 | $verticalContainer.html("");
102 | $horizontalContainer.children('li').clone().appendTo($verticalContainer);
103 | $verticalContainer.children('li').toggleClass("hidden");
104 | $verticalContainer.children('li').on("click", function (e) {
105 | $horizontalContainer.find("[tab-id=" + $(this).attr("tab-id") + "] a").tab("show");
106 | updateTabs();
107 | });
108 | };
109 | $horizontalContainer.siblings(".tabs-dropdown").off('show.bs.dropdown').on('show.bs.dropdown', onDropDow);
110 |
111 | // update tabs
112 | updateTabs();
113 |
114 | // Update tabs on window resize
115 | $(window).off("resize.dyntabs").on("resize.dyntabs", function () {
116 | updateTabs();
117 | });
118 | }
119 |
120 | return new DynamicTabs();
121 | });
122 | };
123 | }(jQuery));
124 |
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/dyntabs/bootstrap-dynamic-tabs.min.js:
--------------------------------------------------------------------------------
1 | (function($){$.fn.bootstrapDynamicTabs=function(){this.each(function(){var $horizontalContainer=$(this);function DynamicTabs(){if($horizontalContainer.parent('.dynamic-tabs-container').length===0){$horizontalContainer.addClass("dynamic-tabs").wrap("");$horizontalContainer.after("");}
2 | var $tabs=$horizontalContainer.children('li');$tabs.each(function(i){$(this).addClass("dynamic-tab").attr("tab-id",i);});var updateTabs=function(){var i,horizontalTab,tabId,verticalTab,tabWidth,isVisible;var availableWidth=$horizontalContainer.width();var numVisibleHorizontalTabs=1;var activeTab=$horizontalContainer.find('.active');var activeTabIndex=activeTab.index();activeTab.toggleClass('hidden',false);availableWidth=availableWidth-activeTab.outerWidth(true);var $tabs=$horizontalContainer.children('li');for(i=activeTabIndex-1;i>=0;i--){horizontalTab=$tabs.eq(i);if(availableWidth>0){horizontalTab.toggleClass('hidden',false);tabWidth=horizontalTab.outerWidth(true);isVisible=tabWidth<=availableWidth;if(isVisible){availableWidth=availableWidth-tabWidth;numVisibleHorizontalTabs++;}else{availableWidth=-1;}}else{isVisible=false;}
3 | horizontalTab.toggleClass('hidden',!isVisible);}
4 | for(i=activeTabIndex+1;i<$tabs.length;i++){horizontalTab=$tabs.eq(i);if(availableWidth>0){horizontalTab.toggleClass('hidden',false);tabWidth=horizontalTab.outerWidth(true);isVisible=tabWidth<=availableWidth;if(isVisible){availableWidth=availableWidth-tabWidth;numVisibleHorizontalTabs++;}else{availableWidth=-1;}}else{isVisible=false;}
5 | horizontalTab.toggleClass('hidden',!isVisible);}
6 | var numVisibleVerticalTabs=$tabs.length-numVisibleHorizontalTabs;var hasVerticalTabs=(numVisibleVerticalTabs>0);$horizontalContainer.siblings(".tabs-dropdown").toggleClass("hidden",!hasVerticalTabs);};var onDropDow=function(){var $verticalContainer=$horizontalContainer.siblings(".tabs-dropdown").find(".dropdown-menu");$verticalContainer.html("");$horizontalContainer.children('li').clone().appendTo($verticalContainer);$verticalContainer.children('li').toggleClass("hidden");$verticalContainer.children('li').on("click",function(e){$horizontalContainer.find("[tab-id="+$(this).attr("tab-id")+"] a").tab("show");updateTabs();});};$horizontalContainer.siblings(".tabs-dropdown").off('show.bs.dropdown').on('show.bs.dropdown',onDropDow);updateTabs();$(window).off("resize.dyntabs").on("resize.dyntabs",function(){updateTabs();});}
7 | return new DynamicTabs();});};}(jQuery));
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/lixeira/dwEvents.js:
--------------------------------------------------------------------------------
1 | //Class declaration for DWEventProcessor
2 | function DWEventProcessorClass(aComponent){
3 | //Set the Owner of this
4 | this.Owner = aComponent;
5 |
6 | //retain the last Event found in GetEventIndexByName for SpeedUp
7 | lastFound = 0;
8 |
9 | eventTypes = ["abort","change"];
10 |
11 |
12 | //EventHandlers is a bidirectional array correspond with:
13 | //EventHandlers[<"eventTypes" index >][]
14 | this.EventHandlers = [];
15 |
16 |
17 | /* this function process all events hookeds and redirect to its eventHandlerFunctions
18 | !!!! Attention !!!!: this function is called by DOM Element,
19 | consequently "this" represent a DOM element and not EventProcessor Object. */
20 | this.ProcessEvent = function (aEvent, a2, a3, a4) {
21 | var result = true;
22 | DW.logger.debugMessage("EventProcessor: Processing Event");
23 | try {
24 | //get event source
25 | var origEvent = aEvent || window.event;
26 | if (origEvent) {
27 | DW.logger.debugMessage("EventProcessor: origEvent.type = " + origEvent.type);
28 | } else {
29 | DW.logger.debugMessage("EventProcessor: origEvent not found");
30 | }
31 | //get index of event type
32 | var i = this.EventProcessor.GetEventIndexByName(origEvent.type);
33 | if (i < 0) {
34 | return result;
35 | }
36 | //Get the DWControl of the element that originated the event
37 | var origControl = DW.controls.GetControlByElement(origEvent.target);
38 | //if found DWControl
39 | if (origControl != null) {
40 | /* if (origControl.IsAsyncEventsDisabled()) { // if DWC async events were disabled by user, return
41 | logMessage("EventProcessor: origControl (" + origControl.id + ") is disabled for async events.");
42 | return true;
43 | } */
44 | //get the Hook for origControl of represent this event
45 | var CompHook = origControl.EventProcessor.EventHandlers[i];
46 | //if found Hook
47 | if (CompHook) {
48 | //Loop for all eventHandlerFunctions of this Hook
49 | var count = CompHook.length;
50 | for (var j = 0; j < count; j++) {
51 | DW.logger.debugMessage("EventProcessor: Executing event handler Function");
52 | origControl.eventFunc = CompHook[j];
53 | //try execute current eventHandlerFunction
54 | if (!origControl.eventFunc(origEvent)) {
55 | DW.logger.consoleError("EventProcessor: Err in execute Eventhandler");
56 | result = false;
57 | break;
58 | }
59 | }
60 | }
61 | } else {
62 | DW.logger.debugMessage("EventProcessor: origControl is null");
63 | }
64 | }
65 | catch (e) {
66 | DW.logger.consoleError(e.name + ": " + e.message);
67 | //var trace = printStackTrace({e: e});
68 | //consoleWrite(trace);
69 | throw e;
70 | }
71 | return result;
72 | }
73 |
74 | //Get the event index by event name
75 | this.GetEventIndexByName = function (aEventName){
76 | if (eventTypes[this.lastFound] == aEventName) {
77 | return this.lastFound;
78 | }
79 | var result = -1;
80 | for (var i = 0; i < eventTypes.length; i++) {
81 | if (eventTypes[i] == aEventName) {
82 | result = i;
83 | break;
84 | }
85 | }
86 | this.lastFound = result;
87 | return result;
88 | }
89 |
90 | //Hook Component Event
91 | this.HookEvent = function (eventName, eventHandlerFunction) {
92 | //Get the "eventType" index
93 | var i = this.GetEventIndexByName(eventName);
94 | DW.logger.debugMessage("EventProcessor: HookEvent: eventName = " + eventName);
95 | //create a hook for this eventName
96 | if (this.EventHandlers[i] == null) {
97 | this.EventHandlers[i] = [];
98 | //get element event name
99 | var xEventName = "on" + eventName;
100 | //if Compenent has original event
101 | if (this.Owner[xEventName] != null) {
102 | //Hook Abort to Compenent original event
103 | this.EventHandlers[0] = this.Owner[xEventName]
104 | }
105 | //Hook Compenent original event to EventProcessor.ProcessEvent
106 | this.Owner[xEventName] = this.ProcessEvent;
107 | }
108 | //add eventHandlerFunction to Hook
109 | this.EventHandlers[i].push(eventHandlerFunction);
110 | return this;
111 | }
112 |
113 |
114 | //UnHook Component Event
115 | this.UnHookEvent = function(eventName, eventHandlerFunction){
116 | //Get the "eventType" index
117 | var i = this.GetEventIndexByName(eventName);
118 | DW.logger.debugMessage("EventProcessor: UnHookEvent: eventName = " + eventName);
119 | //Verify if Hook exists for this eventName
120 | if (this.EventHandlers[i] == null ) {
121 | //Exit if Hook not exists
122 | return this;
123 | }
124 | //Find eventHandlerFunction for this Hook
125 | var iLen = this.EventHandlers[i].length;
126 | for (var j = 0; j < iLen; j++) {
127 | //if found
128 | if (this.EventHandlers[i][j] == eventHandlerFunction) {
129 | //remove eventHandlerFunction
130 | this.EventHandlers[i].splice(j, 1);
131 | break;
132 | }
133 | }
134 | return this;
135 | }
136 | }
137 |
138 | //Create a DWComponent.EventProcessor Object
139 | function DWInitEventProcessor(aComponent){
140 | //verify already created and if not Create
141 | var lEvtProc = null;
142 | if (aComponent) {
143 | lEvtProc = aComponent.EventProcessor;
144 | if (!lEvtProc){
145 | lEvtProc = new DWEventProcessorClass(aComponent);
146 | }
147 | aComponent.EventProcessor = lEvtProc;
148 | }
149 | }
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/maskedinput/jquery.maskedinput.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | jQuery Masked Input Plugin
3 | Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
4 | Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
5 | Version: 1.4.1
6 | */
7 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
--------------------------------------------------------------------------------
/Demo/Win32/Debug/wwwroot/dwlib/validator/validator.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Validator v0.11.5 for Bootstrap 3, by @1000hz
3 | * Copyright 2016 Cina Saffary
4 | * Licensed under http://opensource.org/licenses/MIT
5 | *
6 | * https://github.com/1000hz/bootstrap-validator
7 | */
8 |
9 | +function(a){"use strict";function b(b){return b.is('[type="checkbox"]')?b.prop("checked"):b.is('[type="radio"]')?!!a('[name="'+b.attr("name")+'"]:checked').length:b.val()}function c(b){return this.each(function(){var c=a(this),e=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b),f=c.data("bs.validator");(f||"destroy"!=b)&&(f||c.data("bs.validator",f=new d(this,e)),"string"==typeof b&&f[b]())})}var d=function(c,e){this.options=e,this.validators=a.extend({},d.VALIDATORS,e.custom),this.$element=a(c),this.$btn=a('button[type="submit"], input[type="submit"]').filter('[form="'+this.$element.attr("id")+'"]').add(this.$element.find('input[type="submit"], button[type="submit"]')),this.update(),this.$element.on("input.bs.validator change.bs.validator focusout.bs.validator",a.proxy(this.onInput,this)),this.$element.on("submit.bs.validator",a.proxy(this.onSubmit,this)),this.$element.on("reset.bs.validator",a.proxy(this.reset,this)),this.$element.find("[data-match]").each(function(){var c=a(this),d=c.data("match");a(d).on("input.bs.validator",function(a){b(c)&&c.trigger("input.bs.validator")})}),this.$inputs.filter(function(){return b(a(this))}).trigger("focusout"),this.$element.attr("novalidate",!0),this.toggleSubmit()};d.VERSION="0.11.5",d.INPUT_SELECTOR=':input:not([type="hidden"], [type="submit"], [type="reset"], button)',d.FOCUS_OFFSET=20,d.DEFAULTS={delay:500,html:!1,disable:!0,focus:!0,custom:{},errors:{match:"Does not match",minlength:"Not long enough"},feedback:{success:"glyphicon-ok",error:"glyphicon-remove"}},d.VALIDATORS={"native":function(a){var b=a[0];return b.checkValidity?!b.checkValidity()&&!b.validity.valid&&(b.validationMessage||"error!"):void 0},match:function(b){var c=b.data("match");return b.val()!==a(c).val()&&d.DEFAULTS.errors.match},minlength:function(a){var b=a.data("minlength");return a.val().length").addClass("list-unstyled").append(a.map(d,function(b){return a("")[c](b)})),void 0===f.data("bs.validator.originalContent")&&f.data("bs.validator.originalContent",f.html()),f.empty().append(d),e.addClass("has-error has-danger"),e.hasClass("has-feedback")&&g.removeClass(this.options.feedback.success)&&g.addClass(this.options.feedback.error)&&e.removeClass("has-success"))},d.prototype.clearErrors=function(a){var c=a.closest(".form-group"),d=c.find(".help-block.with-errors"),e=c.find(".form-control-feedback");d.html(d.data("bs.validator.originalContent")),c.removeClass("has-error has-danger has-success"),c.hasClass("has-feedback")&&e.removeClass(this.options.feedback.error)&&e.removeClass(this.options.feedback.success)&&b(a)&&e.addClass(this.options.feedback.success)&&c.addClass("has-success")},d.prototype.hasErrors=function(){function b(){return!!(a(this).data("bs.validator.errors")||[]).length}return!!this.$inputs.filter(b).length},d.prototype.isIncomplete=function(){function c(){var c=b(a(this));return!("string"==typeof c?a.trim(c):c)}return!!this.$inputs.filter("[required]").filter(c).length},d.prototype.onSubmit=function(a){this.validate(),(this.isIncomplete()||this.hasErrors())&&a.preventDefault()},d.prototype.toggleSubmit=function(){this.options.disable&&this.$btn.toggleClass("disabled",this.isIncomplete()||this.hasErrors())},d.prototype.defer=function(b,c){return c=a.proxy(c,this,b),this.options.delay?(window.clearTimeout(b.data("bs.validator.timeout")),void b.data("bs.validator.timeout",window.setTimeout(c,this.options.delay))):c()},d.prototype.reset=function(){return this.$element.find(".form-control-feedback").removeClass(this.options.feedback.error).removeClass(this.options.feedback.success),this.$inputs.removeData(["bs.validator.errors","bs.validator.deferred"]).each(function(){var b=a(this),c=b.data("bs.validator.timeout");window.clearTimeout(c)&&b.removeData("bs.validator.timeout")}),this.$element.find(".help-block.with-errors").each(function(){var b=a(this),c=b.data("bs.validator.originalContent");b.removeData("bs.validator.originalContent").html(c)}),this.$btn.removeClass("disabled"),this.$element.find(".has-error, .has-danger, .has-success").removeClass("has-error has-danger has-success"),this},d.prototype.destroy=function(){return this.reset(),this.$element.removeAttr("novalidate").removeData("bs.validator").off(".bs.validator"),this.$inputs.off(".bs.validator"),this.options=null,this.validators=null,this.$element=null,this.$btn=null,this};var e=a.fn.validator;a.fn.validator=c,a.fn.validator.Constructor=d,a.fn.validator.noConflict=function(){return a.fn.validator=e,this},a(window).on("load",function(){a('form[data-toggle="validator"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery);
--------------------------------------------------------------------------------
/Demo/uDWSessionData.dfm:
--------------------------------------------------------------------------------
1 | object DWSessionData: TDWSessionData
2 | OldCreateOrder = False
3 | Height = 150
4 | Width = 215
5 | end
6 |
--------------------------------------------------------------------------------
/Demo/uDWSessionData.pas:
--------------------------------------------------------------------------------
1 | unit uDWSessionData;
2 |
3 | interface
4 |
5 | uses
6 | DW.CORE.UserSession;
7 | type
8 | TDWSessionData = class(TDWUserSession)
9 | private
10 | { private declarations }
11 | public
12 | { public declarations }
13 | end;
14 |
15 | { !!! Do Not Declare Global Variables !!! }
16 |
17 | implementation
18 |
19 | uses
20 | DWGlobal;
21 |
22 | {$R *.dfm}
23 |
24 |
25 |
26 | initialization
27 | gUserSessionClass := TDWSessionData;
28 |
29 | end.
--------------------------------------------------------------------------------
/Demo/uServerMainForm.dfm:
--------------------------------------------------------------------------------
1 | object FrmServerMain: TFrmServerMain
2 | Left = 0
3 | Top = 0
4 | Caption = 'FrmServerMain'
5 | ClientHeight = 202
6 | ClientWidth = 447
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'Tahoma'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnShow = FormShow
15 | PixelsPerInch = 96
16 | TextHeight = 13
17 | object Server: TDWServer
18 | Port = '80'
19 | DocDir = 'C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\wwwroot'
20 | TemplateDir =
21 | 'C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\wwwroot\templ' +
22 | 'ates\'
23 | LibDir =
24 | 'C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\wwwroot\dwlib' +
25 | '\'
26 | UrlBase = 'http://0.0.0.0:80'
27 | Left = 216
28 | Top = 104
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/Demo/uServerMainForm.pas:
--------------------------------------------------------------------------------
1 | unit uServerMainForm;
2 |
3 | interface
4 |
5 | uses
6 | VCL.Forms, System.SysUtils, DW.CORE.Server, System.Classes;
7 | type
8 | TFrmServerMain = class(TForm)
9 | Server: TDWServer;
10 | procedure FormShow(Sender: TObject);
11 | private
12 | { private declarations }
13 | public
14 | { public declarations }
15 | end;
16 |
17 | { !!! Do Not Declare Global Variables !!! }
18 |
19 | implementation
20 | uses
21 | uWebMainForm, uDWSessionData;
22 |
23 | {$R *.dfm}
24 |
25 | procedure TFrmServerMain.FormShow(Sender: TObject);
26 | begin
27 | Server.MainForm:= TWebMainForm;
28 | Server.DocDir := Server.AppPath + 'wwwroot\';
29 | Server.LibDir := Server.AppPath + 'wwwroot\dwlib\';
30 | Server.TemplateDir := Server.AppPath + 'wwwroot\templates\';
31 | ForceDirectories(Server.AppPath + 'wwwroot');
32 | ForceDirectories(Server.AppPath + 'wwwroot\templates');
33 | Server.Start;
34 | end;
35 | end.
--------------------------------------------------------------------------------
/Demo/uWebMainForm.dfm:
--------------------------------------------------------------------------------
1 | object WebMainForm: TWebMainForm
2 | Left = 0
3 | Top = 0
4 | Width = 320
5 | Height = 240
6 | Caption = ''
7 | object DWLabel1: TDWLabel
8 | Left = 64
9 | Top = 112
10 | Width = 200
11 | Height = 25
12 | Font.Charset = DEFAULT_CHARSET
13 | Font.Color = clWindowText
14 | Font.Height = -16
15 | Font.Name = 'Tahoma'
16 | Font.Style = []
17 | ZIndex = 0
18 | TabIndex = -1
19 | TabStop = False
20 | Text = 'DWLabel1'
21 | Caption = 'Hello World
DelphiWeb'
22 | RawText = True
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/Demo/uWebMainForm.pas:
--------------------------------------------------------------------------------
1 | { DelphiWeb is an VCL internet Framework for Delphi
2 | | https://github.com/DrHank/DelphiWeb
3 | | Developped by Delcio Sbeghen @SRP Sistemas
4 | | Under MIT Licence: https://opensource.org/licenses/MIT
5 | |
6 | | Credits:
7 | | * The Server Core is based in OverByte ICS: http://www.overbyte.be/
8 | | * The Json Library is based in JsonDataObjects: https://github.com/ahausladen/JsonDataObjects
9 | |and changes by IWBootstrap Framework
10 | | * The DW VCL is based on Bootstrap Framework: https://github.com/kattunga/IWBootstrapFramework
11 | }
12 |
13 | unit uWebMainForm;
14 |
15 | interface
16 |
17 | uses
18 | DWForm, System.Classes, Vcl.Controls, DW.VCL.Control, DW.VCL.DBControl,
19 | DW.VCL.Labels;
20 | type
21 | TWebMainForm = class(TDWForm)
22 | DWLabel1: TDWLabel;
23 | private
24 | { private declarations }
25 | public
26 | { public declarations }
27 | end;
28 |
29 | { !!! Do Not Declare Global Variables !!! }
30 |
31 | implementation
32 |
33 | {$R *.dfm}
34 |
35 | end.
--------------------------------------------------------------------------------
/Include/Overbyte/Include/Ics.InterlockedApi.inc:
--------------------------------------------------------------------------------
1 | {$IFDEF CPUX64}
2 | function InterlockedIncrement(var Addend: LongInt): LongInt;
3 | asm
4 | MOV EAX,1
5 | LOCK XADD [RCX].Integer,EAX
6 | INC EAX
7 | end;
8 |
9 | {$ELSE}
10 |
11 | function InterlockedExchange(var Target: Integer; Value: Integer): Integer;
12 | asm
13 | MOV ECX,EAX
14 | MOV EAX,[ECX]
15 | LOCK XCHG [ECX],EDX
16 | end;
17 |
18 | function InterlockedExchangePointer(var Target: Pointer; Value: Pointer): Pointer;
19 | asm
20 | JMP InterlockedExchange
21 | end;
22 |
23 | function InterlockedExchangeAdd(var Addend: Integer; Increment: Integer): Integer;
24 | asm
25 | MOV ECX,EAX
26 | MOV EAX,EDX
27 | LOCK XADD [ECX],EAX
28 | end;
29 |
30 | function InterlockedAdd(var Addend: Integer; Increment: Integer): Integer;
31 | asm
32 | MOV ECX,EAX
33 | MOV EAX,EDX
34 | LOCK XADD [ECX],EAX
35 | ADD EAX,EDX
36 | end;
37 |
38 | function InterlockedIncrement(var Addend: Integer): Integer;
39 | asm
40 | MOV EDX,1
41 | JMP InterlockedAdd
42 | end;
43 |
44 | function InterlockedDecrement(var Addend: Integer): Integer;
45 | asm
46 | MOV EDX,-1
47 | JMP InterlockedAdd
48 | end;
49 |
50 | {$ENDIF CPUX86}
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Include/Overbyte/Include/OverbyteIcsDefs.inc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/Include/OverbyteIcsDefs.inc
--------------------------------------------------------------------------------
/Include/Overbyte/Include/OverbyteIcsSslDefs.inc:
--------------------------------------------------------------------------------
1 | { Uncomment next define in order to turn off version checking of OpenSSL }
2 | { library, not recommended. }
3 | {.$DEFINE NO_OSSL_VERSION_CHECK}
4 |
5 | { Comment next define in order to include Server Name Indication (SNI). }
6 | { If commented undefines "BEFORE_OSSL_098E" and sets minimum OSSL version }
7 | { to v0.9.8F. Tested with OSSL v0.9.8k and v0.9.8L, both are built including }
8 | { the TLS extensions by default. }
9 | { Angus - March 2015, no longer supporting 098 so enable by default }
10 | {.$DEFINE OPENSSL_NO_TLSEXT}
11 |
12 | { Uncommented next define will create files containing debug information if }
13 | { the OpenSSL libraries failed to load. }
14 | { File names: FailedIcsSSLEAY.txt and FailedIcsLIBEAY.txt }
15 | {.$DEFINE LOADSSL_ERROR_FILE}
16 |
17 | { Uncomment next define if OpenSSL shall use the Delphi memory manager. }
18 | { This is very useful to find memory leaks in our SSL code with a memory }
19 | { manager capable to report memory leaks such as FastMM with option }
20 | { ReportMemoryLeaksOnShutDown enabled. Note that two leaks were always }
21 | { reported on shutdown (13 - 20 bytes: Unknown x 2), those are no leaks in ICS }
22 | { but obviously in the OpenSSL libraries. }
23 | {.$DEFINE OPENSSL_USE_DELPHI_MM}
24 |
25 | { Uncomment next define to use a few custom resource strings instead of the }
26 | { OpenSSL strings. Currently only useful if localized certificate properties }
27 | { shall be displayed. }
28 | {.$DEFINE OPENSSL_USE_RESOURCE_STRINGS}
29 |
30 | { Comment next define to include experimental Engine code. }
31 | { http://openssl.org/docs/crypto/engine.html }
32 | { The default should be "OPENSSL_NO_ENGINE" it's currently very experimental }
33 | {.$DEFINE OPENSSL_NO_ENGINE}
34 |
35 | { Uncomment next define if OpenSSL needs to support the oboslete SSLv2 protocol}
36 | { OpenSSL 1.0.2g and 1.0.1s and later no longer export SSlv2 methods and will }
37 | { not load (unless special DLLs are built). }
38 | {.$DEFINE OPENSSL_ALLOW_SSLV2}
39 |
40 | { Do not modify below this line }
41 | { -----------------------------------------------------------------------------}
42 | { Angus - March 2015, no longer supporting 098 so nothing left }
43 | { Angus - June 2015, enable engine support, which are cryptographic }
44 | { modules adding extra algorithms }
45 | { Angus - March 2016, added define OPENSSL_ALLOW_SSLV2 }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Include/Overbyte/Include/OverbyteIcsZlib.inc:
--------------------------------------------------------------------------------
1 | { undefine this to use ZLIB1 DLL, define it to use C OBJ files }
2 | {$IFDEF MSWINDOWS}
3 | {$DEFINE USE_ZLIB_OBJ}
4 | {$ENDIF}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Include/Overbyte/OverByteIcsFtpSrvT.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverByteIcsFtpSrvT.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsCRC.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsCRC.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsCharsetUtils.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsCharsetUtils.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsDES.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsDES.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsDigestAuth.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsDigestAuth.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsFtpSrv.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsFtpSrv.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsFtpSrv.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsFtpSrv.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsHttpAppServer.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsHttpAppServer.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsHttpSrv.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsHttpSrv.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsHttpSrv.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsHttpSrv.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsLIBEAY.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsLIBEAY.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsLogger.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsLogger.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsLogger.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsLogger.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsMD4.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsMD4.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsMD5.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsMD5.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsMimeUtils.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsMimeUtils.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsMimeUtils.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsMimeUtils.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsNtlmMsgs.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsNtlmMsgs.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsOneTimePw.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsOneTimePw.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsSSLEAY.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsSSLEAY.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsSocketUtils.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsSocketUtils.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsThreadTimer.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsThreadTimer.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsTimeList.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsTimeList.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsTimeList.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsTimeList.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsTypes.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsTypes.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsUtils.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsUtils.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWSockBuf.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWSockBuf.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWSocket.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWSocket.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWSocket.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWSocket.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWSocketS.dcr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWSocketS.dcr
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWSocketS.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWSocketS.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWebSession.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWebSession.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWinnls.pas:
--------------------------------------------------------------------------------
1 | unit OverbyteIcsWinnls;
2 |
3 | // From Winnls.h
4 | { Normalization requires Vista+ or XP SP2 with additional install of:
5 | Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1 }
6 | {
7 | May 2012 - V8.00 - Arno added FireMonkey cross platform support with POSIX/MacOS
8 | also IPv6 support, include files now in sub-directory
9 | }
10 | {$I Include\OverbyteIcsDefs.inc}
11 |
12 | {$ALIGN ON}
13 | {$MINENUMSIZE 4}
14 | {$WEAKPACKAGEUNIT}
15 |
16 | {.$DEFINE CPP_WINHEADER_VISTA}
17 |
18 | interface
19 |
20 | {$IFDEF MSWINDOWS}
21 |
22 | uses
23 | {$IFDEF RTL_NAMESPACES}Winapi.Windows{$ELSE}Windows{$ENDIF};
24 |
25 | type
26 | //#if (WINVER >= 0x0600)
27 | {$IFDEF CPP_WINHEADER_VISTA} {$EXTERNALSYM _NORM_FORM} {$ENDIF}
28 | _NORM_FORM = (
29 | NormalizationOther,
30 | NormalizationC,
31 | NormalizationD,
32 | NormalizationKC = 5,
33 | NormalizationKD);
34 | {$IFDEF CPP_WINHEADER_VISTA} {$EXTERNALSYM NORM_FORM} {$ENDIF}
35 | NORM_FORM = _NORM_FORM;
36 | TNormForm = NORM_FORM;
37 |
38 | {$IFDEF CPP_WINHEADER_VISTA} {$EXTERNALSYM IsNormalizedString} {$ENDIF}
39 | function IsNormalizedString(NormForm: TNormForm; lpString: LPCWSTR;
40 | cwLength: Integer): BOOL; stdcall;
41 |
42 | {$IFDEF CPP_WINHEADER_VISTA} {$EXTERNALSYM NormalizeString} {$ENDIF}
43 | function NormalizeString(NormForm: TNormForm; lpSrcString: LPCWSTR;
44 | cwSrcLength: Integer; lpDstString: LPWSTR; cwDstLength: Integer): Integer; stdcall;
45 | //#endif (WINVER >= 0x0600)
46 |
47 | function LoadNormalizeLib: Boolean;
48 |
49 | {$ENDIF MSWINDOWS}
50 |
51 | implementation
52 |
53 | {$IFDEF MSWINDOWS}
54 |
55 | const
56 | LibNormaliz = 'Normaliz.dll';
57 | _IsNormalizedString : function (NormForm: TNormForm; lpString: LPCWSTR;
58 | cwLength: Integer): BOOL; stdcall = nil;
59 | _NormalizeString : function(NormForm: TNormForm; lpSrcString: LPCWSTR;
60 | cwSrcLength: Integer; lpDstString: LPWSTR; cwDstLength: Integer): Integer; stdcall = nil;
61 | var
62 | hNormaliz: THandle = 0;
63 |
64 | function LoadNormalizeLib: Boolean;
65 | begin
66 | if (@_IsNormalizedString = nil) or (@_NormalizeString = nil) then
67 | begin
68 | if hNormaliz = 0 then
69 | hNormaliz := LoadLibrary(LibNormaliz);
70 | if hNormaliz <> 0 then
71 | begin
72 | @_IsNormalizedString := GetProcAddress(hNormaliz, 'IsNormalizedString');
73 | if @_IsNormalizedString <> nil then
74 | @_NormalizeString := GetProcAddress(hNormaliz, 'NormalizeString');
75 | end;
76 | end;
77 | Result := (@_IsNormalizedString <> nil) and (@_NormalizeString <> nil);
78 | end;
79 |
80 | function IsNormalizedString(NormForm: TNormForm; lpString: LPCWSTR;
81 | cwLength: Integer): BOOL;
82 | begin
83 | if (@_IsNormalizedString = nil) then
84 | LoadNormalizeLib;
85 | Result := _IsNormalizedString(NormForm, lpString, cwLength);
86 | end;
87 |
88 | function NormalizeString(NormForm: TNormForm; lpSrcString: LPCWSTR;
89 | cwSrcLength: Integer; lpDstString: LPWSTR;
90 | cwDstLength: Integer): Integer;
91 | begin
92 | if (@_NormalizeString = nil) then
93 | LoadNormalizeLib;
94 | Result := _NormalizeString(NormForm, lpSrcString, cwSrcLength, lpDstString,
95 | cwDstLength);
96 | end;
97 |
98 | {$ENDIF MSWINDOWS}
99 | end.
100 |
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWinsock.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWinsock.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsWndControl.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsWndControl.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsZLibDll.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsZLibDll.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsZLibObj.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsZLibObj.pas
--------------------------------------------------------------------------------
/Include/Overbyte/OverbyteIcsZlibHigh.pas:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/OverbyteIcsZlibHigh.pas
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/adler32.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/adler32.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/compress.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/compress.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/crc32.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/crc32.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/deflate.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/deflate.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/infback.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/infback.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/inffast.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/inffast.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/inflate.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/inflate.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/inftrees.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/inftrees.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/trees.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/trees.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/uncompr.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/uncompr.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/adler32.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/adler32.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/compress.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/compress.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/crc32.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/crc32.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/deflate.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/deflate.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/infback.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/infback.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/inffast.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/inffast.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/inflate.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/inflate.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/inftrees.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/inftrees.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/trees.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/trees.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/uncompr.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/uncompr.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/win64/zutil.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/win64/zutil.obj
--------------------------------------------------------------------------------
/Include/Overbyte/zobj125/zutil.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EMBBlaster/DelphiWeb/c179c884b75909660be7610f0d8d76dfcf7a7e50/Include/Overbyte/zobj125/zutil.obj
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 DrHank
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Delphi-Web
2 | Delphi Web is a RAD Framework to develop Web Applications like to develop Windows Applications, using the power of VCL.
3 | Support for JQuery, Bootstrap, SEO friendly, light and powerfull. It Free and Open-Source.
4 |
5 | ## Help Please
6 | This project is under development, soon we must have a functional version.
7 |
8 | This version is an basic implementation and many bugs need to be corrected.
9 |
10 | See the Branchs for last modifications.
11 |
12 | Please help us to take this project forward.
13 |
14 |
--------------------------------------------------------------------------------
/dw.vcl.FluidForm.pas:
--------------------------------------------------------------------------------
1 | unit dw.vcl.FluidForm;
2 |
3 | interface
4 |
5 | uses
6 | System.Classes, dw.vcl.InputForm, DWTypes, DWElementTag;
7 |
8 | type
9 |
10 | TDWFormEncType = (iwbsfeDefault, iwbsfeMultipart, iwbsfeText);
11 |
12 | TDWFluidForm = class(TDWCustomInputForm)
13 | private
14 | FEncType: TDWFormEncType;
15 | FOnSubmit: TDWInputFormSubmitEvent;
16 | procedure DoSubmit(aParams: TStrings);
17 | protected
18 | procedure InternalRenderCss(var ACss: string); override;
19 | procedure InternalRenderScript(const AHTMLName: string; AScript: TStringList); override;
20 | function RenderHTML: TDWElementTag; override;
21 | function RenderAsync: TDWElementXHTMLTag; override;
22 | public
23 | constructor Create(AOwner: TComponent); override;
24 | destructor Destroy; override;
25 | function GetRoleString: string; override;
26 | published
27 | property EncType: TDWFormEncType read FEncType write FEncType default iwbsfeDefault;
28 | property OnSubmit: TDWInputFormSubmitEvent read FOnSubmit write FOnSubmit;
29 | end;
30 |
31 | implementation
32 |
33 | uses
34 | System.SysUtils, dw.vcl.Common, DWUtils;
35 |
36 | { TIWBSFluidForm }
37 |
38 | constructor TDWFluidForm.Create(AOwner: TComponent);
39 | begin
40 | inherited;
41 | FEncType := iwbsfeDefault;
42 | end;
43 |
44 | destructor TDWFluidForm.Destroy;
45 | begin
46 |
47 | inherited;
48 | end;
49 |
50 | procedure TDWFluidForm.DoSubmit(aParams: TStrings);
51 | begin
52 |
53 | if Assigned(FOnSubmit) then
54 | FOnSubmit(aParams);
55 | { TODO 1 -oDELCIO -cIMPLEMENT : Need to implement TIWBSFluidForm Submit event }
56 | // aReply.SendRedirect(aApplication.SessionInternalUrlBase);
57 | end;
58 |
59 | function TDWFluidForm.GetRoleString: string;
60 | begin
61 | Result := 'form';
62 | end;
63 |
64 | procedure TDWFluidForm.InternalRenderCss(var ACss: string);
65 | begin
66 | TDWBSCommon.AddCssClass(ACss, 'iwbs-form-fluid');
67 | end;
68 |
69 | procedure TDWFluidForm.InternalRenderScript(const AHTMLName: string; AScript: TStringList);
70 | begin
71 | inherited;
72 | if ValidationEnabled and Hasvalidator then
73 | AScript.Add('$("#' + HTMLName + '").validator(''validate'');');
74 | end;
75 |
76 | function TDWFluidForm.RenderAsync: TDWElementXHTMLTag;
77 | begin
78 | Result := inherited;
79 | if ValidationEnabled and Hasvalidator then
80 | DWApplication.CallBackResp.AddScriptToExecute
81 | ('$("#' + HTMLName + '").validator(''validate'');', False);
82 | end;
83 |
84 | function TDWFluidForm.RenderHTML: TDWElementTag;
85 | var
86 | LParentForm: TDWCustomInputForm;
87 | begin
88 | LParentForm := DWFindParentInputForm(Parent);
89 | if LParentForm <> nil then
90 | raise Exception.Create('forms can not be nested, you try to put ' + Name + ' inside ' +
91 | LParentForm.Name);
92 |
93 | Result := inherited;
94 |
95 | if ValidationEnabled and Hasvalidator then
96 | Result.AddStringParam('data-toggle', 'validator');
97 |
98 | if Assigned(FOnSubmit) then
99 | begin
100 | raise Exception.Create
101 | ('TIWBSFluidForm Submit event not implemented yet. Contribute with this.');
102 | { TODO 1 -oDELCIO -cIMPLEMENT : Need to implement TIWBSFluidForm Submit event }
103 | (* Result.AddStringParam('method', 'post');
104 | if FEncType = iwbsfeMultipart then
105 | Result.AddStringParam('enctype', 'multipart/form-data')
106 | else if FEncType = iwbsfeText then
107 | Result.AddStringParam('enctype', 'text/plain');
108 | Result.AddStringParam('action', DWApplication.RegisterCallBack( HTMLName+'.FormSubmit', DoSubmit, (FEncType = iwbsfeMultipart)));
109 | *)
110 | end
111 | else
112 | Result.AddStringParam('onSubmit', 'return FormDefaultSubmit();');
113 | end;
114 |
115 | end.
116 |
--------------------------------------------------------------------------------