void AuthWidget::createOAuthLoginView() { if (!model_->oAuth().empty()) { setCondition("if:oauth", true); WContainerWidget *icons = new WContainerWidget(); icons->setInline(isInline()); for (unsigned i = 0; i < model_->oAuth().size(); ++i) { const OAuthService *auth = model_->oAuth()[i]; WImage *w = new WImage("css/oauth-" + auth->name() + ".png", icons); w->setToolTip(auth->description()); w->setStyleClass("Wt-auth-icon"); w->setVerticalAlignment(AlignMiddle); OAuthProcess *const process = auth->createProcess(auth->authenticationScope()); #ifndef WT_TARGET_JAVA w->clicked().connect(process, &OAuthProcess::startAuthenticate); #else process->connectStartAuthenticate(w->clicked()); #endif process->authenticated().connect (boost::bind(&AuthWidget::oAuthDone, this, process, _1)); WObject::addChild(process); } bindWidget("icons", icons); } }
void RegistrationWidget::update() { if (model_->passwordAuth()) bindString("password-description", tr("Wt.Auth.password-registration")); else bindEmpty("password-description"); updateView(model_); if (!created_) { WLineEdit *password = resolve<WLineEdit *> (RegistrationModel::ChoosePasswordField); WLineEdit *password2 = resolve<WLineEdit *> (RegistrationModel::RepeatPasswordField); WText *password2Info = resolve<WText *> (RegistrationModel::RepeatPasswordField + std::string("-info")); if (password && password2 && password2Info) model_->validatePasswordsMatchJS(password, password2, password2Info); } WAnchor *isYou = resolve<WAnchor *>("confirm-is-you"); if (!isYou) { isYou = new WAnchor(std::string("#"), tr("Wt.Auth.confirm-is-you")); isYou->hide(); bindWidget("confirm-is-you", isYou); } if (model_->isConfirmUserButtonVisible()) { if (!isYou->clicked().isConnected()) isYou->clicked().connect(this, &RegistrationWidget::confirmIsYou); isYou->show(); } else isYou->hide(); if (model_->isFederatedLoginVisible()) { if (!conditionValue("if:oauth")) { setCondition("if:oauth", true); if (model_->passwordAuth()) bindString("oauth-description", tr("Wt.Auth.or-oauth-registration")); else bindString("oauth-description", tr("Wt.Auth.oauth-registration")); WContainerWidget *icons = new WContainerWidget(); icons->addStyleClass("Wt-field"); for (unsigned i = 0; i < model_->oAuth().size(); ++i) { const OAuthService *service = model_->oAuth()[i]; WImage *w = new WImage("css/oauth-" + service->name() + ".png", icons); w->setToolTip(service->description()); w->setStyleClass("Wt-auth-icon"); w->setVerticalAlignment(AlignMiddle); OAuthProcess *const process = service->createProcess(service->authenticationScope()); w->clicked().connect(process, &OAuthProcess::startAuthenticate); process->authenticated().connect (boost::bind(&RegistrationWidget::oAuthDone, this, process, _1)); WObject::addChild(process); } bindWidget("icons", icons); } } else { setCondition("if:oauth", false); bindEmpty("icons"); } if (!created_) { WPushButton *okButton = new WPushButton(tr("Wt.Auth.register")); WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel")); bindWidget("ok-button", okButton); bindWidget("cancel-button", cancelButton); okButton->clicked().connect(this, &RegistrationWidget::doRegister); cancelButton->clicked().connect(this, &RegistrationWidget::close); created_ = true; } }
bool CSVWholeview::enumMonitors(const string &szDeviceID, const string &szDeviceName, WTableCell *pTableCell) { map<int, base_param, less<int> > sortList; map<int, base_param, less<int> >::iterator lsItem; OBJECT objDevice = GetEntity(szDeviceID, m_szIDCUser, m_szIDCPwd); if(objDevice != INVALID_VALUE) { list<string> lsMonitorID; list<string>::iterator lstItem; if (GetSubMonitorsIDByEntity(objDevice, lsMonitorID)) { base_param monitor; string szMonitorId(""); OBJECT objMonitor = INVALID_VALUE; MAPNODE node = INVALID_VALUE; string szName(""), szIndex(""); int nIndex = 0; for(lstItem = lsMonitorID.begin(); lstItem != lsMonitorID.end(); lstItem ++) { szMonitorId = (*lstItem).c_str(); objMonitor = GetMonitor(szMonitorId, m_szIDCUser, m_szIDCPwd); if(objMonitor != INVALID_VALUE) { node = GetMonitorMainAttribNode(objMonitor); if(node != INVALID_VALUE) { FindNodeValue(node, "sv_name", szName); FindNodeValue(node, "sv_index", szIndex); if(szIndex.empty()) nIndex = FindIndexByID(szMonitorId); else nIndex = atoi(szIndex.c_str()); monitor.szIndex = szMonitorId; monitor.szName = szName; lsItem = sortList.find(nIndex); while(lsItem != sortList.end()) { nIndex ++;//= nMax; lsItem = sortList.find(nIndex); } sortList[nIndex] = monitor; } CloseMonitor(objMonitor); } } } CloseEntity(objDevice); } string szShowText(""), szContent(""); int nState = dyn_normal; bool bShowDevice = false; for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++) { // get monitor's current state nState = getMonitorState(lsItem->second.szIndex, szShowText); WImage *pMonitor = NULL; if(m_nShowType == -1 || m_nShowType == nState || (m_nShowType == dyn_normal && nState == dyn_no_data) || (m_nShowType == dyn_error && nState == dyn_bad)) { bShowDevice = true; pMonitor = new WImage("/Images/state_green.gif", pTableCell); } if(pMonitor) { // change show image by state switch(nState) { case dyn_no_data: pMonitor->setImageRef("/Images/state_grey.gif"); break; case dyn_normal: pMonitor->setImageRef("/Images/state_green.gif"); break; case dyn_warnning: pMonitor->setImageRef("/Images/state_yellow.gif"); break; case dyn_error: case dyn_bad: pMonitor->setImageRef("/Images/state_red.gif"); break; case dyn_disable: pMonitor->setImageRef("/Images/state_stop.gif"); break; } // monitor's style && onclick event szContent = "style='cursor:pointer;' onclick = 'window.open(\"SimpleReport.exe?id=" + lsItem->second.szIndex + "\");'"; sprintf(pMonitor->contextmenu_, szContent.c_str()); pMonitor->setToolTip(szDeviceName + ":" + lsItem->second.szName + "\r\n" + szShowText); } } return bShowDevice; }
void SVSEView::addSVSEList(string &szName, string &szIndex) { if(m_pSEList) { int nRow = m_pSEList->numRows(); SVTableCell cell; sv_group_state groupState = getSVSEState(szIndex, m_pSVUser, m_szIDCUser, m_szIDCPwd); bool bHasEditRight = true; bool bHasDelRight = true; if(m_pSVUser) { bHasEditRight = m_pSVUser->haveUserRight(szIndex, "se_edit"); bHasDelRight = m_pSVUser->haveUserRight(szIndex, "se_delse"); } else { bHasEditRight = false; bHasDelRight = false; } // Ñ¡Ôñ //if(szIndex.compare("1") != 0) //{ // WCheckBox * pCheck = NULL; // if(bHasEditRight || bHasDelRight) pCheck = new WCheckBox("", (WContainerWidget *)m_pSEList->elementAt(nRow, 0)); // if(pCheck) // { // cell.setType(adCheckBox); // cell.setValue(pCheck); // m_svSEList.WriteCell(szIndex, 0, cell); // } //} // ÃèÊö WText *pDesc = new WText("", (WContainerWidget *)m_pSEList->elementAt(nRow, 0)); if(pDesc) { char szState[512] = {0}; sprintf(szState, "%s%d<BR>%s%d<BR>%s%d<BR>%s%d<BR>%s%d", SVResString::getResString("IDS_Device_Count").c_str(), groupState.nDeviceCount, SVResString::getResString("IDS_Monitor_Count").c_str(), groupState.nMonitorCount, SVResString::getResString("IDS_Monitor_Disable_Count").c_str(), groupState.nDisableCount, SVResString::getResString("IDS_Monitor_Error_Count").c_str(), groupState.nErrorCount, SVResString::getResString("IDS_Monitor_Warn_Count").c_str(), groupState.nWarnCount); pDesc->setText(szState); } // Ãû³Æ WText *pName = new WText(szName, (WContainerWidget *)m_pSEList->elementAt(nRow, 1)); if ( pName ) { sprintf(pName->contextmenu_, "style='color:#669;cursor:pointer;' onmouseover='" \ "this.style.textDecoration=\"underline\"' " \ "onmouseout='this.style.textDecoration=\"none\"'"); pName->setToolTip(szName); WObject::connect(pName, SIGNAL(clicked()), "showbar();", &m_wNameMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_wNameMapper.setMapping(pName, szIndex); cell.setType(adText); cell.setValue(pName); m_svSEList.WriteCell(szIndex, 2, cell); SVTableRow *pRow = m_svSEList.Row(szIndex); if(pRow) pRow->setProperty(szIndex.c_str()); } // ±à¼ WImage * pEdit = NULL; if(bHasEditRight) pEdit = new WImage("../icons/edit.gif", (WContainerWidget *)m_pSEList->elementAt(nRow, 2)); if (pEdit) { pEdit->setToolTip(SVResString::getResString("IDS_Edit")); pEdit->setStyleClass("imgbutton"); WObject::connect(pEdit, SIGNAL(clicked()), "showbar();", &m_wEditMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_wEditMapper.setMapping(pEdit,szIndex); } if((nRow + 1) % 2 == 0) m_pSEList->GetRow(nRow)->setStyleClass("tr1"); else m_pSEList->GetRow(nRow)->setStyleClass("tr2"); } }
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"); }