File:  [mozdev] / cdn / www / sources.html
Revision 1.137: download - view: text, annotated - select for diffs - revision graph
Thu Feb 27 14:08:11 2003 UTC (16 years, 6 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
longer page - checkins this month

    1: <!-- MAIN CONTENT -->
    2: <h5 class="page-header">Source Code</h5>
    3: 
    4: <p>
    5:   The cdn source code can be accessed in either of the following ways:
    6: </p>
    7: 
    8: <ul>
    9: <li>View the source using the CVS <a href="http://www.mozdev.org/source/browse/cdn/">web interface</a></li>
   10: <li>Check out the source using anonymous CVS with the following commands (password is guest):
   11: 
   12: <pre>
   13: cvs -d :pserver:guest@mozdev.org:/cvs login
   14: cvs -d :pserver:guest@mozdev.org:/cvs co cdn
   15: </pre>
   16: 
   17: </li>
   18: </ul><?php $doNotCapitalise = 1; // $project='orbits'; // testing ?>
   19: 
   20: <?php
   21: 
   22: // $Id: sources.html,v 1.137 2003/02/27 14:08:11 cdn Exp $
   23: 
   24:   require("include/CVS_PATHS");
   25: 
   26:   define(MAX_READ_SIZE, 500000);
   27:   define(MAX_READ, 100000);
   28: 
   29:   $today              = date("y/m/d"); if (ereg('local', HOST) ): $today = '03/02/21'; endif;
   30:   $day = (int)date('d');
   31:   --$day;
   32:   $yesterday          = date("y/m/" . sprintf('%2u', $day));
   33:   $this_month         = date("y/m/");
   34:   
   35:   $today = $this_month;
   36:   
   37:   $commit_log         = "cvs@$project.mozdev.org";
   38: 
   39:   if(!$local_conf_commits)
   40:     print '<span id="CVS-local-conf-commits">' . $local_conf_commits_msg . "</span>\n";
   41: 
   42:   //BEGIN BLOCK
   43:  
   44:    if(file_exists(COMMIT_PATH.$commit_log) && 
   45:       $local_conf_commits) {
   46: 
   47:      $size = filesize(COMMIT_PATH.$commit_log);
   48: 
   49:     $contents = array();
   50:     if ($size > MAX_READ_SIZE) {
   51:       // print "<!-- Log File is greater than 500K -->\n";
   52: 
   53:       $fp = fopen (COMMIT_PATH.$commit_log, "r");
   54:       fseek($fp, $size - MAX_READ);
   55:       if ($contents) {
   56:         print "$contents\n";
   57:         exit;
   58:       }
   59:       $tok = strtok(fread($fp, MAX_READ),"\n");
   60:       while ($tok) {
   61:         array_push($contents, $tok);
   62:         $tok = strtok("\n");
   63:       }
   64:       fclose($fp);
   65:     }
   66:     
   67:     if (!$contents)
   68:       $contents = file(COMMIT_PATH.$commit_log);
   69: 
   70:     // preprocess Tag: stuff would be here if it didn't mess
   71:     // things up completely
   72: 
   73:     $len=count($contents);
   74:     $r            = -1;
   75:     
   76:     $_project = $project;
   77:     
   78:     if ( !isset($doNotCapitalise) )
   79:       $_project = PROJECT;
   80:    
   81:     print '<script type="text/javascript" src="/js/styleswitcher.js"></script>' . "\n";
   82: 
   83:     print '<h4 id="CVS-h4">' . "Today's CVS Commits for " . $_project . " Project</h4>\n";
   84:     print '<div id="CVS-table">' . "\n";
   85: 
   86:     if($len) {
   87:       
   88:       print '<p id="CVS-style-switch"><a href="#" onclick="setActiveStyleSheet(\'Default Checkins\'); return false;">change style to default</a> |' . "\n";
   89:       print '<a href="#" onclick="setActiveStyleSheet(\'Bonsai-esque Checkins\'); return false;">change style to bonsai</a></p>' . "\n";
   90:       
   91:       print '<div class="CVS-block CVS-dft-hidden">' . "\n";
   92:       print '<div class="CVS-td-900 CVS-headers">Who</div>' . "\n";
   93:       print '<div class="CVS-td-f90 CVS-headers">When</div>' . "\n";
   94:       print '<div class="CVS-td-checkins">' . "\n" .
   95:             '<div class="CVS-checkins CVS-headers" style="margin-top: 1px;">';
   96:       print 'What</div>' . "\n";
   97:       print '<div class="CVS-log CVS-headers" style="margin-top: 1px;">Why</div>' . "\n";
   98:       print '</div></div>';
   99:       print '<div style="clear: left; float: none;"></div>' . "\n";
  100: 
  101:       for($i=0;$i<$len;$i++) {
  102:         if(ereg("Modified:    www", $contents[$l]) &&
  103:            !$local_conf_commits)
  104:           break;
  105: 
  106: //start of parse of commitlog for $today / $yesterday
  107: 
  108:         if(ereg("  Date: $today", $contents[$i])) {
  109:           $r++;
  110: 
  111:           $yy = substr(YEAR, 0, 2);
  112: 
  113:           $_timestamp = str_replace('Date: ', '', ltrim($contents[$i]));
  114:           $_timestamp = str_replace("\n", '', $_timestamp);
  115: 
  116:           $_ts_link = $yy . ereg_replace('[\ \/]', '_', $_timestamp);
  117: 
  118:           $_timestamp = '<a name="' . $_ts_link . '">'; 
  119: 
  120:           $result[$r] = '<div class="CVS-block';
  121: 
  122:           if ($r == 0) 
  123:             $result[$r] .= ' CVS-last-block';
  124: 
  125:           $result[$r] .= '"><div class="CVS-td-900">' . "\n";
  126: 
  127: //who
  128:           $result[$r] .= "<strong>" . $_timestamp . htmlspecialchars($contents[$i-1]) . "</a></strong>\n" .
  129:           "</div>\n" .
  130:           '<div class="CVS-td-f90">' . "\n";
  131: 
  132:           $_time = htmlspecialchars($contents[$i]);
  133: 
  134: // when
  135:           $result[$r] .= '<a class="CVS-td-f90" href="' . '#' . $_ts_link . '">' . $_time . '</a>';
  136: 
  137:           $result[$r] = eregi_replace("(User|Date):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span> ", $result[$r]);
  138: 
  139:           $result[$r] .= "\n</div>\n" .
  140:           '<div class="CVS-td-checkins">' . "\n" .
  141:           '<div class="CVS-checkins">' . "\n";
  142: 
  143:           $webcvs = 'http://www.' . HOST . '/source/browse/' . $project;
  144: 
  145:           for($l=$i+1;$l<$len;$l++) {
  146:             if(ereg("  Revision  Changes    Path", $contents[$l]))
  147:               break;
  148: 
  149:             if(ereg("  User:", $contents[$l]))
  150:               break;
  151: 
  152:             $checkins = eregi_replace("((https|http|mailto|ftp):\/\/[^[:space:]<>]{1,})",
  153:                         "<a href=\"\\1\">\\1</a>", htmlspecialchars($contents[$l]));
  154: 
  155:             // '  Added:       www/img  background.png' 
  156:             // '  Modified:    www      cdn.css' 
  157:             // '  Removed:     www/protected sources.html'
  158:             // '               www/compact index.html'
  159:             // '  mozpos/downloads - New directory'
  160: 
  161:             if ( ereg("^[[:space:]]{1,3}Log\:", $checkins) ) {
  162:               $idRemoved = false; $_log_section = true;
  163:              // $checkins = eregi_replace("(Log):{1}", '<span class="CVS-bonsai-hidden"' . ">\\1</span>", $checkins);
  164:               $checkins = '</div>' . "\n" . '</div>' . "\n" .
  165:                           '<div class="CVS-log"><div class="CVS-bonsai-hidden">' . $checkins;
  166:             }
  167: 
  168:             if ( ereg("^[[:space:]]{1,3}((Added|Modified|Removed):)", $checkins) || ereg("^[[:space:]]{9}", $checkins) ||
  169:                  strstr($checkins, "New directory")
  170:                ) {
  171: 
  172:               if ( !strstr($checkins, "New directory") ) {
  173:                 $identifier = trim(substr($checkins, 0, 15)); // may change to &nbsp; group
  174: 
  175:                 $checkins = substr($checkins, 15);
  176: 
  177:                 $_New_directory = false;
  178:               }
  179:               else {
  180:                 $checkins = str_replace('- New directory', '-_New_directory', $checkins);
  181: 
  182:                 $webcvs = 'http://www.' . HOST . '/source/browse';
  183: 
  184:                 unset($identifier);
  185: 
  186:                 $_New_directory = true;
  187:               }
  188: 
  189:               $_16 = strpos($checkins, ' ');
  190: 
  191:               $_path = substr( $checkins, 0, $_16);
  192: 
  193:               $checkins = ereg_replace('[[:space:]]{1,}', ' ',
  194:                           trim( substr ( $checkins, $_16 ) ) );
  195: 
  196:               $checkinsA = explode(' ', $checkins);
  197: 
  198:               unset($checkins);
  199: 
  200:               for($z=0; $z < count($checkinsA); ++$z)
  201:                 $checkinsA[$z] = trim($checkinsA[$z]);
  202: 
  203:               if ( !empty($identifier) )
  204:                 $checkins = '<span class="CVS-bonsai-hidden">' . $identifier . '</span>';
  205: 
  206:               if ( !empty($_path)) {
  207:                 // reset, important !
  208:                 $webcvs = 'http://www.' . HOST . '/source/browse/' . $project; 
  209:                 $webcvs .= '/' . $_path;
  210:                 $checkins .= ' <span class="CVS-bonsai-hidden"><a href="' . $webcvs;
  211:                 $checkins .= '">' . $_path . '</a></span>';
  212:               }
  213: 
  214:               $Y = count($checkinsA);
  215: 
  216:               for($y=0; $y < $Y; ++$y) {
  217: 
  218:                 if ( ereg('Tag:', $checkinsA[$y]) || ereg('Tag:', $checkinsA[$y-1]) || $_tag ||
  219:                      strstr($checkinsA[$y], '-_New_directory')
  220:                    )
  221:                   $TAG = true;
  222:                 else
  223:                   $TAG = false;
  224: 
  225:                 $checkins .= ' <span';
  226: 
  227:                 if ( !$_New_directory )
  228:                   $checkins .= ' class="CVS-dft-inline"';
  229: 
  230:                 if ( strstr($checkinsA[$y+1], '-_New_directory') )
  231:                   $checkins .= ' class="CVS-dft-inline"';
  232: 
  233:                 $checkins .= '>';
  234: 
  235:                 if(!$TAG) {
  236:                   $checkins .= '<a href="' . $webcvs . '/';
  237: 
  238:                   if( $identifier == 'Removed:' || $idRemoved )
  239:                     $checkins .= 'Attic/';
  240: 
  241:                   $checkins .= $checkinsA[$y] . '">';
  242:                 }
  243: 
  244:                 if ( !$_New_directory ) {
  245:                   $checkins .= '<span class="CVS-dft-hidden">'; // $project / $_path
  246:                   $_webcvs = str_replace('http://www.' . HOST . '/source/browse/', '', $webcvs);
  247: 
  248:                   if ( strlen($_webcvs) > 15 )
  249:                     $checkins .= substr($_webcvs, 0, 12) . '...' . substr($_webcvs, strrpos($_webcvs, '/'));
  250:                   else
  251:                     $checkins .= $_webcvs;
  252: 
  253:                   if( $identifier == 'Removed:' || $idRemoved )
  254:                     $checkins .= '/Attic';
  255: 
  256:                   $checkins .= '/</span>';
  257:                 }
  258: 
  259:                 $checkinsA[$y] = str_replace('-_New_directory', '- New directory', $checkinsA[$y]);
  260: 
  261:                 $checkins .= $checkinsA[$y];
  262: 
  263:                 if (ereg("Tag\:$", trim($checkinsA[$y])) &&
  264:                     empty($checkinsA[$y+1]))
  265:                   $_tag = true; 
  266:                 else
  267:                   $_tag = false;
  268: 
  269:                 if (!$TAG)
  270:                   $checkins .= '</a>';
  271: 
  272:                   $checkins .= '</span>';
  273: 
  274:               }
  275: 
  276:               if ( $identifier == 'Removed:' || $idRemoved )
  277:                 $idRemoved = true;
  278:               else
  279:                 $idRemoved = false;
  280: 
  281:             }
  282: 
  283:             $checkins = trim( str_replace('</span> <span>', ' ', $checkins) );
  284: 
  285:             if ( !ereg('^<d', $checkins) )
  286:               $checkins = '<div class="CVS-div-checkins">' . $checkins;
  287: // what
  288:             if ( !empty( $checkins ) )
  289:               $result[$r] .= $checkins . "</div>\n"; // what
  290:   
  291: 
  292:           }
  293: 
  294:             if ( $_log_section ) {
  295:               $_log_section = false;
  296:               $result[$r] .= '</div>';
  297:             }
  298: 
  299:           $result[$r] .= "</div>\n";
  300:           $result[$r] .= "</div>\n";
  301:           $result[$r] .= '<div style="clear: left; float: none;"></div>' . "\n";
  302:         }
  303: 
  304: // end  of parse of commitlog for $today / $yesterday
  305: 
  306:       }
  307:     }
  308: 
  309:     if (!$result) {  
  310:       print '<div id="CVS-no-commits">There are no new commits today</div>'."\n";
  311:     } else {
  312:       $reversed=array_reverse($result);
  313:       for ($i=0;$i<count($result);$i++)
  314:         print $reversed[$i];
  315: //        print $reversed[0];
  316:     }
  317: 
  318:     print "</div>\n\n";
  319: 
  320:   } // END BLOCK
  321: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>