示例#1
0
void VcardForm::onWmUserUpdate() {
    //std::string xml=*(vcard->toXML());
    //const std::string &xml2=XMLStringPrep(xml);
    //const std::wstring xml3=utf8::utf8_wchar(xml2);

    //SendMessage(hwndHTML, WM_SETTEXT, 0, (LPARAM)"");

    //img.reset();

	imgFile=appRootPath;// + L"userdata\\avatars\\" + L"$$$_tmp.jpg";

	if (savePhoto(imgFile.c_str())){
        //img=ImageRef(new Image(imgFile.c_str()));
		//Contact::ref contact = Contact::ref(new Contact(this->jid,"","","",""));
		//contact->img_avatar=img;
	}


    startHtml();
    addImg(L"\\vcard");
    beginForm("vcard-photo", "photo");
    if (img) if (img->getHBmp()) {
        button("save",std::string("Save")); 
        if (editForm) button("clear",std::string("Clear")); 
    }
    if (editForm) button("load",std::string("Load")); 
    addText("<BR>");
    endForm(); 

	//contact->img_avatar=img;
    

    beginForm("vcard-fields", "publish");

    addHtmlField("FN", NULL,        "Full Name", TXT);
    addHtmlField("NICKNAME", NULL,  "Nickname", TXT);
    addHtmlField("BDAY", NULL,      "Birthday", TXT);
    addHtmlField("ADR", "STREET",   "Street", TXT);
    addHtmlField("ADR", "EXTADR",   "Street2", TXT);
    addHtmlField("ADR", "LOCALITY", "City", TXT);
    addHtmlField("ADR", "REGION",   "State", TXT);
    addHtmlField("ADR", "PCODE",    "Post code", TXT);
    addHtmlField("ADR", "CTRY",     "Country", TXT);
    addHtmlField("TEL", "HOME",     "Home Phone Number", TXT);
    addHtmlField("TEL", "NUMBER",   "Phone Number", TXT);
    addHtmlField("EMAIL", "USERID", "E-Mail", URL);
    addHtmlField("TITLE", NULL,     "Position", TXT);
    addHtmlField("ROLE", NULL,      "Role", TXT);
    addHtmlField("ORG", "ORGNAME",  "Organization", TXT);
    addHtmlField("ORG", "ORGUNIT",  "Dept", TXT);
    addHtmlField("URL", NULL,       "Url", URL);
    addHtmlField("DESC", NULL,      "About", MULTILINE);

    if (editForm) button(std::string("Publish"));
    //button("reload",std::string("Reload")); 
    endForm();

    endHtml();
}
示例#2
0
void CaptchaForm::onSubmit( JabberDataBlockRef replyForm ) {

    JabberDataBlock answer("iq", NULL);
    answer.setAttribute("type", "set");
    answer.setAttribute("id", id);
    answer.setAttribute("to", jid);

    answer.addChildNS("challenge", "urn:xmpp:tmp:challenge")->addChild(replyForm);
    
    ResourceContextRef rc=this->rc.lock();
    if (rc) {
        rc->jabberStream->sendStanza(answer);

        startHtml();
        addText("Done");
        endForm();

    }
}