Exemplo n.º 1
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");
	}	
}