Esempio n. 1
0
WWidget *FormWidgets::wTextArea()
{
  WContainerWidget *result = new WContainerWidget();

  topic("WTextArea", result);
  addText(tr("formwidgets-WTextArea"), result);

  WTextArea *ta = new WTextArea(result);
  ta->setColumns(80);
  ta->setRows(15);
  ta->setText(tr("formwidgets-WTextArea-contents"));
  ed_->showSignal(ta->changed(), "Text area changed");
 
  addText(tr("formwidgets-WTextArea-related"), result);

  return result;
}
Esempio n. 2
0
void Recaptcha::update_impl() {
    if (!implementation()) {
        setImplementation(new WContainerWidget());
    }
    get_impl()->clear();
    WText* title = new WText("reCAPTCHA", get_impl());
    title->addStyleClass("wc_recaptcha_title");
    if (js()) {
        WContainerWidget* image = new WContainerWidget(get_impl());
        image->setId("recaptcha_image");
        response_field_ = input_ ? input_ : new WLineEdit(get_impl());
        challenge_field_ = new WLineEdit(get_impl());
        // not challenge_field_->hide() to get its .text()
        doJavaScript("$(" + challenge_field_->jsRef() + ").hide();");
        response_field_->setId("recaptcha_response_field");
        doJavaScript("Recaptcha.create('" + public_key_  + "', '',"
                     "{theme: 'custom'});");
        if (buttons_enabled_) {
            add_buttons();
        }
        doJavaScript("clearTimeout($(" + jsRef() + ").data('timer'));");
        doJavaScript("$(" + jsRef() + ").data('timer',"
                     "setInterval(function() {"
                     "$(" + challenge_field_->jsRef() + ")"
                     ".val(Recaptcha.get_challenge());"
                     "}, 200));");
    } else {
        WTemplate* iframe = new WTemplate(get_impl());
        iframe->setTemplateText("<iframe src='https://www.google.com/recaptcha/"
                                "api/noscript?k=" + public_key_ +
                                "' height='300' width='500' frameborder='0'>"
                                "</iframe>", XHTMLUnsafeText);
        if (input_) {
            challenge_field_ = input_;
        } else {
            WTextArea* ta = new WTextArea(get_impl());
            ta->setColumns(40);
            ta->setRows(3);
            challenge_field_ = ta;
        }
        response_field_ = new WLineEdit("manual_challenge", get_impl());
        response_field_->hide();
    }
}
Esempio n. 3
0
CShowLog::CShowLog(WContainerWidget *parent):
WContainerWidget(parent)
{
	refreshCount=0;

	string strTemp1,strTemp2;
	OBJECT objRes=LoadResource("default", "localhost");  
	if( objRes !=INVALID_VALUE )
	{	
		MAPNODE ResNode=GetResourceNode(objRes);
		if( ResNode != INVALID_VALUE )
		{
			FindNodeValue(ResNode,"IDS_LogShow",strMainTitle);
			FindNodeValue(ResNode,"IDS_ReadLogError",strTemp1);
			FindNodeValue(ResNode,"IDS_MonitorLogContext",strTemp2);
		}
		CloseResource(objRes);
	}
	
	
	char buf_tmp[4096]={0};
    int nSize =4095;


	GetEnvironmentVariable( "QUERY_STRING", buf_tmp,nSize);
	//char * tmpquery;
	//tmpquery = getenv( "QUERY_STRING");
	//if(tmpquery)
	//	strcpy(buf_tmp,tmpquery);
	if(buf_tmp != NULL)
	{
		std::string buf1 = buf_tmp;
		int pos = buf1.find("=", 0);
		querystr = buf1.substr(pos+1, buf1.size() - pos - 1);
	}
	
	strPath = "";
	strPath += GetSiteViewRootPath();
	strPath += "\\data\\Temp\\";
	strPath += querystr;
	strPath += ".txt";

	string   strTemp; 
	string   strOutput;

	try
	{
		ifstream  Input(strPath.c_str(), ios::out); 
			//获取日志行数
			nTotleLine = 0;
			nCurLine = 0;
			nPageLine = 100;

		if(Input.is_open())
		{
		
			while(!Input.eof())   
			{   
				nTotleLine++;
				getline(Input, strTemp , '\n');
				//puts(strTemp.c_str());
			}

			Input.close(); 
		}
		
		//获取日志最新100行数数据
		nStartLine = nTotleLine - nPageLine;

		//Input.open(strPath.c_str(), ios::out, 0);

		ifstream  Input1(strPath.c_str(), ios::out); 
		if(Input1.is_open())
		{
			while(!Input1.eof())   
			{   
				if(nTotleLine <= nPageLine)
				{
					getline(Input1, strTemp , '\n');
					strOutput += strTemp;
					strOutput += "\n";
				}
				else
				{
					if(nCurLine >=  nStartLine)
					{
						getline(Input1, strTemp , '\n');
						strOutput += strTemp;
						strOutput += "\n";
					}
					else
						getline(Input1, strTemp , '\n');
					
					nCurLine++;
				}
			}

			Input1.close(); 
		}

	}
	catch(...)
	{
		strOutput = strTemp1;
	}

	WTable * pContainTable = new WTable(this);
	
	//日志标题
	string strLogTitle = GetDeviceTitle(querystr);
	strLogTitle += ":";
	strLogTitle += GetMonitorPropValue(querystr, "sv_name");
	strLogTitle += strTemp2;


	pContainTable ->setStyleClass("t5");
	//pContainTable->setStyleClass("StatsTable");
	WText * pReportTitle = new WText(strLogTitle, (WContainerWidget*)pContainTable->elementAt(0, 0));
	pContainTable->elementAt(0, 0)->setContentAlignment(AlignTop | AlignCenter);
	WFont font1;
	font1.setSize(WFont::Large, WLength(60, WLength::Pixel));
	pReportTitle ->decorationStyle().setFont(font1);


	//日志内容
	WTextArea * pStateTextArea = new WTextArea(strOutput, (WContainerWidget*)pContainTable->elementAt(1, 0));
	//pContainTable->elementAt(1, 0)->setStyleClass("t5");
	pContainTable->elementAt(1, 0)->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));
	pStateTextArea->setRows(nPageLine);
	pStateTextArea->setColumns(60);
	pStateTextArea ->setStyleClass("testingresult2");
	//pStateTextArea->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));
	pStateTextArea->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage));

	strcpy(pStateTextArea->contextmenu_ , "readonly=\"readonly\"");

	//strPageTitle = "";
	//new WText("日志内容:", pMainTable->elementAt(4, 0));
	//new WText(strOutput, pMainTable->elementAt(2,0));

	//版权信息
	WText * bottomTitle = new WText("Copyright SiteView", pContainTable->elementAt(2, 0));
	bottomTitle ->decorationStyle().setFont(font1);
	pContainTable->elementAt(2, 0)->setContentAlignment(AlignTop | AlignCenter);
	bottomTitle->decorationStyle().setForegroundColor(Wt::blue);
}