File:  [mozdev] / cdn / www / sources.html
Revision 1.128: download - view: text, annotated - select for diffs - revision graph
Thu Feb 27 01:01:03 2003 UTC (16 years, 5 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
style switcher !

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

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