• R/O
  • SSH
  • HTTPS

mantisbtmonitor: Commit


Commit MetaInfo

Revision65 (tree)
Zeit2021-11-20 06:52:14
Autorderekwildstar

Log Message

Utilização do TEdgeBrowser! Arquivos adicionais se aplicam
Início das alterações para remoção definitiva do TWebBrowser
Nova função GetCommentForEdition adicionada (contém erros)
Documentação atualizada

Ändern Zusammenfassung

Diff

--- trunk/client/prj/MantisBTMonitor.dproj (revision 64)
+++ trunk/client/prj/MantisBTMonitor.dproj (revision 65)
@@ -115,7 +115,7 @@
115115 <VerInfo_MinorVer>0</VerInfo_MinorVer>
116116 <VerInfo_Release>0</VerInfo_Release>
117117 <VerInfo_Locale>1033</VerInfo_Locale>
118- <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.11;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
118+ <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.49;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
119119 <Debugger_RunParams>/desenvolvimento</Debugger_RunParams>
120120 <VerInfo_AutoGenVersion>false</VerInfo_AutoGenVersion>
121121 <VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
@@ -122,7 +122,7 @@
122122 <DCC_DebugInformation>2</DCC_DebugInformation>
123123 <DCC_SymbolReferenceInfo>2</DCC_SymbolReferenceInfo>
124124 <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
125- <VerInfo_Build>11</VerInfo_Build>
125+ <VerInfo_Build>49</VerInfo_Build>
126126 <DCC_MapFile>3</DCC_MapFile>
127127 </PropertyGroup>
128128 <ItemGroup>
@@ -186,8 +186,7 @@
186186 <Source Name="MainSource">MantisBTMonitor.dpr</Source>
187187 </Source>
188188 <Excluded_Packages>
189- <Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
190- <Excluded_Packages Name="D:\componentesdelphi\03-Implementacao\01-Src\_BPL\d26\JvPluginSystemDesign260.bpl">JVCL Plugin Components</Excluded_Packages>
189+ <Excluded_Packages Name="D:\componentesdelphi\03-Implementacao\01-Src\_BPL\d26\KRKChromiumWindow260.bpl">KRK ChromiumWindow</Excluded_Packages>
191190 </Excluded_Packages>
192191 </Delphi.Personality>
193192 <Platforms>
--- trunk/client/src/lib/UFunctions.pas (revision 64)
+++ trunk/client/src/lib/UFunctions.pas (revision 65)
@@ -34,7 +34,7 @@
3434 procedure OpenTaskWithMantis(ATaskNumber: Cardinal);
3535 procedure SaveAttachmentDataToFile(AAttachmentData: TMemoryStream; AFileName: String; AOpen: Boolean = True);
3636 //function UploadAttachment(AIssueNumber: Cardinal; AFileName: String): Cardinal;
37-procedure LoadWebBrowserHTML(AWebBrowser: TWebBrowser; AHTML: String; ABackgroundColor: String = '#FFFFFF'; AWithTinyMCE: Boolean = False);
37+procedure LoadWebBrowserHTML(AWebBrowser: TWebBrowser; AHTML: String; ABackgroundColor: String = '#FFFFFF'{; AWithTinyMCE: Boolean = False});
3838 //procedure LoadAttachmentsCLDS(AComments: TComments; AClientDataSet: TClientDataSet);
3939 procedure LoadRelatedTasksCLDS(ARelatedTasks: TRelatedTasks; AClientDataSet: TClientDataSet);
4040 procedure LoadHistoryCLDS(AHistory: THistory; AClientDataSet: TClientDataSet);
@@ -542,7 +542,7 @@
542542 // ,FileContents);
543543 //end;
544544
545-procedure LoadWebBrowserHTML(AWebBrowser: TWebBrowser; AHTML: String; ABackgroundColor: String = '#FFFFFF'; AWithTinyMCE: Boolean = False);
545+procedure LoadWebBrowserHTML(AWebBrowser: TWebBrowser; AHTML: String; ABackgroundColor: String = '#FFFFFF'{; AWithTinyMCE: Boolean = False});
546546 //-/////////////////////////////////////////////////////////////////////////////
547547 function GetCorrectHTML(ABody: String): String;
548548 const
@@ -577,9 +577,9 @@
577577 + '<body>%s</body>'
578578 + '</html>';
579579 begin
580- if AWithTinyMCE then
581- Result := Trim(Format(HTML,[GetTinyMCEInitializationCode(TForm(AWebBrowser.Owner).Handle),ABackgroundColor,ABody]))
582- else
580+// if AWithTinyMCE then
581+// Result := Trim(Format(HTML,[GetTinyMCEInitializationCode(TForm(AWebBrowser.Owner).Handle),ABackgroundColor,ABody]))
582+// else
583583 Result := Trim(Format(HTML,['',ABackgroundColor,ABody]));
584584 end;
585585 //-/////////////////////////////////////////////////////////////////////////////
--- trunk/client/src/lib/UScrapFunctions.pas (revision 64)
+++ trunk/client/src/lib/UScrapFunctions.pas (revision 65)
@@ -224,7 +224,8 @@
224224 function AssignedTasks(AHandle: Cardinal; out ATasks: TTasks; AFullInfo: Boolean = False): Boolean;
225225 function TaskDetails(AHandle: Cardinal; var ATask: TTask): Boolean;
226226 function GetAttachmentData(AHandle: Cardinal; AId: Cardinal; out AData: TMemoryStream): Boolean;
227-function GetTinyMCEInitializationCode(AHandle: Cardinal): String;
227+function GetCommentForEdition(AHandle: Cardinal; ACommentId: Cardinal; out AComment: String): Boolean;
228+//function GetTinyMCEInitializationCode(AHandle: Cardinal): String;
228229
229230 implementation
230231
@@ -292,8 +293,8 @@
292293 begin
293294 Screen.Cursor := crHourGlass;
294295 try
295- ZeroMemory(@Req,SizeOf(Req));
296- ZeroMemory(@Res,SizeOf(Res));
296+ ZeroMemory(@Req,SizeOf(TRequestOptions));
297+ ZeroMemory(@Res,SizeOf(TResponse));
297298
298299 Req.AutoClearSSLState := True;
299300
@@ -348,8 +349,8 @@
348349 begin
349350 Screen.Cursor := crHourGlass;
350351 try
351- ZeroMemory(@Req,SizeOf(Req));
352- ZeroMemory(@Res,SizeOf(Res));
352+ ZeroMemory(@Req,SizeOf(TRequestOptions));
353+ ZeroMemory(@Res,SizeOf(TResponse));
353354 ZeroMemory(@AUserInfo,SizeOf(TUserInfo));
354355
355356 Req.AutoClearSSLState := True;
@@ -434,8 +435,8 @@
434435 begin
435436 Screen.Cursor := crHourGlass;
436437 try
437- ZeroMemory(@Req,SizeOf(Req));
438- ZeroMemory(@Res,SizeOf(Res));
438+ ZeroMemory(@Req,SizeOf(TRequestOptions));
439+ ZeroMemory(@Res,SizeOf(TResponse));
439440 ZeroMemory(@AUserInfo,SizeOf(TUserInfo));
440441
441442 Req.AutoClearSSLState := True;
@@ -504,8 +505,8 @@
504505
505506 Screen.Cursor := crHourGlass;
506507 try
507- ZeroMemory(@Req,SizeOf(Req));
508- ZeroMemory(@Res,SizeOf(Res));
508+ ZeroMemory(@Req,SizeOf(TRequestOptions));
509+ ZeroMemory(@Res,SizeOf(TResponse));
509510
510511 Req.AutoClearSSLState := True;
511512
@@ -1233,8 +1234,8 @@
12331234 begin
12341235 Screen.Cursor := crHourGlass;
12351236 try
1236- ZeroMemory(@Req,SizeOf(Req));
1237- ZeroMemory(@Res,SizeOf(Res));
1237+ ZeroMemory(@Req,SizeOf(TRequestOptions));
1238+ ZeroMemory(@Res,SizeOf(TResponse));
12381239
12391240 Req.AutoClearSSLState := True;
12401241
@@ -1362,8 +1363,8 @@
13621363 begin
13631364 Screen.Cursor := crHourGlass;
13641365 try
1365- ZeroMemory(@Req,SizeOf(Req));
1366- ZeroMemory(@Res,SizeOf(Res));
1366+ ZeroMemory(@Req,SizeOf(TRequestOptions));
1367+ ZeroMemory(@Res,SizeOf(TResponse));
13671368
13681369 Req.AutoClearSSLState := True;
13691370
@@ -1405,8 +1406,8 @@
14051406 begin
14061407 Screen.Cursor := crHourGlass;
14071408 try
1408- ZeroMemory(@Req,SizeOf(Req));
1409- ZeroMemory(@Res,SizeOf(Res));
1409+ ZeroMemory(@Req,SizeOf(TRequestOptions));
1410+ ZeroMemory(@Res,SizeOf(TResponse));
14101411
14111412 Req.AutoClearSSLState := True;
14121413
@@ -1444,6 +1445,117 @@
14441445 end;
14451446 end;
14461447
1448+{$WARN SYMBOL_PLATFORM OFF}
1449+function GetCommentForEdition(AHandle: Cardinal; ACommentId: Cardinal; out AComment: String): Boolean;
1450+var
1451+ Req: TRequestOptions;
1452+ Res: TResponse;
1453+ HTMLDocument: IHTMLdocument;
1454+begin
1455+ Screen.Cursor := crHourGlass;
1456+ try
1457+ ZeroMemory(@Req,SizeOf(TRequestOptions));
1458+ ZeroMemory(@Res,SizeOf(TResponse));
1459+ AComment := '';
1460+
1461+ Req.AutoClearSSLState := True;
1462+
1463+ Req.Content := TStringStream.Create('bugnote_id=' + ACommentId.ToString);
1464+ try
1465+ Req.InternetOpenParams.Agent := 'MantisBT Monitor';
1466+ Req.InternetOpenParams.AccessType := INTERNET_OPEN_TYPE_PRECONFIG;
1467+ Req.InternetConnectParams.ServerName := PChar(Configurations.MantisBTBaseUrl + '/mantis/bugnote_edit_page.php');
1468+ Req.InternetConnectParams.Service := INTERNET_SERVICE_HTTP;
1469+ Req.InternetConnectParams.Context := AHandle;
1470+
1471+ Req.HttpOpenRequestParams.Verb := 'POST';
1472+ Req.HttpOpenRequestParams.AcceptTypes := TStringList.Create;
1473+ try
1474+ Req.HttpOpenRequestParams.AcceptTypes.Add('*/*');
1475+ Req.HttpOpenRequestParams.Context := AHandle;
1476+ Req.HttpOpenRequestParams.AutoDetectHTTPS := True;
1477+ Req.HttpOpenRequestParams.IgnoreInvalidCertificates := True;
1478+ Req.HttpOpenRequestParams.Headers := TStringList.Create;
1479+ try
1480+ Req.HttpOpenRequestParams.Headers.Add('Content-Type: application/x-www-form-urlencoded');
1481+ Req.HttpSendRequestParams.IgnoreInvalidCertificateCA := True;
1482+
1483+ Res.Content := TStringStream.Create('',TEncoding.UTF8);
1484+ try
1485+ Request(Req,Res);
1486+
1487+ HTMLDocument := coHTMLDocument.Create as IHTMLDocument;
1488+
1489+ (HTMLDocument as IHTMLDocument2).DesignMode := 'On';
1490+ (HTMLDocument as IHTMLDocument2).charset := 'utf-8';
1491+ (HTMLDocument as IHTMLDocument2Disp).Write(TStringStream(Res.Content).DataString);
1492+ (HTMLDocument as IHTMLDocument2).Close;
1493+
1494+ AComment := ((HTMLDocument as IHTMLDocument3).getElementById('bugnote_text') as IHTMLElement).innerText;
1495+
1496+ é necessário trabalhar no innerhtml fazendo o que está explicado abaixo, provavelmente de forma invertida
1497+ existem quebras de linha fisicas 1310, que precisam ser transformadas em <br> apenas dentro de tags pre
1498+ basicamente o que deve ser feito é dentro dos pre, pegar tudo qu for quebra fisica 1310, 13 10 e converter para <BR>
1499+ (*
1500+
1501+Este texto está pré-formatado e pode ser usado para exibir qualquer texto que
1502+não pode perder'#$D#$A'seu formato, isto é, espaços em branco. Ele é renderizado
1503+em fonte monoespaçada e precisa ter'#$D#$A'quebras de linha adicionadas de forma
1504+explícita, do contrário ele pode sair do limite da'#$D#$A'tela.'#$D#$A#$D#$A'Internamente
1505+foi necessário adicionar um evento para interceptar o salvamento do texto do'#$D#$A'editor
1506+a fim de converter as quebras de html (tag BR) em simples quebras de linha físicas '#$D#$A'(caracteres
1507+0x0D 0x0A ou \r\n). Isso foi necessário porque tags BR são válidos dentro de
1508+tags'#$D#$A'PRE, mas o Mantis ignora este fato e termina por incluir quebras de
1509+linha adicionais, fazendo'#$D#$A'com que hajam duas quebras para cada linha quebrada.
1510+
1511+ let html = (new DOMParser()).parseFromString(aEventData.content,"text/html");
1512+ let pres = html.getElementsByTagName("pre");
1513+
1514+ // Protege o conteúdo dos tags preformatados convertendo
1515+ // tags br ou quebras de linha físicas por um tag
1516+ // inexistente. Após este loop apenas vão existir
1517+ // quebras de linha físicas fora de tags, as quais serão
1518+ // removidas mais adiante.
1519+ for (let pre of pres) {
1520+ pre.innerHTML = pre.innerHTML.replaceAll("<br>","[br]");
1521+ pre.innerHTML = pre.innerHTML.replaceAll("<br />","[br]");
1522+ pre.innerHTML = pre.innerHTML.replaceAll("\\r\\n","[br]");
1523+ pre.innerHTML = pre.innerHTML.replaceAll("\\r","[br]");
1524+ pre.innerHTML = pre.innerHTML.replaceAll("\\n","[br]");
1525+ }
1526+
1527+ // Serializa o html com os tags protetores
1528+ aEventData.content = html.body.innerHTML;
1529+
1530+ // Remove as quebras de linha físicas que são incluídas
1531+ // automaticamente no código html
1532+ aEventData.content = aEventData.content.replaceAll("\\r","");
1533+ aEventData.content = aEventData.content.replaceAll("\\n","");
1534+
1535+ // Substitui os tags protetores pelo seu valor real
1536+ aEventData.content = aEventData.content.replaceAll("[br]","\\n");
1537+
1538+ *)
1539+
1540+ Result := True;
1541+ finally
1542+ Res.Content.Free;
1543+ end;
1544+ finally
1545+ Req.HttpOpenRequestParams.Headers.Free;
1546+ end;
1547+ finally
1548+ Req.HttpOpenRequestParams.AcceptTypes.Free;
1549+ end;
1550+ finally
1551+ Req.Content.Free;
1552+ end;
1553+ finally
1554+ Screen.Cursor := crDefault;
1555+ end;
1556+end;
1557+{$WARN SYMBOL_PLATFORM ON}
1558+
14471559 { TUserInfo }
14481560
14491561 function TUserInfo.FirstName: String;
@@ -1633,58 +1745,58 @@
16331745 end;
16341746 end;
16351747
1636-function GetTinyMCEInitializationCode(AHandle: Cardinal): String;
1637-var
1638- Req: TRequestOptions;
1639- Res: TResponse;
1640-begin
1641- Result := '';
1748+//function GetTinyMCEInitializationCode(AHandle: Cardinal): String;
1749+//var
1750+// Req: TRequestOptions;
1751+// Res: TResponse;
1752+//begin
1753+// Result := '';
1754+//
1755+// Screen.Cursor := crHourGlass;
1756+// try
1757+// ZeroMemory(@Req,SizeOf(Req));
1758+// ZeroMemory(@Res,SizeOf(Res));
1759+//
1760+// Req.AutoClearSSLState := True;
1761+//
1762+// Req.InternetOpenParams.Agent := 'MantisBT Monitor';
1763+// Req.InternetOpenParams.AccessType := INTERNET_OPEN_TYPE_PRECONFIG;
1764+// Req.InternetConnectParams.Service := INTERNET_SERVICE_HTTP;
1765+// Req.InternetConnectParams.Context := AHandle;
1766+//
1767+// Req.HttpOpenRequestParams.Verb := 'GET';
1768+// Req.HttpOpenRequestParams.AcceptTypes := TStringList.Create;
1769+// try
1770+// Req.HttpOpenRequestParams.AcceptTypes.Add('*/*');
1771+// Req.HttpOpenRequestParams.Context := AHandle;
1772+// Req.HttpOpenRequestParams.AutoDetectHTTPS := True;
1773+// Req.HttpOpenRequestParams.IgnoreInvalidCertificates := True;
1774+// Req.HttpSendRequestParams.IgnoreInvalidCertificateCA := True;
1775+//
1776+// Req.InternetConnectParams.ServerName := PChar(Configurations.MantisBTBaseUrl + '/mantis/config/TinyMCEInitializationCode.php');
1777+// Res.Content := TStringStream.Create('',TEncoding.UTF8);
1778+// try
1779+// Request(Req,Res);
1780+//
1781+// Result := (Res.Content as TStringStream).DataString;
1782+// // O código do TinyMCE está ajustado para trabalhar dentro do Mantis e
1783+// // por isso usa caminhos relativos e absolutos de acordo com o servidor
1784+// // do Mantis. Precisamos, pois, usar caminhos absolutos sempre
1785+// Result := StringReplace(Result,'src="js/','src="' + Configurations.MantisBTBaseUrl + '/mantis/js/',[]);
1786+//
1787+// Result := StringReplace(Result,'https://desenvolvimento.tjpe.gov.br/mantis/js/tinymce/tinymce.min.js','https://cdn.tiny.cloud/1/f015pbciy4iq7tzpvossjylof3tpkcy89bmwcdkd321qfsj4/tinymce/5/tinymce.min.js',[]);
1788+//
1789+//
1790+//
1791+// finally
1792+// Res.Content.Free;
1793+// end;
1794+// finally
1795+// Req.HttpOpenRequestParams.AcceptTypes.Free;
1796+// end;
1797+// finally
1798+// Screen.Cursor := crDefault;
1799+// end;
1800+//end;
16421801
1643- Screen.Cursor := crHourGlass;
1644- try
1645- ZeroMemory(@Req,SizeOf(Req));
1646- ZeroMemory(@Res,SizeOf(Res));
1647-
1648- Req.AutoClearSSLState := True;
1649-
1650- Req.InternetOpenParams.Agent := 'MantisBT Monitor';
1651- Req.InternetOpenParams.AccessType := INTERNET_OPEN_TYPE_PRECONFIG;
1652- Req.InternetConnectParams.Service := INTERNET_SERVICE_HTTP;
1653- Req.InternetConnectParams.Context := AHandle;
1654-
1655- Req.HttpOpenRequestParams.Verb := 'GET';
1656- Req.HttpOpenRequestParams.AcceptTypes := TStringList.Create;
1657- try
1658- Req.HttpOpenRequestParams.AcceptTypes.Add('*/*');
1659- Req.HttpOpenRequestParams.Context := AHandle;
1660- Req.HttpOpenRequestParams.AutoDetectHTTPS := True;
1661- Req.HttpOpenRequestParams.IgnoreInvalidCertificates := True;
1662- Req.HttpSendRequestParams.IgnoreInvalidCertificateCA := True;
1663-
1664- Req.InternetConnectParams.ServerName := PChar(Configurations.MantisBTBaseUrl + '/mantis/config/TinyMCEInitializationCode.php');
1665- Res.Content := TStringStream.Create('',TEncoding.UTF8);
1666- try
1667- Request(Req,Res);
1668-
1669- Result := (Res.Content as TStringStream).DataString;
1670- // O código do TinyMCE está ajustado para trabalhar dentro do Mantis e
1671- // por isso usa caminhos relativos e absolutos de acordo com o servidor
1672- // do Mantis. Precisamos, pois, usar caminhos absolutos sempre
1673- Result := StringReplace(Result,'src="js/','src="' + Configurations.MantisBTBaseUrl + '/mantis/js/',[]);
1674-
1675- Result := StringReplace(Result,'https://desenvolvimento.tjpe.gov.br/mantis/js/tinymce/tinymce.min.js','https://cdn.tiny.cloud/1/f015pbciy4iq7tzpvossjylof3tpkcy89bmwcdkd321qfsj4/tinymce/5/tinymce.min.js',[]);
1676-
1677-
1678-
1679- finally
1680- Res.Content.Free;
1681- end;
1682- finally
1683- Req.HttpOpenRequestParams.AcceptTypes.Free;
1684- end;
1685- finally
1686- Screen.Cursor := crDefault;
1687- end;
1688-end;
1689-
16901802 end.
--- trunk/client/src/UFormManageNote.pas (revision 64)
+++ trunk/client/src/UFormManageNote.pas (revision 65)
@@ -5,20 +5,19 @@
55 uses
66 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
77 Dialogs, UFormBasicDialog, StdCtrls, Buttons, UPngBitBtn, ExtCtrls, PngImage,
8- Vcl.OleCtrls, SHDocVw;
8+ KRK.Internet.Edge, Winapi.ActiveX;
99
1010 type
1111 TFormManageNote = class(TFormBasicDialog)
12- WEBR: TWebBrowser;
12+ EDBR: TEdgeBrowser;
13+ procedure EDBRExecuteScript(Sender: TCustomEdgeBrowser; AResult: HRESULT; const AResultObjectAsJson: string);
14+ procedure EDBRNavigationCompleted(Sender: TCustomEdgeBrowser; IsSuccess: Boolean; WebErrorStatus: TOleEnum);
1315 procedure FormShow(Sender: TObject);
14- procedure WEBRShowScriptError(ASender: TObject; const AErrorLine,
15- AErrorCharacter, AErrorMessage, AErrorCode, AErrorUrl: OleVariant;
16- var AOut: OleVariant; var AHandled: Boolean);
16+ procedure PNBBSaveClick(Sender: TObject);
1717 private
1818 { Private declarations }
19- FTaskNumber: Cardinal;
20- FUpdating: Boolean;
2119 FCommentId: Cardinal;
20+ FComment: String;
2221 protected
2322 procedure ValidateOk; override;
2423 public
@@ -31,60 +30,81 @@
3130 {$R *.dfm}
3231
3332 uses
34- UFunctions, MSHTML;
33+ JSON, UFunctions, UScrapFunctions;
3534
36-const
37- HTML = '<form id="ManageNote" name="ManageNote"><textarea id="Comment" name="Comment">texto</textarea></form>';
38-
3935 { TFormManageNote }
4036
37+procedure TFormManageNote.EDBRExecuteScript(Sender: TCustomEdgeBrowser; AResult: HRESULT; const AResultObjectAsJson: string);
38+begin
39+ // A execução de scripts na página atual com ExecuteJavaScript retorna sempre
40+ // um JSON com dois atributos, functionName e result.
41+ if AResultObjectAsJson <> '' then
42+ with TJSONObject.ParseJSONValue(AResultObjectAsJson) do
43+ try
44+ var FunctionName: String := GetValue<String>('functionName','');
45+
46+ if FunctionName = 'getComment' then
47+ begin
48+ ShowMessage(GetValue<String>('result'));
49+ inherited ValidateOk;
50+ end
51+
52+ finally
53+ Free;
54+ end;
55+end;
56+
57+procedure TFormManageNote.EDBRNavigationCompleted(Sender: TCustomEdgeBrowser; IsSuccess: Boolean; WebErrorStatus: TOleEnum);
58+begin
59+ inherited;
60+ EDBR.ExecuteScript('setComment("' + FComment + '")');
61+end;
62+
4163 procedure TFormManageNote.FormShow(Sender: TObject);
4264 begin
4365 inherited;
44- WEBR.Navigate2('http://desenvolvimento.tjpe.gov.br/mantis/config/TinyMCEEditor.php');
45-// LoadWebBrowserHTML(WEBR,HTML,'#FFFFFF',True);
46-// WEBR.
66+ EDBR.Navigate('http://desenvolvimento.tjpe.gov.br/mantis/config/TinyMCEEditor.php');
4767 end;
4868
69+procedure TFormManageNote.PNBBSaveClick(Sender: TObject);
70+begin
71+// inherited;
72+ EDBR.ExecuteScript('setComment("' + FComment + '")');
73+end;
74+
4975 class function TFormManageNote.ShowMeModal(AOwner: TComponent; ATaskNumber, ACommentId: Cardinal): TModalResult;
5076 begin
5177 with Self.Create(AOwner) do
5278 begin
53- FTaskNumber := ATaskNumber;
5479 FCommentId := ACommentId;
55- FUpdating := ACommentId > 0;
80+ FComment := '';
5681
5782 AutoCaption := False;
5883
5984 Caption := 'Gerenciador de anotações - ' + Application.Title;
6085
61- if FUpdating then
86+ if ACommentId > 0 then
6287 LABECaption.Caption := 'Editando a anotação #' + IntToStr(FCommentId)
6388 else
64- LABECaption.Caption := 'Redigindo uma nova anotação para a tarefa #' + IntToStr(FTaskNumber);
65-
66- Result := ShowModal;
89+ LABECaption.Caption := 'Redigindo uma nova anotação para a tarefa #' + IntToStr(ATaskNumber);
90+
91+ if (ACommentId > 0) and not GetCommentForEdition(Handle,FCommentId,FComment) then
92+ begin
93+ Application.MessageBox('Não foi possível obter o comentário para edição. Por favor, tente novamente!','Erro ao obter o comentário',MB_ICONERROR);
94+ Result := mrAbort;
95+ end
96+ else
97+ begin
98+ FComment := StringReplace(FComment,#13#10,'<br>',[rfReplaceAll]);
99+ FComment := StringReplace(FComment,'"','\"',[rfReplaceAll]);
100+ Result := ShowModal;
101+ end;
67102 end;
68103 end;
69104
70105 procedure TFormManageNote.ValidateOk;
71-var
72- HTMLDocument: IHTMLDocument;
73- HTMLTextAreaElement: IHTMLTextAreaElement;
74106 begin
75- HTMLDocument := WEBR.Document as IHTMLDocument;
76- HTMLTextAreaElement := (HTMLDocument as IHTMLDocument3).getElementById('Comment') as IHTMLTextAreaElement;
77- ShowMessage(HTMLTextAreaElement.value);
78-
79- inherited;
107+ EDBR.ExecuteScript('getComment()');
80108 end;
81109
82-procedure TFormManageNote.WEBRShowScriptError(ASender: TObject;
83- const AErrorLine, AErrorCharacter, AErrorMessage, AErrorCode,
84- AErrorUrl: OleVariant; var AOut: OleVariant; var AHandled: Boolean);
85-begin
86- inherited;
87- ShowMessage('erro de script!');
88-end;
89-
90110 end.
--- trunk/client/src/UFormTask.pas (revision 64)
+++ trunk/client/src/UFormTask.pas (revision 65)
@@ -348,7 +348,17 @@
348348 procedure TFormTask.WEBRCommentsBeforeNavigate2(ASender: TObject; const pDisp: IDispatch; const URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool);
349349 begin
350350 inherited;
351+ // no tedgebrowser use OnNavigationStart
352+{
353+ Args.ArgsInterface.Get_uri(URI);
351354
355+ if Pos('zettaomnis',URI) > 0 then
356+ begin
357+ ShowMessage('xx');
358+ Args.ArgsInterface.Set_Cancel(1);
359+ end;
360+
361+}
352362 if Pos('about:/EditNote',URL) = 1 then
353363 begin
354364 Cancel := True;
Show on old repository browser