- Timestamp:
- Mar 31, 2010, 5:06:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateDialog.pas
r698 r729 47 47 FAnswerOpenTag : string; //kt added 12/28/09 48 48 FAnswerCloseTag : string; //kt added 12/28/09 49 NameToObjID : TStringList; //kt added 3/26/10 50 Formulas : TStringList; //kt added 3/26/10 51 TxtObjects : TStringList; //kt added 3/28/10 49 52 procedure SizeFormToCancelBtn(); 50 53 procedure ChkAll(Chk: boolean); … … 81 84 frmTemplateDialog: TfrmTemplateDialog; 82 85 83 const84 HTMLBEGINNINGTAG = '{HTML:'; //kt85 HTMLENDINGTAG = '}'; //kt86 HTMLBEGINNINGTAGLEN = length(HTMLBEGINNINGTAG); //kt87 HTMLENDINGTAGLEN = length(HTMLENDINGTAG); //kt88 89 86 implementation 90 87 … … 153 150 i, j, idx, Indent: integer; 154 151 DlgProps, Txt: string; 152 Temp : string; //kt 153 Changed : boolean; //kt 155 154 DlgIDCounts: TStringList; 156 155 DlgInt: TIntStruc; 157 156 CancelDlg: Boolean; 158 157 CancelMsg: String; 159 160 158 161 159 procedure IncDlgID(var id: string); //Appends an item count in the form of id.0, id.1, id.2, etc … … 221 219 frmTemplateDialog.HTMLAnswerOpenTag := '<I>'; //kt 12/28/09 222 220 //SL.Text := RemoveHTMLTags(SL.Text); //elh 223 AssignFieldIDs(SL); 221 AssignFieldIDs(SL,frmTemplateDialog.NameToObjID); //kt added NameToObjID param 3/26/10 222 HideFormulas(SL,frmTemplateDialog.Formulas); //kt added 3/26/10 223 HideTxtObjects(SL,frmTemplateDialog.TxtObjects); //kt added 3/28/10 224 224 frmTemplateDialog.SL := SL; 225 225 frmTemplateDialog.Index := ''; … … 231 231 repeat 232 232 i := pos(ObjMarker, Txt); 233 if(i > 1) then 234 begin 233 if(i > 1) then begin 235 234 j := pos(DlgPropMarker, Txt); 236 if(j > 0) then 237 begin 235 if(j > 0) then begin 238 236 DlgProps := copy(Txt, j + DlgPropMarkerLen, (i - j - DlgPropMarkerLen)); 239 237 CountDlgProps(DlgProps); 240 end 241 else 242 begin 238 end else begin 243 239 DlgProps := ''; 244 240 j := i; 245 241 end; 246 242 inc(frmTemplateDialog.Count); 247 243 frmTemplateDialog.Index := frmTemplateDialog.Index + … … 249 245 inc(idx,i+ObjMarkerLen-1); 250 246 Indent := StrToIntDef(Piece(DlgProps, ';', 5),0); 251 if(frmTemplateDialog.FirstIndent > Indent) then 247 if(frmTemplateDialog.FirstIndent > Indent) then begin 252 248 frmTemplateDialog.FirstIndent := Indent; 253 end; 254 if(i > 0) then 249 end; 250 end; 251 if(i > 0) then begin 255 252 delete(txt, 1, i + ObjMarkerLen - 1); 253 end; 256 254 until (i = 0); 257 if(frmTemplateDialog.Count > 0) then 258 begin 259 if(frmTemplateDialog.OneOnly) then 260 begin 255 if(frmTemplateDialog.Count > 0) then begin 256 if(frmTemplateDialog.OneOnly) then begin 261 257 frmTemplateDialog.btnNone.Visible := FALSE; 262 258 frmTemplateDialog.btnAll.Visible := FALSE; … … 264 260 frmTemplateDialog.BuildAllControls; 265 261 repeat 266 if (assigned(frmNotes)) and (frmTemplateDialog.HTMLMode) then frmNotes.HTMLEditor.SetMsgActive(False); //kt 2-1-10 267 frmTemplateDialog.ShowModal; 268 if (assigned(frmNotes)) and (frmTemplateDialog.HTMLMode) then frmNotes.HTMLEditor.SetMsgActive(True); //kt 2-1-10 269 if(frmTemplateDialog.ModalResult = mrOK) then begin 270 GetText(SL, TRUE); {TRUE = Include embedded fields} 271 { 272 if uTemplates.bUsingHTMLMode then begin 273 SL.Text := FormatHTMLTags(SL.Text); 274 end else begin 275 SL.Text := RemoveHTMLTags(SL.Text); 276 end; 277 } 278 end else begin 279 if (not PreviewMode) and (not frmTemplateDialog.Silent) and (not uInit.TimedOut) then 280 begin 281 // CancelMsg := 'If you cancel, your changes will not be saved. Are you sure you want to cancel?'; <-- original line. //kt 8/8/2007 282 CancelMsg := DKLangConstW('fTemplateDialog_If_you_cancelx_your_changes_will_not_be_savedx__Are_you_sure_you_want_to_cancelx'); //kt added 8/8/2007 283 // if (InfoBox(CancelMsg, 'Cancel Dialog Processing', MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES) then <-- original line. //kt 8/8/2007 284 if (InfoBox(CancelMsg, DKLangConstW('fTemplateDialog_Cancel_Dialog_Processing'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES) then //kt added 8/8/2007 285 begin 286 SL.Clear; 287 Result := TRUE; 288 CancelDlg := TRUE; 289 end 290 else 291 CancelDlg := FALSE; 292 end 293 else 294 begin 262 if (assigned(frmNotes)) and (frmTemplateDialog.HTMLMode) then frmNotes.HTMLEditor.SetMsgActive(False); //kt 2-1-10 263 frmTemplateDialog.ShowModal; 264 if (assigned(frmNotes)) and (frmTemplateDialog.HTMLMode) then frmNotes.HTMLEditor.SetMsgActive(True); //kt 2-1-10 265 if(frmTemplateDialog.ModalResult = mrOK) then begin 266 //kt -- begin mod -- 3/27/10 267 Changed := RestoreTransformTxtObjects(SL, frmTemplateDialog.TxtObjects, frmTemplateDialog.NameToObjID); 268 Changed := RestoreTransformFormulas(SL, frmTemplateDialog.Formulas, frmTemplateDialog.NameToObjID) or Changed; 269 if Changed then begin //kt 3/27/10 270 Txt := SL.Text; 271 i := pos(ObjMarker, Txt); 272 if(i > 1) then begin 273 j := pos(DlgPropMarker, Txt); 274 if (j <= 0) then j := i; 275 Temp := frmTemplateDialog.Index; 276 SetPiece(Temp,'~',2,IntToStr(j-1)); 277 frmTemplateDialog.Index := Temp; 278 end; 279 end; 280 //kt -- end mod -- 281 GetText(SL, TRUE); {TRUE = Include embedded fields} 282 { 283 if uTemplates.bUsingHTMLMode then begin 284 SL.Text := FormatHTMLTags(SL.Text); 285 end else begin 286 SL.Text := RemoveHTMLTags(SL.Text); 287 end; 288 } 289 end else begin 290 if (not PreviewMode) and (not frmTemplateDialog.Silent) and (not uInit.TimedOut) then begin 291 // CancelMsg := 'If you cancel, your changes will not be saved. Are you sure you want to cancel?'; <-- original line. //kt 8/8/2007 292 CancelMsg := DKLangConstW('fTemplateDialog_If_you_cancelx_your_changes_will_not_be_savedx__Are_you_sure_you_want_to_cancelx'); //kt added 8/8/2007 293 // if (InfoBox(CancelMsg, 'Cancel Dialog Processing', MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES) then <-- original line. //kt 8/8/2007 294 if (InfoBox(CancelMsg, DKLangConstW('fTemplateDialog_Cancel_Dialog_Processing'), MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES) then begin //kt added 8/8/2007 295 295 SL.Clear; 296 296 Result := TRUE; 297 297 CancelDlg := TRUE; 298 end else begin 299 CancelDlg := FALSE; 298 300 end; 299 end; 301 end else begin 302 SL.Clear; 303 Result := TRUE; 304 CancelDlg := TRUE; 305 end; 306 end; 300 307 until CancelDlg or (frmTemplateDialog.ModalResult = mrOK) 301 end 302 else 308 end else begin 303 309 SL.Clear; 310 end; 304 311 finally 305 312 //frmTemplateDialog.Free; v22.11e RV … … 324 331 tempString := Txt; 325 332 //here we will strip out all HTML formatting tags //elh 326 beginning := pos(HTML BEGINNINGTAG, tempString);333 beginning := pos(HTML_BEGIN_TAG, tempString); 327 334 if beginning = 0 then begin 328 335 Result := Txt; … … 331 338 begin 332 339 tempResult := tempResult + Leftstr(tempString,beginning-1); 333 tempString := Rightstr(tempString,length(tempString)-beginning-HTML BEGINNINGTAGLEN);334 ending := pos(HTML ENDINGTAG, tempString);340 tempString := Rightstr(tempString,length(tempString)-beginning-HTML_BEGIN_TAGLEN); 341 ending := pos(HTML_ENDING_TAG, tempString); 335 342 tempString := Rightstr(tempString,length(tempString)-ending); 336 beginning := pos(HTML BEGINNINGTAG, tempString);337 // tempString := Midstr(Txt,i,HTML BEGINNINGTAGLEN);343 beginning := pos(HTML_BEGIN_TAG, tempString); 344 // tempString := Midstr(Txt,i,HTML_BEGIN_TAGLEN); 338 345 end; 339 346 Result := tempResult + tempString; … … 348 355 tempString := Txt; 349 356 //here we will strip out all HTML formatting tags //elh 350 beginning := pos(HTML BEGINNINGTAG, tempString);357 beginning := pos(HTML_BEGIN_TAG, tempString); 351 358 if beginning = 0 then begin 352 359 Result := Txt; … … 355 362 begin 356 363 tempResult := tempResult + Leftstr(tempString,beginning-1); 357 tempString := Rightstr(tempString,length(tempString)-beginning-HTML BEGINNINGTAGLEN+1);358 ending := pos(HTML ENDINGTAG, tempString);364 tempString := Rightstr(tempString,length(tempString)-beginning-HTML_BEGIN_TAGLEN+1); 365 ending := pos(HTML_ENDING_TAG, tempString); 359 366 tempResult := tempResult + Leftstr(tempString,ending-1); 360 367 tempString := Rightstr(tempString,length(tempString)-ending); 361 beginning := pos(HTML BEGINNINGTAG, tempString);362 // tempString := Midstr(Txt,i,HTML BEGINNINGTAGLEN);368 beginning := pos(HTML_BEGIN_TAG, tempString); 369 // tempString := Midstr(Txt,i,HTML_BEGIN_TAGLEN); 363 370 end; 364 371 Result := tempResult + tempString; … … 565 572 end; 566 573 tmp := copy(SL.Text, p1, p2); 567 tmp := RemoveHTMLTags(tmp); 574 tmp := RemoveHTMLTags(tmp); //kt 568 575 if(copy(tmp, length(tmp)-1, 2) = CRLF) then 569 576 delete(tmp, length(tmp)-1, 2); … … 747 754 Entries := TStringList.Create; 748 755 NoTextID := TStringList.Create; 756 NameToObjID := TStringList.Create ; //kt 757 Formulas := TStringList.Create ; //kt 758 TxtObjects := TStringList.Create; //kt added 3/28/10 749 759 FOldHintEvent := Application.OnShowHint; 750 760 Application.OnShowHint := AppShowHint; … … 774 784 Entries.Free; 775 785 BuildIdx.Free; 786 NameToObjID.Free; //kt 787 Formulas.Free; //kt 788 TxtObjects.Free; //kt 776 789 end; 777 790
Note:
See TracChangeset
for help on using the changeset viewer.