void BasePage::printSeries(const Dbo::collection<Dbo::ptr<Seria> >& listseries){ WTable *seriaTable = new WTable(); seriaTable->setHeaderCount(1); seriaTable->setStyleClass("tablestyle"); seriaTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>")); seriaTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Name of seria </p>")); seriaTable->elementAt(0, 2)->addWidget(new WText("<p align='left'> Number of books </p>")); _pagecontent->addWidget(seriaTable); int row=1; for (Dbo::collection<Dbo::ptr<Seria> >::const_iterator i = listseries.begin(); i != listseries.end(); ++i){ Dbo::ptr<Seria> Seria = *i; seriaTable->setStyleClass("tablestyle th,td,tr"); //headers seriaTable->elementAt(row, 0) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(row))); //genre seriaTable->elementAt(row, 1) ->addWidget(new WText(WString::fromUTF8(Seria.get()->seria))); //num of books in seria seriaTable->elementAt(row, 2) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((Seria.get()->numOfBooks)))); _pagecontent->addWidget(seriaTable); row++; } }
void BasePage::printAuthors(const Dbo::collection<Dbo::ptr<Author> >& listauthors){ WTable *authTable = new WTable(); authTable->setHeaderCount(1); authTable->setStyleClass("tablestyle"); authTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>")); authTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Full name or pseudo </p>")); authTable->elementAt(0, 2)->addWidget(new WText("<p align='left'> Years of life </p>")); _pagecontent->addWidget(authTable); int row=1; for (Dbo::collection<Dbo::ptr<Author> >::const_iterator i = listauthors.begin(); i != listauthors.end(); ++i){ Dbo::ptr<Author> Author = *i; authTable->setStyleClass("tablestyle th,td,tr"); //headers authTable->elementAt(row, 0) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(row))); //name authTable->elementAt(row, 1) ->addWidget(new WText(WString::fromUTF8(Author.get()->name))); //authors authTable->elementAt(row, 2) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((Author.get()->years)))); _pagecontent->addWidget(authTable); row++; } }
//添加栏目 bool WSVFlexTable::AppendRows(std::string strColName) { if(GetContentTable()!=NULL) { int iLast = GetContentTable()->numRows(); //栏 iLast++; WTable * pTmpTable = new WTable((WContainerWidget *)GetContentTable()->elementAt(iLast, 0)); //栏名称 pTmpTable->elementAt(0, 0)->setStyleClass("padding_top"); WTable * pTmpTitleTable = new WTable((WContainerWidget *)pTmpTable->elementAt(0, 0)); pTmpTitleTable->setStyleClass("table_data_input_rows"); pTmpTitleTable->elementAt(0, 0)->setStyleClass("table_data_input_text"); new WText(strColName, (WContainerWidget *)pTmpTitleTable->elementAt(0, 0)); //栏内容 pTmpTable->elementAt(1, 0)->setStyleClass("padding_4"); m_pListRowTable.push_back(new WTable((WContainerWidget *)pTmpTable->elementAt(1, 0))); //栏分隔线 iLast++; WTable * pSeparatorTable = new WTable((WContainerWidget *)GetContentTable()->elementAt(iLast, 0)); pSeparatorTable->setStyleClass("table_data_input_rows"); pSeparatorTable->elementAt(0, 0)->setStyleClass("table_data_input_space"); new WImage("/Images/space.gif","",pSeparatorTable->elementAt(0, 0)); } return true; }
//添加栏目 void WSPopTable::AppendRows(std::string strRowName) { int iLast = pFirstTable->numRows(); iLast++; //RowTitle WTable * pTitleTable = new WTable((WContainerWidget *)pFirstTable->elementAt(iLast,0)); pTitleTable->setStyleClass("padding_5"); pTitleTable->resize(WLength(100,WLength::Percentage),WLength()); pTitleTable->elementAt(0,0)->setStyleClass("textbold"); pTitleText = new WText(strRowName, pTitleTable->elementAt(0,0)); //Help if(bHelp) { pTitleTable->elementAt(0, 1)->setContentAlignment(AlignRight|AlignTop); pHelpImg = new WImage("/Images/help.png","", pTitleTable->elementAt(0, 1)); pHelpImg->setStyleClass("hand"); } //RowContent iLast++; pFirstTable->elementAt(iLast,0)->setStyleClass("padding_2"); WTable * pRowContentTable = new WTable((WContainerWidget *)pFirstTable->elementAt(iLast, 0)); pRowContentTable->resize(WLength(100,WLength::Percentage),WLength()); //top ShowTop(pRowContentTable); //content pRowContentTable->elementAt(1, 0)->setStyleClass("pop_table_mid_l"); WTable * pReturnTable = new WTable((WContainerWidget *)pRowContentTable->elementAt(1, 1)); pReturnTable->resize(WLength(100,WLength::Percentage),WLength()); pReturnTable->setStyleClass("bgcolor"); // pReturnTable->elementAt(0, 0)->setStyleClass("padding_5"); m_pListContentTable.push_back(new WTable((WContainerWidget *)pReturnTable->elementAt(0, 0))); //分隔线 pReturnTable->elementAt(1,0)->setStyleClass("padding_5"); WTable * pLineTable = new WTable((WContainerWidget *)pReturnTable->elementAt(1, 0)); pLineTable->resize(WLength(100,WLength::Percentage), WLength()); pLineTable->elementAt(0, 0)->setStyleClass("table_data_input_space"); new WImage("/Images/space.gif","",pLineTable->elementAt(0, 0)); //ActionTable pReturnTable->elementAt(2,0)->setStyleClass("padding_2"); m_pListActionTable.push_back(new WTable((WContainerWidget *)pReturnTable->elementAt(2,0))); pRowContentTable->elementAt(1, 2)->setStyleClass("pop_table_mid_r"); //bottom ShowBottom(pRowContentTable); }
/*void BasePage::addAuthor(){ WContainerWidget *container1 = new WContainerWidget(); Wt::WTemplate *r = new Wt::WTemplate(Wt::WString::tr("addAuthorForm")); WLineEdit *editName = new WLineEdit(container1); editName->setPlaceholderText("name"); r->bindWidget("name", editName); WLineEdit *editYears = new WLineEdit(container1); editYears->setPlaceholderText("years"); r->bindWidget("years", editYears); WPushButton *button = new WPushButton("Add author", container1); button->setMargin(10, Top | Bottom); button->clicked().connect(std::bind([=] () {BookManager am; am.addAuthor("123","2016"); })); r->bindWidget("button", button); _pagecontent->addWidget(r); }*/ void BasePage::addMark(const Dbo::collection<Dbo::ptr<Book> >& listaddmark){ WTable *table = new WTable(); table->setHeaderCount(1); table->setStyleClass("tablestyle"); table->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>")); table->elementAt(0, 1)->addWidget(new WText("<p align='left'> Title of book </p>")); table->elementAt(0, 2)->addWidget(new WText("<p align='left'> Author </p>")); table->elementAt(0, 3)->addWidget(new WText("<p align='left'> Genre </p>")); table->elementAt(0, 4)->addWidget(new WText("<p align='left'> Add your mark </p>")); _pagecontent->addWidget(table); int row=1; for (Dbo::collection<Dbo::ptr<Book> >::const_iterator i = listaddmark.begin(); i != listaddmark.end(); ++i){ Dbo::ptr<Book> book = *i; table->setStyleClass("tablestyle th,td,tr"); //headers table->elementAt(row, 0) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(row))); //titles table->elementAt(row, 1) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(book.get()->title))); //authors table->elementAt(row, 2) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((book.get()->author.get()->name)))); //genres table->elementAt(row, 3) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((book.get()->genre.get()->genre)))); //add mark WLineEdit *editAddMark = new WLineEdit(table->elementAt(row,4)); editAddMark->setPlaceholderText("Add mark"); table->elementAt(row, 4) ->addWidget(editAddMark); table->elementAt(row, 4) ->addWidget(new WText("<br></br>")); WPushButton *button = new WPushButton("Add mark", table->elementAt(row,4)); button->setMargin(10, Top | Bottom); table->elementAt(row, 4) ->addWidget(button); /*button->clicked().connect(std::bind([] ( Dbo::ptr<Book> book) { BookManager bm; std::cout<<book.get()->title; int curMark=book.get()->mark; int curNumMarks=book.get()->numMarks; bm.refreshRate(book.get()->id, curMark+5, curNumMarks+1, session); },*i ));*/ row++; _pagecontent->addWidget(table); } }
CMenuTable::CMenuTable(WContainerWidget * parent, const std::string strTitle) :WTable(parent) { this->setCellPadding(0); this->setCellSpaceing(0); bShow = true; WTable * pTable = new WTable(this->elementAt(0,0)); pTable->setCellPadding(0); pTable->setCellSpaceing(0); new WText(strTitle, (WContainerWidget*)pTable->elementAt(0,0)); pTable->elementAt(0,0)->setStyleClass("navt2title"); m_pOpenimg = new WImage("../icons/arrowdown.gif", (WContainerWidget *)pTable->elementAt(0, 1)); m_pOpenimg->setStyleClass("helpimg"); m_pCloseimg = new WImage("../icons/arrowup.gif", (WContainerWidget *)pTable->elementAt(0, 1)); m_pCloseimg->setStyleClass("helpimg"); //m_pOpenimg->decorationStyle().setCursor(WCssDecorationStyle::Pointer); //m_pCloseimg->decorationStyle().setCursor(WCssDecorationStyle::Pointer); //pTable->elementAt(0,0)->resize(15, 11); //m_pCloseimg->resize(15, 11); pTable->elementAt(0, 1)->setContentAlignment(AlignRight); pTable->setStyleClass("navt2"); m_pOpenimg->hide(); WObject::connect(pTable->elementAt(0,0),SIGNAL(clicked()),this,SLOT(ShowOrHideTable())); WObject::connect(m_pOpenimg,SIGNAL(clicked()),this,SLOT(ShowTable())); WObject::connect(m_pCloseimg,SIGNAL(clicked()),this,SLOT(HideTable())); m_pContentTable = new WTable((WContainerWidget*)this->elementAt(1,0)) ; m_pContentTable->setCellPadding(0); m_pContentTable->setCellSpaceing(0); m_pContentTable->setStyleClass("navt3"); }
WSVMainTable::WSVMainTable(WContainerWidget * parent, const std::string strTitle, const bool bHelp_) :WTable(parent) { bHelp = bHelp_; // pThreeTable =NULL; //第一层table this->setStyleClass("padding_top"); //第二层table pMainTable = new WTable((WContainerWidget *)this->elementAt(0,0)); //this->GetRow(0)->setStyleClass("padding_top"); //pMainTable->setStyleClass("padding_top"); //第三层table WTable* pTopViewTable = new WTable((WContainerWidget *)pMainTable->elementAt(0,0)); pTopViewTable->setStyleClass("padding_2"); pTitleTxt = new WText(strTitle,(WContainerWidget *)pTopViewTable->elementAt(0,0)); pTopViewTable->elementAt(0,0)->setStyleClass("textbold"); strcpy(pTopViewTable->elementAt(0,0)->contextmenu_,"nowrap"); if(bHelp) { pTopViewTable->elementAt(0, 1)->setContentAlignment(AlignRight); pHelpImg = new WImage("/Images/help.png","", pTopViewTable->elementAt(0, 1)); pHelpImg->setStyleClass("hand"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 创建标题 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void CEccBaseTable::createTitle(bool bHasHelp) { int nRow = numRows(); // 标题表 WTable *pTitle = new WTable(elementAt(nRow, 0)); if(pTitle) { pTitle->setStyleClass("padding_2"); m_pTitle = new WText("Title", pTitle->elementAt(0, 0)); if(m_pTitle) m_pTitle->setStyleClass("textbold"); // 是否创建帮助 if(bHasHelp) { // 创建帮助 // 2007.1.23 Kevin Yang // 将help.gif修改为help.png WImage *pHelp = new WImage("../Images/help.png", pTitle->elementAt(0, 1)); pTitle->elementAt(0, 1)->setContentAlignment(AlignRight); if(pHelp) { pHelp->setStyleClass("hand"); WObject::connect(pHelp, SIGNAL(clicked()), this, SLOT(ShowHideHelp())); } } } elementAt(nRow, 0)->setStyleClass("padding_top"); }
void CSVSortList::createContent() { int nRow = numRows(); WTable * pTable = new WTable(elementAt(nRow,0)); if(pTable) { pTable->setCellPadding(0); pTable->setCellSpaceing(0); WScrollArea * pScrollArea = new WScrollArea(elementAt(nRow,0)); if(pScrollArea) { pScrollArea->setStyleClass("t5"); pScrollArea->setWidget(pTable); } pTable->setStyleClass("t5"); elementAt(nRow, 0)->setStyleClass("t7"); nRow = pTable->numRows(); m_pContent = new WTable(pTable->elementAt(nRow,0)); pTable->elementAt(nRow,0)->setContentAlignment(AlignTop); } if(m_pContent) { m_pContent->setStyleClass("t3"); nRow = m_pContent->numRows(); new WText(SVResString::getResString("IDS_Name"), m_pContent->elementAt(nRow, 0)); new WText(SVResString::getResString("IDS_Sort"), m_pContent->elementAt(nRow, 1)); m_pContent->GetRow(0)->setStyleClass("t3title"); } }
void BasePage::printTop10( const Dbo::collection<Dbo::ptr<Book> >& top10){ //setContentText("top10"); // # creating table WTable *table = new WTable(); table->setHeaderCount(1); table->setStyleClass("tablestyle"); table->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>")); table->elementAt(0, 1)->addWidget(new WText("<p align='left'> Title of book </p>")); table->elementAt(0, 2)->addWidget(new WText("<p align='left'> Author </p>")); table->elementAt(0, 3)->addWidget(new WText("<p align='left'> Genre </p>")); table->elementAt(0, 4)->addWidget(new WText("<p align='left'> Mark </p>")); _pagecontent->addWidget(table); int row=1; for (Dbo::collection<Dbo::ptr<Book> >::const_iterator i = top10.begin(); i != top10.end(); ++i){ Dbo::ptr<Book> Book = *i; table->setStyleClass("tablestyle th,td,tr"); //headers table->elementAt(row, 0) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(row))); //titles table->elementAt(row, 1) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(Book.get()->title))); //authors table->elementAt(row, 2) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((Book.get()->author.get()->name)))); //genres table->elementAt(row, 3) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((Book.get()->genre.get()->genre)))); //marks table->elementAt(row, 4) ->addWidget(new WText(WString::fromUTF8("{1}") .arg((Book.get()->mark)))); _pagecontent->addWidget(table); row++; } }
void BasePage::printGenres(const Dbo::collection<Dbo::ptr<Genre> >& listgenres){ WTable *genreTable = new WTable(); genreTable->setHeaderCount(1); genreTable->setStyleClass("tablestyle"); genreTable->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>")); genreTable->elementAt(0, 1)->addWidget(new WText("<p align='left'> Types og genres </p>")); _pagecontent->addWidget(genreTable); int row=1; for (Dbo::collection<Dbo::ptr<Genre> >::const_iterator i = listgenres.begin(); i != listgenres.end(); ++i){ Dbo::ptr<Genre> Genre = *i; genreTable->setStyleClass("tablestyle th,td,tr"); //headers genreTable->elementAt(row, 0) ->addWidget(new WText(WString::fromUTF8("{1}") .arg(row))); //genre genreTable->elementAt(row, 1) ->addWidget(new WText(WString::fromUTF8(Genre.get()->genre))); _pagecontent->addWidget(genreTable); row++; } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 创建视图控制 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void CEccGenTitle::createViewControl() { int nRow = numRows(); WTable *pSub = new WTable(elementAt(nRow, 0)); if(pSub) { pSub->setStyleClass("widthauto"); m_pList = new WImage("../Images/treeview_list.png", pSub->elementAt(0, 0)); pSub->elementAt(0, 0)->setStyleClass("padding_2"); m_pIcon = new WImage("../Images/treeview_graph.png", pSub->elementAt(0, 1)); pSub->elementAt(0, 1)->setStyleClass("padding_bom"); } }
void WSVFlexTable::AppendEntityDesRow(string strLabel, string strDes) { int iLast = GetContentTable()->numRows(); //名称 描述 iLast++; GetContentTable()->elementAt(iLast, 0)->setStyleClass("padding_top"); WTable * pTable = new WTable(GetContentTable()->elementAt(iLast, 0)); pTable->setStyleClass("table_data_input_rows"); pTable->elementAt(0, 0)->setStyleClass("table_data_input_text"); strcpy(pTable->elementAt(0, 0)->contextmenu_,"nowrap"); strcpy(pTable->elementAt(0, 1)->contextmenu_,"nowrap"); new WText(strLabel, pTable->elementAt(0, 0)); new WText(strDes, pTable->elementAt(0, 1)); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 创建内容表 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void CEccBaseTable::createContent() { m_nContentRow = numRows(); WTable *pSub = new WTable(elementAt(m_nContentRow, 0)); if(pSub) { pSub->setStyleClass("panel"); WScrollArea *pScroll = new WScrollArea(elementAt(m_nContentRow, 0)); if(pScroll) { pScroll->setWidget(pSub); pScroll->setStyleClass("panel"); } m_pContent = new WTable(pSub->elementAt(0, 0)); pSub->elementAt(0, 0)->setContentAlignment(AlignTop); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 创建添加按钮 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void SVConditionParam::createAddButton(int nRow) { WTable *pSub = new WTable(m_pOperate->elementAt(nRow, 1)); if(pSub) { pSub->setStyleClass("widthauto"); new WText(SVResString::getResString("IDS_Condition"), m_pOperate->elementAt(nRow, 0)); m_pReturnList = new WComboBox(pSub->elementAt(0, 0)); if(m_pReturnList) { m_pReturnList->setStyleClass("cell_condition"); list<SVReturnItem*>::iterator lsItem; for(lsItem = m_lsReturn.begin(); lsItem != m_lsReturn.end(); lsItem++) m_pReturnList->addItem((*lsItem)->getLabel()); } new WText(" ", pSub->elementAt(0, 1)); m_pOperateList = new WComboBox(pSub->elementAt(0, 2)); if(m_pOperateList) { m_pOperateList->setStyleClass("cell_condition"); list<string>::iterator lsItem; for(lsItem = m_lsCondition.begin(); lsItem != m_lsCondition.end(); lsItem++) m_pOperateList->addItem((*lsItem)); } new WText(" ", pSub->elementAt(0, 3)); m_pParam = new WLineEdit("", pSub->elementAt(0, 4)); if(m_pParam) m_pParam->setStyleClass("cell_condition"); new WText(" ", pSub->elementAt(0, 5)); CEccButton * pAdd = new CEccButton(SVResString::getResString("IDS_Add"), SVResString::getResString("IDS_Add_Title"), "", pSub->elementAt(0, 6)); if(pAdd) { WObject::connect(pAdd, SIGNAL(clicked()), this, SLOT(addCondition())); } } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 初始化 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void CEccAddMonitor1st::initForm(bool bHasHelp) { // 创建标题 CEccBaseTable::createTitle(bHasHelp); // 设置标题文本 if(m_pTitle) m_pTitle->setText(SVResString::getResString("IDS_Add_Monitor")); // 得当当前行数 int nRow = numRows(); // 创建子组并设置TD的样式表 WTable *pSub = new WTable(elementAt(nRow, 0)); elementAt(nRow, 0)->setStyleClass("height95p"); if(pSub) { //设置样式表 pSub->setStyleClass("panel"); // 创建新的滚动区 WScrollArea *pScroll = new WScrollArea(elementAt(nRow, 0)); if(pScroll) { pScroll->setWidget(pSub); pScroll->setStyleClass("panel"); } // 创建 表 CEccListTable *pSubList = new CEccListTable(pSub->elementAt(0, 0), false, false, false, false); if(pSubList) { // 设置标题 pSubList->setTitle(SVResString::getResString("IDS_Add_Monitor_Title")); // 得到内容表 m_pContent = pSubList->getListTable(); } pSub->elementAt(0, 0)->setContentAlignment(AlignTop); } createOperate(); }
void CSVWholeview::NewInitForm() { int pRow = numRows(); //elementAt(pRow, 0)->resize(WLength(90, WLength::Percentage), 0); elementAt(pRow, 0)->setContentAlignment(AlignCenter); WTable *pSub = new WTable(elementAt(pRow, 0)); if(pSub) { //elementAt(pRow, 0)->setStyleClass("padding_top"); pSub->setStyleClass("padding_top"); //pSub->setStyleClass("padding_2"); pSub->resize(WLength(96, WLength::Percentage), 0); WText *pTitle = new WText(m_szTitle, pSub->elementAt(0, 0)); pSub->elementAt(0, 0)->setStyleClass("textbold1"); m_pTime = new WText("local time", pSub->elementAt(0, 1)); pSub->elementAt(0, 1)->setContentAlignment(AlignRight | AlignTop); //m_pMainTable = new WSVMainTable(elementAt(pRow, 0), m_szTitle, false); //m_pTime = new WText("local time", m_pMainTable->GetContentTable()->elementAt(0, 0)); //m_pMainTable->elementAt(0, 1)->setContentAlignment(AlignRight | AlignTop); svutil::TTime ttime = svutil::TTime::GetCurrentTimeEx(); string curTime = ttime.Format(); if(m_pTime) { m_pTime->setText(m_szRefreshTime + curTime); } } pRow = numRows(); m_pMainTable = new WSVMainTable(elementAt(pRow, 0), "", false); m_pFlexTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(1, 0), EntityDes, ""); m_pContent = new WTable(m_pFlexTable->GetContentTable()->elementAt(1, 0)); m_pContent->setStyleClass("widthauto"); }
void SVSEView::createTitle() { int nRow = numRows(); WTable *pSub = new WTable(elementAt(nRow, 0)); elementAt(nRow, 0)->setStyleClass("t1title"); if(pSub) { pSub->setStyleClass("t3"); nRow = pSub->numRows(); WText *pTitle = new WText(SVResString::getResString("IDS_SE_List_Title"), (WContainerWidget*)pSub->elementAt(nRow, 0)); if(pTitle) pTitle->setStyleClass("tgrouptitle2"); pSub->elementAt(nRow, 0)->setStyleClass("cell_80"); m_pTime = new WText("local time", pSub->elementAt(nRow, 1)); pSub->elementAt(nRow, 1)->setContentAlignment(AlignRight | AlignCenter); svutil::TTime ttime = svutil::TTime::GetCurrentTimeEx(); string curTime = ttime.Format(); if(m_pTime) { m_pTime->setStyleClass("tgrouptitle2"); m_pTime->setText(SVResString::getResString("IDS_Refresh_Time") + curTime); } } }
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> "; 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(); } }
void CmsSubscribers::Impl::FillDataTable(const CmsSubscribers::Impl::Table &tableType) { try { SubscribersTableContainer->clear(); WTable *table = new WTable(SubscribersTableContainer); table->setStyleClass("table table-striped table-hover"); table->setHeaderCount(1, Orientation::Horizontal); table->elementAt(0, 0)->addWidget(new WText(tr("cms-subscribers-no"))); table->elementAt(0, 1)->addWidget(new WText(tr("cms-subscribers-inbox"))); table->elementAt(0, 2)->addWidget(new WText(tr("cms-subscribers-subscription"))); table->elementAt(0, 3)->addWidget(new WText(tr("cms-subscribers-pending-confirm"))); table->elementAt(0, 4)->addWidget(new WText(tr("cms-subscribers-pending-cancel"))); table->elementAt(0, 5)->addWidget(new WText(tr("cms-subscribers-join-date"))); table->elementAt(0, 6)->addWidget(new WText(tr("cms-subscribers-update-date"))); table->elementAt(0, 7)->addWidget(new WText(tr("cms-subscribers-uuid"))); result r; switch (tableType) { case Table::All: r = Pool::Database()->Sql() << (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date" " FROM \"%1%\" ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;") % Pool::Database()->GetTableName("SUBSCRIBERS")).str(); break; case Table::EnFa: r = Pool::Database()->Sql() << (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date" " FROM \"%1%\" WHERE subscription = 'en_fa' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;") % Pool::Database()->GetTableName("SUBSCRIBERS")).str(); break; case Table::En: r = Pool::Database()->Sql() << (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date" " FROM \"%1%\" WHERE subscription = 'en' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;") % Pool::Database()->GetTableName("SUBSCRIBERS")).str(); break; case Table::Fa: r = Pool::Database()->Sql() << (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date" " FROM \"%1%\" WHERE subscription = 'fa' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;") % Pool::Database()->GetTableName("SUBSCRIBERS")).str(); break; case Table::Inactive: r = Pool::Database()->Sql() << (format("SELECT inbox, uuid, subscription, pending_confirm, pending_cancel, join_date, update_date" " FROM \"%1%\" WHERE subscription = 'none' ORDER BY inbox COLLATE \"en_US.UTF-8\" ASC;") % Pool::Database()->GetTableName("SUBSCRIBERS")).str(); break; } int i = 0; while(r.next()) { ++i; string inbox; string uuid; string subscription; string pending_confirm; string pending_cancel; string join_date; string update_date; r >> inbox >> uuid >> subscription >> pending_confirm >> pending_cancel >> join_date >> update_date; WString subscriptionTypeName; WString pendingConfirmTypeName; WString pendingCancelTypeName; this->GetSubscriptionTypeName(subscription, subscriptionTypeName); this->GetSubscriptionTypeName(pending_confirm, pendingConfirmTypeName); this->GetSubscriptionTypeName(pending_cancel, pendingCancelTypeName); WString joinDate; WString updateDate; this->GetDate(join_date, joinDate); this->GetDate(join_date, updateDate); table->elementAt(i, 0)->addWidget(new WText(WString::fromUTF8(lexical_cast<string>(i)))); table->elementAt(i, 1)->addWidget(new WText(WString::fromUTF8(inbox))); table->elementAt(i, 2)->addWidget(new WText(subscriptionTypeName)); table->elementAt(i, 3)->addWidget(new WText(pendingConfirmTypeName)); table->elementAt(i, 4)->addWidget(new WText(pendingCancelTypeName)); table->elementAt(i, 5)->addWidget(new WText(joinDate)); table->elementAt(i, 6)->addWidget(new WText(updateDate)); table->elementAt(i, 7)->addWidget(new WText(WString::fromUTF8(uuid))); } } catch (boost::exception &ex) { LOG_ERROR(boost::diagnostic_information(ex)); } catch (std::exception &ex) { LOG_ERROR(ex.what()); } catch (...) { LOG_ERROR(UNKNOWN_ERROR); } }
WContainerWidget * WSVFlexTable::AppendRowsContent(int nRow, int nColumn, int nColumnCount, string strLabel, string strDes, string strError,bool noBlank) { //取出指定栏目的Table WTable * pRowTable = NULL; WContainerWidget * pParentCell = NULL; // if(nRow > m_pListRowTable.size()) { for (unsigned i = nRow; i > m_pListRowTable.size() ; --i) { AppendRows(""); //此情况应该无效或不会出现, 暂时先这样处理 } } else { // } //(nColumn * 2) //nColumnCount == 2 则为 50% pRowTable = m_pListRowTable[nRow]; pRowTable->setStyleClass("table_data_input_rows"); //标题 WText if(noBlank) strLabel += "<font color=red>*</font>"; new WText(strLabel, pRowTable->elementAt(nRow, (nColumn * 2))); strcpy(pRowTable->elementAt(nRow, (nColumn * 2))->contextmenu_,"nowrap"); pRowTable->elementAt(nRow, (nColumn * 2))->setStyleClass("table_data_input_text"); //输入控件 pParentCell = pRowTable->elementAt(nRow, (nColumn * 2) + 1); //pRowTable->elementAt(nRow, (nColumn * 2) + 1)->setStyleClass("table_data_input_text"); strcpy(pRowTable->elementAt(nRow, (nColumn * 2) + 1)->contextmenu_,"nowrap"); //帮助 WText if(strDes != "") { m_pListHelpText.push_back(new WText(strDes, pRowTable->elementAt(nRow + 1, (nColumn * 2) + 1))); if(nColumnCount == 2) pRowTable->elementAt(nRow + 1, (nColumn * 2) + 1)->resize(WLength(50,WLength::Percentage), WLength()); //strcpy(pRowTable->elementAt(nRow + 1, (nColumn * 2) + 1)->contextmenu_,"nowrap"); pRowTable->elementAt(nRow + 1, (nColumn * 2) + 1)->setStyleClass("table_data_input_des"); } //错误信息 WText if(strError != "") { m_pListErrorText.push_back(new WText(strError, pRowTable->elementAt(nRow + 2, (nColumn * 2) + 1))); if(nColumnCount == 2) pRowTable->elementAt(nRow + 2, (nColumn * 2) + 1)->resize(WLength(50,WLength::Percentage), WLength()); //strcpy(pRowTable->elementAt(nRow + 2, (nColumn * 2) + 1)->contextmenu_,"nowrap"); pRowTable->elementAt(nRow + 2, (nColumn * 2) + 1)->setStyleClass("table_data_input_error"); } return pParentCell; }
void CSVAddPlan::showMainForm() { string szMon,szThurs,szWed,szTues,szFri,szSat,szSun,szDisable,szEnable,szfrom,szTo,szAddRelPlanBut; //Resource OBJECT objRes=LoadResource("default", "localhost"); if( objRes !=INVALID_VALUE ) { MAPNODE ResNode=GetResourceNode(objRes); if( ResNode != INVALID_VALUE ) { FindNodeValue(ResNode,"IDS_Time_Area_Task_Add",szAddRelPlanBut); FindNodeValue(ResNode,"IDS_Disable",szDisable); FindNodeValue(ResNode,"IDS_Enable",szEnable); FindNodeValue(ResNode,"IDS_Monday",szMon); FindNodeValue(ResNode,"IDS_Tuesday",szThurs); FindNodeValue(ResNode,"IDS_Wednesday",szWed); FindNodeValue(ResNode,"IDS_Thursday",szTues); FindNodeValue(ResNode,"IDS_Friday",szFri); FindNodeValue(ResNode,"IDS_Saturday",szSat); FindNodeValue(ResNode,"IDS_Sunday",szSun); FindNodeValue(ResNode,"IDS_From",szfrom); FindNodeValue(ResNode,"IDS_To",szTo); } CloseResource(objRes); } new WText("<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", this); new WText("<div id='view_panel' class='panel_view'>", this); OutputDebugString("----------------strUser----------------\n"); pMainTable = new WSVMainTable(this, szTitle, true); if(pMainTable->pHelpImg) { connect(pMainTable->pHelpImg, SIGNAL(clicked()),this,SLOT(AddPlanHelp())); } AddRangeTable = new WSVFlexTable((WContainerWidget *)pMainTable->GetContentTable()->elementAt(1,0), Group, m_FormShowText.szAddReTitle); if (AddRangeTable->GetContentTable() != NULL) { AddRangeTable->AppendRows(m_FormShowText.szBasicAdd); m_pName = new WLineEdit("", AddRangeTable->AppendRowsContent(0, m_FormShowText.szRunName+"<span class =required>*</span>", m_FormShowText.szRunNameHelp, m_FormShowText.szErrorMsg)); //m_pName -> setTextSize(50); m_pName->resize(WLength(300, WLength::Pixel),WLength(20, WLength::Pixel)); m_pName->setStyleClass("input_text"); new WText("", AddRangeTable->AppendRowsContent(0, "", "", m_FormShowText.szErrorMsg1)); m_pTasklist = new CTaskList(NULL, AddRangeTable,m_FormShowText.strWeekHelp); /* m_pCombo[0] = new WComboBox(RecList->elementAt(0, 1)); m_pCombo[0]->addItem(szEnable); m_pCombo[0]->addItem(szDisable); pFrom[0] = new WText(szfrom, RecList->elementAt(0, 2)); m_pStart[0] = new WLineEdit("00:00", RecList->elementAt(0, 3)); m_pStart[0]->setStyleClass("input_text"); pTo[0] = new WText(szTo, RecList->elementAt(0, 4)); m_pEnd[0] = new WLineEdit("23:59", RecList->elementAt(0, 5)); m_pEnd[0]->setStyleClass("input_text"); for (int i=1; i<7; i++) { WTable *RecList = new WTable(AddRangeTable->AppendRowsContent(0, DayType[i], "", "")); RecList->setStyleClass("widthauto"); m_pCombo[i] = new WComboBox(RecList->elementAt(0, 1)); m_pCombo[i]->addItem(szEnable); m_pCombo[i]->addItem(szDisable); pFrom[i] = new WText(szfrom, RecList->elementAt(0, 2)); m_pStart[i] = new WLineEdit("00:00", RecList->elementAt(0, 3)); m_pStart[i]->setStyleClass("input_text"); pTo[i] = new WText(szTo, RecList->elementAt(0, 4)); m_pEnd[i] = new WLineEdit("23:59", RecList->elementAt(0, 5)); m_pEnd[i]->setStyleClass("input_text"); } */ AddRangeTable->AppendRows(m_FormShowText.szAdvanceAdd); textarea = new WTextArea("", AddRangeTable->AppendRowsContent(1, m_FormShowText.szDescript, "", "")); textarea->resize(WLength(400, WLength::Pixel),WLength(100, WLength::Pixel)); textarea->setStyleClass("input_text"); AddRangeTable->ShowOrHideHelp(); AddRangeTable->HideAllErrorMsg(); } if (AddRangeTable->GetActionTable() != NULL) { WTable *pGroupOperate = new WTable(AddRangeTable->GetActionTable()->elementAt(0, 1)); pGroupOperate->setStyleClass("widthauto"); WSVButton * pSave = new WSVButton(pGroupOperate->elementAt(0,0),m_FormShowText.szSaveBut,"button_bg_m_black.png",m_FormShowText.szSaveBut,true); WObject::connect(pSave, SIGNAL(clicked()), this, SLOT(Save())); //pGroupOperate->elementAt(0,0)-> addWidget(pSave); WSVButton * pCancel = new WSVButton(pGroupOperate->elementAt(0,1),m_FormShowText.szCancelBut,"button_bg_m.png",m_FormShowText.szCancelBut,false); WObject::connect(pCancel, SIGNAL(clicked()), this, SLOT(Cancel())); //pGroupOperate->elementAt(0,0)-> addWidget(pCancel); //pGroupOperate->elementAt(0,0)->setContentAlignment(AlignCenter); } //new WText("</div>"); //Jansion.zhou 2006-12-25 // WTable * TitleTable = new WTable(this); //TitleTable->setStyleClass("t3"); //m_pErrMsg = new WText("", (WContainerWidget *)TitleTable->elementAt(0,0)); // m_pErrMsg->decorationStyle().setForegroundColor(Wt::red); // m_pErrMsg->hide(); //Jansion.zhou 2006-12-25 ////connect svdb failure WText //m_pConnErr = new WText("", (WContainerWidget *)TitleTable->elementAt(0, 0)); //m_pConnErr->decorationStyle().setForegroundColor(Wt::red); //m_pConnErr ->hide(); new WText("</div>", this); AddJsParam("uistyle", "viewpan"); AddJsParam("fullstyle", "true"); AddJsParam("bGeneral", "false"); new WText("<SCRIPT language='JavaScript' src='/Script.js'></SCRIPT>", this); }
void CSVPlanSet::InitFlexTable(std::string strTitle1, std::string strTitle2) { ReceiveAddrSetTable = new WSVFlexTable(pMainTable->GetContentTable()->elementAt(1,0), List, strTitle1); //new WText("\n<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", this); //WTable * m_pGeneral4 = new WTable(this); //WTable * m_pGeneral = new WTable( this ); //m_pGeneral ->setStyleClass("t2"); //if ( m_pGeneral ) ReceiveAddrSetTable->SetDivId("listpan1"); if(ReceiveAddrSetTable->GetContentTable()!=NULL) { strListHeights += "200"; strListHeights += ","; strListPans += ReceiveAddrSetTable->GetDivId(); strListPans += ","; strListTitles += ReceiveAddrSetTable->dataTitleTable->formName(); strListTitles += ","; ReceiveAddrSetTable->AppendColumn("", WLength(5, WLength::Percentage)); ReceiveAddrSetTable->SetDataRowStyle("table_data_grid_item_img"); ReceiveAddrSetTable->AppendColumn(m_FormShowText.szColName, WLength(70, WLength::Percentage)); ReceiveAddrSetTable->SetDataRowStyle("table_data_grid_item_img"); ReceiveAddrSetTable->AppendColumn(m_FormShowText.szColMod, WLength(25, WLength::Percentage)); ReceiveAddrSetTable->SetDataRowStyle("table_data_grid_item_text"); //older list table header // // 列表 // ContainerReceiveAddrSetTable = new WTable((WContainerWidget *) m_pGeneral->elementAt(1,0)); // ContainerReceiveAddrSetTable -> setStyleClass("t3"); // ReceiveAddrSetTable = new WTable((WContainerWidget *) ContainerReceiveAddrSetTable->elementAt(0,0)); // nullTable = new WTable((WContainerWidget *) ContainerReceiveAddrSetTable->elementAt(1, 0)); // // ReceiveAddrSetTable->setStyleClass("t3"); // ReceiveAddrSetTable->setCellPadding(0); // ReceiveAddrSetTable->setCellSpaceing(0); // nullTable -> setStyleClass("t8"); // // // 添加表头 // // 全选 clicked 事件处理 函数 SelAll //// new WText(m_FormShowText.szColStatus, (WContainerWidget*)ReceiveAddrSetTable->elementAt(0, 0)); // new WText("", (WContainerWidget*)ReceiveAddrSetTable->elementAt(0, 0)); // new WText(m_FormShowText.szColName, (WContainerWidget*)ReceiveAddrSetTable->elementAt(0, 1)); //// new WText(m_FormShowText.szColType, (WContainerWidget*)ReceiveAddrSetTable->elementAt(0, 2)); // new WText(m_FormShowText.szColMod, (WContainerWidget*)ReceiveAddrSetTable->elementAt(0, 2)); // ReceiveAddrSetTable->elementAt(0, 0)->setStyleClass("t3title"); // ReceiveAddrSetTable->elementAt(0, 1)->setStyleClass("t3title"); // ReceiveAddrSetTable->elementAt(0, 2)->setStyleClass("t3title"); // ReceiveAddrSetTable->elementAt(0, 3)->setStyleClass("t3title"); updateRangeSchedule(); } if(ReceiveAddrSetTable->GetActionTable()!=NULL) { ReceiveAddrSetTable->AddStandardSelLink(m_FormShowText.szTipSelAll , m_FormShowText.szTipNotSelAll, m_FormShowText.szTipInvSel ); WObject::connect(ReceiveAddrSetTable->pSelAll, SIGNAL(clicked()), this, SLOT(SelAll())); WObject::connect(ReceiveAddrSetTable->pSelNone, SIGNAL(clicked()), this, SLOT(SelNone())); WObject::connect(ReceiveAddrSetTable->pSelReverse, SIGNAL(clicked()), this, SLOT(SelInvert())); WTable *pTbl; ReceiveAddrSetTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter); ReceiveAddrSetTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold"); pTbl = new WTable(ReceiveAddrSetTable->GetActionTable()->elementAt(0,1)); pTbl->setStyleClass("widthauto"); WSVButton * DelBtn = new WSVButton(pTbl->elementAt(0,0),m_FormShowText.szTipDel,"button_bg_del.png",m_FormShowText.szTipDel, false); connect(DelBtn, SIGNAL(clicked()) ,this, SLOT(BeforeDelPlan())); pTbl = new WTable(ReceiveAddrSetTable->GetActionTable()->elementAt(0,2)); ReceiveAddrSetTable->GetActionTable()->elementAt(0,2)->setContentAlignment(AlignRight); WSVButton * btn = new WSVButton(ReceiveAddrSetTable->GetActionTable()->elementAt(0,2),m_FormShowText.szAddRelPlanBut,"button_bg_add_black.png",m_FormShowText.szAddRelPlanBut, true); connect(btn, SIGNAL(clicked()), this, SLOT(AddPlan())); // //ft = new CFlexTable(); //ft->AddGroupOperate(m_pGeneral,m_FormShowText.szValDel); //ft->AddGroupAddBtn(m_pGeneral,m_FormShowText.szAddRelPlanBut); //WObject::connect(ft->pSelAll, SIGNAL(clicked()), this, SLOT(SelAll())); //WObject::connect(ft->pSelNone, SIGNAL(clicked()), this, SLOT(SelNone())); //WObject::connect(ft->pSelinvert, SIGNAL(clicked()), this, SLOT(SelInvert())); // WObject::connect(ft->pDel , SIGNAL(clicked()) ,this, SLOT(BeforeDelPlan())); //WObject::connect(ft->pAdd, SIGNAL(clicked()), this, SLOT(AddPlan())); connect(&m_signalMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditPlan(const std::string))); //ReceiveAddrSetTable->SetNullTipInfo(strSepPlanNull); ReceiveAddrSetTable->SetNullTipInfo(strSepPlanNull); if(m_pListPlan.size() <= 0) { //OutputDebugString("---------------- NO S ------------------\n"); //OutputDebugString(("---------------- NO S"+ strSepPlanNull + " ------------------\n").c_str()); ReceiveAddrSetTable->ShowNullTip(); } else { //OutputDebugString("---------------- Yes S------------------\n"); ReceiveAddrSetTable->HideNullTip(); } //隐藏按钮 pHideBut = new WPushButton("hide button",this); if(pHideBut) { pHideBut->setToolTip("Hide Button"); connect(pHideBut,SIGNAL(clicked()),this,SLOT(DelPlan())); pHideBut->hide(); } //隐藏按钮 pHideBut1 = new WPushButton("hide button",this); if(pHideBut1) { pHideBut1->setToolTip("Hide Button"); connect(pHideBut1,SIGNAL(clicked()),this,SLOT(DelPlan1())); pHideBut1->hide(); } }
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 SysMon::Impl::RefreshResourceUsage() { sg_cpu_percents *cpuPercents; sg_mem_stats *memStats; sg_swap_stats *swapStats; sg_host_info *hostInfo; sg_disk_io_stats *diskIoStats; sg_network_io_stats *networkIoStats; std::size_t cpuPercentsEntries = 0; std::size_t memStatsEntries = 0; std::size_t swapStatsEntries = 0; std::size_t hostInfoEntries = 0; std::size_t diskIoStatsEntries = 0; std::size_t networkIoStatsEntries = 0; /// Get the host info if ((hostInfo = sg_get_host_info(&hostInfoEntries)) != NULL) { HostInfoDiv->clear(); WTable *hostTable = new WTable(HostInfoDiv); hostTable->setStyleClass("table table-hover"); hostTable->setHeaderCount(1, Orientation::Horizontal); hostTable->elementAt(0, 0)->addWidget(new WText(tr("system-monitor-host-info-os-name"))); hostTable->elementAt(0, 1)->addWidget(new WText(tr("system-monitor-host-info-os-release"))); hostTable->elementAt(0, 2)->addWidget(new WText(tr("system-monitor-host-info-os-version"))); hostTable->elementAt(0, 3)->addWidget(new WText(tr("system-monitor-host-info-platform"))); hostTable->elementAt(0, 4)->addWidget(new WText(tr("system-monitor-host-info-hostname"))); hostTable->elementAt(0, 5)->addWidget(new WText(tr("system-monitor-host-info-bitwidth"))); hostTable->elementAt(0, 6)->addWidget(new WText(tr("system-monitor-host-info-host-state"))); hostTable->elementAt(0, 7)->addWidget(new WText(tr("system-monitor-host-info-ncpus"))); hostTable->elementAt(0, 8)->addWidget(new WText(tr("system-monitor-host-info-maxcpus"))); hostTable->elementAt(0, 9)->addWidget(new WText(tr("system-monitor-host-info-uptime"))); hostTable->elementAt(0, 10)->addWidget(new WText(tr("system-monitor-host-info-systime"))); hostTable->elementAt(1, 0)->addWidget(new WText(WString(hostInfo->os_name))); hostTable->elementAt(1, 1)->addWidget(new WText(WString(hostInfo->os_release))); hostTable->elementAt(1, 2)->addWidget(new WText(WString(hostInfo->os_version))); hostTable->elementAt(1, 3)->addWidget(new WText(WString(hostInfo->platform))); hostTable->elementAt(1, 4)->addWidget(new WText(WString(hostInfo->hostname))); hostTable->elementAt(1, 5)->addWidget(new WText(lexical_cast<string>(hostInfo->bitwidth))); hostTable->elementAt(1, 6)->addWidget(new WText(lexical_cast<string>(HostState[hostInfo->host_state]))); hostTable->elementAt(1, 7)->addWidget(new WText(lexical_cast<string>(hostInfo->ncpus))); hostTable->elementAt(1, 8)->addWidget(new WText(lexical_cast<string>(hostInfo->maxcpus))); hostTable->elementAt(1, 9)->addWidget(new WText(lexical_cast<string>(hostInfo->uptime))); hostTable->elementAt(1, 10)->addWidget(new WText(lexical_cast<string>(hostInfo->systime))); } /// Shift and fill the CPU usage cache and model if ((cpuPercents = sg_get_cpu_percents(&cpuPercentsEntries)) != NULL) { CpuInstant cpuInstant; cpuInstant[Cpu::User] = cpuPercents->user; cpuInstant[Cpu::Kernel] = cpuPercents->kernel; cpuInstant[Cpu::Idle] = cpuPercents->idle; cpuInstant[Cpu::IoWait] = cpuPercents->iowait; cpuInstant[Cpu::Swap] = cpuPercents->swap; cpuInstant[Cpu::Nice] = cpuPercents->nice; CpuUsageCache.push_back(cpuInstant); CpuUsageCache.pop_front(); int i = 0; for (std::list<CpuInstant>::const_iterator it = CpuUsageCache.begin(); it != CpuUsageCache.end(); ++it) { cpuInstant = *it; CpuUsageModel->setData(i, 0, cpuInstant[Cpu::User]); CpuUsageModel->setData(i, 1, cpuInstant[Cpu::Kernel]); CpuUsageModel->setData(i, 2, cpuInstant[Cpu::Idle]); CpuUsageModel->setData(i, 3, cpuInstant[Cpu::IoWait]); CpuUsageModel->setData(i, 4, cpuInstant[Cpu::Swap]); CpuUsageModel->setData(i, 5, cpuInstant[Cpu::Nice]); CpuUsageModel->setData(i, 6, i); ++i; } } /// Shift and fill the memory usage cache and model if(((memStats = sg_get_mem_stats(&memStatsEntries)) != NULL)) { MemoryInstant memoryInstant; memoryInstant[Memory::Total] = 100.0; memoryInstant[Memory::Free] = 100.0 * memStats->free / memStats->total; memoryInstant[Memory::Used] = 100.0 * memStats->used / memStats->total; memoryInstant[Memory::Cache] = 100.0 * memStats->cache / memStats->total; MemoryUsageCache.push_back(memoryInstant); MemoryUsageCache.pop_front(); MemoryUsageModel->setHeaderData( 0, WString::fromUTF8("{1} {2}") .arg(Utility::CalculateSize(memStats->total)) .arg(tr("system-monitor-memory-stats-total"))); MemoryUsageModel->setHeaderData( 1, WString::fromUTF8("{1} ({2}%) {3}") .arg(Utility::CalculateSize(memStats->free)) .arg((wformat(L"%.1f") % memoryInstant[Memory::Free]).str()) .arg(tr("system-monitor-memory-stats-free")) ); MemoryUsageModel->setHeaderData( 2, WString::fromUTF8("{1} ({2}%) {3}") .arg((Utility::CalculateSize(memStats->used))) .arg((wformat(L"%.1f") % memoryInstant[Memory::Used]).str()) .arg(tr("system-monitor-memory-stats-used")) ); MemoryUsageModel->setHeaderData( 3, WString::fromUTF8("{1} ({2}%) {3}") .arg(Utility::CalculateSize(memStats->cache)) .arg((wformat(L"%.1f") % memoryInstant[Memory::Cache]).str()) .arg(tr("system-monitor-memory-stats-cache")) ); int i = 0; for (std::list<MemoryInstant>::const_iterator it = MemoryUsageCache.begin(); it != MemoryUsageCache.end(); ++it) { memoryInstant = *it; MemoryUsageModel->setData(i, 0, memoryInstant[Memory::Total]); MemoryUsageModel->setData(i, 1, memoryInstant[Memory::Free]); MemoryUsageModel->setData(i, 2, memoryInstant[Memory::Used]); MemoryUsageModel->setData(i, 3, memoryInstant[Memory::Cache]); MemoryUsageModel->setData(i, 4, i); ++i; } } /// Shift and fill the swap usage cache and model if(((swapStats = sg_get_swap_stats(&swapStatsEntries)) != NULL)) { SwapInstant swapInstant; swapInstant[Swap::Total] = 100.0; swapInstant[Swap::Used] = 100.0 * swapStats->used / swapStats->total; swapInstant[Swap::Free] = 100.0 * swapStats->free / swapStats->total; SwapUsageCache.push_back(swapInstant); SwapUsageCache.pop_front(); SwapUsageModel->setHeaderData( 0, WString::fromUTF8("{1} {2}") .arg(Utility::CalculateSize(swapStats->total)) .arg(tr("system-monitor-swap-stats-total"))); SwapUsageModel->setHeaderData( 1, WString::fromUTF8("{1} ({2}%) {3}") .arg((Utility::CalculateSize(swapStats->used))) .arg((wformat(L"%.1f") % (!isnan(swapInstant[Swap::Used]) ? swapInstant[Swap::Used] : 0.0)).str()) .arg(tr("system-monitor-swap-stats-used")) ); SwapUsageModel->setHeaderData( 2, WString::fromUTF8("{1} ({2}%) {3}") .arg(Utility::CalculateSize(swapStats->free)) .arg((wformat(L"%.1f") % (!isnan(swapInstant[Swap::Free]) ? swapInstant[Swap::Free] : 0.0)).str()) .arg(tr("system-monitor-swap-stats-free")) ); int i = 0; for (std::list<SwapInstant>::const_iterator it = SwapUsageCache.begin(); it != SwapUsageCache.end(); ++it) { swapInstant = *it; SwapUsageModel->setData(i, 0, swapInstant[Swap::Total]); SwapUsageModel->setData(i, 1, swapInstant[Swap::Used]); SwapUsageModel->setData(i, 2, swapInstant[Swap::Free]); SwapUsageModel->setData(i, 3, i); ++i; } } /// Shift and fill the virtual memory usage cache and model if (memStatsEntries > 0 && swapStatsEntries > 0) { unsigned long long total; unsigned long long used; unsigned long long free; if (!isnan(100.0 * swapStats->total / swapStats->total)) total = memStats->total + swapStats->total; else total = memStats->total; if (!isnan(100.0 * swapStats->used / swapStats->total)) used = memStats->used + swapStats->used; else used = memStats->used; if (!isnan(100.0 * swapStats->free / swapStats->total)) free = memStats->free + swapStats->free; else free = memStats->free; VirtualMemoryInstant virtualMemoryInstant; virtualMemoryInstant[VirtualMemory::Total] = 100.0; virtualMemoryInstant[VirtualMemory::Used] = 100.0 * used / total; virtualMemoryInstant[VirtualMemory::Free] = 100.0 * free / total; VirtualMemoryUsageCache.push_back(virtualMemoryInstant); VirtualMemoryUsageCache.pop_front(); VirtualMemoryUsageModel->setHeaderData( 0, WString::fromUTF8("{1} {2}") .arg(Utility::CalculateSize(total)) .arg(tr("system-monitor-virtual-memory-stats-total"))); VirtualMemoryUsageModel->setHeaderData( 1, WString::fromUTF8("{1} ({2}%) {3}") .arg((Utility::CalculateSize(used))) .arg((wformat(L"%.1f") % virtualMemoryInstant[VirtualMemory::Used]).str()) .arg(tr("system-monitor-virtual-memory-stats-used")) ); VirtualMemoryUsageModel->setHeaderData( 2, WString::fromUTF8("{1} ({2}%) {3}") .arg(Utility::CalculateSize(free)) .arg((wformat(L"%.1f") % virtualMemoryInstant[VirtualMemory::Free]).str()) .arg(tr("system-monitor-virtual-memory-stats-free")) ); int i = 0; for (std::list<VirtualMemoryInstant>::const_iterator it = VirtualMemoryUsageCache.begin(); it != VirtualMemoryUsageCache.end(); ++it) { virtualMemoryInstant = *it; VirtualMemoryUsageModel->setData(i, 0, virtualMemoryInstant[VirtualMemory::Total]); VirtualMemoryUsageModel->setData(i, 1, virtualMemoryInstant[VirtualMemory::Used]); VirtualMemoryUsageModel->setData(i, 2, virtualMemoryInstant[VirtualMemory::Free]); VirtualMemoryUsageModel->setData(i, 3, i); ++i; } } /// Get the disk info DiskInfoDiv->clear(); size_t diskTotalRead = 0; size_t diskTotalWrite = 0; WTable *diskTable = new WTable(DiskInfoDiv); diskTable->setStyleClass("table table-hover"); diskTable->setHeaderCount(1, Orientation::Horizontal); diskTable->elementAt(0, 0)->addWidget(new WText(tr("system-monitor-disk-io-stats-disk-name"))); diskTable->elementAt(0, 1)->addWidget(new WText(tr("system-monitor-disk-io-stats-read-bytes"))); diskTable->elementAt(0, 2)->addWidget(new WText(tr("system-monitor-disk-io-stats-write-bytes"))); diskTable->elementAt(0, 3)->addWidget(new WText(tr("system-monitor-disk-io-stats-systime"))); if ((diskIoStats = sg_get_disk_io_stats_diff(&diskIoStatsEntries)) != NULL) { for (size_t i = 0; i < diskIoStatsEntries; ++i) { diskTable->elementAt((int)i + 1, 0)->addWidget(new WText(lexical_cast<string>(diskIoStats->disk_name))); diskTable->elementAt((int)i + 1, 1)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(diskIoStats->read_bytes)))); diskTable->elementAt((int)i + 1, 2)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(diskIoStats->write_bytes)))); diskTable->elementAt((int)i + 1, 3)->addWidget(new WText(lexical_cast<string>((long)diskIoStats->systime))); diskTotalRead += diskIoStats->read_bytes; diskTotalWrite += diskIoStats->write_bytes; ++diskIoStats; } diskTable->elementAt((int)diskIoStatsEntries + 1, 0)->addWidget(new WText(tr("system-monitor-disk-io-stats-total"))); diskTable->elementAt((int)diskIoStatsEntries + 1, 1)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(diskTotalRead)))); diskTable->elementAt((int)diskIoStatsEntries + 1, 2)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(diskTotalWrite)))); diskTable->elementAt((int)diskIoStatsEntries + 1, 3)->addWidget(new WText("-")); } /// Get the netowrk info NetworkInfoDiv->clear(); size_t networkTotalRx = 0; size_t networkTotalTx = 0; size_t networkTotalPacketsIn = 0; size_t networkTotalPacketsOut = 0; size_t networkTotalErrorsIn = 0; size_t networkTotalErrorsOut = 0; size_t networkTotalCollisions = 0; WTable *networkTable = new WTable(NetworkInfoDiv); networkTable->setStyleClass("table table-hover"); networkTable->setHeaderCount(1, Orientation::Horizontal); networkTable->elementAt(0, 0)->addWidget(new WText(tr("system-monitor-network-io-stats-interface_name"))); networkTable->elementAt(0, 1)->addWidget(new WText(tr("system-monitor-network-io-stats-tx"))); networkTable->elementAt(0, 2)->addWidget(new WText(tr("system-monitor-network-io-stats-rx"))); networkTable->elementAt(0, 3)->addWidget(new WText(tr("system-monitor-network-io-stats-ipackets"))); networkTable->elementAt(0, 4)->addWidget(new WText(tr("system-monitor-network-io-stats-opackets"))); networkTable->elementAt(0, 5)->addWidget(new WText(tr("system-monitor-network-io-stats-ierrors"))); networkTable->elementAt(0, 6)->addWidget(new WText(tr("system-monitor-network-io-stats-oerrors"))); networkTable->elementAt(0, 7)->addWidget(new WText(tr("system-monitor-network-io-stats-collisions"))); networkTable->elementAt(0, 8)->addWidget(new WText(tr("system-monitor-network-io-stats-systime"))); if ((networkIoStats = sg_get_network_io_stats_diff(&networkIoStatsEntries)) != NULL) { for (size_t i = 0; i < networkIoStatsEntries; ++i) { networkTable->elementAt((int)i + 1, 0)->addWidget(new WText(lexical_cast<string>(networkIoStats->interface_name))); networkTable->elementAt((int)i + 1, 1)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(networkIoStats->tx)))); networkTable->elementAt((int)i + 1, 2)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(networkIoStats->rx)))); networkTable->elementAt((int)i + 1, 3)->addWidget(new WText(lexical_cast<string>(networkIoStats->ipackets))); networkTable->elementAt((int)i + 1, 4)->addWidget(new WText(lexical_cast<string>(networkIoStats->opackets))); networkTable->elementAt((int)i + 1, 5)->addWidget(new WText(lexical_cast<string>(networkIoStats->ierrors))); networkTable->elementAt((int)i + 1, 6)->addWidget(new WText(lexical_cast<string>(networkIoStats->oerrors))); networkTable->elementAt((int)i + 1, 7)->addWidget(new WText(lexical_cast<string>(networkIoStats->collisions))); networkTable->elementAt((int)i + 1, 8)->addWidget(new WText(lexical_cast<string>((long)networkIoStats->systime))); networkTotalTx += networkIoStats->tx; networkTotalRx += networkIoStats->rx; networkTotalPacketsIn += networkIoStats->ipackets; networkTotalPacketsOut += networkIoStats->opackets; networkTotalErrorsIn += networkIoStats->ierrors; networkTotalErrorsOut += networkIoStats->oerrors; networkTotalCollisions += networkIoStats->collisions; new WBreak(NetworkInfoDiv); ++networkIoStats; } networkTable->elementAt((int)networkIoStatsEntries + 1, 0)->addWidget(new WText(tr("system-monitor-network-io-stats-total"))); networkTable->elementAt((int)networkIoStatsEntries + 1, 1)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(networkTotalTx)))); networkTable->elementAt((int)networkIoStatsEntries + 1, 2)->addWidget(new WText(WString(L"{1}") .arg(Utility::CalculateSize(networkTotalRx)))); networkTable->elementAt((int)networkIoStatsEntries + 1, 3)->addWidget(new WText(lexical_cast<string>(networkTotalPacketsIn))); networkTable->elementAt((int)networkIoStatsEntries + 1, 4)->addWidget(new WText(lexical_cast<string>(networkTotalPacketsOut))); networkTable->elementAt((int)networkIoStatsEntries + 1, 5)->addWidget(new WText(lexical_cast<string>(networkTotalErrorsIn))); networkTable->elementAt((int)networkIoStatsEntries + 1, 6)->addWidget(new WText(lexical_cast<string>(networkTotalErrorsOut))); networkTable->elementAt((int)networkIoStatsEntries + 1, 7)->addWidget(new WText(lexical_cast<string>(networkTotalCollisions))); networkTable->elementAt((int)networkIoStatsEntries + 1, 8)->addWidget(new WText("-")); new WBreak(NetworkInfoDiv); } }
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)); } } } } }