00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "Dlg_SpreadHelp2.h"
00009 #include "MainFrm.h"
00010
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #undef THIS_FILE
00014 static char THIS_FILE[] = __FILE__;
00015 #endif
00016
00017 CDlg_SpreadHelp2::CDlg_SpreadHelp2(CWnd* pParent )
00018 : CDialog(CDlg_SpreadHelp2::IDD, pParent),
00019 m_wbe (&m_wb, &m_wbuih)
00020 {
00021
00022
00023
00024 }
00025
00026 void CDlg_SpreadHelp2::DoDataExchange(CDataExchange* pDX)
00027 {
00028 CDialog::DoDataExchange(pDX);
00029
00030 DDX_Control(pDX, IDC_WB, m_wb);
00031
00032 }
00033
00034 BEGIN_MESSAGE_MAP(CDlg_SpreadHelp2, CDialog)
00035
00036
00037 END_MESSAGE_MAP()
00038
00039 BOOL CDlg_SpreadHelp2::OnInitDialog()
00040 {
00041 CDialog::OnInitDialog();
00042
00043 m_wbe.Attach ();
00044 m_wb.Navigate ("about:blank", 0, 0, 0, 0);
00045
00046 CString strHTML;
00047 CString strNewHTML = _App.View_SpreadHelpDialog_LinkToUsText ();
00048
00049 if (strNewHTML == "")
00050 {
00051 CString str2;
00052 str2.Format ("%x", GetSysColor (COLOR_3DFACE));
00053
00054 char c0 = str2[0], c1 = str2[1];
00055 str2.SetAt (0, str2 [4]);
00056 str2.SetAt (1, str2 [5]);
00057 str2.SetAt (4, c0);
00058 str2.SetAt (5, c1);
00059
00060 CString str5 = LS (L_SHDLG_M5);
00061 str5.Replace ("\n", "<br>");
00062
00063 UINT nM3 = L_SHDLG_M3;
00064 SYSTEMTIME time;
00065 GetLocalTime (&time);
00066 if (time.wDay < 16 && time.wMonth == 8 && time.wYear == 2006)
00067 nM3 = L_SHDLG_M3_BEFORE_AUG16_2006;
00068
00069 CString str;
00070 str.Format ("<html><style type=\"text/css\"><!--\nbody {margin-left: 0px; margin-top: 0px; margin-right: 0px;\
00071 margin-bottom: 0px; } \n-->\n</style><body bgcolor='#%s'>\
00072 <font face='ms sans serif' size='-8pt'>%s<br><br>%s<br><br>%s<br><br>%s<br><br>%s<br><br>%s</font></body></html>",
00073 str2, LS (L_DEARFOLK), LS (L_SHDLG_M1),
00074 LS (L_SHDLG_M2), LS (nM3), LS (L_SHDLG_M4), str5);
00075
00076 CMainFrame* pFrm = (CMainFrame*) AfxGetApp ()->m_pMainWnd;
00077
00078 CString str3;
00079 str3.Format ("<a href='http://fdm.freedownloadmanager.org/fromfdm/buzz.php3?from=%d_%d'>%s</a>",
00080 PRG_BUILD_NUMBER, pFrm->m_Customizations.get_AffiliateID (), LS (L_FDMBUZZ));
00081
00082 CString str4;
00083 str4.Format ("<a href='http://fdm.freedownloadmanager.org/fromfdm/blog.php3?from=%d_%d'>%s</a>",
00084 PRG_BUILD_NUMBER, pFrm->m_Customizations.get_AffiliateID (), LS (L_BLOG));
00085
00086 strHTML.Format (str, str3, str4);
00087 }
00088 else
00089 {
00090 CString str2;
00091 str2.Format ("%x", GetSysColor (COLOR_3DFACE));
00092
00093 char c0 = str2[0], c1 = str2[1];
00094 str2.SetAt (0, str2 [4]);
00095 str2.SetAt (1, str2 [5]);
00096 str2.SetAt (4, c0);
00097 str2.SetAt (5, c1);
00098
00099 CString str;
00100 str.Format ("<html><style type=\"text/css\"><!--\nbody {margin-left: 0px; margin-top: 0px; margin-right: 0px;\
00101 margin-bottom: 0px; } \n-->\n</style><body bgcolor='#%s'>\
00102 <font face='ms sans serif' size='-8pt'>%s</font></body></html>",
00103 str2, strNewHTML);
00104
00105 CMainFrame* pFrm = (CMainFrame*) AfxGetApp ()->m_pMainWnd;
00106
00107 CString str3;
00108 str3.Format ("http://fdm.freedownloadmanager.org/fromfdm/buzz.php3?from=%d_%d",
00109 PRG_BUILD_NUMBER, pFrm->m_Customizations.get_AffiliateID ());
00110
00111 CString str4;
00112 str4.Format ("http://fdm.freedownloadmanager.org/fromfdm/blog.php3?from=%d_%d",
00113 PRG_BUILD_NUMBER, pFrm->m_Customizations.get_AffiliateID ());
00114
00115 strHTML.Format (str, str3, str4);
00116 }
00117
00118 CStdioFile file;
00119 char szTmpPath [MY_MAX_PATH];
00120 char szTmpFile [MY_MAX_PATH];
00121 GetTempPath (MY_MAX_PATH, szTmpPath);
00122 GetTempFileName (szTmpPath, "fdm", 0, szTmpFile);
00123 m_strFile = szTmpFile;
00124 file.Open (m_strFile, CFile::modeCreate | CFile::modeWrite);
00125 file.WriteString (strHTML);
00126 file.Close ();
00127
00128 CString str;
00129 str.Format ("file://%s", m_strFile);
00130
00131 m_wb.Navigate (str, 0, 0, 0, 0);
00132
00133 ApplyLanguage ();
00134
00135 vmsSpreadHelpRemind en = _App.View_SpreadHelpDialog ();
00136 if (en == SHR_WAIT1STTIME)
00137 _App.View_SpreadHelpDialog (en = SHR_IN3DAYS);
00138
00139 if (en == SHR_IN3DAYS)
00140 CheckDlgButton (IDC_REMIND_IN3DAYS, BST_CHECKED);
00141 else
00142 CheckDlgButton (IDC_DONTSHOWAGAIN, BST_CHECKED);
00143
00144 return TRUE;
00145 }
00146
00147 CDlg_SpreadHelp2::~CDlg_SpreadHelp2()
00148 {
00149 DeleteFile (m_strFile);
00150 }
00151
00152 void CDlg_SpreadHelp2::ApplyLanguage()
00153 {
00154 fsDlgLngInfo lnginfo [] = {
00155 fsDlgLngInfo (IDC_REMIND_IN3DAYS, L_REMIND_IN3DAYS),
00156 fsDlgLngInfo (IDC_DONTSHOWAGAIN, L_SHDLG_DONTSHOWAGAIN),
00157 fsDlgLngInfo (IDOK, L_JOINBUZZ),
00158 fsDlgLngInfo (IDCANCEL, L_NOTHANKYOU),
00159 };
00160
00161 _LngMgr.ApplyLanguage (this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), L_PLACELINKTOFDM2);
00162
00163 CString str = _App.View_SpreadHelpDialog_RadioButton1Text ();
00164 if (str != "")
00165 SetDlgItemText (IDC_REMIND_IN3DAYS, str);
00166 str = _App.View_SpreadHelpDialog_RadioButton2Text ();
00167 if (str != "")
00168 SetDlgItemText (IDC_DONTSHOWAGAIN, str);
00169 }
00170
00171 void CDlg_SpreadHelp2::OnOK()
00172 {
00173 CString str;
00174 CMainFrame* pFrm = (CMainFrame*) AfxGetApp ()->m_pMainWnd;
00175
00176 str.Format ("http://fdm.freedownloadmanager.org/fromfdm/buzz.php3?from=%d_%d",
00177 PRG_BUILD_NUMBER, pFrm->m_Customizations.get_AffiliateID ());
00178
00179 fsOpenUrlInBrowser (str);
00180
00181 _App.View_SpreadHelpDialog (SHR_NEVER);
00182
00183 CDialog::OnOK();
00184 }
00185
00186 void CDlg_SpreadHelp2::OnCancel()
00187 {
00188 if (IsDlgButtonChecked (IDC_REMIND_IN3DAYS) == BST_CHECKED)
00189 _App.View_SpreadHelpDialog (SHR_IN3DAYS);
00190 else
00191 _App.View_SpreadHelpDialog (SHR_NEVER);
00192
00193 CDialog::OnCancel();
00194 }