/* This file is part of Bolixo. Bolixo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Bolixo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bolixo. If not, see . */ #include #include #include #include #include #include #include #include #define DEFINE_USERINFO #include "util.h" #include "../bolixo.h" #include "../bolixo.m" #include "webtabs.h" #include #include #include "document.h" #undef INSTRUMENT #include "../instrument.h" #include "../proto/bod_client.protoch" #include "w_var.h" void index_doc (DOCUMENT_POINTER &pt, DOC_ID &jump, bool index); void index_doc (DOCUMENT_POINTER &pt, DOC_ID &jump); static WEBID ID_MAIL("mail"); void mail(CONNECT_INFO &con, vector &docpointers) { glocal CONNECT_INFO con = con; glocal vector *docpointers = &docpointers; static unsigned size[5]={15,45,40,0,0}; ("mails",tabs,size); sethelp(); static WEBID id("tab:mails"); (id,currents[id.c_str()]); sethead (MSG_U(H_INBOXES,"Owner\tProject")); setclickopt (true,"",string_f("webtab_add=1:INBOX~%s",MSG_R(I_INBOX))); if (glocal.webtabs.selected("INBOX")) setcurrent(0); setrow ("white",0,"\t%s",MSG_U(I_INBOX,"INBOX")); (glocal.con,w_session.c_str(),"",true,false); unsigned rownum=1; for (auto s:inboxes){ string add = string_f("webtab_add=1:%s",s.project); //url_self (add.c_str(),"%s",s.role); if (glocal.webtabs.selected(s.project)) glocal.webtable.setcurrent(rownum); glocal.webtable.setclickopt (true,"",add); glocal.webtable.setrow("white",rownum,"%s\t%s",s.manager,s.project); rownum++; } glocal const char *project = id; if (strcmp(id,"INBOX")==0) glocal.project = ""; string inbox = string("inbox") + id; (ID_MAIL,currents[inbox],offsets[inbox],5); // This code is never called tlmpweb_flushheader(); (glocal.con,w_session.c_str(),"",glocal.project,false,noline,1); if (messages.size()!=1){ htmlprintf ("Internal error: %s\n",msg); }else{ htmlprintf ("title=%s

\n",messages[0].title); string path = index_format_mail_fname(messages[0],userinfo.name); (glocal.con,w_session.c_str(),path,""); const char *pt = content; while (*pt != '\0'){ const char *start = pt; while (*pt != '\0' && *pt != '\n') pt++; htmlwrite (start,pt-start); htmlout ("
\n"); if (*pt == '\n') pt++; }
} glocal unsigned rownum = nbskip; sethead (MSG_U(H_MAILS,"From\tManager\tProject\tRole\tSubmit\tTitle")); (glocal.con,w_session.c_str(),"",glocal.project,false,nbskip,nblines); if (!success){ //htmlprintf ("Error: %d %s
",internal_error,msg); }else{ for (auto &m:messages){ string path = index_format_mail_fname(m,userinfo.name); glocal.webtable.setclickopt (true,"",string_f("webtab_add=2:%s~%s" ,path.c_str(),m.from)); if (glocal.webtabs.selected(path)) glocal.webtable.setcurrent(glocal.rownum); const char *style = m.viewed != VIEWED_OK ? "whitebold" : "white"; glocal.webtable.setrow (style,glocal.rownum,"%s\t%s\t%s\t%s\t%s\t%s" ,m.from ,m.manager ,m.project ,m.role ,format_date(userinfo.dateformat,m.submit).c_str() ,m.title); glocal.rownum++; } }
DIV d("webtable"); d.print(); if (strcmp(id,"help")==0){ index_doc((*glocal.docpointers)[SECTION_MAILS],section_mails); }else if (strcmp(id,"helpmain")==0){ index_doc((*glocal.docpointers)[SECTION_NONE],section_none); }else{ glocal const char *id = id; glocal const char *from = title; (glocal.con,w_session.c_str(),id,""); vector tb; int n = str_splitline (glocal.id,'/',tb); /- if (n >= 5 && strcmp(tb[3].c_str(),"inbox")!=0){ if (n >= 6){ htmlprintf ("
%s%s/%s/%s\n",MSG_U(I_PROJECT,"Project"),tb[2].c_str(),tb[3].c_str(),tb[4].c_str()); }else{ htmlprintf ("
%s%s/%s\n",MSG_R(I_PROJECT),tb[2].c_str(),tb[3].c_str()); } } htmlprintf ("
%s%s\n",MSG_U(I_FROM,"From"),glocal.from); htmlprintf ("
%s%s\n",MSG_U(I_TITLE,"Title"),info.title); htmlprintf ("
%s%s\n",MSG_U(I_DATE,"Date"),info.modified); /-
/-

const char *pt = content; while (*pt != '\0'){ const char *start = pt; while (*pt != '\0' && *pt != '\n') pt++; htmlout (start,pt-start); htmlout ("
\n"); if (*pt == '\n') pt++; } } }