");
htmlprintf ("%s | \n",title,colspan);
char tmp[100];
snprintf (tmp,sizeof(tmp),"size=%u",size);
c->field_string (var,tmp);
}
static void index_field (_F_form *c, bool newline, const char *title, W_SSTRING &var)
{
index_field (c,newline,1,title,var,25);
}
/*
Define a form field to edit the access of a group within a list
*/
static void index_field_access (_F_form *c, W_VAR &var)
{
c->field_list (var,"");
c->field_list_item ("",MSG_U(I_INHERIT,"inherit"));
c->field_list_item ("R",MSG_U(I_READONLY,"read-only"));
c->field_list_item ("W",MSG_U(I_READWRITE,"read-write"));
c->field_list_end();
}
static void index_field_group (_F_form *c, W_VAR &var, const vector &groups)
{
c->field_list (var,"");
c->field_list_item("","");
for (auto &s:groups) c->field_list_item (s.c_str(),s.c_str());
c->field_list_end();
}
/*
Update a group definition in a list
*/
static void index_set_group (CONNECT_INFO &con, const char *list, const char *group, const char *access, bool &fail)
{
glocal bool fail = false;
glocal const char *groupname = group;
(con,w_session.c_str(),list,glocal.groupname,access,"");
if (!success){
htmlprintf (MSG_U(E_UPDGROUP,"Failure to update group %s: %s \n"),glocal.groupname,msg);
glocal.fail = true;
}
if (glocal.fail) fail = true;
}
static void index_set_group (CONNECT_INFO &con, const char *list, W_SSTRING &group, W_SSTRING &access, vector &groups, bool &fail)
{
const char *groupname = group.c_str();
if (groupname[0] != '\0'){
groups.push_back(groupname);
index_set_group (con,list,groupname,access.c_str(),fail);
}
}
static void index_delete_new_from_old(const vector &news, vector &old)
{
for (auto &n:news){
auto p = find(old.begin(),old.end(),n);
if (p != old.end()){
old.erase(p);
}
}
}
static const char *adding = "__add__";
static bool profile_formactive (_F_webtabs &c, W_SSTRING &var)
{
const char *state = c.getstate();
if (w_add.isset()){
c.setstate(adding);
}else if (var.isset()){
c.setstate(var.c_str());
}else if (state[0] != '\0'){
if (strcmp(state,adding)==0){
w_add.setinitval("1");
}else{
var.setinitval(state);
}
}
return var.isset() || w_add.isset();
}
static bool profile_formactive (_F_webtabs &c)
{
const char *state = c.getstate();
if (w_add.isset()){
c.setstate(adding);
}else if (state[0] != '\0'){
if (strcmp(state,adding)==0){
w_add.setinitval("1");
}
}
return w_add.isset();
}
/*
Return the proper image to tell if this ID has a notification or not
*/
static const char *profile_notify_icon (const string &id)
{
string tmp = string("profile:")+id;
return userinfo.notifies.count(tmp) > 0 ? "/new.png" : "/seen.png";
}
/*
Set the check boxes for the notitications dialog
*/
static void profile_set_notifies (_F_form &f, PARAM_STRING key)
{
/-
f.field_checkbox(w_notify_ui,key,"");
/- |
f.field_checkbox(w_notify_email,key,"");
}
void profile(CONNECT_INFO &con, CONNECT_INFO &con_sess, vector &docpointers)
{
glocal CONNECT_INFO con = con;
glocal CONNECT_INFO *con_sess = &con_sess;
glocal vector *docpointers = &docpointers;
static unsigned size[5]={15,45,40,0,0};
("profile",tabs,size);
static WEBID id("tab:profiles");
(id,currents[id.c_str()]);
sethead (MSG_U(H_PROFILE,"\tProfiles"));
vector> t={
{"Account",MSG_U(T_ACCOUNT,"Account"),MSG_R(T_ACCOUNT)},
{"Notifications",MSG_U(T_NOTIFICATIONS,"Notifications"),MSG_R(T_NOTIFICATIONS)},
{"Interests",MSG_U(T_INTERESTS,"Interests"),MSG_R(T_INTERESTS)},
{"Contacts",MSG_U(T_CONTACTS,"Contacts"),MSG_U(T_CONTACTSTOYOU,"Contact requests to you")},
{"Contact-req",MSG_U(T_CONTACT_REQS,"Requests"),MSG_U(T_REQUESTSBYYOU,"Contact requests from you")},
{"Projects",MSG_U(T_PROJECTS,"Projects"),MSG_R(T_PROJECTS)},
{"Groups",MSG_U(T_GROUPS,"Groups"),MSG_R(T_GROUPS)}
};
unsigned rownum=0;
unsigned status_width = tlmpweb_ismobile() ? 60 : 20;
for (auto s:t){
if (glocal.webtabs.selected(get<0>(s))) setcurrent(rownum);
string add = string_f("webtab_add=1:%s~%s",get<0>(s).c_str(),get<1>(s).c_str());
setclickopt (true,"",add);
setrow ("white",rownum," \t%s",status_width,profile_notify_icon(get<0>(s)),get<2>(s).c_str());
rownum++;
}
DIV f("webtable"); f.print();
if (strcmp(id,"helpgroups")==0){
index_doc((*glocal.docpointers)[SECTION_GROUPS],section_groups);
}else if (strcmp(id,"helpprojects")==0){
index_doc((*glocal.docpointers)[SECTION_PROJECTS],section_projects);
}else if (strcmp(id,"helpcontacts")==0){
index_doc((*glocal.docpointers)[SECTION_CONTACTS],section_contacts);
}else if (strcmp(id,"helpcontact-req")==0){
index_doc((*glocal.docpointers)[SECTION_CONTACT_REQ],section_contact_req);
}else if (strcmp(id,"helpaccount")==0){
index_doc((*glocal.docpointers)[SECTION_ACCOUNT],section_account);
}else if (strcmp(id,"helpinterests")==0){
index_doc((*glocal.docpointers)[SECTION_INTERESTS],section_interests);
}else if (strcmp(id,"helpnotifications")==0){
index_doc((*glocal.docpointers)[SECTION_NOTIFICATIONS],section_notifications);
}else if (strcmp(id,"helpmain")==0){
index_doc((*glocal.docpointers)[SECTION_NONE],section_none);
}else if (strncmp(id,"project:",8)==0){
glocal const char *prjname = id+8;
glocal bool adding = glocal.prjname[0] == '\0';
(id);
/- |
if (!glocal.adding) htmlprintf ("%s | %s \n",MSG_U(T_PROJECT,"Project"),glocal.prjname);
/- | |
(glocal.con,w_session.c_str(),"");
for (auto &l:lists){
if (strcmp(l.name,glocal.prjname)==0){
w_desc = l.description;
for (unsigned i=0; i
glocal vector groups;
// PATCH: Group contacts is not returned by list_groups
// For the public group, it is necessary. Maybe other projects would
// need access to special group contact...
if (strcmp(glocal.prjname,"public")==0) glocal.groups.push_back("contacts");
(glocal.con,w_session.c_str(),"",true);
for (auto &g:groups) glocal.groups.push_back(g.name);
if (glocal.adding){
htmlprintf ("%s | \n",MSG_U(I_PRJ_PROJECT,"Project"));
field_string (w_list,"size=30");
}
htmlprintf (" | %s | ",MSG_U(I_PRJ_DESCRIPTION,"Description"));
field_string (w_desc,"style=width:100%");
/- |
/-#I_PRJ_MEMBERS | Members |
/-#I_PRJ_GROUP Group | Access
/- |
---|
index_field_group (this,w_group1,glocal.groups);
/- |
index_field_access (this,w_access1);
/- |
index_field_group (this,w_group2,glocal.groups);
/- |
index_field_access (this,w_access2);
/- |
index_field_group (this,w_group3,glocal.groups);
/- |
index_field_access (this,w_access3);
/- |
index_field_group (this,w_group4,glocal.groups);
/- |
index_field_access (this,w_access4);
/- |
/- |
button_submit();
bool ret = true;
if (strcmp(w_desc.c_str(),"a")==0){
ret = false;
/- a is not allowed
/-
}
return ret;
glocal bool fail = false;
if (glocal.adding){
glocal.prjname = w_list.c_str();
(glocal.con,w_session.c_str(),w_list.c_str(),"");
if (!success){
glocal.fail = true;
htmlprintf ("Can't create list: %s\n",msg);
}else{
}
}
if (!glocal.fail){
glocal vector oldgroups;
(glocal.con,w_session.c_str(),"");
for (auto &l:lists){
if (strcmp(l.name,glocal.prjname)==0){
for (auto g:l.groups) glocal.oldgroups.push_back(g);
break;
}
}
(glocal.con,w_session.c_str(),glocal.prjname,w_desc.c_str(),"");
if (!success){
/- error
glocal.fail = true;
}
vector newgroups;
index_set_group (glocal.con,glocal.prjname,w_group1,w_access1,newgroups,glocal.fail);
index_set_group (glocal.con,glocal.prjname,w_group2,w_access2,newgroups,glocal.fail);
index_set_group (glocal.con,glocal.prjname,w_group3,w_access3,newgroups,glocal.fail);
index_set_group (glocal.con,glocal.prjname,w_group4,w_access4,newgroups,glocal.fail);
if (!glocal.fail){
// We have to remove the groups that are gone
index_delete_new_from_old(newgroups,glocal.oldgroups);
// what remains in oldgroups have to be deleted (setting access to - does this)
for (auto &g:glocal.oldgroups) index_set_group (glocal.con,glocal.prjname,g.c_str(),"-",glocal.fail);
}
}
fail = glocal.fail;
if (!fail){
if (glocal.adding){
glocal.webtabs.redotab();
resetstate();
}
keepediting = true;
reload();
}
}else if (strncmp(id,"group:",6)==0){
glocal const char *grpname = id+6;
glocal bool adding = glocal.grpname[0] == '\0';
(id);
/- |
if (!glocal.adding) htmlprintf ("%s | %s \n",MSG_R(I_GROUP),glocal.grpname);
/- | |
(glocal.con,w_session.c_str(),"",true);
for (auto &g:groups){
if (strcmp(g.name,glocal.grpname)==0){
w_desc = g.description;
w_content = "";
for (unsigned i=0; i
if (glocal.adding){
htmlprintf ("%s | ",MSG_U(I_GROUP,"Group"));
field_string (w_group,"size=30");
}
/-#I_DESCRIPTION | Description |
field_string (w_desc,"style=width:100%");
/- |
/-#I_MEMBERS | Members |
field_textarea (w_content,20,-100,"");
/- |
button_submit();
bool ret = true;
return ret;
glocal bool fail = false;
if (glocal.adding){
glocal.grpname = w_group.c_str();
(glocal.con,w_session.c_str(),glocal.grpname,"");
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CANTCREATEGROUP,"Can't create group: %s \n"),msg);
}else{
// The group has been added, the tab name will change.
glocal.webtabs.setid(string_f("group:%s",glocal.grpname));
glocal.webtabs.settitle(string_f("%s %s",MSG_R(I_GROUP),glocal.grpname));
}
}
if (!glocal.fail){
glocal vector oldusers;
(glocal.con,w_session.c_str(),"",true);
for (auto &g:groups){
if (strcmp(g.name,glocal.grpname)==0){
for (auto u:g.users) glocal.oldusers.push_back(u);
break;
}
}
(glocal.con,w_session.c_str(),glocal.grpname,w_desc.c_str(),"");
if (!success){
htmlprintf (MSG_U(E_CANTSETGROUPDESC,"Can't set group description: %s \n"),msg);
glocal.fail = true;
}
vector newusers,newaccesses,newroles;
const char *pt = w_content.c_str();
while (*pt != '\0'){
string word;
pt = str_copyword(word,pt);
vector tb;
int n = str_splitline(word.c_str(),':',tb);
if (n > 0){
while (tb.size() < 3) tb.push_back("");
newusers.push_back (tb[0]);
newaccesses.push_back(tb[1]);
newroles.push_back(tb[2]);
}
}
for (unsigned i=0; !glocal.fail && i(glocal.con,w_session.c_str(),glocal.grpname
,glocal.user,newaccesses[i].c_str(),newroles[i].c_str(),"");
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CANTSETMEMBER,"Can't set member %s: %s\n"),glocal.user,msg);
}
}
if (!glocal.fail){
// We have to remove the groups that are gone
index_delete_new_from_old(newusers,glocal.oldusers);
// what remains in oldusers have to be deleted (setting access to - does this)
for (auto &g:glocal.oldusers){
glocal const char *user = g.c_str();
(glocal.con,w_session.c_str(),glocal.grpname
,glocal.user,"-","","");
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CANTDELMEMBER,"Can't delete member %s: %s\n"),glocal.user,msg);
}
}
}
}
fail = glocal.fail;
if (!fail){
if (glocal.adding){
glocal.webtabs.redotab();
resetstate();
}
keepediting = true;
reload();
}
}else if (strcmp(id,"sendcontact")==0){
glocal bool done = false;
(id);
/- |
// /-
/- |
/-#I_SENDCONTACT Send a contact request
/- |
htmlprintf ("%s | \n",MSG_U(I_TOCONTACT,"Person to contact"));
field_string (w_user,"style=width:100%");
htmlprintf (" | %s | \n",MSG_U(I_MESSAGE,"Message"));
field_textarea (w_content,10,-100,"");
/- |
button_submit();
return true;
glocal bool fail = false;
(glocal.con,w_session.c_str(),"",w_user.c_str(),w_content.c_str());
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CONTACTFAIL,"Contact request failed: %s \n"),msg);
}else{
glocal.done = true;
}
fail = glocal.fail;
if (glocal.done){
/-#I_CONTACTSENT Contact request sent!
}
}else if (strncmp(id,"manage:",7)==0){
glocal bool done = false;
glocal CONTACT_STATUS status = CONTACT_WAITING;
glocal string user = id+7;
(id);
/- |
/- |
/-#I_MANAGECONTACT Manage a contact
/- | |
(glocal.con,w_session.c_str(),"",true,glocal.user,0,1);
if (contacts.size() == 1){
auto &c = contacts[0];
w_content = c.message;
}
field_hidden(w_user);
/-
/-#I_REQUESTFROM Request from
/- |
htmlout (glocal.user);
/- |
htmlout (MSG_R(I_MESSAGE));
/- |
field_textarea(w_content,5,-100,"readonly");
/- |
/-#I_ACCEPTREQ Accept request
/- |
field_radio(w_accept,"accept",true,"");
/- |
/-#I_REFUSEREQ Refuse request
/- |
field_radio(w_accept,"reject",false,"");
/- |
button_submit();
return true;
glocal bool fail = false;
if (strcmp(w_accept.c_str(),"accept")==0){
glocal.status = CONTACT_ACCEPTED;
}else if (strcmp(w_accept.c_str(),"reject")==0){
glocal.status = CONTACT_REJECTED;
}else{
glocal.fail = true;
/- Invalid input ???
}
if (!glocal.fail){
(glocal.con,w_session.c_str(),"",glocal.user,glocal.status);
if (!success){
glocal.fail = true;
htmlprintf ("operation failed: %s \n",msg);
}else{
glocal.done = true;
}
}
fail = glocal.fail;
if (glocal.done){
/- |
/-#I_CONTACTDONE Contact request processed!
/-
if (glocal.status == CONTACT_ACCEPTED){
htmlprintf (MSG_U(I_FROMNOWON,"From now on, you can communicate with user %s \n"),glocal.user.c_str());
htmlprintf (MSG_U(I_MAKEMEMBER,"You can make user %s member of your groups \n"),glocal.user.c_str());
/-#I_HEMAKEMEMBER and he can make you member of his groups.
}
/- |
|
glocal.webtabs.setstate("");
}
}else if (strcmp(id,"interest")==0){
glocal bool done = false;
(id);
/- |
/- |
/-#I_ADDINTEREST Add more interesting people
/- | |
htmlprintf ("%s | \n",MSG_U(I_PEOPLES,"Peoples"));
field_textarea (w_content,10,-100,"");
/- |
button_submit();
return true;
glocal string error;
glocal bool fail = false;
glocal vector users;
const char *pt = w_content.c_str();
while (*pt != '\0'){
pt = str_skip(pt);
if (*pt > ' '){
const char *start = pt;
while (*pt > ' ') pt++;
glocal.users.push_back(string(start,pt-start));
}
}
// Check if some are already in the interest list
(glocal.con,w_session.c_str(),"");
for (auto u:users){
if (find(glocal.users.begin(),glocal.users.end(),u.name)!=glocal.users.end()){
glocal.error += string_f(" %s",u.name);
glocal.fail = true;
}
}
if (!glocal.fail){
for (auto u:glocal.users){
glocal const char *user = u.c_str();
(glocal.con,w_session.c_str(),u,"");
if (!success){
htmlprintf (MSG_U(E_INTERESTSET,"Can't add user %s in interest list: %s \n")
,glocal.user,msg);
glocal.fail = true;
}
if (glocal.fail) break;
}
}else{
htmlprintf ("%s %s ",MSG_U(E_INTERESTDUP,"These people are already in your interest list"),glocal.error.c_str());
}
fail = glocal.fail;
if (!fail) glocal.webtabs.setstate("");
}
if (strcmp(id,"Projects")==0){ // CONF projects
sethelp("helpprojects",MSG_U(I_HELPPROJECTS,"Projects"));
{
DIV t; t.id(TAB_FORM).print();
url_self (string_f("webtab_add=2:project:~%s",MSG_U(I_NEWPRJ,"New project")),MSG_U(I_CREATELIST,"Create a new project"));
/-
}
static WEBID id ("list:projects");
(id,currents[id.c_str()]);
sethead (MSG_U(H_PROF_PROJECTS,"Project\tMembers\tAccess"));
(glocal.con,w_session.c_str(),"");
unsigned rownum=0;
for (auto &l:lists){
if (l.name[0] != '#'){
string id = string_f("project:%s",l.name);
string add = string_f("webtab_add=2:%s~%s %s",id.c_str(),MSG_R(I_PROJECT),l.name);
glocal.webtable.setclickopt (true,"",add);
if (glocal.webtabs.selected(id)) glocal.webtable.setcurrent(rownum);
glocal.webtable.setrow ("sep",rownum,"%s\t%s\a",l.name,l.description);
glocal.webtable.setclickopt (false,"","");
for (unsigned i=0; i
}else if (strcmp(id,"Groups")==0){ // CONF groups
sethelp("helpgroups",MSG_U(I_HELPGROUPS,"Groups"));
{
DIV t; t.id(TAB_FORM).print();
url_self (string_f("webtab_add=2:group:~%s",MSG_U(I_NEWGROUP,"New group")),MSG_U(I_CREATEGROUP,"Create a new group"));
/-
}
static WEBID id ("list:groups");
(id,currents[id.c_str()]);
sethead (MSG_U(H_GROUPS,"Group\tMembers\tAccess\tRole"));
(glocal.con,w_session.c_str(),"",true);
unsigned rownum=0;
for (auto &g:groups){
string id = string_f("group:%s",g.name);
string add = string_f("webtab_add=2:%s~%s %s",id.c_str(),MSG_R(I_GROUP),g.name);
glocal.webtable.setclickopt (true,"",add);
if (glocal.webtabs.selected(id)) glocal.webtable.setcurrent(rownum);
glocal.webtable.setrow ("sep",rownum,"%s\t%s\a\a",g.name,g.description);
glocal.webtable.setclickopt (false,"","");
for (unsigned i=0; i
}else if (strcmp(id,"Contacts")==0 || strcmp(id,"Contact-req")==0){ // CONF contacts
glocal bool to_me = strcmp(id,"Contacts")==0;
util_delnotify (*glocal.con_sess,"profile",id);
if (glocal.to_me){
sethelp("helpcontacts",MSG_U(I_HELPCONTACTS,"Contacts"));
}else{
sethelp("helpcontact-req",MSG_U(I_HELPCONTACT_REQ,"Requests"));
}
if (!glocal.to_me){
DIV f; f.id(TAB_FORM).print();
url_self (string_f("webtab_add=2:sendcontact~%s",MSG_U(I_CONTACTREQUEST,"Contact request")),MSG_U(I_NEWCONTACT,"Send a contact request"));
/-
}
static WEBID ID_CONTACT("list:contacts");
(ID_CONTACT,currents[ID_CONTACT.c_str()],offsets[ID_CONTACT.c_str()],10);
sethead (MSG_U(H_CONTACTS,"User\tDate\tStatus"));
(glocal.con,w_session.c_str(),"",glocal.to_me,"",nbskip,nblines);
static const char *tbstatus[]={MSG_U(I_WAITING,"waiting"),MSG_U(I_ACCEPTED,"accepted"),MSG_U(I_REJECTED,"rejected")};
unsigned rownum = 0;
for (auto &c:contacts){
if (glocal.to_me){
glocal.webtable.setclickopt (true,"",string_f("webtab_add=2:manage:%s~%s %s",c.user,MSG_U(I_MANAGE,"Request from"),c.user));
}
glocal.webtable.setrow("white",rownum,"%s\t%s\t%s",c.user
,format_date(userinfo.dateformat,c.reqdate).c_str(),tbstatus[c.status]);
rownum++;
}
}else if (strcmp(id,"Interests")==0){ // CONF interests
sethelp("helpinterests",MSG_U(I_HELPINTERESTS,"Interests"));
{
DIV f; f.id(TAB_FORM).print();
url_self (string_f("webtab_add=2:interest~%s",MSG_R(I_NEWINTEREST)),MSG_U(I_NEWINTEREST,"Add interests"));
/-
}
static WEBID ID_INTERESTS("list:interests");
(ID_INTERESTS,currents[ID_INTERESTS.c_str()]);
glocal unsigned dropmenu = dropmenu;
glocal unsigned noline = noline;
(glocal.con,w_session.c_str(),"");
if (glocal.noline < users.size() && glocal.dropmenu == MENU_DELETE){
(glocal.con,w_session.c_str()
,users[glocal.noline].name,"");
}
glocal unsigned mini_image_width = tlmpweb_ismobile() ? 60 : 40;
adddrop_opt (MENU_DELETE,MSG_R(M_DELETE));
sethead (MSG_U(H_INTEREST,"\tPerson\tSince"));
(glocal.con,w_session.c_str(),"");
unsigned rownum=0;
for (auto &u:users){
glocal.webtable.setclickopt (true,"",string_f("user=%u:%s",rownum,u.name));
string since = format_date(userinfo.dateformat,u.since);
const char *pt = strchr(u.name,'@');
if (pt!=NULL){
// remote user
string name(u.name,pt-u.name);
const char *site = pt+1;
string link = string_f("https://%s/public/%s",site,name.c_str());
string span = string_f("%s",link.c_str(),u.name);
glocal.webtable.setrow("white",rownum," \t%s\t%s"
,site,name.c_str(),span.c_str(),since.c_str());
}else if (u.visible){
string link = string_f("/public/%s",u.name);
string span = string_f("%s",link.c_str(),u.name);
glocal.webtable.setrow("white",rownum," \t%s\t%s"
,glocal.mini_image_width,u.name,span.c_str(),since.c_str());
}else{
glocal.webtable.setrow("white",rownum," \t%s\t%s"
,u.name,since.c_str());
}
rownum++;
}
}else if (strcmp(id,"Notifications")==0){ // CONF notifications
glocal string status = " ";
sethelp("helpnotifications",MSG_U(I_HELPNOTIF,"Notifications"));
DIV d("webtable"); d.autoscroll().print();
glocal vector keys;
glocal.keys.push_back(NOTIFY_PROFILE_CONTACTS);
glocal.keys.push_back(NOTIFY_PROFILE_CONTACT_REQ);
(glocal.con,w_session.c_str(),"",false);
for (auto &g:groups){
glocal.keys.push_back(string_f("talks:%s:%s",g.owner,g.name));
}
(id);
/-
htmlprintf ("%s",glocal.status.c_str());
/- |
for (auto &k:glocal.keys){
glocal const char *key = k.c_str();
(glocal.con,w_session.c_str(),"",k);
// tlmp_warning ("notify load key=%s ui=%u email=%u\n",glocal.key,ui,email);
w_notify_ui[glocal.key] = ui;
w_notify_email[glocal.key] = email;
}
(glocal.con,w_session.c_str(),"",false);
htmlprintf ("%s\n",MSG_R(H_MESSAGES));
htmlprintf (" | %s | %s | %s | %s\n"
,MSG_U(I_OWNER,"Owner"),MSG_R(I_GROUP)
,MSG_U(I_PASSIVENOTIF,"Passive"),MSG_U(I_EMAILNOTIF,"Email"));
htmlprintf (" | | %s",MSG_R(I_SHORTINBOX));
profile_set_notifies(glocal.form,string_f("talks:%s:inbox",userinfo.name.c_str()));
for (auto &g:groups){
if (userinfo.name != g.owner
|| is_not_in(g.name,"inbox","anonymous")){
htmlprintf (" | %s | %s",g.owner,g.name);
profile_set_notifies (glocal.form,string_f("talks:%s:%s",g.owner,g.name));
}
}
htmlprintf (" | | %s",MSG_R(I_ANONINBOX));
profile_set_notifies (glocal.form,string_f("talks:%s:anonymous",userinfo.name.c_str()));
/- |
htmlprintf (" | %s | %s | %s\n"
,MSG_U(H_CONTACTNOTIFS,"Contacts")
,MSG_R(I_PASSIVENOTIF),MSG_R(I_EMAILNOTIF));
htmlprintf (" | %s",MSG_R(T_CONTACTSTOYOU));
profile_set_notifies (*this,NOTIFY_PROFILE_CONTACTS);
htmlprintf (" | %s",MSG_R(T_REQUESTSBYYOU));
profile_set_notifies (*this,NOTIFY_PROFILE_CONTACT_REQ);
/- |
button_submit();
return true;
for (auto &k:glocal.keys){
(glocal.con,w_session.c_str(),"",k,w_notify_ui[k],false,w_notify_email[k],false);
}
glocal.status = MSG_R(I_CONFIGUPDATED);
keepediting = true;
}else if (strcmp(id,"Account")==0){ // CONF account
glocal string status = " ";
sethelp("helpaccount",MSG_U(I_HELPACCOUNT,"Account"));
DIV d("webtable"); d.autoscroll().print();
(id);
/-
htmlprintf ("%s",glocal.status.c_str());
/- |
(glocal.con,w_session.c_str(),"");
w_lang = config.lang;
w_dateformat = string_f("%u",config.dateformat);
w_public_view = config.public_view;
w_public_dir = config.public_dir;
w_anon_messages = config.anon_messages;
w_timezone = config.timezone;
(glocal.con,w_session.c_str(),"");
w_publish = info.publish;
w_bosite = info.bosite_visible;
w_name = info.fullname;
w_address1 = info.address1;
w_address2 = info.address2;
w_city = info.city;
w_zipcode = info.zipcode;
w_state = info.state;
w_country = info.country;
w_email = info.email;
w_phone = info.phone;
w_fax = info.fax;
w_website = info.website;
w_interest = info.interest;
w_photo = info.photo;
w_miniphoto = info.mini_photo;
{
DIV d; d.border(1,"gray").paddings(5,5).vpaddings(0,5).print();
/-
/-#T_PERSOPREF Personal preferences
/-
/-
/-#I_LANG Language |
field_list (w_lang,"");
field_list_item ("eng",MSG_U(I_ENGLISH,"English"));
field_list_item ("fr",MSG_U(I_FRENCH,"French"));
field_list_end();
/-#I_DATEFORMAT | Date format |
field_list(w_dateformat,"");
field_list_item ("0",MSG_U(I_ENGDATE,"Month DD YYYY HH:MMam/pm"));
field_list_item ("1",MSG_U(I_ISODATE,"YYYY/MM/DD HH:MM:SS"));
field_list_end();
/-#I_TIMEZONE | Time zone |
field_list(w_timezone,"");
("/etc/timezones.lst",true);
glocal.form.field_list_item(line);
return 0;
field_list_end();
/-#I_ENABLEPUB | Enable public view |
field_checkbox (w_public_view,"");
/-#I_PUBFOLDER | Public folder |
field_list (w_public_dir,"");
field_list_item ("",MSG_U(I_NONE,"--none--"));
field_list_item ("/",MSG_U(I_ROOTDIR,"root"));
(glocal.con,w_session.c_str(),string_f("/projects/%s/public",userinfo.name.c_str())
,"",false,0,100);
for (auto &f:files){
if (bolixo_isdir(f.type)){
glocal.form.field_list_item (f.name,f.name);
}
}
/-#I_ACCEPTANON | Accept anonymous messages |
field_checkbox (w_anon_messages,"");
/- |
}
{
DIV d; d.border(1,"gray").paddings(5,5).vpaddings(0,5).vmargins(5,0).print();
/-
/-#T_PUBLISH Public information
/-
/-#F_PUBLISH Publish to bolixo.org directory
/-
field_checkbox (w_publish,"");
DIV dd; dd.border(1,"lightgray").print();
/-
index_field (this,true,3,MSG_U(F_FULLNAME,"Name and surname"),w_name,40);
index_field (this,true,3,MSG_U(F_ADDRESS1,"Address"),w_address1,40);
index_field (this,true,3,MSG_U(F_ADDRESS2,"Address"),w_address2,40);
index_field (this,true,MSG_U(F_CITY,"City"),w_city);
index_field (this,false,MSG_U(F_STATE,"State"),w_state);
index_field (this,true,MSG_U(F_COUNTRY,"Country"),w_country);
index_field (this,false,MSG_U(F_ZIPCODE,"ZIP code"),w_zipcode);
index_field (this,true,MSG_U(F_EMAIL,"Email"),w_email);
index_field (this,true,MSG_U(F_PHONE,"Phone"),w_phone);
index_field (this,false,MSG_U(F_FAX,"Fax"),w_fax);
/-
/-#F_PUBLISHSOME Publish
/- |
field_checkbox (w_bosite,"");
/-#F_PUBBOLIXOSITE your Bolixo page
/-
field_checkbox (w_photo,"");
/-#F_YOURPHOTO Your photo
/-
field_checkbox (w_miniphoto,"");
/-#F_YOURMINIPHOTO Your mini photo
index_field (this,true,MSG_U(F_WEBSITE,"Web site"),w_website);
/- |
/-#F_INTERESTS Interests
/- |
field_textarea (w_interest,8,70,"");
/- |
}
/-
button_submit();
bool ret = true;
if (w_bosite.getval() != 0 && w_public_view.getval()==0){
ret = false;
/- *
/-#E_CANTPUBBOSITE You can't publish your Bolixo page unless you enable public view
}else if (w_miniphoto.getval() != 0
&& util_entrytype(glocal.con,string_f("/projects/%s/public/mini-photo.jpg",userinfo.name.c_str()))!=ENTRY_FILE){
ret = false;
/- *
/-#E_CANTPUBMINIPHOTO You can't publish your mini-photo because you have not uploaded it yet
}else if (w_photo.getval() != 0
&& util_entrytype(glocal.con,string_f("/projects/%s/public/photo.jpg",userinfo.name.c_str()))!=ENTRY_FILE){
ret = false;
/- *
/-#E_CANTPUBPHOTO You can't publish your photo because you have not uploaded it yet
}
return ret;
glocal bool fail = false;
CONFIG config;
config.lang = w_lang.c_str();
config.dateformat = atoi(w_dateformat.c_str());
config.public_view = w_public_view;
config.public_dir = w_public_dir.c_str();
config.anon_messages = w_anon_messages;
config.timezone = w_timezone.c_str();
(glocal.con,w_session.c_str(),"",config);
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CANTSAVECONFIG,"Can't save configuration: %s\n"),msg);
}else{
translat_selectlang (w_lang.c_str());
glocal.status = MSG_U(I_CONFIGUPDATED,"Configuration updated");
}
USERPUBLICINFO info;
info.publish = w_publish.getval();
info.bosite_visible = w_bosite.getval();
info.fullname = w_name.c_str();
info.address1 = w_address1.c_str();
info.address2 = w_address2.c_str();
info.city = w_city.c_str();
info.zipcode = w_zipcode.c_str();
info.state = w_state.c_str();
info.country = w_country.c_str();
info.email = w_email.c_str();
info.phone = w_phone.c_str();
info.fax = w_fax.c_str();
info.website = w_website.c_str();
info.interest = w_interest.c_str();
info.photo = w_photo.getval();
info.mini_photo = w_miniphoto.getval();
(glocal.con,w_session.c_str(),"",info);
if (!success){
glocal.fail = true;
htmlprintf (MSG_U(E_CANTSAVEPUBCONFIG,"Can't save public configurations: %s\n"),msg);
}
fail = glocal.fail;
keepediting = true;
}
}
| | | | | |
| | | |