Example #1
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建标题
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
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");
}
Example #2
0
void SpritesDemo::Load() {
	m_sprites[0] = new WSprite(m_app);
	m_sprites[0]->Load();
	WImage* img = new WImage(m_app);
	img->Load("Media/dummy.bmp");
	m_sprites[0]->SetImage(img);
	img->RemoveReference();

	m_sprites[1] = new WSprite(m_app);
	m_sprites[1]->Load();
	img = new WImage(m_app);
	img->Load("Media/checker.bmp");
	m_sprites[1]->SetImage(img);
	img->RemoveReference();
	m_sprites[1]->SetPosition(100, 100);
	m_sprites[1]->SetAlpha(0.5f);

	m_sprites[2] = new WSprite(m_app);
	WShader* pixel_shader = new CustomSpritePS(m_app);
	pixel_shader->Load();
	WEffect* fx = m_app->SpriteManager->CreateSpriteEffect(pixel_shader);
	pixel_shader->RemoveReference();
	WMaterial* mat = new WMaterial(m_app);
	mat->SetEffect(fx);
	fx->RemoveReference();
	m_sprites[2]->SetMaterial(mat);
	mat->RemoveReference();
	m_sprites[2]->Load();
	m_sprites[2]->SetPosition(200, 200);
	m_sprites[2]->SetSize(200, 200);
}
Example #3
0
void EtagStore::update_image() {
    clear();
    WImage* image = new WImage(resource_->url());
    addWidget(image);
    image->resize(0, 0);
    wApp->triggerUpdate();
}
Example #4
0
void SVConditionParam::createShowButton(int nRow)
{
    WImage * pSet = new WImage("../icons/set.gif", (WContainerWidget*)elementAt(nRow,1));
    if(pSet)
    {
        pSet->setStyleClass("imgbutton");
        WObject::connect(pSet, SIGNAL(clicked()), this, SLOT(showAddCondition()));
    }
}
Example #5
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建显示追加条件
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::createShowButton(int nRow)
{
    WImage * pSet = new WImage("../Images/more.gif", elementAt(nRow,1));
    if(pSet)
    {
        pSet->setStyleClass("hand");
        WObject::connect(pSet, SIGNAL(clicked()), this, SLOT(showAddCondition()));
    }
}
Example #6
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建隐藏按钮
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::createHideButton()
{
    int nRow = m_pOperate->numRows();

    WImage  * pClose = new WImage("../Images/tocHide.gif", m_pOperate->elementAt(nRow,1));
    m_pOperate->elementAt(nRow, 1)->setContentAlignment(AlignTop | AlignRight);
    if(pClose)
    {
        pClose->setStyleClass("hand");
        WObject::connect(pClose, SIGNAL(clicked()), this, SLOT(hideAddCondition()));
    }
}
Example #7
0
void SVConditionParam::createHideButton()
{
    int nRow = m_pOperate->numRows();

    WImage  * pClose = new WImage("../icons/closewnd.gif", (WContainerWidget*)m_pOperate->elementAt(nRow,1));
    m_pOperate->elementAt(nRow, 1)->setContentAlignment(AlignTop | AlignRight);
    if(pClose)
    {
        pClose->setStyleClass("imgbutton");
        WObject::connect(pClose, SIGNAL(clicked()), this, SLOT(hideAddCondition()));
    }
}
Example #8
0
void CSVReportSet::addPhoneListNew()
{

	std::list<string> sectionlist;
	std::list<string>::iterator m_sItem;
	GetIniFileSections(sectionlist, "reportset.ini");

	int numRow = 1;
	for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++)
	{
		m_pReportListTable->InitRow(numRow);

		std::string section = *m_sItem;

		string ret = "error";

		WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 0));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 0)->setContentAlignment(AlignCenter);
		// 名称
		std::string strlinkname;
		std::string hrefstr = RepHrefStr(section);
		strlinkname ="<a href=/fcgi-bin/startsreportlist.exe?id="+hrefstr+">"+section+"</a>";
		WText *pName = new WText(strlinkname, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow , 2));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 2)->setContentAlignment(AlignCenter);

		std::string szPeriod = GetIniFileString(section, "Period", ret, "reportset.ini");
		if(strcmp(szPeriod.c_str(), "error") == 0)
		{
		}

		WText *pPeriod = new WText(szPeriod, (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);
		pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer);   
		connect(pEdit, SIGNAL(clicked()), &m_signalMapper, SLOT(map()));
		m_signalMapper.setMapping(pEdit, section);

		REPORT_LIST list;

		list.pSelect = pCheck;
		list.pName = pName;
		list.pPeriod = pPeriod;
		list.pEdit = pEdit;
		m_pListReport.push_back(list);

		numRow++;
	}
}
Example #9
0
void WDatePicker::createDefault(WLineEdit *forEdit)
{
  WImage *icon = new WImage(WApplication::relativeResourcesUrl() 
			    + "calendar_edit.png");
  icon->resize(16, 16);
  icon->setVerticalAlignment(AlignMiddle);

  if (!forEdit) {
    forEdit = new WLineEdit();
    create(icon, forEdit);
    layout_->insertWidget(0, forEdit);
  } else
    create(icon, forEdit);
}
Example #10
0
void WSVFlexTable::InitRow(int nRow)
{
	for(int i = 1,j = 0; i < dataTitleTable->numColumns() + 1; i+=2, j++)
	{
		dataGridTable->elementAt(nRow, i)->resize(WLength(4), WLength());
		WImage * pTmpImage = new WImage("/Images/space.gif", "", (WContainerWidget *)dataGridTable->elementAt(nRow, i));
		pTmpImage->resize(WLength(4), WLength());
		dataGridTable->elementAt(nRow, i - 1)->resize(m_pColumnWidth[j], WLength());
		dataGridTable->elementAt(nRow, i - 1)->setStyleClass(m_pRowDataCss[j]);
	}
	
	if((nRow%2) == 0)
		dataGridTable->GetRow(nRow)->setStyleClass("table_data_grid_item_bg");
}
Example #11
0
/*! \brief Create an image which can be dragged.
 *
 * The image to be displayed when dragging is given by smallurl, and
 * configured with the given mime type
 */
