Exemplo n.º 1
0
void WriteLog(const char * strMsg)
{
    char datebuf[128] , timebuf[128] , tempbuf[1024];
	_tzset();
	_strdate(datebuf);
	_strtime(timebuf);

	sprintf(tempbuf , "%s-%s\t" , datebuf , timebuf);

	char filename[128] = {0};

	string strPath = "";
	strPath = GetSiteViewRootPath();

	sprintf(filename , "%s\\fcgi-bin\\SipDownload.log" , strPath.c_str());

	FILE * pFile;
	struct _stat buf;
	if(_stat(filename , &buf) == 0)
	{
		if(buf.st_size >= 5000*1024)
		{
			pFile = fopen(filename , "w");
			if(pFile != NULL)
				fclose(pFile);
		}
	}
	pFile = fopen(filename ,"a+");	
	if(pFile != NULL)
	{
		fprintf(pFile ,"%s%s\n" , tempbuf , strMsg);
		fclose(pFile);
	}    
}
Exemplo n.º 2
0
void CHZDLReport::SaveExcelBtn()
{
	OutputDebugString("\n----------ExportExcel Begin-------------\n");
	std::string szFilePath =GetSiteViewRootPath();
	szFilePath += "\\htdocs\\";	
	szFilePath += szXSLReportName;

	CSpreadSheet SS(szFilePath.c_str(), "统计报表");

	CStringArray headerArray, contentArray;

	SS.BeginTransaction();

	// 加入标题
	headerArray.RemoveAll();
	headerArray.Add("设备名称");
	headerArray.Add("IP/机器名");
	headerArray.Add("CPU平均利用率(%)");
	headerArray.Add("内存平均利用率(%)");
	SS.AddHeaders(headerArray);

	list<DeviceItem>::iterator RecordItem;
	char buf[256];
	memset(buf, 0, 256);

	for(RecordItem=DeviceList.begin(); RecordItem != DeviceList.end(); RecordItem++)
	{
		contentArray.RemoveAll();

		contentArray.Add(RecordItem->sName.c_str());
		contentArray.Add(RecordItem->sIP.c_str());

		if (RecordItem->hasCPU) sprintf(buf, "%0.0f", RecordItem->CPUUtilization);
		else sprintf(buf, "%s", "无CPU监视器");
		contentArray.Add(buf);

		memset(buf, 0, 256);
		if (RecordItem->hasMemory) sprintf(buf, "%0.0f", RecordItem->MemoryUtilization);
		else sprintf(buf, "%s", "无Memory监视器");
		contentArray.Add(buf);

		SS.AddRow(contentArray);
	}
	SS.Commit();		
	OutputDebugString("\n----------ExportExcel End-------------\n");

	OutputDebugString("\n----------showDownload-------------\n");

	string sDown = "hiddenbar();showDownload('<a href=/";
	sDown += szXSLReportName;
	sDown += " target=_blank>";
	sDown += szXSLReportName;
	sDown += "</a>','";
	sDown += "下载列表";
	sDown += "','";
	sDown += "关闭";
	sDown += "')";
	WebSession::js_af_up = sDown;
}
Exemplo n.º 3
0
//打印日志函数
void WriteLog( const char* str )
{
//	return;
	char timebuf[128],datebuf[128];

	_tzset();
	_strtime( timebuf );
	_strdate( datebuf );
	char * p = datebuf;
	while(*p)
	{
		if(*p == '/')
			*p = '-';
		p++;
	}

	char szProgramName[128] = {0};
	sprintf(szProgramName , "%s.log" , "SmsSend(USMP)");
	string	strEccPath = GetSiteViewRootPath();
	char szLogFile[128];
	sprintf( szLogFile, "%s\\temp\\%s", 
		     strEccPath.c_str(), szProgramName );
	
	// 判断文件大小:在不打开文件的情况下实现
	struct _stat buf;
	if( _stat( szLogFile, &buf ) == 0 )
	{
		if( buf.st_size > 10000*1024 )
		{
			FILE *log = fopen( szLogFile, "w" );
			if( log != NULL )
				fclose( log );
		}
	}

	FILE *log = fopen( szLogFile,"a+");
	if( log != NULL )
	{
		fprintf( log, "%s \t%s\n", timebuf, str );
		fclose( log );
	}

}
Exemplo n.º 4
0
void CTuopList::refresh()
{
	bool bEnd = false;
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "TuopList";
	LogItem.sHitFunc = "refresh";
	LogItem.sDesc = strRefresh;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

OPEnd:
	if(bEnd)
	{
		DWORD dcalEnd=GetTickCount();
		InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd -dcalBegin);
		return;
	}

	if(bFirst)
	{
		bFirst =false;
		bEnd = true;	
		goto OPEnd;
	}

	m_pTopologyListTable->GeDataTable()->clear();
	RecordList.clear();

	pSortTable->GeDataTable()->clear();
	
	
	std::string strIndex;
	std::list<string> m_pList;
	std::list<string>::iterator m_pItem;

	#ifdef	 Tuopu
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");		
	#else
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	std::list<string> m_pVList;
	std::list<string>::iterator m_pVItem;

	#ifdef	 Tuopu
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");
	#else
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif
	
	m_pVItem = m_pVList.begin();	
	for(m_pItem = m_pList.begin(); m_pItem != m_pList.end(); m_pItem++)
	{
		std::string strUserName = *m_pItem;
		std::string strVSD = *m_pVItem; 
		OneRecord list;
		list.strUserName = strUserName;
		//vsd文件始终不会更改, 所以用它来制造key
		list.strBackName = ReplaceStdString(strVSD, ".vsd", ".htm");
		list.strTuop = strVSD;

		//读取tuopfile.ini的sort信息并赋值给OneRecord变量。:
		//如果没有预先设置的sort信息则按什么规则自动赋值? ---》先是读预先设置的序号, 为默认值 则不存在 意味着是新发布的 
		//---》规则(读一遍ini, 找到序号最大值, 加1 并写到tuopfile.ini文件中)
		int nSort = GetIniFileInt("sort", strVSD, -1, "tuopfile.ini");
		if(nSort != -1)
		{
			list.nSort = nSort;
		}
		else
		{
			//获取序号最大值, 加1
			list.nSort = GetMaxSortId() + 1;

			//写序号值到ini
		#ifdef	 Tuopu
			WriteIniFileInt("sort", strVSD, list.nSort, "tuopfile.ini");
		#else
			WriteIniFileInt("sort", strVSD, list.nSort, "maintainfile.ini");
		#endif
		}

		RecordList.push_back(list);

		m_pVItem++;
	}


	//显示列表
	int i = 1;
	std::string strOpen;

	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->InitRow(i);
		pSortTable->InitRow(i);
		i++;
	}

	i = 1;
	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0)->setContentAlignment(AlignCenter);
		m_pRecordList->pCheckBox = new WCheckBox("", (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0));		

		strOpen = "<a href=./showtuopu.exe?pageid=";
		strOpen += ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
	#ifdef	 Tuopu
		strOpen += "&version=0";
	#else
		strOpen += "&version=0&usrleader=0&maintain=1";
	#endif
		strOpen += " target=_blank>";
		strOpen += m_pRecordList->strUserName;
		strOpen += "</a>";

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		m_pRecordList->pstrUserName = new WText(strOpen, (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		
		m_pRecordList->pLineEdit = new WLineEdit(m_pRecordList->strUserName,m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		m_pRecordList->pLineEdit->hide();

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);		
		m_pRecordList->pTuop = new WImage("../Images/resource.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));
		m_pRecordList->pTuop->setToolTip(strTuopTip);
		m_pRecordList->pTuop->setStyleClass("hand");

		//绑定visio事件
		std::string strJavascript;

	#ifdef	 Tuopu
		strJavascript = "window.open('../tuoplist/" + m_pRecordList->strTuop + "','newwindow')";	
	#else
		strJavascript = "window.open('../maintainlist/" + m_pRecordList->strTuop + "','newwindow')";	
	#endif

		connect(m_pRecordList->pTuop, SIGNAL(clicked()),strJavascript.c_str() ,WObject::JAVASCRIPT );

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6)->setContentAlignment(AlignCenter);
		m_pRecordList->pEdit = new WImage("/Images/edit.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6));		
		m_pRecordList->pEdit->setToolTip(strEditTip);
		m_pRecordList->pEdit->setStyleClass("hand");
		
		strIndex=m_pRecordList->strUserName.c_str();

		m_userMapper.setMapping(m_pRecordList->pEdit, strIndex); 
		
		connect(m_pRecordList->pEdit, SIGNAL(clicked()), &m_userMapper, SLOT(map()));
		connect(m_pRecordList->pLineEdit, SIGNAL(keyWentDown(int)), this, SLOT(EditReturn(int)));
		i++;

		//排序界面初始化
		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		WText * pTmpText = new WText(m_pRecordList->strUserName, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		
		char chItem[32]  = {0};	
		sprintf(chItem, "%d", m_pRecordList->nSort);
		string strSort = chItem;

		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);
		WLineEdit * pTmpEdit = new WLineEdit(strSort, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));

		//放到sv_table里去
		SVTableCell ce;
		ce.setType(adText);
		ce.setValue(pTmpText);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 0, ce);

		ce.setType(adLineEdit);
		ce.setValue(pTmpEdit);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 1, ce);
	}
	
	m_pList.clear();
	m_pVList.clear();
	
	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	//可能有问题..
	pSortTable->hide();

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}
Exemplo n.º 5
0
//删除操作
void CTuopList::DelUser()
{
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "TuopList";
	LogItem.sHitFunc = "DelUser";
	LogItem.sDesc = strDeleteType;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

	string strDeleteTuop;

	for(m_pRecordList = RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList++)
    {       
        if (m_pRecordList->pCheckBox->isChecked())
        {			
			std::string sVal = m_pRecordList->strBackName;
			std::string sVsd = ReplaceStdString(sVal, ".htm", ".vsd");
			std::string sDiretory = ReplaceStdString(sVal, ".htm", ".files");

		#ifdef	 Tuopu
			DeleteIniFileKey("filename", sVal, "tuopfile.ini");
			DeleteIniFileKey("filename", sVsd, "tuopfile.ini");
		#else
			std::string sName = ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
			DeleteIniFileKey("filename", sVal, "maintainfile.ini");
			DeleteIniFileKey("filename", sVsd, "maintainfile.ini");
			DeleteIniFileSection(sName, "maintain.ini");
		#endif			

			//std::string filepath = "C:\\Program Files\\Apache Group\\apache2\\htdocs\\tuoplist\\";			
			//删除了拓扑图  序号怎么变?---》是直接删除呢? 还是要加把其他的序号都整理一遍?---》或者把大于它的序号都减1即可。
			DelSortId(sVsd);

			string strDelDir;
		#ifdef	 Tuopu
			std::string filepath = GetSiteViewRootPath() + "\\htdocs\\tuoplist\\";
			
			filepath += sVal;
			
			bool bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}
		#else
			std::string filepath = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";
			std::string fileleaderpath = GetSiteViewRootPath() + "\\htdocs\\maintainleaderlist\\";
			strDelDir = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";

			filepath += sVal;			
			
			bool bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

			fileleaderpath += sVal;
			
			bret = DeleteFile(fileleaderpath.c_str());
			if(!bret)
			{
				//
			}

			strDelDir += sDiretory;

			//DeleteDirectory(strDelDir);
		#endif			
			


		#ifdef	 Tuopu
			filepath = GetSiteViewRootPath() + "\\htdocs\\tuoplist\\";

			filepath += sVsd;
			
			bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

		#else
			filepath = GetSiteViewRootPath() + "\\htdocs\\maintainlist\\";
			fileleaderpath = GetSiteViewRootPath() + "\\htdocs\\maintainleaderlist\\";

			filepath += sVsd;
			
			bret = DeleteFile(filepath.c_str());
			if(!bret)
			{
				//
			}

			fileleaderpath += sVsd;
			
			bret = DeleteFile(fileleaderpath.c_str());
			if(!bret)
			{
				//
			}

		#endif			


			//files目录是否也删除

            int nRow = ((WTableCell*)(m_pRecordList->pCheckBox->parent()))->row();
        
            list<OneRecord>::iterator pItem = m_pRecordList;
        
            m_pRecordList --;
        
			std::string temp = pItem->pstrUserName->text();		
			int pos = temp.find(">", 0);
			int pos1 = temp.find("<", pos);
			string strTemp = temp.substr(pos + 1, pos1 - pos - 1);			
 			strDeleteTuop += strTemp;
			strDeleteTuop += "  ";

			RecordList.erase(pItem);          
        
            m_pTopologyListTable->GeDataTable()->deleteRow(nRow); 						
        }
    }

	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	//插记录到UserOperateLog表
	TTime mNowTime = TTime::GetCurrentTimeEx();
	OperateLog m_pOperateLog;
	m_pOperateLog.InsertOperateRecord("UserOperateLog",strUserID,mNowTime.Format(),strDeleteType,strMainTitle,strDeleteTuop);

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}
Exemplo n.º 6
0
void CTuopList::ShowMainTable()
{
	//strNullList = "空的列表";

	m_pMainTable = new WSVMainTable(this,strMainTitle,false);
	//if(m_pMainTable->pHelpImg)
	//{
	//	connect(m_pMainTable->pHelpImg,SIGNAL(click()),this,SLOT(ShowHelp()));
	//}

	//拓扑列表界面
	m_pTopologyListTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(0,0),List, strTitle);

	if (m_pTopologyListTable->GetContentTable() != NULL)
	{
		m_pTopologyListTable->AppendColumn("",WLength(40,WLength::Pixel));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strLoginLabel,WLength(70,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strNameUse,WLength(10,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strNameEdit,WLength(10,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");
	}

	if (m_pTopologyListTable->GetActionTable() != NULL)
	{
		m_pTopologyListTable->AddStandardSelLink(strAllSel ,strAllNotSel,strFanSel);
		connect(m_pTopologyListTable->pSelAll, SIGNAL(clicked()), this, SLOT(SelAll()));
		connect(m_pTopologyListTable->pSelNone, SIGNAL(clicked()), this, SLOT(SelNone()));
		connect(m_pTopologyListTable->pSelReverse, SIGNAL(clicked()), this, SLOT(SelInvert()));
	
		WTable *pTbl;
		m_pTopologyListTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter);
		m_pTopologyListTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold");
		
		pTbl = new WTable(m_pTopologyListTable->GetActionTable()->elementAt(0,1));
		pTbl->setStyleClass("widthauto");
		WSVButton * pDel = new WSVButton(pTbl->elementAt(0,1),strDelete, "button_bg_del.png", "", false);
		if (pDel)
		{
			connect(pDel, SIGNAL(clicked()), this, SLOT(BeforeDelUser()));
		} 

		//新增
		//WSVButton * pSort = new WSVButton(pTbl->elementAt(0,2), "排序", "button_bg_taxis.png", "", false);
		WSVButton * pSort = new WSVButton(pTbl->elementAt(0,2), strSort, "button_bg_taxis.png", "", false);
		if (pSort)
		{
			connect(pSort, SIGNAL(clicked()), this, SLOT(Sort()));
		}

		//WTable *pTbl2;
		m_pTopologyListTable->GetActionTable()->elementAt(0, 2)->setContentAlignment(AlignRight);		
		strcpy(m_pTopologyListTable->GetActionTable()->elementAt(0, 2)->contextmenu_, "nowrap");			

		//Tuopu 发布插件下载
		string strTuopPluginJs = "window.open('../TuopoClient.exe','newwindow')";
		
		string szLink = "<a href='#'>" + szTuopDown + "</a>&nbsp;&nbsp;";
		WText * pTuopPlugin = new WText(szLink, (WContainerWidget *)m_pTopologyListTable->GetActionTable()->elementAt(0, 2));
		connect(pTuopPlugin, SIGNAL(clicked()),strTuopPluginJs.c_str() ,WObject::JAVASCRIPT);
	}

	m_pTopologyListTable->SetNullTipInfo(strNullList);


	//拓扑排序列表界面
	//pSortTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(1,0), List, "拓扑排序列表");
	pSortTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(1,0), List, strTuoPuSortList);
	if (pSortTable->GetContentTable() != NULL)
	{
		pSortTable->AppendColumn("",WLength(40,WLength::Pixel));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");

		//pSortTable->AppendColumn("名称",WLength(50,WLength::Percentage));
		pSortTable->AppendColumn(strName,WLength(50,WLength::Percentage));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");

		//pSortTable->AppendColumn("序号",WLength(50,WLength::Percentage));
		pSortTable->AppendColumn(strSequenceNo,WLength(50,WLength::Percentage));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");
	}

	if (pSortTable->GetActionTable() != NULL)
	{
		WTable *pTbl1;
		pSortTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter);
		pSortTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold");
		
		pTbl1 = new WTable(pSortTable->GetActionTable()->elementAt(0,1));
		pTbl1->setStyleClass("widthauto");
		//WSVButton * pSortOkBtn = new WSVButton(pTbl1->elementAt(0, 1), "确 定", "button_bg_m.png", "", false);
		WSVButton * pSortOkBtn = new WSVButton(pTbl1->elementAt(0, 1), strAffirm, "button_bg_m.png", "", false);

		if(pSortOkBtn)
		{
			connect(pSortOkBtn,SIGNAL(clicked()),this,SLOT(SortOk()));
		}
	}
	
	//编辑事件
	std::string strIndex;

	std::list<string> m_pList;
	std::list<string>::iterator m_pItem;

	#ifdef	 Tuopu
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");		
	#else
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	std::list<string> m_pVList;
	std::list<string>::iterator m_pVItem;

	#ifdef	 Tuopu
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");
	#else
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	m_pVItem = m_pVList.begin();	
	for(m_pItem = m_pList.begin(); m_pItem != m_pList.end(); m_pItem++)
	{
		std::string strUserName = *m_pItem;
		std::string strVSD = *m_pVItem; 
		OneRecord list;
		list.strUserName = strUserName;
		//vsd文件始终不会更改, 所以用它来制造key
		list.strBackName = ReplaceStdString(strVSD, ".vsd", ".htm");
		list.strTuop = strVSD;

		//读取tuopfile.ini的sort信息并赋值给OneRecord变量。:
		//如果没有预先设置的sort信息则按什么规则自动赋值? ---》先是读预先设置的序号, 为默认值 则不存在 意味着是新发布的 
		//---》规则(读一遍ini, 找到序号最大值, 加1 并写到tuopfile.ini文件中)
		int nSort = GetIniFileInt("sort", strVSD, -1, "tuopfile.ini");
		if(nSort != -1)
		{
			list.nSort = nSort;
		}
		else
		{
			//获取序号最大值, 加1
			list.nSort = GetMaxSortId() + 1;

			//写序号值到ini
		#ifdef	 Tuopu
			WriteIniFileInt("sort", strVSD, list.nSort, "tuopfile.ini");
		#else
			WriteIniFileInt("sort", strVSD, list.nSort, "maintainfile.ini");
		#endif
		}

		RecordList.push_back(list);

		m_pVItem++;
	}	
	
	
	//绑定编辑事件
	connect(&m_userMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditUserName(const std::string)));

	//显示列表
	int i = 1;
	std::string strOpen;

	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->InitRow(i);
		pSortTable->InitRow(i);
		i++;
	}

	i = 1;
	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		//列表数据界面初始化
		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0)->setContentAlignment(AlignCenter);
		m_pRecordList->pCheckBox = new WCheckBox("", (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0));		

		strOpen = "<a href=./showtuopu.exe?pageid=";
		strOpen += ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
	#ifdef	 Tuopu
		strOpen += "&version=0";
	#else
		strOpen += "&version=0&usrleader=0&maintain=1";
	#endif
		strOpen += " target=_blank>";
		strOpen += m_pRecordList->strUserName;
		strOpen += "</a>";

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		m_pRecordList->pstrUserName = new WText(strOpen, (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		

		m_pRecordList->pLineEdit = new WLineEdit(m_pRecordList->strUserName,m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		m_pRecordList->pLineEdit->hide();


		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);		
		m_pRecordList->pTuop = new WImage("../Images/resource.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));
		m_pRecordList->pTuop->setToolTip(strTuopTip);
		m_pRecordList->pTuop->setStyleClass("hand");

		//绑定visio事件
		std::string strJavascript;

	#ifdef	 Tuopu
		strJavascript = "window.open('../tuoplist/" + m_pRecordList->strTuop + "','newwindow')";	
	#else
		strJavascript = "window.open('../maintainlist/" + m_pRecordList->strTuop + "','newwindow')";	
	#endif

		connect(m_pRecordList->pTuop, SIGNAL(clicked()),strJavascript.c_str() ,WObject::JAVASCRIPT );

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6)->setContentAlignment(AlignCenter);
		m_pRecordList->pEdit = new WImage("/Images/edit.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6));		
		m_pRecordList->pEdit->setToolTip(strEditTip);
		m_pRecordList->pEdit->setStyleClass("hand");
		
		strIndex=m_pRecordList->strUserName.c_str();

		m_userMapper.setMapping(m_pRecordList->pEdit, strIndex); 
		
		connect(m_pRecordList->pEdit, SIGNAL(clicked()), &m_userMapper, SLOT(map()));
		connect(m_pRecordList->pLineEdit, SIGNAL(keyWentDown(int)), this, SLOT(EditReturn(int)));
		i++;

		//排序数据界面初始化
		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		WText * pTmpText = new WText(m_pRecordList->strUserName, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));

		char chItem[32]  = {0};	
		sprintf(chItem, "%d", m_pRecordList->nSort);
		string strSort = chItem;

		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);
		WLineEdit * pTmpEdit = new WLineEdit(strSort, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));

		//放到sv_table里去
		SVTableCell ce;
		ce.setType(adText);
		ce.setValue(pTmpText);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 0, ce);

		ce.setType(adLineEdit);
		ce.setValue(pTmpEdit);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 1, ce);
	}
	
	m_pList.clear();
	m_pVList.clear();
	
	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	pSortTable->hide();


	//隐藏按钮
	pHideBtn = new WPushButton("hide button",this);
	if(pHideBtn)
	{
		pHideBtn->setToolTip("Hide Button");
		connect(pHideBtn,SIGNAL(clicked()),this,SLOT(DelUser()));
		pHideBtn->hide();
	}

	pTranslateBtn = new WPushButton("Translate",this);
	pExChangeBtn = new WPushButton("Refresh",this);

	//翻译
	int bTrans = GetIniFileInt("translate", "translate", 0, "general.ini");
	if(bTrans == 1)
	{
		this->pTranslateBtn->show();
		connect(this->pTranslateBtn, SIGNAL(clicked()), this, SLOT(Translate()));	

		this->pExChangeBtn->show();
		connect(this->pExChangeBtn, SIGNAL(clicked()), this, SLOT(ExChange()));	
	}
	else
	{
		this->pTranslateBtn->hide();
		this->pExChangeBtn->hide();
	}
}
Exemplo n.º 7
0
CShowLog::CShowLog(WContainerWidget *parent):
WContainerWidget(parent)
{
	refreshCount=0;

	string strTemp1,strTemp2;
	OBJECT objRes=LoadResource("default", "localhost");  
	if( objRes !=INVALID_VALUE )
	{	
		MAPNODE ResNode=GetResourceNode(objRes);
		if( ResNode != INVALID_VALUE )
		{
			FindNodeValue(ResNode,"IDS_LogShow",strMainTitle);
			FindNodeValue(ResNode,"IDS_ReadLogError",strTemp1);
			FindNodeValue(ResNode,"IDS_MonitorLogContext",strTemp2);
		}
		CloseResource(objRes);
	}
	
	
	char buf_tmp[4096]={0};
    int nSize =4095;


	GetEnvironmentVariable( "QUERY_STRING", buf_tmp,nSize);
	//char * tmpquery;
	//tmpquery = getenv( "QUERY_STRING");
	//if(tmpquery)
	//	strcpy(buf_tmp,tmpquery);
	if(buf_tmp != NULL)
	{
		std::string buf1 = buf_tmp;
		int pos = buf1.find("=", 0);
		querystr = buf1.substr(pos+1, buf1.size() - pos - 1);
	}
	
	strPath = "";
	strPath += GetSiteViewRootPath();
	strPath += "\\data\\Temp\\";
	strPath += querystr;
	strPath += ".txt";

	string   strTemp; 
	string   strOutput;

	try
	{
		ifstream  Input(strPath.c_str(), ios::out); 
			//获取日志行数
			nTotleLine = 0;
			nCurLine = 0;
			nPageLine = 100;

		if(Input.is_open())
		{
		
			while(!Input.eof())   
			{   
				nTotleLine++;
				getline(Input, strTemp , '\n');
				//puts(strTemp.c_str());
			}

			Input.close(); 
		}
		
		//获取日志最新100行数数据
		nStartLine = nTotleLine - nPageLine;

		//Input.open(strPath.c_str(), ios::out, 0);

		ifstream  Input1(strPath.c_str(), ios::out); 
		if(Input1.is_open())
		{
			while(!Input1.eof())   
			{   
				if(nTotleLine <= nPageLine)
				{
					getline(Input1, strTemp , '\n');
					strOutput += strTemp;
					strOutput += "\n";
				}
				else
				{
					if(nCurLine >=  nStartLine)
					{
						getline(Input1, strTemp , '\n');
						strOutput += strTemp;
						strOutput += "\n";
					}
					else
						getline(Input1, strTemp , '\n');
					
					nCurLine++;
				}
			}

			Input1.close(); 
		}

	}
	catch(...)
	{
		strOutput = strTemp1;
	}

	WTable * pContainTable = new WTable(this);
	
	//日志标题
	string strLogTitle = GetDeviceTitle(querystr);
	strLogTitle += ":";
	strLogTitle += GetMonitorPropValue(querystr, "sv_name");
	strLogTitle += strTemp2;


	pContainTable ->setStyleClass("t5");
	//pContainTable->setStyleClass("StatsTable");
	WText * pReportTitle = new WText(strLogTitle, (WContainerWidget*)pContainTable->elementAt(0, 0));
	pContainTable->elementAt(0, 0)->setContentAlignment(AlignTop | AlignCenter);
	WFont font1;
	font1.setSize(WFont::Large, WLength(60, WLength::Pixel));
	pReportTitle ->decorationStyle().setFont(font1);


	//日志内容
	WTextArea * pStateTextArea = new WTextArea(strOutput, (WContainerWidget*)pContainTable->elementAt(1, 0));
	//pContainTable->elementAt(1, 0)->setStyleClass("t5");
	pContainTable->elementAt(1, 0)->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));
	pStateTextArea->setRows(nPageLine);
	pStateTextArea->setColumns(60);
	pStateTextArea ->setStyleClass("testingresult2");
	//pStateTextArea->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));
	pStateTextArea->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));

	strcpy(pStateTextArea->contextmenu_ , "readonly=\"readonly\"");

	//strPageTitle = "";
	//new WText("日志内容:", pMainTable->elementAt(4, 0));
	//new WText(strOutput, pMainTable->elementAt(2,0));

	//版权信息
	WText * bottomTitle = new WText("Copyright SiteView", pContainTable->elementAt(2, 0));
	bottomTitle ->decorationStyle().setFont(font1);
	pContainTable->elementAt(2, 0)->setContentAlignment(AlignTop | AlignCenter);
	bottomTitle->decorationStyle().setForegroundColor(Wt::blue);
}
Exemplo n.º 8
0
CString FuncGetInstallPath()
{
	CString strRet = _T("");
	strRet= GetSiteViewRootPath().c_str();
	return strRet;
}
Exemplo n.º 9
0
void SVDeviceTest::TestDevice()
{
    bool bRet = false;
    char szReturn [svBufferSize] = {0};
    int nSize = sizeof(szReturn);
    int nQuerySize = static_cast<int>(m_szQuery.length()) + 2;
    char *pszQueryString = new char[nQuerySize];
    if(pszQueryString)
    {
		OutputDebugString("-------------enter TestDevice()-----------------\n");
        //PrintDebugString(m_szQuery.c_str());
        memset(pszQueryString, 0 , nQuerySize);
        changeQueryString(m_szQuery.c_str(), pszQueryString);
        string szDll = "", szFunc = "";
        GetDllAndFunc(m_szQuery.c_str(), szDll, szFunc);
        string szSEID(GetSEID(m_szQuery.c_str()));
        PrintDebugString("DLL name: " + szDll + "\tFunc name: " + szFunc);
        if(szSEID == "1")
        {
            szDll = GetSiteViewRootPath() + "\\fcgi-bin\\" + szDll;
            if(!szDll.empty() && !szFunc.empty())
            {
    #ifdef WIN32
                HINSTANCE hdll = LoadLibrary(szDll.c_str());
                if (hdll)
                {
                    DeviceTest* func = (DeviceTest*)::GetProcAddress(hdll, szFunc.c_str());
                    if (func)
                    {
                        bRet = (*func)(pszQueryString, szReturn, nSize);
                    }
					//Jansion.zhou 2007-01-07
                    //int nRow = m_pSubContent->numRows();
                    //new WText(m_szTestSucc, m_pSubContent->elementAt(nRow, 0));
                    FreeLibrary(hdll);
                }
    #else
    #endif
            }
        }
        else
        {
            PrintDebugString("Test Device by SiteView ECC Slave");
            string szMsg = "dll is " + szDll + " func is " + szFunc + " query stirng is ";
            szMsg += pszQueryString;
            PrintDebugString(szMsg);
            bRet = ReadWriteDynQueue(szSEID, szDll, szFunc, pszQueryString, nQuerySize, szReturn, nSize);
        }
        delete []pszQueryString;
    }
    if(bRet)
    {
        PrintReturn(szReturn);
        int nRow = m_pSubContent->numRows();		
		OutputDebugString("\n----------TestDevice-----------\n");
    }
    else
    {
        int nRow = m_pSubContent->numRows();
	}
}