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

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