WImage *createDragImage(const char *url, const char *smallurl,
			const char *mimeType,
			WContainerWidget *p)
{
  WImage *result = new WImage(url, p);
  WImage *dragImage = new WImage(smallurl, p);

  /*
   * Set the image to be draggable, showing the other image (dragImage)
   * to be used as the widget that is visually dragged.
   */
  result->setDraggable(mimeType, dragImage, true);

  return result;
}
Example #12
0
void HangmanWidget::createHangmanImages(WContainerWidget *parent)
{
   for(unsigned int i = 0; i <= MaxGuesses; ++i) {
      std::string fname = "icons/hangman";
      fname += boost::lexical_cast<std::string>(i) + ".png";
      WImage *theImage = new WImage(fname, parent);
      HangmanImages.push_back(theImage);

      // Although not necessary, we can avoid flicker (on konqueror)
      // by presetting the image size.
      theImage->resize(WLength(256), WLength(256));
   }

   HurrayImage = new WImage("icons/hangmanhurray.png", parent);
   resetImages(); // Hide all images
}
Example #13
0
void WSVFlexTable::AppendColumn(std::string strBigColName,std::string strSmallColName, WLength width_)
{

	for (int i=0 ; i< 3; i++)
	{
		if(GetContentTable()!=NULL)
		{
			int iLast = dataTitleTable->numColumns();		
			if(iLast!=0)
			{
				new WImage("/Images/table_head_space.png","",(WContainerWidget *)dataTitleTable->elementAt(0,iLast));
				WImage * pTmpImage = new WImage("/Images/space.gif","",(WContainerWidget *)dataGridTable->elementAt(0,iLast));
				pTmpImage->resize(WLength(4), WLength());
				dataGridTable->elementAt(1,iLast)->resize(WLength(4), WLength());
				iLast = iLast+1;
			}

			//m_pColumnWidth[iLast] = width_;
			m_pColumnWidth.push_back(width_);
			dataTitleTable->elementAt(1,iLast)->setStyleClass("table_data_grid_header_text");
			dataTitleTable->elementAt(1,iLast)->resize(width_,WLength());
			dataTitleTable->elementAt(1,iLast)->setContentAlignment(AlignCenter);
			strcpy(dataTitleTable->elementAt(1,iLast)->contextmenu_,"nowrap");


			dataTitleTable->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));

			new WText(strSmallColName,(WContainerWidget *)dataTitleTable->elementAt(1,iLast));

			dataGridTable->elementAt(0,iLast)->setStyleClass("table_data_grid_header_text");
			dataGridTable->elementAt(0,iLast)->resize(width_,WLength());
			dataGridTable->elementAt(0,iLast)->setContentAlignment(AlignCenter);
			strcpy(dataGridTable->elementAt(0,iLast)->contextmenu_,"nowrap");

			dataGridTable->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));

			//return new WText("",(WContainerWidget *)dataGridTable->elementAt(0,iLast));
		}
	}
	
	//return NULL;
}
Example #14
0
WSTreeAndPanTable::WSTreeAndPanTable(WContainerWidget * parent)
:WTable(parent)
{
	this->setStyleClass("panel_view");
	
	this->elementAt(0, 0)->setStyleClass("tree_bg");
	
	//TreeTable 可以在引用时再添加
	//new WText("<div id='tree_panel' name='tree_panel' class='panel_tree'>", this->elementAt(0, 0));
	//new WText("</div>", this->elementAt(0, 0));

	//DragTable Cell
	this->elementAt(0, 1)->setStyleClass("resize");
	strcpy(this->elementAt(0, 1)->contextmenu_, "onMouseDown='this.setCapture()' onMouseUp='this.releaseCapture();'");
	WImage * pTmpImage = new WImage("/Images/space.gif", this->elementAt(0, 1));
	pTmpImage->resize(WLength(5), WLength());

	//PanTable Cell 可以在引用时再添加
	//new WText("<div id='view_panel' class='panel_view'>", this->elementAt(0, 2));
	//new WText("</div>", this->elementAt(0, 2));
}
Example #15
0
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);
  }
}
Example #16
0
WImage *WItemDelegate::iconWidget(WidgetRef& w,
                                  const WModelIndex& index, bool autoCreate)
{
  WImage *image = dynamic_cast<WImage *>(w.w->find("i"));
  if (image || !autoCreate)
    return image;

  IndexContainerWidget *wc =
      dynamic_cast<IndexContainerWidget *>(w.w->find("a"));

  if (!wc)
    wc = dynamic_cast<IndexContainerWidget *>(w.w->find("o"));

  if (!wc) {
    wc = new IndexContainerWidget(index);
    wc->setObjectName("o");
    wc->addWidget(w.w);
    w.w = wc;
  }

  image = new WImage();
  image->setObjectName("i");
  image->setStyleClass("icon");
  wc->insertWidget(wc->count() - 1, image);

  // IE does not want to center vertically without this:
  if (wApp->environment().agentIsIE()) {
    WImage *inv = new WImage(wApp->onePixelGifUrl());
    inv->setStyleClass("rh w0 icon");
    inv->resize(0, WLength::Auto);
    wc->insertWidget(wc->count() -1, inv);
  }

  return image;
}
Example #17
0
 // Clone an image which reallocates the image if of a different dimension.
 void CloneFrom(const WImage<T>& src) {
     Allocate(src.Width(), src.Height(), src.Channels());
     CopyFrom(src);
 }
