Develop and Download Open Source Software

Browse CVS Repository

Annotation of /gikonavigoeson/gikonavi/HTMLCreate.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (hide annotations) (download) (as text)
Sun Nov 13 14:26:19 2005 UTC (18 years, 5 months ago) by h677
Branch: MAIN
CVS Tags: v1_51_0_617
Changes since 1.6: +4 -2 lines
File MIME type: text/x-pascal
スキンのレスの生成で、スレッドの番号を毎回求めるのを1回に抑制。

1 h677 1.1 unit HTMLCreate;
2    
3     interface
4    
5     uses
6     Windows, Messages, SysUtils, Classes, {Graphics,} Controls, {Forms,}
7     ComCtrls, IniFiles, ShellAPI, Math, GikoSystem,
8     {$IF Defined(DELPRO) }
9     SHDocVw,
10     MSHTML,
11     {$ELSE}
12     SHDocVw_TLB,
13     MSHTML_TLB,
14     {$IFEND}
15     {HttpApp,} YofUtils, {URLMon,} BoardGroup, {gzip,} {Dolib,}
16     {bmRegExp,} AbonUnit, MojuUtils, Setting,
17     ExternalBoardManager, ExternalBoardPlugInMain{,}
18     {Sort,} ,GikoBayesian;
19    
20     type
21     THTMLCreate = class(TObject)
22     private
23     { Private ?辿?転 }
24 h677 1.4 anchorLen : Integer;
25     pURLCHARs,pURLCHARe : PChar;
26     pANCHORs, pANCHORe : PChar;
27     pCTAGLs, pCTAGLe : PChar;
28     pCTAGUs, pCTAGUe : PChar;
29     pREF_MARKSs : array[0..9] of PChar;
30     pREF_MARKSe : array[0..9] of PChar;
31     constructor Create;
32    
33 h677 1.1 function AddBeProfileLink(AID : string; ANum: Integer):string ;
34     procedure CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
35     procedure CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
36     procedure CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
37     procedure CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
38 h677 1.2 function ConvertResAnchor(res: string): string;
39 h677 1.5 procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
40 h677 1.1 public
41     { Public ?辿?転 }
42 h677 1.4 function AddAnchorTag(s: string): string;
43 h677 1.2 function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
44     function SkinedRes(skin: string; Res: TResRec; No: string): string;
45     function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
46 h677 1.5 // function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
47 h677 1.1 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
48 h677 1.2 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
49 h677 1.1 end;
50    
51     var
52     HTMLCreater: THTMLCreate;
53    
54     implementation
55    
56 h677 1.4 const
57     URL_CHAR: string = '0123456789'
58     + 'abcdefghijklmnopqrstuvwxyz'
59     + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
60     + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
61     ANCHOR_REF = 'href=';
62     CLOSE_TAGAL = '</a>';
63     CLOSE_TAGAU = '</A>';
64     RES_REF = '&gt;&gt;';
65     REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
66     'ms-help://','p://', 'https://',
67     'www.', 'ftp://','news://','rtsp://');
68    
69     constructor THTMLCreate.Create;
70     var
71     j : Integer;
72     begin
73     // + 3 ?? 'href="' ('"'???鼎)???????o???G?[?V???????]?T???????邸?辿????
74     anchorLen := Length( ANCHOR_REF ) + 3;
75     pANCHORs := PChar(ANCHOR_REF);
76     pANCHORe := pANCHORs + Length(ANCHOR_REF);
77     pURLCHARs := PChar(URL_CHAR);
78     pURLCHARe := pURLCHARs + Length(URL_CHAR);
79     pCTAGLs := PChar(CLOSE_TAGAL);
80     pCTAGLe := pCTAGLs + 4;
81     pCTAGUs := PChar(CLOSE_TAGAU);
82     pCTAGUe := pCTAGUs + 4;
83     for j := 0 to 9 do begin
84     pREF_MARKSs[j] := PChar(REF_MARK[j]);
85     pREF_MARKSe[j] := pREF_MARKSs[j] + Length(REF_MARK[j]);
86     end;
87     end;
88 h677 1.1 // ?X?L?????????????A?l???u?????辿
89     function THTMLCreate.LoadFromSkin(
90     fileName: string;
91     ThreadItem: TThreadItem;
92     SizeByte: Integer
93     ): string;
94     var
95     Skin: TStringList;
96     begin
97    
98     Skin := TStringList.Create;
99     try
100     if FileExists( fileName ) then begin
101     Skin.LoadFromFile( fileName );
102    
103     // ?但???????????直???纏???A?I?v?V?????_?C?A???O???v???r???[?p try
104     try
105     if ThreadItem.ParentBoard <> nil then
106     if ThreadItem.ParentBoard.ParentCategory <> nil then
107     CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
108     CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
109     except end;
110     CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
111     CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
112     CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
113     CustomStringReplace( Skin, '<SKINPATH/>', GikoSys.Setting.CSSFileName);
114     CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
115     CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
116     CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
117    
118     CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
119     CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
120     CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
121    
122     //----- ?????????存???甜???`?直?叩?????p?B?R?????g?A?E?g?直???????直
123     // ?但???????????直???纏???A?I?v?V?????_?C?A???O???v???r???[?p try
124 h677 1.6 if GikoSys.Setting.UseKatjushaType then begin
125     try
126     if ThreadItem.ParentBoard <> nil then
127     if ThreadItem.ParentBoard.ParentCategory <> nil then
128     CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
129     CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
130     except end;
131     CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
132     CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
133     CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
134     CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);
135     CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
136     CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
137     CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
138    
139     CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
140     CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
141     CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
142     end
143 h677 1.1 //----- ???????長
144     end;
145     Result := Skin.Text;
146     finally
147     Skin.Free;
148     end;
149     end;
150    
151     // ???X???l???u?????辿
152     function THTMLCreate.SkinedRes(
153     skin: string;
154     Res: TResRec;
155     No: string
156     ): string;
157     var
158     spamminess : Extended;
159     wordCount : TWordCount;
160     begin
161    
162     wordCount := TWordCount.Create;
163     try
164     spamminess := Floor( GikoSys.SpamParse(
165     Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
166    
167     Skin := CustomStringReplace( Skin, '<NUMBER/>',
168     '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
169     Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
170     Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
171     Skin := CustomStringReplace( Skin, '<MAILNAME/>',
172     '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
173     Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
174     Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
175     Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
176     Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
177     Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
178    
179     //----- ???甜???`?直?叩?????p?B?R?????g?A?E?g?直???????直
180 h677 1.6 if GikoSys.Setting.UseKatjushaType then begin
181     Skin := CustomStringReplace( Skin, '&NUMBER',
182     '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
183     Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
184     Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
185     Skin := CustomStringReplace( Skin, '&MAILNAME',
186     '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
187     Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
188     Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
189     Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
190     Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
191     Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
192     end;
193 h677 1.1 //----- ???????長
194    
195     Result := Skin;
196     finally
197     wordCount.Free;
198     end;
199    
200     end;
201     (*************************************************************************
202     *http://??????????anchor?^?O?t?鼎?????辿?B
203     *************************************************************************)
204     function THTMLCreate.AddAnchorTag(s: string): string;
205     var
206     url: string;
207     href: string;
208     i, j, b: Integer;
209     tmp: Integer;
210     idx, idx2: Integer;
211 h677 1.4 pos : PChar;
212 h677 1.1 pp, pe : PChar;
213     begin
214     Result := '';
215 h677 1.4
216 h677 1.1 while True do begin
217     idx := MaxInt;
218     idx2 := MaxInt;
219 h677 1.4 pp := PChar(s);
220     pe := pp + Length(s);
221    
222 h677 1.1 for j := 0 to 9 do begin
223 h677 1.4 pos := AnsiStrPosEx(pp, pe, pREF_MARKSs[j], pREF_MARKSe[j]);
224     if pos <> nil then begin
225     tmp := pos - pp + 1;
226     idx := Min(tmp, idx);
227     if idx = tmp then idx2 := j; //?????}?[?N?長?????????????????徹??
228     end;
229 h677 1.1 end;
230 h677 1.4
231 h677 1.1 if idx = MaxInt then begin
232     //?????N?????????B
233     Result := Result + s;
234     Break;
235     end;
236    
237 h677 1.4 if (idx > 1) and (idx > anchorLen) and
238     (AnsiStrPosEx(pp + idx - 1 - anchorLen, pp + idx, pANCHORs, pANCHORe) <> nil) then begin
239 h677 1.1 //?哲???????N?^?O???????????辿???徹?????鼎?????V
240 h677 1.4 //</a></A>???T???A?店?????長???????巽???纏?????頂?????長????
241     pos := AnsiStrPosEx(pp + idx, pe, pCTAGLs, pCTAGLe);
242     if pos = nil then
243     pos := AnsiStrPosEx(pp + idx, pe, pCTAGUs, pCTAGUe);
244     if pos = nil then
245     b := Length(REF_MARK[idx2])
246     else
247     b := pos - pp + 1;
248 h677 1.1
249 h677 1.4 Result := Result + Copy(s, 1, idx + b);
250     Delete(s, 1, idx + b);
251 h677 1.1 Continue;
252     end;
253    
254     Result := Result + Copy(s, 1, idx - 1);
255     Delete(s, 1, idx - 1);
256     b := Length( s ) + 1;
257     pp := PChar(s);
258     for i := 1 to b do begin
259     pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
260    
261     if pe = nil then begin
262     //URL???叩?????????足???I?????A?????????足???????B
263     url := Copy(s, 1, i - 1);
264     case idx2 of
265     1 : href := 'h' + url;
266     2 : href := 'ht' + url;
267     4 : href := 'htt' + url;
268     6 : href := 'http://' + url;
269     else
270     href := url;
271     end;
272    
273     Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
274     Delete(s, 1, i - 1);
275     Break;
276     end;
277     //???????i???辿?B
278     Inc(pp);
279     end;
280     end;
281     end;
282    
283     //?????AAID?F???徹?????辿?炭?tID???????AANum:???X?? AURL?F?泥???X???b?h??URL
284     function THTMLCreate.AddBeProfileLink(AID : string; ANum: Integer):string ;
285     var
286     p : integer;
287     BNum, BMark : string;
288     begin
289     p := AnsiPos('BE:', AnsiUpperCase(AID));
290     if p > 0 then begin
291     BNum := Copy(AID, p, Length(AID));
292     AID := Copy(AID, 1, p - 1);
293     p := AnsiPos('-', BNum);
294     if p > 0 then begin
295     BMark := '?' + Trim(Copy(BNum, p + 1, Length(BNum)));
296     BNum := Copy(BNum, 1, p - 1);
297     end;
298     BNum := Trim(BNum);
299     Result := AID + ' <a href="' + BNum + '/' + IntToStr(ANum)
300     + '" target=_blank>' + BMark + '</a>';
301     end else
302     Result := AID;
303     end;
304 h677 1.5 procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
305     var
306     p : Integer;
307     begin
308     p := Pos(Separator,Text);
309     if (p > 0 ) then begin
310     st := Copy(Text, 1, p - 1);
311     et := Copy(Text, p + Length(Separator), Length(Text));
312     end else begin
313     st := Text;
314     et := Text;
315     end;
316     end;
317 h677 1.1 (*************************************************************************
318     *
319     * from HotZonu
320     *************************************************************************)
321     function THTMLCreate.ConvRes(const Body, Bbs, Key,
322     ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
323     DatToHTML: boolean = false): string;
324     const
325     GT = '&gt;';
326 h677 1.5 SN = '0123456789';
327     FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
328 h677 1.1 var
329     i : integer;
330 h677 1.5 s : string;
331 h677 1.1 sw: boolean;
332 h677 1.5 cm: boolean;
333 h677 1.1 No: string;
334     oc : string;
335 h677 1.5 pos, pmin : integer;
336     j : integer;
337     token : array[0..5] of string;
338     ch : string;
339     db : boolean;
340     len : integer;
341     rink : string;
342     function addResAnchor(const Left :string) : string;
343 h677 1.1 var
344 h677 1.5 st,et : string;
345 h677 1.1 begin
346 h677 1.5 //?I?[???長?s???????I?邸???`?F?b?N
347     if j <= len then begin
348     if db then j := j - 2
349     else j := j - 1;
350     end;
351     //?????????????????巽???????鼎
352     if No = '' then begin
353     Result := Left + Copy(s, 1, j - 1);
354     end else begin
355     separateNumber(st, et, No, '-');
356    
357     if not DatToHTML then begin
358     Result := Left + Format(FORMAT_LINK,
359     [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
360     end else begin
361     Result := Left + Format('<a href="#%s">', [st]);
362     end;
363     Result := Result + Copy(s, 1, j - 1) + '</a>';
364     end;
365     Delete(s, 1, j - 1);
366 h677 1.1 end;
367 h677 1.5
368     procedure getNumberString;
369 h677 1.1 begin
370 h677 1.5 while (j <= len) do begin
371     if (ByteType(s, j) = mbSingleByte) then begin
372     //1byte????
373     ch := s[j];
374     Inc(j);
375     db := false;
376     end else begin
377     //2byte????
378     ch := ZenToHan(Copy(s, j, 2));
379     Inc(j, 2);
380     db := true;
381 h677 1.1 end;
382 h677 1.5
383     if System.Pos(ch, SN) > 0 then begin
384     No := No + ch;
385     end else if (ch = '-') then begin
386     if sw then break;
387     if No = '' then break;
388     No := No + ch;
389     sw := true;
390     end else begin
391     break;
392 h677 1.1 end;
393     end;
394     end;
395    
396 h677 1.5 function checkComma : boolean;
397 h677 1.1 begin
398 h677 1.5 j := 1;
399     len := Length(s);
400     if ((len > 0) and (s[j] = ',')) or ((len > 1) and (ZenToHan(Copy(s, j ,2)) = ',')) then begin
401     Result := true;
402     if (ByteType(s, j) = mbSingleByte) then
403     Inc(j)
404     else
405     Inc(j, 2);
406     No := '';
407     end else begin
408     Result := false;
409 h677 1.1 end;
410     end;
411     begin
412 h677 1.5 //s ???{?????S???端???辿
413 h677 1.1 s := Body;
414 h677 1.5 //???????N???A
415     Result := '';
416     //???????徹?????????S
417     token[0] := GT + GT;
418     token[1] := GT;
419     token[2] := '????';
420     token[3] := '??';
421     token[4] := '<a ';
422     token[5] := '<A ';
423    
424     //
425     while Length(s) > 2 do begin
426     pmin := Length(s) + 1;
427     i := Length(token);
428     for j := 0 to 5 do begin
429     pos := AnsiPos(token[j], s);
430     if pos <> 0 then begin
431     if pos < pmin then begin
432     //?????長?q?b?g?直?????徹??
433     i := j;
434     //?長?店?l???X?V
435     pmin := pos;
436     end;
437     end;
438     end;
439    
440     //?q?b?g?直?????????????????O???長???????R?s?[
441     Result := Result + Copy(s, 1, pmin - 1);
442     Delete(s, 1, pmin - 1);
443    
444     if i = 6 then begin
445     //?q?b?g???直
446     end else if (i = 4) or (i = 5) then begin
447     //'<a ' or '<A' ?長?q?b?g '</a>' or '</A>' ???長?R?s?[
448     pmin := AnsiPos('</a>' , s);
449     pos := AnsiPos('</A>' , s);
450     if (pmin <> 0) and (pos <> 0) then begin
451     if (pmin > pos) then begin
452     pmin := pos;
453 h677 1.1 end;
454 h677 1.5 end else if (pos <> 0) then begin
455     pmin := pos;
456 h677 1.1 end;
457 h677 1.5 rink := Copy(s, 1, pmin + 3);
458     Result := Result + rink;
459     Delete(s, 1, pmin + 3);
460    
461     pmin := Length(rink);
462     i := Length(token);
463     for j := 0 to 3 do begin
464     pos := AnsiPos(token[j], rink);
465     if pos <> 0 then begin
466     if pos < pmin then begin
467     //?????長?q?b?g?直?????徹??
468     i := j;
469     //?長?店?l???X?V
470     pmin := pos;
471 h677 1.1 end;
472     end;
473     end;
474 h677 1.5 // ???X?A???J?[???????????????巽,?????足?????A???J?[???直???直?造
475     if i <= 3 then begin
476     No := '';
477     cm := checkComma;
478     len := Length(s);
479     while cm do begin
480     oc := '';
481     No := '';
482     sw := false;
483     db := false;
484     getNumberString;
485     Result := addResAnchor(Result);
486     cm := checkComma;
487     end;
488 h677 1.1 end;
489     end else begin
490 h677 1.5 //?????直?巽???????????p?^?[??
491     j := Length(token[i]) + 1;
492     oc := '';
493     No := '';
494     sw := false;
495     db := false;
496     len := Length(s);
497     getNumberString;
498     Result := addResAnchor(Result);
499 h677 1.1 end;
500     end;
501 h677 1.5 Result := Result + s;
502 h677 1.1 end;
503    
504 h677 1.2 function THTMLCreate.ConvertResAnchor(res: string): string;
505     const
506     _HEAD : string = '<a href="../';
507     _TAIL : string = ' target="_blank">';
508     _ST: string = '&st=';
509     _TO: string = '&to=';
510     _STA: string = '&START=';
511     _END: string = '&END=';
512     var
513     i, j, k: Integer;
514     tmp: string;
515     begin
516     Result := '';
517     i := AnsiPos(_HEAD, res);
518     while i <> 0 do begin
519     Result := Result + Copy(res, 1, i -1);
520     Delete(res, 1, i - 1);
521     j := AnsiPos(_TAIL, res);
522     if j = 0 then begin
523     Result := Result + res;
524     Exit;
525     end;
526     tmp := Copy(res, 1, j - 1);
527     Delete(res, 1, j + 16);
528     if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
529     Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
530     Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
531     Result := Result + '<a href="#' + tmp + '">';
532     end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
533     Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
534     Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
535     Result := Result + '<a href="#' + tmp + '">';
536     end else begin
537     k := LastDelimiter('/', tmp);
538     Delete(tmp, 1, k);
539     if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
540     Delete(tmp, AnsiPos('-', tmp), Length(tmp))
541     else
542     Delete(tmp, AnsiPos('"', tmp), Length(tmp));
543    
544     Result := Result + '<a href="#' + tmp + '">';
545     end;
546     i := AnsiPos(_HEAD, res);
547     end;
548     Result := Result + res;
549    
550     end;
551    
552 h677 1.1 //Plugin?????p???辿Board???X???b?h??HTML?????店?直??doc?????鼎???鄭
553     procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
554     var
555     i: integer;
556     NewReceiveNo: Integer;
557     boardPlugIn : TBoardPlugIn;
558     UserOptionalStyle: string;
559     begin
560 h677 1.6 //===== ?v???O?C???????辿?\??
561     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
562     NewReceiveNo := ThreadItem.NewReceive;
563     // ?t?H???g?但?T?C?Y??????
564     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
565     try
566     doc.open;
567     // ?w?b?_
568     doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
569     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );
570     doc.Write('<p id="idSearch"></p>' + #13#10 );
571    
572     for i := 0 to threadItem.Count - 1 do begin
573     // 1 ???K?存?\??
574     if i <> 0 then begin
575     // ?\????????????
576     case GikoSys.ResRange of
577     Ord( grrKoko ):
578     if ThreadItem.Kokomade > (i + 1) then
579     Continue;
580     Ord( grrNew ):
581     if NewReceiveNo > (i + 1) then
582     Continue;
583     10..65535:
584     if (threadItem.Count - i) > GikoSys.ResRange then
585     Continue;
586     end;
587     end;
588 h677 1.1
589 h677 1.6 // ?V???}?[?N
590     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
591     try
592     if GikoSys.Setting.UseSkin then begin
593     if FileExists( GikoSys.GetSkinNewmarkFileName ) then
594     doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
595     else
596     doc.Write( '<a name="new"></a>' + #13#10 );
597     end else if GikoSys.Setting.UseCSS then begin
598     doc.Write('<a name="new"></a><div class="new">?V?????X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);
599     end else begin
600     doc.Write('</dl>');
601     doc.Write('<a name="new"></a>');
602     doc.Write('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>?V?????X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
603     doc.Write('<dl> + #13#10');
604 h677 1.1 end;
605 h677 1.6 except
606     doc.Write( '<a name="new"></a>' + #13#10);
607     end;
608     end;
609 h677 1.1
610 h677 1.6 // ???X
611     doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );
612 h677 1.1
613 h677 1.6 if ThreadItem.Kokomade = (i + 1) then begin
614     // ???????長?????転
615     try
616     if GikoSys.Setting.UseSkin then begin
617     if FileExists( GikoSys.GetSkinBookmarkFileName ) then
618     doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
619     else
620 h677 1.1 doc.Write( '<a name="koko"></a>' + #13#10 );
621 h677 1.6 end else if GikoSys.Setting.UseCSS then begin
622     doc.Write('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' + #13#10 );
623     end else begin
624     doc.Write('</dl>');
625     doc.Write('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>?R?R???長?????転</b></font></td></tr></table>');
626     doc.Write('<dl>' + #13#10 );
627 h677 1.1 end;
628 h677 1.6 except
629     doc.Write( '<a name="koko"></a>' + #13#10 );
630 h677 1.1 end;
631 h677 1.6 end;
632     end;
633 h677 1.1
634    
635 h677 1.6 // ?X?L??(?t?b?^)
636     doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );
637     finally
638     doc.Close;
639 h677 1.1 end;
640     end;
641    
642    
643     procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
644     var
645     i: integer;
646     No: string;
647     CSSFileName: string;
648     NewReceiveNo: Integer;
649     Res: TResRec;
650     UserOptionalStyle: string;
651     SkinHeader: string;
652     SkinNewRes: string;
653     SkinRes: string;
654     strTmp : string;
655 h677 1.7 ThreadName : string;
656 h677 1.1 function ReplaceRes( skin: string ): string;
657     begin
658     Result := SkinedRes( skin, Res, No );
659     end;
660     begin
661 h677 1.6 NewReceiveNo := ThreadItem.NewReceive;
662     // ?t?H???g?但?T?C?Y??????
663     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
664     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
665 h677 1.7 ThreadName := ChangeFileExt(ThreadItem.FileName, '');
666    
667 h677 1.6 doc.open;
668     try
669     doc.charset := 'Shift_JIS';
670    
671     // ?X?L????????
672     try
673     SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
674     if Length( UserOptionalStyle ) > 0 then
675     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
676     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
677     doc.Write( SkinHeader + #13#10);
678     except
679     end;
680    
681     try
682     SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
683     except
684     end;
685    
686     try
687     SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
688     except
689     end;
690 h677 1.1
691 h677 1.6 doc.Write('<p id="idSearch"></p>' + #13#10);
692     doc.Write('<a name="top"></a>' + #13#10);
693 h677 1.1
694 h677 1.6 for i := 0 to ReadList.Count - 1 do begin
695     // 1 ???K?存?\??
696     if i <> 0 then begin
697     // ?\????????????
698     case GikoSys.ResRange of
699     Ord( grrKoko ):
700     if ThreadItem.Kokomade > (i + 1) then
701     Continue;
702     Ord( grrNew ):
703     if NewReceiveNo > (i + 1) then
704     Continue;
705     10..65535:
706     if (threadItem.Count - i) > GikoSys.ResRange then
707     Continue;
708 h677 1.1 end;
709 h677 1.6 end;
710 h677 1.1
711 h677 1.6 // ?V???}?[?N
712     if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
713 h677 1.1 try
714 h677 1.6 if FileExists( GikoSys.GetSkinNewmarkFileName ) then
715     doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10)
716     else
717     doc.Write( '<a name="new"></a>' + #13#10 );
718 h677 1.1 except
719 h677 1.6 doc.Write( '<a name="new"></a>' + #13#10 );
720 h677 1.1 end;
721 h677 1.6 end;
722 h677 1.1
723 h677 1.6 if (Trim(ReadList[i]) <> '') then begin
724     No := IntToStr(i + 1);
725 h677 1.1
726 h677 1.6 Res := DivideStrLine(ReadList[i]);
727 h677 1.7 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ThreadName, 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
728 h677 1.6 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
729 h677 1.1
730 h677 1.6 try
731     if NewReceiveNo <= (i + 1) then
732     // ?V?????X
733     strTmp := ReplaceRes( SkinNewRes )
734     else
735     // ???鱈?????X
736     strTmp := ReplaceRes( SkinRes );
737 h677 1.1
738 h677 1.6 doc.Write( strTmp + #13#10 );
739     except
740 h677 1.1 end;
741 h677 1.6 end;
742 h677 1.1
743 h677 1.6 if ThreadItem.Kokomade = (i + 1) then begin
744     // ???????長?????転
745 h677 1.1 try
746 h677 1.6 if FileExists( GikoSys.GetSkinBookmarkFileName ) then
747     doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
748     else
749     doc.Write( '<a name="koko"></a>' + #13#10 );
750 h677 1.1 except
751 h677 1.6 doc.Write( '<a name="koko"></a>' + #13#10 );
752 h677 1.1 end;
753     end;
754     end;
755 h677 1.6
756     doc.Write('<a name="bottom"></a>' + #13#10);
757     // ?X?L??(?t?b?^)
758     try
759     doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );
760     except
761     end;
762     finally
763     doc.close;
764 h677 1.1 end;
765     end;
766    
767     procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
768     var
769     i: integer;
770     No: string;
771     CSSFileName: string;
772     NewReceiveNo: Integer;
773     Res: TResRec;
774     UserOptionalStyle: string;
775     begin
776 h677 1.6 doc.open;
777     try
778     doc.charset := 'Shift_JIS';
779     NewReceiveNo := ThreadItem.NewReceive;
780     // ?t?H???g?但?T?C?Y??????
781     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
782     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
783     if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
784     //CSS?g?p
785 h677 1.1 doc.Write('<html><head>' + #13#10);
786     doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' + #13#10);
787 h677 1.6 doc.Write('<title>' + sTitle + '</title>' + #13#10);
788     doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">' + #13#10);
789     if Length( UserOptionalStyle ) > 0 then
790     doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>' + #13#10);
791     doc.Write('</head>' + #13#10);
792     doc.Write('<body>' + #13#10);
793 h677 1.1 doc.Write('<a name="top"></a>' + #13#10);
794     doc.Write('<p id="idSearch"></p>' + #13#10);
795 h677 1.6 doc.Write('<div class="title">' + sTitle + '</div>' + #13#10);
796 h677 1.1 for i := 0 to ReadList.Count - 1 do begin
797     // 1 ???K?存?\??
798     if i <> 0 then begin
799     // ?\????????????
800     case GikoSys.ResRange of
801     Ord( grrKoko ):
802     if ThreadItem.Kokomade > (i + 1) then
803     Continue;
804     Ord( grrNew ):
805     if NewReceiveNo > (i + 1) then
806     Continue;
807     10..65535:
808     if (threadItem.Count - i) > GikoSys.ResRange then
809     Continue;
810     end;
811     end;
812    
813     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
814 h677 1.6 doc.Write('<a name="new"></a><div class="new">?V?????X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);
815 h677 1.1 end;
816    
817     if (Trim(ReadList[i]) <> '') then begin
818     No := IntToStr(i + 1);
819 h677 1.3 Res := DivideStrLine(ReadList[i]);
820 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
821     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
822     if Res.FMailTo = '' then
823 h677 1.6 doc.Write('<a name="' + No + '"></a>'
824     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
825     + '<span class="name_label">?添?O?F</span> '
826     + '<span class="name"><b>' + Res.FName + '</b></span> '
827     + '<span class="date_label">???e?炭?F</span> '
828     + '<span class="date">' + Res.FDateTime+ '</span></div>'
829     + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)
830 h677 1.1 else if GikoSys.Setting.ShowMail then
831 h677 1.6 doc.Write('<a name="' + No + '"></a>'
832     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
833     + '<span class="name_label"> ?添?O?F </span>'
834     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
835     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
836     + '<span class="date_label"> ???e?炭?F</span>'
837     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
838     + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)
839 h677 1.1 else
840 h677 1.6 doc.Write('<a name="' + No + '"></a>'
841     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
842     + '<span class="name_label"> ?添?O?F </span>'
843     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
844     + '<b>' + Res.FName + '</b></a>'
845     + '<span class="date_label"> ???e?炭?F</span>'
846     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
847     + '<div class="mes">' + Res.FBody + ' </div>' + #13#10);
848 h677 1.1 end;
849 h677 1.6
850 h677 1.1 if ThreadItem.Kokomade = (i + 1) then begin
851 h677 1.6 doc.Write('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' + #13#10);
852 h677 1.1 end;
853 h677 1.6
854 h677 1.1 end;
855 h677 1.6
856 h677 1.1 doc.Write('<a name="bottom"></a>' + #13#10);
857 h677 1.6 doc.Write('<a name="last"></a>' + #13#10);
858 h677 1.1 doc.Write('</body></html>' + #13#10);
859     end;
860 h677 1.6 finally
861     doc.Close;
862     end;
863     end;
864    
865     procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
866     var
867     i: integer;
868     No: string;
869     NewReceiveNo: Integer;
870     Res: TResRec;
871     begin
872     doc.open;
873     try
874     doc.charset := 'Shift_JIS';
875     NewReceiveNo := ThreadItem.NewReceive;
876     doc.Write('<html><head>' + #13#10);
877     doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' + #13#10);
878     doc.Write('<title>' + sTitle + '</title></head>' + #13#10);
879     doc.Write('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10);
880     doc.Write('<a name="top"></a>' + #13#10);
881     doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>' + #13#10);
882     doc.Write('<dl>' + #13#10);
883     doc.Write('<p id="idSearch"></p>' + #13#10);
884     for i := 0 to ReadList.Count - 1 do begin
885     // 1 ???K?存?\??
886     if i <> 0 then begin
887     // ?\????????????
888     case GikoSys.ResRange of
889     Ord( grrKoko ):
890     if ThreadItem.Kokomade > (i + 1) then
891     Continue;
892     Ord( grrNew ):
893     if NewReceiveNo > (i + 1) then
894     Continue;
895     10..65535:
896     if (threadItem.Count - i) > GikoSys.ResRange then
897     Continue;
898     end;
899     end;
900    
901     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
902     doc.Write('</dl>' + #13#10);
903     doc.Write('<a name="new"></a>' + #13#10);
904     doc.Write('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>?V?????X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>' + #13#10);
905     doc.Write('<dl>' + #13#10);
906     end;
907    
908     if (Trim(ReadList[i]) <> '') then begin
909     No := IntToStr(i + 1);
910     Res := DivideStrLine(ReadList[i]);
911     Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
912     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
913     if Res.FMailTo = '' then
914     doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10)
915     else if GikoSys.Setting.ShowMail then
916     doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10)
917     else
918     doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10);
919     end;
920     if ThreadItem.Kokomade = (i + 1) then begin
921     doc.Write('</dl>' + #13#10);
922     doc.Write('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>?R?R???長?????転</b></font></td></tr></table>' + #13#10);
923     doc.Write('<dl>' + #13#10);
924     end;
925     end;
926     doc.Write('</dl>' + #13#10);
927     doc.Write('<a name="bottom"></a>' + #13#10);
928     doc.Write('</body></html>' + #13#10);
929     finally
930     doc.Close;
931 h677 1.1 end;
932     end;
933    
934     procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
935     var
936     ReadList: TStringList;
937     CSSFileName: string;
938     FileName: string;
939     Res: TResRec;
940 h677 1.4 {$IFDEF DEBUG}
941     st, rt: Cardinal;
942     {$ENDIF}
943 h677 1.1 begin
944 h677 1.4 {$IFDEF DEBUG}
945     Writeln('Create HTML');
946     st := GetTickCount;
947     {$ENDIF}
948 h677 1.1 if ThreadItem <> nil then begin
949     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
950     CreateUsePluginHTML(doc, ThreadItem, sTitle);
951     end else begin
952     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
953     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
954     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
955     ShortDayNames[7] := '?y';
956    
957     ReadList := TStringList.Create;
958     try
959     if ThreadItem.IsLogFile then begin
960     FileName := ThreadItem.GetThreadFileName;
961     ReadList.LoadFromFile(FileName);
962     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
963     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
964     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
965     if ThreadItem.Title = '' then begin
966 h677 1.3 Res := DivideStrLine(ReadList[0]);
967 h677 1.1 sTitle := Res.FTitle;
968     end else
969     sTitle := ThreadItem.Title
970     end else begin
971     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
972     end;
973     // ?t?H???g?但?T?C?Y??????
974     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
975     if GikoSys.Setting.UseSkin then begin
976     CreateUseSKINHTML(doc, ThreadItem, ReadList);
977     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
978     CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);
979     end else begin
980     CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);
981     end;
982     finally
983     ReadList.Free;
984     end;
985     end;
986     end;
987 h677 1.4 {$IFDEF DEBUG}
988     rt := GetTickCount - st;
989     Writeln('Done.');
990     Writeln(IntToStr(rt) + ' ms');
991     {$ENDIF}
992 h677 1.1 end;
993    
994 h677 1.2 procedure THTMLCreate.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
995     var
996     i: integer;
997     No: string;
998     //bufList : TStringList;
999     ReadList: TStringList;
1000     // SaveList: TStringList;
1001     CSSFileName: string;
1002     BBSID: string;
1003     FileName: string;
1004     Res: TResRec;
1005     boardPlugIn : TBoardPlugIn;
1006    
1007     UserOptionalStyle: string;
1008     SkinHeader: string;
1009     SkinRes: string;
1010     tmp, tmp1: string;
1011     function LoadSkin( fileName: string ): string;
1012     begin
1013     Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1014     end;
1015     function ReplaceRes( skin: string ): string;
1016     begin
1017     Result := SkinedRes( skin, Res, No );
1018     end;
1019    
1020     begin
1021     if ThreadItem <> nil then begin
1022     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1023     html.Clear;
1024     html.BeginUpdate;
1025     //if ThreadItem.IsBoardPlugInAvailable then begin
1026     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1027     //===== ?v???O?C???????辿?\??
1028     //boardPlugIn := ThreadItem.BoardPlugIn;
1029     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1030     // ?t?H???g?但?T?C?Y??????
1031     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1032     try
1033     // ?????R?[?h???v???O?C?????C?邸?辿
1034     // ?w?b?_
1035     tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1036     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1037     //?但???Q?????巽?????Q????
1038     if GikoSys.Setting.UseSkin then begin
1039     tmp1 := './' + GikoSys.Setting.CSSFileName;
1040     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1041     tmp1 := CustomStringReplace(tmp1, '\', '/');
1042     tmp := CustomStringReplace(tmp, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1043     end else if GikoSys.Setting.UseCSS then begin
1044     tmp1 := './' + CSSFileName;
1045     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1046     tmp1 := CustomStringReplace(tmp1, '\', '/');
1047     tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1048     end;
1049     html.Append( tmp );
1050    
1051     for i := 0 to threadItem.Count - 1 do begin
1052    
1053     // ???X
1054     html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1055    
1056     end;
1057     // ?X?L??(?t?b?^)
1058     html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1059     finally
1060     end;
1061     html.EndUpdate;
1062     //Exit;
1063     end else begin
1064     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
1065     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
1066     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
1067     ShortDayNames[7] := '?y';
1068     BBSID := ThreadItem.ParentBoard.BBSID;
1069     ReadList := TStringList.Create;
1070     try
1071     if ThreadItem.IsLogFile then begin
1072     FileName := ThreadItem.GetThreadFileName;
1073     ReadList.LoadFromFile(FileName);
1074     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1075     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
1076     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
1077 h677 1.3 Res := DivideStrLine(ReadList[0]);
1078 h677 1.2 //Res.FTitle := CustomStringReplace(Res.FTitle, '???M', ',');
1079     sTitle := Res.FTitle;
1080     end else begin
1081     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
1082     end;
1083     try
1084     // ?t?H???g?但?T?C?Y??????
1085     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1086    
1087     if GikoSys.Setting.UseSkin then begin
1088     // ?X?L???g?p
1089     // ?X?L????????
1090     try
1091     SkinHeader := LoadSkin( GikoSys.GetSkinHeaderFileName );
1092     if Length( UserOptionalStyle ) > 0 then
1093     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1094     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1095     //?但???Q?????巽?????Q????
1096     tmp1 := './' + GikoSys.Setting.CSSFileName;
1097     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1098     tmp1 := CustomStringReplace(tmp1, '\', '/');
1099     SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1100     html.Append( SkinHeader );
1101     except
1102     end;
1103     try
1104     SkinRes := LoadSkin( GikoSys.GetSkinResFileName );
1105     except
1106     end;
1107     html.Append('<a name="top"></a>');
1108     for i := 0 to ReadList.Count - 1 do begin
1109     if (Trim(ReadList[i]) <> '') then begin
1110     No := IntToStr(i + 1);
1111    
1112 h677 1.3 Res := DivideStrLine(ReadList[i]);
1113 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1114     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1115    
1116     try
1117     html.Append( ReplaceRes( SkinRes ) );
1118     except
1119     end;
1120     end;
1121    
1122     end;
1123     html.Append('<a name="bottom"></a>');
1124     // ?X?L??(?t?b?^)
1125     try
1126     html.Append( LoadSkin( GikoSys.GetSkinFooterFileName ) );
1127     except
1128     end;
1129     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1130     //CSS?g?p
1131     //CSSFileName := GetAppDir + CSS_FILE_NAME;
1132     html.Append('<html><head>');
1133     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1134     html.Append('<title>' + sTitle + '</title>');
1135     //?但???Q?????巽?????Q????
1136     tmp1 := './' + CSSFileName;
1137     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1138     tmp1 := CustomStringReplace(tmp1, '\', '/');
1139    
1140     html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1141     if Length( UserOptionalStyle ) > 0 then
1142     html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1143     html.Append('</head>');
1144     html.Append('<body>');
1145     html.Append('<a name="top"></a>');
1146     html.Append('<div class="title">' + sTitle + '</div>');
1147     for i := 0 to ReadList.Count - 1 do begin
1148     if (Trim(ReadList[i]) <> '') then begin
1149     No := IntToStr(i + 1);
1150 h677 1.3 Res := DivideStrLine(ReadList[i]);
1151 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1152     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1153     if Res.FMailTo = '' then
1154     html.Append('<a name="' + No + '"></a>'
1155     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1156     + '<span class="name_label">?添?O?F</span> '
1157     + '<span class="name"><b>' + Res.FName + '</b></span> '
1158     + '<span class="date_label">???e?炭?F</span> '
1159     + '<span class="date">' + Res.FDateTime+ '</span></div>'
1160     + '<div class="mes">' + Res.FBody + ' </div>')
1161     else if GikoSys.Setting.ShowMail then
1162     html.Append('<a name="' + No + '"></a>'
1163     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1164     + '<span class="name_label"> ?添?O?F </span>'
1165     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1166     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1167     + '<span class="date_label"> ???e?炭?F</span>'
1168     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1169     + '<div class="mes">' + Res.FBody + ' </div>')
1170     else
1171     html.Append('<a name="' + No + '"></a>'
1172     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1173     + '<span class="name_label"> ?添?O?F </span>'
1174     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1175     + '<b>' + Res.FName + '</b></a>'
1176     + '<span class="date_label"> ???e?炭?F</span>'
1177     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1178     + '<div class="mes">' + Res.FBody + ' </div>');
1179     end;
1180     end;
1181     html.Append('<a name="bottom"></a>');
1182     html.Append('<a name="last"></a>');
1183     html.Append('</body></html>');
1184     end else begin
1185     //CSS???g?p
1186     html.Append('<html><head>');
1187     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1188     html.Append('<title>' + sTitle + '</title></head>');
1189     html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1190     html.Append('<a name="top"></a>');
1191     html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1192     html.Append('<dl>');
1193     for i := 0 to ReadList.Count - 1 do begin
1194     if (Trim(ReadList[i]) <> '') then begin
1195     No := IntToStr(i + 1);
1196 h677 1.3 Res := DivideStrLine(ReadList[i]);
1197 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1198     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1199     if Res.FMailTo = '' then
1200     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1201     else if GikoSys.Setting.ShowMail then
1202     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1203     else
1204     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1205     end;
1206     end;
1207     html.Append('</dl>');
1208     html.Append('<a name="bottom"></a>');
1209     html.Append('</body></html>');
1210     end;
1211     finally
1212     html.EndUpdate;
1213     end;
1214     finally
1215     ReadList.Free;
1216     end;
1217     end;
1218     end;
1219     end;
1220    
1221 h677 1.1 initialization
1222     HTMLCreater := THTMLCreate.Create;
1223    
1224     finalization
1225     if HTMLCreater <> nil then begin
1226     HTMLCreater.Free;
1227     HTMLCreater := nil;
1228     end;
1229    
1230     end.

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26