/** * Load network iformation (hosts names) from ini file. * * @param aNetworkInfo ref. to the TNetworkInfo structure, which will be populated */ void CTestStepLLMNR_Init::LoadNetworkConfigFromIniL(TNetworkInfo& aNetworkInfo) { TName tmpBuf; TInt nRes; //-- get number of hosts which are supposed to be running //-- there should be at last 2 host names in the list TESTL(GetIntFromConfig(KNodesSection, _L("NumNodes"), nRes) && nRes >= KMinNodes); const TInt numNodes = nRes; //-- get maximal number of trials of host hame resolution TESTL(GetIntFromConfig(KNodesSection, _L("ConnectTrials"), nRes) && nRes >= 1); const TInt maxTrials = nRes; //-- populate NetworkInfo array with information from ini file. TNodeInfo nodeInfo; for(TInt i=0; i<numNodes; ++i) { //-- get host name from ini file tmpBuf.Format(_L("HostName%d"),i+1); if(!GetIniFileString(KNodesSection, tmpBuf, nodeInfo.iHostName)) continue; //-- put host info to the array nodeInfo.iCntTrials = maxTrials; aNetworkInfo.AppendNode(nodeInfo); } //-- check number of hosts to communicate with. TESTL(aNetworkInfo.NodesCount() >= KMinNodes); }
bool Init() { bool bRet = false; try { nMax_Updating_Num = atoi(GetIniFileString("OtherSet" , "maxUpCount" , "" , "DeviceUpgrade.ini").c_str()); nUpdating_Num = 0; SvIniFile inifile; SvIniFile::iterator pMap; GetSvIniFileBySections(inifile , "SipDownload.ini" , "default"); pMap = inifile.begin(); while(pMap != inifile.end()) { string strTemp = pMap->second.find("UpdateState")->second; // if(pMap->second.find("UpdateState")->second.compare("正在升级") == 0) if(strTemp.compare("正在升级") == 0) { string delayTime = pMap->second.find("DelayTime")->second; if(delayTime.empty()) { nUpdating_Num++; pMap++; continue; } string beginTime = pMap->second.find("BeginTime")->second; time_t CT; //当前时间 time_t ST; //开始时间 time_t DT; //超时时间 CTime t1 = CTime::GetCurrentTime(); CT = t1.GetTime(); Update::ConvertTime(beginTime , ST); DT = (atoi(delayTime.c_str()))*60*1000; if((ST+DT) > CT) { WriteIniFileString(pMap->first , "UpdateState" , "升级失败" , "SipDownload.ini"); } else { nUpdating_Num++; } } pMap++; } bRet = true; } catch(...) { char strErrorMsg[1024] = {0}; GetErrorMsg(strErrorMsg); WriteLog(strErrorMsg); bRet = false; } return bRet; }
void CSVReportSet::addPhoneListNew() { std::list<string> sectionlist; std::list<string>::iterator m_sItem; GetIniFileSections(sectionlist, "reportset.ini"); int numRow = 1; for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++) { m_pReportListTable->InitRow(numRow); std::string section = *m_sItem; string ret = "error"; WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 0)); m_pReportListTable->GeDataTable()->elementAt(numRow, 0)->setContentAlignment(AlignCenter); // 名称 std::string strlinkname; std::string hrefstr = RepHrefStr(section); strlinkname ="<a href=/fcgi-bin/startsreportlist.exe?id="+hrefstr+">"+section+"</a>"; WText *pName = new WText(strlinkname, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow , 2)); m_pReportListTable->GeDataTable()->elementAt(numRow, 2)->setContentAlignment(AlignCenter); std::string szPeriod = GetIniFileString(section, "Period", ret, "reportset.ini"); if(strcmp(szPeriod.c_str(), "error") == 0) { } WText *pPeriod = new WText(szPeriod, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 4)); m_pReportListTable->GeDataTable()->elementAt(numRow, 4)->setContentAlignment(AlignCenter); WImage *pEdit = new WImage("/Images/edit.gif", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow ,6)); m_pReportListTable->GeDataTable()->elementAt(numRow, 6)->setContentAlignment(AlignCenter); pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer); connect(pEdit, SIGNAL(clicked()), &m_signalMapper, SLOT(map())); m_signalMapper.setMapping(pEdit, section); REPORT_LIST list; list.pSelect = pCheck; list.pName = pName; list.pPeriod = pPeriod; list.pEdit = pEdit; m_pListReport.push_back(list); numRow++; } }
void CTuopList::EditReturn(int keyCode) { string strUserID = GetWebUserID(); HitLog LogItem; LogItem.sUserName = strUserID; LogItem.sHitPro = "TuopList"; LogItem.sHitFunc = "EditReturn"; LogItem.sDesc = strReturnSave; DWORD dcalBegin=GetTickCount(); InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0); // OutputDebugString("EditReturn\n"); if(keyCode == 13) { char buf[1024]; memset(buf, 0, 1023); string str = pCurrEditUserName->text(); sprintf(buf, "%s", str.c_str()); // OutputDebugString(buf); std::list<string> keylist; std::list<string>::iterator itemkey; #ifdef Tuopu bool bret = GetIniFileKeys("filename", keylist, "tuopfile.ini"); #else bool bret = GetIniFileKeys("filename", keylist, "maintainfile.ini"); #endif if(!bret) { // } bool bExist1 = true; std::string sVal = ""; std::string defaultret = "error"; std::string sret = ""; //此名字是否已经存在? for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++) { sVal = *itemkey; #ifdef Tuopu sret = GetIniFileString("filename", sVal, defaultret, "tuopfile.ini"); #else sret = GetIniFileString("filename", sVal, defaultret, "maintainfile.ini"); #endif if(strcmp(sret.c_str(), bStrCurr.c_str()) == 0) { continue; } if(strcmp(sret.c_str(), str.c_str()) == 0) { bExist1 = false; } } // OutputDebugString("befor bExtit1\n"); if(bExist1) { for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++) { sVal = *itemkey; #ifdef Tuopu sret = GetIniFileString("filename", sVal, defaultret, "tuopfile.ini"); #else sret = GetIniFileString("filename", sVal, defaultret, "maintainfile.ini"); #endif if(strcmp(sret.c_str(), bStrCurr.c_str()) == 0) { // OutputDebugString("befor write1\n"); #ifdef Tuopu WriteIniFileString("filename", sVal, str, "tuopfile.ini"); #else WriteIniFileString("filename", sVal, str, "maintainfile.ini"); #endif break; } } string strOpen; strOpen = "<a href=./showtuopu.exe?pageid="; strOpen += ReplaceStdString(sVal, ".htm", ""); #ifdef Tuopu strOpen += "&version=0"; #else strOpen += "&version=0&usrleader=0&maintain=1"; #endif strOpen += " target=_blank>"; strOpen += buf; strOpen += "</a>"; pCurrName->setText(strOpen.c_str()); pCurrName->show(); pCurrEditUserName->hide(); //插记录到UserOperateLog表 string strUserID = GetWebUserID(); TTime mNowTime = TTime::GetCurrentTimeEx(); OperateLog m_pOperateLog; m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strEditTip,strMainTitle,buf); } else { WebSession::js_af_up = "alert('"; WebSession::js_af_up += "have same name tuop"; WebSession::js_af_up += "')"; } } DWORD dcalEnd1=GetTickCount(); InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin); }
std::list<string> CTuopList::ReadFileName(string path) { WIN32_FIND_DATA fd; std::list<string> strlist; path += "\\*.*"; HANDLE fr=::FindFirstFile(path.c_str(),&fd); while(::FindNextFile(fr,&fd)) { if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) { // } else { std::string str1 = fd.cFileName; int npos = str1.find(".htm", 0); if(npos >= 0) { std::list<string> keylist; std::list<string>::iterator itemkey; #ifdef Tuopu bool bret = GetIniFileKeys("filename", keylist, "tuopfile.ini"); #else bool bret = GetIniFileKeys("filename", keylist, "maintainfile.ini"); #endif if(!bret) { // } bool bExist = false; for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++) { std::string str = *itemkey; if(strcmp(str.c_str(), fd.cFileName) == 0) { bExist = true; break; } } //用户权限 if(GetUserRight(fd.cFileName)) { if(bExist) { std::string defaultret = "error"; #ifdef Tuopu std::string sret = GetIniFileString("filename", fd.cFileName, defaultret, "tuopfile.ini"); #else std::string sret = GetIniFileString("filename", fd.cFileName, defaultret, "maintainfile.ini"); #endif //int npos = sret.find(".htm", 0); //if(npos >= 0) if(sret != defaultret) { strlist.push_back(sret); } } else { #ifdef Tuopu WriteIniFileString("filename", fd.cFileName, fd.cFileName, "tuopfile.ini"); #else WriteIniFileString("filename", fd.cFileName, fd.cFileName, "maintainfile.ini"); #endif strlist.push_back(fd.cFileName); } } } } } return strlist; }
void CSVWholeview::enumSVSE() { if(!m_pContent) return; PAIRLIST selist; string szRootname(""); int nRow = 0; WTable *pTable = m_pContent; if(GetIniFileInt("solover","solover",1,"general.ini") == 1) { sv_pair svpair; svpair.name = "1"; OBJECT objSE = GetSVSE("1");//, m_szIDCUser, m_szIDCPwd); if(objSE != INVALID_VALUE) { svpair.value = GetSVSELabel(objSE); CloseSVSE(objSE); } selist.push_back(svpair); } else { GetAllSVSEInfo(selist); szRootname = GetIniFileString("segroup","name","","general.ini"); if(szRootname.empty()) szRootname = "SiteView ECC 7.0"; nRow = m_pContent->numRows(); //WImage *pShow = new WImage("../Images/foldopen.gif", m_pContent->elementAt(nRow, 0)); //WImage *pHide = new WImage("../Images/foldclose.gif", m_pContent->elementAt(nRow, 0)); WImage *pShow = new WImage("/Images/cb1-unwrap.gif", m_pContent->elementAt(nRow, 0)); WImage *pHide = new WImage("/Images/cb1-fold.gif", m_pContent->elementAt(nRow, 0)); new WText(" ",m_pContent->elementAt(nRow, 0)); //new WImage("../Images/home.gif", m_pContent->elementAt(nRow, 1)); new WImage("/Images/cbb-2main.gif", m_pContent->elementAt(nRow, 1)); new WText(" ",m_pContent->elementAt(nRow, 1)); WText *pName = new WText(szRootname, m_pContent->elementAt(nRow, 2)); if(pName) { sprintf(pName->contextmenu_, "style='color:#669;cursor:pointer;' onmouseover='" \ "this.style.textDecoration=\"underline\"' " \ "onmouseout='this.style.textDecoration=\"none\"'"); } pTable = new WTable(m_pContent->elementAt(nRow + 1, 2)); pTable->setStyleClass("widthauto"); if(!pTable) return; else { if(pShow && pHide) { string szShow = "", szHide = "", szSubTable = ""; szShow = pHide->formName(); szHide = pShow->formName(); szSubTable = pTable->formName(); string szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'"; string szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'"; sprintf(pShow->contextmenu_, szShowText.c_str()); sprintf(pHide->contextmenu_, szHideText.c_str()); } } } PAIRLIST::iterator iSe; bool bHasRight = true; int nChildCount = 0, nIndex = 0; OBJECT objSE = INVALID_VALUE; OBJECT objGroup = INVALID_VALUE; MAPNODE node = INVALID_VALUE; string szSEID(""), szSubGroupID(""), szEntityID(""); string szName(""), szIndex(""); string szContext(""), szShow(""), szHide(""), szSubTable(""); string szShowText(""), szHideText(""); list<string> lsGroupID; list<string> lsDeviceID; list<string>::iterator lstItem; for(iSe= selist.begin(); iSe!=selist.end(); iSe++) { szSEID = (*iSe).name; bHasRight = true; if(m_pSVUser) bHasRight = m_pSVUser->haveGroupRight(szSEID, Tree_SE); if(bHasRight) { nRow = pTable->numRows(); //WImage *pShow = new WImage("../Images/foldopen.gif", pTable->elementAt(nRow, 0)); //WImage *pHide = new WImage("../Images/foldclose.gif", pTable->elementAt(nRow, 0)); WImage *pShow = new WImage("/Images/cb1-unwrap.gif", pTable->elementAt(nRow, 0)); WImage *pHide = new WImage("/Images/cb1-fold.gif", pTable->elementAt(nRow, 0)); new WText(" ",pTable->elementAt(nRow, 0)); new WImage("/Images/cbb-2main.gif", pTable->elementAt(nRow, 1)); new WText(" ",pTable->elementAt(nRow, 1)); WText *pName = new WText((*iSe).value, pTable->elementAt(nRow, 2)); if(pName) { szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?svseid=" + szSEID + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'" + "onmouseout='this.style.textDecoration=\"none\"'"; sprintf(pName->contextmenu_, szContext.c_str()); } WTable *pSubTable = new WTable(pTable->elementAt(nRow + 1, 2)); pSubTable->setStyleClass("widthauto"); if(!pSubTable) return; else { if(pShow && pHide) { szShow = pHide->formName(); szHide = pShow->formName(); szSubTable = pSubTable->formName(); szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'"; szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'"; sprintf(pShow->contextmenu_, szShowText.c_str()); sprintf(pHide->contextmenu_, szHideText.c_str()); } } objSE = GetSVSE(szSEID); if(objSE != INVALID_VALUE) { lsGroupID.clear(); if(GetSubGroupsIDBySE(objSE, lsGroupID)) { map<int, base_param, less<int> > sortList; map<int, base_param, less<int> >::iterator lsItem; map<int, base_param, less<int> >::iterator compItem; base_param group; for(lstItem = lsGroupID.begin(); lstItem != lsGroupID.end(); lstItem ++) { szSubGroupID =(*lstItem); bHasRight = true; if(m_pSVUser) bHasRight = m_pSVUser->haveGroupRight(szSubGroupID, Tree_GROUP); if(bHasRight) { objGroup = GetGroup(szSubGroupID, m_szIDCUser, m_szIDCPwd); if(objGroup != INVALID_VALUE) { node = GetGroupMainAttribNode(objGroup); if(node != INVALID_VALUE) { FindNodeValue(node, "sv_name", szName); FindNodeValue(node, "sv_index", szIndex); if(szIndex.empty()) nIndex = FindIndexByID(szSubGroupID); else nIndex = atoi(szIndex.c_str()); group.szIndex = szSubGroupID; group.szName = szName; lsItem = sortList.find(nIndex); while(lsItem != sortList.end()) { nIndex ++; lsItem = sortList.find(nIndex); } sortList[nIndex] = group; } CloseGroup(objGroup); } } } nChildCount += static_cast<int>(sortList.size()); for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++) { //PrintDebugString("In first setting ---------" + lsItem->second.szName + "\n"); //bool bbbb = false; nRow = pSubTable->numRows(); WImage *pShow = new WImage("/Images/cb1-unwrap.gif", pSubTable->elementAt(nRow, 0)); WImage *pHide = new WImage("/Images/cb1-fold.gif", pSubTable->elementAt(nRow, 0)); new WText(" ",pSubTable->elementAt(nRow, 0)); new WImage("/Images/cbb-3group.gif", pSubTable->elementAt(nRow, 1)); new WText(" ",pSubTable->elementAt(nRow, 1)); WText *pName = new WText(lsItem->second.szName, pSubTable->elementAt(nRow, 2)); if(pName) { string szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?groupid=" + lsItem->second.szIndex + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'" + "onmouseout='this.style.textDecoration=\"none\"'"; sprintf(pName->contextmenu_, szContext.c_str()); } WTable * pSub = new WTable(pSubTable->elementAt(nRow + 1, 2)); if(pSub) { if(pShow && pHide) { szShow = pHide->formName(); szHide = pShow->formName(); szSubTable = pSub->formName(); string szShowText = "onclick='showsubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='display:none;cursor:pointer'"; string szHideText = "onclick='hidesubtable(\"" + szShow + "\", \"" + szHide + "\", \"" + szSubTable + "\")' " + "style='cursor:pointer'"; sprintf(pShow->contextmenu_, szShowText.c_str()); sprintf(pHide->contextmenu_, szHideText.c_str()); } if(!enumGroups(lsItem->second.szIndex, pSub)) { //bbbb = true; //pSubTable->deleteRow(nRow); pShow->hide(); pHide->hide(); } } } } lsDeviceID.clear(); if(GetSubEntitysIDBySE(objSE, lsDeviceID)) { map<int, base_param, less<int> > sortList; map<int, base_param, less<int> >::iterator lsItem; base_param device; for(lstItem = lsDeviceID.begin(); lstItem != lsDeviceID.end(); lstItem ++) { szEntityID =(*lstItem); bHasRight = true; if(m_pSVUser) bHasRight = m_pSVUser->haveGroupRight(szEntityID, Tree_DEVICE); if(bHasRight) { OBJECT objDevice = GetEntity(szEntityID, m_szIDCUser, m_szIDCPwd); if(objDevice != INVALID_VALUE) { MAPNODE node = GetEntityMainAttribNode(objDevice); if(node != INVALID_VALUE) { FindNodeValue(node, "sv_name", szName); FindNodeValue(node, "sv_index", szIndex); if(szIndex.empty()) nIndex = FindIndexByID(szEntityID); else nIndex = atoi(szIndex.c_str()); device.szIndex = szEntityID; device.szName = szName; lsItem = sortList.find(nIndex); while(lsItem != sortList.end()) { nIndex ++; lsItem = sortList.find(nIndex); } sortList[nIndex] = device; } CloseEntity(objDevice); } } } nChildCount += static_cast<int>(sortList.size()); for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++) { nRow = pSubTable->numRows(); new WText(" ",pSubTable->elementAt(nRow , 0)); new WImage("/Images/cbb-4server.gif", pSubTable->elementAt(nRow, 1)); new WText(" ",pSubTable->elementAt(nRow , 1)); WText *pName = new WText(lsItem->second.szName, pSubTable->elementAt(nRow, 2)); if(pName) { szContext = "onclick='parent.document.frames(\"left\").location.replace(\"/fcgi-bin/menu.exe?cmd=treeview.exe?deviceid=" + lsItem->second.szIndex + "\");' style='color:#669;cursor:pointer;' onmouseover='this.style.textDecoration=\"underline\"'" + "onmouseout='this.style.textDecoration=\"none\"'"; sprintf(pName->contextmenu_, szContext.c_str()); } if(!enumMonitors(lsItem->second.szIndex, lsItem->second.szName, pSubTable->elementAt(nRow, 2))) { //pSubTable->deleteRow(nRow); } } } CloseSVSE(objSE); if(nChildCount <= 0) { new WText(m_szNoChild, pSubTable->elementAt(nRow, 2)); } } } } }
bool CCheckBoxTreeView::InitTree(std::string strFirstNode_, bool bDevice_ ,bool bCheck_ ,bool bMain_ ,std::string strUser_, std::string szSEID) { vector<string >::iterator iSelItor; m_pOldSelNode =NULL; if(treeroot) delete treeroot; if (m_menutable) { while ( m_menutable->numRows() > 1) { m_menutable->deleteRow(m_menutable->numRows() - 1); } } strFirstNode=strFirstNode_; bDevice=bDevice_; bCheck=bCheck_; bMain=bMain_; strUser=strUser_; pTreeSelNode =NULL; if (bDevice_) //增加权限table cell { if(pRightTbl==NULL) { InitRightCell(); } Scrolltable->resize(WLength(100,WLength::Percentage), 450); this->setStyleClass("margin_top"); }else { this->setStyleClass("margin_top"); Scrolltable->setStyleClass("widthauto"); } int nAdmin = GetIniFileInt(strUser, "nAdmin", -1, "user.ini"); if(nAdmin==-1) bAdmin = false; else bAdmin= true; if(!bAdmin) { std::string groupright= GetIniFileString(strUser, "groupright", "", "user.ini"); ParserToken(pUserSelGroupList,groupright.c_str(),","); vector<string>::iterator result1; for( result1=pUserSelGroupList.begin();result1!=pUserSelGroupList.end();result1++) PushGroup(result1->c_str(),pUserTreeGroupList); } WTreeNode *FistNode; { OBJECT root = GetSVSE(szSEID); list<string> lsGroupID; list<string>::iterator lstItem; WTreeNode *tmpNode = NULL; if(treeroot!=NULL) { FistNode= makeTreeFile(GetSVSELabel(root), szSEID, Tree_SE, treeroot, false, false, "/Images/cbb-2main.gif", "/Images/cbb-2main.gif"); }else{ FistNode= makeTreeMap(GetSVSELabel(root), szSEID, Tree_SE, m_menutable, false, false, "/Images/cbb-2main.gif", "/Images/cbb-2main.gif"); treeroot= FistNode; } if (root != INVALID_VALUE) { //第一层组 if(GetSubGroupsIDBySE(root, lsGroupID)) { map<int, base_param, less<int> > sortList; map<int, base_param, less<int> >::iterator lsItem; base_param group; for(lstItem = lsGroupID.begin(); lstItem != lsGroupID.end(); lstItem ++) { string szSubGroupID = (*lstItem).c_str(); bool bSelTree = true;// 是否增加组或者设备到树上 if(!bAdmin) { iSelItor = find(pUserTreeGroupList.begin(),pUserTreeGroupList.end(),szSubGroupID); if(iSelItor == pUserTreeGroupList.end()) bSelTree= false; } if(bSelTree) { OBJECT objGroup = GetGroup(szSubGroupID); if(objGroup != INVALID_VALUE) { MAPNODE node = GetGroupMainAttribNode(objGroup); if(node != INVALID_VALUE) { string szName = "", szIndex = ""; FindNodeValue(node, "sv_index", szIndex); if(szIndex.empty()) szIndex = findIndexByRealID(szSubGroupID); group.szIndex = szSubGroupID; group.szName = szName; int nIndex = atoi(szIndex.c_str()); lsItem = sortList.find(nIndex); while(lsItem != sortList.end()) { nIndex ++; lsItem = sortList.find(nIndex); } sortList[nIndex] = group; } CloseGroup(objGroup); } } } for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++) { bool bTreehaveCheck=true; if(bCheck_) bTreehaveCheck =true; else { iSelItor =find(pUserSelGroupList.begin(),pUserSelGroupList.end(), lsItem->second.szIndex); if(iSelItor ==pUserSelGroupList.end()) bTreehaveCheck= false; } tmpNode=AddGroupTreeNode(lsItem->second.szIndex, FistNode, bTreehaveCheck); if(tmpNode!=NULL) EnumGroup(lsItem->second.szIndex, tmpNode, bTreehaveCheck); } } if(GetSubEntitysIDBySE(root, lsGroupID)) { map<int, base_param, less<int> > sortList; map<int, base_param, less<int> >::iterator lsItem; base_param device; for(lstItem = lsGroupID.begin(); lstItem != lsGroupID.end(); lstItem ++) { string szEntityID = (*lstItem).c_str(); bool bSelTree =true;// 是否增加组或者设备到树上 if(!bAdmin) { iSelItor =find(pUserTreeGroupList.begin(),pUserTreeGroupList.end(),szEntityID); if(iSelItor ==pUserTreeGroupList.end()) bSelTree= false; } if(bSelTree) { OBJECT objDevice = GetEntity(szEntityID); if(objDevice != INVALID_VALUE) { MAPNODE node = GetEntityMainAttribNode(objDevice); if(node != INVALID_VALUE) { string szName = "", szIndex = ""; //FindNodeValue(node, "sv_name", szName); FindNodeValue(node, "sv_index", szIndex); if(szIndex.empty()) szIndex = findIndexByRealID(szEntityID); device.szIndex = szEntityID; device.szName = szName; int nIndex = atoi(szIndex.c_str()); lsItem = sortList.find(nIndex); while(lsItem != sortList.end()) { //nMax ++; nIndex ++; lsItem = sortList.find(nIndex); } sortList[nIndex] = device; } CloseEntity(objDevice); } //AddDeviceTreeNode(szEntityID, parentNode ); } } for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++) AddDeviceTreeNode(lsItem->second.szIndex, FistNode); } CloseSVSE(root); } } makeTreeFile("无依靠", "-2", Tree_MONITOR, FistNode, false, false, "/Images/cbb-6application.gif","/Images/cbb-6application.gif"); return true; }
void CCheckBoxTreeView::InitRightCell() { pRightTbl = new WTable(this->elementAt(0,1)); pSeRightTbl = new WTable( pRightTbl->elementAt(0,0)); pGroupRightTbl= new WTable( pRightTbl->elementAt(1,0)); pDeviceRightTbl = new WTable( pRightTbl->elementAt(2,0)); pMonitorRightTbl =new WTable( pRightTbl->elementAt(3,0)); pAppTbl = new WTable( pRightTbl->elementAt(4,0)); for(int i =0;i<pRightTbl->numRows();i++) pRightTbl->elementAt(i,0)->setVerticalAlignment(AlignTop); std::list<string> keylist; int nRightTplIndex; GetIniFileKeys("group",keylist,"userright.ini"); nRightTplIndex =1; new WText(GetIniFileString("group", "value", "","userright.ini") , pGroupRightTbl->elementAt(0,0)); pGroupRightTbl->elementAt(0,0)->setStyleClass("t3title"); for( list<std::string >::iterator _aRight = keylist.begin(); _aRight != keylist.end(); _aRight ++) { if ( (_aRight->compare("value")!=0)&&(_aRight->compare("sort")!=0) ) { WCheckBox* pCheckBox= new WCheckBox(GetIniFileString("group", _aRight->c_str(), "","userright.ini"), pGroupRightTbl->elementAt(nRightTplIndex++,0)); connect(pCheckBox,SIGNAL(clicked()),this,SLOT(DoSetAppEnable())); mGroupRightMap[_aRight->c_str()]= pCheckBox ; } } //--------------------------device-------------------------------------------------------- GetIniFileKeys("device",keylist,"userright.ini"); nRightTplIndex =1; new WText(GetIniFileString("device", "value", "","userright.ini") , pDeviceRightTbl->elementAt(0,0)); pDeviceRightTbl->elementAt(0,0)->setStyleClass("t3title"); for( list<std::string >::iterator _aRight = keylist.begin(); _aRight != keylist.end(); _aRight ++) { if ( (_aRight->compare("value")!=0)&&(_aRight->compare("sort")!=0) ) { WCheckBox* pCheckBox= new WCheckBox(GetIniFileString("device", _aRight->c_str(), "","userright.ini"), pDeviceRightTbl->elementAt(nRightTplIndex++,0)); connect(pCheckBox,SIGNAL(clicked()),this,SLOT(DoSetAppEnable())); //pCheckBox->disable(); mDeviceRightMap[_aRight->c_str()]= pCheckBox ; } } //---------------------------monitor--------------------------------------------------------------- GetIniFileKeys("monitor",keylist,"userright.ini"); nRightTplIndex =1; new WText(GetIniFileString("monitor", "value", "","userright.ini") , pMonitorRightTbl->elementAt(0,0)); pMonitorRightTbl->elementAt(0,0)->setStyleClass("t3title"); for( list<std::string >::iterator _aRight = keylist.begin(); _aRight != keylist.end(); _aRight ++) { if ( (_aRight->compare("value")!=0)&&(_aRight->compare("sort")!=0) ) { WCheckBox* pCheckBox= new WCheckBox(GetIniFileString("monitor", _aRight->c_str(), "","userright.ini"), pMonitorRightTbl->elementAt(nRightTplIndex++,0)); connect(pCheckBox,SIGNAL(clicked()),this,SLOT(DoSetAppEnable())); mMonitorRightMap[_aRight->c_str()]= pCheckBox ; } } /* //---------------------------se--------------------------------------------------------------- GetIniFileKeys("seserver",keylist,"userright.ini"); nRightTplIndex =1; new WText(GetIniFileString("seserver", "value", "","userright.ini") , pSeRightTbl->elementAt(0,0)); pSeRightTbl->elementAt(0,0)->setStyleClass("t3title"); for( list<std::string >::iterator _aRight = keylist.begin(); _aRight != keylist.end(); _aRight ++) { if ( (_aRight->compare("value")!=0)&&(_aRight->compare("sort")!=0) ) { WCheckBox* pCheckBox= new WCheckBox(GetIniFileString("seserver", _aRight->c_str(), "","userright.ini"), pSeRightTbl->elementAt(nRightTplIndex++,0)); connect(pCheckBox,SIGNAL(clicked()),this,SLOT(DoSetAppEnable())); mseRightMap[_aRight->c_str()]= pCheckBox ; } } */ pApp = new WPushButton("应用",pAppTbl->elementAt(0,0)); new WText(" ",pAppTbl->elementAt(0,0)); pAppDec = new WPushButton("应用包括下级 ",pAppTbl->elementAt(0,0)); connect(pApp,SIGNAL(clicked()),this,SLOT(DoApp1())); connect(pAppDec,SIGNAL(clicked()),this,SLOT(DoAppDec())); pApp->disable(); pAppDec->disable(); }
void CSVReportSet::EditRow(const std::string str) { PrintDebugString("Begin EditRow\n"); chgstr = str; std::string ret = "error"; SAVE_REPORT_LIST report; report.szTitle = GetIniFileString(str, "Title", ret, "reportset.ini"); if(strcmp(report.szTitle.c_str(), "error") == 0) { report.szTitle = ""; } report.szDescript = GetIniFileString(str, "Descript", ret, "reportset.ini"); if(strcmp(report.szDescript.c_str(), "error") == 0) { report.szDescript = ""; } report.szPlan = GetIniFileString(str, "Plan", ret, "reportset.ini"); if(strcmp(report.szPlan.c_str(), "error") == 0) { } report.szPeriod = GetIniFileString(str, "Period", ret, "reportset.ini"); if(strcmp(report.szPeriod.c_str(), "error") == 0) { } report.szStatusresult = GetIniFileString(str, "StatusResult", ret, "reportset.ini"); if(strcmp(report.szStatusresult.c_str(), "error") == 0) { } report.szErrorresult = GetIniFileString(str, "ErrorResult", ret, "reportset.ini"); if(strcmp(report.szErrorresult.c_str(), "error") == 0) { } report.szGraphic = GetIniFileString(str, "Graphic", ret, "reportset.ini"); if(strcmp(report.szGraphic.c_str(), "error") == 0) { } report.szComboGraphic = GetIniFileString(str, "ComboGraphic", ret, "reportset.ini"); if(strcmp(report.szComboGraphic.c_str(), "error") == 0) { } report.szListData = GetIniFileString(str, "ListData", ret, "reportset.ini"); if(strcmp(report.szListData.c_str(), "error") == 0) { } report.szListNormal = GetIniFileString(str, "ListNormal", ret, "reportset.ini"); if(strcmp(report.szListNormal.c_str(), "error") == 0) { } report.szListError = GetIniFileString(str, "ListError", ret, "reportset.ini"); if(strcmp(report.szListError.c_str(), "error") == 0) { } report.szListDanger = GetIniFileString(str, "ListDanger", ret, "reportset.ini"); if(strcmp(report.szListDanger.c_str(), "error") == 0) { } report.szListAlert = GetIniFileString(str, "ListAlert", ret, "reportset.ini"); if(strcmp(report.szListAlert.c_str(), "error") == 0) { } report.szEmailSend = GetIniFileString(str, "EmailSend", ret, "reportset.ini"); if(strcmp(report.szEmailSend.c_str(), "error") == 0) { report.szEmailSend = ""; } report.szParameter = GetIniFileString(str, "Parameter", ret, "reportset.ini"); if(strcmp(report.szParameter.c_str(), "error") == 0) { } report.szDeny = GetIniFileString(str, "Deny", ret, "reportset.ini"); if(strcmp(report.szDeny.c_str(), "error") == 0) { } report.szGenerate = GetIniFileString(str, "Generate", ret, "reportset.ini"); if(strcmp(report.szGenerate.c_str(), "error") == 0) { } report.szClicketValue = GetIniFileString(str, "ClicketValue", ret, "reportset.ini"); if(strcmp(report.szClicketValue.c_str(), "error") == 0) { report.szClicketValue = ""; } report.szListClicket = GetIniFileString(str, "ListClicket", ret, "reportset.ini"); if(strcmp(report.szListClicket.c_str(), "error") == 0) { } report.szStartTime = GetIniFileString(str, "StartTime", ret, "reportset.ini"); if(strcmp(report.szStartTime.c_str(), "error") == 0) { report.szStartTime = ""; } report.szEndTime = GetIniFileString(str, "EndTime", ret, "reportset.ini"); if(strcmp(report.szEndTime.c_str(), "error") == 0) { report.szEndTime = ""; } report.nWeekEndIndex = GetIniFileInt(str,"WeekEndTime",0,"reportset.ini"); //Ticket #123 start -------苏合 report.szExcel = GetIniFileString(str, "GenExcel", ret, "reportset.ini"); if(strcmp(report.szExcel.c_str(), "error") == 0) { report.szExcel = ""; } //Ticket #123 end -------苏合 report.szGroupRight= GetIniFileString(str, "GroupRight", ret, "reportset.ini"); char abc[2000]; sprintf(abc,"\n%s-------%s\n",str.c_str(),report.szGroupRight.c_str()); OutputDebugString(abc); if(strcmp(report.szGroupRight.c_str(), "error") == 0) { } report.chgstr = str; emit EditPhone(report); }
//add list function void CSVReportSet::addPhoneList(WTable * table) { m_ptbPhone = new WTable((WContainerWidget*)table->elementAt(7,0)); nullTable = new WTable((WContainerWidget*)table->elementAt(8, 0)); m_ptbPhone -> setStyleClass("t3"); nullTable -> setStyleClass("t3"); if (m_ptbPhone) { m_ptbPhone -> setCellPadding(0); m_ptbPhone->setCellSpaceing(0); new WText("", (WContainerWidget*)m_ptbPhone->elementAt(0,0)); new WText(m_formText.szColName, (WContainerWidget*)m_ptbPhone->elementAt(0, 1)); new WText(m_formText.szColPeriod, (WContainerWidget*)m_ptbPhone->elementAt(0, 2)); new WText(m_formText.szColEdit, (WContainerWidget*)m_ptbPhone->elementAt(0, 3)); m_ptbPhone->elementAt(0, 0)->setStyleClass("t3title"); m_ptbPhone->elementAt(0, 1)->setStyleClass("t3title"); m_ptbPhone->elementAt(0, 2)->setStyleClass("t3title"); m_ptbPhone->elementAt(0, 3)->setStyleClass("t3title"); } std::list<string> sectionlist; std::list<string>::iterator m_sItem; GetIniFileSections(sectionlist, "reportset.ini"); for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++) { int numRow = m_ptbPhone->numRows(); std::string section = *m_sItem; string ret = "error"; WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_ptbPhone->elementAt(numRow, 0)); // 名称 std::string strlinkname; std::string hrefstr = RepHrefStr(section); strlinkname ="<a href=/fcgi-bin/startsreportlist.exe?id="+hrefstr+">"+section+"</a>"; WText *pName = new WText(strlinkname, (WContainerWidget*)m_ptbPhone->elementAt(numRow , 1)); std::string szPeriod = GetIniFileString(section, "Period", ret, "reportset.ini"); if(strcmp(szPeriod.c_str(), "error") == 0) { } WText *pPeriod = new WText(szPeriod, (WContainerWidget*)m_ptbPhone->elementAt(numRow, 2)); WImage *pEdit = new WImage("../icons/edit.gif", (WContainerWidget*)m_ptbPhone->elementAt(numRow ,3)); pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer); connect(pEdit, SIGNAL(clicked()), &m_signalMapper, SLOT(map())); m_signalMapper.setMapping(pEdit, section); REPORT_LIST list; list.pSelect = pCheck; list.pName = pName; list.pPeriod = pPeriod; list.pEdit = pEdit; m_pListReport.push_back(list); } m_ptbPhone->adjustRowStyle("tr1","tr2"); //m_pReportListTable->HideNullTip(); }
void CSVReportSet::UpdatePhoneList() { /* int nNum =m_ptbPhone->numRows(); for(int i=1;i<nNum;i++) { m_ptbPhone->deleteRow(1); } */ PrintDebugString("Into UpdatePhoneList\n"); m_pReportListTable->GeDataTable()->clear(); m_pListReport.clear(); std::list<string> sectionlist; std::list<string>::iterator m_sItem; GetIniFileSections(sectionlist, "reportset.ini"); //if(sectionlist.size() == 0) //{ // WText * nText = new WText("[----------统计报告列表为空-----------]", (WContainerWidget*)m_pReportListTable->GeDataTable() -> elementAt(0, 0)); // nText ->decorationStyle().setForegroundColor(Wt::red); // //nullTable -> elementAt(0, 0) -> setContentAlignment(AlignTop | AlignCenter); //} int numRow = 1; for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++) { std::string section = *m_sItem; std::list<string> keylist; std::list<string>::iterator m_pItem; bool bRet = false; bRet = GetIniFileKeys(section,keylist, "reportset.ini" ); if(!bRet) { } m_pItem = keylist.begin(); std::string str = *m_pItem; std::string ret = "error"; REPORT_LIST list; m_pReportListTable->InitRow(numRow); // 是否选择 WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 0)); m_pReportListTable->GeDataTable()->elementAt(numRow, 0)->setContentAlignment(AlignCenter); // 名称 std::string ReportName = GetIniFileString(section, "Title", ret, "reportset.ini"); std::string strlinkname; std::string hrefstr = RepHrefStr(ReportName); strlinkname ="<a href=/fcgi-bin/statsreportlist.exe?id="+hrefstr+">"+ReportName+"</a>"; OutputDebugString("----------------report link name include null----------------\n"); OutputDebugString(strlinkname.c_str()); OutputDebugString("\n"); if(strcmp(ReportName.c_str(), "error") == 0) { } WText *pName = new WText(strlinkname, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow , 2)); m_pReportListTable->GeDataTable()->elementAt(numRow, 2)->setContentAlignment(AlignCenter); std::string ReportPeriod = GetIniFileString(section, "Period", ret, "reportset.ini"); if(strcmp(ReportPeriod.c_str(), "error") == 0) { } WText *pPeriod = new WText(ReportPeriod, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 4)); m_pReportListTable->GeDataTable()->elementAt(numRow, 4)->setContentAlignment(AlignCenter); WImage *pEdit = new WImage("/Images/edit.gif", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow ,6)); m_pReportListTable->GeDataTable()->elementAt(numRow, 6)->setContentAlignment(AlignCenter); if(!GetUserRight("m_reportlistEdit")) pEdit->hide(); else pEdit->show(); pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer); connect(pEdit, SIGNAL(clicked()),"showbar();", &m_signalMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_signalMapper.setMapping(pEdit, section); list.pSelect = pCheck; list.pName = pName; list.pPeriod = pPeriod; list.pEdit = pEdit; m_pListReport.push_back(list); numRow++; PrintDebugString("Into UpdatePhoneList loop\n"); } }