File:  [mozdev] / cdn / www / sources.html
Revision 1.171: download - view: text, annotated - select for diffs - revision graph
Tue Jun 10 07:31:48 2003 UTC (15 years, 10 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

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

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