-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneralwebsiteunit1.pas
387 lines (320 loc) · 11.4 KB
/
generalwebsiteunit1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
{==============================================================================}
{ Copyright (c) 2010, 2011, 2012 by Donald R. Ziesig. All Rights Reserved. }
{==============================================================================}
{ This file is part of MagicWebsiteBuilder. }
{ }
{ MagicWebsiteBuilder is free software: you can redistribute it and/or modify }
{ it under the terms of the GNU General Public License as published by }
{ the Free Software Foundation, either version 3 of the License, or }
{ (at your option) any later version. }
{ }
{ MagicWebsiteBuilder is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the }
{ GNU General Public License for more details. }
{ }
{ You should have received a copy of the GNU General Public License }
{ along with MagicWebsiteBuilder in file COPYING. If not, see }
{ <http://www.gnu.org/licenses/>. }
{==============================================================================}
unit GeneralWebsiteUnit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
Persists1, TextIO1, WebsiteRootUnit1;
type
{ TGeneralWebsiteData }
TGeneralWebsiteData = class( TWebsiteRoot )
private
procedure SetClientName(const AValue: String);
procedure SetCopyrightInitialYear(const AValue: Integer);
procedure SetCopyrightBy(const AValue: String);
procedure SetCustomizationLink(const AValue: String);
procedure SetDefaultTitle(const AValue: String);
procedure SetHoverBackgroundColor(const AValue: Integer);
procedure SetHoverForegroundColor(const AValue: Integer);
procedure SetIDXURL(const AValue: String);
procedure SetLinkForegroundColor(const AValue: Integer);
procedure setNoHostURL(const AValue: String);
procedure SetPoint2URL(const AValue: String);
procedure SetWolfnetURL(const AValue: string);
procedure SetZHouseURL(const AValue: String);
protected
fTestMode : Boolean;
fClientName : String;
fPoint2URL : String;
fIDXURL : String;
fWolfnetURL : String;
fZHouseURL : String;
fNoHostURL : String;
fCustomizationLink : string;
fLinkForegroundColor : Integer;
fHoverForegroundColor : Integer;
fHoverBackgroundColor : Integer;
fDefaultTitle : String;
fCopyrightInitialYear : Integer;
fCopyrightBy : String;
protected
function GetCopyrightYears : String;
function GetClientName : String;
function GetCopyrightBy : String;
function GetPoint2URL : String;
function GetIDXURL : String;
function GetWolfnetURL : String;
function GetZHouseURL : String;
function GetNoHostURL : String;
function GetCustomizationLink : String;
function GetLinkForegroundColor : String;
function GetHoverForegroundColor : String;
function GetHoverBackgroundColor : String;
function GetDefaultTitle : String;
function GetUpdateDate : String;
function GetName : String;
function DeployBaseURL : String;
function DeployURL : String;
function TopImageCSS : String;
public
constructor Create( AParent : TPersists = nil ); override;
procedure BuildVarlist;
procedure MakeNew; override;
procedure Save( TextIO : TTextIO ); override;
procedure Read( TextIO : TTextIO; Version : Integer ); override;
property TestMode : Boolean read fTestMode write fTestMode;
property ClientName : String read fClientName write SetClientName;
property Point2URL : String read fPoint2URL write SetPoint2URL;
property IDXURL : String read fIDXURL write SetIDXURL;
property WolfnetURL : string read fWolfnetURL write SetWolfnetURL;
property ZHouseURL : String read fZHouseURL write SetZHouseURL;
property NoHostURL : String read fNoHostURL write setNoHostURL;
property CustomizationLink : String read fCustomizationLink write SetCustomizationLink;
property LinkForegroundColor : Integer read fLinkForegroundColor write SetLinkForegroundColor;
property HoverForegroundColor : Integer read fHoverForegroundColor write SetHoverForegroundColor;
property HoverBackgroundColor : Integer read fHoverBackgroundColor write SetHoverBackgroundColor;
property DefaultTitle : String read fDefaultTitle write SetDefaultTitle;
property CopyrightInitialYear : Integer read fCopyrightInitialYear write SetCopyrightInitialYear;
property CopyrightBy : String read fCopyrightBy write SetCopyrightBy;
end;
implementation
uses
ObjectFactory1, NamedFunctionUnit1, Common1;
{ TGeneralWebsiteData }
const
Version = 1;
procedure TGeneralWebsiteData.SetClientName(const AValue: String);
begin
Update(fClientName,AValue);
end;
procedure TGeneralWebsiteData.SetCopyrightInitialYear(const AValue: Integer);
begin
Update(fCopyrightInitialYear,AValue);
end;
procedure TGeneralWebsiteData.SetCopyrightBy(const AValue: String);
begin
Update(fCopyrightBy,AValue);
end;
procedure TGeneralWebsiteData.SetCustomizationLink(const AValue: String);
begin
Update(fCustomizationLink,AValue);
end;
procedure TGeneralWebsiteData.SetDefaultTitle(const AValue: String);
begin
Update(fDefaultTitle,AValue);
end;
procedure TGeneralWebsiteData.SetHoverBackgroundColor(const AValue: Integer);
begin
Update(fHoverBackgroundColor,AValue);
end;
procedure TGeneralWebsiteData.SetHoverForegroundColor(const AValue: Integer);
begin
Update(fHoverForegroundColor,AValue);
end;
procedure TGeneralWebsiteData.SetIDXURL(const AValue: String);
begin
Update(fIDXURL,AValue);
end;
procedure TGeneralWebsiteData.SetLinkForegroundColor(const AValue: Integer);
begin
Update(fLinkForegroundColor,AValue);
end;
procedure TGeneralWebsiteData.setNoHostURL(const AValue: String);
begin
Update(fNoHostURL,AValue);
end;
procedure TGeneralWebsiteData.SetPoint2URL(const AValue: String);
begin
Update(fPoint2URL,AValue);
end;
procedure TGeneralWebsiteData.SetWolfnetURL(const AValue: string);
begin
Update(fWolfnetURL,AValue);
end;
procedure TGeneralWebsiteData.SetZHouseURL(const AValue: String);
begin
Update(fZHouseURL,AValue);
end;
function TGeneralWebsiteData.TopImageCSS: String;
begin
Result := ''; { TODO 1 -odonz : Implement this correctly. Needs to look at the images unit to see if the top image has been loaded. }
end;
function TGeneralWebsiteData.GetCopyrightYears: String;
begin
result := IntToStr( fCopyrightInitialYear );
end;
function TGeneralWebsiteData.GetClientName: String;
begin
Result := fClientName;
end;
function TGeneralWebsiteData.GetCopyrightBy: String;
begin
Result := fCopyrightBy;
end;
function TGeneralWebsiteData.GetPoint2URL: String;
begin
Result := fPoint2URL;
end;
function TGeneralWebsiteData.GetIDXURL: String;
begin
Result := fIDXURL;
end;
function TGeneralWebsiteData.GetWolfnetURL: String;
begin
Result := fWolfnetURL;
end;
function TGeneralWebsiteData.GetZHouseURL: String;
begin
Result := fZHouseURL;
end;
function TGeneralWebsiteData.GetNoHostURL: String;
begin
Result := fNoHostURL;
end;
function TGeneralWebsiteData.GetCustomizationLink: String;
begin
Result := fCustomizationLink;
end;
function TGeneralWebsiteData.GetLinkForegroundColor: String;
begin
Result := CSSColor(ColorSwap(fLinkForegroundColor));
end;
function TGeneralWebsiteData.GetHoverForegroundColor: String;
begin
Result := CSSColor(ColorSwap(fHoverForegroundColor));
end;
function TGeneralWebsiteData.GetHoverBackgroundColor: String;
begin
Result := CSSColor(ColorSwap(fHoverBackgroundColor));
end;
function TGeneralWebsiteData.GetDefaultTitle: String;
begin
Result := fDefaultTitle;
end;
function TGeneralWebsiteData.GetUpdateDate: String;
begin
Result := DateTimeToStr(Now);
end;
function TGeneralWebsiteData.GetName: String;
begin
Result := Name;
end;
constructor TGeneralWebsiteData.Create(AParent : TPersists = nil);
begin
inherited Create(AParent);
BuildVarlist;
end;
function TGeneralWebsiteData.DeployBaseURL: String;
begin
if TestMode then
Result := ''
else
Result := 'http://www.customizewebsite.com/' +'/';
end;
function TGeneralWebsiteData.DeployURL: String;
begin
if TestMode then
Result := ''
else
Result := 'http://customizewebsite.com/' + Name +'/';
end;
procedure TGeneralWebsiteData.BuildVarlist;
begin
inherited;
VarList.AddFunction('CopyrightYears',@GetCopyrightYears);
VarList.AddFunction('CopyrightBy',@GetCopyrightBy);
VarList.AddFunction('ClientName',@GetClientName);
VarList.AddFunction('TCWCustomizationLink',@getCustomizationLink);
VarList.AddFunction('CustomizationLinkColor',@GetLinkForegroundColor);
VarList.AddFunction('CustomizationLinkHoverColor',@GetHoverForegroundColor);
VarList.AddFunction('CustomizationLinkHoverBackground',@GetHoverBackgroundColor);
VarList.AddFunction('Title',@GetDefaultTitle);
VarList.AddFunction('IDXRootURL',@GetIDXURL);
VarList.AddFunction('UpdateDate',@GetUpdateDate);
VarList.AddFunction('DeployBaseURL',@DeployBaseURL);
VarList.AddFunction('DeployURL',@DeployURL);
VarList.AddFunction('TopImageCSS',@TopImageCSS);
end;
procedure TGeneralWebsiteData.MakeNew;
begin
inherited MakeNew;
fClientName := 'A Client';
fPoint2URL := 'Point2';
fIDXURL := 'IDX';
fWolfnetURL := 'Wolfnet';
fZHouseURL := 'ZHouse';
fNoHostURL := '#';
fCustomizationLink := '/* None Specified */';
fLinkForegroundColor := $FFFFFF;
fHoverForegroundColor := $000000;
fHoverBackgroundColor := $ffffff;
fDefaultTitle := 'Default Title';
fCopyrightInitialYear := 2012;
fCopyrightBy := 'The Customized Website';
fTestMode := True; // LOOK HERE
end;
procedure TGeneralWebsiteData.Save(TextIO: TTextIO);
begin
SaveHeader( TextIO, Version );
TextIO.WriteLn(fClientName);
TextIO.WriteLN(fPoint2URL);
TextIO.WriteLn(fIDXURL);
TextIO.Writeln(fWolfnetURL);
TextIO.Writeln(fZHouseURL);
TextIO.Writeln(fNoHostURL);
TextIO.Writeln(fCustomizationLink);
TextIO.Writeln(fLinkForegroundColor);
TextIO.Writeln(fHoverForegroundColor);
TextIO.Writeln(fHoverBackgroundColor);
TextIO.Writeln(fDefaultTitle);
TextIO.Writeln(fCopyrightInitialYear);
TextIO.Writeln(fCopyrightBy);
UNMODIFY;
SaveTrailer( TextIO );
end;
procedure TGeneralWebsiteData.Read( TextIO : TTextIO; Version : Integer );
begin
MakeNew;
if Version >= 1 then
begin
TextIO.ReadLn(fClientName);
TextIO.ReadLn(fPoint2URL);
TextIO.ReadLn(fIDXURL);
TextIO.ReadLn(fWolfnetURL);
TextIO.ReadLn(fZHouseURL);
TextIO.ReadLn(fNoHostURL);
TextIO.ReadLn(fCustomizationLink);
TextIO.ReadLn(fLinkForegroundColor);
TextIO.ReadLn(fHoverForegroundColor);
TextIO.ReadLn(fHoverBackgroundColor);
TextIO.ReadLn(fDefaultTitle);
TextIO.ReadLn(fCopyrightInitialYear);
TextIO.ReadLn(fCopyrightBy);
end;
end;
//function TGeneralWebsiteData.Find(Variable: String; var GotIt: Boolean
// ): String;
//begin
// GotIt := VarList.Execute( Result, Variable);
//end;
initialization
ObjectFactory.RegisterClass( TGeneralWebsiteData.ClassType );
end.