File:  [mozdev] / cdn / www / sources.html
Revision 1.170: download - view: text, annotated - select for diffs - revision graph
Thu Mar 13 17:03:49 2003 UTC (16 years, 7 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
http://mozdev.org/bugs/show_bug.cgi?id=3377

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

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