eFinancialPlanner  V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
html_helper.class.cpp
Go to the documentation of this file.
2 {
3 public:
4  html_helper();
5  void footer(string tab_name, string extraInfo ="");
6  void show_home();
7  void header(int iid=0, bool addSavingsPlan = false, bool addPlots = false);
8  string get_string(const std::string& varName);
9  const string c_salt = "k35f9vfgDtjTe1";
10  void show_toolBar(string tab_name, string usrName = "");
11  void next_step(int stepNbr, int subStepNbr);
12 // string dropDown_currency();
13  void aside(const string& textLine);
14  void cout_box_color(string the_color);
15  string get_box_color_class(string the_color);
16  string get_glyphicon(string the_color);
17 
18 //-- the colors used in the graphs: red,green black, etc.:
19  const string seriesColorsGoalPlot ="[ 'rgba(160, 0, 0, 0.6)', 'rgba(0, 0, 160, 0.6)', 'rgba(0, 160, 0, 0.6)', \"#000\", \"#663\", \"#958c12\", \"#953579\", \"#4b5de4\", \"#d8b83f\", \"#ff5800\", \"#0085cc\"]";
20 // const string seriesColorsGoalPlot ="[ \"#ff3333\", \"#33f\", \"#3a3\", \"#000\", \"#663\", \"#958c12\", \"#953579\", \"#4b5de4\", \"#d8b83f\", \"#ff5800\", \"#0085cc\"]";
21 
22  //-- the asset-class-colors, optimized for 1 cash, 3 bonds, 3 equity and 3 others:
23  const string assetClassColors ="['#999', '#0c3', '#396', '#0c9', '#3cf', '#69f', '#96f', '#f93', '#fc3', '#f63', '#33f']";
24 
25  string terms_of_use();
26  string privacy_policy();
27  string cookie_policy();
28  string collapse_open(string parent_id, string title, int nbr, bool add_triangle = true, bool is_open = true, string xtra_body_class = "");
29  string collapse_close(string parent_id = "", int nbr = 0, bool add_triangle = true);
30 
31 
32 private:
33  void header_menu_bar();
34  void parse_date_time();
35  void show_args(int argc, char **argv);
36  void parse_breadcrumb(int tab, int sub_tab);
37  void parse_title(int tab, int sub_tab);
38 
39  const std::map<int, string> c_photos_phdb = {{1,"phdb/ZM5K1325_01.jpg"}, {2,"phdb/ZM5K1312_01b.jpg"},
40  {3,"phdb/ZM5K1302_01c.jpg"},{4,"phdb/ZM5K1313_01c.jpg"}, {5, "fvdspieg1.jpg"}, {6, "fvdspieg2.jpg"}};
41  const string c_photos_phdb_dir = "/img/";
42  const string c_content_header = "Content-type:text/html\r\n\r\n";
43  const string c_doc_type = "<!DOCTYPE html>";
44 
45  std::map<int, string> scale125i2s;
46  typedef std::map<string, string> STRMAP;
47  typedef std::map<int, STRMAP > STEPDEF;
49  std::map<int, STEPDEF> sub_steps;
50  int get_prev_step(int theStep, int theSubStep);
51  int get_prev_sub_step(int theStep, int theSubStep);
52  int get_next_step(int theStep, int theSubStep);
53  int get_next_sub_step(int theStep, int theSubStep);
54  bool sub_step_exists(int theStep, int theSubStep);
55  std::map<string, int> step_nbrs;
56  std::map<string, int> sub_step_nbrs;
57  int get_step_nbr(string step_name);
58  int get_sub_step_nbr(string sub_step_name);
59  /*
60  const string c_tab_names[NBR_TABS] = {"Home","Login", "Goals", "Inventory", "Feedback", "Simulation", "Follow Up"};
61  const string c_tab_titles[NBR_TABS] = {
62  "Welcome to " + oConfig.soft_name, // home
63  "", //login
64  "State <strong>YOUR</strong> personal life goals as clear as possible", //goals
65  "Take your time to tell the software about your savings and future savings capacity", //inventory
66  "Taking into account Your goals and Your savings capacity, this seems a reasonable plan", //feedback
67  "Please see here what <strong>could</strong> happen: one of the millions of possible scenarios", // simulation
68  "Here you see one of the possible scenarios if you would not do anything between now and the given moment" //followup
69  };
70  const string c_sub_tab_titles[NBR_TABS][NBR_SUB_TABS] ={
71  {"","",""},
72  {"Please log in if you registered before","Register if you have no account yet",""},
73  {"","",""},
74  {"List here Your EXISTING savings","List here Your FUTURE savings capacity",""},
75  {"","",""},
76  {"","",""},
77  {"","",""}
78  };
79  const string c_tab_urls[NBR_TABS] = {
80  oConfig.soft_url + "?a=h",
81  oConfig.soft_url + "?a=rf",
82  oConfig.soft_url + "?a=gl",
83  oConfig.soft_url + "?a=if",
84  oConfig.soft_url + "?a=f",
85  oConfig.soft_url + "?a=s",
86  oConfig.soft_url + "?a=fu"};
87  const string c_sub_tab_names[NBR_TABS][NBR_SUB_TABS] = {
88  {"","",""},
89  {"Login","Register",""},
90  {"","",""},
91  {"Assets","Cash Flows",""},
92  {"","",""},
93  {"","",""},
94  {"","",""}
95  };
96  const string c_sub_tab_urls[NBR_TABS][NBR_SUB_TABS] = {
97  {"","",""},
98  {oConfig.soft_url + "?a=lf",oConfig.soft_url + "?a=rf",""},
99  {"","",""},
100  {oConfig.soft_url + "?a=if",oConfig.soft_url + "?a=cl",""},
101  {"","",""},
102  {"","",""},
103  {"","",""}};
104 
105  */
106  const string c_right_menu_names[NBR_RIGHT_MENU] = {"My Account","Disclaimers","Log Out"};
108  oConfig.soft_url + "?a=ie",
109  oConfig.soft_url + "?a=d",
110  oConfig.soft_url + "?a=io"
111  };
112 const string c_arrow = "&nbsp;<img src=\"" + oConfig.css_dir + "next.gif\" border=\"0\" width=\"5\" height=\"9\" alt=\"\" class=\"noPadding\">&nbsp;";
113  void show_social();
114 
115  void navbar_start();
116  void navbar_item(int k, string usr_name = "", string tab_name = "");
117  void navbar_end();
118  void navbar_box(int k, string usr_name = "");
119 
120 };
121 
126 {
128 
130  int step = 1, sub_step = 1;
131  steps[step]["name"] = "Home";
132  steps[step]["url"] = oConfig.soft_url + "?a=h";
133  steps[step]["title"] = t_titles["welcome"];
134  steps[step]["must_login"] = "N";
135  step_nbrs["home"] = step; sub_step_nbrs["home"] = 0;
136 
138  /* step++;
139  sub_step = 1;
140  step_nbrs["login"] = step; sub_step_nbrs["login"] = sub_step;
141  steps[step]["name"] = "Identification";
142  steps[step]["url"] = oConfig.soft_url + "?a=rf";
143  steps[step]["title"] = "";
144  sub_steps[step][sub_step]["name"] = "Login";
145  sub_steps[step][sub_step]["url"] = oConfig.soft_url + "?a=lf";
146  sub_steps[step][sub_step]["title"] = "";//"Log In";
147  sub_step++;
148  step_nbrs["register"] = step; sub_step_nbrs["register"] = sub_step;
149  sub_steps[step][sub_step]["name"] = "Register";
150  sub_steps[step][sub_step]["url"] = oConfig.soft_url + "?a=rf";
151  sub_steps[step][sub_step]["title"] = "";//"Register";
152  steps[step]["must_login"] = "N";*/
153 
155  step++;
156  step_nbrs["personalize"] = step; sub_step_nbrs["personalize"] = 0;
157  steps[step]["name"] = "Personalize";
158  steps[step]["url"] = oConfig.soft_url + "?a=p";
159  steps[step]["title"] = t_titles["personalize"];
160  steps[step]["must_login"] = "Y";
161 
163  step++;
164  step_nbrs["goals"] = step; sub_step_nbrs["goals"] = 0;
165  steps[step]["name"] = "Goals";
166  steps[step]["url"] = oConfig.soft_url + "?a=gl";
167  steps[step]["title"] = t_titles["goal"];;
168  steps[step]["must_login"] = "Y";
169 
171  step++;
172  sub_step = 1;
173  step_nbrs["assets"] = step; sub_step_nbrs["assets"] = sub_step;
174  steps[step]["name"] = "Inventory";
175  steps[step]["url"] = oConfig.soft_url + "?a=if";
176  steps[step]["title"] = t_titles["inventory"];
177  sub_steps[step][sub_step]["name"] = "Assets";
178  sub_steps[step][sub_step]["url"] = oConfig.soft_url + "?a=if";
179  sub_steps[step][sub_step]["title"] = t_titles["asset"];
180  sub_step++;
181  step_nbrs["cfs"] = step; sub_step_nbrs["cfs"] = sub_step;
182  sub_steps[step][sub_step]["name"] = "Savings and expenses";
183  sub_steps[step][sub_step]["url"] = oConfig.soft_url + "?a=cl";
184  sub_steps[step][sub_step]["title"] = t_titles["cash_flow"];
185  steps[step]["must_login"] = "Y";
186 
188  step++;
189  step_nbrs["feedback"] = step; sub_step_nbrs["feedback"] = 0;
190  steps[step]["name"] = "Feedback";
191  steps[step]["url"] = oConfig.soft_url + "?a=f";
192  steps[step]["title"] = t_titles["feedback"];
193  steps[step]["must_login"] = "Y";
194 
196  step++;
197  step_nbrs["simulation"] = step; sub_step_nbrs["simulation"] = 0;
198  steps[step]["name"] = "Simulation";
199  steps[step]["url"] = oConfig.soft_url + "?a=s";
200  steps[step]["title"] = t_titles["simulation"];
201  steps[step]["must_login"] = "Y";
202 
204  step++;
205  step_nbrs["followup"] = step; sub_step_nbrs["followup"] = 0;
206  steps[step]["name"] = "Follow-Up";
207  steps[step]["url"] = oConfig.soft_url + "?a=fu";
208  steps[step]["title"] = t_titles["follow_up"];
209  steps[step]["must_login"] = "Y";
210 }
211 
215 inline int html_helper::get_prev_step(int theStep, int theSubStep)
216 {
217  if (theStep <= 1) return 0;
218  if (theSubStep > 1)
219  {
220  return theStep;
221  }
222  else
223  {
224  return theStep - 1;
225  }
226 }
230 inline int html_helper::get_next_step(int theStep, int theSubStep)
231 {
232  if (theStep <= 0) return 1; //erroneous input, so back to the safe home-screen
233  if (theStep == 1) return 0; //at login, we do not show the next step (would not work)
234  // if there is a next substep, then stay in this step
235  auto outerIt = sub_steps.find(theStep);
236  if (outerIt != sub_steps.end())
237  {
238  auto innerMapPtr = outerIt->second;
239  const int KeyInner = theSubStep + 1;
240  auto innerIt = innerMapPtr.find(KeyInner);
241  if (innerIt != innerMapPtr.end()) return theStep;
242  }
243  if (steps.find(theStep+1) != steps.end()) return theStep + 1; //if there is a next step, then return it
244  return 0;
245 }
246 
250 inline int html_helper::get_next_sub_step(int theStep, int theSubStep)
251 {
252  auto outerIt = sub_steps.find(theStep);
253  //if there are substeps
254  if (outerIt != sub_steps.end())
255  {
256  auto innerMapPtr = outerIt->second;
257  const int KeyInner = theSubStep+1;
258  auto innerIt = innerMapPtr.find(KeyInner);
259  if (innerIt != innerMapPtr.end())
260  {
261  return theSubStep+1;
262  }
263  }
264  //so, now there are no substeps or there is no next one, so
265  outerIt = sub_steps.find(theStep + 1); // go look in the next step
266  if (outerIt != sub_steps.end())
267  {
268  auto innerMapPtr = outerIt->second;
269  const int KeyInner = 1;
270  auto innerIt = innerMapPtr.find(KeyInner);
271  if (innerIt != innerMapPtr.end())
272  {
273  return 1;
274  }
275  }
276  return 0;
277 }
284 inline int html_helper::get_prev_sub_step(int theStep, int theSubStep)
285 {
286  if (theSubStep > 1) return theSubStep - 1;
287  if (theStep <= 1) return 0;
288  // now we have to fing the highest substep of the previous step
289 
290 
291  auto outerIt = sub_steps.find(theStep - 1);
292  if (outerIt != sub_steps.end())
293  {
294  auto innerMapPtr = outerIt->second;
295  const int KeyInner = 1;
296  auto innerIt = innerMapPtr.find(KeyInner);
297  if (innerIt != innerMapPtr.end())
298  {
299  return KeyInner;
300  }
301  }
302  return 0;
303 }
304 
308 inline bool html_helper::sub_step_exists(int theStep, int theSubStep)
309 {
310  auto outerIt = sub_steps.find(theStep);
311  if (outerIt != sub_steps.end())
312  {
313  auto innerMapPtr = outerIt->second;
314  const int KeyInner = theSubStep;
315  auto innerIt = innerMapPtr.find(KeyInner);
316  if (innerIt == innerMapPtr.end())
317  {
318  return false;
319  }
320  else
321  {
322  return true;
323  }
324  }
325  else
326  {
327  return false;
328  }
329 }
330 
334 int html_helper::get_step_nbr(string step_name)
335 {
336  if (step_name == "") return 0;
337  try
338  {
339  return step_nbrs.at(step_name);
340  }
341  catch (std::out_of_range& e)
342  {
343 #ifdef DEBUG
344  std::cerr << e.what() << std::endl;
345 #endif
346  cout << "error no. HH001";
347  }
348  return -1;
349 }
350 
354 int html_helper::get_sub_step_nbr(string sub_step_name)
355 {
356  if (sub_step_name == "") return 0;
357  try
358  {
359  return sub_step_nbrs.at(sub_step_name);
360  }
361  catch (std::out_of_range& e)
362  {
363 #ifdef DEBUG
364  std::cerr << e.what() << std::endl;
365 #endif
366  cout << "error no. HH002";
367  }
368  return -1;
369 }
370 
371 
375 inline string html_helper::collapse_open(string parent_id, string title, int nbr, bool add_triangle, bool is_open, string xtra_body_class)
376 {
377  string s, s_nbr = to_string(nbr), s_in = (is_open)?"in":"";
378  switch (oConfig.layout)
379  {
380  case '2':
381  s = "\n<div class=\"panel panel-default\">";
382  s = s + "\n<div class=\"brightgreenBox panel-heading\">";
383  s = s + "<a data-toggle=\"collapse\" data-parent=\"#" + parent_id + "\" data-target=\"#collapse" + s_nbr + "\">";
384  s = s + title;
385  if (add_triangle) s = s + "&nbsp;<span class=\"glyphicon glyphicon-triangle-bottom\"></span>";
386  s = s + "</a>";
387  s = s + "</div>";
388  s = s + "\n<div id=\"collapse" + s_nbr + "\" class=\"panel-collapse collapse " + s_in + "\">";
389  s = s + "\n<div class=\"panel-body " + xtra_body_class + "\">\n";
390  break;
391  case '1':
392  default:
393  s= "<div clas=\"alert-info\">\n";
394  }
395  return s;
396 }
397 
401 inline string html_helper::collapse_close(string parent_id, int nbr, bool add_triangle)
402 {
403  string s = "";
404  switch (oConfig.layout)
405  {
406  case '2' :
407  if (parent_id != "")
408  {
409  string s_nbr = to_string(nbr);
410  s = "<p><a data-toggle=\"collapse\" data-parent=\"#" + parent_id + "\" data-target=\"#collapse" + s_nbr + "\">";
411  s = s + t_collapse;
412  if (add_triangle) s = s + "&nbsp;<span class=\"glyphicon glyphicon-triangle-top\"></span>";
413  s = s + "</a></p>";
414  }
415  s = s + "</div></div></div>\n";
416  break;
417  case '1':
418  default:
419  s = s + "</div>\n";
420  }
421  return s;
422 }
423 
424 
428 void html_helper::footer(string tab_name, string extraInfo)
429 {
430  int step = get_step_nbr(tab_name);
431  int sub_step = get_sub_step_nbr(tab_name);
432 
433 // cout << "<hr/>";
434  if (extraInfo != "")
435  {
436  cout << endl;
437  switch (oConfig.layout)
438  {
439  case '1' :
440  cout << "<button class=\"btn btn-primary\" id=\"btnShow\">" << t_show_extra_info << "</button>&nbsp;";
441  cout << "<button class=\"btn btn-primary\" id=\"btnHide\">" << t_hide_extra_info << "</button>";
442  cout << "<div id=\"extraInfo\">" << t_extraInfo[extraInfo] << "</div>";
443  break;
444  case '2' :
445  bs_modal (t_show_extra_info + "&nbsp;<span class=\"glyphicon glyphicon-info-sign\"></span>", t_extraInfo[extraInfo]);
446  break;
447  default :
448  cout << "<button class=\"btn btn-primary\" id=\"btnShow\">" << t_show_extra_info << "</button>&nbsp;";
449  cout << "<button class=\"btn btn-primary\" id=\"btnHide\">" << t_hide_extra_info << "</button>";
450  cout << "<div id=\"extraInfo\">" << t_extraInfo[extraInfo] << "</div>";
451  break;
452  }
453  //cout << "<br style=\"clear:left;\"/>";
454  }
455  next_step(step, sub_step);
456  parse_breadcrumb(step, sub_step);
457  cout << "</div><div class=\"alert alert-warning\">" << t_warning << "</div>\n";
458  cout << "</div>\n"; // close the mainBody div
459  cout << "<div class=\"footer\">";
460  cout << "<p>";
461  if (oConfig.layout == '2')
462  {
463  cout << "<span class=\"glyphicon glyphicon-copyright-mark\"></span>";
464  }
465  else
466  {
467  cout << "(C)";
468  }
469  cout << " Dr. Philippe De Brouwer (2015)</p>";
470  cout << "</div>\n";
471 /*
472 #ifdef DEBUG
473  int k, l;
474  for (k = 1; k < NBR_TABS; k++){
475  for (l = 1; l < NBR_SUB_TABS; l++){
476  cout << "[k,l]:[" << to_string(k) << to_string(l) << "] = " << c_sub_tab_names[k-1][l-1] << "<br>\n";
477  }
478  }
479 #endif
480 */
481 
482  cout << "</div>";
483 
484 
485 // placed at the end of the document in order to allow the page to load faster:
486 
487  /*cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/jquery.js\"></script>";
488  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/transition.js\"></script>";
489  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/alert.js\"></script>";
490  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/modal.js\"></script>";
491  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/dropdown.js\"></script>";
492  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/scrollspy.js\"></script>";
493  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/tab.js\"></script>";
494  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/tooltip.js\"></script>";
495  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/popover.js\"></script>";
496  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/button.js\"></script>";
497  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/collapse.js\"></script>";
498  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/carousel.js\"></script>";
499  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/typeahead.js\"></script>";
500  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/affix.js\"></script>";
501  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/holder/holder.js\"></script>";
502  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/google-code-prettify/prettify.js\"></script>";
503  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/application.js\"></script>";*/
504 
505 
507 
508  #ifdef DEBUG
509  cout << "<br>---------[DEBUG INFO]---------\n<br>" + debug_info << "<br>\n-------[END DEBUG INFO]-------\n<br>";
510 #endif
511 
512 /* int k;
513  for (k = 1; k < 10; k++)
514  {
515  cout << "<br><br><b> " << steps[k]["name"] << "</b>";
516  cout << "<BR>next_step (" << k << ",0) = " << get_next_step(k,0) << " -- get_next_sub_step = " << get_next_sub_step(k,0);
517  cout << "<BR>next_step (" << k << ",1) = " << get_next_step(k,1) << " -- get_next_sub_step = " << get_next_sub_step(k,1);
518  cout << "<BR>next_step (" << k << ",2) = " << get_next_step(k,2) << " -- get_next_sub_step = " << get_next_sub_step(k,2);
519  }*/
520 
521 
522  cout << "</body>\n"; //close div-id = wrapper
523  cout << "</html>";
524 }
525 
530 {
531  time_t t = time(0); // get time now
532  struct tm * now = localtime( & t );
533  cout << (now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' << now->tm_mday;
534 }
535 
540 {
541  cout << "<nav id=\"nav\"><ul>";
542  cout << "<li><a href=\"" << oConfig.wrapper_url << "\"><b>HOME</b></a></li>";
543  cout << "<li><a href=\"" << oConfig.wrapper_url << "/solutions.html\"><b>SOLUTIONS</b></a></li>";
544  cout << "<li><a href=\"" << oConfig.wrapper_url << "/further_info.html\"><b>BACKGROUND INFORMATION</b></a></li>";
545  cout << "<li><a href=\"" << oConfig.wrapper_url << "/about.html\"><b>ABOUT US</b></a></li>";
546  cout << "<li><a href=\"" << oConfig.wrapper_url << "/contact.html\"><b>CONTACT</b></a></li>";
547  cout << "</ul></nav>\n";
548 
549  cout << "<div class=\"history\"><a HREF=\"/\">eFinancialPlanner</a>";
550  cout << "&nbsp;<img src=\""<< oConfig.css_dir << "next.gif\" border=\"0\" width=\"5\" height=\"9\" alt=\"\" class=\"noPadding\">&nbsp;";
551  cout << "<a HREF=\"" + oConfig.soft_url + "\">" << t_title << "</a></div>";
552  cout << "\n";
553  cout << "<div class=\"mainBody\" id=\"mainBodyAlone\"><div id=\"appWrapper\">";
554 }
555 
562 void html_helper::header(int iid, bool addSavingsPlan, bool addPlots)
563 {
564  if (iid != 0) cout << "Set-Cookie:iid=" << std::to_string(iid) << ";\n";
565  cout << c_content_header;
566  cout << c_doc_type;
567  switch(oConfig.language)
568  {
569  case '1':
570  cout << "\n<html lang=\"en-UK\">\n"; break;
571  case '2':
572  cout << "\n<html lang=\"en-US\">\n"; break;
573  default:
574  cout << "\n<html lang=\"en-UK\">\n";
575  }
576  cout << "<head>\n";
577  cout << "<title>" << t_title << "</title>\n";
578  cout << "<meta charset=\"utf-8\">\n";
579  cout << "<meta name=\"Description\" content=\"Personal Financial Planning\">\n";
580  cout << "<meta name=\"Keywords\" content=\"financial planning, Philippe, De Brouwer, Philippe De Brouwer, PFP, Personal Financial Plan, Behavioral Finance, Behavioural Finance, Dr. Philippe J.S. De Brouwer\">\n";
581  cout << "<meta name=\"author\" content=\"Philippe De Brouwer\">\n";
582  cout << "<LINK REL=\"icon\" HREF=\"favicon.ico\" TYPE=\"image/ico\">\n";
583  cout << "<LINK REL=\"SHORTCUT ICON\" HREF=\"favicon.ico\">\n";
584 
586  cout << "<script src=\"" << oConfig.scripts_dir << "dist/jquery.min.js\"></script>\n";
587  //cout << "<script class=\"include\" type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>";
588 
589 
591  if (addPlots)
592  {
593  cout << "<script src=\"" << oConfig.scripts_dir << "dist/jquery.jqplot.min.js\"></script>\n";
594  cout << "<script src=\"" << oConfig.scripts_dir << "jqplot.pieRenderer.min.js\"></script>\n";
595  cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.css_dir << "jquery.jqplot.min.css\">\n";
596  cout << "<style type=\"text/css\">.jqplot-data-label {color: #444;font-size: 1.1em;}</style>\n";
597  cout << "<script src=\"" << oConfig.scripts_dir << "jqplot.customMarkerRenderer.js\"></script>\n";
598  }
599 
600 
602  //cout << "<script type=\"text/javascript\" src=\"" << oConfig.scripts_dir << "calendarDateInput.js\"></script>\n";
603  cout << "<script src=\"" << oConfig.scripts_dir << "goal_type_sh.js\"></script>\n";
604  cout << "<script src=\"" << oConfig.scripts_dir << "extraInfo.js\"></script>\n";
605  if (addSavingsPlan) cout << "<script src=\"" << oConfig.scripts_dir << "savings_plan_sh.js\"></script>\n";
606 
608  cout << "<script src=\"" << oConfig.scripts_dir << "datepicker/js/bootstrap-datepicker.js\"></script>\n";
609  cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.scripts_dir << "datepicker/css/datepicker.css\">\n";
610 
612  switch(oConfig.layout)
613  {
614  case '1':
615  cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.css_dir << "base2.css\">\n";
616  break;
617  case '2':
618  cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.css_dir << "base1.css\">\n";
619  cout << "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n";
620  cout << "<link href=\"" << oConfig.css_dir << "bootstrap/css/bootstrap.css\" rel=\"stylesheet\" media=\"screen\">\n";
621  cout << "<link href=\"" << oConfig.css_dir << "bootstrap/css/bootstrap-responsive.css\" rel=\"stylesheet\" media=\"screen\">\n";
622  cout << "<link href=\"" << oConfig.css_dir << "bootstrap/css/bootstrap-theme.css\" rel=\"stylesheet\">\n";
623  cout << "<script src=\"" << oConfig.css_dir << "bootstrap/js/bootstrap.min.js\"></script>";
624 //>>>> cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.css_dir << "base2_post.css\">\n";
625  break;
626  default:
627  cout << "<link rel=\"stylesheet\" type=\"text/css\" href=\"" << oConfig.css_dir << "base2.css\">\n";
628  }
629 
631  switch (oConfig.font_combination)
632  {
633  case '1' : //corben&Nobile
634  cout << "<link href=\"https://fonts.googleapis.com/css?family=Corben:bold\" rel=\"stylesheet\" type=\"text/css\">";
635  cout << "<style>h1, h2, h3, h4, h5, h6 {font-family: 'Corben', Georgia, Times, serif;}</style>";
636  cout << "<link href=\"https://fonts.googleapis.com/css?family=Corben:bold\" rel=\"stylesheet\" type=\"text/css\">";
637  cout << "<style>div, body, p {font-family: 'Nobile', Helvetica, Arial, sans-serif;}</style>";
638  break;
639  case '2' : //Droid Serif+Sans
640  cout << "<link href=\"https://fonts.googleapis.com/css?family=Droid+Serif\" rel=\"stylesheet\" type=\"text/css\">";
641  cout << "<style>h1, h2, h3, h4, h5, h6 {font-family: 'Dorid Serif', Georgia, Times, serif;}</style>";
642  cout << "<link href=\"https://fonts.googleapis.com/css?family=Droid+Sans\" rel=\"stylesheet\" type=\"text/css\">";
643  cout << "<style>div, body, p {font-family: 'Droid Sans', Helvetica, Arial, sans-serif;}</style>";
644  break;
645  case '3' : //Ubuntu + default
646  cout << "<link href=\"https://fonts.googleapis.com/css?family=Ubuntu:bold\" rel=\"stylesheet\" type=\"text/css\">";
647  cout << "<style>h1, h2, h3, h4, h5, h6 {font-family: 'Ubuntu', Georgia, Times, serif;}</style>";
648  cout << "<style>div, body, p {font-family: sans-serif;}</style>";
649  break;
650  case '4' : //Ubuntu+Vollkorn
651  cout << "<link href=\"https://fonts.googleapis.com/css?family=Ubuntu:bold\" rel=\"stylesheet\" type=\"text/css\">";
652  cout << "<style>h1, h2, h3, h4, h5, h6 {font-family: 'Ubuntu', Georgia, Times, serif;}</style>";
653  cout << "<link href=\"https://fonts.googleapis.com/css?family=Vollkorn\" rel=\"stylesheet\" type=\"text/css\">";
654  cout << "<style>div, body, p {font-family: 'Vollkorn', Georgia, Times, Serif;}</style>";
655  break;
656  case '5' : //|Journal + default
657  cout << "<link href=\"" << oConfig.css_dir << "fonts/journal/font.css\" rel=\"stylesheet\" type=\"text/css\">";
658  cout << "<style>h1, h2, h3, h4, h5, h6 {font-weight:bold;font-family: 'JOURNAL', Georgia, Times, serif;}</style>";
659  cout << "<style>h1{font-size:4.5em;}h2{font-size:3.5em;}h3{font-size:2.5em;}h4{font-size:2em;}h5{font-size:1em;}</style>";
660 
661 // cout << "<link href=\"https://fonts.googleapis.com/css?family=Vollkorn\" rel=\"stylesheet\" type=\"text/css\">";
662  cout << "<style>div, body, p {font-family: sans-serif;}</style>";
663  break;
664  case '6' : //|Journal + Gentium
665  cout << "<link href=\"" << oConfig.css_dir << "fonts/journal/font.css\" rel=\"stylesheet\" type=\"text/css\">";
666  cout << "<style>h1, h2, h3, h4, h5, h6 {font-weight:bold;font-family: 'JOURNAL', Georgia, Times, serif;}</style>";
667  cout << "<style>h1{font-size:3.5em;}h2{font-size:2.5em;}h3{font-size:2em;}h4{font-size:1.75em;}h5{font-size:1.5em;}</style>";
668  cout << "<link href=\"" << oConfig.css_dir << "fonts/gentium/font.css\" rel=\"stylesheet\" type=\"text/css\">";
669  cout << "<style>body {font-size: 17px;}table.jqplot-table-legend {font-size:.75em;}</style>";
670  cout << "<style>div, body, p {font-family: GentiumPlusW, sans-serif;}</style>";
671  break;
672 
673  case '7' : //|Gentium + Gentium
674  cout << "<link href=\"" << oConfig.css_dir << "fonts/gentium/font.css\" rel=\"stylesheet\" type=\"text/css\">";
675  cout << "<style>h1, h2, h3, h4, h5, h6 {font-weight:bold;font-family: GentiumPlusW, sans-serif;}</style>";
676  cout << "<style>body {font-size: 17px;}table.jqplot-table-legend {font-size:.75em;}</style>";
677  //cout << "<style>h1{font-size:4.5em;}h2{font-size:3.5em;}h3{font-size:2.5em;}h4{font-size:2em;}h5{font-size:1em;}</style>";
678  cout << "<style>div, body, p {font-family: GentiumPlusW, sans-serif;}</style>";
679  break;
680 
681  default:
682  cout << "<style>h1, h2, h3, h4, h5, h6 {font-family: Georgia, Times, serif;}</style>";
683  cout << "<style>div, body, p {font-family: 'Droid Sans', Helvetica, Arial, sans-serif;}</style>";
684  }
685 
686  cout << "</head>\n";
687 
689  cout << "<body>\n";
690  switch (oConfig.layout)
691  {
692  case '2':
693  cout << "<div class=\"container-fluid\">";
694  case '1':
695  default:
696  cout << "<div id=\"wrapper\">\n";
697  }
699 // cout << h1(t_title + "/" + title);
700 // cout << "<hr/>";
701 
702  if (error_message != "")
703  {
704  cout << "<div class=\"alert alert-warning\"><ul>" << error_message << "</ul>";
705  cout << "</div>\n"; // close the alert alert-warning div
706  error_message = "";
707  }
708  if (std_message != "")
709  {
710  cout << "<div class=\"alert alert-info\"><ul>" << std_message << "</ul>";
711  cout << "</div>\n";
712  std_message = "";
713  }
714 
715 }
716 
723 {
724 /* long k;
725  long fib=1, fibprev=1;
726  cout << "<h2>Fibonacci numbers: </h2>";
727  cout << fibprev;
728  for (k = 1; k <= 75; k++) {
729  cout << "\t--\t";
730  cout << fib;
731  fib = fib + fibprev;
732  fibprev = fib - fibprev;
733  }
734  cout << "\r\n";
735  */
736  using namespace cgicc;
737  Cgicc cgi;
738  int isLogin;
739 
740  form_iterator uid = cgi.getElement("uid");
741  if(uid != cgi.getElements().end()) { isLogin = 1;} else { isLogin = 0;}
742 
743  cout << p("This simple process consists of three easy steps:");
744  cout << "<img src=\"" << oConfig.www_dir << "/img/ranking.jpeg\" align=\"right\"/>";
745  cout << ul();
746  cout << li("<a href=\"" + oConfig.soft_url + "?a=rf\">Register</a> or <a href=\"" + oConfig.soft_url + "?a=lf\">Login</a>");
747  if (isLogin == 0)
748  {
749  cout << li("STEP 1: Make an inventory of your assets and main cash-flows (income and expenses)");
750  cout << li("STEP 2: Set Your personal financial goals");
751  cout << li("STEP 3: Contemplate on the Feedback");
752  cout << p(" ");
753  cout << "<p>Next step: <button type=\"btn btn-primary\" class=\"btn btn-primary\" onclick=\"window.location.href=\'" + oConfig.soft_url + "?a=rf\'\">Register</button> or ";
754  cout << "<button type=\"btn btn-primary\" class=\"btn btn-primary\" onclick=\"window.location.href=\'" + oConfig.soft_url + "?a=lf\'\">Login</button></p>";
755  cout << p(" ");
756  }
757  else
758  {
759  cout << li("STEP 1: <a href=\"" + oConfig.soft_url + "?a=if\">Make an inventory of your assets and main cash-flows (income and expenses)</a>");
760  cout << li("STEP 2: <a href=\"" + oConfig.soft_url + "?a=gf\">Set Your personal financial goals</a>");
761  cout << li("STEP 3: <a href=\"" + oConfig.soft_url + "?a=f\">Contemplate on the Feedback</a>");
762  cout << p(" ");
763  cout << "<p>Next step: <button type=\"btn btn-primary\" onclick=\"window.location.href=\'" + oConfig.soft_url + "?a=gl\'\">Define Your Goals</button></p>";
764  cout << p(" ");
765  }
766  cout << ul();
767 
768  // test for normal distributicgion
769 /* cout << "<a href=\"" + oConfig.soft_url + "?1000+i.cf+a+20\">do do1()</a>";
770  double a[] = {0.001, 0.01, 0.1, 0.5, 0.65, 0.9, 0.95, 0.98, 0.99, 0.999};
771  cout << "<table border=\"1\"><tr><th>x</th><th>norminv(x)</th></tr>";
772  for (k = 0; k < (sizeof(a)/sizeof(*a)); k++) {cout << "<tr><td>" << a[k] << "</td><td>" << norminv(a[k]) << "</td></tr>";}
773  cout << "</table>";
774  double b[] = {-5,-4,-3,-2,-1,0,1,2,3,4,5};
775  cout << "<table border=\"1\"><tr><th>x</th><th>phi(x)</th></tr>";
776  for (k = 0; k < (sizeof(b)/sizeof(*b)); k++) {cout << "<tr><td>" << b[k] << "</td><td>" << phi(b[k]) << "</td></tr>";}
777  cout << "</table>";
778 */
779 }
780 
781 
782 /* *************************************************************************
783  * get_string
784  * ************************************************************************/
785 string html_helper::get_string(const std::string& varName)
786 {
787  try
788  {
789  Cgicc formData;
790  form_iterator fvalue1 = formData.getElement(varName);
791  if( !fvalue1->isEmpty() && fvalue1 != (*formData).end()) {return **fvalue1;} else {return "";}
792  }
793  catch(exception& e) { cout << "**ERROR!!**\n"; return "ERROR";}
794 }
795 
803 {
804  switch (oConfig.layout)
805  {
806  case '2' :
807  bs_navbar_start();
808  break;
809  case '1' :
810  default :
811  cout << "<ul class=\"nav-tabs\">";
812  break;
813  }
814 }
815 
821 inline void html_helper::navbar_item(int k, string usr_name, string tab_name)
822 {
823  int l;
824  int selected_sub = get_sub_step_nbr(tab_name);
825  int active_tab_nbr = get_step_nbr(tab_name);
826  bool produce_sublist, is_active, is_disabled;
827  string the_url;
828 
829  is_active = (k == active_tab_nbr)?true:false;
830  is_disabled = ((usr_name == "") && (steps[k]["must_login"] == "Y"))?true:false;
831  the_url = ((usr_name == "") && (steps[k]["must_login"] == "Y"))?"&#35":steps[k]["url"];
832 
833  switch (oConfig.layout)
834  {
835  case '2' : // bootstrap
836  {
837  cout << "<li role=\"presentation\" class=\"";
838  if (is_active)
839  {
840  cout << "active";
841  }
842  else if (is_disabled)
843  {
844  cout << "disabled ";
845  }
846  if (sub_step_exists(k,1) && oConfig.layout == '2')
847  {
848  cout << " dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\" role=\"button\" aria-expanded=\"false\">" << steps[k]["name"] << "<span class=\"caret\"></span></a>";
849  }
850  else
851  {
852  cout << "\"><a href=\"" << the_url << "\">" << steps[k]["name"] << "</a>";;
853  }
854  produce_sublist = (sub_step_exists(k,1))?true:false; //this must be here as it can depend on the presentation
855  if (produce_sublist)
856  {
857  if (sub_step_exists(k,1) && oConfig.layout == '2')
858  {
859  cout << "<ul class=\"dropdown-menu\" role=\"menu\">";
860  }
861  else
862  {
863  cout << "<ul>";
864  }
865 
866  for (l = 1; (l <= NBR_SUB_TABS) && (sub_step_exists(k,l)); l++)
867  {
868  cout << "<li><A href=\"" << sub_steps[k][l]["url"] << "\"";
869  if (l == selected_sub) {cout << " class=\"active\" ";}
870  cout << ">" << sub_steps[k][l]["name"] << "</a></li>";
871  }
872  cout << "</ul>";
873  }
874  cout << "</li>\n";
875  }
876  break;
877  case '1':
878  default :
879  {
880  cout << "<li role=\"presentation\" class=\"";
881  if (is_active)
882  {
883  cout << "active";
884  }
885  else if (is_disabled)
886  {
887  cout << "disabled ";
888  }
889  if (sub_step_exists(k,1) && oConfig.layout == '2')
890  {
891  cout << " dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\" role=\"button\" aria-expanded=\"false\">" << steps[k]["name"] << "<span class=\"caret\"></span></a>";
892  }
893  else
894  {
895  cout << "\"><a href=\"" << the_url << "\">" << steps[k]["name"] << "</a>";;
896  }
897  produce_sublist = (k == active_tab_nbr && sub_step_exists(k,1))?true:false;
898  if (produce_sublist)
899  {
900  if (sub_step_exists(k,1) && oConfig.layout == '2')
901  {
902  cout << "<ul class=\"dropdown-menu\" role=\"menu\">";
903  }
904  else
905  {
906  cout << "<ul>";
907  }
908 
909  for (l = 1; (l <= NBR_SUB_TABS) && (sub_step_exists(k,l)); l++)
910  {
911  cout << "<li><A href=\"" << sub_steps[k][l]["url"] << "\"";
912  if (l == selected_sub) {cout << " class=\"active\" ";}
913  cout << ">" << sub_steps[k][l]["name"] << "</a></li>";
914  }
915  cout << "</ul>";
916  }
917  cout << "</li>\n";
918  }
919  break;
920  }
921 
922 }
923 
930 {
931  switch (oConfig.layout)
932  {
933  case '2' :
934  bs_navbar_end();
935  break;
936  case '1' :
937  default :
938  cout << "</ul>";
939  break;
940  }
941 }
942 
948 inline void html_helper::navbar_box(int k, string usr_name)
949 {
950  if (usr_name == "") return; // no box if no user logged in as this is mainly for account management
951 
952  switch (oConfig.layout)
953  {
954  case '2' :
955  {
956  cout << "<ul class=\"nav navbar-nav navbar-right\">";
957  cout << "<li class=\"dropdown\">";
958  cout << "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">" << usr_name << "&nbsp;<span class=\"caret\"></span></a>";
959  cout << "<ul class=\"dropdown-menu\">";
960  for (k=0; k < NBR_RIGHT_MENU;k++)
961  {
962  cout << "<li><a href=\"" << c_right_menu_urls[k] << "\">" << c_right_menu_names[k] << "</a></li>";
963  }
964  cout << "</ul>";
965  cout << "</li>"; //of the first menu item
966  cout << "</ul>"; // close the right-menu
967  }
968  break;
969  case '1':
970  default :
971  {
972  cout << "<span class=\"floatRight\">";
973  cout << "logged in as: <i>" << usr_name << "</i>&nbsp;&nbsp;<br>" ;
974  for (k=0; k < NBR_RIGHT_MENU;k++)
975  {
976  cout << "<a href=\"" << c_right_menu_urls[k] << "\">" << c_right_menu_names[k] << "</a> &nbsp;&nbsp;";
977  }
978  cout << "</span>";
979  }
980  break;
981  }
982 }
983 
984 
988 void html_helper::show_toolBar(string tab_name , string usrName)
989 {
990  int k;
991  int selected = get_step_nbr(tab_name);
992  int selected_sub = get_sub_step_nbr(tab_name);
993 
994  //open the nav-bar
995  navbar_start();
996  //place each item of the nav-bar
997 
998  for (k = 1; k <= NBR_TABS; k++)
999  {
1000  navbar_item(k, usrName, tab_name);
1001  }
1002 
1003  // -- the box with account related links
1004  switch (oConfig.layout)
1005  {
1006  case '2' :
1007  bs_navbar_end1();
1008  navbar_box(k, usrName);
1009 // navbar_end();
1010  bs_navbar_end2();
1011 
1012  break;
1013  case '1':
1014  default :
1015  navbar_end();
1016  navbar_box(k, usrName);
1017  break;
1018  }
1019 
1020  cout << "<br style=\"clear:all;\"/>";
1021 
1022  parse_title(selected, selected_sub);
1023  /*
1024  *
1025  cout << "<div class=\"nav\"><table class=\"toolBar\"><tr>";
1026  for (k = 1; k <= NBR_TABS; k++)
1027  {
1028  if (first) {first = false;} else {cout << "<td class=\"toolBarArrow\">&nbsp;</td>";}
1029  cout << "<TD class=";
1030  if (actives[k-1] == '0')
1031  {cout << "\"toolBarInactive\">" << c_tab_names[k-1] << "</TD>\n";}
1032  else
1033  {
1034  if (k == selected) {cout << "\"toolBarSelected\"";} else {cout << "\"toolBar\"";}
1035  cout << "><A class=\"toolBar\" href=\"" << c_tab_urls[k-1] << "\">" << c_tab_names[k-1] << "</A></TD>\n";
1036  }
1037  }
1038  cout << "</tr></table></div>\n";*/
1039 // parse_breadcrumb(selected, selected_sub);
1040 
1041 }
1042 
1046 void html_helper::next_step(int stepNbr, int subStepNbr)
1047 {
1048  if (stepNbr != 0)
1049  {
1050 /* cout << "<div class=\"nextStep\"><h2><img src=\"" << oConfig.css_dir << "arrow_right.svg\" width=\"100px\" height=\"12px\" >NEXT STEP: <a href=\"";
1051  if (subStepNbr == 0)
1052  {cout << c_tab_urls[stepNbr] << "\">" << c_tab_names[stepNbr];}
1053  else
1054  {cout << c_sub_tab_urls[stepNbr-1][subStepNbr] << "\">" << c_sub_tab_names[stepNbr-1][subStepNbr];}
1055  cout << "</a></h2></div>";
1056  }*/
1057 
1058  int prevSubStepNbr = get_prev_sub_step(stepNbr,subStepNbr);
1059  int prevStepNbr = get_prev_step(stepNbr,subStepNbr);
1060  int nextSubStepNbr = get_next_sub_step(stepNbr,subStepNbr);
1061  int nextStepNbr = get_next_step(stepNbr,subStepNbr);
1062 
1063  if (prevStepNbr != 0)
1064  {
1065  string back_symbol;
1066  switch (oConfig.layout)
1067  {
1068  case '1' :
1069  back_symbol = "<img src=\"" + oConfig.css_dir + "arrow_right.svg\" width=\"150px\" height=\"12px\" >";
1070  break;
1071  case '2' :
1072  back_symbol = "<span class=\"glyphicon glyphicon-step-backward\"></span>";
1073  break;
1074  default :
1075  back_symbol = " <span class=\"glyphicon glyphicon-step-forward\"></span>";
1076  break;
1077  }
1078 
1079 
1080  cout << "\n<a class=\"btn btn-default\" href=\"";
1081  if (prevSubStepNbr == 0)
1082  {
1083  cout << steps[prevStepNbr]["url"] << "\">"<< back_symbol << t_prev_step << ": " << steps[prevStepNbr]["name"];
1084  }
1085  else
1086  {
1087  cout << sub_steps[prevStepNbr][prevSubStepNbr]["url"] << "\">" << back_symbol << t_prev_step << ": " << sub_steps[prevStepNbr][prevSubStepNbr]["name"];
1088  }
1089  cout << "</a>\n";
1090  }
1091 
1092 
1093  if (nextStepNbr != 0)
1094  {
1095  cout << "\n<a class=\"btn btn-primary\" href=\"";
1096  if (nextSubStepNbr == 0)
1097  {
1098  cout << steps[nextStepNbr]["url"] << "\">" << t_next_step << ": " << steps[nextStepNbr]["name"];
1099  }
1100  else
1101  {
1102  cout << sub_steps[nextStepNbr][nextSubStepNbr]["url"] << "\">" << t_next_step << ": " << sub_steps[nextStepNbr][nextSubStepNbr]["name"];
1103  }
1104  switch (oConfig.layout)
1105  {
1106  case '1' : cout << "<img src=\"" << oConfig.css_dir << "arrow_right.svg\" width=\"150px\" height=\"12px\" >"; break;
1107  case '2' : cout << "<span class=\"glyphicon glyphicon-step-forward\"></span>"; break;
1108  default : cout << " <span class=\"glyphicon glyphicon-step-forward\"></span>"; break;
1109  }
1110  cout << "</a>\n";
1111  }
1112 
1113  }
1114 }
1115 
1119 void html_helper::aside(const string& textLine)
1120 {
1121  if (oConfig.show_aside)
1122  {
1123  srand (time(NULL)); //initialize random seed
1124  int iRand = rand() % c_photos_phdb.size() + 1; // generate random photo number
1125  cout << "<aside>";
1126  cout << "<img src=\"" << c_photos_phdb_dir << c_photos_phdb.find(iRand)->second;
1127  cout << "\" alt=\"Philippe's picture\" align=\"center\" width=\"100px\">";
1128  cout << "<p>&quot;" << textLine << "&quot;</p>";
1129  show_social() ;
1130  cout << "</aside>\n";
1131  }
1132  else {}
1133 }
1134 
1139 {
1140  cout << "<br><div id=\"share\">";
1141  cout << "<script src=\"//platform.linkedin.com/in.js\" type=\"text/javascript\">lang: en_US</script><script type=\"IN/Share\" data-counter=\"right\"></script>";
1142  cout << "<div id=\"fb-root\"></div>";
1143  cout << "<script>(function(d, s, id) {";
1144  cout << " var js, fjs = d.getElementsByTagName(s)[0];";
1145  cout << " if (d.getElementById(id)) return;";
1146  cout << " js = d.createElement(s); js.id = id;";
1147  cout << " js.src = \"//connect.facebook.net/en_GB/all.js#xfbml=1\";";
1148  cout << " fjs.parentNode.insertBefore(js, fjs);";
1149  cout << " }(document, 'script', 'facebook-jssdk'));</script>";
1150  cout << "<div class=\"fb-like\" data-href=\"" << oConfig.soft_url << "\" data-layout=\"button\" data-action=\"like\" data-show-faces=\"false\" data-share=\"true\"></div></div>";
1151 }
1152 
1158 void html_helper::parse_breadcrumb(int tab, int sub_tab)
1159 {
1160  switch (oConfig.layout)
1161  {
1162  case '2' :
1163  cout << "<ol class =\"breadcrumb\">";
1164  cout << "<li>" << t_breadcrumb << "</li>";
1165  cout << "<li><a HREF=\"" << oConfig.wrapper_url << "\">" << oConfig.wrapper_name << "</a></li>";
1166  cout << "<li><a HREF=\"" << oConfig.soft_url << "\">" << oConfig.soft_name << "</a></li>";
1167  cout << "<li><a HREF=\"" << steps[tab]["url"] << "\">" << steps[tab]["name"] << "</a></li>";
1168  if (tab != 0 && sub_tab != 0)
1169  {
1170  cout << "<li><a HREF=\"" << sub_steps[tab][sub_tab]["url"] << "\">" << sub_steps[tab][sub_tab]["name"] << "</a></li>";
1171  }
1172  cout << "</ol>";
1173  cout << "<br style=\"clear:left;\"/>";
1174  break;
1175  case '1' :
1176  default :
1177  cout << "<div class=\"breadcrumb\">" << t_breadcrumb;
1178  cout << "<a HREF=\"" << oConfig.wrapper_url << "\">" << oConfig.wrapper_name << "</a>" << c_arrow;
1179  cout << "<a HREF=\"" << oConfig.soft_url << "\">" << oConfig.soft_name << "</a>";
1180  cout << "" << c_arrow << "<a HREF=\"" << steps[tab]["url"] << "\">" << steps[tab]["name"] << "</a>";
1181  if (tab != 0 && sub_tab != 0)
1182  {
1183  cout << c_arrow;
1184  cout << "<a HREF=\"" << sub_steps[tab][sub_tab]["url"] << "\">" << sub_steps[tab][sub_tab]["name"] << "</a>";
1185  }
1186  cout << "</div>";
1187  cout << "<br style=\"clear:left;\"/>";
1188  break;
1189  }
1190 }
1191 
1192 
1198 void html_helper::parse_title(int tab, int sub_tab)
1199 {
1200 // cout << "<BR>tab=" << tab << " sub_tab=" << sub_tab;
1201  cout << "<br style=\"clear:all;\"/>\n";
1202  auto outerIt = steps.find(tab);
1203  if (outerIt != steps.end())
1204  {
1205  auto innerMapPtr = outerIt->second;
1206  const string KeyInner = "title";
1207  auto innerIt = innerMapPtr.find(KeyInner);
1208  if (innerIt != innerMapPtr.end()) cout << "<h1>" << steps[tab]["title"] << "</h1>";
1209  }
1210  cout << t_after_title[steps[tab]["name"]];
1211  auto outer2It = sub_steps.find(tab); // go look in the sub-step
1212  if (outer2It != sub_steps.end())
1213  {
1214  auto innerMapPtr = outer2It->second;
1215  const int KeyInner2 = sub_tab;
1216  auto innerIt = innerMapPtr.find(KeyInner2);
1217  if (innerIt != innerMapPtr.end())
1218  {
1219  auto inner2MapPtr = innerIt->second;
1220  const string KeyInner3 = "title";
1221  auto inner2It = inner2MapPtr.find(KeyInner3);
1222  if (inner2It != inner2MapPtr.end()) cout << "<h2>" << sub_steps[tab][sub_tab]["title"] << "</h2>";
1223  }
1224  }
1225  cout << endl;
1226 }
1227 
1233 void html_helper::cout_box_color(string the_color)
1234 {
1235  if (the_color == "brightgreen") cout << "brightgreenBox";
1236  else if (the_color == "green") cout << "greenBox";
1237  else if (the_color == "amber") cout << "amberBox";
1238  else if (the_color == "red") cout << "redBox";
1239  else if (the_color == "darkred") cout << "darkredBox";
1240  else {cout << "amberBox";}
1241 }
1242 
1246 string html_helper::get_box_color_class(string the_color)
1247 {
1248  string s;
1249  if (the_color == "brightgreen") s = "brightgreenBox";
1250  else if (the_color == "green") s = "greenBox";
1251  else if (the_color == "amber") s = "amberBox";
1252  else if (the_color == "red") s = "redBox";
1253  else if (the_color == "darkred") s = "darkredBox";
1254  else {s = "amberBox";}
1255  return s;
1256 }
1257 
1261 string html_helper::get_glyphicon(string the_color)
1262 {
1263  string s;
1264  switch (oConfig.layout)
1265  {
1266  case '2' :
1267  s = "<span class=\"";
1268  if (the_color == "brightgreen") s = s + "glyphicon glyphicon-thumbs-up";
1269  else if (the_color == "green") s = s + "glyphicon glyphicon-thumbs-up";
1270  else if (the_color == "amber") s = s + "glyphicon glyphicon-alert";
1271  else if (the_color == "red") s = s + "glyphicon glyphicon-thumbs-down";
1272  else if (the_color == "darkred") s = s + "glyphicon glyphicon-thumbs-down";
1273  else {s = s + "glyphicon";}
1274  s = s + "\"></span>";
1275  break;
1276  case '1' :
1277  default:
1278  if (the_color == "brightgreen") s = ":-D";
1279  else if (the_color == "green") s = ":-)";
1280  else if (the_color == "amber") s = ":-|";
1281  else if (the_color == "red") s = ":-(";
1282  else if (the_color == "darkred") s = ":'-(";
1283  else {s = ":-?";}
1284  break;
1285  }
1286  return s;
1287 }
1288 
1289 
1290 
1295 {
1296  string s = "<a href=\"" + oConfig.soft_url + "?a=d#use\">Terms of Use</a>";
1297  return s;
1298 }
1299 
1304 {
1305  string s = "<a href=\"" + oConfig.soft_url + "?a=d#privacy\">Privacy Policy</a>";
1306  return s;
1307 }
1308 
1313 {
1314  string s = "<a href=\"" + oConfig.soft_url + "?a=d#cookie\">Cookie Policy</a>";
1315  return s;
1316 }
bool show_aside
whether or not to show the side-box
string soft_url
void navbar_box(int k, string usr_name="")
const bool parse_wrapper
true will turn of the rendering of the menu related to the soft_server_url
const string css_dir
unordered_map< string, string > t_titles
Definition: texts_Eng_UK.h:58
const string t_prev_step
Definition: texts_Eng_UK.h:17
void bs_modal(string title, string content, string id="myModal", string b1_text="", string b1_url="")
const string scripts_dir
void parse_title(int tab, int sub_tab)
const string t_warning
Definition: texts_Eng_UK.h:8
int get_step_nbr(string step_name)
const string seriesColorsGoalPlot
void parse_breadcrumb(int tab, int sub_tab)
const string t_collapse
Definition: texts_Eng_UK.h:25
const string c_right_menu_urls[NBR_RIGHT_MENU]
void aside(const string &textLine)
int get_prev_step(int theStep, int theSubStep)
char font_combination
1=Corben&Nobile, 2=Droid (Serif and Sans), d = default (non-google fonts), 3=Ubuntu+Sans, 4=Ubuntu+Vollkorn, 5=handwritten+sans, 6 = handrwitten titles+serif! (pref 3 and 5)
int get_prev_sub_step(int theStep, int theSubStep)
const string c_photos_phdb_dir
const string c_salt
const string c_arrow
const string wrapper_url
void header(int iid=0, bool addSavingsPlan=false, bool addPlots=false)
string collapse_open(string parent_id, string title, int nbr, bool add_triangle=true, bool is_open=true, string xtra_body_class="")
const string t_breadcrumb
Definition: texts_Eng_UK.h:35
string error_message
global message variables
Definition: efp.cpp:132
#define NBR_TABS
number of tabs in the main menu of the software
Definition: efp.cpp:80
const bool show_social
std::map< string, int > sub_step_nbrs
const string t_title
Definition: texts_Eng_UK.h:7
std::map< string, string > STRMAP
const string c_content_header
const string c_right_menu_names[NBR_RIGHT_MENU]
#define NBR_RIGHT_MENU
the number of menu items floated to the right
Definition: efp.cpp:82
const std::map< int, string > c_photos_phdb
std::map< int, STEPDEF > sub_steps
int get_next_sub_step(int theStep, int theSubStep)
std::map< string, int > step_nbrs
void show_args(int argc, char **argv)
int get_next_step(int theStep, int theSubStep)
bool sub_step_exists(int theStep, int theSubStep)
string get_box_color_class(string the_color)
const string wrapper_name
void next_step(int stepNbr, int subStepNbr)
#define NBR_SUB_TABS
maximum number of tabs used in the sub-menu
Definition: efp.cpp:81
const string soft_name
const string t_hide_extra_info
Definition: texts_Eng_UK.h:105
int get_sub_step_nbr(string sub_step_name)
Cgicc cgi
Definition: efp.cpp:129
const string t_next_step
Definition: texts_Eng_UK.h:18
void show_toolBar(string tab_name, string usrName="")
void navbar_item(int k, string usr_name="", string tab_name="")
void footer(string tab_name, string extraInfo="")
string collapse_close(string parent_id="", int nbr=0, bool add_triangle=true)
unordered_map< string, string > t_extraInfo
Definition: texts_Eng_UK.h:108
string get_string(const std::string &varName)
const string www_dir
unordered_map< string, string > t_after_title
Definition: texts_Eng_UK.h:179
string std_message
Definition: efp.cpp:133
string get_glyphicon(string the_color)
std::map< int, STRMAP > STEPDEF
const string assetClassColors
void cout_box_color(string the_color)
config oConfig
mysql connection mysql connector from dev.mysql.com
Definition: efp.cpp:149
char language
1=UK English
const string c_doc_type
char layout
Presentation.
const string t_show_extra_info
Definition: texts_Eng_UK.h:104
std::map< int, string > scale125i2s
a scale from 1 to 5, int to string