Example #18
0
DetailManipulation::DetailManipulation(bool enhance, WContainerWidget *parent)
	: WContainerWidget(parent), onlySmooth(!enhance)
{

	resize(WLength::Auto, WLength::Auto);

	// Image bar
	prepareInputImages();
	WContainerWidget *imageBar = new WContainerWidget;
	WVBoxLayout *imageBarLayout = new WVBoxLayout();
	for (size_t i = 0; i < inputImages.size(); ++i) {
		WImage *img = inputImages[i]->getOriginalImage();
		img->setStyleClass("image_button");
		img->resize(160, 120);
		img->setAttributeValue("onMouseOver", "this.width=192; this.height=144;");
		img->setAttributeValue("onMouseOut", "this.width=160; this.height=120;");
		img->clicked().connect(
				boost::bind(&DetailManipulation::selectImage,
							this,
							i
							)
		);
		imageBarLayout->addWidget(img);
	}
	imageBar->resize(200, WLength::Auto);
	imageBar->setLayout(imageBarLayout);
	selectedImageId = 0;

	// Main component
	imageTab = new WTabWidget();
	imageTab->addTab(inputImages[selectedImageId]->getOriginalImage(), "Original");
	if (onlySmooth) {
		imageTab->addTab(new WImage(smoothedResult[selectedImageId].second), smoothedResult[selectedImageId].first);
	}
	else {
		imageTab->addTab(new WImage(enhancedResult[selectedImageId].second), enhancedResult[selectedImageId].first);
	}
	imageTab->resize(600, WLength::Auto);


	WGridLayout *controllerLayout = new WGridLayout();
	WSlider *rSlider = new WSlider(Wt::Vertical);
	rSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
	rSlider->setTickPosition(Wt::WSlider::TicksBothSides);
	WDoubleSpinBox *rSpinBox = new WDoubleSpinBox();
	rSpinBox->setMinimum(R_MINIMUM);
	rSpinBox->setMaximum(R_MAXIMUM);
	rSlider->sliderMoved().connect(
			boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
						this,
						rSpinBox,
						true,
						_1)
	);
	rSpinBox->valueChanged().connect(
			boost::bind(&DetailManipulation::changeSliderValue,
						this,
						rSlider,
						1.f/(R_MAXIMUM-R_MINIMUM),
						_1)
	);
	controllerLayout->addWidget(rSlider, 2, 0, 6, 1);
	controllerLayout->addWidget(rSpinBox, 9, 0);
	controllerLayout->addWidget(new WText("radius"), 10, 0);


	WSlider *epsSlider = new WSlider(Wt::Vertical);
	epsSlider->setMinimum(SLIDER_MINIMUM);
	epsSlider->setMaximum(SLIDER_MAXIMUM);
	epsSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
	epsSlider->setTickPosition(WSlider::TicksBothSides);
	WDoubleSpinBox *epsSpinBox = new WDoubleSpinBox();
	epsSpinBox->setMinimum(EPS_MINIMUM);
	epsSpinBox->setMaximum(EPS_MAXIMUM);
	epsSlider->sliderMoved().connect(
			boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
						this,
						epsSpinBox,
						false,
						_1)
	);
	epsSpinBox->valueChanged().connect(
			boost::bind(&DetailManipulation::changeSliderValue,
						this,
						epsSlider,
						1.f/(EPS_MAXIMUM-EPS_MINIMUM),
						_1)
	);
	controllerLayout->addWidget(epsSlider, 2, 1, 6, 1);
	controllerLayout->addWidget(epsSpinBox, 9, 1);
	controllerLayout->addWidget(new WText("epsilon"), 10, 1);

	WPushButton *apply = new WPushButton("Apply");
	apply->clicked().connect(
			boost::bind(&DetailManipulation::applyEnhancement,
					this,
					rSpinBox,
					epsSpinBox
					)
	);
	controllerLayout->addWidget(apply, 1, 0, 1, 2);


	WContainerWidget *controller = new WContainerWidget();
	controller->resize(120, WLength::Auto);
	controller->setLayout(controllerLayout);


	WBorderLayout *mainLayout = new WBorderLayout(this);
	mainLayout->addWidget(imageBar, WBorderLayout::West);
	mainLayout->addWidget(imageTab, WBorderLayout::Center);
	mainLayout->addWidget(controller, WBorderLayout::East);
	//setLayout(mainLayout, Wt::AlignTop | Wt::AlignJustify);
	/*
		doJavaScript(
			    "(function () { \
						     var imageTags = document.getElementsByClassName(\"image_button\"); \
						     for (var i=0; image=imageTags[i]; ++i) { \
						         if (image.width>200 && image.height>0) { \
						             image.width = 192;  \
						         } \
						     }\
				 })();"
		);*/

}
Example #19
0
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");
}
Example #20
0
void CSVReportSet::UpdatePhoneList()
{
	/*
	int nNum =m_ptbPhone->numRows();
	for(int i=1;i<nNum;i++)
	{
		m_ptbPhone->deleteRow(1);

	}
	*/
	PrintDebugString("Into UpdatePhoneList\n");

	m_pReportListTable->GeDataTable()->clear();

	m_pListReport.clear();

	std::list<string> sectionlist;
	std::list<string>::iterator m_sItem;
	GetIniFileSections(sectionlist, "reportset.ini");

	//if(sectionlist.size() == 0)
	//{
	//	WText * nText = new WText("[----------统计报告列表为空-----------]", (WContainerWidget*)m_pReportListTable->GeDataTable() -> elementAt(0, 0));
	//	nText ->decorationStyle().setForegroundColor(Wt::red);
	//	//nullTable -> elementAt(0, 0) -> setContentAlignment(AlignTop | AlignCenter);
	//}

	int numRow = 1;
	for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++)
	{
		std::string section = *m_sItem;

		std::list<string> keylist;
		std::list<string>::iterator m_pItem;
		
		bool bRet = false;
		bRet = GetIniFileKeys(section,keylist, "reportset.ini" );
		if(!bRet)
		{
		}

		m_pItem = keylist.begin();

		std::string str = *m_pItem;
		std::string ret = "error";


		REPORT_LIST list;

		m_pReportListTable->InitRow(numRow);
		
		// 是否选择
		WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 0));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 0)->setContentAlignment(AlignCenter);

		
		// 名称
		std::string ReportName = GetIniFileString(section, "Title", ret, "reportset.ini");
		std::string strlinkname;
		std::string hrefstr =  RepHrefStr(ReportName);
		strlinkname ="<a href=/fcgi-bin/statsreportlist.exe?id="+hrefstr+">"+ReportName+"</a>";

		OutputDebugString("----------------report link name include null----------------\n");
		OutputDebugString(strlinkname.c_str());
		OutputDebugString("\n");

		if(strcmp(ReportName.c_str(), "error") == 0)
		{
		}
		WText *pName = new WText(strlinkname, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow , 2));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 2)->setContentAlignment(AlignCenter);

		std::string ReportPeriod = GetIniFileString(section, "Period", ret, "reportset.ini");
		if(strcmp(ReportPeriod.c_str(), "error") == 0)
		{
		}
		WText *pPeriod = new WText(ReportPeriod, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow, 4));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 4)->setContentAlignment(AlignCenter);

		WImage *pEdit = new WImage("/Images/edit.gif", (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow ,6));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 6)->setContentAlignment(AlignCenter);
		if(!GetUserRight("m_reportlistEdit"))
			pEdit->hide();
		else
			pEdit->show();

		pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer);   
	    connect(pEdit, SIGNAL(clicked()),"showbar();", &m_signalMapper, SLOT(map()),
			WObject::ConnectionType::JAVASCRIPTDYNAMIC);

		m_signalMapper.setMapping(pEdit, section);

		list.pSelect = pCheck;
		list.pName = pName;
		list.pPeriod = pPeriod;
		list.pEdit = pEdit;
		m_pListReport.push_back(list);		

		numRow++;

		PrintDebugString("Into UpdatePhoneList loop\n");
	}	
}
Example #21
0
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");
    }

}
Example #22
0
bool CSVWholeview::enumGroups(const string &szGroupID, WTable *pTable)
{
    bool bShowGroup = false;
	bool gShowGroup = true;//jansion
	bool mShowGroup = true; //jansion
	pTable->setStyleClass("widthauto");
    if(!szGroupID.empty())
    {     
        OBJECT objGroup = GetGroup(szGroupID);
        if(objGroup != INVALID_VALUE)
        { 
			//PrintDebugString("In ------------------------------------\n");
            string szIndex(""), szName(""), szShowIndex(""), szContext("");
            string szShow(""), szHide(""), szSubTable("");
            string szShowText(""), szHideText("");
            bool bHasRight = true;
            int nIndex = 0, nRow = 0; 
            MAPNODE node = INVALID_VALUE;
            list<string> lsGroupID;
            list<string> lsDeviceID;
            list<string>::iterator lstItem;
			//list<string>::iterator bcompItem;

            if(GetSubGroupsIDByGroup(objGroup, lsGroupID))
            {
				
                map<int, base_param, less<int> > sortList;
                map<int, base_param, less<int> >::iterator lsItem;
				map<int, base_param, less<int> >::iterator bcompItem;

				//bool gShow = false;

                base_param group;
                OBJECT objSubGroup = INVALID_VALUE;
                for(lstItem = lsGroupID.begin(); lstItem != lsGroupID.end(); lstItem ++)
                {
					//PrintDebugString("In --------------- for ---------------------\n");
                    szIndex =(*lstItem);
                    bHasRight = true;
                    if(m_pSVUser)
                        bHasRight = m_pSVUser->haveGroupRight(szIndex, Tree_GROUP);
                    if(bHasRight)
                    {
                        objSubGroup = GetGroup(szIndex, m_szIDCUser, m_szIDCPwd);
                        if(objGroup != INVALID_VALUE)
                        {
                            node = GetGroupMainAttribNode(objSubGroup);
                            if(node != INVALID_VALUE)
                            { 
                                FindNodeValue(node, "sv_name", szName);
                                FindNodeValue(node, "sv_index", szShowIndex);
                                if(szShowIndex.empty())
                                    nIndex = FindIndexByID(szIndex);
                                else
                                    nIndex = atoi(szShowIndex.c_str());
                                group.szIndex = szIndex;
                                group.szName = szName;

                                lsItem = sortList.find(nIndex);
                                while(lsItem != sortList.end())
                                {
                                    nIndex ++;
                                    lsItem = sortList.find(nIndex);
                                }
                                sortList[nIndex] = group;
                            }							
							else
							{
								gShowGroup = false;
							}
                            CloseGroup(objSubGroup);
                        }
                    }
					else
					{
						gShowGroup =false;
					}
                }

				//if (lsGroupID.empty())
				//	PrintDebugString("In group is ====== false\n");

                for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++)
                {					
					//PrintDebugString("In emnuGroup " + lsItem->second.szName + "\n");

					//bool gShow = false;

                    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));
					//if(!enumGroups(lsItem->second.szIndex, pSub))
					//{
                    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("&nbsp;",pTable->elementAt(nRow, 0));

                    //new WImage("../Images/group.gif", pTable->elementAt(nRow, 1));
					new WImage("/Images/cbb-3group.gif", pTable->elementAt(nRow, 1));
					new WText("&nbsp;",pTable->elementAt(nRow, 1));

                    WText *pName = new WText(lsItem->second.szName, pTable->elementAt(nRow, 2));
                    if(pName)
                    {
                        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(pTable->elementAt(nRow + 1, 2));
                    if(pSub)
                    {          
                        if(pShow && pHide)
                        {
                            szShow = pHide->formName();
                            szHide = pShow->formName();
                            szSubTable = pSub->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());            
                        }

                        if(!enumGroups(lsItem->second.szIndex, pSub))
						{
							//gShow = true;
							//pTable->deleteRow(nRow);
							pShow->hide();
							pHide->hide();
						}
                        else
						{
                            //bShowGroup = true;
							//pShow->hide();
							//pHide->hide();
						}
                    }

                }

				if (sortList.empty())
					gShowGroup = false;

            }
			else
			{
				gShowGroup = false;
			}
            if(GetSubEntitysIDByGroup(objGroup, lsDeviceID))
            {
                map<int, base_param, less<int> > sortList;
                map<int, base_param, less<int> >::iterator lsItem;
                base_param device;
                OBJECT objDevice = INVALID_VALUE;
                for(lstItem = lsDeviceID.begin(); lstItem != lsDeviceID.end(); lstItem ++)
                {
                    szIndex =(*lstItem);
                    bHasRight = true;
                    if(m_pSVUser)
                        bHasRight = m_pSVUser->haveGroupRight(szIndex, Tree_DEVICE);
                    if(bHasRight)
                    {
                        objDevice = GetEntity(szIndex, m_szIDCUser, m_szIDCPwd);
                        if(objDevice != INVALID_VALUE)
                        {
                            node = GetEntityMainAttribNode(objDevice);
                            if(node != INVALID_VALUE)
                            {
                                FindNodeValue(node, "sv_name", szName);
                                FindNodeValue(node, "sv_index", szShowIndex);
                                if(szShowIndex.empty())
                                    nIndex = FindIndexByID(szIndex);
                                else
                                    nIndex =  atoi(szShowIndex.c_str());
                                device.szIndex = szIndex;
                                device.szName = szName;

                                lsItem = sortList.find(nIndex);
                                while(lsItem != sortList.end())
                                {
                                    nIndex ++;
                                    lsItem = sortList.find(nIndex);
                                }
                                sortList[nIndex] = device;
                            }
							else
							{
								mShowGroup = false;
							}
                            CloseEntity(objDevice);
                        }
                    }
                }
                for(lsItem = sortList.begin(); lsItem != sortList.end(); lsItem ++)
                {
					//PrintDebugString("In emnuGroup " + lsItem->second.szName + "------------------------\n");
                    nRow = pTable->numRows();
                    //new WImage("../Images/device.gif", pTable->elementAt(nRow, 1));
					new WImage("/Images/cbb-4server.gif", pTable->elementAt(nRow, 1));
					new WText("&nbsp;",pTable->elementAt(nRow, 1));

                    WText *pName = new WText(lsItem->second.szName, pTable->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, pTable->elementAt(nRow, 2)))
					{
						bShowGroup = false;
						//bShowGroup = true;
                        //pTable->deleteRow(nRow);
					}
                    else
                        bShowGroup = true;
                }

				//84200891
				if (sortList.empty())
				{
					mShowGroup = false;
				}

            }
			else
			{
				mShowGroup = false;
			}
            CloseGroup(objGroup);
        }
		else
		{
			mShowGroup = false;
			gShowGroup = false;
		}
    }
	else
	{
		mShowGroup = false;
		gShowGroup = false;
	}

	bool bbShowGroup;
	bbShowGroup = gShowGroup || mShowGroup;
    return bbShowGroup;
}
Example #23
0
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;
}
Example #24
0
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("&nbsp;",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("&nbsp;",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("&nbsp;",pTable->elementAt(nRow, 0));

			new WImage("/Images/cbb-2main.gif", pTable->elementAt(nRow, 1));

			new WText("&nbsp;",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("&nbsp;",pSubTable->elementAt(nRow, 0));

						new WImage("/Images/cbb-3group.gif", pSubTable->elementAt(nRow, 1));

						new WText("&nbsp;",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("&nbsp;",pSubTable->elementAt(nRow , 0));

						new WImage("/Images/cbb-4server.gif", pSubTable->elementAt(nRow, 1));

						new WText("&nbsp;",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));
                }
            }
        }
    }
}
Example #25
0
//add  list function
void CSVReportSet::addPhoneList(WTable * table)
{
    m_ptbPhone = new WTable((WContainerWidget*)table->elementAt(7,0));
	nullTable = new WTable((WContainerWidget*)table->elementAt(8, 0));

	m_ptbPhone -> setStyleClass("t3");
	nullTable -> setStyleClass("t3");

    if (m_ptbPhone)
    {
        m_ptbPhone -> setCellPadding(0);   
		m_ptbPhone->setCellSpaceing(0);
		new WText("", (WContainerWidget*)m_ptbPhone->elementAt(0,0));
		new WText(m_formText.szColName, (WContainerWidget*)m_ptbPhone->elementAt(0, 1));
		new WText(m_formText.szColPeriod, (WContainerWidget*)m_ptbPhone->elementAt(0, 2));
		new WText(m_formText.szColEdit, (WContainerWidget*)m_ptbPhone->elementAt(0, 3));
		
		m_ptbPhone->elementAt(0, 0)->setStyleClass("t3title");
		m_ptbPhone->elementAt(0, 1)->setStyleClass("t3title");
		m_ptbPhone->elementAt(0, 2)->setStyleClass("t3title");
		m_ptbPhone->elementAt(0, 3)->setStyleClass("t3title");
		
    }

	std::list<string> sectionlist;
	std::list<string>::iterator m_sItem;
	GetIniFileSections(sectionlist, "reportset.ini");

	for(m_sItem = sectionlist.begin(); m_sItem != sectionlist.end(); m_sItem++)
	{
		int numRow = m_ptbPhone->numRows();
		std::string section = *m_sItem;

		string ret = "error";

		WCheckBox * pCheck = new WCheckBox("", (WContainerWidget*)m_ptbPhone->elementAt(numRow, 0));
		// 名称
		std::string strlinkname;
		std::string hrefstr = RepHrefStr(section);
		strlinkname ="<a href=/fcgi-bin/startsreportlist.exe?id="+hrefstr+">"+section+"</a>";
		WText *pName = new WText(strlinkname, (WContainerWidget*)m_ptbPhone->elementAt(numRow , 1));

		std::string szPeriod = GetIniFileString(section, "Period", ret, "reportset.ini");
		if(strcmp(szPeriod.c_str(), "error") == 0)
		{
		}
		
		WText *pPeriod = new WText(szPeriod, (WContainerWidget*)m_ptbPhone->elementAt(numRow, 2));
		
		WImage *pEdit = new WImage("../icons/edit.gif", (WContainerWidget*)m_ptbPhone->elementAt(numRow ,3));
		pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer);   
	    connect(pEdit, SIGNAL(clicked()), &m_signalMapper, SLOT(map()));
		m_signalMapper.setMapping(pEdit, section);

		REPORT_LIST list;

		list.pSelect = pCheck;
		list.pName = pName;
		list.pPeriod = pPeriod;
		list.pEdit = pEdit;
		m_pListReport.push_back(list);
		
	}
	m_ptbPhone->adjustRowStyle("tr1","tr2");
	

	//m_pReportListTable->HideNullTip();
		
}
Example #26
0
void CSVReportSet::SavePhone(SAVE_REPORT_LIST * report)
{
    //nullTable -> clear();

	if(strcmp(chgstr.c_str(), "") != 0)
    {
        Edit_Phone(report);
        return;
    }
    
	//judge report name/(ini section) is right
	
	std::list<string> sectionlist;
	std::list<string>::iterator Item;
	GetIniFileSections(sectionlist, "reportset.ini");
	bool bRe = false;

	for(Item = sectionlist.begin(); Item != sectionlist.end(); Item++)
	{
		std::string str = *Item;
		if(strcmp(str.c_str(), report->szTitle.c_str()) == 0)
		{
			bRe = true;
			break;
		}
	}

	if(bRe)//有重复
	{

		std::list<string> errorMsgList;
		errorMsgList.push_back(m_formText.szConnErr);
		m_pReportListTable->ShowErrorMsg(errorMsgList);		//show error msg


		//m_pConnErr ->setText(m_formText.szConnErr);
		//m_pConnErr ->show();	
	}
	else
	{
		//int numRow = m_ptbPhone->numRows();
		int numRow = m_pReportListTable->GeDataTable()->numRows();
		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 strlinkname;

		std::string hrefstr =  RepHrefStr(report->szTitle);
		strlinkname ="<a href=/fcgi-bin/statsreportlist.exe?id="+hrefstr+">"+report->szTitle+"</a>";

		WText *pName = new WText(strlinkname, (WContainerWidget*)m_pReportListTable->GeDataTable()->elementAt(numRow , 2));
		m_pReportListTable->GeDataTable()->elementAt(numRow, 2)->setContentAlignment(AlignCenter);
	    
		WText *pPeriod = new WText(report->szPeriod, (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);
		pEdit->decorationStyle().setCursor(WCssDecorationStyle::Pointer);   
	    
		//m_ptbPhone->adjustRowStyle("tr1","tr2"); 

		m_signalMapper.setMapping(pEdit, report->szTitle);
	  
		bool isWriteIni = false;

		isWriteIni = WriteIniFileString(report->szTitle, "Title", report->szTitle, "reportset.ini");
		if(!isWriteIni)
		{

		}
		isWriteIni = WriteIniFileString(report->szTitle, "Descript", report->szDescript, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Plan", report->szPlan, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Period", report->szPeriod, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "StatusResult", report->szStatusresult, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ErrorResult", report->szErrorresult, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Graphic", report->szGraphic, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ComboGraphic", report->szComboGraphic, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListData", report->szListData, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListNormal", report->szListNormal, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListError", report->szListError, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListDanger", report->szListDanger, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListAlert", report->szListAlert, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "EmailSend", report->szEmailSend, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Parameter", report->szParameter, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Deny", report->szDeny, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "Generate", report->szGenerate, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ClicketValue", report->szClicketValue, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "ListClicket", report->szListClicket, "reportset.ini");
		if(!isWriteIni)
		{
		}
		isWriteIni = WriteIniFileString(report->szTitle, "GroupRight", report->szGroupRight, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "StartTime", report->szStartTime, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileString(report->szTitle, "EndTime", report->szEndTime, "reportset.ini");
		if(!isWriteIni)
		{
		}

		isWriteIni = WriteIniFileInt(report->szTitle, "WeekEndTime", report->nWeekEndIndex, "reportset.ini");
		if(!isWriteIni)
		{
		}
		//Ticket #123  start   -------苏合
		isWriteIni = WriteIniFileString(report->szTitle, "GenExcel", report->szExcel, "reportset.ini");
		if(!isWriteIni)
		{
		}
		//Ticket #123   end    -------苏合
		

		m_pReportListTable->HideNullTip();
		
		//REPORT_LIST list;
		REPORT_LIST list;

		list.pSelect = pCheck;
		list.pName = pName;
		list.pPeriod = pPeriod;
		list.pEdit = pEdit;
		m_pListReport.push_back(list);
		chgstr = "";
		connect(pEdit, SIGNAL(clicked()), "showbar();",&m_signalMapper, SLOT(map()),WObject::ConnectionType::JAVASCRIPTDYNAMIC );
	}
	
}
Example #27
0
WImage *Captcha::GenCap()
{
    size_t n1 = (rand() % 10) + 1;
    size_t n2 = (rand() % 10) + 1;
    int rotate = (rand() % 7 - 3);
    int skew = (rand() % 9 - 4);

    Result = n1 * n2;

    string captcha(lexical_cast<string>(n1));
    captcha += " X ";
    captcha += lexical_cast<string>(n2);

    Image img(Geometry(115, 35), Color("white"));
    list<Drawable> drawList;

    drawList.push_back(DrawableTextAntialias(true));
    drawList.push_back(DrawableFont("../fnt/HAZELN.TTF"));
    drawList.push_back(DrawablePointSize(32));
    drawList.push_back(DrawableStrokeColor(Color("black")));
    drawList.push_back(DrawableFillColor(Color(0, 0, 0, MaxRGB)));
    drawList.push_back(DrawableTextDecoration(UnderlineDecoration));
    drawList.push_back(DrawableGravity(CenterGravity));


    drawList.push_back(DrawableRotation(rotate));
    drawList.push_back(DrawableRotation(skew));
    drawList.push_back(DrawableText(0, 0, captcha));

    img.draw(drawList);


    string capPath;

    do {
        capPath = "../tmp/captcha-";
        capPath += lexical_cast<string>(rand());
        capPath += ".png";
    } while (System::FileExists(capPath));


    img.write(capPath);

    WMemoryResource *capResource = new WMemoryResource("image/png");

    char *buffer = NULL;
    size_t size = 0;
    System::ReadFile(capPath, size, &buffer);

    capResource->setData(reinterpret_cast<const unsigned char*>(buffer),
                         static_cast<int>(size));

    delete buffer;

    System::EraseFile(capPath);

    WImage *capImage = new WImage(capResource, "Captcha");
    capImage->setStyleClass("captcha");

    return capImage;
}
Example #28
0
 // Copy the contents from another image which is just a convenience to cvCopy
 void CopyFrom(const WImage<T>& src) { cvCopy(src.Ipl(), image_); }
Example #29
0
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;
  }
}
Example #30
0
 // Copy constructor
 WImageView(const WImage<T>& img) : WImage<T>(0) {
     header_ = *(img.Ipl());
     WImage<T>::SetIpl(&header_);
 }