File:  [mozdev] / cdn / www / sources.html
Revision 1.133: download - view: text, annotated - select for diffs - revision graph
Thu Feb 27 10:21:54 2003 UTC (16 years, 5 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
tweaks

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

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