From db65996bc8f5c000d72050bb6f8cae61d1b9fb8e Mon Sep 17 00:00:00 2001 From: h677 Date: Wed, 16 Aug 2006 02:22:33 +0000 Subject: [PATCH] =?utf8?q?Samba=E5=AF=BE=E7=AD=96=E3=81=8C=EF=BC=8C?= =?utf8?q?=E8=A8=AD=E5=AE=9A=E5=80=A40=E7=A7=92=E3=81=A0=E3=81=A8=E4=BD=9C?= =?utf8?q?=E5=8B=95=E3=81=97=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7=E5=90=88?= =?utf8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=80=82=20=E3=83=AC=E3=82=B9?= =?utf8?q?=E3=82=A8=E3=83=87=E3=82=A3=E3=82=BF=E3=81=AE=E3=83=97=E3=83=AC?= =?utf8?q?=E3=83=93=E3=83=A5=E3=83=BC=E7=94=A8HTML=E4=BD=9C=E6=88=90?= =?utf8?q?=E3=82=92THTMLCreate=E3=81=AB=E7=A7=BB=E8=A1=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Editor.pas | 64 +++++++++++++---------------------------------------- HTMLCreate.pas | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 49 deletions(-) diff --git a/Editor.pas b/Editor.pas index a50a3ae..ac53180 100644 --- a/Editor.pas +++ b/Editor.pas @@ -12,7 +12,7 @@ uses SHDocVw_TLB, MSHTML_TLB, {$IFEND} - ActiveX, {HTTPApp,} YofUtils, Trip, IniFiles, StrUtils, + ActiveX, {HTTPApp,} YofUtils, IniFiles, StrUtils, GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept, @@ -210,7 +210,6 @@ type FResistWords: TStringList; ///< “ü—̓AƒVƒXƒg‚ÌŽ«‘‚©‚ç‚ÌŒŸõŒ‹‰Ê FSambaTimer: TSambaTimer; ///< Samba‘΍ô‚̃^ƒCƒ}[ procedure Preview; - function RepHtml(s: string): string; function Check: Boolean; procedure SetNameList(sName, sMail: string); procedure Send(ACOOKIE: string; SPID: string; PON: string; FirstWriting: Boolean); @@ -264,7 +263,7 @@ implementation uses Giko, ItemDownload, MojuUtils, IdGlobal, GikoMessage, Imm, - InputAssistDataModule, InputAssist; + InputAssistDataModule, InputAssist, HTMLCreate; const CAPTION_NAME_NEW: string = 'ƒMƒRƒiƒr ƒXƒŒ—§‚ăGƒfƒBƒ^'; CAPTION_NAME_RES: string = 'ƒMƒRƒiƒr ƒŒƒXƒGƒfƒBƒ^'; @@ -451,7 +450,7 @@ begin SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0; TitlePanel.Visible := True; - if (FSambaTimer.SetBoard(FBoard) > 0) then begin + if (FSambaTimer.SetBoard(FBoard) >= 0) then begin UpdateSambaStatus; FNow := Now(); FSambaTimer.OnTimer := SambaTimer; @@ -470,7 +469,7 @@ begin SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0; TitlePanel.Visible := False; - if (FSambaTimer.SetBoard(FThreadItem.ParentBoard) > 0) then begin + if (FSambaTimer.SetBoard(FThreadItem.ParentBoard) >= 0) then begin UpdateSambaStatus; FNow := Now(); FSambaTimer.OnTimer := SambaTimer; @@ -573,65 +572,32 @@ var No: string; Mail: string; Namae: string; - DateTime: string; Body: string; s: string; - - posTrip : Integer; - tripOrigin : string; begin if FThreadItem = nil then begin No := '1'; - Title := RepHtml(TitleEdit.Text); + Title := THTMLCreate.RepHtml(TitleEdit.Text); end else begin No := IntToStr(FThreadItem.Count + 1); - Title := RepHtml(FThreadItem.Title); + Title := THTMLCreate.RepHtml(FThreadItem.Title); end; - body := GetBody; - Namae := RepHtml(NameComboBox.Text); - Mail := RepHtml(MailComboBox.Text); - Body := RepHtml(body); - Body := StringReplace(Body, #13#10, '
', [rfReplaceAll]); - DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now); + Body := GetBody; + Namae := THTMLCreate.RepHtml(NameComboBox.Text); + Mail := THTMLCreate.RepHtml(MailComboBox.Text); + Body := THTMLCreate.RepHtml(Body); + Body := CustomStringReplace(Body, #13#10, '
', False); + if Trim(Namae) = '' then Namae := '–¼–³‚µ‚³‚ñ'; - s := '' + #13#10 - + '' + #13#10 - + '' + title + '' + #13#10 -// + '' + #13#10 - + '' + #13#10 - + '' + #13#10 - + '' + title + '' + #13#10 - + '
' + #13#10; - posTrip := AnsiPos( '#', Namae ); - if posTrip > 0 then - begin - tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) ); - Namae := - Copy( Namae, 1, posTrip - 1 ) + ' Ÿ' + - get_2ch_trip( PChar( tripOrigin ) ) + ''; - end; - if Mail = '' then - s := s + '
' + No + ' F ' + Namae + ' F ' + DateTime+ '
' + Body + '


