Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2003 21:26:31 +0200
From:      "Paul Gelderblom" <paulgelderblom@bigfoot.com>
To:        <freebsd-cvsweb@FreeBSD.org>
Cc:        =?iso-8859-1?Q?Ville_Skytt=E4?= <scop@FreeBSD.org>
Subject:   Contribution: show different icon for icon for binary (-kb) files and show keyword expansion mode on the log page
Message-ID:  <001001c338f4$2f831000$0b00000a@a2000.nl>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C33904.F2EA4E40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

Attached is a patch that makes cvsweb display a different icon for files =
that are -according to the cvs server- binary files.
Until now, cvsweb merely ignored keyword expansion lines in the (r)log, =
but after this patch it uses them as follows:
- in the directory page binary files get a different icon
- in the log page, the keyword expansion type is shown, with an =
additional note if it's a binary file.

Of course, you need an icon for this; my 'artwork' is included  (put it =
in the cvsweb/icons folder) (based on the other icons already present =
there; am I not infringing anyone's copyright?)
For those who use the Apache icons ( in /icons by default on an apache =
server) it will use the binary.gif already present there.

The patch file included is a context diff against the current head =
revision in the freebsd repository.

Ville: It's a relatively small change so I hope it can be included there =
....

Greetings,
Paul Gelderblom
paulgelderblom@bigfoot.com







------=_NextPart_000_000C_01C33904.F2EA4E40
Content-Type: application/octet-stream;
	name="binicon.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="binicon.patch"

Index: cvsweb.cgi=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /home/ncvs/projects/cvsweb/cvsweb.cgi,v=0A=
retrieving revision 1.149=0A=
diff -c -r1.149 cvsweb.cgi=0A=
*** cvsweb.cgi	4 May 2003 10:42:20 -0000	1.149=0A=
--- cvsweb.cgi	22 Jun 2003 08:00:03 -0000=0A=
***************=0A=
*** 62,68 ****=0A=
    %MIRRORS %DEFAULTVALUE %ICONS %MTYPES=0A=
    @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS=0A=
    %alltags %fileinfo %tags @branchnames %nameprinted=0A=
!   %symrev %revsym @allrevisions %date %author @revdisplayorder=0A=
    @revisions %state %difflines %log %branchpoint @revorder=0A=
    $prcgi @prcategories $re_prcategories $prkeyword $re_prkeyword =
$mancgi=0A=
    $checkoutMagic $doCheckout $scriptname $scriptwhere=0A=
--- 62,68 ----=0A=
    %MIRRORS %DEFAULTVALUE %ICONS %MTYPES=0A=
    @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS=0A=
    %alltags %fileinfo %tags @branchnames %nameprinted=0A=
!   %symrev %revsym @allrevisions %date %author @revdisplayorder =
$keywordsubstitution=0A=
    @revisions %state %difflines %log %branchpoint @revorder=0A=
    $prcgi @prcategories $re_prcategories $prkeyword $re_prkeyword =
$mancgi=0A=
    $checkoutMagic $doCheckout $scriptname $scriptwhere=0A=
***************=0A=
*** 72,78 ****=0A=
    %input $query $barequery $sortby $bydate $byrev $byauthor=0A=
    $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot=0A=
    $mimetype $charset $output_filter $defaultTextPlain $defaultViewable=0A=
!   $command_path %CMD $allow_compress $backicon $diricon $fileicon =
$graphicon=0A=
    $fullname $newname $cvstreedefault $logo $defaulttitle $address=0A=
    $long_intro $short_instruction $shortLogLen $show_author=0A=
    $tablepadding $hr_breakable $showfunc $hr_ignwhite $hr_ignkeysubst=0A=
--- 72,78 ----=0A=
    %input $query $barequery $sortby $bydate $byrev $byauthor=0A=
    $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot=0A=
    $mimetype $charset $output_filter $defaultTextPlain $defaultViewable=0A=
!   $command_path %CMD $allow_compress $backicon $diricon $fileicon =
$graphicon $binfileicon=0A=
    $fullname $newname $cvstreedefault $logo $defaulttitle $address=0A=
    $long_intro $short_instruction $shortLogLen $show_author=0A=
    $tablepadding $hr_breakable $showfunc $hr_ignwhite $hr_ignkeysubst=0A=
***************=0A=
*** 793,799 ****=0A=
  =0A=
      if ($file eq '..' || -d "$fullname/$file") {=0A=
        next if ($file eq '..' && $where eq '/');=0A=
!       my ($rev, $date, $log, $author, $filename) =3D =
@{$fileinfo{$file}}=0A=
          if (defined($fileinfo{$file}));=0A=
        printf "<tr class=3D\"dir-row-%s\">\n<td colspan=3D\"2\">",=0A=
          ($dirrow % 2) ? 'even' : 'odd';=0A=
--- 793,799 ----=0A=
  =0A=
      if ($file eq '..' || -d "$fullname/$file") {=0A=
        next if ($file eq '..' && $where eq '/');=0A=
!       my ($rev, $date, $log, $author, $filename, $keywordsubst) =3D =
@{$fileinfo{$file}}=0A=
          if (defined($fileinfo{$file}));=0A=
        printf "<tr class=3D\"dir-row-%s\">\n<td colspan=3D\"2\">",=0A=
          ($dirrow % 2) ? 'even' : 'odd';=0A=
***************=0A=
*** 878,892 ****=0A=
        $url       =3D './' . $fileurl . $query;=0A=
        $filesexists++;=0A=
        next if (!defined($fileinfo{$file}));=0A=
!       my ($rev, $date, $log, $author) =3D @{$fileinfo{$file}};=0A=
        $filesfound++;=0A=
        printf "<tr class=3D\"dir-row-%s\">\n", ($dirrow % 2) ? 'even' : =
'odd';=0A=
        printf '<td%s>', $allow_cvsgraph ? '' : ' colspan=3D"2"';=0A=
  =0A=
        if ($nofilelinks) {=0A=
!         print $fileicon;=0A=
        } else {=0A=
!         print &link($fileicon, $url);=0A=
        }=0A=
        print '&nbsp;', &link(htmlquote($file), $url), $attic;=0A=
        if ($allow_cvsgraph) {=0A=
--- 878,893 ----=0A=
        $url       =3D './' . $fileurl . $query;=0A=
        $filesexists++;=0A=
        next if (!defined($fileinfo{$file}));=0A=
!       my ($rev, $date, $log, $author, $filename, $keywordsubst) =3D =
@{$fileinfo{$file}};=0A=
        $filesfound++;=0A=
        printf "<tr class=3D\"dir-row-%s\">\n", ($dirrow % 2) ? 'even' : =
'odd';=0A=
        printf '<td%s>', $allow_cvsgraph ? '' : ' colspan=3D"2"';=0A=
  =0A=
+       my $icon=3D($keywordsubst eq "b" ? $binfileicon:$fileicon);=0A=
        if ($nofilelinks) {=0A=
!         print $icon;=0A=
        } else {=0A=
!         print &link($icon, $url);=0A=
        }=0A=
        print '&nbsp;', &link(htmlquote($file), $url), $attic;=0A=
        if ($allow_cvsgraph) {=0A=
***************=0A=
*** 2149,2154 ****=0A=
--- 2150,2156 ----=0A=
    my $state =3D 'start';=0A=
    my ($date, $branchpoint, $branch, $log, @filetags);=0A=
    my ($rev, $revision, $revwanted, $filename, $head, $author);=0A=
+   my ($keywordsubst);=0A=
  =0A=
    while (<$fh>) {=0A=
      if ($state eq "start") {=0A=
***************=0A=
*** 2163,2168 ****=0A=
--- 2165,2171 ----=0A=
        $revision    =3D '';=0A=
        %symrev      =3D ();=0A=
        @filetags    =3D ();=0A=
+       $keywordsubst=3D '';=0A=
  =0A=
        #jump to head state=0A=
        $state =3D "head";=0A=
***************=0A=
*** 2180,2185 ****=0A=
--- 2183,2190 ----=0A=
          $head =3D $1;=0A=
        } elsif (/^branch: (.+)$/) {=0A=
          $branch =3D $1;=0A=
+       } elsif (/^keyword substitution: (.+)$/) {=0A=
+         $keywordsubst =3D $1;=0A=
        } elsif (/^symbolic names:/) {=0A=
          $state =3D "tags";=0A=
          ($branch =3D $head) =3D~ s/\.\d+$//=0A=
***************=0A=
*** 2250,2256 ****=0A=
                : 0=0A=
              && ($rev eq $head))=0A=
          {    # Don't think head is needed here..=0A=
!           my @finfo =3D ($rev, $date, $log, $author, $filename);=0A=
            my ($name);=0A=
            ($name =3D $filename) =3D~ s%/.*%%;=0A=
            $fileinfo{$name} =3D [@finfo];=0A=
--- 2255,2261 ----=0A=
                : 0=0A=
              && ($rev eq $head))=0A=
          {    # Don't think head is needed here..=0A=
!           my @finfo =3D ($rev, $date, $log, $author, $filename, =
$keywordsubst);=0A=
            my ($name);=0A=
            ($name =3D $filename) =3D~ s%/.*%%;=0A=
            $fileinfo{$name} =3D [@finfo];=0A=
***************=0A=
*** 2313,2318 ****=0A=
--- 2318,2324 ----=0A=
    undef %state;=0A=
    undef %difflines;=0A=
    undef %log;=0A=
+   $keywordsubstitution=3D"";=0A=
  =0A=
    if (!open($fh, "-|")) {    # child=0A=
      if ($revision ne '') {=0A=
***************=0A=
*** 2331,2342 ****=0A=
        } else {=0A=
          $symnames =3D 0;=0A=
        }=0A=
!     } elsif (/^head:\s+([\d\.]+)/) {=0A=
        $head =3D $1;=0A=
      } elsif (/^branch:\s+([\d\.]+)/) {=0A=
        $curbranch =3D $1;=0A=
      } elsif (/^symbolic names/) {=0A=
        $symnames =3D 1;=0A=
      } elsif (/^-----/) {=0A=
        last;=0A=
      }=0A=
--- 2337,2351 ----=0A=
        } else {=0A=
          $symnames =3D 0;=0A=
        }=0A=
!     }=0A=
!     if (/^head:\s+([\d\.]+)/) {=0A=
        $head =3D $1;=0A=
      } elsif (/^branch:\s+([\d\.]+)/) {=0A=
        $curbranch =3D $1;=0A=
      } elsif (/^symbolic names/) {=0A=
        $symnames =3D 1;=0A=
+     } elsif (/^keyword substitution: (.+)$/) {=0A=
+         $keywordsubstitution =3D $1;=0A=
      } elsif (/^-----/) {=0A=
        last;=0A=
      }=0A=
***************=0A=
*** 2852,2857 ****=0A=
--- 2861,2869 ----=0A=
    print "\n</p>\n<hr noshade>\n";=0A=
  =0A=
    print "<p>\n";=0A=
+ =0A=
+   my $explain=3D($keywordsubstitution =3D~ /b/) ? " (i.e.: CVS =
considers this a binary file)":"";=0A=
+   print "Keyword substitution: $keywordsubstitution $explain<br>\n";=0A=
    print $curbranch=0A=
      ? ("Default branch: ", ($revsym{$curbranch} || $curbranch))=0A=
      : "No default branch";=0A=
Index: cvsweb.conf=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /home/ncvs/projects/cvsweb/cvsweb.conf,v=0A=
retrieving revision 1.49=0A=
diff -c -r1.49 cvsweb.conf=0A=
*** cvsweb.conf	4 May 2003 10:54:39 -0000	1.49=0A=
--- cvsweb.conf	22 Jun 2003 08:00:05 -0000=0A=
***************=0A=
*** 203,208 ****=0A=
--- 203,209 ----=0A=
            back  =3D> [('[BACK]',  "$iconsdir/back.gif",      20,   =
22)],=0A=
            dir   =3D> [('[DIR]',   "$iconsdir/dir.gif",       20,   =
22)],=0A=
            file  =3D> [('[TXT]',   "$iconsdir/text.gif",      20,   =
22)],=0A=
+           binfile  =3D> [('[BINARY]',"$iconsdir/binary.gif", 20,   =
22)],=0A=
            graph =3D> [('[GRAPH]', "$iconsdir/minigraph.png", 16,   =
16)],=0A=
  );=0A=
  undef $iconsdir;=0A=

------=_NextPart_000_000C_01C33904.F2EA4E40--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001001c338f4$2f831000$0b00000a>