void CSVReportSet::refresh() { //nullTable -> clear(); PrintDebugString("Begin refresh function\n"); UpdatePhoneList(); if(!GetUserRight("m_reportlistAdd")) m_pAdd->hide(); else m_pAdd->show(); if(!GetUserRight("m_reportlistDel")) m_pDel->hide(); else m_pDel->show(); //翻译 int bTrans = GetIniFileInt("translate", "translate", 0, "general.ini"); if(bTrans == 1) { pTranslateBtn->show(); pExChangeBtn->show(); } else { pTranslateBtn->hide(); pExChangeBtn->hide(); } }
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 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"); } }
void CSVReportSet::initForm() { new WText("<SCRIPT language='JavaScript' src='/Calendar.js'></SCRIPT>",this); new WText("<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", this); new WText("<div id='view_panel' class='panel_view'>",this); m_pMainTable = new WSVMainTable(this,m_formText.szMainTitle,false); m_pReportListTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(0,0), List, m_formText.szTBTitle); if (m_pReportListTable->GetContentTable() != NULL) { m_pReportListTable->AppendColumn("",WLength(5,WLength::Percentage)); m_pReportListTable->SetDataRowStyle("table_data_grid_item_img"); m_pReportListTable->AppendColumn(m_formText.szColName,WLength(55,WLength::Percentage)); m_pReportListTable->SetDataRowStyle("table_data_grid_item_text"); m_pReportListTable->AppendColumn(m_formText.szColPeriod,WLength(20,WLength::Percentage)); m_pReportListTable->SetDataRowStyle("table_data_grid_item_img"); m_pReportListTable->AppendColumn(m_formText.szColEdit,WLength(20,WLength::Percentage)); m_pReportListTable->SetDataRowStyle("table_data_grid_item_text"); } addPhoneListNew(); connect(&m_signalMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditRow(const std::string))); if (m_pReportListTable->GetActionTable() != NULL) { m_pReportListTable->SetNullTipInfo(szListEmpty); if(m_pListReport.size() <= 0) { m_pReportListTable->ShowNullTip(); } else { m_pReportListTable->HideNullTip(); } m_pReportListTable->AddStandardSelLink(m_formText.szTipSelAll1 ,m_formText.szTipSelNone,m_formText.szTipSelInv); connect(m_pReportListTable->pSelAll, SIGNAL(clicked()), this, SLOT(SelAll())); connect(m_pReportListTable->pSelNone, SIGNAL(clicked()), this, SLOT(SelNone())); connect(m_pReportListTable->pSelReverse, SIGNAL(clicked()), this, SLOT(SelInvert())); WTable *pTbl; m_pReportListTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter); m_pReportListTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold"); pTbl = new WTable(m_pReportListTable->GetActionTable()->elementAt(0,1)); pTbl->setStyleClass("widthauto"); m_pDel = new WSVButton(pTbl->elementAt(0,1),m_formText.szTipDel, "button_bg_del.png", "", false); if(!GetUserRight("m_reportlistDel")) m_pDel->hide(); else m_pDel->show(); if (m_pDel) { m_pDel->setToolTip(m_formText.szTipDel); connect(m_pDel , SIGNAL(clicked()),this, SLOT(BeforeDelPhone())); } m_pReportListTable->GetActionTable()->elementAt(0,2)->setContentAlignment(AlignRight); m_pAdd = new WSVButton(m_pReportListTable->GetActionTable()->elementAt(0,2),m_formText.szAddPhoneBut, "button_bg_add_black.png", m_formText.szTipAddNew, true); if(!GetUserRight("m_reportlistAdd")) m_pAdd->hide(); else m_pAdd->show(); if (m_pAdd) { m_pAdd->setToolTip(m_formText.szTipAddNew); WObject::connect(m_pAdd, SIGNAL(clicked()),"showbar();", this, SLOT(AddPhone()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC); } //隐藏按钮 pHideBut = new WPushButton("hide button",this); if(pHideBut) { pHideBut->setToolTip("Hide Button"); connect(pHideBut,SIGNAL(clicked()),this,SLOT(DelPhone())); pHideBut->hide(); } } // new WText("\n<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", this); //// new WText("<SCRIPT language='JavaScript' src='/Calendar.js'></SCRIPT>", this); // //CMainTable * T1table = new CMainTable(this ,"统计报告"); // // WTable* T1table = new WTable(this); // T1table->setStyleClass("t1"); // new WText(m_formText.szMainTitle, T1table->elementAt(0,0)); // T1table->elementAt(0,0)->setStyleClass("t1title"); // // // WTable * TitleTable = new WTable(T1table->elementAt(1,0)); // // TitleTable->setStyleClass("t3"); //Jansion.zhou 2006-12-25 m_pConnErr = new WText("", (WContainerWidget *)this); m_pConnErr->decorationStyle().setForegroundColor(Wt::red); m_pConnErr ->hide(); //if(m_pReportListTable->GetContentTable() != NULL) //{ // m_pReportListTable->AppendRows(""); // //int NowRows = m_pReportListTable->GeDataTable()->numRows(); // m_pConnErr = new WText("", m_pReportListTable->AppendRowsContent(0, "","",m_formText.szConnErr)); // m_pConnErr->decorationStyle().setForegroundColor(Wt::red); //} //测试连接SVDB std::list<string> sectionlist; bool IsConn = GetIniFileSections(sectionlist, "smsconfig.ini"); if(!IsConn) { //连接SVDB失败 m_pConnErr ->setText(m_formText.szConnErr); m_pConnErr ->show(); } pTranslateBtn = new WPushButton(strTranslate, this); connect(pTranslateBtn, SIGNAL(clicked()), this, SLOT(Translate())); pTranslateBtn->setToolTip(strTranslateTip); pTranslateBtn->hide(); pExChangeBtn = new WPushButton(strRefresh, this); connect(pExChangeBtn, SIGNAL(clicked()), this, SLOT(ExChange())); pExChangeBtn->setToolTip(strRefreshTip); pExChangeBtn->hide(); //翻译 int bTrans = GetIniFileInt("translate", "translate", 0, "general.ini"); if(bTrans == 1) { pTranslateBtn->show(); pExChangeBtn->show(); } else { pTranslateBtn->hide(); pExChangeBtn->hide(); } ////主框架帮助按钮 //m_pHelpImg = new WImage("../icons/help.gif", (WContainerWidget *)TitleTable->elementAt( 0, 1)); //m_pHelpImg -> hide(); //m_pHelpImg ->setStyleClass("helpimg"); //TitleTable->elementAt(0, 1) -> setContentAlignment(AlignTop | AlignRight); //WObject::connect(m_pHelpImg, SIGNAL(clicked()), this, SLOT(MainHelp())); // ////接受列表 ////WTable * m_pListGeneral = new WTable(this); //WTable * m_pListGeneral = new WTable(T1table->elementAt(2,0)); // //m_pListGeneral ->setStyleClass("t2"); // ////接受列表收/放显示栏 //pHide2 = new WImage("../icons/open.gif", (WContainerWidget *)m_pListGeneral->elementAt( 0, 0)); // if ( pHide2 ) // { // pHide2->decorationStyle().setCursor(WCssDecorationStyle::Pointer); // WObject::connect(pHide2, SIGNAL(clicked()), this, SLOT(showSmsList2())); // pHide2->hide(); // } // pShow2 = new WImage("../icons/close.gif", (WContainerWidget *)m_pListGeneral->elementAt( 0, 0)); // if ( pShow2 ) // { // pShow2->decorationStyle().setCursor(WCssDecorationStyle::Pointer); // WObject::connect(pShow2, SIGNAL(clicked()), this, SLOT(hideSmsList2())); // } //m_pListGeneral->elementAt(0, 0)->setStyleClass("t2title"); //new WText(m_formText.szTBTitle, (WContainerWidget *)m_pListGeneral->elementAt( 0, 0)); //table2 = new WTable((WContainerWidget *)m_pListGeneral->elementAt(1,0)); ////table2 -> setStyleClass("bg_Border"); //table2 ->setStyleClass("t3"); //PrintDebugString("Init Old Table\n"); // if ( table2 ) // { // addPhoneList(table2); // connect(&m_signalMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditRow(const std::string))); // PrintDebugString("Init Old Table2\n"); // //AddGroupOperate(table2); //} new WText("</div>", this); AddJsParam("uistyle", "viewpan"); AddJsParam("fullstyle", "true"); AddJsParam("bGeneral", "false"); new WText("<SCRIPT language='JavaScript' src='/Script.js'></SCRIPT>", this); }
void CSVReportSet::AddGroupOperate(WTable * pTable) { PrintDebugString("begin Init AddOperator function\n"); m_pGroupOperate = new WTable((WContainerWidget *)pTable->elementAt( 8, 0)); if ( m_pGroupOperate ) { WImage * pSelAll = new WImage("../icons/selall.gif", (WContainerWidget *)m_pGroupOperate->elementAt(0, 1)); if (pSelAll) { pSelAll->setStyleClass("imgbutton"); pSelAll->setToolTip(m_formText.szTipSelAll1); connect(pSelAll, SIGNAL(clicked()), this, SLOT(SelAll())); } WImage * pSelNone = new WImage("../icons/selnone.gif", (WContainerWidget *)m_pGroupOperate->elementAt(0, 2)); if (pSelAll) { pSelNone->setStyleClass("imgbutton"); pSelNone->setToolTip(m_formText.szTipSelNone); connect(pSelNone, SIGNAL(clicked()), this, SLOT(SelNone())); } WImage * pSelinvert = new WImage("../icons/selinvert.gif", (WContainerWidget *)m_pGroupOperate->elementAt(0, 3)); if (pSelinvert) { pSelinvert->setStyleClass("imgbutton"); pSelinvert->setToolTip(m_formText.szTipSelInv); connect(pSelinvert, SIGNAL(clicked()), this, SLOT(SelInvert())); } pDel = new WImage("../icons/del.gif", (WContainerWidget *)m_pGroupOperate->elementAt(0, 4)); if(!GetUserRight("m_reportlistDel")) pDel->hide(); else pDel->show(); if (pDel) { pDel->setStyleClass("imgbutton"); pDel->setToolTip(m_formText.szTipDel); connect(pDel , SIGNAL(clicked()),this, SLOT(BeforeDelPhone())); } pAdd = new WPushButton(m_formText.szAddPhoneBut, (WContainerWidget *)m_pGroupOperate->elementAt(0, 6)); pAdd->setStyleClass("wizardbutton"); if(!GetUserRight("m_reportlistAdd")) pAdd->hide(); else pAdd->show(); if (pAdd) { pAdd->setToolTip(m_formText.szTipAddNew); WObject::connect(pAdd, SIGNAL(clicked()),"showbar();", this, SLOT(AddPhone()) , WObject::ConnectionType::JAVASCRIPTDYNAMIC); } m_pGroupOperate->elementAt(0, 6)->resize(WLength(100,WLength::Percentage),WLength(100,WLength::Percentage)); m_pGroupOperate->elementAt(0, 6)->setContentAlignment(AlignRight); } PrintDebugString("Init AddOperator function\n"); //隐藏按钮 pHideBut = new WPushButton("hide button",this); if(pHideBut) { pHideBut->setToolTip("Hide Button"); connect(pHideBut,SIGNAL(clicked()),this,SLOT(DelPhone())); pHideBut->hide(); } PrintDebugString("Init AddOperator function finish\n"); }