// WebPageRoot.cpp : implementation file // #include "stdafx.h" #include "udpadmintool.h" #include "WebPageRoot.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CWebPageRoot dialog CWebPageRoot::CWebPageRoot(CWnd* pParent /*=NULL*/) : CDialog(CWebPageRoot::IDD, pParent) { //{{AFX_DATA_INIT(CWebPageRoot) m_sNewRoot = _T(""); m_edSelectIP = _T(""); //}}AFX_DATA_INIT } void CWebPageRoot::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CWebPageRoot) DDX_Text(pDX, IDC_EDIT_NEWROOT, m_sNewRoot); DDX_Text(pDX, IDC_EDIT_SELECT_IP, m_edSelectIP); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CWebPageRoot, CDialog) //{{AFX_MSG_MAP(CWebPageRoot) ON_BN_CLICKED(IDC_BUTTON_SETUP, OnButtonSetup) ON_BN_CLICKED(IDC_CHECK, OnCheck) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CWebPageRoot message handlers void CWebPageRoot::OnButtonSetup() { // TODO: Add your control notification handler code here char wwwroot[64]; UpdateData(TRUE); GetDlgItem(IDC_BUTTON_SETUP)->EnableWindow(FALSE); GetDlgItem(IDOK)->EnableWindow(FALSE); //GetDlgItem(IDCANCEL)->EnableWindow(FALSE); if(m_sNewRoot.GetLength()<5 || strstr(m_sNewRoot, "..")>0) { AfxMessageBox("An input format is invalid."); return; } sprintf(wwwroot, m_sNewRoot); // web root´Â CtrlDeviceEx¸¦ Áö¿øÇÏ´Â 61XÄ¿³Î¿¡¼­´Â À¯È¿ÇÏÁö ¾Ê´Ù. - cjy, 07_1130 14:34 if(CtrlDevice(theApp.m_info.sIp, 0x40, (unsigned char *)wwwroot, m_sNewRoot.GetLength())) { // success // AfxMessageBox("Web Page Root path is successfully changed. Please upload customer¡¯s own webpage using IPAdminTool."); AfxMessageBox("Web root path is successfully changed. Please upload your webpages using IPAdminTool"); } else { // fail //AfxMessageBox("Changing web root path completed"); AfxMessageBox("Can not change the web root path.\n" "* Note: Change web root path is not avaliable in Kernel 510 or later version"); // - cjy, 07_1123 14:15 } GetDlgItem(IDC_BUTTON_SETUP)->EnableWindow(TRUE); GetDlgItem(IDOK)->EnableWindow(TRUE); //GetDlgItem(IDCANCEL)->EnableWindow(TRUE); } BOOL CWebPageRoot::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here int i, flag=0; char temp[5]; UpdateData(); m_edSelectIP = theApp.GetSelectDeviceName(); UpdateData(FALSE); memset(temp, 0x00, sizeof(temp)); for(i=0; i<50; i++) { if(theApp.m_info.FirmwareVersion[i] == '.') { flag++; if(flag==2) { memcpy(temp, &theApp.m_info.FirmwareVersion[i+1], 3); if(atoi(temp)<326) { AfxMessageBox("This firmware does not support \"Web root path change\" function."); OnOK(); } break; } } } if(i>45) { AfxMessageBox("This firmware does not support \"Web root path change\" function."); OnOK(); } if(theApp.m_info.wwwroot[0] == '(') GetDlgItem(IDC_EDIT_OLDROOT)->SetWindowText("/boawww"); else GetDlgItem(IDC_EDIT_OLDROOT)->SetWindowText(theApp.m_info.wwwroot); m_bCheck = FALSE; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL CWebPageRoot::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->wParam == VK_RETURN) { return TRUE; } return CDialog::PreTranslateMessage(pMsg); } void CWebPageRoot::OnCheck() { // TODO: Add your control notification handler code here if(m_bCheck) { GetDlgItem(IDC_EDIT_NEWROOT)->EnableWindow(TRUE); m_bCheck = FALSE; } else { GetDlgItem(IDC_EDIT_NEWROOT)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_NEWROOT)->SetWindowText("/boawww"); m_bCheck = TRUE; } }