コード例 #1
0
//删除了拓扑图  序号怎么变?---》是直接删除呢? 还是要加把其他的序号都整理一遍?---》或者把大于它的序号都减1即可。
void DelSortId(string strVsd)
{
	//获取要删除 sortid 删除该记录
	int nDelSortId = 0;	

	#ifdef	 Tuopu
		nDelSortId = GetIniFileInt("sort", strVsd, -1, "tuopfile.ini");			
		DeleteIniFileKey("sort", strVsd, "tuopfile.ini");
	#else
		nDelSortId = GetIniFileInt("sort", strVsd, -1, "maintainfile.ini");
		DeleteIniFileKey("sort", strVsd, "maintainfile.ini");
	#endif

	//删除了拓扑图  序号怎么变?---》是直接删除呢? 还是要加把其他的序号都整理一遍?---》或者把大于它的序号都减1即可。
	std::list<string> keylist;
	std::list<string>::iterator itemkey;

#ifdef	 Tuopu
	bool bret = GetIniFileKeys("sort", keylist, "tuopfile.ini");
#else
	bool bret = GetIniFileKeys("sort", keylist, "maintainfile.ini");
#endif

	if(bret)
	{
		std::string sVal = "";
		
		int nSort = 0;
		for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++)
		{
			sVal = *itemkey;
		#ifdef	 Tuopu
			nSort = GetIniFileInt("sort", sVal, -1, "tuopfile.ini");
		#else
			nSort = GetIniFileInt("sort", sVal, -1, "maintainfile.ini");
		#endif
			
			if(nSort > nDelSortId)
			{
				nSort--;
				
			#ifdef	 Tuopu
				WriteIniFileInt("sort", sVal, nSort, "tuopfile.ini");
			#else
				WriteIniFileInt("sort", sVal, nSort, "maintainfile.ini");
			#endif
			}
		}
	}
}
コード例 #2
0
//新增的Sort相关函数
int GetMaxSortId()
{
	int nMaxId = 0;
	std::list<string> keylist;
	std::list<string>::iterator itemkey;

#ifdef	 Tuopu
	bool bret = GetIniFileKeys("sort", keylist, "tuopfile.ini");
#else
	bool bret = GetIniFileKeys("sort", keylist, "maintainfile.ini");
#endif

	if(bret)
	{
		std::string sVal = "";
		
		int nSort = 0;
		for(itemkey = keylist.begin(); itemkey != keylist.end(); itemkey++)
		{
			sVal = *itemkey;
		#ifdef	 Tuopu
			nSort = GetIniFileInt("sort", sVal, -1, "tuopfile.ini");
		#else
			nSort = GetIniFileInt("sort", sVal, -1, "maintainfile.ini");
		#endif
			
			//char chItem[32]  = {0};	
			//sprintf(chItem, "%d", nSort);
			//string strSort = chItem;
			//
			//OutputDebugString("GetMaxSortId:");
			//OutputDebugString(strSort.c_str());
			
			if(nSort > nMaxId)
				nMaxId = nSort;
		}
	}

	return nMaxId;
}
コード例 #3
0
ファイル: IniToSql.cpp プロジェクト: sryanyuan/bmloginsvr
bool ParseDropItem(const char* _pszFile, char* _pBuf, int _id)
{
	char szSubValue[10];
	char szDescpribe[MAX_PATH];
	char szItemName[20];
	char szProb[10];
	char szValue[10];
	itoa(_id, szValue, 10);

	std::vector<int> xKeys;
	std::map<std::string, int> xNameIdMap;
	if(false == GetNameToIDMap(szItemPath, xNameIdMap))
	{
		return false;
	}
	if(0 == xNameIdMap.size())
	{
		return false;
	}

	//////////////////////////////////////////////////////////////////////////
	xKeys.clear();
	GetIniFileKeys(szValue, _pszFile, xKeys);
	bool bWriteName = true;
	int nNameIndex = 0;
	int nProbIndex = 0;
	bool bFirst = true;
	char szOut[100];
	bool bRet = false;

	if(!xKeys.empty())
	{
		for(int i = 0; i < xKeys.size(); ++i)
		{
			itoa(xKeys[i], szSubValue, 10);
			GetPrivateProfileString(szValue, szSubValue, "", szDescpribe, MAX_PATH - 1, _pszFile);
			bWriteName = true;
			nNameIndex = 0;
			nProbIndex = 0;

			if(strlen(szDescpribe))
			{
				for(int i = 0; i <= strlen(szDescpribe); ++i)
				{
					if(szDescpribe[i] == '|')
					{
						bWriteName = false;
						szItemName[nNameIndex] = 0;
						nNameIndex = 0;
					}
					else if(szDescpribe[i] == '\0')
					{
						szProb[nProbIndex] = 0;
						nProbIndex = 0;

						int nProb = atoi(szProb);
						if(nProb != 0 &&
							strlen(szItemName))
						{
							std::string xName = szItemName;
							std::map<std::string, int>::const_iterator fnditer = xNameIdMap.find(xName);

							if(fnditer != xNameIdMap.end())
							{
								szOut[0] = 0;
								if(bFirst)
								{
									sprintf(szOut, "%d|%d",
										fnditer->second, nProb);
									bFirst = false;
								}
								else
								{
									sprintf(szOut, ",%d|%d",
										fnditer->second, nProb);
								}
								if(szOut[0] != 0)
								{
									strcat(_pBuf, szOut);
									bRet = true;
								}
							}
						}
					}
					else
					{
						if(bWriteName)
						{
							szItemName[nNameIndex++] = szDescpribe[i];
						}
						else
						{
							szProb[nProbIndex++] = szDescpribe[i];
						}
					}
				}
			}
		}
	}

	return bRet;
}
コード例 #4
0
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);
}
コード例 #5
0
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;
}
コード例 #6
0
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("&nbsp;&nbsp;",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();


}
コード例 #7
0
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");
	}	
}