' + #13#10 - else - s := s + '
' + No + ' F ' + Namae + ' [' + Mail + ']F ' + DateTime+ '
' + Body + '


' + #13#10; - s := s + ''; + s := THTMLCreate.CreatePreviewHTML(Title, No, Mail, Namae, Body); + SetContent(s, Browser); end; -function TEditorForm.RepHtml(s: string): string; -begin -// s := StringReplace(s, '&', '&', [rfReplaceAll]); - s := CustomStringReplace(s, '<', '<'); - s := CustomStringReplace(s, '>', '>'); -// s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //Žd—l•ÏX‚É‚æ‚è Žg—p•s‰Â - s := CustomStringReplace(s, '"', '"'); - Result := s; -end; - procedure TEditorForm.EditorPageChange(Sender: TObject); var tmpBoard: TBoard; @@ -842,7 +808,7 @@ var begin FAbort := False; State := gdsError; - Namae := RepHtml(NameComboBox.Text); + Namae := THTMLCreate.RepHtml(NameComboBox.Text); if FThreadItem = nil then Board := FBoard else diff --git a/HTMLCreate.pas b/HTMLCreate.pas index 57f658c..ff690d9 100644 --- a/HTMLCreate.pas +++ b/HTMLCreate.pas @@ -86,6 +86,11 @@ type class procedure DivideStrLine(Line: string; PRes: PResRec); //HTML‚©‚烊ƒ“ƒNƒ^ƒO‚ðíœ‚·‚é class function DeleteLink(const s: string): string; + //HTML‚̃{ƒfƒB‚É‹–‚³‚ê‚镶Žš—ñ‚É’uŠ·‚·‚é + class function RepHtml(const s: string): string; + //ƒŒƒXƒGƒfƒBƒ^‚̃vƒŒƒrƒ…[—pHTML‚ðì¬‚·‚é + class function CreatePreviewHTML(const Title: string; const No: string; + const Mail: string; const Namae: string; const Body: string ) : string; end; var @@ -93,6 +98,9 @@ var implementation +uses + Trip; + const URL_CHAR: string = '0123456789' + 'abcdefghijklmnopqrstuvwxyz' @@ -1546,7 +1554,69 @@ begin inc(i, 2); end; end; +{ +\brief HTML‰»‚Ì‚½‚ß‚Ì’uŠ· +\param s Œ³‚ɂȂ镶Žš—ñ +\return HTML‚ÌinnerText‚Æ‚µ‚Ä‚ä‚邳‚ê‚镶Žš—ñ +} +class function THTMLCreate.RepHtml(const s: string): string; +begin +// s := StringReplace(s, '&', '&', [rfReplaceAll]); + Result := s; + Result := CustomStringReplace(Result, '<', '<'); + Result := CustomStringReplace(Result, '>', '>'); +// s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //Žd—l•ÏX‚É‚æ‚è Žg—p•s‰Â + Result := CustomStringReplace(Result, '"', '"'); +end; +{ +\brief ƒŒƒXƒGƒfƒBƒ^‚ł̃vƒŒƒrƒ…[—pHTMLì¬ +\param Title ƒXƒŒƒbƒhƒ^ƒCƒgƒ‹ +\param No ƒŒƒX”ԍ† +\param Mail ƒ[ƒ‹—“ +\param Name –¼‘O—“ +\param Body –{•¶ +\return ƒvƒŒƒrƒ…[—pHTML +} +class function THTMLCreate.CreatePreviewHTML( + const Title: string; + const No: string; + const Mail: string; + const Namae: string; + const Body: string +) : string; +var + posTrip : Integer; + tripOrigin : string; + NameWithTrip: string; + DateTime: string; +begin + Result := ''#13#10 + + ''#13#10 + + '' + title + ''#13#10 + + ''#13#10 + + ''#13#10 + + '' + title + ''#13#10 + + '
'#13#10; + + DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', Now()); + + NameWithTrip := Namae; + posTrip := AnsiPos( '#', Namae ); + if posTrip > 0 then begin + tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) ); + NameWithTrip := Copy( Namae, 1, posTrip - 1 ) + ' Ÿ' + + get_2ch_trip( PChar( tripOrigin ) ) + ''; + end; + if Mail = '' then begin + Result := Result + '
' + No + ' F ' + NameWithTrip + + ' F ' + DateTime+ '
' + Body + '


' + #13#10 + end else begin + Result := Result + '
' + No + ' F ' + NameWithTrip + + ' [' + Mail + ']F ' + DateTime+ '
' + Body + '


' + #13#10; + end; + Result := Result + ''; +end; constructor TBufferedWebBrowser.Create(Browser: TWebBrowser; BuffSize: Integer); begin inherited Create; -- 2.11.0