DirectoryDlg.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /****************************************************************/
  2. /* */
  3. /* DirectoryDlg.cpp */
  4. /* */
  5. /* Implementation of the CDirectoryDlg class. */
  6. /* This class is a part of the FTP Server Application */
  7. /* */
  8. /* Programmed by LYFZ van der Meer */
  9. /* Copyright LYFZ Software Solutions 2002 */
  10. /* http://www.LYFZvandermeer.nl */
  11. /* */
  12. /* Last updated: 10 july 2002 */
  13. /* */
  14. /****************************************************************/
  15. #include "stdafx.h"
  16. #include "DBServer.h"
  17. #include "DirectoryDlg.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. CDirectoryDlg::CDirectoryDlg(CWnd* pParent /*=NULL*/)
  24. : CDialog(CDirectoryDlg::IDD, pParent)
  25. {
  26. //{{AFX_DATA_INIT(CDirectoryDlg)
  27. m_strPath = _T("");
  28. m_bVirtualDir = FALSE;
  29. m_strAlias = _T("");
  30. m_bAllowCreateDirectory = FALSE;
  31. m_bAllowDelete = FALSE;
  32. m_bAllowDownload = FALSE;
  33. m_bAllowRename = FALSE;
  34. m_bAllowUpload = FALSE;
  35. //}}AFX_DATA_INIT
  36. }
  37. void CDirectoryDlg::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CDirectoryDlg)
  41. DDX_Text(pDX, IDC_PATH, m_strPath);
  42. DDX_Check(pDX, IDC_VIRTUALDIR, m_bVirtualDir);
  43. DDX_Text(pDX, IDC_ALIAS, m_strAlias);
  44. DDX_Check(pDX, IDC_CREATE_DIR, m_bAllowCreateDirectory);
  45. DDX_Check(pDX, IDC_DELETE, m_bAllowDelete);
  46. DDX_Check(pDX, IDC_DOWNLOAD, m_bAllowDownload);
  47. DDX_Check(pDX, IDC_RENAME, m_bAllowRename);
  48. DDX_Check(pDX, IDC_UPLOAD, m_bAllowUpload);
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(CDirectoryDlg, CDialog)
  52. //{{AFX_MSG_MAP(CDirectoryDlg)
  53. ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
  54. ON_BN_CLICKED(IDC_VIRTUALDIR, OnVirtualdir)
  55. //}}AFX_MSG_MAP
  56. END_MESSAGE_MAP()
  57. void CDirectoryDlg::OnBrowse()
  58. {
  59. CString strDir = BrowseForFolder(m_hWnd, "Select a directory:", BIF_RETURNONLYFSDIRS);
  60. if (!strDir.IsEmpty())
  61. {
  62. m_strPath = strDir;
  63. UpdateData(FALSE);
  64. }
  65. }
  66. BOOL CDirectoryDlg::OnInitDialog()
  67. {
  68. CDialog::OnInitDialog();
  69. if (!m_strTitle.IsEmpty())
  70. SetWindowText(m_strTitle);
  71. if (m_bIsHomeDir)
  72. {
  73. GetDlgItem(IDC_VIRTUALDIR)->EnableWindow(FALSE);
  74. GetDlgItem(IDC_ALIAS)->EnableWindow(FALSE);
  75. GetDlgItem(IDC_ALIAS)->SetWindowText("/");
  76. }
  77. else
  78. {
  79. OnVirtualdir();
  80. }
  81. return TRUE;
  82. }
  83. void CDirectoryDlg::OnVirtualdir()
  84. {
  85. UpdateData();
  86. if (m_bVirtualDir)
  87. GetDlgItem(IDC_ALIAS)->EnableWindow();
  88. else
  89. GetDlgItem(IDC_ALIAS)->EnableWindow(FALSE);
  90. }