// $Id: html_utility.cc 430 2007-07-06 23:33:11Z peter $ /* Copyright (C) 2006 Peter Johansson Copyright (C) 2007 Jari Häkkinen, Peter Johansson This file is part of svndigest, http://trac.thep.lu.se/trac/svndigest svndigest 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 2 of the License, or (at your option) any later version. svndigest 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "html_utility.h" #include "Configuration.h" #include "Date.h" #include "HtmlStream.h" #include // this header file is created by configure #include #include namespace theplu{ namespace svndigest{ std::string anchor(const std::string& url, const std::string& name, u_int level, const std::string& title) { std::stringstream ss; HtmlStream hs(ss); ss << ""; hs << name; ss << ""; return ss.str(); } void print_footer(std::ostream& os) { Date date; os << "

\nGenerated on " << date("%a %b %d %H:%M:%S %Y") << " (UTC) by " << anchor("http://trac.thep.lu.se/trac/svndigest/", PACKAGE_STRING, 0, "") << "\n

\n\n\n\n"; } void print_header(std::ostream& os, std::string title, u_int level, std::string user, std::string item, std::string path) { os << "\n" << "\n" << "\n" << " " << title << " - svndigest\n" << "\n" << "\n" << "\n" << "
" << "
  • "; if (item=="main") os << "
  • "; else os << "
  • "; os << anchor("index.html", "Main", level, "Main page"); os << "
  • "; if (item=="total") os << "
  • "; else os << "
  • "; os << anchor(user+"/total/"+path, "Total", level, "View statistics of all lines"); os << "
  • "; if (item=="code") os << "
  • "; else os << "
  • "; os << anchor(user+"/code/"+path, "Code", level, "View statistics of code lines"); os << "
  • "; if (item=="comments") os << "
  • "; else os << "
  • "; os << anchor(user+"/comments/"+path, "Comment", level, "View statistics of comment lines"); os << "
  • "; if (item=="empty") os << "
  • "; else os << "
  • "; os << anchor(user+"/empty/"+path, "Other", level, "View statistics of empty lines"); os << "
  • " << "
" << "
\n"; } std::string trac_revision(size_t r) { const Configuration& conf = Configuration::instance(); std::stringstream ss; if (conf.trac_root().empty()) ss << r; else { std::stringstream rev; rev << r; ss << anchor(conf.trac_root()+"changeset/"+rev.str(), rev.str()); } return ss.str(); } }} // end of namespace svndigest and namespace theplu