Changeset 750 for trunk/lib


Ignore:
Timestamp:
Jan 12, 2009, 5:46:11 AM (13 years ago)
Author:
Peter Johansson
Message:

fixes #358

Location:
trunk/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r693 r750  
    33/*
    44  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2009 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    140141  void Directory::print_core(const bool verbose) const
    141142  {
     143    mkdir("blame_output/" + local_path_);
    142144    // print daughter nodes, i.e., this function is recursive
    143145    for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i)
  • trunk/lib/File.cc

    r712 r750  
    33/*
    44  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2009 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    5455    if (!output_dir_.empty())
    5556      output_dir_+='/';
     57  }
     58
     59
     60  std::string File::blame_output_file_name(void) const
     61  {
     62    return "blame_output/" + local_path() + ".html";
    5663  }
    5764
     
    215222  void File::print_blame(std::ofstream& os) const
    216223  {
    217     os << "<br /><h3>Blame Information</h3>";
     224    os << "<br /><h3>" << local_path() << "</h3>";
    218225    os << "<table class=\"blame\">\n";
    219226    os << "<thead>\n";
     
    324331  void File::print_core(const bool verbose) const
    325332  {
     333    std::ofstream os(blame_output_file_name().c_str());
     334    assert(os.good());
     335    print_html_start(os, "svndigest", level_+1);
     336    print_blame(os);
     337    print_footer(os);
     338    os.close();
    326339  }
    327340
     
    354367    print_author_summary(os, stats_[stats_type], line_type, log);
    355368    os << "\n";
    356 
    357     print_blame(os);
     369    os << "<h3>"
     370       << anchor(blame_output_file_name(),
     371                 "Blame Information", level_+3)
     372       << "</h3>\n";
    358373
    359374    print_footer(os);
  • trunk/lib/File.h

    r693 r750  
    66/*
    77  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2009 Peter Johansson
    89
    910  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    7374
    7475  private:
     76    std::string blame_output_file_name(void) const;
     77
    7578    /**
    7679       @return log of this File.
  • trunk/lib/html_utility.cc

    r733 r750  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2009 Peter Johansson
    67
    78  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    2122*/
    2223
     24#include <config.h>
     25
    2326#include "html_utility.h"
    2427
    25 #include "config.h"
    2628#include "Configuration.h"
    2729#include "Date.h"
    2830#include "HtmlStream.h"
    2931#include "subversion_info.h"
    30 #include <config.h> // this header file is created by configure
    3132
    3233#include <sstream>
     
    7778                    const std::string& stats)
    7879  {
     80    print_html_start(os, title, level);
     81    os << "<div id=\"menu\">"
     82       << "<ul>\n<li></li>\n";
     83    if (item=="main")
     84      os << "<li class=\"highlight\">";
     85    else
     86      os << "<li>";
     87    os << anchor("index.html", "Main", level, "Main page");
     88    os << "</li>\n";
     89
     90    std::string stats_local(stats);
     91    if (stats_local=="none")
     92      stats_local = "classic";
     93
     94    if (item=="total")
     95      os << "<li class=\"highlight\">";
     96    else
     97      os << "<li>\n";
     98    os << anchor(stats_local+"/"+user+"/total/"+path, "Total", level,
     99           "View statistics of all lines");
     100    os << "</li>\n";
     101
     102    if (item=="code")
     103      os << "<li class=\"highlight\">";
     104    else
     105      os << "<li>";
     106    os << anchor(stats_local+"/"+user+"/code/"+path, "Code", level,
     107                 "View statistics of code lines");
     108    os << "</li>\n";
     109
     110    if (item=="comments")
     111      os << "<li class=\"highlight\">";
     112    else
     113      os << "<li>";
     114    os << anchor(stats_local+"/"+user+"/comments/"+path, "Comment", level,
     115                 "View statistics of comment lines");
     116    os << "</li>\n";
     117
     118
     119    if (item=="empty")
     120      os << "<li class=\"highlight\">";
     121    else
     122      os << "<li>";
     123    os << anchor(stats_local+"/"+user+"/empty/"+path, "Other", level,
     124                 "View statistics of other lines");
     125    os << "</li>\n";
     126    os << "<li>";
     127    // Peter, this is ugly! But how to add space?
     128    for (size_t i=0; i<50; ++i)
     129      os << "&nbsp;";
     130    os << "</li>\n";
     131
     132    std::string item_local(item);
     133    if (item_local=="none")
     134      item_local = "total";
     135    if (item_local=="main")
     136      item_local = "total";
     137
     138    if (stats=="classic")
     139      os << "<li class=\"highlight\">";
     140    else
     141      os << "<li>";
     142    os << anchor("classic/"+user+"/"+item_local+"/"+path, "Classic", level,
     143                 "View classic statistics");
     144    os << "</li>\n";
     145
     146    if (stats=="blame")
     147      os << "<li class=\"highlight\">";
     148    else
     149      os << "<li>";
     150    os << anchor("blame/"+user+"/"+item_local+"/"+path, "Blame", level,
     151                 "View blame statistics");
     152    os << "</li>\n";
     153
     154    if (stats=="add")
     155      os << "<li class=\"highlight\">";
     156    else
     157      os << "<li>";
     158    os << anchor("add/"+user+"/"+item_local+"/"+path, "Add", level,
     159                 "View add statistics");
     160    os << "</li>\n";
     161
     162
     163    os << "</li>\n"
     164       << "</ul></div>\n"
     165       << "<div id=\"main\">\n";
     166  }
     167
     168
     169  void print_html_start(std::ostream& os, const std::string& title,
     170                        unsigned int level)
     171  {
    79172    os << "<!-- Generated by " << PACKAGE_STRING << "-->\n";
    80173    os << "<!DOCTYPE html\n"
     
    91184    os << "svndigest.css\" type=\"text/css\" />\n"
    92185       << "</head>\n"
    93        << "<body>\n"
    94        << "<div id=\"menu\">"
    95        << "<ul>\n<li></li>\n";
    96     if (item=="main")
    97       os << "<li class=\"highlight\">";
    98     else
    99       os << "<li>";
    100     os << anchor("index.html", "Main", level, "Main page");
    101     os << "</li>\n";
    102 
    103     std::string stats_local(stats);
    104     if (stats_local=="none")
    105       stats_local = "classic";
    106 
    107     if (item=="total")
    108       os << "<li class=\"highlight\">";
    109     else
    110       os << "<li>\n";
    111     os << anchor(stats_local+"/"+user+"/total/"+path, "Total", level,
    112            "View statistics of all lines");
    113     os << "</li>\n";
    114 
    115     if (item=="code")
    116       os << "<li class=\"highlight\">";
    117     else
    118       os << "<li>";
    119     os << anchor(stats_local+"/"+user+"/code/"+path, "Code", level,
    120                  "View statistics of code lines");
    121     os << "</li>\n";
    122 
    123     if (item=="comments")
    124       os << "<li class=\"highlight\">";
    125     else
    126       os << "<li>";
    127     os << anchor(stats_local+"/"+user+"/comments/"+path, "Comment", level,
    128                  "View statistics of comment lines");
    129     os << "</li>\n";
    130 
    131 
    132     if (item=="empty")
    133       os << "<li class=\"highlight\">";
    134     else
    135       os << "<li>";
    136     os << anchor(stats_local+"/"+user+"/empty/"+path, "Other", level,
    137                  "View statistics of other lines");
    138     os << "</li>\n";
    139     os << "<li>";
    140     // Peter, this is ugly! But how to add space?
    141     for (size_t i=0; i<50; ++i)
    142       os << "&nbsp;";
    143     os << "</li>\n";
    144 
    145     std::string item_local(item);
    146     if (item_local=="none")
    147       item_local = "total";
    148     if (item_local=="main")
    149       item_local = "total";
    150 
    151     if (stats=="classic")
    152       os << "<li class=\"highlight\">";
    153     else
    154       os << "<li>";
    155     os << anchor("classic/"+user+"/"+item_local+"/"+path, "Classic", level,
    156                  "View classic statistics");
    157     os << "</li>\n";
    158 
    159     if (stats=="blame")
    160       os << "<li class=\"highlight\">";
    161     else
    162       os << "<li>";
    163     os << anchor("blame/"+user+"/"+item_local+"/"+path, "Blame", level,
    164                  "View blame statistics");
    165     os << "</li>\n";
    166 
    167     if (stats=="add")
    168       os << "<li class=\"highlight\">";
    169     else
    170       os << "<li>";
    171     os << anchor("add/"+user+"/"+item_local+"/"+path, "Add", level,
    172                  "View add statistics");
    173     os << "</li>\n";
    174 
    175 
    176     os << "</li>\n"
    177        << "</ul></div>\n"
    178        << "<div id=\"main\">\n";
    179   }
    180 
     186       << "<body>\n";
     187  }
    181188
    182189  std::string trac_revision(svn_revnum_t r, std::string color)
  • trunk/lib/html_utility.h

    r716 r750  
    88  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    99  Copyright (C) 2008 Jari Häkkinen
     10  Copyright (C) 2008 Peter Johansson
    1011
    1112  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    6869
    6970
     71  /**
     72     \brief print html start
     73
     74     Just like print_header, this function outputs start of html page,
     75     but in contrast to print_header there are no menus in the otput
     76     of this function.
     77   */
     78  void print_html_start(std::ostream& os, const std::string& title,
     79                        unsigned int level);
     80
     81
    7082  ///
    7183  /// @return if trac-revision is set in config file anchor to trac is
  • trunk/lib/utility.cc

    r724 r750  
    33/*
    44  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2009 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    191192    if (code){
    192193      std::stringstream ss;
    193       ss << "mkdir(" << dir << "): failed with error code: errno=" << errno;
     194      ss << "mkdir(" << dir << "): failed\n" << strerror(errno);
    194195      throw std::runtime_error(ss.str());
    195196    }
Note: See TracChangeset for help on using the changeset viewer.