| 9 |
IWContainer, IWHTMLContainer, IWHTML40Container, IWRegion, IWDBStdCtrls, |
IWContainer, IWHTMLContainer, IWHTML40Container, IWRegion, IWDBStdCtrls, |
| 10 |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompLabel, |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompLabel, |
| 11 |
IWCompGrids, IWCompText, IWCompTabControl, IWCompButton, IWCompEdit, |
IWCompGrids, IWCompText, IWCompTabControl, IWCompButton, IWCompEdit, |
| 12 |
IWHTMLControls, IWCompExtCtrls, UserSessionUnit, PngImage, Data.DB, |
IWHTMLControls, IWCompExtCtrls, PngImage, Data.DB, |
| 13 |
IWCompListbox, IWBaseComponent, IWBaseHTMLComponent, IWBaseHTML40Component, |
IWCompListbox, IWBaseComponent, IWBaseHTMLComponent, IWBaseHTML40Component, |
| 14 |
IWCompMenu, Vcl.Menus, System.Variants; |
IWCompMenu, Vcl.Menus, System.Variants, Vcl.Dialogs, System.UITypes, Unit8; |
| 15 |
|
|
| 16 |
type |
type |
| 17 |
TIWForm1 = class(TIWAppForm) |
TIWForm1 = class(TIWAppForm) |
|
IWFrame1: TIWFrame1; |
|
| 18 |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
| 19 |
IWLabel1: TIWLabel; |
IWLabel1: TIWLabel; |
| 20 |
IWDBLabel1: TIWDBLabel; |
IWDBLabel1: TIWDBLabel; |
| 39 |
IWLabel8: TIWLabel; |
IWLabel8: TIWLabel; |
| 40 |
IWList2: TIWList; |
IWList2: TIWList; |
| 41 |
IWLabel4: TIWLabel; |
IWLabel4: TIWLabel; |
|
IWImageFile1: TIWImageFile; |
|
| 42 |
IWRegion7: TIWRegion; |
IWRegion7: TIWRegion; |
| 43 |
IWLabel5: TIWLabel; |
IWLabel5: TIWLabel; |
| 44 |
IWLabel6: TIWLabel; |
IWLabel6: TIWLabel; |
| 45 |
IWList3: TIWList; |
IWList3: TIWList; |
| 46 |
|
IWImage1: TIWImage; |
| 47 |
|
IWFrame8: TIWFrame8; |
| 48 |
|
IWLink4: TIWLink; |
| 49 |
|
IWLink3: TIWLink; |
| 50 |
|
IWLink5: TIWLink; |
| 51 |
|
IWFrame1: TIWFrame1; |
| 52 |
|
IWLink6: TIWLink; |
| 53 |
|
IWLink7: TIWLink; |
| 54 |
procedure IWAppFormRender(Sender: TObject); |
procedure IWAppFormRender(Sender: TObject); |
| 55 |
procedure IWLink2Click(Sender: TObject); |
procedure IWLink2Click(Sender: TObject); |
| 56 |
procedure IWAppFormCreate(Sender: TObject); |
procedure IWAppFormCreate(Sender: TObject); |
| 57 |
procedure IWButton1Click(Sender: TObject); |
procedure IWButton1Click(Sender: TObject); |
| 58 |
procedure IWLink1Click(Sender: TObject); |
procedure IWLink1Click(Sender: TObject); |
| 59 |
|
procedure IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer); |
| 60 |
|
procedure IWFrame8IWButton1Click(Sender: TObject); |
| 61 |
|
procedure IWFrame8IWLink1Click(Sender: TObject); |
| 62 |
|
procedure IWLink4Click(Sender: TObject); |
| 63 |
|
procedure IWLink3Click(Sender: TObject); |
| 64 |
|
procedure IWLink5Click(Sender: TObject); |
| 65 |
|
procedure IWLink6Click(Sender: TObject); |
| 66 |
private |
private |
| 67 |
function GetPage: TPage; |
Filter: Boolean; |
| 68 |
procedure SetPage(const Value: TPage); |
function GetPage: Boolean; |
| 69 |
|
procedure SetPage(const Value: Boolean); |
| 70 |
procedure LoadImage; |
procedure LoadImage; |
| 71 |
procedure ClearImage; |
procedure ClearImage; |
| 72 |
|
function GetThumbnail: Boolean; |
| 73 |
|
procedure CallBack(EventParams: TStringList); |
| 74 |
|
procedure SetThumbnail(const Value: Boolean); |
| 75 |
public |
public |
| 76 |
property Page: TPage read GetPage write SetPage; |
property Page: Boolean read GetPage write SetPage; |
| 77 |
|
property Thumbnail: Boolean read GetThumbnail write SetThumbnail; |
| 78 |
end; |
end; |
| 79 |
|
|
| 80 |
|
var |
| 81 |
|
IWForm1: TIWForm1; |
| 82 |
|
|
| 83 |
implementation |
implementation |
| 84 |
|
|
| 85 |
{$R *.dfm} |
{$R *.dfm} |
| 86 |
|
|
| 87 |
uses Unit3, ServerController, Unit6; |
uses Unit3, ServerController, Unit6, Unit4, Unit9, Unit10, Unit5, Unit11; |
| 88 |
|
|
| 89 |
|
procedure TIWForm1.CallBack(EventParams: TStringList); |
| 90 |
|
begin |
| 91 |
|
if SameText(EventParams.Values['RetValue'], 'true') = true then |
| 92 |
|
TCartForm.Create(WebApplication).Show; |
| 93 |
|
IWFrame8.IWEdit1.Text := '0'; |
| 94 |
|
end; |
| 95 |
|
|
| 96 |
procedure TIWForm1.ClearImage; |
procedure TIWForm1.ClearImage; |
| 97 |
var |
var |
| 101 |
for i := 0 to IWGrid1.RowCount - 1 do |
for i := 0 to IWGrid1.RowCount - 1 do |
| 102 |
for j := 0 to IWGrid1.ColumnCount - 1 do |
for j := 0 to IWGrid1.ColumnCount - 1 do |
| 103 |
IWGrid1.Cell[i, j].Control.Free; |
IWGrid1.Cell[i, j].Control.Free; |
| 104 |
|
IWGrid1.RowCount := 0; |
| 105 |
end; |
end; |
| 106 |
|
|
| 107 |
function TIWForm1.GetPage: TPage; |
function TIWForm1.GetPage: Boolean; |
| 108 |
begin |
begin |
| 109 |
result := UserSession.FPage; |
result := UserSession.FPage; |
| 110 |
end; |
end; |
| 111 |
|
|
| 112 |
|
function TIWForm1.GetThumbnail: Boolean; |
| 113 |
|
begin |
| 114 |
|
result := UserSession.FThumbnail; |
| 115 |
|
end; |
| 116 |
|
|
| 117 |
procedure TIWForm1.IWAppFormCreate(Sender: TObject); |
procedure TIWForm1.IWAppFormCreate(Sender: TObject); |
| 118 |
const |
const |
| 119 |
i = 120; |
i = 120; |
| 120 |
var |
var |
| 121 |
s: Integer; |
s: Integer; |
| 122 |
begin |
begin |
| 123 |
|
IWForm1 := Self; |
| 124 |
Page := UserSession.FPage; |
Page := UserSession.FPage; |
| 125 |
|
Thumbnail := UserSession.FThumbnail; |
| 126 |
s := DM.FDTable3.FieldByName('BGCOLOR').AsInteger; |
s := DM.FDTable3.FieldByName('BGCOLOR').AsInteger; |
| 127 |
IWLabel2.BGColor := s; |
IWLabel2.BGColor := s; |
| 128 |
IWLabel3.BGColor := s; |
IWLabel3.BGColor := s; |
| 135 |
IWRegion5.Width := i; |
IWRegion5.Width := i; |
| 136 |
IWRegion6.Width := i; |
IWRegion6.Width := i; |
| 137 |
IWRegion7.Width := i; |
IWRegion7.Width := i; |
| 138 |
|
WebApplication.RegisterCallBack('callback', CallBack); |
| 139 |
end; |
end; |
| 140 |
|
|
| 141 |
procedure TIWForm1.IWAppFormRender(Sender: TObject); |
procedure TIWForm1.IWAppFormRender(Sender: TObject); |
| 196 |
IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')'; |
IWList1.Items[i] := IWList1.Items.Names[i] + '(' + s + ')'; |
| 197 |
end; |
end; |
| 198 |
IWList2.Items.Clear; |
IWList2.Items.Clear; |
| 199 |
if Page = TPage.Info then |
with DM.FDQuery1 do |
| 200 |
begin |
begin |
| 201 |
with DM.FDQuery1 do |
SQL.Clear; |
| 202 |
|
SQL.Add('select volume,name,price from cart_data,item_data'); |
| 203 |
|
SQL.Add(' where cart_data.serial = item_data.serial'); |
| 204 |
|
SQL.Add(' and number = :num;'); |
| 205 |
|
ParamByName('num').AsInteger := UserSession.user_number; |
| 206 |
|
Open; |
| 207 |
|
First; |
| 208 |
|
i := 0; |
| 209 |
|
while Eof = false do |
| 210 |
begin |
begin |
| 211 |
SQL.Clear; |
s := Fields.Fields[0].AsString + 'x' + Fields.Fields[1].AsString; |
| 212 |
SQL.Add('select volume,name,price from cart_data join item_data'); |
i := i + Fields.Fields[0].AsInteger * Fields.Fields[2].AsInteger; |
| 213 |
SQL.Add(' on (cart_data.serial = item_data.serial)'); |
IWList2.Items.Add(s); |
| 214 |
SQL.Add(' where number = :num;'); |
Next; |
| 215 |
Params.ParamByName('num').AsInteger := UserSession.user_number; |
end; |
| 216 |
Open; |
IWList2.Items.Add(i.ToString + '円'); |
| 217 |
First; |
Close; |
| 218 |
i := 0; |
IWList3.Items.Clear; |
| 219 |
while Eof = false do |
SQL.Clear; |
| 220 |
begin |
SQL.Add('select name from recent_data,item_data'); |
| 221 |
s := Fields.Fields[0].AsString + 'x' + Fields.Fields[1].AsString; |
SQL.Add(' where recent_data.serial = item_data.serial'); |
| 222 |
i := i + Fields.Fields[0].AsInteger * Fields.Fields[2].AsInteger; |
SQL.Add(' and number = :num;'); |
| 223 |
IWList2.Items.Add(s); |
ParamByName('num').AsInteger := UserSession.user_number; |
| 224 |
Next; |
Open; |
| 225 |
end; |
First; |
| 226 |
IWList2.Items.Add(i.ToString + '円'); |
while Eof = false do |
| 227 |
Close; |
begin |
| 228 |
IWList3.Items.Clear; |
IWList3.Items.Add(Fields.Fields[0].AsString); |
| 229 |
SQL.Clear; |
Next; |
|
SQL.Add('select name from recent_data join item_data'); |
|
|
SQL.Add(' on (recent_data.serial = item_data.serial)'); |
|
|
SQL.Add(' where number = :num;'); |
|
|
Params.ParamByName('num').AsInteger := UserSession.user_number; |
|
|
Open; |
|
|
First; |
|
|
while Eof = false do |
|
|
begin |
|
|
IWList3.Items.Add(Fields.Fields[0].AsString); |
|
|
Next; |
|
|
end; |
|
|
Close; |
|
| 230 |
end; |
end; |
| 231 |
|
Close; |
| 232 |
end; |
end; |
| 233 |
LoadImage; |
LoadImage; |
| 234 |
IWLabel6.Visible:=DM.FDTable2.Filtered; |
if IWGrid1.Visible = true then |
| 235 |
|
IWLabel6.Visible := Filter |
| 236 |
|
else |
| 237 |
|
DM.FDTable2.Locate('SERIAL',UserSession.Serial); |
| 238 |
end; |
end; |
| 239 |
|
|
| 240 |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
procedure TIWForm1.IWButton1Click(Sender: TObject); |
| 241 |
|
var |
| 242 |
|
i: Integer; |
| 243 |
begin |
begin |
| 244 |
DM.FDTable2.Filtered := false; |
IWFrame8IWLink1Click(Sender); |
| 245 |
if IWEdit1.Text <> '' then |
if IWEdit1.Text <> '' then |
| 246 |
begin |
begin |
| 247 |
DM.FDTable2.Filter := 'NAME like ' + QuotedStr('%' + IWEdit1.Text + '%'); |
DM.FDTable2.Filter := 'NAME like ' + QuotedStr('%' + IWEdit1.Text + '%'); |
| 248 |
DM.FDTable2.Filtered := true; |
DM.FDTable2.Filtered := true; |
| 249 |
IWLabel6.Caption := IWEdit1.Text + 'を検索しています'; |
i := DM.FDTable2.RecordCount; |
| 250 |
|
IWLabel6.Caption := Format(IWEdit1.Text + 'を検索しています:%d件', [i]); |
| 251 |
|
if i = 0 then |
| 252 |
|
DM.FDTable2.Filtered := false; |
| 253 |
|
Filter := true; |
| 254 |
|
end |
| 255 |
|
else |
| 256 |
|
begin |
| 257 |
|
DM.FDTable2.Filtered := false; |
| 258 |
|
Filter := false; |
| 259 |
|
end; |
| 260 |
|
end; |
| 261 |
|
|
| 262 |
|
procedure TIWForm1.IWFrame8IWButton1Click(Sender: TObject); |
| 263 |
|
var |
| 264 |
|
i, j: Integer; |
| 265 |
|
s: string; |
| 266 |
|
begin |
| 267 |
|
if TryStrToInt(IWFrame8.IWEdit1.Text, i) = false then |
| 268 |
|
begin |
| 269 |
|
WebApplication.ShowMessage('個数が不正です'); |
| 270 |
|
Exit; |
| 271 |
|
end; |
| 272 |
|
if i = 0 then |
| 273 |
|
begin |
| 274 |
|
WebApplication.ShowMessage('1個以上のご注文が必要です'); |
| 275 |
|
Exit; |
| 276 |
|
end; |
| 277 |
|
s := WebApplication.Request.CookieFields.Values['user_cookie']; |
| 278 |
|
if s = '' then |
| 279 |
|
begin |
| 280 |
|
DM.FDTable1.Last; |
| 281 |
|
j := DM.FDTable1.FieldByName('NUMBER').AsInteger + 1; |
| 282 |
|
while DM.FDTable1.Lookup('NUMBER', j, 'NUMBER') = j do |
| 283 |
|
inc(j); |
| 284 |
|
UserSession.user_number := j; |
| 285 |
|
DM.FDTable1.AppendRecord([nil, nil, nil, nil, nil, nil, |
| 286 |
|
UserSession.user_number, Date]); |
| 287 |
|
WebApplication.Response.Cookies.AddCookie('user_cookie', |
| 288 |
|
UserSession.user_number.ToString, '/', Date + 10); |
| 289 |
|
end; |
| 290 |
|
with DM.FDQuery1 do |
| 291 |
|
begin |
| 292 |
|
Open('select * from cart_data;'); |
| 293 |
|
if Locate('NUMBER;SERIAL', VarArrayOf([UserSession.user_number, |
| 294 |
|
UserSession.Serial]), []) = true then |
| 295 |
|
begin |
| 296 |
|
Edit; |
| 297 |
|
FieldByName('VOLUME').AsInteger := FieldByName('VOLUME').AsInteger + i; |
| 298 |
|
Post; |
| 299 |
|
end |
| 300 |
|
else |
| 301 |
|
AppendRecord([nil, i, UserSession.user_number, UserSession.Serial]); |
| 302 |
end; |
end; |
| 303 |
IWLabel6.Visible := DM.FDTable2.Filtered; |
WebApplication.ShowConfirm('カートに移動しますか', 'callback', '移動', 'はい', 'いいえ'); |
| 304 |
|
end; |
| 305 |
|
|
| 306 |
|
procedure TIWForm1.IWFrame8IWLink1Click(Sender: TObject); |
| 307 |
|
begin |
| 308 |
|
Thumbnail := true; |
| 309 |
|
end; |
| 310 |
|
|
| 311 |
|
procedure TIWForm1.IWGrid1CellClick(ASender: TObject; |
| 312 |
|
const ARow, AColumn: Integer); |
| 313 |
|
begin |
| 314 |
|
Thumbnail := false; |
| 315 |
|
UserSession.Serial := Integer(IWGrid1.Cell[ARow, AColumn].Tag); |
| 316 |
end; |
end; |
| 317 |
|
|
| 318 |
procedure TIWForm1.IWLink1Click(Sender: TObject); |
procedure TIWForm1.IWLink1Click(Sender: TObject); |
| 321 |
end; |
end; |
| 322 |
|
|
| 323 |
procedure TIWForm1.IWLink2Click(Sender: TObject); |
procedure TIWForm1.IWLink2Click(Sender: TObject); |
| 324 |
|
var |
| 325 |
|
i: Integer; |
| 326 |
begin |
begin |
| 327 |
case Page of |
if Page = true then |
| 328 |
Main: |
begin |
| 329 |
|
i := UserSession.user_number; |
| 330 |
|
if (DM.FDTable1.Locate('EMAIL;PASSWORD', |
| 331 |
|
VarArrayOf([IWEdit2.Text, UserSession.hash(IWEdit3.Text)]), |
| 332 |
|
[loCaseInsensitive]) = true) and |
| 333 |
|
(DM.FDTable1.FieldByName('EMAIL').AsString <> '') then |
| 334 |
|
begin |
| 335 |
|
IWEdit2.Text := ''; |
| 336 |
|
UserSession.user_number := DM.FDTable1.FieldByName('NUMBER').AsInteger; |
| 337 |
|
if i <> 0 then |
| 338 |
begin |
begin |
| 339 |
if DM.FDTable1.Locate('EMAIL;PASSWORD', |
with DM.FDQuery1 do |
|
VarArrayOf([IWEdit2.Text, IWEdit3.Text]), [loCaseInsensitive]) = true |
|
|
then |
|
| 340 |
begin |
begin |
| 341 |
Page := Info; |
Open('select * from user_data where number = :num', [i]); |
| 342 |
UserSession.user_number := DM.FDTable1.FieldByName('NUMBER') |
Delete; |
| 343 |
.AsInteger; |
Open('select number from cart_data where number = :num;', [i]); |
| 344 |
IWEdit2.Text := ''; |
First; |
| 345 |
|
while Eof = false do |
| 346 |
|
begin |
| 347 |
|
Edit; |
| 348 |
|
FieldByName('number').AsInteger := UserSession.user_number; |
| 349 |
|
Next; |
| 350 |
|
end; |
| 351 |
end; |
end; |
|
IWEdit3.Text := ''; |
|
|
end; |
|
|
Info: |
|
|
begin |
|
|
DM.FDTable1.Filtered := false; |
|
|
Page := Main; |
|
| 352 |
end; |
end; |
| 353 |
|
Page := false; |
| 354 |
|
end; |
| 355 |
|
IWEdit3.Text := ''; |
| 356 |
|
end |
| 357 |
|
else |
| 358 |
|
Page := true; |
| 359 |
|
end; |
| 360 |
|
|
| 361 |
|
procedure TIWForm1.IWLink3Click(Sender: TObject); |
| 362 |
|
begin |
| 363 |
|
with TMyPage.Create(WebApplication) do |
| 364 |
|
begin |
| 365 |
|
Form := Self; |
| 366 |
|
Show; |
| 367 |
end; |
end; |
| 368 |
end; |
end; |
| 369 |
|
|
| 370 |
|
procedure TIWForm1.IWLink4Click(Sender: TObject); |
| 371 |
|
begin |
| 372 |
|
TCartForm.Create(WebApplication).Show; |
| 373 |
|
end; |
| 374 |
|
|
| 375 |
|
procedure TIWForm1.IWLink5Click(Sender: TObject); |
| 376 |
|
begin |
| 377 |
|
TIWForm10.Create(WebApplication).Show; |
| 378 |
|
end; |
| 379 |
|
|
| 380 |
|
procedure TIWForm1.IWLink6Click(Sender: TObject); |
| 381 |
|
begin |
| 382 |
|
Page := true; |
| 383 |
|
if Sender = IWLink6 then |
| 384 |
|
TAdminPage.Create(WebApplication).Show |
| 385 |
|
else |
| 386 |
|
TAdminFile.Create(WebApplication).Show; |
| 387 |
|
end; |
| 388 |
|
|
| 389 |
procedure TIWForm1.LoadImage; |
procedure TIWForm1.LoadImage; |
| 390 |
var |
var |
| 391 |
s: TStream; |
s: TStream; |
| 392 |
png: TPngImage; |
png: TPngImage; |
| 393 |
pic: TIWImageFile; |
pic: TIWImage; |
| 394 |
i: Integer; |
i: Integer; |
| 395 |
j: Integer; |
j: Integer; |
| 396 |
k: Integer; |
t: string; |
| 397 |
label label1; |
label label1; |
| 398 |
begin |
begin |
| 399 |
ClearImage; |
ClearImage; |
| 400 |
png := TPngImage.Create; |
png := TPngImage.Create; |
| 401 |
try |
try |
| 402 |
IWGrid1.RowCount := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
if Thumbnail = true then |
| 403 |
k := 1; |
begin |
| 404 |
for i := 0 to IWGrid1.RowCount - 1 do |
i := DM.FDTable2.RecordCount div IWGrid1.ColumnCount; |
| 405 |
for j := 0 to IWGrid1.ColumnCount - 1 do |
if DM.FDTable2.RecordCount mod IWGrid1.ColumnCount > 0 then |
| 406 |
|
inc(i); |
| 407 |
|
IWGrid1.RowCount := i; |
| 408 |
|
if DM.FDTable2.Filtered = false then |
| 409 |
|
DM.FDTable2.Last |
| 410 |
|
else |
| 411 |
|
DM.FDTable2.FindLast; |
| 412 |
|
for i := 0 to IWGrid1.RowCount - 1 do |
| 413 |
|
for j := 0 to IWGrid1.ColumnCount - 1 do |
| 414 |
|
begin |
| 415 |
|
if DM.FDTable2.Filtered = false then |
| 416 |
|
begin |
| 417 |
|
if DM.FDTable2.Bof = true then |
| 418 |
|
goto label1; |
| 419 |
|
end |
| 420 |
|
else if DM.FDTable2.Found = false then |
| 421 |
|
goto label1; |
| 422 |
|
if DM.FDTable2.FieldByName('THUMBNAIL').IsNull = false then |
| 423 |
|
begin |
| 424 |
|
s := DM.FDTable2.CreateBlobStream |
| 425 |
|
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
| 426 |
|
try |
| 427 |
|
png.LoadFromStream(s); |
| 428 |
|
finally |
| 429 |
|
s.Free; |
| 430 |
|
end; |
| 431 |
|
pic := TIWImage.Create(IWGrid1); |
| 432 |
|
pic.Picture.Assign(png); |
| 433 |
|
IWGrid1.Cell[i, j].Control := pic; |
| 434 |
|
end; |
| 435 |
|
t := DM.FDTable2.FieldByName('NAME').AsString; |
| 436 |
|
if Length(t) > 10 then |
| 437 |
|
t := Copy(t, 1, 8) + '..'; |
| 438 |
|
IWGrid1.Cell[i, j].Tag := |
| 439 |
|
Pointer(DM.FDTable2.FieldByName('SERIAL').AsInteger); |
| 440 |
|
IWGrid1.Cell[i, j].Text := t; |
| 441 |
|
IWGrid1.Cell[i, j].Alignment := taCenter; |
| 442 |
|
IWGrid1.Cell[i, j].Clickable := true; |
| 443 |
|
if DM.FDTable2.Filtered = false then |
| 444 |
|
DM.FDTable2.Prior |
| 445 |
|
else |
| 446 |
|
DM.FDTable2.FindPrior; |
| 447 |
|
end; |
| 448 |
|
label1: |
| 449 |
|
end |
| 450 |
|
else if DM.FDTable2.Locate('SERIAL', UserSession.Serial, []) = true then |
| 451 |
|
if DM.FDTable2.FieldByName('IMAGE').IsNull = false then |
| 452 |
begin |
begin |
|
if DM.FDTable2.FieldByName('THUMBNAIL') = nil then |
|
|
continue; |
|
| 453 |
s := DM.FDTable2.CreateBlobStream |
s := DM.FDTable2.CreateBlobStream |
| 454 |
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
(DM.FDTable2.FieldByName('IMAGE'), bmRead); |
| 455 |
try |
try |
| 456 |
png.LoadFromStream(s); |
png.LoadFromStream(s); |
|
pic := TIWImageFile.Create(IWGrid1); |
|
|
pic.Picture.Assign(png); |
|
|
IWGrid1.Cell[i, j].Control := pic; |
|
|
IWGrid1.Cell[i, j].Text := k.ToString; |
|
|
inc(k); |
|
| 457 |
finally |
finally |
| 458 |
s.Free; |
s.Free; |
| 459 |
end; |
end; |
| 460 |
if DM.FDTable2.Bof = true then |
IWFrame8.IWImage1.Picture.Assign(png); |
| 461 |
goto label1; |
end |
| 462 |
end; |
else |
| 463 |
label1: |
IWFrame8.IWImage1.Picture.Assign(nil); |
| 464 |
finally |
finally |
| 465 |
png.Free; |
png.Free; |
| 466 |
end; |
end; |
|
png := nil; |
|
|
s := nil; |
|
| 467 |
Randomize; |
Randomize; |
| 468 |
DM.FDTable2.Last; |
DM.FDTableView.Filter := 'DATE > '+QuotedStr(DateTimeToStr(Date-10)); |
| 469 |
DM.FDTable2.MoveBy(-Random(DM.FDTable2.RecordCount div 5)); |
DM.FDTableView.First; |
| 470 |
if DM.FDTable2.FieldByName('THUMBNAIL') <> nil then |
DM.FDTableView.MoveBy(Random(DM.FDTableView.RecordCount)); |
| 471 |
|
if DM.FDTableView.FieldByName('THUMBNAIL').IsNull = false then |
| 472 |
begin |
begin |
| 473 |
s := DM.FDTable2.CreateBlobStream |
s := DM.FDTableView.CreateBlobStream |
| 474 |
(DM.FDTable2.FieldByName('THUMBNAIL'), bmRead); |
(DM.FDTableView.FieldByName('THUMBNAIL'), bmRead); |
| 475 |
png := TPngImage.Create; |
png := TPngImage.Create; |
| 476 |
try |
try |
| 477 |
png.LoadFromStream(s); |
png.LoadFromStream(s); |
| 478 |
IWImageFile1.Picture.Assign(png); |
IWImage1.Picture.Assign(png); |
| 479 |
finally |
finally |
| 480 |
png.Free; |
png.Free; |
| 481 |
s.Free; |
s.Free; |
| 482 |
end; |
end; |
| 483 |
end; |
end; |
| 484 |
IWLabel4.Caption := DM.FDTable2.FieldByName('NAME').AsString; |
IWLabel4.Caption := DM.FDTableView.FieldByName('NAME').AsString; |
| 485 |
end; |
end; |
| 486 |
|
|
| 487 |
procedure TIWForm1.SetPage(const Value: TPage); |
procedure TIWForm1.SetPage(const Value: Boolean); |
|
var |
|
|
x: Boolean; |
|
| 488 |
begin |
begin |
| 489 |
UserSession.FPage := Value; |
UserSession.FPage := Value; |
| 490 |
x := Value = Info; |
IWRegion7.Visible := not Value; |
| 491 |
IWRegion7.Visible := x; |
IWDBLabel1.Visible := not Value; |
| 492 |
IWDBLabel1.Visible := x; |
IWLink3.Visible := not Value; |
| 493 |
IWLink1.Visible := not x; |
IWLink1.Visible := Value; |
| 494 |
IWText1.Visible := not x; |
IWText1.Visible := Value; |
| 495 |
if x = true then |
if Value = false then |
| 496 |
begin |
begin |
| 497 |
IWLabel1.Caption := 'ようこそ'; |
IWLabel1.Caption := 'ようこそ'; |
| 498 |
IWLink2.Caption := 'ログアウト'; |
IWLink2.Caption := 'ログアウト'; |
| 499 |
|
WebApplication.Response.Cookies.AddCookie('user_cookie', |
| 500 |
|
UserSession.user_number.ToString, '/', Date + 10); |
| 501 |
end |
end |
| 502 |
else |
else |
| 503 |
begin |
begin |
| 504 |
IWLabel1.Caption := 'ようこそゲスト様'; |
IWLabel1.Caption := 'ようこそゲスト様'; |
| 505 |
IWLink2.Caption := 'ログイン'; |
IWLink2.Caption := 'ログイン'; |
| 506 |
|
Thumbnail := true; |
| 507 |
|
IWText1.Text := ''; |
| 508 |
|
DM.FDTable2.Filtered := false; |
| 509 |
|
Filter := false; |
| 510 |
|
if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then |
| 511 |
|
begin |
| 512 |
|
WebApplication.Response.Cookies.AddCookie('user_cookie', '0', '/', |
| 513 |
|
Date - 1); |
| 514 |
|
UserSession.user_number := 0; |
| 515 |
|
end; |
| 516 |
end; |
end; |
| 517 |
end; |
end; |
| 518 |
|
|
| 519 |
|
procedure TIWForm1.SetThumbnail(const Value: Boolean); |
| 520 |
|
begin |
| 521 |
|
UserSession.FThumbnail := Value; |
| 522 |
|
IWGrid1.Visible := Value; |
| 523 |
|
IWFrame8.Visible := not Value; |
| 524 |
|
end; |
| 525 |
|
|
| 526 |
initialization |
initialization |
| 527 |
|
|
| 528 |
TIWForm1.SetAsMainForm; |
TIWForm1.SetAsMainForm; |