Changeset 379 for trunk/lib/File.cc


Ignore:
Timestamp:
Jun 20, 2007, 11:35:02 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Addresses #62.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r356 r379  
    22
    33/*
    4   Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2007 Peter Johansson
     4  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
    65
    76  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
     
    7877  }
    7978
    80 
    81   void File::print_core(const std::string& user, const std::string& line_type,
    82                         const SVNlog& log) const
    83   {
    84     std::string outpath = user+"/"+line_type+"/"+local_path();
    85     std::string imagefile = "images/"+line_type+"/"+local_path_+".png";
    86     std::string html_name(outpath + ".html");
    87     std::ofstream os(html_name.c_str());
    88     print_header(os, name(), level_+2, user, line_type, local_path()+".html");
    89     path_anchor(os);
    90     os << "<p align=center>\n<img src='";
    91     for (size_t i=0; i<level_; ++i)
    92       os << "../";
    93     os << "../../";
    94     if (user=="all")
    95       os << stats_.plot(imagefile,line_type);
    96     else
    97       os << imagefile;
    98     os << "' alt='[plot]' border=0>\n</p>";
    99 
    100     print_author_summary(os, line_type, log);
    101     os << "</p>\n";
    102 
    103     print_footer(os);
    104     os.close();
    105   }
    106 
    107 
    108   void File::print_core(const bool verbose) const
    109   {
    110   }
    111 
     79  /*
     80  void File::blame_anchor(std::ostream& os) const
     81  {
     82    os << "<h2 class=\"path\">\n";
     83    std::vector<std::string> words;
     84    words.reserve(level_+1);
     85    std::string word;
     86    words.push_back(Node::project_);
     87    std::stringstream ss(local_path());
     88    while(getline(ss,word,'/'))
     89      if (!word.empty()) // ignore double slash in path
     90        words.push_back(word);
     91    if (words.size()==1)
     92      os << anchor("index.html", Node::project_,0, "View " + Node::project_);
     93    else {
     94      for (size_t i=0; i<words.size()-1; ++i){
     95        os << anchor("index.html", words[i], level_-i, "View " + words[i]);
     96        os << "<span class=\"sep\">/</span>\n";
     97      }
     98      os << anchor(href(), words.back(), level_+2-words.size(),
     99             "View " + words.back());
     100    }
     101    os << "\n</h2>\n";
     102  }
     103  */
    112104
    113105  void File::print_blame(std::ofstream& os, const std::string line_type) const
    114106  {
     107    os << "<h3>Blame information</h3>";
    115108    os << "<table class=\"blame\">\n";
    116 
     109    os << "<thead>\n";
     110    os << "<tr>\n";
     111    os << "<th>Rev</th>\n";
     112    os << "<th>Author</th>\n";
     113    os << "<th>Line</th>\n";
     114    os << "</tr>\n</thead>\n";
     115    os << "<tbody>\n";
     116
     117    os << "</tbody>\n";
    117118    os << "</table>\n";
    118119  }
     
    152153      }
    153154    }
    154 
    155155
    156156    // Code copied from Gnuplot -r70
     
    228228    // finally move printed temporary file to original file
    229229    rename(tmpname, path().c_str());
    230    
    231   }
     230  }
     231
     232
     233  void File::print_core(const bool verbose) const
     234  {
     235  }
     236
     237
     238  void File::print_core(const std::string& user, const std::string& line_type,
     239                        const SVNlog& log) const
     240  {
     241    std::string outpath = user+"/"+line_type+"/"+local_path();
     242    std::string imagefile = "images/"+line_type+"/"+local_path_+".png";
     243    std::string html_name(outpath + ".html");
     244    std::ofstream os(html_name.c_str());
     245    print_header(os, name(), level_+2, user, line_type, local_path()+".html");
     246    path_anchor(os);
     247
     248    os << "<p align=center>\n<img src='";
     249    for (size_t i=0; i<level_; ++i)
     250      os << "../";
     251    os << "../../";
     252    if (user=="all")
     253      os << stats_.plot(imagefile,line_type);
     254    else
     255      os << imagefile;
     256    os << "' alt='[plot]' border=0>\n</p>";
     257
     258    print_author_summary(os, line_type, log);
     259    os << "</p>\n";
     260
     261    print_blame(os,line_type);
     262
     263    print_footer(os);
     264    os.close();
     265  }
     266
    232267}} // end of namespace svndigest and namespace theplu
Note: See TracChangeset for help on using the changeset viewer.