threads / rfc / 4585

RFC patchgitweb: Add title attribute with unshortened value for table cells

Subject: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

## tl;dr

7 messages between Jun 20, 2006 and Jun 20, 2006. Diffs are folded; open one to read it.

replies: 6people: 4as markdown or json

Jakub Narebski· Jun 20, 2006, 08:12 UTC · lore

This allows to see full, unshortened value on mouseover using 'title' attribute for <td> element. For now it means only author name and project owner name.

Ugly solution using $cgi->start_td({-title => VALUE})

Doesn't work well with values outside us-ascii, but that might be considered web browser bug (misfeature), not a bug in gitweb.

--- The idea is to have full value available on mouseover, be it commit title, author of the commit, project owner, tag name/title or project description. For now only author name and project owner name are implemented, and implementation is ugly and results is not perfect.

 gitweb/gitweb.cgi |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
b72280ac4649d54375732de771f7d92c7d350258
Show changes to gitweb/gitweb.cgi +6 −6
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 1b254df..9a09b20 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -887,7 +887,7 @@ sub git_project_list {
 		$alternate ^= 1;
 		print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary"), -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
 		      "<td>$pr->{'descr'}</td>\n" .
-		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
+		      $cgi->start_td({-title => $pr->{'owner'}}) . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
 		my $colored_age;
 		if ($pr->{'commit'}{'age'} < 60*60*2) {
 			$colored_age = "<span style =\"color: #009900;\"><b><i>$pr->{'commit'}{'age_string'}</i></b></span>";
@@ -1057,7 +1057,7 @@ sub git_summary {
 				$ref = " <span class=\"tag\">" . esc_html($refs->{$commit}) . "</span>";
 			}
 			print "<td><i>$co{'age_string'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
 			      "<td>";
 			if (length($co{'title_short'}) < length($co{'title'})) {
 				print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
@@ -2306,7 +2306,7 @@ sub git_history {
 			}
 			$alternate ^= 1;
 			print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
 			      "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" .
 			      esc_html(chop_str($co{'title'}, 50)) . "$ref</b>") . "</td>\n" .
 			      "<td class=\"link\">" .
@@ -2396,7 +2396,7 @@ sub git_search {
 			}
 			$alternate ^= 1;
 			print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-			      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
+			      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
 			      "<td>" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" . esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
 			my $comment = $co{'comment'};
@@ -2449,7 +2449,7 @@ sub git_search {
 					}
 					$alternate ^= 1;
 					print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-					      "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
+					      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
 					      "<td>" .
 					      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$co{'id'}"), -class => "list"}, "<b>" .
 					      esc_html(chop_str($co{'title'}, 50)) . "</b><br/>");
@@ -2537,7 +2537,7 @@ sub git_shortlog {
 		}
 		$alternate ^= 1;
 		print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
-		      "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
+		      $cgi->start_td({-title => $co{'author_name'}}) . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
 		      "<td>";
 		if (length($co{'title_short'}) < length($co{'title'})) {
 			print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
-- 
1.3.0
Junio C Hamano· Jun 20, 2006, 09:15 UTC · re: Jakub Narebski · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

Jakub Narebski <jnareb@gmail.com> writes:
> Doesn't work well with values outside us-ascii, but that might be
> considered web browser bug (misfeature), not a bug in gitweb.
That's sad.
Are you sure about it?

What does start_td({-title=>"blah"}) produce? <td title="blah">? If so, is http://members.cox.net/junkio/t.html close to what you are trying to achieve here?

>  		      "<td>$pr->{'descr'}</td>\n" .
> -		      "<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
> +		      $cgi->start_td({-title => $pr->{'owner'}}) . chop_str($pr->{'owner'}, 15) . "</i></td>\n";

Where did the opening <i> go? Not that I care about italics, since I think this should all be done with stylesheet, but I do care about unbalanced pairs.

BTW, I haven't nailed down the procedure to update the kernel.org gitweb installations (I suspect the burden is on me since Kay orphaned gitweb onto me).

I wonder if there is somebody who is willing to run gitweb from the "next" branch on some public site, so that I can be reasonably confident before breaking one of the most important infrastructure of the kernel development? Volunteers?

Timo Hirvonen· Jun 20, 2006, 09:46 UTC · re: Junio C Hamano · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

Junio C Hamano <junkio@cox.net> wrote:
> I wonder if there is somebody who is willing to run gitweb from
> the "next" branch on some public site, so that I can be
> reasonably confident before breaking one of the most important
> infrastructure of the kernel development?  Volunteers?
I can help.
http://onion.dynserv.net/git/gitweb.cgi
Note: http://onion.dynserv.net/git/ (index.cgi) is an old version.

Global symbol "$path" requires explicit package name at /var/www/localhost/htdocs/git/gitweb.cgi line 1521. Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to compilation errors.

The line is:
$file =~ m#^/# or $file = "$projectroot/$path/$file";

$path seems to be undefined. I don't understand perl very well so I can't fix it.

-- 
http://onion.dynserv.net/~timo/
Jakub Narebski· Jun 20, 2006, 09:59 UTC · re: Timo Hirvonen · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

Timo Hirvonen wrote:
Show 13 quoted lines
> http://onion.dynserv.net/git/gitweb.cgi
> 
> Global symbol "$path" requires explicit package name at
> /var/www/localhost/htdocs/git/gitweb.cgi line 1521.
> Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to
> compilation errors.
> 
> The line is:
> 
> $file =~ m#^/# or $file = "$projectroot/$path/$file";
> 
> $path seems to be undefined.  I don't understand perl very well so I
> can't fix it.
Temporary fix is in:
 
  "[PATCH] Fix: Support for the standard mime.types map in gitweb"
  (Message-Id: <11507843541678-git-send-email-jnareb@gmail.com>)
    http://permalink.gmane.org/gmane.comp.version-control.git/22172
BTW. I have _my_ version at 
  http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Timo Hirvonen· Jun 20, 2006, 10:57 UTC · re: Jakub Narebski · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

Jakub Narebski <jnareb@gmail.com> wrote:
Show 21 quoted lines
> Timo Hirvonen wrote:
> 
> > http://onion.dynserv.net/git/gitweb.cgi
> > 
> > Global symbol "$path" requires explicit package name at
> > /var/www/localhost/htdocs/git/gitweb.cgi line 1521.
> > Execution of /var/www/localhost/htdocs/git/gitweb.cgi aborted due to
> > compilation errors.
> > 
> > The line is:
> > 
> > $file =~ m#^/# or $file = "$projectroot/$path/$file";
> > 
> > $path seems to be undefined.  I don't understand perl very well so I
> > can't fix it.
> 
> Temporary fix is in:
>  
>   "[PATCH] Fix: Support for the standard mime.types map in gitweb"
>   (Message-Id: <11507843541678-git-send-email-jnareb@gmail.com>)
>     http://permalink.gmane.org/gmane.comp.version-control.git/22172

Seems to work now. I also enabled blame and it works too. But I noticed that the search is sometimes broken. If you click a "blob" link and then try to search something gitweb will complain:

    403 Forbidden - Unknown commit object. 

"h" parameter is blob, not commit. Shouldn't the h parameter be set to HEAD always when searching? Searching starts at h so the search results vary:

http://onion.dynserv.net/git/gitweb.cgi?p=cmus.git&a=search&h=HEAD&s=pickaxe%3Atheme
http://onion.dynserv.net/git/gitweb.cgi?p=cmus.git&a=search&h=fd2d983d51858e25cc71b14b59c787e1683ba7c5&s=pickaxe%3Atheme
-- 
http://onion.dynserv.net/~timo/
Jakub Narebski· Jun 20, 2006, 09:48 UTC · re: Junio C Hamano · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

Junio C Hamano wrote:
Show 8 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Doesn't work well with values outside us-ascii, but that might be
>> considered web browser bug (misfeature), not a bug in gitweb.
> 
> That's sad.
> 
> Are you sure about it?
Now I see I was wrong.
> What does start_td({-title=>"blah"}) produce? <td title="blah">?
> If so, is http://members.cox.net/junkio/t.html close to what you
> are trying to achieve here?

Yes, that is what I tried to achieve. Using CGI to set attributes was to quote characters which cannot be in double quited attribute values, i.e. change '"' to '&#34;' or '&quot;'. I don't know what start_td did with \"o character (Perl v5.8.6, CGI::VERSION=3.05).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
David Woodhouse· Jun 20, 2006, 15:28 UTC · re: Junio C Hamano · lore

Re: [PATCH/RFC] gitweb: Add title attribute with unshortened value for table cells

On Tue, 2006-06-20 at 02:15 -0700, Junio C Hamano wrote:
> I wonder if there is somebody who is willing to run gitweb from
> the "next" branch on some public site, so that I can be
> reasonably confident before breaking one of the most important
> infrastructure of the kernel development?  Volunteers? 

Yeah, we can do it on git.infradead.org if you promise to respond quickly when you break it. Or I can set up a virtual host on http://git2.infradead.org/ to use the testing version if you'd prefer.

Mail me a SSH public key, I'll give you an account.
-- 
dwmw2

← back to recent threads