Revision | 33 (tree) |
---|---|
Zeit | 2017-09-29 06:22:45 |
Autor | derekwildstar |
- Ajustes no sistema de navegação de notas
@@ -150,7 +150,7 @@ | ||
150 | 150 | <VersionInfo Name="MajorVer">1</VersionInfo> |
151 | 151 | <VersionInfo Name="MinorVer">2</VersionInfo> |
152 | 152 | <VersionInfo Name="Release">3</VersionInfo> |
153 | - <VersionInfo Name="Build">798</VersionInfo> | |
153 | + <VersionInfo Name="Build">833</VersionInfo> | |
154 | 154 | <VersionInfo Name="Debug">False</VersionInfo> |
155 | 155 | <VersionInfo Name="PreRelease">False</VersionInfo> |
156 | 156 | <VersionInfo Name="Special">False</VersionInfo> |
@@ -162,7 +162,7 @@ | ||
162 | 162 | <VersionInfoKeys> |
163 | 163 | <VersionInfoKeys Name="CompanyName"></VersionInfoKeys> |
164 | 164 | <VersionInfoKeys Name="FileDescription"></VersionInfoKeys> |
165 | - <VersionInfoKeys Name="FileVersion">1.2.3.798</VersionInfoKeys> | |
165 | + <VersionInfoKeys Name="FileVersion">1.2.3.833</VersionInfoKeys> | |
166 | 166 | <VersionInfoKeys Name="InternalName"></VersionInfoKeys> |
167 | 167 | <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys> |
168 | 168 | <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys> |
@@ -3,7 +3,7 @@ | ||
3 | 3 | interface |
4 | 4 | |
5 | 5 | uses |
6 | - SHDocVw; | |
6 | + SHDocVw, DBClient; | |
7 | 7 | |
8 | 8 | type |
9 | 9 | TIssueInfo = record |
@@ -24,6 +24,7 @@ | ||
24 | 24 | procedure DownloadAttachment(AAttachmentId: Cardinal; AFileName: String; AOpen: Boolean = True); |
25 | 25 | function UploadAttachment(AIssueNumber: Cardinal; AFileName: String): Cardinal; |
26 | 26 | procedure LoadWebBrowserHTML(AWebBrowser: TWebBrowser; AText: String; ADecode: Boolean = False); |
27 | +procedure GenerateSimpleComments(AWebBrowser: TWebBrowser; AClientDataSet: TClientDataSet); | |
27 | 28 | |
28 | 29 | implementation |
29 | 30 |
@@ -142,7 +143,7 @@ | ||
142 | 143 | + '</html>'; |
143 | 144 | begin |
144 | 145 | if ADeCode then |
145 | - ABody := StringReplace(DecodeString(ABody),#13#10,'<br>',[rfReplaceAll]) | |
146 | + ABody := StringReplace(UTF8Decode(DecodeString(ABody)),#13#10,'<br>',[rfReplaceAll]) | |
146 | 147 | else |
147 | 148 | ABody := StringReplace(ABody,#13#10,'<br>',[rfReplaceAll]); |
148 | 149 | Result := Format(HTML,[ABody]); |
@@ -165,4 +166,38 @@ | ||
165 | 166 | end; |
166 | 167 | end; |
167 | 168 | |
169 | +procedure GenerateSimpleComments(AWebBrowser: TWebBrowser; AClientDataSet: TClientDataSet); | |
170 | +const | |
171 | + COMMENT = '<div style="background-color: %s; font-weight: bold; color: #FFFFFF; padding: 5px">(%s) <span style="color: #FFFF00">%s</span> respondeu em <span style="color: #FFFF00">%s</span></div><div>%s</div><br>'; | |
172 | +var | |
173 | + Comments: String; | |
174 | + Color: String; | |
175 | +begin | |
176 | + if AClientDataSet.RecordCount > 0 then | |
177 | + begin | |
178 | + AClientDataSet.First; | |
179 | + try | |
180 | + Comments := ''; | |
181 | + while not AClientDataSet.Eof do | |
182 | + begin | |
183 | + if AClientDataSet.FieldByName('private').AsInteger = 1 then | |
184 | + Color := '#808080' | |
185 | + else | |
186 | + Color := '#008000'; | |
187 | + | |
188 | + Comments := Comments + Format(COMMENT,[Color | |
189 | + ,FormatFloat('00000000',AClientDataSet.FieldByName('id').Asinteger) | |
190 | + ,AClientDataSet.FieldByName('Reporter').AsString | |
191 | + ,FormatDateTime('dd/mm/yyyy "às" hh:nn:ss',AClientDataSet.FieldByName('Date').AsDateTime) | |
192 | + ,UTF8Decode(DecodeString(AClientDataSet.FieldByName('Note').AsString))]); | |
193 | + AClientDataSet.Next; | |
194 | + end; | |
195 | + LoadWebBrowserHTML(AWebBrowser,Comments); | |
196 | + finally | |
197 | + AClientDataSet.First; | |
198 | + end; | |
199 | + end; | |
200 | +end; | |
201 | + | |
202 | + | |
168 | 203 | end. |
@@ -76,13 +76,13 @@ | ||
76 | 76 | ACTNNoteReply: TAction; |
77 | 77 | ACTNNoteFullScreen: TAction; |
78 | 78 | PACONotes: TPageControl; |
79 | - TASHNoteIndividual: TTabSheet; | |
80 | - TASHNoteContinuous: TTabSheet; | |
79 | + TASHNoteAdvanced: TTabSheet; | |
80 | + TASHNoteSimple: TTabSheet; | |
81 | 81 | PANE: TPanel; |
82 | 82 | Label1: TLabel; |
83 | 83 | LABENoteDate: TLabel; |
84 | - PNSBNextNote: TPngSpeedButton; | |
85 | - PNSBPreviousNote: TPngSpeedButton; | |
84 | + PNSBNotePrevious: TPngSpeedButton; | |
85 | + PNSBNoteNext: TPngSpeedButton; | |
86 | 86 | LABENoteAuthor: TLabel; |
87 | 87 | WEBRNote: TWebBrowser; |
88 | 88 | LABENoteNumber: TLabel; |
@@ -90,14 +90,18 @@ | ||
90 | 90 | PANEButtons: TPanel; |
91 | 91 | PNBBNoteReply: TPngBitBtn; |
92 | 92 | PNBBNoteFullScreen: TPngBitBtn; |
93 | - WEBRNotesContinuous: TWebBrowser; | |
93 | + WEBRNotesSimple: TWebBrowser; | |
94 | 94 | PANE1: TPanel; |
95 | 95 | PNSBNoteNew: TPngSpeedButton; |
96 | 96 | ACTNNoteNew: TAction; |
97 | - procedure TASHNoteContinuousShow(Sender: TObject); | |
97 | + LABENoteCount: TLabel; | |
98 | + PNSBNoteLast: TPngSpeedButton; | |
99 | + PNSBNoteFirst: TPngSpeedButton; | |
100 | + procedure PNSBNoteFirstClick(Sender: TObject); | |
101 | + procedure PNSBNoteLastClick(Sender: TObject); | |
98 | 102 | procedure CLDSCommentsAfterScroll(DataSet: TDataSet); |
99 | - procedure PNSBNextNoteClick(Sender: TObject); | |
100 | - procedure PNSBPreviousNoteClick(Sender: TObject); | |
103 | + procedure PNSBNotePreviousClick(Sender: TObject); | |
104 | + procedure PNSBNoteNextClick(Sender: TObject); | |
101 | 105 | procedure FormShow(Sender: TObject); |
102 | 106 | procedure ACTNNoteFullScreenExecute(Sender: TObject); |
103 | 107 | procedure ACTNNoteReplyExecute(Sender: TObject); |
@@ -119,7 +123,6 @@ | ||
119 | 123 | FAttachmentsLoaded: Boolean; |
120 | 124 | FRelationshipsLoaded: Boolean; |
121 | 125 | FCommentsLoaded: Boolean; |
122 | - FContinuousCommentsLoaded: Boolean; | |
123 | 126 | FAdditionalInfoLoaded: Boolean; |
124 | 127 | FStepsToReproduceLoaded: Boolean; |
125 | 128 |
@@ -130,7 +133,6 @@ | ||
130 | 133 | procedure LoadAttachments; |
131 | 134 | procedure LoadRelationships; |
132 | 135 | procedure LoadComments; |
133 | - procedure LoadContinuousComments; | |
134 | 136 | protected |
135 | 137 | procedure CreateParams(var Params: TCreateParams); override; |
136 | 138 | public |
@@ -160,6 +162,7 @@ | ||
160 | 162 | Application.ProcessMessages; |
161 | 163 | end; |
162 | 164 | |
165 | + | |
163 | 166 | procedure TFormIssue.ACTNNoteFullScreenExecute(Sender: TObject); |
164 | 167 | begin |
165 | 168 | inherited; |
@@ -177,10 +180,11 @@ | ||
177 | 180 | inherited; |
178 | 181 | LABENoteAuthor.Caption := CLDSCommentsReporter.AsString; |
179 | 182 | LABENoteDate.Caption := FormatDateTime('dd/mm/yyyy "às" hh:nn:ss',CLDSCommentsDate.AsDateTime); |
180 | - LABENoteNumber.Caption := '(' + CLDSCommentsid.AsString + ')'; | |
183 | + LABENoteNumber.Caption := '(' + FormatFloat('00000000',CLDSCommentsid.AsInteger) + ')'; | |
181 | 184 | LoadWebBrowserHTML(WEBRNote,CLDSCommentsNote.AsString,True); |
182 | 185 | PNBBNoteReply.Tag := CLDSCommentsId.AsInteger; |
183 | 186 | PNBBNoteFullScreen.Tag := CLDSCommentsId.AsInteger; |
187 | + LABENoteCount.Caption := Format('Anotação %u de %u',[Abs(CLDSComments.RecordCount - CLDSComments.RecNo + 1),CLDSComments.RecordCount]); | |
184 | 188 | |
185 | 189 | if CLDSCommentsPrivate.AsInteger = 1 then |
186 | 190 | PANE.Color := clGray |
@@ -187,8 +191,11 @@ | ||
187 | 191 | else |
188 | 192 | PANE.Color := clGreen; |
189 | 193 | |
190 | - PNSBNextNote.Enabled := CLDSComments.RecNo > 1; | |
191 | - PNSBPreviousNote.Enabled := CLDSComments.RecNo < CLDSComments.RecordCount; | |
194 | + PNSBNoteLast.Enabled := CLDSComments.RecNo > 1; | |
195 | + PNSBNoteNext.Enabled := PNSBNoteLast.Enabled; | |
196 | + | |
197 | + PNSBNoteFirst.Enabled := CLDSComments.RecNo < CLDSComments.RecordCount; | |
198 | + PNSBNotePrevious.Enabled := PNSBNoteFirst.Enabled; | |
192 | 199 | end; |
193 | 200 | |
194 | 201 | procedure TFormIssue.CLDSRelatedIssuesStatusGetText(Sender: TField; var Text: string; DisplayText: Boolean); |
@@ -246,15 +253,13 @@ | ||
246 | 253 | procedure TFormIssue.LoadComments; |
247 | 254 | begin |
248 | 255 | if not FCommentsLoaded then |
256 | + begin | |
249 | 257 | FCommentsLoaded := GetComments(FIssueInfo.Id,Configurations.UserId,CLDSComments); |
258 | + if FCommentsLoaded then | |
259 | + GenerateSimpleComments(WEBRNotesSimple,CLDSComments); | |
260 | + end; | |
250 | 261 | end; |
251 | 262 | |
252 | -procedure TFormIssue.LoadContinuousComments; | |
253 | -begin | |
254 | - if not FContinuousCommentsLoaded then | |
255 | - FContinuousCommentsLoaded := True; | |
256 | -end; | |
257 | - | |
258 | 263 | procedure TFormIssue.LoadIssueHeader; |
259 | 264 | begin |
260 | 265 | Caption := 'Caso Mantis #' + IntToStr(FIssueInfo.Id); |
@@ -323,18 +328,30 @@ | ||
323 | 328 | Close; |
324 | 329 | end; |
325 | 330 | |
326 | -procedure TFormIssue.PNSBNextNoteClick(Sender: TObject); | |
331 | +procedure TFormIssue.PNSBNotePreviousClick(Sender: TObject); | |
327 | 332 | begin |
328 | 333 | inherited; |
329 | - CLDSComments.Prior; | |
334 | + CLDSComments.Next; | |
330 | 335 | end; |
331 | 336 | |
332 | -procedure TFormIssue.PNSBPreviousNoteClick(Sender: TObject); | |
337 | +procedure TFormIssue.PNSBNoteFirstClick(Sender: TObject); | |
333 | 338 | begin |
334 | 339 | inherited; |
335 | - CLDSComments.Next; | |
340 | + CLDSComments.Last; | |
336 | 341 | end; |
337 | 342 | |
343 | +procedure TFormIssue.PNSBNoteLastClick(Sender: TObject); | |
344 | +begin | |
345 | + inherited; | |
346 | + CLDSComments.First; | |
347 | +end; | |
348 | + | |
349 | +procedure TFormIssue.PNSBNoteNextClick(Sender: TObject); | |
350 | +begin | |
351 | + inherited; | |
352 | + CLDSComments.Prior; | |
353 | +end; | |
354 | + | |
338 | 355 | class function TFormIssue.ShowMe(AIssueNumber: Cardinal; AModal: Boolean = False): TModalResult; |
339 | 356 | begin |
340 | 357 | Result := mrNone; |
@@ -348,7 +365,6 @@ | ||
348 | 365 | FAttachmentsLoaded := False; |
349 | 366 | FRelationshipsLoaded := False; |
350 | 367 | FCommentsLoaded := False; |
351 | - FContinuousCommentsLoaded := False; | |
352 | 368 | FAdditionalInfoLoaded := False; |
353 | 369 | FStepsToReproduceLoaded := False; |
354 | 370 |
@@ -378,12 +394,6 @@ | ||
378 | 394 | LoadComments; |
379 | 395 | end; |
380 | 396 | |
381 | -procedure TFormIssue.TASHNoteContinuousShow(Sender: TObject); | |
382 | -begin | |
383 | - inherited; | |
384 | - LoadContinuousComments; | |
385 | -end; | |
386 | - | |
387 | 397 | procedure TFormIssue.TASHStepsToReproduceShow(Sender: TObject); |
388 | 398 | begin |
389 | 399 | inherited; |
@@ -13,8 +13,8 @@ | ||
13 | 13 | LABE2: TLabel; |
14 | 14 | LABENoteDate: TLabel; |
15 | 15 | WEBRNote: TWebBrowser; |
16 | - PNSBNextNote: TPngSpeedButton; | |
17 | - PNSBPreviousNote: TPngSpeedButton; | |
16 | + PNSBPrevious: TPngSpeedButton; | |
17 | + PNSBNext: TPngSpeedButton; | |
18 | 18 | CLDSComments: TClientDataSet; |
19 | 19 | CLDSCommentsId: TIntegerField; |
20 | 20 | CLDSCommentsReporter: TStringField; |
@@ -23,15 +23,15 @@ | ||
23 | 23 | CLDSCommentsNote: TMemoField; |
24 | 24 | LABENoteAuthor: TLabel; |
25 | 25 | IMAGOpenWithMantis: TImage; |
26 | + PNSBFirst: TPngSpeedButton; | |
26 | 27 | PNSBLast: TPngSpeedButton; |
27 | - PNSBFirst: TPngSpeedButton; | |
28 | + procedure PNSBLastClick(Sender: TObject); | |
28 | 29 | procedure PNSBFirstClick(Sender: TObject); |
29 | - procedure PNSBLastClick(Sender: TObject); | |
30 | 30 | procedure IMAGOpenWithMantisClick(Sender: TObject); |
31 | 31 | procedure FormShow(Sender: TObject); |
32 | 32 | procedure CLDSCommentsAfterScroll(DataSet: TDataSet); |
33 | - procedure PNSBNextNoteClick(Sender: TObject); | |
34 | - procedure PNSBPreviousNoteClick(Sender: TObject); | |
33 | + procedure PNSBPreviousClick(Sender: TObject); | |
34 | + procedure PNSBNextClick(Sender: TObject); | |
35 | 35 | procedure PNBBOKClick(Sender: TObject); |
36 | 36 | private |
37 | 37 | { Private declarations } |
@@ -57,7 +57,7 @@ | ||
57 | 57 | inherited; |
58 | 58 | LABENoteAuthor.Caption := CLDSCommentsReporter.AsString; |
59 | 59 | LABENoteDate.Caption := FormatDateTime('dd/mm/yyyy "às" hh:nn:ss',CLDSCommentsDate.AsDateTime); |
60 | - LABECaption.Caption := Format(FCaptionTemplate,[CLDSCommentsid.AsInteger,CLDSComments.RecNo,CLDSComments.RecordCount]); | |
60 | + LABECaption.Caption := Format(FCaptionTemplate,[FormatFloat('00000000',CLDSCommentsid.AsInteger),Abs(CLDSComments.RecordCount - CLDSComments.RecNo + 1),CLDSComments.RecordCount]); | |
61 | 61 | LoadWebBrowserHTML(WEBRNote,CLDSCommentsNote.AsString,True); |
62 | 62 | |
63 | 63 | if CLDSCommentsPrivate.AsInteger = 1 then |
@@ -66,10 +66,10 @@ | ||
66 | 66 | PANE.Color := clGreen; |
67 | 67 | |
68 | 68 | PNSBLast.Enabled := CLDSComments.RecNo > 1; |
69 | - PNSBNextNote.Enabled := PNSBLast.Enabled; | |
69 | + PNSBNext.Enabled := PNSBLast.Enabled; | |
70 | 70 | |
71 | 71 | PNSBFirst.Enabled := CLDSComments.RecNo < CLDSComments.RecordCount; |
72 | - PNSBPreviousNote.Enabled := PNSBFirst.Enabled; | |
72 | + PNSBPrevious.Enabled := PNSBFirst.Enabled; | |
73 | 73 | end; |
74 | 74 | |
75 | 75 | procedure TFormViewNote.FormShow(Sender: TObject); |
@@ -91,28 +91,28 @@ | ||
91 | 91 | // Método para responder a anotação visível |
92 | 92 | end; |
93 | 93 | |
94 | -procedure TFormViewNote.PNSBFirstClick(Sender: TObject); | |
94 | +procedure TFormViewNote.PNSBLastClick(Sender: TObject); | |
95 | 95 | begin |
96 | 96 | inherited; |
97 | - CLDSComments.Last; | |
97 | + CLDSComments.First; | |
98 | 98 | end; |
99 | 99 | |
100 | -procedure TFormViewNote.PNSBLastClick(Sender: TObject); | |
100 | +procedure TFormViewNote.PNSBFirstClick(Sender: TObject); | |
101 | 101 | begin |
102 | 102 | inherited; |
103 | - CLDSComments.First; | |
103 | + CLDSComments.Last; | |
104 | 104 | end; |
105 | 105 | |
106 | -procedure TFormViewNote.PNSBNextNoteClick(Sender: TObject); | |
106 | +procedure TFormViewNote.PNSBPreviousClick(Sender: TObject); | |
107 | 107 | begin |
108 | 108 | inherited; |
109 | - CLDSComments.Prior; | |
109 | + CLDSComments.Next; | |
110 | 110 | end; |
111 | 111 | |
112 | -procedure TFormViewNote.PNSBPreviousNoteClick(Sender: TObject); | |
112 | +procedure TFormViewNote.PNSBNextClick(Sender: TObject); | |
113 | 113 | begin |
114 | 114 | inherited; |
115 | - CLDSComments.Next; | |
115 | + CLDSComments.Prior; | |
116 | 116 | end; |
117 | 117 | |
118 | 118 | class function TFormViewNote.ShowMeModal(AOwner: TComponent; AIssueNumber: Cardinal; ANoteId: Cardinal): TModalResult; |
@@ -119,7 +119,7 @@ | ||
119 | 119 | begin |
120 | 120 | with Self.Create(AOwner) do |
121 | 121 | begin |
122 | - FCaptionTemplate := 'Visualizando anotação #%u (%u/%u)'; | |
122 | + FCaptionTemplate := 'Visualizando anotação #%s (%u/%u)'; | |
123 | 123 | FIssueNumber := AIssueNumber; |
124 | 124 | FNoteId := ANoteId; |
125 | 125 | Result := ShowModal; |