user_msgs;
IMAGES_SIZE imgsizes;
{
CONNECT_HTTP_INFO webcon;
// We initialize the webcon using what was returned by readuserinfo.
// But if the user is not in the directory, we have to guess
if (info.nodename[0] != '\0'){
webcon.init(info.nodename);
}else{
// Here we guess it is using https
string url = string_f("https://%s",glocal.server.c_str());
webcon.init(url);
}
(webcon,glocal.local_name,0,3);
if (success){
glocal.user_has_msgs = true;
for (auto &m:messages){
glocal.user_msgs.push_back(m);
}
}
}
DIV d("textgrow","showentry"); d.bg("#BFE4FF").w(100).h(100).autoscroll().print();
auto actions = [&](){
// Actions doable on this user
DIV dd; dd.bg("white").w(95).marginleftauto().marginrightauto().vmargins(5,5).paddings(5,5).borderradius(10).print();
{
DIV txt; txt.w(100).textalign("center").fontsize(imgsizes.medium_font_size).print();
/-#T_ACTIONS Actions
}
if (is_eq(userinfo.name,glocal.user)){
/-#I_NOACTIONONYOU No action on yourself
}else{
DIV table; table.table().w(100).print();
{
DIV td2; td2.td().paddings(20,0).textalign("left"); // Used in copy later, no print()
DIV td3; td3.td().paddings(30,0).textalign("right"); // Used in copy later, no print()
DIV tr; tr.tr().print();
{
DIV td; td.td().print();
htmlprintf ("%s",MSG_R(T_CONTACTS));
}
{
DIV td; td.copy(td2).print();
auto status = msgs_relation_status(glocal.con,glocal.user);
if (status == RELATION_STATUS::NONE){
htmlprintf (MSG_U(I_NOTCONNECTEDWITH,"Not connected with user %s"),glocal.user);
td.copy(td3).print();
DIV msg("linkbutton"); msg.title(string_f(MSG_U(I_SENDCONTACTREQTO,"Send a contact request to %s"),glocal.user));
msg.params("onclick=formsubmit('/index.hc?webstep=%d&webtab_add=1:Contact-req~%s&webtab_add2=2:sendcontact~%s&recipients=%s')"
,step_profile,url_encode(MSG_R(T_CONTACT_REQS)).c_str()
,url_encode(MSG_R(I_CONTACTREQUEST)).c_str(),glocal.user);
msg.print();
htmlprintf ("%s\n",MSG_R(I_SENDCONTACT));
}else if (status == RELATION_STATUS::CONNECTED){
/-#I_YOUARECONNECTED You are connected
td.copy(td3).print();
DIV msg("linkbutton"); msg.title(string_f(MSG_U(I_SENDMSGTO,"Send a message to %s"),glocal.user));
msg.params("onclick=formsubmit('/index.hc?webstep=%d&webtab_add=1:%s:inbox/%s~%s')"
,step_talks,userinfo.name.c_str(),glocal.user,glocal.user);
msg.print();
/-#I_SENDMESSAGE Send a message
}else if (status == RELATION_STATUS::REJECTED){
htmlprintf (MSG_U(I_USERHASREJECTEDYOU,"%s has rejected your connection request"),glocal.user);
}else if (status == RELATION_STATUS::REJECTED_BY_YOU){
htmlprintf (MSG_U(I_YOUREJECTEDUSER,"You rejected the connection request from %s"),glocal.user);
}else if (status == RELATION_STATUS::WAITING){
htmlprintf (MSG_U(I_YOUSENTCONTACTREQ,"You sent a contact request to %s. Waiting"),glocal.user);
}else if (status == RELATION_STATUS::WAITING_FOR_YOU){
htmlprintf (MSG_U(I_USERSENTREQUEST,"%s sent a contact request, waiting for your answer"),glocal.user);
td.copy(td3).print();
DIV msg("linkbutton"); msg.title(MSG_U(I_MANAGECONTACTS,"Manage contacts"));
msg.params("onclick=formsubmit('/index.hc?webstep=%d&webtab_add=1:Contacts~%s')"
,step_profile,MSG_R(T_CONTACT_REQS));
msg.print();
htmlout (MSG_R(I_MANAGECONTACTS));
}
}
tr.tr().print();
{
DIV td; td.td().print();
htmlprintf ("%s",MSG_R(T_INTERESTS));
}
{
DIV td; td.copy(td2).print();
bool interest = msgs_interest(glocal.con,glocal.user);
if (interest){
htmlprintf (MSG_U(I_YOUARESUBSCRIBED,"You are subscribed to %s"),glocal.user);
td.copy(td3).print();
DIV msg("linkbutton"); msg.title(MSG_U(I_MANAGEINTERESTS,"Manage interests"));
msg.params("onclick=formsubmit(\"/index.hc?webstep=%d&webtab_add=1:Interests~%s\")"
,step_profile,url_encode(MSG_R(T_INTERESTS)).c_str());
msg.print();
htmlout (MSG_R(I_MANAGEINTERESTS));
}else{
htmlprintf (MSG_U(I_YOUARENOTSUBSCRIBED,"You are not subscribed to %s"),glocal.user);
td.copy(td3).print();
DIV msg("linkbutton"); msg.title(string_f(MSG_U(I_ADDINTERESTUSER,"Add interest for user %s"),glocal.user));
msg.params("onclick=formsubmit(\"/index.hc?webstep=%d&webtab_add=1:Interests~%s&webtab_add2=2:interest~%s&name=%s&list=%s\")"
,step_profile,url_encode(MSG_R(T_INTERESTS)).c_str()
,url_encode(MSG_R(I_NEWINTEREST)).c_str()
,glocal.user,MSG_R(I_0_NEWS));
msg.print();
htmlprintf (MSG_R(I_ADDINTERESTUSER),glocal.user);
}
}
}
}
};
auto messages = [&](){
// Messages published by this user
DIV dd; dd.bg("white").w(95).marginleftauto().marginrightauto().vmargins(5,5).paddings(5,5).borderradius(10).print();
{
DIV txt; txt.w(100).textalign("center").fontsize(imgsizes.medium_font_size).print();
/-#I_PUBMESSAGES Public messages
}
glocal imgsizes;
(WEBID("direntry"));
no_autoscroll();
int rownum=0;
for (auto &m:glocal.user_msgs){
setrow ("sep",rownum,"#%s\t%s",m.from.c_str(),util_format_shortmsg(m.content,glocal.imgsizes.image_width).c_str());
rownum++;
}
};
if (!success){
if (internal_error){
htmlprintf ("internal error %d msg=%s\n",internal_error,msg);
}else{
{
DIV dd; dd.bg("white").w(95).h(20).marginleftauto().marginrightauto().vmargins(10,5).paddings(5,5).borderradius(10)
.textalign("center").print();
DIV ddd; ddd.h(100).vpaddings(20,0).fontsize(imgsizes.medium_font_size).print();
htmlprintf (MSG_U(E_NOPUBINFO,"No information about user %s in the public directory\n"),glocal.fulluser.c_str());
}
actions();
messages();
}
}else{
DIV dd; dd.bg("white").w(95).marginleftauto().marginrightauto().vmargins(10,5).paddings(5,5).borderradius(10).print();
{
DIV ddd; ddd.w(100).dispflex().flowrow().print();
DIV img; img.flexfixe().marginleftauto().print();
if (info.mini_photo_modified[0] != '\0'){
htmlprintf ("
\n"
,imgsizes.mini_photo_width,util_getdirserver(),info.user,info.nodename,info.mini_photo_modified);
}
img.end();
DIV txt; txt.flexfixe().vertalign("middle").fontsize_px(imgsizes.large_font_size).margins(5,0).marginrightauto().print();
htmlout (glocal.fulluser);
}
{
// We put the large photo and multiple lines next to it. So we start with a flowrow() and the a flowcol()
DIV row; row.w(100).dispflex().flowrow().print();
if (info.photo_modified[0] != '\0'){
DIV img; img.flexfixe().print();
htmlprintf ("
\n"
,imgsizes.photo_width,util_getdirserver(),info.user,info.nodename,info.photo_modified);
}
DIV col; col.w(100).dispflex().flowcol().print();
{
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s\n"
,imgsizes.large_font_size,info.fullname);
}
{
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s %s\n",MSG_R(I_SINCE),format_date(userinfo.dateformat,info.created).c_str());
}
if (info.email[0] != '\0'){
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s %s\n",MSG_R(F_EMAIL),info.email);
}
if (info.city[0] != '\0'){
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s\n",info.city);
}
{
DIV one; one.flexfixe().paddings(5,5).margins(5,0).vmargins(5,0).borderradius(5).border(1,"lightgray").print();
html_r_printf ("%s\n",util_format_shortmsg(info.interest,imgsizes.image_width).c_str());
}
}
if (info.website[0] != '\0' || info.bolixosite[0] != '\0'){
/-
DIV site; site.w(100).table().print();
if (info.website[0] != '\0'){
dir_row (MSG_R(F_WEBSITE),info.website,false,true);
}
if (info.bolixosite[0] != '\0'){
dir_row (MSG_R(F_BOLIXOSITE),info.bolixosite,false,true);
}
}
dd.end();
msgs_show_address(info);
actions();
// Server information
dd.bg("white").w(95).marginleftauto().marginrightauto().vmargins(5,5).paddings(5,5).borderradius(10).print();
{
DIV ddd; ddd.w(100).dispflex().flowrow().print();
DIV txt; txt.flexfixe().vertalign("middle").fontsize_px(imgsizes.large_font_size).marginleftauto().marginrightauto().print();
htmlprintf ("%s %s\n",MSG_U(I_HOSTEDON,"Hosted on"),glocal.server.c_str());
}
{
// We put the large photo and multiple lines next to it. So we start with a flowrow() and the a flowcol()
DIV row; row.w(100).dispflex().flowrow().print();
if (server.photo_modified[0] != '\0'){
DIV img; img.flexfixe().print();
htmlprintf ("
\n"
,imgsizes.photo_width,util_getdirserver(),"",info.nodename,server.photo_modified);
}
DIV col; col.w(100).dispflex().flowcol().print();
{
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s %s\n",MSG_R(I_SINCE),format_date(userinfo.dateformat,server.created).c_str());
}
if (server.email[0] != '\0'){
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s %s\n",MSG_R(F_EMAIL),server.email);
}
if (server.city[0] != '\0'){
DIV one; one.flexfixe().margins(5,0).print();
htmlprintf ("%s\n",server.city);
}
{
DIV one; one.flexfixe().paddings(5,5).margins(5,0).vmargins(5,0).borderradius(5).border(1,"lightgray").print();
html_r_printf ("%s\n",util_format_shortmsg(server.description,imgsizes.image_width).c_str());
}
}
/-
{
DIV site; site.w(100).table().print();
if (server.website[0] != '\0'){
dir_row (MSG_R(F_WEBSITE),server.website,false,true);
}
dir_row4 (MSG_U(I_DOMAIN,"domain"),server.domain.domain,MSG_U(I_CREATIONDATE,"Creation date"),server.domain.creation_date);
dir_row4 ("","",MSG_U(I_UPDATEDDATE,"Updated date"),server.domain.updated_date);
dir_row4 ("","",MSG_U(I_EXPIRYDATE,"Expiry date"),server.domain.expiry_date);
dir_row4 ("","",MSG_U(I_REGISTRAR,"Registrar"),server.domain.registrar);
}
dd.end();
msgs_show_address(server);
messages();
}