#include "StdAfx.h" #include "MBDocAttrWnd.h" CMBDocAttrWnd::CMBDocAttrWnd(void):SHostDialog(_T("LAYOUT:DLG_DOCATTR")) { m_bLayoutInited = FALSE; m_pDocInfo = NULL; // °æ±¾Áбí m_pVerLstAdapter = NULL; m_pLvVerLst = NULL; // ¹ØÁªÁбí m_pLinkLstAdapter = NULL; m_pLvLinkLst = NULL; // ÈÕÖ¾ä¯ÀÀÁбí m_pMCLVLogViewLst = NULL; m_pDocLogViewLstAdapter = NULL; // ÈÕÖ¾ÏÂÔØÁбí m_pMCLVLogDldLst = NULL; m_pDocLogDldLstAdapter = NULL; m_pSvrMgr = NULL; m_pHisDocMgr = new CMBHisDocMgr(); // ÀúÊ·¹ÜÀíÆ÷ m_pDocNormalLogMgr = new CMBDocLogMgr(); // ³£¹æÈÕÖ¾¹ÜÀí m_pDocViewLogMgr = new CMBDocLogMgr(); // ä¯ÀÀÈÕÖ¾¹ÜÀí m_pDocDldLogMgr = new CMBDocLogMgr(); // ÏÂÔØÈÕÖ¾¹ÜÀí m_pFileSvrClientMgr = new CMBFileSvrClientMgr();// Îļþ·þÎñ¹ÜÀíÆ÷ // ä¯ÀÀ¹ÜÀíÆ÷ m_pViewWndMgr = new CMBViewWndMgr(); } CMBDocAttrWnd::~CMBDocAttrWnd(void) { UnRegisterNotifyCenter(); MBSAFE_DELETE(m_pDocNormalLogMgr) MBSAFE_DELETE(m_pDocViewLogMgr) MBSAFE_DELETE(m_pDocDldLogMgr) MBSAFE_DELETE(m_pFileSvrClientMgr) MBSAFE_DELETE(m_pViewWndMgr) } // ÉèÖÃÎļþÐÅÏ¢ void CMBDocAttrWnd::SetDocInfo( CMBDocInfo *pDocInfo ) { m_pDocInfo = pDocInfo; } void CMBDocAttrWnd::SetSvrMgr( CMBServerMgr *pSvrMgr ) { m_pSvrMgr = pSvrMgr; m_pViewWndMgr->SetSvrMgr(m_pSvrMgr); } int CMBDocAttrWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { SetMsgHandled(FALSE); return 0; } BOOL CMBDocAttrWnd::OnInitDialog(HWND hWnd, LPARAM lParam) { m_bLayoutInited = TRUE; // ×¢²á RegisterNotifyCenter(); InitFileSvrCientMgr(); ///////////°æ±¾Áбí//////////////////// m_pLvVerLst = FindChildByName2("lv_verlst"); if(m_pLvVerLst) { m_pVerLstAdapter = new CMBVerLstAdapter(); m_pVerLstAdapter->SetDocInfo(m_pDocInfo); m_pLvVerLst->SetAdapter(m_pVerLstAdapter); m_pVerLstAdapter->Release(); } //////////////¹ØÁªÁбí///////////////// m_pLvLinkLst = FindChildByName2("lv_linklst"); if(m_pLvLinkLst) { m_pLinkLstAdapter = new CMBLinkLstAdapter(); m_pLinkLstAdapter->SetSvrMgr(m_pSvrMgr); m_pLvLinkLst->SetAdapter(m_pLinkLstAdapter); m_pLinkLstAdapter->Release(); } //////////////ÈÕÖ¾ä¯ÀÀÁбí///////////////////////// m_pMCLVLogViewLst = FindChildByName2("mclv_log_view"); if(m_pMCLVLogViewLst) { m_pDocLogViewLstAdapter = new CMBDocLogViewLstAdapter(); m_pMCLVLogViewLst->SetAdapter(m_pDocLogViewLstAdapter); m_pDocLogViewLstAdapter->Release(); } ////////////////ÈÕÖ¾ÏÂÔØÁбí/////////////////////////// m_pMCLVLogDldLst = FindChildByName2("mclv_log_dld"); if(m_pMCLVLogDldLst) { m_pDocLogDldLstAdapter = new CMBDocLogDldLstAdapter(); m_pMCLVLogDldLst->SetAdapter(m_pDocLogDldLstAdapter); m_pDocLogDldLstAdapter->Release(); } SetTimer(WM_TIMER_INIT,20); return 0; } void CMBDocAttrWnd::OnTabPageRadioSwitch(int nID) { CString strErrInfo; STabCtrl *pTab = FindChildByName2(L"tab_docattr"); if( NULL == pTab ) return; switch (nID){ case PAGE_DOCATTR_ATTR_ID: // ÊôÐÔ { pTab->SetCurSel(_T("ÊôÐÔ")); } break; case PAGE_DOCATTR_ASSOCI_ID: // ¹ØÁª { pTab->SetCurSel(_T("¹ØÁª")); } break; case PAGE_DOCATTR_VERSION_ID: // °æ±¾ { // µÃµ½ÀúÊ· °æ±¾ if( !m_pHisDocMgr->m_bGetHistoryDocList ) { CMBHisDocInfo *pHisDocInfo = new CMBHisDocInfo(); pHisDocInfo->m_strID = m_pDocInfo->m_strID; pHisDocInfo->m_strHistoryID = m_pDocInfo->m_strFileID; pHisDocInfo->m_strFileName = m_pDocInfo->m_strFileName; pHisDocInfo->m_strVer = m_pDocInfo->m_strVer; pHisDocInfo->m_strFileTime = m_pDocInfo->m_strFileTime; if( !m_pHisDocMgr->AddHisDocInfo(pHisDocInfo) ) { delete pHisDocInfo; pHisDocInfo = NULL; } // µÃµ½ÀúÊ·°æ±¾ if(!CMBDocSvrCommomFtn::GetHistoryDocList(m_pSvrMgr,m_pDocInfo,m_pHisDocMgr,strErrInfo)) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return ; } ReVerLstAdapter(); m_pLvVerLst->SetSel(0); } pTab->SetCurSel(_T("°æ±¾")); } break; case PAGE_DOCATTR_LOG_ID: // ÈÕÖ¾ { InitDocLogMgr( 0 ); pTab->SetCurSel(_T("ÈÕÖ¾")); } break; } } void CMBDocAttrWnd::ReVerLstAdapter() { CMBBaseObjVector vectorObj; m_pHisDocMgr->GetBaseObjVector(vectorObj); m_pVerLstAdapter->SetVectorObj( vectorObj ); m_pVerLstAdapter->notifyDataSetChanged(); } void CMBDocAttrWnd::OnTabLogPageRadioSwitch(int nID) { CString strErrInfo; STabCtrl *pTab = FindChildByName2(L"tab_dlg_logattr"); if( NULL == pTab ) return; switch (nID){ case PAGE_DOCATTR_LOG_CYCLE_ID: // ÉúÃüÖÜÆÚ { InitDocLogMgr( 0 ); pTab->SetCurSel(_T("ÉúÃüÖÜÆÚ")); } break; case PAGE_DOCATTR_LOG_VIEW_ID: // ä¯ÀÀ { InitDocLogMgr( 1 ); pTab->SetCurSel(_T("ä¯ÀÀ")); } break; case PAGE_DOCATTR_LOG_DLD_ID: // ÏÂÔØ { InitDocLogMgr( 2 ); pTab->SetCurSel(_T("ÏÂÔØ")); } break; } } void CMBDocAttrWnd::OnTimer(UINT_PTR nIDEvent) { switch (nIDEvent) { case WM_TIMER_INIT: { KillTimer(WM_TIMER_INIT); CString strErrInfo; // µÃµ½ÎĵµÐÅÏ¢ if( !CMBDocSvrCommomFtn::GetDocInfo(m_pSvrMgr,m_pDocInfo,strErrInfo ) ) // µÃµ½ÎĵµÐÅÏ¢ { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return ; } // ³õʼ»¯Êý¾Ý InitData(m_pDocInfo); }break; default: SetMsgHandled(FALSE); break; } } void CMBDocAttrWnd::InitData( CMBDocInfo *pDocInfo ) { if( NULL == pDocInfo ) return ; CString strTags,strTmpTag; CStringArray arTags; CMBBaseAttachDocObjVector::iterator it; CMBBaseAttachDocObj *pAttachDocObj = NULL; CMBBaseAttachDocObjVector vecotrAttachObj; CMBBaseObjVector vectorObj; SStringT strEvalValue,strEvalNum,strViewNum,strDownloadNum; strEvalValue.Format(_T("%d.0"),pDocInfo->m_nEvalValue); strEvalNum.Format(_T("%d"),pDocInfo->m_nEvalNum); strViewNum.Format(_T("%d"),pDocInfo->m_nViewNum); strDownloadNum.Format(_T("%d"),pDocInfo->m_nDownloadNum); /////////////////////״̬ SStatic *pTxtDocType = FindChildByName2("txt_doctype"); if( NULL == pTxtDocType ) return ; pTxtDocType->SetWindowText( pDocInfo->m_strDocType ); /////////////////////×ÜÆÀ·Ö SStatic *pTxtEvalVal = FindChildByName2("txt_evalvalue"); if( NULL == pTxtEvalVal ) return ; pTxtEvalVal->SetWindowText(strEvalValue); /////////////////////ƽ¾ùÆÀ·Ö SRatingBarEx *pRBExEvalVal = FindChildByName2("rating_evalvalue"); if( NULL == pRBExEvalVal ) return ; if( pDocInfo->m_nEvalNum != 0 ) { pRBExEvalVal->SetValue(float(pDocInfo->m_nEvalValue / pDocInfo->m_nEvalNum)); } pRBExEvalVal->EnableWindow(FALSE,TRUE); /////////////////////ä¯ÀÀÊý SStatic *pTxtViewNum = FindChildByName2("txt_viewnum"); if( NULL == pTxtViewNum ) return ; pTxtViewNum->SetWindowText(strViewNum); /////////////////////ÏÂÔØÊý SStatic *pTxtDldNum = FindChildByName2("txt_dldnum"); if( NULL == pTxtDldNum ) return ; pTxtDldNum->SetWindowText(strDownloadNum); /////////////////////ÆÀÂÛ SStatic *pTxtEvalNum = FindChildByName2("txt_evalnum"); if( NULL == pTxtEvalNum ) return ; pTxtEvalNum->SetWindowText(strEvalNum); ////////////////////////////µÚÒ»ÐÐ///////////////////////////////// /////////////////////±àºÅ SStatic *pTxtCode = FindChildByName2("docattr_code"); if( NULL == pTxtCode ) return ; pTxtCode->SetWindowText(pDocInfo->m_strCode); /////////////////////°æ±¾ SStatic *pTxtVersion = FindChildByName2("docattr_version"); if( NULL == pTxtVersion ) return ; pTxtVersion->SetWindowText(pDocInfo->m_strVer); /////////////////////״̬ SStatic *pTxtStatus = FindChildByName2("docattr_status"); if( NULL == pTxtStatus ) return ; pTxtStatus->SetWindowText(pDocInfo->m_strStatus); /////////////////////´óС SStatic *pTxtSize = FindChildByName2("docattr_size"); if( NULL == pTxtSize ) return ; pTxtSize->SetWindowText(CStrFileUtils::GetFileSizeDisplayStr(pDocInfo->m_nFileSize)); ////////////////////////////µÚ¶þÐÐ///////////////////////////////// /////////////////////ÎļþÃû³Æ SStatic *pTxtName = FindChildByName2("docattr_name"); if( NULL == pTxtName ) return ; pTxtName->SetWindowText(pDocInfo->m_strFileName); ////////////////////////////µÚÈýÐÐ///////////////////////////////// ////////////////////¸½¼þ SWindow *pWndAttach = FindChildByName("docattr_attach"); if( NULL == pWndAttach ) return ; CMBAttachDocMgr *pAttachDocMgr = pDocInfo->GetAttachDocMgr(); if(pAttachDocMgr) { pAttachDocMgr->GetAttachObjVector( vecotrAttachObj); for( it = vecotrAttachObj.begin();it != vecotrAttachObj.end();it++ ) { pAttachDocObj = *it; AddAttachToUI( pWndAttach,pAttachDocObj ); } } ////////////////////////////µÚËÄÐÐ///////////////////////////////// /////////////////////Îĵµ¹ñ SStatic *pTxtCabinetName = FindChildByName2("docattr_cabinet_name"); if( NULL == pTxtCabinetName ) return ; pTxtCabinetName->SetWindowText(pDocInfo->m_strCabinetName); /////////////////////Ŀ¼ SStatic *pTxtCatalogName = FindChildByName2("docattr_catalog_name"); if( NULL == pTxtCatalogName ) return ; pTxtCatalogName->SetWindowText(pDocInfo->m_strCatalogName); ////////////////////////////µÚÎåÐÐ///////////////////////////////// /////////////////////Ãܼ¶ SStatic *pTxtSecret = FindChildByName2("docattr_secret"); if( NULL == pTxtSecret ) return ; pTxtSecret->SetWindowText(pDocInfo->m_strSecretName); /////////////////////ÓÐЧÆÚ SStatic *pTxtValidTime = FindChildByName2("docattr_valid_time"); if( NULL == pTxtValidTime ) return ; pTxtValidTime->SetWindowText( CMBDateUtils::GetDateToMin(pDocInfo->m_strExpDate) ); ////////////////////////////µÚÁùÐÐ///////////////////////////////// /////////////////////ÉÏ´«ÈË SStatic *pTxtUploadPsn = FindChildByName2("docattr_upload_person"); if( NULL == pTxtUploadPsn ) return ; pTxtUploadPsn->SetWindowText(pDocInfo->m_strCreatorName); /////////////////////ÉÏ´«ÈÕÆÚ SStatic *pTxtUploadTime = FindChildByName2("docattr_upload_time"); if( NULL == pTxtUploadTime ) return ; pTxtUploadTime->SetWindowText( CMBDateUtils::GetDateToMin( pDocInfo->m_strDTCreate ) ); ////////////////////////////µÚÆßÐÐ///////////////////////////////// /////////////////////×÷Õß SStatic *pTxtCreator = FindChildByName2("docattr_creator"); if( NULL == pTxtCreator ) return ; pTxtCreator->SetWindowText(pDocInfo->m_strAuthor); /////////////////////²¿ÃÅ SStatic *pTxtDepart = FindChildByName2("docattr_depart"); if( NULL == pTxtDepart ) return ; pTxtDepart->SetWindowText( pDocInfo->m_strAuthorDepart ); ////////////////////////////µÚ°ËÐÐ///////////////////////////////// /////////////////////±êÇ© SStatic *pTxtTag = FindChildByName2("docattr_tag"); if( NULL == pTxtTag ) return ; pDocInfo->GetTags(arTags); for( int i = 0;i < arTags.GetCount();i++ ) { CString strTag = arTags[i]; if( i == 0 ) { strTags += strTag; }else{ strTmpTag.Format(_T(" / %s"),strTag); strTags += strTmpTag; } } pTxtTag->SetWindowText(strTags); /*STagView *pTag = FindChildByName2("docattr_tag"); if( NULL == pTag ) return ; pDocInfo->GetTags(arTags); for( int i = 0;i < arTags.GetCount();i++ ) { CString strTag = arTags[i]; SWindow *pWnd = pTag->InsertTag(); pWnd->FindChildByName(_T("txt_item"))->SetWindowText(strTag); } pTag->ReLayout();*/ ////////////////////////////µÚ¾ÅÐÐ///////////////////////////////// /////////////////////±¸×¢ SStatic *pTxtRemark = FindChildByName2("docattr_remark"); if( NULL == pTxtRemark ) return ; pTxtRemark->SetWindowText( pDocInfo->m_strNote ); ///////////////////////////¹ØÁªÎĵµÊý¾Ý//////////////////////////// CMBLinkDocMgr *pLinkDocMgr = pDocInfo->GetLinkDocMgr(); if( pLinkDocMgr ) { pLinkDocMgr->GetBaseObjVector( vectorObj ); m_pLinkLstAdapter->SetVectorObj(vectorObj); } } // Ïò½çÃæÔö¼Ó¸½¼þ void CMBDocAttrWnd::AddAttachToUI( SWindow *pWndAttach,CMBBaseAttachDocObj *pAttachDocObj ) { if( NULL == pWndAttach || NULL == pAttachDocObj ) return ; CString strXml; strXml.Format(_T("") \ _T("%s") \ _T("") \ _T(""),pAttachDocObj->m_strFileName); SWindow *pItem = pWndAttach->CreateChildren(strXml); if( NULL == pItem ) return ; SWindow *pLkName = pItem->FindChildByName(_T("lk_name")); if( NULL != pLkName ) { pLkName->SetUserData((ULONG_PTR)pAttachDocObj); pLkName->GetEventSet()->subscribeEvent(EVT_CMD, Subscriber(&CMBDocAttrWnd::OnEventViewAttach, this)); } SWindow *pBtnDld = pItem->FindChildByName(_T("btn_dld")); if( NULL != pBtnDld ) { pBtnDld->SetUserData((ULONG_PTR)pAttachDocObj); pBtnDld->GetEventSet()->subscribeEvent(EVT_CMD, Subscriber(&CMBDocAttrWnd::OnEventDldAttach, this)); } } // 0 -- ³£¹æ,1 -- ä¯ÀÀ,2 -- ÏÂÔØ void CMBDocAttrWnd::InitDocLogMgr( int nType ) { CString strSessionID,strResult, strType,strErrInfo; switch( nType ) { case 0: { strType = _T("³£¹æ"); if( !m_pDocNormalLogMgr->m_bDMSGetDocTypeLog ) { if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocInfo->m_strID,strType, _T(""),strSessionID, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocNormalLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } m_pDocNormalLogMgr->m_bDMSGetDocTypeLog = true; // ³õʼ»¯ÉúÃüÖÜÆÚ InitLifeCycle( m_pDocNormalLogMgr ); } } break; case 1: { strType = _T("ä¯ÀÀ"); if( !m_pDocViewLogMgr->m_bDMSGetDocTypeLog ) { if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocInfo->m_strID,strType, _T(""),strSessionID, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocViewLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } /////////////////////////////////////////// CMBBaseObjVector vectorObj; m_pDocViewLogMgr->GetBaseObjVector(vectorObj); m_pDocLogViewLstAdapter->SetVectorObj(vectorObj); /////////////////////////////////////////////// m_pDocViewLogMgr->m_bDMSGetDocTypeLog = true; } } break; case 2: { strType = _T("ÏÂÔØ"); if( !m_pDocDldLogMgr->m_bDMSGetDocTypeLog ) { if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocInfo->m_strID,strType, _T(""),strSessionID, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocDldLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } /////////////////////////////////////////// CMBBaseObjVector vectorObj; m_pDocDldLogMgr->GetBaseObjVector(vectorObj); m_pDocLogDldLstAdapter->SetVectorObj(vectorObj); /////////////////////////////////////////////// m_pDocDldLogMgr->m_bDMSGetDocTypeLog = true; } } break; } } // 0 -- ³£¹æ,1 -- ä¯ÀÀ,2 -- ÏÂÔØ void CMBDocAttrWnd::LoadDocLogMgr( int nType ) { CString strResult, strErrInfo; switch( nType ) { case 0: { // Ϊ×îºóÒ»Ò³£¬Ôò²»´¦Àí if(m_pDocNormalLogMgr->m_nCurPage == m_pDocNormalLogMgr->m_nTotalPages ) return ; if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocNormalLogMgr->m_strSessionID,m_pDocNormalLogMgr->m_nCurPage+1, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocNormalLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ³õʼ»¯ÉúÃüÖÜÆÚ InitLifeCycle( m_pDocNormalLogMgr ); } break; case 1: { // Ϊ×îºóÒ»Ò³£¬Ôò²»´¦Àí if( m_pDocViewLogMgr->m_nCurPage == m_pDocViewLogMgr->m_nTotalPages ) return ; if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocViewLogMgr->m_strSessionID,m_pDocViewLogMgr->m_nCurPage+1, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocViewLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } /////////////////////////////////////////// CMBBaseObjVector vectorObj; m_pDocViewLogMgr->GetBaseObjVector(vectorObj); m_pDocLogViewLstAdapter->SetVectorObj(vectorObj); /////////////////////////////////////////////// } break; case 2: { // Ϊ×îºóÒ»Ò³£¬Ôò²»´¦Àí if(m_pDocDldLogMgr->m_nCurPage == m_pDocDldLogMgr->m_nTotalPages ) return ; if( !m_pSvrMgr->GetNetDiskWebCMgr()->DMSGetDocTypeLog( m_pDocDldLogMgr->m_strSessionID,m_pDocDldLogMgr->m_nCurPage+1, strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } // ½âÎö·þÎñ¶ËÊý¾Ý if(!m_pDocDldLogMgr->ParseXml( strResult,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎó"),MB_OK); return ; } /////////////////////////////////////////// CMBBaseObjVector vectorObj; m_pDocDldLogMgr->GetBaseObjVector(vectorObj); m_pDocLogDldLstAdapter->SetVectorObj(vectorObj); /////////////////////////////////////////////// } break; } } // ³õʼ»¯ÉúÃüÖÜÆÚ void CMBDocAttrWnd::InitLifeCycle( CMBDocLogMgr *pLogMgr ) { SWindow *pWndLifeCycle = FindChildByName(_T("wnd_lifecycle")); if( pLogMgr == NULL || pWndLifeCycle == NULL ) return ; int nIndex = 1; /// µÃµ½Êý¾Ý CMBBaseDocLogObjVector::iterator it; CMBBaseDocLogObj *pDocLogObj = NULL; CMBBaseDocLogObjVector vecotrDocLogObj; pLogMgr->GetDocLogObjVector(vecotrDocLogObj); ///////////////////////////////////////////////////////////////// // ÏÈÇå³ý°É DestroyAllChild( pWndLifeCycle ); ////²åÈëÒ»ÌõÏß°É InsertLineToLiefCycle(pWndLifeCycle ); /////////////////////// for( it = vecotrDocLogObj.begin();it != vecotrDocLogObj.end();it++ ) { pDocLogObj = *it; if(AddLogObjToUI( pWndLifeCycle,pDocLogObj,nIndex )) { nIndex++; } } } // Ìí¼ÓÈÕÖ¾ÏòUIÖÐ bool CMBDocAttrWnd::AddLogObjToUI( SWindow *pWndLifeCycle,CMBBaseDocLogObj *pDocLogObj,int nIndex ) { if( NULL == pDocLogObj || 0 == nIndex ) return false; CString strLogType,strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor,strTime,strFontFace; strLogType = pDocLogObj->m_strType; strTime = CMBDateUtils::GetMonDayToMin( pDocLogObj->m_strTime ); strLogPsnPlusTime.Format(_T("%s %s"),pDocLogObj->m_strOperatorName,strTime); if( strLogType == _T("ÉÏ´«") ) { strRoundSkin = _T("doclog_upload"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-upload_x"); } else if( strLogType == _T("¶¨°æ") ) { strRoundSkin = _T("doclog_fixedver"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-flag"); } else if( strLogType == _T("·¢²¼") ) { strRoundSkin = _T("doclog_release"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-SendMsg"); } else if( strLogType == _T("Éý°æ") ) { strRoundSkin = _T("doclog_upver"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-up_version"); } else if( strLogType == _T("×÷·Ï") ) { strRoundSkin = _T("doclog_invalid"); strRoundTxtColor = _T("#000000"); strRoundTxt = _T("fu-file_invalid"); } else if( strLogType == _T("ÖØÆôÓ¦ÓÃ") ) { strRoundSkin = _T("doclog_recall"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-recall2"); } else if( strLogType == _T("ÊôÐÔ±ä¸ü") ) { strRoundSkin = _T("doclog_attr_change"); strRoundTxtColor = _T("#000000"); strRoundTxt = _T("fu-edit"); } else if( strLogType == _T("ÐÂÔö¸½¼þ") ) { strRoundSkin = _T("doclog_add_attach"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-attach"); } else if( strLogType == _T("ɾ³ý¸½¼þ") ) { strRoundSkin = _T("doclog_del_attach"); strRoundTxtColor = _T("#000000"); strRoundTxt = _T("fu-attach_del"); } else if( strLogType == _T("ÐÂÔö¹ØÁª") ) { strRoundSkin = _T("doclog_add_link"); strRoundTxtColor = _T("#FFFFFF"); strRoundTxt = _T("fu-link"); } else if( strLogType == _T("ɾ³ý¹ØÁª") ) { strRoundSkin = _T("doclog_del_link"); strRoundTxtColor = _T("#000000"); strRoundTxt = _T("fu-link_del"); } else { return false; // ²»´¦Àí } ///// strRoundTxt = m_pSvrMgr->GetIconFontMgr()->GetFontIconValue(strRoundTxt); // ²éÕÒ //////////////////////////////////////////////// if( nIndex == 1 ) { InsertFirstItemToLifeCycle(pWndLifeCycle, strLogType,strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor ); return true; } if( (nIndex % 2) == 0 ) // żÊý { InsertEvenItemToLifeCycle(pWndLifeCycle, strLogType,strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor ); } else // ÆæÊý { InsertOddItemToLifeCycle( pWndLifeCycle,strLogType,strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor ); } return true; } void CMBDocAttrWnd::InsertLineToLiefCycle(SWindow *pWndLifeCycle ) { if( NULL == pWndLifeCycle ) return ; CString strXml; strXml.Format(_T("
")); pWndLifeCycle->CreateChildren(strXml); } // ²åÈëµÚÒ»ÏîÏòÉúÃüÖÜÆÚ void CMBDocAttrWnd::InsertFirstItemToLifeCycle(SWindow *pWndLifeCycle,CString strLogType,CString strLogPsnPlusTime,CString strRoundSkin,CString strRoundTxt,CString strRoundTxtColor ) { if( NULL == pWndLifeCycle ) return ; CString strXml; strXml.Format(_T("%s") \ _T("") \ _T("%s"), strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor,strLogType ); SWindow *pWnd = new SWindow(); pWndLifeCycle->InsertChild(pWnd); pWnd->SetAttribute(_T("pos"),_T("0,0,-1,@41")); pWnd->CreateChildren(strXml); } // ²åÈëÆæÊýÏîÏòÉúÃüÖÜÆÚ void CMBDocAttrWnd::InsertOddItemToLifeCycle( SWindow *pWndLifeCycle,CString strLogType,CString strLogPsnPlusTime,CString strRoundSkin,CString strRoundTxt,CString strRoundTxtColor ) { if( NULL == pWndLifeCycle ) return ; CString strXml; strXml.Format(_T("%s") \ _T("") \ _T("%s"), strLogPsnPlusTime,strRoundSkin, strRoundTxt, strRoundTxtColor,strLogType ); SWindow *pWnd = new SWindow(); pWndLifeCycle->InsertChild(pWnd); pWnd->SetAttribute(_T("pos"),_T("0,[23,-1,@41")); pWnd->CreateChildren(strXml); } // ²åÈëżÊýÏîÏòÉúÃüÖÜÆÚ void CMBDocAttrWnd::InsertEvenItemToLifeCycle( SWindow *pWndLifeCycle,CString strLogType,CString strLogPsnPlusTime,CString strRoundSkin,CString strRoundTxt,CString strRoundTxtColor ) { if( NULL == pWndLifeCycle ) return ; CString strXml; strXml.Format(_T("%s") \ _T("") \ _T("%s"), strLogType,strRoundSkin, strRoundTxt, strRoundTxtColor,strLogPsnPlusTime); SWindow *pWnd = new SWindow(); pWndLifeCycle->InsertChild(pWnd); pWnd->SetAttribute(_T("pos"),_T("0,[23,-1,@41")); pWnd->CreateChildren(strXml); } // ³£¹æ // 0 -- ³£¹æ,1 -- ä¯ÀÀ,2 -- ÏÂÔØ void CMBDocAttrWnd::OnEventLifeCycleScrollBottom(EventArgs *pEvt) { LoadDocLogMgr( 0 ); } // ä¯ÀÀ // 0 -- ³£¹æ,1 -- ä¯ÀÀ,2 -- ÏÂÔØ void CMBDocAttrWnd::OnEventLogViewScrollBottom(EventArgs *pEvt) { LoadDocLogMgr( 1 ); } // ÏÂÔØ // 0 -- ³£¹æ,1 -- ä¯ÀÀ,2 -- ÏÂÔØ void CMBDocAttrWnd::OnEventLogDldScrollBottom(EventArgs *pEvt) { LoadDocLogMgr( 2 ); } bool CMBDocAttrWnd::RegisterNotifyCenter() { SNotifyCenter::getSingleton().addEvent(EVENTID(EventHistoryDocEnable)); SNotifyCenter::getSingleton().addEvent(EVENTID(EventHistoryDocDld)); SNotifyCenter::getSingleton().addEvent(EVENTID(EventHistoryDocDel)); SNotifyCenter::getSingleton().addEvent(EVENTID(EventDocAttrViewLink)); return true; } bool CMBDocAttrWnd::UnRegisterNotifyCenter() { SNotifyCenter::getSingleton().removeEvent(EventHistoryDocEnable::EventID); SNotifyCenter::getSingleton().removeEvent(EventHistoryDocDld::EventID); SNotifyCenter::getSingleton().removeEvent(EventHistoryDocDel::EventID); SNotifyCenter::getSingleton().removeEvent(EventDocAttrViewLink::EventID); return true; } void CMBDocAttrWnd::InitFileSvrCientMgr() { CString strErrInfo; CString strLogin,strName; CMBFileSvrMgr *pFileSvrMgr = m_pSvrMgr->GetFileSvrMgr(); strLogin = m_pSvrMgr->GetUserLogin()->m_strLoginName; strName = m_pSvrMgr->GetUserLogin()->m_strUserName; if( !m_pFileSvrClientMgr->InitFileSvrCientMgr( m_hWnd,pFileSvrMgr,strLogin,strName,strErrInfo,false) ) return ; } bool CMBDocAttrWnd::OnEventHistoryDocEnable(EventArgs *e) { EventHistoryDocEnable *pTmpEnable = (EventHistoryDocEnable*)e; if( NULL == pTmpEnable->m_pBaseObj ) return false; int nIndex = pTmpEnable->m_nIndex; CString strHisID,strErrInfo,strFileName,strVer,strFileTime; CMBBaseObj *pBaseObj = pTmpEnable->m_pBaseObj; if( pBaseObj->IsKindOf( RUNTIME_CLASS(CMBHisDocInfo))) { CMBHisDocInfo *pHisDocInfo = (CMBHisDocInfo *)pBaseObj; strHisID = pHisDocInfo->m_strHistoryID; strFileName = pHisDocInfo->m_strFileName; strVer = pHisDocInfo->m_strVer; strFileTime = pHisDocInfo->m_strFileTime; } if(!m_pSvrMgr->GetNetDiskWebCMgr()->DMSSetHistoryDocActive(strHisID,strErrInfo)) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return false; } m_pDocInfo->m_bGetDocInfo = false; m_pDocInfo->m_strFileName = strFileName; m_pDocInfo->m_strVer = strVer; m_pDocInfo->m_strFileTime = strFileTime; m_pLvVerLst->SetSel(nIndex,true); return true; } bool CMBDocAttrWnd::OnEventHistoryDocDld(EventArgs *e) { EventHistoryDocDld *pTmpEnable = (EventHistoryDocDld*)e; if( NULL == pTmpEnable->m_pBaseObj ) return false; CString strFileID,strFileName, strFileServer,strPath,strErrInfo; CMBBaseObj *pBaseObj = pTmpEnable->m_pBaseObj; if( pBaseObj->IsKindOf( RUNTIME_CLASS(CMBHisDocInfo))) { CMBHisDocInfo *pHisDocInfo = (CMBHisDocInfo *)pBaseObj; if(!CMBDocSvrCommomFtn::GetDMSDocInfo(m_pSvrMgr,pHisDocInfo,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return false; } strFileID = pHisDocInfo->m_strFileID; strFileName = pHisDocInfo->m_strFileName; strFileServer = pHisDocInfo->m_strFileServer; } /////////////// CMBDownloadPathWnd dlgDownloadPathWnd; dlgDownloadPathWnd.SetDownloadPath( m_pSvrMgr->GetUserLogin()->m_strDownloadPath ); if( IDOK != dlgDownloadPathWnd.DoModal()) return false; strPath = dlgDownloadPathWnd.m_strSelPath; REQLOADSERVER_ITEM reqLoadServerItem; reqLoadServerItem.hWnd = m_hWnd; CMBFileClientMgr *pClientMgr = m_pFileSvrClientMgr->GetFileClientMgr(strFileServer,strErrInfo); if( NULL != pClientMgr ) { pClientMgr->DownloadFile_Asyn(reqLoadServerItem,strFileID,_T(""),strPath + _T("\\") + strFileName); } return true; } bool CMBDocAttrWnd::OnEventHistoryDocDel(EventArgs *e) { CString strErrInfo; EventHistoryDocDel *pTmpEnable = (EventHistoryDocDel*)e; if( NULL == pTmpEnable->m_pBaseObj ) return false; CMBBaseObj *pBaseObj = pTmpEnable->m_pBaseObj; if( !pBaseObj->IsKindOf( RUNTIME_CLASS(CMBHisDocInfo))) return false; ///////////Ìáʾ/////////////////////////////// CMBTipCancelWnd dlg; dlg.SetTipInfo(_T("È·¶¨ÒªÉ¾³ýÕâ¸ö°æ±¾Âð£¿")); if(IDCANCEL == dlg.DoModal()) return false; ///////////end Ìáʾ////////////////////////// CMBHisDocInfo *pHisDocInfo = (CMBHisDocInfo *)pBaseObj; if(!m_pSvrMgr->GetNetDiskWebCMgr()->DMSDeleteHistoryDoc(pHisDocInfo->m_strHistoryID, strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return false; } // Çå³ý m_pHisDocMgr->RemoveHisDocObj(pHisDocInfo); ReVerLstAdapter(); return true; } bool CMBDocAttrWnd::OnEventDocAttrViewLink(EventArgs *e) { EventDocAttrViewLink *pTmpEvt = (EventDocAttrViewLink*)e; if( NULL == pTmpEvt ) return false; CString strErrInfo; CMBBaseObj *pBaseObj = pTmpEvt->m_pBaseObj; if( !pBaseObj->IsKindOf( RUNTIME_CLASS(CMBLinkDocInfo))) return false; CMBLinkDocInfo *pLinkDocInfo = (CMBLinkDocInfo *)pBaseObj; if(!CMBDocSvrCommomFtn::GetDocInfo(m_pSvrMgr,pLinkDocInfo,strErrInfo )) { MBMessageBox(m_hWnd,strErrInfo,_T("´íÎóÌáʾ"),MB_OK); return false; } /////////////ÎļþÀàÐÍ//////////////////////////// CString strFileType = pLinkDocInfo->GetFileType(); strFileType = strFileType.MakeLower(); ///////////////////////////////////////////////// CString strFileID = pLinkDocInfo->m_strFileID; CString strFileServer = pLinkDocInfo->m_strFileServer; CString strName = pLinkDocInfo->m_strFileName; return ViewDoc( strFileType,strFileID,strFileServer,strName,strErrInfo ); } // Çå³ýËùÓÐ×ÓÏî void CMBDocAttrWnd::DestroyAllChild( SWindow *pWnd ) { if( NULL == pWnd ) return ; SWindow *pChild = NULL; int nCount = pWnd->GetChildrenCount(); pChild = pWnd->GetChild(GSW_FIRSTCHILD); while( NULL != pChild ) { pWnd->DestroyChild(pChild); pChild = pWnd->GetChild(GSW_NEXTSIBLING); } } // ä¯ÀÀ¸½¼þ bool CMBDocAttrWnd::OnEventViewAttach(EventArgs *pEvt) { SWindow *pSender = (SWindow *)pEvt->sender; if( NULL == pSender ) return false; CMBBaseAttachDocObj *pAttachDocObj = (CMBBaseAttachDocObj *)pSender->GetUserData(); if( NULL == pAttachDocObj ) return false; CString strErrInfo; /////////////ÎļþÀàÐÍ//////////////////////////// CString strFileType = pAttachDocObj->GetFileType(); strFileType = strFileType.MakeLower(); ///////////////////////////////////////////////// CString strFileID = pAttachDocObj->m_strFileID; CString strFileServer = pAttachDocObj->m_strFileServer; CString strName = pAttachDocObj->m_strFileName; return ViewDoc( strFileType,strFileID,strFileServer,strName,strErrInfo ); } // ÏÂÔØ¸½¼þ bool CMBDocAttrWnd::OnEventDldAttach(EventArgs *pEvt) { SWindow *pSender = (SWindow *)pEvt->sender; if( NULL == pSender ) return false; CMBBaseAttachDocObj *pAttachDocObj = (CMBBaseAttachDocObj *)pSender->GetUserData(); if( NULL == pAttachDocObj ) return false; CString strErrInfo,strPath; /////////////ÎļþÀàÐÍ//////////////////////////// CString strFileType = pAttachDocObj->GetFileType(); strFileType = strFileType.MakeLower(); ///////////////////////////////////////////////// CString strFileID = pAttachDocObj->m_strFileID; CString strFileServer = pAttachDocObj->m_strFileServer; CString strFileName = pAttachDocObj->m_strFileName; /////////////// CMBDownloadPathWnd dlgDownloadPathWnd; dlgDownloadPathWnd.SetDownloadPath(m_pSvrMgr->GetUserLogin()->m_strDownloadPath ); if( IDOK != dlgDownloadPathWnd.DoModal()) return false; strPath = dlgDownloadPathWnd.m_strSelPath; REQLOADSERVER_ITEM reqLoadServerItem; reqLoadServerItem.hWnd = m_hWnd; CMBFileClientMgr *pClientMgr = m_pFileSvrClientMgr->GetFileClientMgr(strFileServer,strErrInfo); if( NULL != pClientMgr ) { pClientMgr->DownloadFile_Asyn(reqLoadServerItem,strFileID,_T(""),strPath + _T("\\") + strFileName); } return true; } // ä¯ÀÀÎĵµ bool CMBDocAttrWnd::ViewDoc( CString strFileType,CString strFileID,CString strFileServer,CString strName,CString &strErrInfo ) { CString strOOSEnable = m_pSvrMgr->GetUserNetDiskInfo()->m_strOOSEnable; CString strOOSExtension = m_pSvrMgr->GetUserNetDiskInfo()->m_strOOSExtension; CString strOOSServer = m_pSvrMgr->GetUserNetDiskInfo()->m_strOOSServer; CString strOOSRoot = m_pSvrMgr->GetUserNetDiskInfo()->m_strOOSRoot; // Îļþ·þÎñ CMBFileSvrInfo * pFileServerInfo = m_pSvrMgr->GetFileSvrMgr()->GetFileSvrInfo( strFileServer ); if( pFileServerInfo == NULL ) { strErrInfo = _T("Îļþ·þÎñÆ÷±êʶΪ¿Õ£¡"); return false; } // ÎļþµÄurl CString strFileUrl = pFileServerInfo->GetUrl( ); if( CMBThumbnailType::IsOfficeType(strFileType) ) { if( strOOSEnable != _T("1") ) { m_pViewWndMgr->ViewPdf( strFileID,strFileUrl,strName,strErrInfo ); return true; } m_pViewWndMgr->ViewOOS( strFileUrl,strFileID,strName,strErrInfo ); } else if(CMBThumbnailType::IsImageType( strFileType ) ) // ä¯ÀÀͼƬ { m_pViewWndMgr->ViewImg(strFileServer,strFileType,strFileID,strErrInfo); } else if( 0 == _tcscmp(strFileType,_T(".pdf") )) // ä¯ÀÀpdf { m_pViewWndMgr->ViewPdf( strFileID,strFileUrl,strName ,strErrInfo ); } else if( CMBThumbnailType::IsTxtType( strFileType ) ) // ä¯ÀÀtxt { m_pViewWndMgr->ViewTxt( strFileServer,strName,strFileID,strErrInfo ) ; } else // { MBMessageBox(m_hWnd,_T("ĿǰÕâÖÖ¸ñʽϵͳÎÞ·¨Ö§³ÖÔÚÏßä¯ÀÀ£¡"),_T("´íÎóÌáʾ"),MB_OK); return true; } return true; }