Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.3 KiB

  1. //
  2. // MODULE: HTMLFrag.cpp
  3. //
  4. // PURPOSE: implementation of the CHTMLFragmentsLocal class.
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  9. //
  10. // AUTHOR: Oleg Kalosha
  11. //
  12. // ORIGINAL DATE: 1-19-1999
  13. //
  14. // NOTES:
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V3.1 1-19-19 OK Original
  19. //
  20. //////////////////////////////////////////////////////////////////////
  21. #include "stdafx.h"
  22. #include "HTMLFragLocal.h"
  23. #include "fileread.h"
  24. #ifdef LOCAL_TROUBLESHOOTER
  25. #include "CHMFileReader.h"
  26. #include "apgtsinf.h"
  27. #include "resource.h"
  28. #endif
  29. /*static*/ bool CHTMLFragmentsLocal::RemoveBackButton(CString& strCurrentNode)
  30. {
  31. int left = 0, right = 0;
  32. if (-1 != (left = strCurrentNode.Find(SZ_INPUT_TAG_BACK)))
  33. {
  34. right = left;
  35. while (strCurrentNode[++right] && strCurrentNode[right] != _T('>'))
  36. ;
  37. if (strCurrentNode[right])
  38. strCurrentNode = strCurrentNode.Left(left) + strCurrentNode.Right(strCurrentNode.GetLength() - right - 1);
  39. else
  40. return false;
  41. return true;
  42. }
  43. return false;
  44. }
  45. //////////////////////////////////////////////////////////////////////
  46. // Construction/Destruction
  47. //////////////////////////////////////////////////////////////////////
  48. CHTMLFragmentsLocal::CHTMLFragmentsLocal( const CString & strScriptPath, bool bIncludesHistoryTable)
  49. : CHTMLFragmentsTS( strScriptPath, bIncludesHistoryTable )
  50. {
  51. }
  52. CString CHTMLFragmentsLocal::GetText(const FragmentIDVector & fidvec, const FragCommand fragCmd )
  53. {
  54. if (!fidvec.empty())
  55. {
  56. const CString & strVariable0 = fidvec[0].VarName; // ref of convenience
  57. int i0 = fidvec[0].Index;
  58. if (fidvec.size() == 1)
  59. {
  60. if ((fragCmd == eResource) && (strVariable0 == VAR_PREVIOUS_SCRIPT))
  61. {
  62. // Hard-coded server side include for backward compatibility.
  63. CString strScriptContent;
  64. strScriptContent.LoadString(IDS_PREVSCRIPT);
  65. return strScriptContent;
  66. }
  67. else if (strVariable0 == VAR_NOBACKBUTTON_INFO)
  68. {
  69. CString strCurrentNode = GetCurrentNodeText();
  70. RemoveBackButton(strCurrentNode);
  71. SetCurrentNodeText(strCurrentNode);
  72. return _T("");
  73. }
  74. }
  75. }
  76. return CHTMLFragmentsTS::GetText( fidvec, fragCmd );
  77. }