codestriker-commits Mailing List for Codestriker: collaborative code reviewer (Page 19)
Brought to you by:
sits
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(58) |
Dec
(14) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(12) |
Feb
(53) |
Mar
(2) |
Apr
|
May
(36) |
Jun
(59) |
Jul
(69) |
Aug
(47) |
Sep
(54) |
Oct
(45) |
Nov
|
Dec
|
| 2006 |
Jan
(20) |
Feb
(3) |
Mar
|
Apr
(6) |
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(12) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2007 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
(7) |
Jul
(7) |
Aug
(6) |
Sep
(5) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
(7) |
Feb
(13) |
Mar
(9) |
Apr
|
May
|
Jun
(50) |
Jul
(22) |
Aug
(58) |
Sep
(28) |
Oct
|
Nov
|
Dec
|
|
From: <si...@us...> - 2005-05-05 09:35:37
|
Topic "CVS commit: Comment tooltip now uses XMLHttpRequest objec..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=46167&action=view -------------------------------------------------------------- Description: Comment tooltip now uses XMLHttpRequest object rather than using an iframe. Modified SubmitNewCommentAction so that it can send an XML reply, if that is what the format parameter requested. The tooltip is dragged by Control-LeftMouseButton. This needed to be changed otherwise text could not be entered into the comment fields. There may be a way of have a "Drag" link, which can activate the drag, as on my Linux box, the window manage grabs the Control-LeftMouseButton event, and drags the entire browser window! -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.css codestriker/html/codestriker.js codestriker/lib/Codestriker/Action/SubmitNewComment.pm codestriker/lib/Codestriker/Http/Input.pm codestriker/lib/Codestriker/Http/Response.pm codestriker/template/en/default/submitnewcomment.html.tmpl |
|
From: <si...@us...> - 2005-03-01 10:13:13
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=335572&action=view User: sits Date: 05/03/01 02:12:54 Modified: lib/Codestriker/Action EditComment.pm ListProjects.pm SubmitNewComment.pm ViewTopic.pm ViewTopicComments.pm ViewTopicFile.pm ViewTopicInfo.pm ViewTopicProperties.pm lib/Codestriker/Http Render.pm Response.pm template/en/default viewtopic.html.tmpl Log: Moved the javascript+css code for comment handling into Response.pm, so that comments are properly handled on all screens. Index: EditComment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/EditComment.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- EditComment.pm 30 Jan 2005 00:47:55 -0000 1.12 +++ EditComment.pm 1 Mar 2005 10:12:49 -0000 1.13 @@ -31,6 +31,7 @@ my $mode = $http_input->get('mode'); my $tabwidth = $http_input->get('tabwidth'); my $anchor = $http_input->get('a'); + my $fview = $http_input->get('fview'); # Retrieve the appropriate topic details. my $topic = Codestriker::Model::Topic->new($topicid); @@ -42,7 +43,7 @@ my @document_description = split /\n/, $topic->{description}; # Display the header of this page. - $http_response->generate_header(topic=>$topicid, + $http_response->generate_header(topic=>$topic, topic_title=>"Edit Comment: $topic->{title}", email=>$email, mode=>$mode, @@ -55,7 +56,8 @@ $vars->{'topic_title'} = $topic->{title}; Codestriker::Action::ViewTopic::ProcessTopicHeader($vars, $topic, - $url_builder); + $url_builder, $fview, + $tabwidth, 1, 0); my $view_topic_url = $url_builder->view_url($topicid, $line, $mode); my $view_comments_url = $url_builder->view_comments_url($topicid); Index: ListProjects.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ListProjects.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ListProjects.pm 30 Sep 2004 10:27:09 -0000 1.9 +++ ListProjects.pm 1 Mar 2005 10:12:49 -0000 1.10 @@ -30,7 +30,7 @@ my @projects = Codestriker::Model::Project->list(); # Display the data, with each prject title linked to edit project page. - $http_response->generate_header(topic => -1, topic_title=>"Project List", + $http_response->generate_header(topic_title=>"Project List", reload=>0, cache=>0); # Create the hash for the template variables. Index: SubmitNewComment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitNewComment.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SubmitNewComment.pm 17 Aug 2004 22:28:46 -0000 1.5 +++ SubmitNewComment.pm 1 Mar 2005 10:12:49 -0000 1.6 @@ -77,7 +77,7 @@ # up will ensure the next editing topic will be handled quickly, as the # overhead of bringing up a new window is removed. my $reload = $query->param('submit') eq 'Submit+Refresh' ? 1 : 0; - $http_response->generate_header(topic=>$topicid, + $http_response->generate_header(topic=>$topic, topic_title=>"Comment Submitted: $topic->{title}", email=>$email, repository=>$topic->{repository}, Index: ViewTopic.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopic.pm,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- ViewTopic.pm 21 Feb 2005 11:25:05 -0000 1.50 +++ ViewTopic.pm 1 Mar 2005 10:12:49 -0000 1.51 @@ -66,9 +66,11 @@ # Retrieve line-by-line versions of the data and description. my @document_description = split /\n/, $topic->{description}; - $http_response->generate_header(topic=>$topic->{topicid}, + $http_response->generate_header(topic=>$topic, + comments=>\@comments, topic_title=>"Topic Text: $topic->{title}", mode=>$mode, tabwidth=>$tabwidth, + fview=>$fview, reload=>0, cache=>1); # Retrieve the repository object, if repository functionality is enabled. @@ -214,7 +216,6 @@ my @document = split /\n/, $topic->{document}; my $max_digit_width = length($#document+1); - # Build the render which will be used to build this page. my $render = Codestriker::Http::Render->new($query, $url_builder, 1, $max_digit_width, $topicid, @@ -262,49 +263,51 @@ Codestriker::TopicListeners::Manager::topic_viewed($email, $topic); } -# This function is used by all of the three topic pages to fill out the -# common template items that are required by all three. -sub ProcessTopicHeader($$$) { +# This function is used by all of the view topic tabs to fill out the +# common template items that are required by all, in addition to the view +# topic file action. +sub ProcessTopicHeader +{ my ($vars, $topic, $url_builder) = @_; # Handle the links in the three topic tabs. $vars->{'view_topicinfo_url'} = $url_builder->view_topicinfo_url($topic->{topicid}); $vars->{'view_topic_url'} = - ## XX mode, last param + ## XX mode, last param $url_builder->view_url($topic->{topicid}, -1, 0); - + $vars->{'view_comments_url'} = $url_builder->view_comments_url($topic->{topicid}); - + $vars->{'view_topic_properties_url'} = $url_builder->view_topic_properties_url($topic->{topicid}); - + my @project_ids = ($topic->{project_id}); $vars->{'list_open_topics_in_project_url'} = $url_builder->list_topics_url("", "", "", "", "", "", "", "", "", "", [ 0 ], \@project_ids); - + # Retrieve the comment details for this topic. my @comments = $topic->read_comments(); - + # Obtains how many comments there are, and the internal link to them. $vars->{'number_comments'} = $#comments + 1; - + # Obtain the view topic summary information, the title, bugs it relates # to, and who the participants are. $vars->{'title'} = $topic->{title}; - + $vars->{'author'} = Codestriker->filter_email($topic->{author}); $vars->{'document_creation_time'} = - Codestriker->format_timestamp($topic->{creation_ts}); - + Codestriker->format_timestamp($topic->{creation_ts}); + $vars->{'topic'} = $topic->{topicid}; - + $vars->{'reviewers'} = Codestriker->filter_email($topic->{reviewers}); $vars->{'cc'} = Codestriker->filter_email($topic->{cc}); - + # Get the list of obsoleted topics. my @obsoleted_topics = (); foreach my $id (@{ $topic->{obsoleted_topics} }) { @@ -315,7 +318,7 @@ push @obsoleted_topics, $entry; } $vars->{'obsoleted_topics'} = \@obsoleted_topics; - + # Get the list of topics this has been obsoleted by. my @obsoleted_by = (); foreach my $id (@{ $topic->{obsoleted_by} }) { @@ -328,4 +331,5 @@ $vars->{'obsoleted_by'} = \@obsoleted_by; } + 1; Index: ViewTopicComments.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicComments.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ViewTopicComments.pm 2 Feb 2005 22:18:48 -0000 1.13 +++ ViewTopicComments.pm 1 Mar 2005 10:12:49 -0000 1.14 @@ -25,6 +25,8 @@ my $topicid = $http_input->get('topic'); my $email = $http_input->get('email'); my $mode = $http_input->get('mode'); + my $fview = $http_input->get('fview'); + my $tabwidth = $http_input->get('tabwidth'); my $feedback = $http_input->get('feedback'); my $show_context = $http_input->get('scontext'); my $show_comments_from_user = $http_input->get('sauthor'); @@ -49,9 +51,11 @@ my $topic = Codestriker::Model::Topic->new($topicid); # Display the data, with each topic title linked to the view topic screen. - $http_response->generate_header(topic=>$topicid, + $http_response->generate_header(topic=>$topic, + comments=>\@comments, topic_title=>"Topic Comments: $topic->{title}", - email=>$email, + email=>$email, fview=>$fview, + tabwidth=>$tabwidth, reload=>0, cache=>0); # Create the hash for the template variables. Index: ViewTopicFile.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicFile.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ViewTopicFile.pm 22 Feb 2005 22:06:10 -0000 1.10 +++ ViewTopicFile.pm 1 Mar 2005 10:12:49 -0000 1.11 @@ -94,9 +94,12 @@ "View File: $filename v$revision"; } - $http_response->generate_header(topic=>$topicid, topic_title=>$title, + $http_response->generate_header(topic=>$topic, + comments=>\@comments, + topic_title=>$title, mode=>$mode, tabwidth=>$tabwidth, + fview=>$fview, repository=>$topic->{repository}, reload=>0, cache=>1); @@ -198,7 +201,7 @@ $$maxline_length_ref = 0; for (my $i = 1; $i <= $#$data_array_ref; $i++) { $$data_array_ref[$i] = - Codestriker::Http::Render->tabadjust($tabwidth, + Codestriker::Http::Render::tabadjust($tabwidth, $$data_array_ref[$i], 0); my $line_length = length($$data_array_ref[$i]); if ($line_length > $$maxline_length_ref) { Index: ViewTopicInfo.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicInfo.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ViewTopicInfo.pm 17 Aug 2004 22:28:46 -0000 1.11 +++ ViewTopicInfo.pm 1 Mar 2005 10:12:49 -0000 1.12 @@ -43,7 +43,7 @@ # Retrieve the comment details for this topic. my @topic_comments = $topic->read_comments(); - $http_response->generate_header(topic=>$topic->{topicid}, + $http_response->generate_header(topic=>$topic, topic_title=>"Topic Properties: $topic->{title}", mode=>$mode, tabwidth=>$tabwidth, reload=>0, cache=>1); Index: ViewTopicProperties.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicProperties.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ViewTopicProperties.pm 30 Sep 2004 22:58:04 -0000 1.11 +++ ViewTopicProperties.pm 1 Mar 2005 10:12:49 -0000 1.12 @@ -40,7 +40,7 @@ # Retrieve the comment details for this topic. my @topic_comments = $topic->read_comments(); - $http_response->generate_header(topic=>$topic->{topicid}, + $http_response->generate_header(topic=>$topic, topic_title=>"Topic Properties: $topic->{title}", mode=>$mode, tabwidth=>$tabwidth, reload=>0, cache=>1); Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- Render.pm 24 Feb 2005 09:41:01 -0000 1.48 +++ Render.pm 1 Mar 2005 10:12:52 -0000 1.49 @@ -151,114 +151,6 @@ $self->{idhashref} = undef; } - # Precompute the overlib HTML for each comment location. - print "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; - - # Add the reviewers for the review here. - print " var topic_reviewers = '" . $topic_obj->{reviewers} . "';\n"; - - # Now record all the comments made so far in the topic. - print " var comment_text = new Array();\n"; - print " var comment_hash = new Array();\n"; - print " var comment_metrics = new Array();\n"; - my $index; - for ($index = 0; $index <= $#comment_locations; $index++) { - - # Contains the overlib HTML text. - my $overlib_html = ""; - - # Determine what the previous and next comment locations are. - my $previous = undef; - my $next = undef; - if ($index > 0) { - $previous = $comment_locations[$index-1]; - } - if ($index < $#comment_locations) { - $next = $comment_locations[$index+1]; - } - - # Compute the previous link if required. - my $current_url = $self->{query}->self_url(); - if (defined $previous && $previous =~ /^(\-?\d+)|\-?\d+|\d+$/o) { - my $previous_fview = $1; - my $previous_index = $index - 1; - my $previous_url = $current_url; - $previous_url =~ s/fview=\d+/fview=$previous_fview/o if $self->{fview} != -1; - $previous_url .= '#' . $previous; - $overlib_html .= "<a href=\"javascript:window.location=\\'$previous_url\\'; "; - if ($self->{fview} == -1 || $self->{fview} == $previous_fview) { - $overlib_html .= "overlib(comment_text[$previous_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$previous_index\\')), FIXY, getEltPageTop(getElt(\\'c$previous_index\\'))); "; -} - $overlib_html .= "void(0);\">Previous</a>"; - } - - # Compute the next link if required. - if (defined $next && $next =~ /^(\-?\d+)|\-?\d+|\d+$/o) { - my $next_fview = $1; - $overlib_html .= " | " if defined $previous; - my $next_index = $index + 1; - my $next_url = $current_url; - $next_url =~ s/fview=\d+/fview=$next_fview/o if $self->{fview} != -1; - $next_url .= '#' . $next; - $overlib_html .= "<a href=\"javascript:window.location=\\'$next_url\\'; "; - if ($self->{fview} == -1 || $self->{fview} == $next_fview) { - $overlib_html .= "overlib(comment_text[$next_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$next_index\\')), FIXY, getEltPageTop(getElt(\\'c$next_index\\'))); "; - } - $overlib_html .= "void(0);\">Next</a>"; - } - if (defined $previous || defined $next) { - $overlib_html .= " | "; - } - - # Add an add comment link. - my $key = $comment_locations[$index]; - $key =~ /^(\-?\d+)\|(\-?\d+)\|(\d+)$/o; - $overlib_html .= "<a href=\"javascript:add_comment_tooltip($1,$2,$3)" . - "; void(0);\">Add Comment</a> | "; - - # Add a close link. - $overlib_html .= "<a href=\"javascript:hideElt(getElt(\\'overDiv\\')); void(0);\">Close</a><p>"; - - # Create the actual comment text. - my @comments = @{ $comment_hash{$key} }; - - for (my $i = 0; $i <= $#comments; $i++) { - my $comment = $comments[$i]; - - # Need to format the data appropriately for HTML display. - my $data = HTML::Entities::encode($comment->{data}); - $data =~ s/\'/\\\'/mg; - $data =~ s/\n/<br>/mg; - $data =~ s/ / /mg; - $data = tabadjust($self, $self->{tabwidth}, $data, 1); - - # Show each comment with the author and date in bold. - $overlib_html .= "<b>Comment from $comment->{author} "; - $overlib_html .= "on $comment->{date}</b><br>"; - $overlib_html .= "$data"; - - # Add a newline at the end if required. - if ($i < $#comments && - substr($overlib_html, length($overlib_html)-4, 4) ne '<br>') { - $overlib_html .= '<br>'; - } - } - - print " comment_text[$index] = '$overlib_html';\n"; - print " comment_hash['" . $comment_locations[$index] . "'] = $index;\n"; - - # Store the current metric values for this comment. - print " comment_metrics[$index] = new Array();\n"; - my $comment_metrics = $comments[0]->{metrics}; - foreach my $metric_config (@{ $Codestriker::comment_state_metrics }) { - my $value = $comment_metrics->{$metric_config->{name}}; - $value = "" unless defined $value; - print " comment_metrics[${index}]['" . - $metric_config->{name} . "'] = '" . $value . "';\n"; - } - - } - print "</script>\n"; bless $self, $type; } @@ -718,7 +610,7 @@ } # Replace spaces and tabs with the appropriate number of 's. - $data = tabadjust($self, $self->{tabwidth}, $data, 1); + $data = tabadjust($self->{tabwidth}, $data, 1); if ($self->{brmode} == $Codestriker::LINE_BREAK_ASSIST_MODE) { $data =~ s/^(\s+)/my $sp='';for(my $i=0;$i<length($1);$i++){$sp.=' '}$sp;/ge; } @@ -947,7 +839,7 @@ my $data = HTML::Entities::encode($comment->{data}); $data =~ s/\n/<br>/mg; $data =~ s/ / /mg; - $data = tabadjust($self, $self->{tabwidth}, $data, 1); + $data = tabadjust($self->{tabwidth}, $data, 1); # Show each comment with the author and date in bold. $digest .= "<b>Comment from $comment->{author} "; @@ -1247,7 +1139,7 @@ my $query = $self->{query}; # Replace the line data with spaces. - my $newdata = tabadjust($self, $self->{tabwidth}, $data, 0); + my $newdata = tabadjust($self->{tabwidth}, $data, 0); if ($class ne "") { # Add the appropriate number of spaces to justify the data to a length @@ -1324,8 +1216,8 @@ # Replace the passed in string with the correct number of spaces, for # alignment purposes. -sub tabadjust ($$$$) { - my ($type, $tabwidth, $input, $htmlmode) = @_; +sub tabadjust ($$$) { + my ($tabwidth, $input, $htmlmode) = @_; $_ = $input; if ($htmlmode) { Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- Response.pm 24 Feb 2005 09:41:01 -0000 1.28 +++ Response.pm 1 Mar 2005 10:12:53 -0000 1.29 @@ -38,7 +38,7 @@ my ($self, %params) = @_; - my $topic = ""; + my $topic = undef; my $topic_title = ""; my $email = ""; my $reviewers = ""; @@ -49,6 +49,7 @@ my $projectid = ""; my $load_anchor = ""; my $topicsort = ""; + my $fview = -1; my $reload = $params{reload}; my $cache = $params{cache}; @@ -65,8 +66,8 @@ $topic = $params{topic}; $topic_title = $params{topic_title}; - # Some screens don't have $topic set, if so, set it to a blank value. - $topic = "" if ! defined($topic); + # Set the fview parameter if defined. + $fview = $params{fview} if defined $params{fview}; # Set the cookie in the HTTP header for the $email, $cc, $reviewers and # $tabwidth parameters. @@ -239,7 +240,7 @@ print "<script type=\"text/javascript\">\n"; print " var cs_load_anchor = '$load_anchor';\n"; print " var cs_reload = $reload;\n"; - print " var cs_topicid = $topic;\n" if defined $topic && $topic ne ""; + print " var cs_topicid = $topic->{topicid};\n" if defined $topic; print " var cs_email = '$email';\n" if defined $email; # Now output all of the comment metric information. @@ -261,16 +262,167 @@ } $i++; } - - print "</script>\n"; + # Output the comment declarations if the $comments array is defined. + my $comments = $params{comments}; + if (defined $comments) { + print generate_comment_declarations($topic, $comments, $query, + $fview, $tabwidth); + } + # Write an HTML comment indicating if response was sent compressed or not. $self->{output_compressed} = $output_compressed; print "\n<!-- Source was" . (!$output_compressed ? " not" : "") . " sent compressed. -->\n"; } +# Return the javascript code necessary to support viewing/modification of +# comments. +sub generate_comment_declarations +{ + my ($topic, $comments, $query, $fview, $tabwidth) = @_; + + # The output html to return. + my $html = ""; + + # Build a hash from filenumber|fileline|new -> comment array, to record + # what comments are associated with what locations. Also record the + # order of comment_locations found. + my %comment_hash = (); + my @comment_locations = (); + for (my $i = 0; $i <= $#$comments; $i++) { + my $comment = $$comments[$i]; + my $key = $comment->{filenumber} . "|" . $comment->{fileline} . "|" . + $comment->{filenew}; + if (! exists $comment_hash{$key}) { + push @comment_locations, $key; + } + push @{ $comment_hash{$key} }, $comment; + } + + # Precompute the overlib HTML for each comment location. + $html .= "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; + + # Add the reviewers for the review here. + $html .= " var topic_reviewers = '" . $topic->{reviewers} . "';\n"; + + # Now record all the comments made so far in the topic. + $html .= " var comment_text = new Array();\n"; + $html .= " var comment_hash = new Array();\n"; + $html .= " var comment_metrics = new Array();\n"; + my $index; + for ($index = 0; $index <= $#comment_locations; $index++) { + + # Contains the overlib HTML text. + my $overlib_html = ""; + + # Determine what the previous and next comment locations are. + my $previous = undef; + my $next = undef; + if ($index > 0) { + $previous = $comment_locations[$index-1]; + } + if ($index < $#comment_locations) { + $next = $comment_locations[$index+1]; + } + + # Compute the previous link if required. + my $current_url = $query->self_url(); + if (defined $previous && $previous =~ /^(\-?\d+)|\-?\d+|\d+$/o) { + my $previous_fview = $1; + my $previous_index = $index - 1; + my $previous_url = $current_url; + $previous_url =~ s/fview=\d+/fview=$previous_fview/o if $fview != -1; + $previous_url .= '#' . $previous; + $overlib_html .= "<a href=\"javascript:window.location=\\'$previous_url\\'; "; + if ($fview == -1 || $fview == $previous_fview) { + $overlib_html .= "overlib(comment_text[$previous_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$previous_index\\')), FIXY, getEltPageTop(getElt(\\'c$previous_index\\'))); "; +} + $overlib_html .= "void(0);\">Previous</a>"; + } + + # Compute the next link if required. + if (defined $next && $next =~ /^(\-?\d+)|\-?\d+|\d+$/o) { + my $next_fview = $1; + $overlib_html .= " | " if defined $previous; + my $next_index = $index + 1; + my $next_url = $current_url; + $next_url =~ s/fview=\d+/fview=$next_fview/o if $fview != -1; + $next_url .= '#' . $next; + $overlib_html .= "<a href=\"javascript:window.location=\\'$next_url\\'; "; + if ($fview == -1 || $fview == $next_fview) { + $overlib_html .= "overlib(comment_text[$next_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$next_index\\')), FIXY, getEltPageTop(getElt(\\'c$next_index\\'))); "; + } + $overlib_html .= "void(0);\">Next</a>"; + } + if (defined $previous || defined $next) { + $overlib_html .= " | "; + } + + # Add an add comment link. + my $key = $comment_locations[$index]; + $key =~ /^(\-?\d+)\|(\-?\d+)\|(\d+)$/o; + $overlib_html .= "<a href=\"javascript:add_comment_tooltip($1,$2,$3)" . + "; void(0);\">Add Comment</a> | "; + + # Add a close link. + $overlib_html .= "<a href=\"javascript:hideElt(getElt(\\'overDiv\\')); void(0);\">Close</a><p>"; + + # Create the actual comment text. + my @comments = @{ $comment_hash{$key} }; + + for (my $i = 0; $i <= $#comments; $i++) { + my $comment = $comments[$i]; + + # Need to format the data appropriately for HTML display. + my $data = HTML::Entities::encode($comment->{data}); + $data =~ s/\'/\\\'/mg; + $data =~ s/\n/<br>/mg; + $data =~ s/ / /mg; + $data = Codestriker::Http::Render::tabadjust($tabwidth, $data, 1); + + # Show each comment with the author and date in bold. + $overlib_html .= "<b>Comment from $comment->{author} "; + $overlib_html .= "on $comment->{date}</b><br>"; + $overlib_html .= "$data"; + + # Add a newline at the end if required. + if ($i < $#comments && + substr($overlib_html, length($overlib_html)-4, 4) ne '<br>') { + $overlib_html .= '<br>'; + } + } + + $html .= " comment_text[$index] = '$overlib_html';\n"; + $html .= " comment_hash['" . $comment_locations[$index] . + "'] = $index;\n"; + + # Store the current metric values for this comment. + $html .= " comment_metrics[$index] = new Array();\n"; + my $comment_metrics = $comments[0]->{metrics}; + foreach my $metric_config (@{ $Codestriker::comment_state_metrics }) { + my $value = $comment_metrics->{$metric_config->{name}}; + $value = "" unless defined $value; + $html .= " comment_metrics[${index}]['" . + $metric_config->{name} . "'] = '" . $value . "';\n"; + } + + } + $html .= "</script>\n"; + + # Now declare the CSS positional elements for each comment location. + $html .= "<style type=\"text/css\">\n"; + for (my $i = 0; $i <= $#$comments; $i++) { + $html .= '#c' . $i . ' { position: absolute; }' . "\n"; + } + $html .= "</style>\n"; + + # Return the generated HTML. + return $html; +} + + # Close the response, which only requires work if we are dealing with # compressed streams. sub generate_footer($) { Index: viewtopic.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopic.html.tmpl,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- viewtopic.html.tmpl 21 Feb 2005 11:25:31 -0000 1.31 +++ viewtopic.html.tmpl 1 Mar 2005 10:12:53 -0000 1.32 @@ -1,13 +1,3 @@ -[%# Output the style elements for the comments which exist #%] - -<style type="text/css"> -[% SET index = 0 %] -[% WHILE index < number_comments %] -#c[% index %] { position: absolute; } -[% index = index + 1 %] -[% END %] -</style> - </head> <body charset="ISO-8859-1" vlink="purple" onload="view_topic_on_load_handler();" bgcolor="#eeeeee" link="blue"> |
|
From: <si...@us...> - 2005-03-01 10:13:05
|
Topic "CVS commit: Moved the javascript+css code for comment han..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=335572&action=view -------------------------------------------------------------- Description: Moved the javascript+css code for comment handling into Response.pm, so that comments are properly handled on all screens. -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Action/EditComment.pm codestriker/lib/Codestriker/Action/ListProjects.pm codestriker/lib/Codestriker/Action/SubmitNewComment.pm codestriker/lib/Codestriker/Action/ViewTopic.pm codestriker/lib/Codestriker/Action/ViewTopicComments.pm codestriker/lib/Codestriker/Action/ViewTopicFile.pm codestriker/lib/Codestriker/Action/ViewTopicInfo.pm codestriker/lib/Codestriker/Action/ViewTopicProperties.pm codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Response.pm codestriker/template/en/default/viewtopic.html.tmpl |
|
From: <si...@us...> - 2005-02-24 09:44:47
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=881457&action=view User: sits Date: 05/02/24 01:44:34 Modified: html codestriker.js Log: Reduced size of field even more Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- codestriker.js 24 Feb 2005 09:40:58 -0000 1.5 +++ codestriker.js 24 Feb 2005 09:44:33 -0000 1.6 @@ -155,14 +155,14 @@ html += '<p><table><tr>\n' + '<td>Your email address: </td>\n' + '<td>' + - '<input type="text" name="email" size="35" maxlength="100" ' + + '<input type="text" name="email" size="25" maxlength="100" ' + 'value="' + cs_email + '">\n' + '</td><td></td></tr><tr>' + '<td>Cc: <font size="-1">' + '<a href="javascript:top.add_other_reviewers();">' + '(add other reviewers)</a></font> </td>' + '<td>' + - '<input type="text" name="comment_cc" size="35" ' + + '<input type="text" name="comment_cc" size="25" ' + 'maxlength="150"></td>\n' + '<td><input type="submit" name="submit" value="Submit"></td>' + '</tr></table></form></body></html>\n'; |
|
From: <si...@us...> - 2005-02-24 09:44:41
|
Topic "CVS commit: Reduced size of field even more" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=881457&action=view -------------------------------------------------------------- Description: Reduced size of field even more -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js |
|
From: <si...@us...> - 2005-02-24 09:41:26
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=947327&action=view User: sits Date: 05/02/24 01:41:02 Modified: html codestriker.js lib/Codestriker/Http Render.pm Response.pm template/en/default submitnewcomment.html.tmpl Log: Now generate the add comment window all via javascript, so that the backend is not required at all. Once the user enters in the comment, of course this is posted to the server. The add comment window is suitable simplified, since the actual topic text is visible in front of the reviewer. We could possibly position the window in a more optimised fashion rather than the middle of the screen, but that can come later. Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- codestriker.js 23 Feb 2005 00:03:17 -0000 1.4 +++ codestriker.js 24 Feb 2005 09:40:58 -0000 1.5 @@ -59,18 +59,204 @@ } } +// Create the HTML necessary for adding a comment. +function add_comment_html(file, line, new_value) +{ + // Get the location of the codestriker URL. + var l = top.location; + var url = l.protocol + '//' + l.host + l.pathname; + + // Create the initial form, with the appropriate hidden fields. + var html = '<html><body bgcolor="#eeeeee">\n' + + '<form name="add_comment" method="POST" ' + + 'action="' + url + '" ' + + 'onSubmit="return top.verify();" ' + + 'enctype="application/x-www-form-urlencoded">\n' + + '<input type="hidden" name="action" value="submit_comment">\n' + + '<input type="hidden" name="line" value="' + line + '">\n' + + '<input type="hidden" name="topic" value="' + cs_topicid + '">\n' + + '<input type="hidden" name="fn" value="' + file + '">\n' + + '<input type="hidden" name="new" value="' + new_value + '">\n' + + '<textarea name="comments" rows="5" cols="50" wrap="hard">\n' + + '</textarea>\n'; + + // Now add in the metric dropdowns. + if (top.cs_metric_data.length > 0) { + html += '<p><table>\n'; + } + for (var i = 0; i < top.cs_metric_data.length; i++) { + if (i % 2 == 0) { + html += '<tr>\n'; + } + html += '<td align="right">' + top.cs_metric_data[i].name + ':</td>\n'; + html += '<td align="left">\n'; + html += '<select name="comment_state_metric_' + + top.cs_metric_data[i].name + '">\n'; + + // Check if a value has been selected for this metric. + var key = file + '|' + line + '|' + new_value; + var comment_number = top.comment_hash[key]; + var current_value = null; + if (comment_number != null && + top.comment_metrics[comment_number] != null) { + current_value = + top.comment_metrics[comment_number][top.cs_metric_data[i].name]; + } + if (current_value == null) { + // If there is no default value defined, create an empty setting. + if (top.cs_metric_data[i].default_value == null) { + html += '<option value="Select Value">' + + '<Select Value></option>\n'; + } + for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { + html += '<option '; + var value = top.cs_metric_data[i].values[j]; + if (value == top.cs_metric_data[i].default_value) { + html += 'selected '; + } + html += 'value="' + value + '">' + value + '</option>\n'; + } + } + else { + // This metric does have a current value selected. + var found_current_value = 0; + for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { + var value = top.cs_metric_data[i].values[j]; + if (value == current_value) { + html += '<option selected value="' + value + '">' + + value + '</option>\n'; + found_current_value = 1; + } + else { + html += '<option value="' + value + '">' + value + + '</option>\n'; + } + } + + // Check if the current value was found, and if not, it must + // represent an old metric value no longer represented in the + // configuration file. + if (found_current_value == 0) { + html += '<option value="' + current_value + '">' + + current_value + '</option>\n'; + } + } + html += '</select>\n'; + html += ' </td>\n'; + if (i % 2 == 1 || i == top.cs_metric_data.length-1) { + html += '</tr>\n'; + } + } + if (top.cs_metric_data.length > 0) { + html += '</table>\n'; + } + + // Now add in the email address, CC and submit buttons. + html += '<p><table><tr>\n' + + '<td>Your email address: </td>\n' + + '<td>' + + '<input type="text" name="email" size="35" maxlength="100" ' + + 'value="' + cs_email + '">\n' + + '</td><td></td></tr><tr>' + + '<td>Cc: <font size="-1">' + + '<a href="javascript:top.add_other_reviewers();">' + + '(add other reviewers)</a></font> </td>' + + '<td>' + + '<input type="text" name="comment_cc" size="35" ' + + 'maxlength="150"></td>\n' + + '<td><input type="submit" name="submit" value="Submit"></td>' + + '</tr></table></form></body></html>\n'; + + // Return the generated html. + return html; +} + +// Verify that a comment is ready to be shipped out. +function verify() +{ + // Get a reference to the comment form. + var comment_form = top.comment_frame.document.add_comment; + + // Check that the comment field has a comment entered in it. + if (comment_form.comments.value == '') { + alert('No comment has been entered.'); + return false; + } + + // Check that the email field has an email address in it. + if (comment_form.email.value == '') { + alert('No email address has been entered.'); + return false; + } + + // Check that the metrics have been set. + for (var i = 0; i < top.cs_metric_data.length; i++) { + var metric_name = top.cs_metric_data[i].name; + var name = 'comment_state_metric_' + metric_name; + var index = comment_form.elements[name].options.selectedIndex; + if (index == -1) { + alert('Metric "' + metric_name + '" has not been specified.'); + return false; + } + + var value = comment_form.elements[name].options[index].value; + if (value == 'Select Value') { + alert('Metric "' + metric_name + '" has not been specified.'); + return false; + } + } + + // If we reached here, then all metrics have been set. + return true; +} + +// Add all the other reviews into the Cc field of the comment frame. +function add_other_reviewers() +{ + // Get a reference to the comment form. + var comment_form = top.comment_frame.document.add_comment; + + // Find out who the reviewers are for this review. + var reviewers = top.topic_reviewers.split(/[\s,]+/); + + // Now check each reviewer to see if it can be added into the Cc field. + for (var i = 0; i < reviewers.length; i++) { + // Get the value of the Cc field and check if the reviewer is present. + var cc_addresses = comment_form.comment_cc.value.split(/[\s,]+/); + var found = 0; + for (var j = 0; j < cc_addresses.length; j++) { + if (reviewers[i] == cc_addresses[j]) { + found = 1; + break; + } + } + + // Also check if the reviewer is already in the email field. + if (reviewers[i] == comment_form.email.value) { + found = 1; + } + + // If not found, append it to the Cc field. + if (found == 0) { + if (comment_form.comment_cc.value != '') { + comment_form.comment_cc.value += ', '; + } + comment_form.comment_cc.value += reviewers[i]; + } + } +} + + // Create a new tooltip window which contains an iframe used for adding // a comment to the topic. function add_comment_tooltip(file, line, new_value) { - var l = window.location; - var url = l.protocol + '//' + l.host + l.pathname + '?' + - 'fn=' + file + '&line=' + line + '&new=' + new_value + - '&topic=' + cs_topicid + '&action=edit'; var html = '<a href="javascript:hideElt(getElt(\'overDiv\')); void(0);">' + 'Close</a><p>' + - '<iframe width="660" height="520" src="' + url + '">' + + '<iframe width="480" height="300" name="comment_frame" ' + + 'src="javascript:top.add_comment_html(' + + file + ',' + line + ',' + new_value + ');">' + 'Can\'t view iframe</iframe>'; - overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 660, - HEIGHT, 520); + overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 480, + HEIGHT, 300); } Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Render.pm 22 Feb 2005 10:14:32 -0000 1.47 +++ Render.pm 24 Feb 2005 09:41:01 -0000 1.48 @@ -154,9 +154,13 @@ # Precompute the overlib HTML for each comment location. print "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; + # Add the reviewers for the review here. + print " var topic_reviewers = '" . $topic_obj->{reviewers} . "';\n"; + # Now record all the comments made so far in the topic. print " var comment_text = new Array();\n"; print " var comment_hash = new Array();\n"; + print " var comment_metrics = new Array();\n"; my $index; for ($index = 0; $index <= $#comment_locations; $index++) { @@ -242,6 +246,17 @@ print " comment_text[$index] = '$overlib_html';\n"; print " comment_hash['" . $comment_locations[$index] . "'] = $index;\n"; + + # Store the current metric values for this comment. + print " comment_metrics[$index] = new Array();\n"; + my $comment_metrics = $comments[0]->{metrics}; + foreach my $metric_config (@{ $Codestriker::comment_state_metrics }) { + my $value = $comment_metrics->{$metric_config->{name}}; + $value = "" unless defined $value; + print " comment_metrics[${index}]['" . + $metric_config->{name} . "'] = '" . $value . "';\n"; + } + } print "</script>\n"; Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Response.pm 22 Feb 2005 10:14:36 -0000 1.27 +++ Response.pm 24 Feb 2005 09:41:01 -0000 1.28 @@ -240,6 +240,29 @@ print " var cs_load_anchor = '$load_anchor';\n"; print " var cs_reload = $reload;\n"; print " var cs_topicid = $topic;\n" if defined $topic && $topic ne ""; + print " var cs_email = '$email';\n" if defined $email; + + # Now output all of the comment metric information. + print " var cs_metric_data = new Array();\n"; + my $i = 0; + foreach my $metric_config (@{ $Codestriker::comment_state_metrics }) { + print " cs_metric_data[$i] = new Object();\n"; + print " cs_metric_data[$i].name = '" . + $metric_config->{name} . "';\n"; + print " cs_metric_data[$i].values = new Array();\n"; + my $j = 0; + foreach my $value (@{ $metric_config->{values} }) { + print " cs_metric_data[$i].values[$j] = '$value';\n"; + $j++; + } + if (defined $metric_config->{default_value}) { + print " cs_metric_data[$i].default_value = '" . + $metric_config->{default_value} . "';\n"; + } + $i++; + } + + print "</script>\n"; # Write an HTML comment indicating if response was sent compressed or not. Index: submitnewcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/submitnewcomment.html.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- submitnewcomment.html.tmpl 21 Feb 2005 11:25:31 -0000 1.5 +++ submitnewcomment.html.tmpl 24 Feb 2005 09:41:01 -0000 1.6 @@ -1,20 +1,7 @@ [%# Screen for the submit comment confirmation screen. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help="" %] - -<H2>Comment submitted</H2> -<P> -<PRE>[% comment | html_entity %] -</PRE><P> - -[%# Display a simple form for closing the comment popup window #%] -<FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"> -<INPUT TYPE="submit" NAME=".submit" VALUE="Close" - ONCLICK="window.close()"> -</FORM> - -[% PROCESS trailer.html.tmpl %] - -</BODY> -</HTML> +</head> +<body bgcolor="#eeeeee"> +<h2>Comment submitted</h2> +</body> +</html> |
|
From: <si...@us...> - 2005-02-24 09:41:22
|
Topic "CVS commit: Now generate the add comment window all via j..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=947327&action=view -------------------------------------------------------------- Description: Now generate the add comment window all via javascript, so that the backend is not required at all. Once the user enters in the comment, of course this is posted to the server. The add comment window is suitable simplified, since the actual topic text is visible in front of the reviewer. We could possibly position the window in a more optimised fashion rather than the middle of the screen, but that can come later. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Response.pm codestriker/template/en/default/submitnewcomment.html.tmpl |
|
From: <si...@us...> - 2005-02-23 00:03:37
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9688688&action=view User: sits Date: 05/02/22 16:03:20 Modified: html codestriker.js Log: Minor UI adjustments Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- codestriker.js 22 Feb 2005 10:14:18 -0000 1.3 +++ codestriker.js 23 Feb 2005 00:03:17 -0000 1.4 @@ -69,8 +69,8 @@ '&topic=' + cs_topicid + '&action=edit'; var html = '<a href="javascript:hideElt(getElt(\'overDiv\')); void(0);">' + 'Close</a><p>' + - '<iframe width="600" height="480" src="' + url + '">' + + '<iframe width="660" height="520" src="' + url + '">' + 'Can\'t view iframe</iframe>'; - overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 600, - HEIGHT, 480); + overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 660, + HEIGHT, 520); } |
|
From: <si...@us...> - 2005-02-23 00:03:37
|
Topic "CVS commit: Minor UI adjustments" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9688688&action=view -------------------------------------------------------------- Description: Minor UI adjustments -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js |
|
From: <si...@us...> - 2005-02-22 22:06:33
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4745824&action=view User: sits Date: 05/02/22 14:06:12 Modified: lib/Codestriker/Action ViewTopicFile.pm Log: Minor UI adjustments Index: ViewTopicFile.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicFile.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ViewTopicFile.pm 27 Sep 2004 22:55:09 -0000 1.9 +++ ViewTopicFile.pm 22 Feb 2005 22:06:10 -0000 1.10 @@ -102,6 +102,7 @@ # Render the HTML header. my $vars = {}; + $vars->{'closehead'} = 1; my $header = Codestriker::Http::Template->new("header"); $header->process($vars); |
|
From: <si...@us...> - 2005-02-22 22:06:25
|
Topic "CVS commit: Minor UI adjustments" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4745824&action=view -------------------------------------------------------------- Description: Minor UI adjustments -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Action/ViewTopicFile.pm |
|
From: <si...@us...> - 2005-02-22 10:14:56
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6631926&action=view User: sits Date: 05/02/22 02:14:37 Modified: html codestriker.js lib/Codestriker/Http Render.pm Response.pm Added: html overlib_centerpopup.js Log: A bit hacky... but comments are now added within an iframe within a tooltip window, and all seems to work fine. Ideally, we'd want the iframe to be populated via a javascript function, rather than round-tripping to the server. We'd also want to have a better response back from the server, but that can all come later... this is a proof of concept which seems to work. Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- codestriker.js 21 Feb 2005 11:40:29 -0000 1.2 +++ codestriker.js 22 Feb 2005 10:14:18 -0000 1.3 @@ -2,13 +2,11 @@ ol_fgcolor = '#FFFFCC'; ol_textsize = '2'; -// Records what topicid is being processed. -var topicid = ''; - // Handle to the popup window. var windowHandle = ''; -function myOpen(url,name) { +function myOpen(url,name) +{ windowHandle = window.open(url,name, 'toolbar=no,width=800,height=600,status=yes,scrollbars=yes,resizable=yes,menubar=no'); // Indicate who initiated this operation. @@ -18,15 +16,13 @@ } // Edit open function. Name is kept short to reduce output size. -function eo(fn,line,newfile) { - var location = window.location; - myOpen(location.protocol + '//' + location.host + - location.pathname + '?fn=' + fn + '&line=' + line + - '&new=' + newfile + '&topic=' + topicid + '&action=edit&a=' + - fn + '|' + line + '|' + newfile, 'e'); +function eo(fn,line,newfile) +{ + add_comment_tooltip(fn,line,newfile); } -function gotoAnchor(anchor, reload) { +function gotoAnchor(anchor, reload) +{ if (anchor == "" || opener == null) return; var index = opener.location.href.lastIndexOf("#"); @@ -63,3 +59,18 @@ } } +// Create a new tooltip window which contains an iframe used for adding +// a comment to the topic. +function add_comment_tooltip(file, line, new_value) +{ + var l = window.location; + var url = l.protocol + '//' + l.host + l.pathname + '?' + + 'fn=' + file + '&line=' + line + '&new=' + new_value + + '&topic=' + cs_topicid + '&action=edit'; + var html = '<a href="javascript:hideElt(getElt(\'overDiv\')); void(0);">' + + 'Close</a><p>' + + '<iframe width="600" height="480" src="' + url + '">' + + 'Can\'t view iframe</iframe>'; + overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 600, + HEIGHT, 480); +} Index: overlib_centerpopup.js =================================================================== RCS file: overlib_centerpopup.js diff -N overlib_centerpopup.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ overlib_centerpopup.js 22 Feb 2005 10:14:29 -0000 1.1 @@ -0,0 +1,28 @@ +//\///// +//\ overLIB Center Popup Plugin +//\ This file requires overLIB 4.10 or later. +//\ +//\ overLIB 4.10 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2003. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +//\///// +if (typeof olInfo=='undefined'||typeof olInfo.meets=='undefined'||!olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Center Popup Plugin.');else {registerCommands('centerpopup,centeroffset'); +if (typeof ol_centerpopup=='undefined') var ol_centerpopup=0;if (typeof ol_centeroffset=='undefined') var ol_centeroffset='0'; +var o3_centerpopup=0;var o3_centeroffset='0'; +function setCenterPopupVariables() {o3_centerpopup=ol_centerpopup;o3_centeroffset=ol_centeroffset;} +function parseCenterPopupExtras(pf,i,ar) {var k=i,v; +if (k<ar.length) {if (ar[k]==CENTERPOPUP) { eval(pf+'centerpopup=('+pf+'centerpopup==0)?1:0'); return k; } +if (ar[k]==CENTEROFFSET) { k=opt_MULTIPLEARGS(++k,ar,(pf+'centeroffset')); return k; } +} +return-1;} +function centerPopupHorizontal(browserWidth, horizontalScrollAmount, widthFix) {if (!o3_centerpopup) return void(0); +var vdisp=o3_centeroffset.split(',');var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount;var pWd=parseInt(o3_width); +placeX=winoffset+Math.round((iwidth-widthFix-pWd)/2)+parseInt(vdisp[0]);if(typeof o3_followscroll!='undefined'&&o3_followscroll&&o3_sticky) o3_relx=placeX; +return placeX;} +function centerPopupVertical(browserHeight,verticalScrollAmount) {if (!o3_centerpopup) return void(0); +var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount;var vdisp=o3_centeroffset.split(',');var pHeight=(o3_aboveheight?parseInt(o3_aboveheight):(olNs4?over.clip.height:over.offsetHeight)); +placeY=scrolloffset+Math.round((iheight-pHeight)/2)+(vdisp.length>1?parseInt(vdisp[1]):0);if(typeof o3_followscroll!='undefined'&&o3_followscroll&&o3_sticky) o3_rely=placeY; +return placeY;} +registerRunTimeFunction(setCenterPopupVariables);registerCmdLineFunction(parseCenterPopupExtras);registerHook('horizontalPlacement',centerPopupHorizontal,FCHAIN);registerHook('verticalPlacement', centerPopupVertical, FCHAIN);if(olInfo.meets(4.10)) registerNoParameterCommands('centerpopup'); +} \ No newline at end of file Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Render.pm 21 Feb 2005 11:40:40 -0000 1.46 +++ Render.pm 22 Feb 2005 10:14:32 -0000 1.47 @@ -154,9 +154,6 @@ # Precompute the overlib HTML for each comment location. print "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; - # Set the topicid. - print " topicid = " . $self->{topic} . ";\n"; - # Now record all the comments made so far in the topic. print " var comment_text = new Array();\n"; print " var comment_hash = new Array();\n"; @@ -209,11 +206,16 @@ $overlib_html .= " | "; } + # Add an add comment link. + my $key = $comment_locations[$index]; + $key =~ /^(\-?\d+)\|(\-?\d+)\|(\d+)$/o; + $overlib_html .= "<a href=\"javascript:add_comment_tooltip($1,$2,$3)" . + "; void(0);\">Add Comment</a> | "; + # Add a close link. $overlib_html .= "<a href=\"javascript:hideElt(getElt(\\'overDiv\\')); void(0);\">Close</a><p>"; # Create the actual comment text. - my $key = $comment_locations[$index]; my @comments = @{ $comment_hash{$key} }; for (my $i = 0; $i <= $#comments; $i++) { Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- Response.pm 21 Feb 2005 21:02:32 -0000 1.26 +++ Response.pm 22 Feb 2005 10:14:36 -0000 1.27 @@ -214,13 +214,15 @@ } my $overlib_js = $codestriker_css; - $overlib_js =~ s/codestriker.css/overlib.js/; + $overlib_js =~ s/codestriker.css/overlib.js/o; + my $overlib_centerpopup_js = $codestriker_css; + $overlib_centerpopup_js =~ s/codestriker.css/overlib_centerpopup.js/o; my $overlib_draggable_js = $codestriker_css; - $overlib_draggable_js =~ s/codestriker.css/overlib_draggable.js/; + $overlib_draggable_js =~ s/codestriker.css/overlib_draggable.js/o; my $xbdhtml_js = $codestriker_css; - $xbdhtml_js =~ s/codestriker.css/xbdhtml.js/; + $xbdhtml_js =~ s/codestriker.css/xbdhtml.js/o; my $codestriker_js = $codestriker_css; - $codestriker_js =~ s/codestriker.css/codestriker.js/; + $codestriker_js =~ s/codestriker.css/codestriker.js/o; # Print the basic HTML header header, with the inclusion of the scripts. print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; @@ -228,15 +230,16 @@ print '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">'; print "\n"; print "<head><title>$title</title>\n"; - print "<base href=\"$query->url()\"/>\n"; print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$codestriker_css\" />\n"; print "<script src=\"$overlib_js\" type=\"text/javascript\"></script>\n"; + print "<script src=\"$overlib_centerpopup_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$overlib_draggable_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$xbdhtml_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$codestriker_js\" type=\"text/javascript\"></script>\n"; print "<script type=\"text/javascript\">\n"; print " var cs_load_anchor = '$load_anchor';\n"; print " var cs_reload = $reload;\n"; + print " var cs_topicid = $topic;\n" if defined $topic && $topic ne ""; print "</script>\n"; # Write an HTML comment indicating if response was sent compressed or not. |
|
From: <si...@us...> - 2005-02-22 10:14:46
|
Topic "CVS commit: A bit hacky... but comments are now added wit..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6631926&action=view -------------------------------------------------------------- Description: A bit hacky... but comments are now added within an iframe within a tooltip window, and all seems to work fine. Ideally, we'd want the iframe to be populated via a javascript function, rather than round-tripping to the server. We'd also want to have a better response back from the server, but that can all come later... this is a proof of concept which seems to work. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js overlib_centerpopup.js codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Response.pm |
|
From: <si...@us...> - 2005-02-22 01:38:48
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6706083&action=view User: sits Date: 05/02/21 17:38:31 Modified: template/en/default header.html.tmpl Log: Ensure the body properties are set correctly in the header Index: header.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/header.html.tmpl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- header.html.tmpl 21 Feb 2005 21:02:50 -0000 1.11 +++ header.html.tmpl 22 Feb 2005 01:38:25 -0000 1.12 @@ -1,6 +1,6 @@ [% IF closehead %] </head> -<body onLoad="gotoAnchor(cs_load_anchor, cs_reload);"> +<body charset="ISO-8859-1" link="blue" vlink="purple" bgcolor="#eeeeee" onLoad="gotoAnchor(cs_load_anchor, cs_reload);"> [% END %] [%# Header HTML code to appear on each screen, after <body> tag. #%] |
|
From: <si...@us...> - 2005-02-22 01:38:41
|
Topic "CVS commit: Ensure the body properties are set correctly ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6706083&action=view -------------------------------------------------------------- Description: Ensure the body properties are set correctly in the header -------------------------------------------------------------- The topic was created with the following files: codestriker/template/en/default/header.html.tmpl |
|
From: <si...@us...> - 2005-02-21 21:04:30
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4489358&action=view User: sits Date: 05/02/21 13:04:12 Modified: lib/Codestriker/Http Response.pm template/en/default header.html.tmpl Log: Make sure the default body onLoad handler is calling gotoAnchor() so that after adding a comment, the main browser window is moved to support current behaviour. Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Response.pm 21 Feb 2005 11:40:41 -0000 1.25 +++ Response.pm 21 Feb 2005 21:02:32 -0000 1.26 @@ -234,8 +234,12 @@ print "<script src=\"$overlib_draggable_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$xbdhtml_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$codestriker_js\" type=\"text/javascript\"></script>\n"; + print "<script type=\"text/javascript\">\n"; + print " var cs_load_anchor = '$load_anchor';\n"; + print " var cs_reload = $reload;\n"; + print "</script>\n"; - # Write a comment indicating if this was compressed or not. + # Write an HTML comment indicating if response was sent compressed or not. $self->{output_compressed} = $output_compressed; print "\n<!-- Source was" . (!$output_compressed ? " not" : "") . " sent compressed. -->\n"; Index: header.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/header.html.tmpl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- header.html.tmpl 21 Feb 2005 11:25:30 -0000 1.10 +++ header.html.tmpl 21 Feb 2005 21:02:50 -0000 1.11 @@ -1,6 +1,6 @@ [% IF closehead %] </head> -<body> +<body onLoad="gotoAnchor(cs_load_anchor, cs_reload);"> [% END %] [%# Header HTML code to appear on each screen, after <body> tag. #%] |
|
From: <si...@us...> - 2005-02-21 21:04:20
|
Topic "CVS commit: Make sure the default body onLoad handler is ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4489358&action=view -------------------------------------------------------------- Description: Make sure the default body onLoad handler is calling gotoAnchor() so that after adding a comment, the main browser window is moved to support current behaviour. -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Http/Response.pm codestriker/template/en/default/header.html.tmpl |
|
From: <si...@us...> - 2005-02-21 11:41:09
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3047939&action=view User: sits Date: 05/02/21 03:40:43 Modified: html codestriker.js lib/Codestriker/Http Render.pm Response.pm Added: html overlib_draggable.js Log: Modified so that all tooltips can be dragged around, so the user can move them to where they want them. This will be particularly useful when we implement the add comment tooltip window. Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- codestriker.js 21 Feb 2005 11:25:05 -0000 1.1 +++ codestriker.js 21 Feb 2005 11:40:29 -0000 1.2 @@ -56,7 +56,7 @@ var comment_number = comment_hash[anchor]; if (comment_number != null) { // We have a comment on this line, bring up the tooltip. - overlib(comment_text[comment_number], STICKY, + overlib(comment_text[comment_number], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt('c' + comment_number)), FIXY, getEltPageTop(getElt('c' + comment_number))); } Index: overlib_draggable.js =================================================================== RCS file: overlib_draggable.js diff -N overlib_draggable.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ overlib_draggable.js 21 Feb 2005 11:40:38 -0000 1.1 @@ -0,0 +1,174 @@ +//\///// +//\ overLIB Draggable Plugin +//\ +//\ You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2003. All rights reserved. +//\ Contributors are listed on the homepage. +//\ See http://www.bosrup.com/web/overlib/ for details. +//\///// +//////// +// PRE-INIT +// Ignore these lines, configuration is below. +//////// +if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.14)) alert('overLIB 4.14 or later is required for the Draggable Plugin.'); +else { +registerCommands('draggable,altcut,dragimg'); +//////// +// DEFAULT CONFIGURATION +// Settings you want everywhere are set here. All of this can also be +// changed on your html page or through an overLIB call. +//////// +if (typeof ol_draggable=='undefined') var ol_draggable=0; +if (typeof ol_altcut=='undefined') var ol_altcut=0; +if (typeof ol_dragimg=='undefined') var ol_dragimg=''; +//////// +// END OF CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////// +//////// +// INIT +//////// +// Runtime variables init. Don't change for config! +var o3_draggable=0; +var o3_altcut=0; +var o3_dragimg=''; +var olImgLeft,olImgTop; +var olImgObj; +var olMseMv; // hold old mouseMove routine +//////// +// PLUGIN FUNCTIONS +//////// +function setDragVariables() { + o3_draggable=ol_draggable; + o3_altcut=ol_altcut; + o3_dragimg=ol_dragimg; + olImgObj=null; +} +// Parses Draggable commands +function parseDragExtras(pf,i,ar) { + var k=i; + if (k < ar.length) { + if (ar[k]==DRAGGABLE) { eval(pf+'draggable=('+pf+'draggable==0) ? 1 : 0'); return k; } + if (ar[k]==ALTCUT) { eval(pf+'altcut=('+pf+'altcut==0) ? 1 : 0'); return k; } + if (ar[k]==DRAGIMG) { eval(pf+'dragimg="'+ar[++k]+'"'); return k; } + } + return -1; +} +////// +// PRESHOW PROCESSING FOR DRAGGABLE POPUPS +////// +function startDrag() { + // Initiate dragging if in same frame and its a sticky + if (o3_draggable) { + if (o3_sticky&&(o3_frame==ol_frame)) initDrag(); + else o3_draggable=0; + } +} +////// +// POSTHIDE PROCESSING FOR DRAGGABLE POPUPS +////// +function stopDrag() { + if (o3_draggable) endDrag(); +} +////// +// DRAGGABLE FUNCTIONS +////// +function initDrag() { + olMseMv=capExtent.onmousemove; + if(olNs4) { + document.captureEvents(Event.MOUSEDOWN | Event.CLICK); + document.onmousedown=grabEl; + document.onclick=function(e) {return routeEvent(e);} + } else { + over.onmousedown=grabEl; + } + if (o3_dragimg) chkForImgSupport(o3_dragimg); + return true; +} +// Checks for image for dragging +function chkForImgSupport(dragImg) { + if (dragImg) { + if (typeof getAnchorObjRef!='undefined') olImgObj=getAnchorObjRef(dragImg); + if (olImgObj==null) o3_dragimg=''; + } +} +// Sets cursor symbol +function setCursor(on) { + if (olNs4) return; + over.style.cursor=(on ? 'move' : 'auto'); +} +// Checks cursor position relative to image +function chkCursorPosition(Obj,XPos,YPos) { + if (Obj) { + o3_anchorx=o3_anchory=0; + o3_anchoralign='UL'; + getAnchorLocation(Obj); + if (XPos < olImgLeft||XPos > (olImgLeft+Obj.width)||YPos < olImgTop||YPos > (olImgTop+Obj.height)) return false; + } + return true; +} +// Sets up mouse grab for moving +function grabEl(e) { + var e=(e) ? e : event; + var X,Y; + var cKy=(olNs4 ? e.modifiers & Event.ALT_MASK : (!olOp ? e.altKey : e.ctrlKey)); + if ((o3_altcut ? !cKy : cKy)) { + // get mouse's current x,y location + X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); + Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); + if (chkCursorPosition(olImgObj,X,Y)) { + if (olNs4) document.captureEvents(Event.MOUSEUP); + capExtent.onmousemove=moveEl; + document.onmouseup=function() {setCursor(0); if (olIe4) over.onselectstart=null; capExtent.onmousemove=olMseMv;} + setCursor(1); + if (olIe4) over.onselectstart=function() {return false;} + if (olNs4) { + cX=X + cY=Y + } else { + // get offsets from upper left hand corner of popup to keep popup from jummping + // when first starting to drag + cX=X-(olNs4 ? over.left : parseInt(over.style.left)); + cY=Y-(olNs4 ? over.top : parseInt(over.style.top)); + } + return (olNs4 ? routeEvent(e) : false); + } + } else setCursor(0); +} +// Moves popup to follow mouse +function moveEl(e) { + var e=(e) ? e : event; + var dX,dY,X,Y; + // get new mouse location + X=(e.pageX || eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft')); + Y=(e.pageY || eval('e.clientY+o3_frame.'+docRoot+'.scrollTop')); + if (chkCursorPosition(olImgObj,X,Y)){ + if (olNs4) { + dX=X-cX; cX=X; + dY=Y-cY; cY=Y; + over.moveBy(dX,dY); + } else + repositionTo(over,X-cX,Y-cY); // move popup to that position + } +} +// Cleanup for Drag end +function endDrag(obj) { + if (olNs4) { + document.releaseEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.CLICK); + document.onmousedown=document.onclick=null; + } else { + if(!obj) obj=over; + obj.onmousedown=null; + } + document.onmouseup= null; +} +//////// +// PLUGIN REGISTRATIONS +//////// +registerRunTimeFunction(setDragVariables); +registerCmdLineFunction(parseDragExtras); +registerHook("disp",startDrag,FBEFORE); +registerHook("hideObject",stopDrag,FAFTER); +if (olInfo.meets(4.14)) registerNoParameterCommands('draggable,altcut'); +} +//end Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- Render.pm 21 Feb 2005 11:25:23 -0000 1.45 +++ Render.pm 21 Feb 2005 11:40:40 -0000 1.46 @@ -186,7 +186,7 @@ $previous_url .= '#' . $previous; $overlib_html .= "<a href=\"javascript:window.location=\\'$previous_url\\'; "; if ($self->{fview} == -1 || $self->{fview} == $previous_fview) { - $overlib_html .= "overlib(comment_text[$previous_index], STICKY, FIXX, getEltPageLeft(getElt(\\'c$previous_index\\')), FIXY, getEltPageTop(getElt(\\'c$previous_index\\'))); "; + $overlib_html .= "overlib(comment_text[$previous_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$previous_index\\')), FIXY, getEltPageTop(getElt(\\'c$previous_index\\'))); "; } $overlib_html .= "void(0);\">Previous</a>"; } @@ -201,7 +201,7 @@ $next_url .= '#' . $next; $overlib_html .= "<a href=\"javascript:window.location=\\'$next_url\\'; "; if ($self->{fview} == -1 || $self->{fview} == $next_fview) { - $overlib_html .= "overlib(comment_text[$next_index], STICKY, FIXX, getEltPageLeft(getElt(\\'c$next_index\\')), FIXY, getEltPageTop(getElt(\\'c$next_index\\'))); "; + $overlib_html .= "overlib(comment_text[$next_index], STICKY, DRAGGABLE, ALTCUT, FIXX, getEltPageLeft(getElt(\\'c$next_index\\')), FIXY, getEltPageTop(getElt(\\'c$next_index\\'))); "; } $overlib_html .= "void(0);\">Next</a>"; } @@ -900,7 +900,7 @@ last if $anchor eq $comment_locations[$index]; } - $params->{onmouseover} = "return overlib(comment_text[$index],STICKY);"; + $params->{onmouseover} = "return overlib(comment_text[$index],STICKY,DRAGGABLE,ALTCUT);"; $params->{onmouseout} = "return nd();"; } else { if (defined $no_comment_class) { Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- Response.pm 21 Feb 2005 11:25:26 -0000 1.24 +++ Response.pm 21 Feb 2005 11:40:41 -0000 1.25 @@ -215,6 +215,8 @@ my $overlib_js = $codestriker_css; $overlib_js =~ s/codestriker.css/overlib.js/; + my $overlib_draggable_js = $codestriker_css; + $overlib_draggable_js =~ s/codestriker.css/overlib_draggable.js/; my $xbdhtml_js = $codestriker_css; $xbdhtml_js =~ s/codestriker.css/xbdhtml.js/; my $codestriker_js = $codestriker_css; @@ -229,6 +231,7 @@ print "<base href=\"$query->url()\"/>\n"; print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$codestriker_css\" />\n"; print "<script src=\"$overlib_js\" type=\"text/javascript\"></script>\n"; + print "<script src=\"$overlib_draggable_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$xbdhtml_js\" type=\"text/javascript\"></script>\n"; print "<script src=\"$codestriker_js\" type=\"text/javascript\"></script>\n"; |
|
From: <si...@us...> - 2005-02-21 11:41:04
|
Topic "CVS commit: Modified so that all tooltips can be dragged ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3047939&action=view -------------------------------------------------------------- Description: Modified so that all tooltips can be dragged around, so the user can move them to where they want them. This will be particularly useful when we implement the add comment tooltip window. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js overlib_draggable.js codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Response.pm |
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=8012688&action=view User: sits Date: 05/02/21 03:25:35 Modified: . codestriker.conf lib/Codestriker/Action ViewTopic.pm lib/Codestriker/Http Render.pm Response.pm lib/Codestriker/Model Comment.pm template/en/default createproject.html.tmpl createtopic.html.tmpl editproject.html.tmpl header.html.tmpl listprojects.html.tmpl listtopics.html.tmpl metricsreport.html.tmpl search.html.tmpl submitnewcomment.html.tmpl submitnewtopic.html.tmpl viewtopic.html.tmpl viewtopiccomments.html.tmpl viewtopicheader.html.tmpl viewtopicinfo.html.tmpl viewtopicproperties.html.tmpl Added: html codestriker.js xbdhtml.js Log: Store the comment data in javascript-land as well, which allows the comment tooltips to navigate between the different comments, using some overlib and CSS-P magic. Still needs some more work, but this is a good start. Eventually, we should be able to add a comment via overlib as well, perhaps within an IFRAME. Index: codestriker.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- codestriker.conf 21 Dec 2004 22:44:22 -0000 1.68 +++ codestriker.conf 21 Feb 2005 11:25:00 -0000 1.69 @@ -1,8 +1,10 @@ # -*-perl-*- # Configuration file for codestriker.pl. -# Database to use for storing codestriker data. Examples given are -# Oracle, SQL Server, PostgreSQL and MySQL. +# Database to use for storing codestriker data. Examples given are +# Oracle, SQL Server, PostgreSQL and MySQL. Refer to the +# documentation on how to create the Codestriker database. + #$db = 'DBI:Oracle:host=127.0.0.1;sid=local'; #$db = 'DBI:ODBC:Codestriker'; #$db = 'DBI:Pg:dbname=codestrikerdb'; @@ -64,7 +66,7 @@ # end of this string when URLs are generated. This can be left blank if # there is no need for bug-tracking integration. $bugtracker = ''; -#$bugtracker = 'http://localhost.localdomain/show_bug.cgi?id='; +$bugtracker = 'http://localhost.localdomain/bugzilla/show_bug.cgi?id='; # Valid repositories which may be selected at the create topic screen. # The order shown here is the order presented in the option list. Most @@ -294,8 +296,8 @@ # $bug_db to "bugzilla", and set the following parameters to your setup. # if the $bug_db is an empty string, all bug-tracking related features will # be disabled. -$bug_db = ''; -#$bug_db = 'bugzilla'; +#$bug_db = ''; +$bug_db = 'bugzilla'; # Bug database connection details. $bug_db_host = 'localhost'; Index: codestriker.js =================================================================== RCS file: codestriker.js diff -N codestriker.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ codestriker.js 21 Feb 2005 11:25:05 -0000 1.1 @@ -0,0 +1,65 @@ +// Global settings for overLIB. +ol_fgcolor = '#FFFFCC'; +ol_textsize = '2'; + +// Records what topicid is being processed. +var topicid = ''; + +// Handle to the popup window. +var windowHandle = ''; + +function myOpen(url,name) { + windowHandle = window.open(url,name, + 'toolbar=no,width=800,height=600,status=yes,scrollbars=yes,resizable=yes,menubar=no'); + // Indicate who initiated this operation. + windowHandle.opener = window; + + windowHandle.focus(); +} + +// Edit open function. Name is kept short to reduce output size. +function eo(fn,line,newfile) { + var location = window.location; + myOpen(location.protocol + '//' + location.host + + location.pathname + '?fn=' + fn + '&line=' + line + + '&new=' + newfile + '&topic=' + topicid + '&action=edit&a=' + + fn + '|' + line + '|' + newfile, 'e'); +} + +function gotoAnchor(anchor, reload) { + if (anchor == "" || opener == null) return; + + var index = opener.location.href.lastIndexOf("#"); + if (index != -1) { + opener.location.href = + opener.location.href.substr(0, index) + "#" + anchor; + } + else { + opener.location.href += "#" + anchor; + } + + if (reload) opener.location.reload(reload); + opener.focus(); +} + +// Called by a body onload handler for the view topic page, to tooltip +// the comment associated with an anchor that has comments made +// against it. +function view_topic_on_load_handler() +{ + // If the URL loaded contains an anchor, check if there is a comment + // associated with it. + var anchor = window.location.hash; + if (anchor != null) { + // Remove the leading # character. + anchor = anchor.substr(1); + var comment_number = comment_hash[anchor]; + if (comment_number != null) { + // We have a comment on this line, bring up the tooltip. + overlib(comment_text[comment_number], STICKY, + FIXX, getEltPageLeft(getElt('c' + comment_number)), + FIXY, getEltPageTop(getElt('c' + comment_number))); + } + } +} + Index: xbdhtml.js =================================================================== RCS file: xbdhtml.js diff -N xbdhtml.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xbdhtml.js 21 Feb 2005 11:25:05 -0000 1.1 @@ -0,0 +1,913 @@ +/* xbdhtml.js (Cross-Browser Nav4/Gecko/IE DHTML API) + 14 May 98, Eric Krock, Copyright Netscape Communications + Permission is granted to reuse, redistribute, and modify + without charge. + + Updated 18 July 2000 by Vladimir Ermakov, Netscape Communications, + and Marcell Ortutay, Plugged in Enterprises, to include support of + the new Netscape Gecko layout engine. + + Updated 15 of February 2001 by Vladimir Ermakov, Netscape Communications: + New Features + -showElt/hideElt -convenience functions to use insead of setEltVisibility + -setEltWidth/setEltHeight -Set the width/height of a layer + -getEltPageLeft/getEltPageTop -XBrowser version of Nav4 pageX/pageY + -stringToNumber -Returns 0 instead of NaN + Improved: + -getEltWidth/getEltHeight -Return offsetWidth if width not specified. + -Also, where possible, replaced detection by browser with detection by property + + Updated October 02, 2001 by Bob Clary, Netscape Communications + Misc + - changed reference to Ultimate Browser Sniffer on mozilla.org + Bugs Fixed + - hideElt -fixed missing argument to setEltVisibility + - getEltPageTop -added marginTop for IE5/Mac + + Makes CSSP functionality and properties of positioned, named + elements accessible from JavaScript in Netscape 4.x, IE and user + agents implementing Gecko layout engine offering a single set of functions which + can be used on both browsers, bridging DOM differences. + + Allows you to do these things from JavaScript on Nav4+/IE4+/Gecko: + - get element object by specifying its name + - hide/show element + - get/set X, Y, Z position of element + - get element height/width + - get/set clipping area (visible area) of element + - get/set background color and background image of element + + Also includes simplified JavaScript client sniffer and + functions to ease dynamic, conditional generation of HTML + markup via document.write() statements. + + Design goals: + - forwardly compatible with future DOM enhancements + - redefinable stub function API + - coexist peacefully with other libraries + - no function name conflicts with cbdhtml.js, etc. + - keep # of functions reasonable and use parameters to specify values + - naming convention for functions easy to learn and remember + - make as short as possible to type + - loadable (though not executable!) without error on Nav3 since Nav3 + sometimes loads <SCRIPT LANGUAGE="JavaScript1.2" SRC=___.js> + - usable in part or in whole; don't have to use whole thing + - can copy and paste individual functions into existing code + Exceptions to this rule: + 1) you must include Is() constructor function and an + instance of "is" global variable; all functions depend on this. + 2) getEltBackgroundColor depends on the color-related functions; + to use it, you must include the others as well; + 3) all the functions for getting the clipping area + (getEltClipLeft getEltClipTop getEltClipRight + getEltClipBottom getEltClipWidth getEltClipHeight) + depend on tempClipObj for use on IE4. + + Usage notes: + - Place the SCRIPT element which links to this JavaScript file, xbdhtml.js, + before your own SCRIPT which calls its functions. + + Example of correct usage: in the HEAD, place this HTML markup: + + <!-- This external script defines cross-browser functions for + accessing CSSP and element properties. --> + <SCRIPT LANGUAGE="JavaScript1.2" SRC=xbdhtml.js> </SCRIPT> + <!-- Make your function calls to manipulate elements in this + SCRIPT, now that the functions have been loaded. --> + <SCRIPT LANGUAGE="JavaScript1.2"><!-- + //-*** put your function calls here *** + //--></SCRIPT> +*/ + + +// This is a simplified version of the JavaScript Client Sniffer code +// found at http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html + +function Is () +{ // convert all characters to lowercase to simplify testing + var agt=navigator.userAgent.toLowerCase() + + // --- BROWSER VERSION --- + this.major = stringToNumber(navigator.appVersion) + this.minor = parseFloat(navigator.appVersion) + + this.nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) + && (agt.indexOf('compatible') == -1))) + this.nav2 = (this.nav && (this.major == 2)) + this.nav3 = (this.nav && (this.major == 3)) + this.nav4 = (this.nav && (this.major == 4)) + + //Netscape 6 + this.nav5 = (this.nav && (this.major == 5)) + this.nav6 = (this.nav && (this.major == 5)) + this.gecko = (this.nav && (this.major >= 5)) + + this.ie = (agt.indexOf("msie") != -1) + this.ie3 = (this.ie && (this.major == 2)) + this.ie4 = (this.ie && (this.major == 3)) + this.ie5 = (this.ie && (this.major == 4)) + + + this.opera = (agt.indexOf("opera") != -1) + + this.nav4up = this.nav && (this.major >= 4) + this.ie4up = this.ie && (this.major >= 4) +} + + +var is = new Is(); + +// Convenience functions to ease dynamic/conditional markup +// generation depending upon browser vendor/version/OS. + +// convenience function to save typing out document.write("STRING"); +// if optional second argument minVersion passed in, +// only write if >= that version; +// if optional third argument maxVersion passed in, +// only execute if <= that version; + +function dw(str, minVersion, maxVersion) +{ if ( ((dw.arguments.length < 3) || (is.major <= maxVersion)) + && ((dw.arguments.length < 2) || (is.major >= minVersion))) + document.write(str) +} + + + +// document write boolean +// convenience function to save typing out +// if (aBoolean) document.write("STRING"); +// if optional second argument aBoolean passed in, only write if +// aBoolean is true. + +function dwb (str, aBoolean) +{ if ((dwb.arguments.length < 2) || aBoolean) + document.write(str) +} + + + +// string version: +// convenience function to return str or "" depending on version; +// if optional second argument version passed in, +// only return str if >= that version; +// if optional third argument maxVersion passed in, +// only return str if <= that version; + +function sv(str, minVersion, maxVersion) +{ if ( ((sv.arguments.length < 3) || (is.major <= maxVersion)) + && ((sv.arguments.length < 2) || (is.major >= minVersion))) + return str; + else return ""; +} + + + +// string boolean +// convenience function to save typing out +// (aBoolean)?"STRING":"" +// if optional second argument aBoolean passed in, only return +// str if aBoolean is true, else return "". + +function sb (str, aBoolean) +{ if ((sb.arguments.length < 2) || aBoolean) + return str; + else return ""; +} + + + + +/* The following stub function API for cross-browser HTML + element positioning and visibility (CSSP access) was + derived from Mike Hall's excellent CBDHTML API. + + Thanks also to Danny Goodman (http://www.dannyg.com/) + and Dan Steinman (http://members.xoom.com/dynduo/). + + USAGE NOTE: when using the functions which get element CSSP + properties [getEltLeft, getEltTop, etc.], keep in mind the + following IE4 CSSP property initialization problem: if you + initialize a property value by CSSP markup, e.g.: + #foo { left: 100px } + rather than initializing them from JavaScript, e.g.: + var fooElt = getElt ("foo"); + setEltLeft (fooElt, 100); + ... the property value for the element's JavaScript style + object (i.e. document.all.foo.style.left) is not set to the + initial value! This is true for a number of IE4 style object + properties including left, top, and clip. Before you get one of these + properties in IE4, you must first set it from JavaScript. + Workaround: set the property via JavaScript instead of CSSP + markup, or set it from both to the same value. +*/ + + +/* functions genElt, writeElt, and layerClipOrder + + Sometimes dynamically generating markup which is optimized for the + current browser will simplify development. genElt will generate + a named DIV on IE4 and Netscape6, and a LAYER/ILAYER tag on Nav4 as a string. + writeElt will create the same string and write it out. + + These three functions must be reused as a group. writeElt calls + genElt, and those two both call layerClipOrder. + + ARGUMENTS OF FUNCTIONS genElt AND writeElt + + genElt and writeElt have identical argument lists. + + The first argument, name, is required. All of the other arguments + default to false and can be explicitly set to false or + omitted. Those properties will be hard coded into the HTML markup + if the argument is provided, and left unset if the argument is set + to false or omitted. + + For example, both of these function calls have the same effect. + They will generate a named, positioned element but not specify + any of the properties, and will write out + the element and content even on Nav3/IE3 and earlier: + writeElt ("foo"); + writeElt ("foo", false, false, false); + + name STRING. Name of element's ID. + content STRING. Content written within element. + left INTEGER. Left edge of element in pixels. + top INTEGER. Top edge of element in pixels. + z INTEGER. z-index of element. + width INTEGER. width in pixels. + height INTEGER. height in pixels. + visibility STRING. "visible", "hidden", or "inherit". + backgroundColor STRING. Background color of element. + backgroundImage STRING. Background image of element. + clip STRING. Comma-delimited list (no spaces!) of 4 + integers in top-right-bottom-left order. Sets clip. + relative BOOLEAN. If true, position relatively, else absolutely. + On Nav4, this determines whether LAYER (absolute) or + ILAYER (relative) is generated. + hideEltOnOlderBrowsers BOOLEAN. If true, return '' on Nav3, IE3, and older. + useDivInsteadOfLayer BOOLEAN. If true, generate DIV on Nav4 not I/LAYER. + classname STRING. CLASS attribute value for element. + + 'genElt' is short for 'generate element markup'. +*/ + +/* maps css order <top>,<right>,<bottom>,<left> to + LAYER CLIP= order <left>,<top>,<right>,<bottom> */ +function layerClipOrder (cssClipString) +{ var commaPos = cssClipString.lastIndexOf(","); + return (cssClipString.substring(commaPos+1) + "," + cssClipString.substring(0,commaPos)); +} + +function genElt (name, content, left, top, z, width, height, visibility, + backgroundColor, backgroundImage, clip, relative, + hideEltOnOlderBrowsers, useDivInsteadOfLayer, classname) +{ var markup = ""; + if (is.gecko) + { + markup = '<DIV ID="' + name + '"' + + ((classname)?' CLASS="' + classname + '"':'') + + ' STYLE="position:' + ((relative)?'relative;':'absolute;') + + ' overflow:none;' + + ((left)?' left:' + left + 'px;':'') + + ((top)?' top:' + top + 'px;':'') + + ((height)?' height:' + height + 'px;':'') + + ((width)?' width:' + width + 'px;':'') + + ((visibility && (visibility!='')) ? ' visibility:' + visibility + ';' : '') + + ((z)?' z-index:' + z + ';':'') + + ((backgroundColor)?' background-color:' + backgroundColor + ';':'') + + ((backgroundImage)?' background-image:url("' + backgroundImage + '");':'') + + ((clip)?' clip:rect("' + clip + '");':'') + + '">' + ((content)?content:'') + '</DIV>'; + } + + else if (is.nav && (is.major == 4 || !hideEltOnOlderBrowsers) && + !useDivInsteadOfLayer) + { var tagname = (relative)?'ILAYER':'LAYER'; + if (visibility && (visibility!='')) + { if (visibility=="hidden") visibility = "hide"; + else if (visibility=="visible") visibility = "show"; + } + markup = '<' + tagname + ' ID="' + name + '"' + ((classname)?' CLASS="' + + classname + '"':'') + ((left)?' LEFT="' + left + '"':'') + + ((top)?' TOP="' + top + '"':'') + ((width)?' WIDTH="' + width + '"':'') + + ((height)?' HEIGHT="' + height + '"':'') + + ((visibility && (visibility!='')) ? ' VISIBILITY="' + visibility + '"' : '') + + ((z)?' Z-INDEX="' + z + '"':'') + + ((backgroundColor)?' BGCOLOR="' + backgroundColor + '"':'') + + ((backgroundImage)?' BACKGROUND="' + backgroundImage + '"':'') + + ((clip)?' CLIP="' + layerClipOrder(clip) + '"':'') + + '>' + ((content)?content:'') + '</' + tagname + '>'; + } + + else if ((is.ie || (is.nav && useDivInsteadOfLayer)) && (is.major>=4 || !hideEltOnOlderBrowsers)) + { markup = '<DIV ID="' + name + '"' + + ((classname)?' CLASS="' + classname + '"':'') + + ' STYLE="position:' + ((relative)?'relative;':'absolute;') + + ' overflow:none;' + + ((left)?' left:' + left + 'px;':'') + + ((top)?' top:' + top + 'px;':'') + + ((height)?' height:' + height + 'px;':'') + + ((width)?' width:' + width + 'px;':'') + + ((visibility && (visibility!='')) ? ' visibility:' + visibility + ';' : '') + + ((z)?' z-index:' + z + ';':'') + + ((backgroundColor)?' background-color:' + backgroundColor + ';':'') + + ((backgroundImage)?' background-image:url("' + backgroundImage + '");':'') + + ((clip)?' clip:rect("' + clip + '");':'') + + '">' + ((content)?content:'') + '</DIV>'; + } + + return markup; +} + +function writeElt (name, content, left, top, z, width, height, visibility, + backgroundColor, backgroundImage, clip, relative, + hideEltOnOlderBrowsers, useDivInsteadOfLayer, classname) +{ if (writeElt.arguments.length < 15) classname = false; + if (writeElt.arguments.length < 14) useDivInsteadOfLayer = false; + if (writeElt.arguments.length < 13) hideEltOnOlderBrowsers = false; + if (writeElt.arguments.length < 12) relative = false; + if (writeElt.arguments.length < 11) clip = false; + if (writeElt.arguments.length < 10) backgroundImage = false; + if (writeElt.arguments.length < 9) backgroundColor = false; + if (writeElt.arguments.length < 8) visibility = false; + if (writeElt.arguments.length < 7) height = false; + if (writeElt.arguments.length < 6) width = false; + if (writeElt.arguments.length < 5) z = false; + if (writeElt.arguments.length < 4) top = false; + if (writeElt.arguments.length < 3) left = false; + if (writeElt.arguments.length < 2) content = false; + document.write (genElt (name, content, left, top, z, width, height, visibility, + backgroundColor, backgroundImage, clip, relative, + hideEltOnOlderBrowsers, useDivInsteadOfLayer, classname)); +} + + +/* CALLING SYNTAX: each Name is a string which is an element's + ID attribute value or a LAYER tag's NAME attribute value. + + getElt (topLevelElementName, childElementName, grandchildElementName ... + targetElementName) + + Example of getting a top-level element: + var fooElement = getElt ("foo") + + Example of getting a nested element: + var fooElement = getElt ("bar", "baz", "foo") + ... where baz is foo's containing parent, and bar is a top-level + element which is baz's containing parent. +*/ + +function getElt () +{ if (is.nav4) + { + var currentLayer = document.layers[getElt.arguments[0]]; + for (var i=1; i<getElt.arguments.length && currentLayer; i++) + { currentLayer = currentLayer.document.layers[getElt.arguments[i]]; + } + return currentLayer; + } + else if(document.getElementById && document.getElementsByName) + { + var name = getElt.arguments[getElt.arguments.length-1]; + if(document.getElementById(name)) //First try to find by id + return document.getElementById(name); + else if (document.getElementsByName(name)) //Then if that fails by name + return document.getElementsByName(name)[0]; + } + else if (is.ie4up) { + var elt = eval('document.all.' + getElt.arguments[getElt.arguments.length-1]); + return(elt); + } + +} + +function showElt(elt) +{ + setEltVisibility(elt,'visible'); +} + +function hideElt(elt) +{ + setEltVisibility(elt, 'hidden'); +} + +/* value must be "visible", "hidden", or "inherit". + These values work on Nav4, Gecko and IE for setting visibility. +*/ +function setEltVisibility (elt, value) +{ if (is.nav4) elt.visibility = value; + else if (elt.style) elt.style.visibility = value; +} + + + +/* Return values are strings "visible", "hidden", or "inherit". + This is consistent with CSS1 and IE4 usage and the settable + values on all three browsers. Note that Nav4 + by default returns "show" and "hide" and that these values + are mapped to "visible" and "hidden" to provide consistent + return values across browsers. */ + +function getEltVisibility (elt) +{ if (is.nav4) + { var value = elt.visibility; + if (value == "show") return "visible"; + else if (value == "hide") return "hidden"; + else return value; + } + else if (elt.style) return elt.style.visibility; +} + + + +/* Move elt to pixel location x,y within its coordinate system, + which is the window content area for top-level elements or + the parent element's coordinates for nested elements which + have an absolutely positioned parent. +*/ + +function moveEltTo (elt, x, y) +{ if (is.nav4) elt.moveTo(x, y); + else if (is.ie4up) { + elt.style.pixelLeft = x; + elt.style.pixelTop = y; + } + else if (is.gecko) { + elt.style.left = x; + elt.style.top = y; + } +} + + +/* Offset elt's pixel location by x,y pixels. */ + +function moveEltBy (elt, x, y) +{ if (is.nav4) elt.moveBy(x, y); + else if (is.ie4up) { + elt.style.pixelLeft += x; + elt.style.pixelTop += y; + } + else if (is.gecko) { + elt.style.left = (stringToNumber(elt.style.left) + x + "px"); + elt.style.top = (stringToNumber(elt.style.top) + y + "px"); + } +} + +/* xbrowser pageX equivalent*/ +function getEltPageLeft(elt) { + var x; + + if (is.nav4) + return elt.pageX; + if (is.ie4up) { + x = 0; + while (elt.offsetParent != null) { + x += elt.offsetLeft; + elt = elt.offsetParent; + } + x += elt.offsetLeft; + return x; + } + if (is.gecko) { + x = 0; + while (elt.offsetParent != null) { + x += elt.offsetLeft; + elt = elt.offsetParent; + } + x += elt.offsetLeft; + return x; + } + return -1; +} + +/* xbrowser pageY equivalent */ +function getEltPageTop(elt) { + var y = 0; + + if (is.nav4) + return elt.pageY; + if (is.ie4up) { + while (elt.offsetParent != null) { + y += elt.offsetTop; + elt = elt.offsetParent; + } + y += elt.offsetTop; + return y; + } + + /* ie5/mac modification added per comment from David Weingard */ + if (is.mac && is.ie5) + { + y += stringToNumber(document.body.currentStyle.marginTop); + } + + if (is.gecko) { + while (elt.offsetParent != null) { + y += elt.offsetTop; + elt = elt.offsetParent; + } + y += elt.offsetTop; + return y; + } + return -1; +} + +/* Sets position of left edge of elt in pixels. */ +function setEltLeft (elt, x) { + if (is.nav4) elt.left=x; + else if (is.ie4up) elt.style.pixelLeft=x; + else if (is.gecko) elt.style.left = (x + "px"); +} + + +/* Returns left edge of elt in pixels. */ +function getEltLeft (elt) { + if (is.nav4) return (elt.left); + else if (is.ie4up) return (elt.style.pixelLeft); + else if (is.gecko) return stringToNumber(elt.style.left); +} + +/* Sets top edge of elt in pixels. */ +function setEltTop (elt, y) +{ if (is.nav4) elt.top=y; + else if (is.ie4up) elt.style.pixelTop=y; + else if (is.gecko) elt.style.top= (y + "px"); +} + +/* Returns top edge of elt in pixels. */ +function getEltTop (elt) +{ if (is.nav4) return (elt.top); + else if (is.ie4up) return (elt.style.pixelTop); + else if (is.gecko) return stringToNumber(elt.style.top); +} + +/* Returns width of elt in pixels. */ +function getEltWidth(elt) { + + if (is.nav4) { + if (elt.document.width) + return elt.document.width; + else + return elt.clip.right - elt.clip.left; + } + if (is.ie4up) { + if (elt.style.pixelWidth) + return elt.style.pixelWidth; + + else + return elt.offsetWidth; + } + if (is.gecko) { + if (elt.style.width) + return stringToNumber(elt.style.width); + else + return stringToNumber(elt.offsetWidth); + } + return -1; +} + +/* set width of elt in pixels */ +function setEltWidth(elt,wdth) +{ + if(is.nav4) + { + elt.document.width = wdth; + } + else if(elt.style) + { + elt.style.width = wdth; + } +} + +/* Returns height of elt in pixels. */ +function getEltHeight(elt) { + if (is.nav4) { + if (elt.document.height) + return elt.document.height; + else + return elt.clip.bottom - elt.clip.top; + } + if (is.ie4up) { + if (elt.style.pixelHeight) + return elt.style.pixelHeight; + else + return elt.clientHeight; + } + if (is.gecko) { + if (elt.style.height) + return stringToNumber(elt.style.height); + else + return stringToNumber(elt.offsetHeight); + } + return -1; +} + +/* set width of elt in pixels */ + +function setEltHeight(elt,hght) +{ + if(is.nav4) + { + elt.document.height = hght; + } + else if(elt.style) + { + elt.style.height = hght; + } +} + +/* Sets element clipping area. + NOTE ORDER: top, right, bottom, left to be consistent with CSS usage. + cliptop, clipright, clipbottom, and clipleft are integers. +*/ +function setEltClip (elt, cliptop, clipright, clipbottom, clipleft) +{ if (is.nav4) { + elt.clip.left = clipleft; + elt.clip.top = cliptop; + elt.clip.right = clipright; + elt.clip.bottom = clipbottom; + } + else if (is.ie4up) elt.style.clip = 'rect(' + cliptop + ' ' + + clipright + ' ' + clipbottom + ' ' + clipleft +')'; + else if (is.gecko) elt.style.clip = 'rect(' + cliptop + ' ' + + clipright + ' ' + clipbottom + ' ' + clipleft +')'; +} + +/* utility function for IE only -- does not use regular expressions + in order to avoid triggering syntax error if parsed by Nav3 */ +function tempClipObj (elt) +{ var clipStr = elt.style.clip; + + clipStr = clipStr.substring (clipStr.indexOf("(") + 1); + this.top = stringToNumber(clipStr); + clipStr = clipStr.substring (clipStr.indexOf(" ") + 1); + this.right = stringToNumber(clipStr); + clipStr = clipStr.substring (clipStr.indexOf(" ") + 1); + this.bottom = stringToNumber(clipStr); + clipStr = clipStr.substring (clipStr.indexOf(" ") + 1); + this.left = stringToNumber(clipStr); +} + +/* Returns left edge of clipping area of elt in pixels. */ +function getEltClipLeft (elt) +{ if (is.nav4) return (elt.clip.left); + else if (elt.style) + { var tempClip = new tempClipObj (elt); + return tempClip.left; + } +} + +/* Returns top edge of clipping area of elt in pixels. */ +function getEltClipTop (elt) +{ if (is.nav4) return (elt.clip.top); + else if (elt.style) + { var tempClip = new tempClipObj (elt); + return tempClip.top; + } +} + +/* Returns right edge of clipping area of elt in pixels. */ +function getEltClipRight (elt) { + if (is.nav4) return (elt.clip.right); + else if (elt.style) + { var tempClip = new tempClipObj (elt); + return tempClip.right; + } + +} + +/* Returns bottom edge of clipping area of elt in pixels. */ +function getEltClipBottom (elt) +{ if (is.nav4) return (elt.clip.bottom); + else if (elt.style) + { var tempClip = new tempClipObj (elt); + return tempClip.bottom; + } +} + +/* Returns width of clipping area of elt in pixels. */ + +function getEltClipWidth (elt) +{ + return (getEltClipRight(elt) - getEltClipLeft(elt)); +} + + +/* Returns height of clipping area of elt in pixels. */ + +function getEltClipHeight (elt) +{ + return (getEltClipBottom(elt) - getEltClipTop(elt)); +} + + +/* Returns width of current window content area in pixels. */ + +function getCurrentWinWidth() +{ if (is.nav4) return(window.innerWidth); + else if (is.ie4up) return(document.body.clientWidth); + else if (is.gecko) return(window.innerWidth); +} + + + +/* Returns height of current window content area in pixels. */ +function getCurrentWinHeight() +{ if (is.nav4) return(window.innerHeight); + else if (is.ie4up) return(document.body.clientHeight); + else if (is.gecko) return(window.innerHeight); + +} + +/* Returns z-index (stacking order) of elt, + which is a positive integer. */ + +function getEltZIndex (elt) +{ if (is.nav4) return(elt.zIndex); + else if (elt.style) return (elt.style.zIndex); +} + +/* Sets z-index (stacking order) of elt. + z is a positive integer. */ + +function setEltZIndex (elt, z) +{ if (is.nav4) elt.zIndex = z; + else if (elt.style) elt.style.zIndex = z; +} + + +/* end CBDHTML derivative functions */ +/* Sets background image of elt to image at imageFilePath. + + Note: although this function and the next provide the + ability to set and get the background image property of + an element across Nav4/Gecko/IE4+, because of differences in + the way background image support is implemented, it may + require considerable experimentation with HTML/CSS markup + and content to achieve the same visual effect. +*/ +function setEltBackgroundImage (elt, imageFilePath) +{ if (is.nav4) elt.background.src = imageFilePath; + else if (is.ie4up) elt.style.backgroundImage = "url(" + imageFilePath + ")"; + else if (is.gecko) elt.style.backgroundImage = "url(" + imageFilePath + ")"; +} + +/* Returns file path or URL of background image of elt. + Note: the return value strings are not identical. + On Nav4, we get back a string like + "file:///F|/DHTML/xbdhtml/xbdhtml/images/redpole.gif". + On IE4 and Gecko, we get back a string like "url(images/redpole.gif)". + so we trim off the leading "url(" and the trailing ")". +*/ + +function getEltBackgroundImage (elt) +{ if (is.nav4) return (elt.background.src); + else if (elt.style) { + var theURL = elt.style.backgroundImage; + if (typeof(theURL) == "string") + { var URLlen = theURL.length; + return (theURL.substring (4, URLlen-1)); + } + else return(theURL); + } +} + +/* Sets background color of elt to colorNumber. + colorNumber is an numeric color code like 0xffffff for white, + or one of the 16 standard color names from CSS1 like "red". + (DO NOT USE IE's extended list of color names strings; they + are not supported on Nav4!) + + NOTE: even if you set the color to one of the 16 CSS1 color name + strings (e.g. "red"), getEltBackgroundColor will always return + the integer code equivalent (e.g. 0xff0000 instead of "red"), + because getEltBackgroundColor automatically converts those names to + an integer on IE4 and Gecko, and on Nav4 the conversion happens by default. + To avoid the confusion of setting the value to a string but getting + an integer back, it's simplest to use color numbers only. + + Note: although this function and the next provide the + ability to set and get the background color property of + an element across Nav4/Gecko/IE4+, because of differences in + the way background color support is implemented, it may + require considerable experimentation with HTML/CSS markup + and content to achieve the same visual effect. +*/ + +function setEltBackgroundColor (elt, colorNumber) +{ if (is.nav4) elt.bgColor = colorNumber; + else if (elt.style) elt.style.backgroundColor = colorNumber; +} + +/* ------------------------------------------------------------- + FUNCTIONS FOR GETTING ELEMENT'S BACKGROUND COLOR + These depend upon each other and must be reused as a group. + ------------------------------------------------------------- */ + +var colorNameString = "aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white"; +var colorNames = new Array ("aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "purple", "red", "silver", "teal", "yellow", "white"); +var colorNumbers = new Array (0xffff, 0, 0xff, 0xff00ff, 0x808080, 0x8000, 0xff00, 0x800000, 0x80, 0x808000, 0x800080, 0xff0000, 0xc0c0c0, 0x8080, 0xffff00, 0xffffff); + + + +/* Tests whether string aString is one of the 16 CSS1 color names. +*/ +function isColorName (aString) +{ return ( (typeof(aString) == "string") && (colorNameString.indexOf(aString) != -1)); +} + +/* Converts color name string (like "white") to number (like 0xffffff). + ONLY supports 16 standard CSS1 color names, NOT IE4 extended list! +*/ +function colorNameToNumber (colorName) +{ for (var i=0; i<16; i++) if (colorNames[i]==colorName) return colorNumbers[i]; + // Return string name unchanged if not found. + // This handles IE4 non-CSS1-standard color names gracefully. + return colorName; +} + +/* Converts color number (like 0xffffff) to name string (like "white"). + ONLY supports 16 standard CSS1 color names, NOT IE4 extended list! +*/ + +function colorNumberToName (colorNumber) +{ for (var i=0; i<16; i++) if (colorNumbers[i]==colorNumber) return colorNames[i]; + return null; +} + +/* Returns background color of elt as integer. + (NOT color name like "red", or IE4 default return value like "#ffffff".) + Nav4 returns integer by default. IE4 returns string which is either: + a) a leading "#" followed by a 6-digit hexadecimal RGB value, or + b) one of the 16 string color names like "red" + ... so we convert this to an integer for compatibility. + and Gecko returns a string which is either: + a) an rgb string like "rgb(255,0,255)" + b) one of the 16 string color names like red. + + WARNING: There is a bug in Netscape6 (Gecko) that makes the browser interpret + decimal color values as hexadecimal, so if you set the color to 65280 + the actual color would be 0x065280. Avoid using decimal color values! + They are not standard and depricated. + WARNING: only the 16 CSS1 color names will be converted to integers. +*/ + +function getEltBackgroundColor (elt) +{ + if (is.nav4) return (elt.bgColor); + else if (is.ie4up) + { + var colorVal = elt.style.backgroundColor; + if (isColorName(colorVal)) return colorNameToNumber (colorVal); + else if (typeof(colorVal) == "string") + return (("0x" + colorVal.substring(1)) - 0); + else return colorVal; + } + else if (is.gecko) { + var colorVal = elt.style.backgroundColor; + + if (typeof(colorVal) == "string") + { + if (isColorName(colorVal)) + { + return colorNameToNumber (colorVal); + } + else if (colorVal.indexOf(["rgb"]) != -1) + { + var sR,sG,sB; + var iR,iG,iB; + var i=0; + + ColorString = (elt.style.backgroundColor); + //ColorString = "rgb(255,20,255)"; + ColorString = ColorString.slice(4,-1); + + while(ColorString[i] != ',' && i < 20){i++;} + sR = ColorString.slice(0,-(ColorString.length - i)); + i++; + j = i; + while(ColorString[j] != ',' && j < 20){j++;} + sG = ColorString.slice(i,0-(ColorString.length - j)); + j++; + sB = ColorString.slice(j); + iR = stringToNumber(sR); + iG = stringToNumber(sG); + iB = stringToNumber(sB); + sR = iR.toString(16);if(sR.length < 2)sR = "0" + sR;if(sR.length < 2)sR = "0" + sR; + sG = iG.toString(16);if(sG.length < 2)sG = "0" + sG;if(sG.length < 2)sG = "0" + sG; + sB = iB.toString(16);if(sB.length < 2)sB = "0" + sB;if(sB.length < 2)sB = "0" + sB; + + sRGB = sR.toUpperCase()+sG.toUpperCase()+sB.toUpperCase(); + return (("0x" + sRGB)-0); + } + } + else return colorVal; + } +} + +/* A version of stringToNumber that returns 0 if there is NaN returned, or number is part of a string, like 100px... */ +function stringToNumber(s) +{ + return parseInt(('0' + s), 10) +} Index: ViewTopic.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopic.pm,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- ViewTopic.pm 17 Oct 2004 22:32:41 -0000 1.49 +++ ViewTopic.pm 21 Feb 2005 11:25:05 -0000 1.50 @@ -40,6 +40,20 @@ # Retrieve the appropriate topic details. my $topic = Codestriker::Model::Topic->new($topicid); + # Retrieve the comment details for this topic, firstly determine how + # many distinct comment lines are there. + my @comments = $topic->read_comments(); + my %comment_map = (); + my $number_comments = 0; + foreach my $comment (@comments) { + my $key = $comment->{filenumber} . "|" . $comment->{fileline} . "|" . + $comment->{filenew}; + if (! exists $comment_map{$key}) { + $comment_map{$key} = 1; + $number_comments++; + } + } + # Retrieve the changed files which are a part of this review. my (@filenames, @revisions, @offsets, @binary, @numchanges); $topic->get_filestable( @@ -52,9 +66,6 @@ # Retrieve line-by-line versions of the data and description. my @document_description = split /\n/, $topic->{description}; - # Retrieve the comment details for this topic. - my @comments = $topic->read_comments(); - $http_response->generate_header(topic=>$topic->{topicid}, topic_title=>"Topic Text: $topic->{title}", mode=>$mode, tabwidth=>$tabwidth, @@ -137,10 +148,12 @@ } $vars->{'description'} = $data; - # Obtain the link to download the actual document text. $vars->{'download_url'} = $url_builder->download_url($topicid); + # Indicate how many comments there are. + $vars->{'number_comments'} = $number_comments; + # Fire the template on the topic heading information. my $template = Codestriker::Http::Template->new("viewtopic"); $template->process($vars); Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- Render.pm 17 Feb 2005 21:29:34 -0000 1.44 +++ Render.pm 21 Feb 2005 11:25:23 -0000 1.45 @@ -89,15 +89,25 @@ $self->{topic_state} = $topic_obj->{topic_state}; # Build a hash from filenumber|fileline|new -> comment array, so that - # when rendering, lines can be coloured appropriately. + # when rendering, lines can be coloured appropriately. Also build a list + # of what points in the review have a comment. Also record a mapping + # from filenumber|fileline|new -> the comment number. my %comment_hash = (); + my @comment_locations = (); + my %comment_location_map = (); for (my $i = 0; $i <= $#$comments; $i++) { my $comment = $$comments[$i]; my $key = $comment->{filenumber} . "|" . $comment->{fileline} . "|" . $comment->{filenew}; + if (! exists $comment_hash{$key}) { + push @comment_locations, $key; + $comment_location_map{$key} = $#comment_locations; + } push @{ $comment_hash{$key} }, $comment; } $self->{comment_hash} = \%comment_hash; + $self->{comment_locations} = \@comment_locations; + $self->{comment_location_map} = \%comment_location_map; # Also have a number of additional private variables which need to # be initialised. @@ -141,6 +151,98 @@ $self->{idhashref} = undef; } + # Precompute the overlib HTML for each comment location. + print "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; + + # Set the topicid. + print " topicid = " . $self->{topic} . ";\n"; + + # Now record all the comments made so far in the topic. + print " var comment_text = new Array();\n"; + print " var comment_hash = new Array();\n"; + my $index; + for ($index = 0; $index <= $#comment_locations; $index++) { + + # Contains the overlib HTML text. + my $overlib_html = ""; + + # Determine what the previous and next comment locations are. + my $previous = undef; + my $next = undef; + if ($index > 0) { + $previous = $comment_locations[$index-1]; + } + if ($index < $#comment_locations) { + $next = $comment_locations[$index+1]; + } + + # Compute the previous link if required. + my $current_url = $self->{query}->self_url(); + if (defined $previous && $previous =~ /^(\-?\d+)|\-?\d+|\d+$/o) { + my $previous_fview = $1; + my $previous_index = $index - 1; + my $previous_url = $current_url; + $previous_url =~ s/fview=\d+/fview=$previous_fview/o if $self->{fview} != -1; + $previous_url .= '#' . $previous; + $overlib_html .= "<a href=\"javascript:window.location=\\'$previous_url\\'; "; + if ($self->{fview} == -1 || $self->{fview} == $previous_fview) { + $overlib_html .= "overlib(comment_text[$previous_index], STICKY, FIXX, getEltPageLeft(getElt(\\'c$previous_index\\')), FIXY, getEltPageTop(getElt(\\'c$previous_index\\'))); "; +} + $overlib_html .= "void(0);\">Previous</a>"; + } + + # Compute the next link if required. + if (defined $next && $next =~ /^(\-?\d+)|\-?\d+|\d+$/o) { + my $next_fview = $1; + $overlib_html .= " | " if defined $previous; + my $next_index = $index + 1; + my $next_url = $current_url; + $next_url =~ s/fview=\d+/fview=$next_fview/o if $self->{fview} != -1; + $next_url .= '#' . $next; + $overlib_html .= "<a href=\"javascript:window.location=\\'$next_url\\'; "; + if ($self->{fview} == -1 || $self->{fview} == $next_fview) { + $overlib_html .= "overlib(comment_text[$next_index], STICKY, FIXX, getEltPageLeft(getElt(\\'c$next_index\\')), FIXY, getEltPageTop(getElt(\\'c$next_index\\'))); "; + } + $overlib_html .= "void(0);\">Next</a>"; + } + if (defined $previous || defined $next) { + $overlib_html .= " | "; + } + + # Add a close link. + $overlib_html .= "<a href=\"javascript:hideElt(getElt(\\'overDiv\\')); void(0);\">Close</a><p>"; + + # Create the actual comment text. + my $key = $comment_locations[$index]; + my @comments = @{ $comment_hash{$key} }; + + for (my $i = 0; $i <= $#comments; $i++) { + my $comment = $comments[$i]; + + # Need to format the data appropriately for HTML display. + my $data = HTML::Entities::encode($comment->{data}); + $data =~ s/\'/\\\'/mg; + $data =~ s/\n/<br>/mg; + $data =~ s/ / /mg; + $data = tabadjust($self, $self->{tabwidth}, $data, 1); + + # Show each comment with the author and date in bold. + $overlib_html .= "<b>Comment from $comment->{author} "; + $overlib_html .= "on $comment->{date}</b><br>"; + $overlib_html .= "$data"; + + # Add a newline at the end if required. + if ($i < $#comments && + substr($overlib_html, length($overlib_html)-4, 4) ne '<br>') { + $overlib_html .= '<br>'; + } + } + + print " comment_text[$index] = '$overlib_html';\n"; + print " comment_hash['" . $comment_locations[$index] . "'] = $index;\n"; + } + print "</script>\n"; + bless $self, $type; } @@ -763,11 +865,6 @@ my ($self, $filenumber, $line, $new, $text, $comment_class, $no_comment_class) = @_; - # Retrieve any comments associated with this line, and javascript - # escape it appropriately. - my $title = $self->get_comment_digest($line, $filenumber, $new); - $title =~ s/\'/\\\'/mg; - # Determine the anchor and edit URL for this line number. my $anchor = "$filenumber|$line|$new"; my $edit_url = "javascript:eo('$filenumber','$line','$new')"; @@ -784,11 +881,26 @@ # If a comment exists on this line, set span and the overlib hooks onto # it. my $query = $self->{query}; - if ($title ne "") { + my %comment_hash = %{ $self->{comment_hash} }; + my %comment_location_map = %{ $self->{comment_location_map} }; + my $comment_number = undef; + if (exists $comment_hash{$anchor}) { + # Determine what comment number this anchor refers to. + $comment_number = $comment_location_map{$anchor}; + if (defined $comment_class) { - $text = $query->span({-class=>$comment_class}, $text); + $text = $query->span({-id=>"c$comment_number"}, "") . + $query->span({-class=>$comment_class}, $text); } - $params->{onmouseover} = "return overlib('$title');"; + + # Determine what the next comment in line is. + my $index = -1; + my @comment_locations = @{ $self->{comment_locations} }; + for ($index = 0; $index <= $#comment_locations; $index++) { + last if $anchor eq $comment_locations[$index]; + } + + $params->{onmouseover} = "return overlib(comment_text[$index],STICKY);"; $params->{onmouseout} = "return nd();"; } else { if (defined $no_comment_class) { @@ -796,7 +908,6 @@ } } - # Return the rendered link. return $query->a($params, $text); } @@ -840,6 +951,8 @@ # Start hook called when about to start rendering to a page. sub start($) { my ($self) = @_; + + # Now create the start of the rendering tables. if ($self->{mode} == $Codestriker::NORMAL_MODE) { $self->_normal_mode_start(); } else { Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Response.pm 16 Feb 2005 11:54:27 -0000 1.23 +++ Response.pm 21 Feb 2005 11:25:26 -0000 1.24 @@ -202,6 +202,7 @@ if (defined $topic_title && $topic_title ne "") { $title .= ": \"$topic_title\""; } + $title = HTML::Entities::encode($title); # Generate the URL to the codestriker CSS file. my $codestriker_css; @@ -214,75 +215,22 @@ my $overlib_js = $codestriker_css; $overlib_js =~ s/codestriker.css/overlib.js/; - - # Write the simple open window javascript method for displaying popups. - # Note gotoAnchor can't simply be: - # - # opener.location.hash = "#" + anchor; - # - # As the old netscapes don't handle it properly. - my $base_url = $query->url(); - my $jscript=<<END; - <script language="JavaScript" type="text/javascript"> - <!-- Hide script - //<![CDATA[ - - // Global settings for overLIB. - ol_fgcolor = '#FFFFCC'; - ol_textsize = '2'; - - var windowHandle = ''; - - function myOpen(url,name) { - windowHandle = window.open(url,name, - 'toolbar=no,width=800,height=600,status=yes,scrollbars=yes,resizable=yes,menubar=no'); - // Indicate who initiated this operation. - windowHandle.opener = window; - - windowHandle.focus(); - } - - // Edit open function. Name is kept short to reduce output size. - function eo(fn,line,newfile) { - myOpen('$base_url' + '?fn=' + fn + '&line=' + line + - '&new=' + newfile + '&topic=$topic&action=edit&a=' + - fn + '|' + line + '|' + newfile, 'e'); - } - - function gotoAnchor(anchor, reload) { - if (anchor == "" || opener == null) return; - - var index = opener.location.href.lastIndexOf("#"); - if (index != -1) { - opener.location.href = - opener.location.href.substr(0, index) + "#" + anchor; - } - else { - opener.location.href += "#" + anchor; - } - - if (reload) opener.location.reload(reload); - opener.focus(); - } - - //]]> End script hiding --> - </script> -END - -# "http://www.w3.org/TR/html4/strict.dtd" - - print $query->start_html(-dtd=>'-//W3C//DTD HTML 4.01 Transitional//EN', - -charset=>'ISO-8859-1', - -title=>"$title", - -bgcolor=>"#eeeeee", - -style=>{src=>"$codestriker_css"}, - -script=>{type=>"text/javascript", src=>"$overlib_js"}, - -base=>$query->url(), - -link=>'blue', - -vlink=>'purple', - -onLoad=>"gotoAnchor('$load_anchor', $reload)"); - - print $jscript; + my $xbdhtml_js = $codestriker_css; + $xbdhtml_js =~ s/codestriker.css/xbdhtml.js/; + my $codestriker_js = $codestriker_css; + $codestriker_js =~ s/codestriker.css/codestriker.js/; + + # Print the basic HTML header header, with the inclusion of the scripts. + print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; + print "\n"; + print '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">'; + print "\n"; + print "<head><title>$title</title>\n"; + print "<base href=\"$query->url()\"/>\n"; + print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$codestriker_css\" />\n"; + print "<script src=\"$overlib_js\" type=\"text/javascript\"></script>\n"; + print "<script src=\"$xbdhtml_js\" type=\"text/javascript\"></script>\n"; + print "<script src=\"$codestriker_js\" type=\"text/javascript\"></script>\n"; # Write a comment indicating if this was compressed or not. $self->{output_compressed} = $output_compressed; Index: Comment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Comment.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Comment.pm 30 Jan 2005 00:48:10 -0000 1.19 +++ Comment.pm 21 Feb 2005 11:25:26 -0000 1.20 @@ -289,6 +289,7 @@ 'ORDER BY ' . 'commentstate.filenumber, ' . 'commentstate.fileline, ' . + 'commentstate.filenew, ' . 'commentdata.creation_ts'); my $success = defined $select_comment; my $rc = $Codestriker::OK; Index: createproject.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/createproject.html.tmpl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- createproject.html.tmpl 21 Nov 2004 05:00:10 -0000 1.18 +++ createproject.html.tmpl 21 Feb 2005 11:25:28 -0000 1.19 @@ -1,6 +1,7 @@ [%# Screen for the create project form. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x350.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x350.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: createtopic.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/createtopic.html.tmpl,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- createtopic.html.tmpl 16 Feb 2005 11:54:26 -0000 1.40 +++ createtopic.html.tmpl 21 Feb 2005 11:25:29 -0000 1.41 @@ -1,6 +1,7 @@ [%# Screen for the create topic form. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x374.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x374.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: editproject.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editproject.html.tmpl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- editproject.html.tmpl 21 Nov 2004 05:00:10 -0000 1.18 +++ editproject.html.tmpl 21 Feb 2005 11:25:30 -0000 1.19 @@ -1,6 +1,7 @@ [%# Screen for the edit project form. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x350.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x350.html" %] <script language="JavaScript"> Index: header.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/header.html.tmpl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- header.html.tmpl 8 Sep 2004 03:48:57 -0000 1.9 +++ header.html.tmpl 21 Feb 2005 11:25:30 -0000 1.10 @@ -1,4 +1,9 @@ -[%# Header HTML code to appear on each screen, after <BODY> tag. #%] +[% IF closehead %] +</head> +<body> +[% END %] + +[%# Header HTML code to appear on each screen, after <body> tag. #%] <table width="100%" border="0"> <tr> Index: listprojects.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listprojects.html.tmpl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- listprojects.html.tmpl 21 Nov 2004 05:00:10 -0000 1.16 +++ listprojects.html.tmpl 21 Feb 2005 11:25:30 -0000 1.17 @@ -1,6 +1,7 @@ [%# Display a list of projects #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x350.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x350.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: listtopics.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listtopics.html.tmpl,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- listtopics.html.tmpl 21 Dec 2004 23:02:59 -0000 1.32 +++ listtopics.html.tmpl 21 Feb 2005 11:25:30 -0000 1.33 @@ -1,6 +1,7 @@ [%# Screen for show a list of topics. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x319.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x319.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: metricsreport.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/metricsreport.html.tmpl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- metricsreport.html.tmpl 24 Nov 2004 11:18:09 -0000 1.11 +++ metricsreport.html.tmpl 21 Feb 2005 11:25:30 -0000 1.12 @@ -1,6 +1,7 @@ [%# Screen for the metrics report. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help ="x672.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help ="x672.html" %] <!-- "" --> Index: search.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/search.html.tmpl,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- search.html.tmpl 16 Feb 2005 11:54:26 -0000 1.26 +++ search.html.tmpl 21 Feb 2005 11:25:31 -0000 1.27 @@ -1,6 +1,7 @@ [%# Screen for search topics. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x636.html" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help = "x636.html" %] <H1>Topic search</H1> Index: submitnewcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/submitnewcomment.html.tmpl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- submitnewcomment.html.tmpl 22 Mar 2004 09:28:10 -0000 1.4 +++ submitnewcomment.html.tmpl 21 Feb 2005 11:25:31 -0000 1.5 @@ -1,6 +1,7 @@ [%# Screen for the submit comment confirmation screen. #%] -[% PROCESS header.html.tmpl version = version displaymenu = 1 help="" %] +[% PROCESS header.html.tmpl version = version displaymenu = 1 + ... [truncated message content] |
|
From: <si...@us...> - 2005-02-21 11:25:44
|
Topic "CVS commit: Store the comment data in javascript-land as ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=8012688&action=view -------------------------------------------------------------- Description: Store the comment data in javascript-land as well, which allows the comment tooltips to navigate between the different comments, using some overlib and CSS-P magic. Still needs some more work, but this is a good start. Eventually, we should be able to add a comment via overlib as well, perhaps within an IFRAME. -------------------------------------------------------------- The topic was created with the following files: codestriker/codestriker.conf codestriker.js xbdhtml.js codestriker/lib/Codestriker/Action/ViewTopic.pm codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Response.pm codestriker/lib/Codestriker/Model/Comment.pm codestriker/template/en/default/createproject.html.tmpl codestriker/template/en/default/createtopic.html.tmpl codestriker/template/en/default/editproject.html.tmpl codestriker/template/en/default/header.html.tmpl codestriker/template/en/default/listprojects.html.tmpl codestriker/template/en/default/listtopics.html.tmpl codestriker/template/en/default/metricsreport.html.tmpl codestriker/template/en/default/search.html.tmpl codestriker/template/en/default/submitnewcomment.html.tmpl codestriker/template/en/default/submitnewtopic.html.tmpl codestriker/template/en/default/viewtopic.html.tmpl codestriker/template/en/default/viewtopiccomments.html.tmpl codestriker/template/en/default/viewtopicheader.html.tmpl codestriker/template/en/default/viewtopicinfo.html.tmpl codestriker/template/en/default/viewtopicproperties.html.tmpl |
|
From: <si...@us...> - 2005-02-17 21:29:51
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1550573&action=view User: sits Date: 05/02/17 13:29:35 Modified: html codestriker.css lib/Codestriker/Http Render.pm Log: Defined the function render_comment_link, which is the only place where text is rendered when it is associated with a comment, such as a line number, or a file or general-level comment. As a side effect, we can now see comments in the tool-tips associated with the file-level and general-level comments. Index: codestriker.css =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.css,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- codestriker.css 22 Aug 2004 12:09:29 -0000 1.10 +++ codestriker.css 17 Feb 2005 21:29:33 -0000 1.11 @@ -83,6 +83,12 @@ /* Smaller monospaced line number with no comment */ SPAN.smsnocom {font-family: monospace; font-size: smaller} +/* File heading */ +SPAN.file_comment {background-color: #cccccc; font-family: Helvetica, Arial; font-size: medium; color: #ff0000} + +/* General heading */ +SPAN.general_comment {color: #ff0000} + /* Style used for rendering data within popup window */ PRE.ms {font-family: monospace; font-size: medium} Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- Render.pm 16 Feb 2005 21:40:07 -0000 1.43 +++ Render.pm 17 Feb 2005 21:29:34 -0000 1.44 @@ -369,9 +369,9 @@ } # Generate the text for the link to add a file-level comment. - my $add_file_level_comment_link = "javascript:eo('$cfi','-1','1')"; my $add_file_level_comment_text = - $query->a({href=>$add_file_level_comment_link}, "[Add File Comment]"); + $self->render_comment_link($cfi, -1, 1, "[Add File Comment]", + "file_comment", undef); if ($repmatch && $revision ne $Codestriker::ADDED_REVISION && $revision ne $Codestriker::PATCH_REVISION) { @@ -748,56 +748,56 @@ $no_comment_class = "smsnocom"; } - my $linedata; - my %comment_hash = %{ $self->{comment_hash} }; - my $key = "$filenumber|$line|$new"; - if ($filenumber != -1 && defined $comment_hash{$key}) { - if ($self->{mode} == $Codestriker::NORMAL_MODE) { - $linedata = "<FONT COLOR=\"$COMMENT_LINE_COLOUR\">$line</FONT>"; - } else { - $linedata = $self->{query}->span({-class=>$comment_class}, $line); - } - } else { - if ($self->{mode} == $Codestriker::NORMAL_MODE) { - $linedata = $line; - } else { - $linedata = - $self->{query}->span({-class=>$no_comment_class}, $line); - } - } - # Check if the linenumber is outside the review. if ($link == 0) { - return $linedata; + return $line; } - my $link_title = $self->get_comment_digest($line, $filenumber, $new); - my $js_title = $link_title; - $js_title =~ s/\'/\\\'/mg; - my $anchor = $key; - my $edit_url = "javascript:eo('$filenumber','$line','$new');"; - - # If the topic is read only, and there is a comment on this line - # don't provide a clickable action, but still show the comment tooltip. - if ($self->{topic_state} ne $Codestriker::topic_states[0]) { - if ($link_title ne "") { - $edit_url = "javascript:void(0);"; - } else { - # No comment on this line, just return the line number as is. - return $linedata; - } + # Now render the line. + return $self->render_comment_link($filenumber, $line, $new, $line, + $comment_class, $no_comment_class); +} + +# Render the supplied text within a edit comment link. +sub render_comment_link { + my ($self, $filenumber, $line, $new, $text, + $comment_class, $no_comment_class) = @_; + + # Retrieve any comments associated with this line, and javascript + # escape it appropriately. + my $title = $self->get_comment_digest($line, $filenumber, $new); + $title =~ s/\'/\\\'/mg; + + # Determine the anchor and edit URL for this line number. + my $anchor = "$filenumber|$line|$new"; + my $edit_url = "javascript:eo('$filenumber','$line','$new')"; + + # Set the anchor to this line number. + my $params = {}; + $params->{name} = $anchor; + + # Only set the href attribute if the comment is in open state. + if ($self->{topic_state} eq $Codestriker::topic_states[0]) { + $params->{href} = $edit_url; } + # If a comment exists on this line, set span and the overlib hooks onto + # it. my $query = $self->{query}; - if ($link_title ne "") { - return $query->a( - {name=>$anchor, - href=>$edit_url, - onmouseover=>"return overlib('$js_title');", - onmouseout=>"return nd();"}, $linedata); + if ($title ne "") { + if (defined $comment_class) { + $text = $query->span({-class=>$comment_class}, $text); + } + $params->{onmouseover} = "return overlib('$title');"; + $params->{onmouseout} = "return nd();"; } else { - return $query->a({name=>$anchor, href=>"$edit_url"}, $linedata); + if (defined $no_comment_class) { + $text = $query->span({-class=>$no_comment_class}, $text); + } } + + # Return the rendered link. + return $query->a($params, $text); } # Generate a string which represents a digest of all the comments made for a @@ -986,8 +986,11 @@ print $query->end_table() . "\n"; # Render the "Add comment to topic" link. - print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, - "Add general comment") . " to topic."); + print $query->p; + print $self->render_comment_link(-1, -1, 1, "Add General Comment", + "general_comment", undef); + print " to topic."; + print $query->p; } # Render the initial start of the coloured table, with an empty row setting @@ -1024,8 +1027,11 @@ # Render the "Add comment to topic" link. my $query = $self->{query}; - print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, - "Add general comment") . " to topic."); + print $query->p; + print $self->render_comment_link(-1, -1, 1, "Add General Comment", + "general_comment", undef); + print " to topic."; + print $query->p; } # Display a line for a single file view. @@ -1094,51 +1100,23 @@ } } - # Render the line data. If the user clicks on a topic line, the - # edit window is focused to the appropriate line. - my $query = $self->{query}; my $line_cell = ""; - - # Check to see if the topic is read only. - if ($self->{topic_state} ne $Codestriker::topic_states[0]) - { - $line_cell = "$prefix$linenumber"; - } - else - { - - if ($link) { - # A line corresponding to the review. - my $edit_url = "javascript:eo('$filenumber','$linenumber','$new')"; - my %comment_hash = %{ $self->{comment_hash} }; - my $key = "$filenumber|$linenumber|$new"; - if (defined $comment_hash{$key}) { - my $link_title = - $self->get_comment_digest($linenumber, $filenumber, $new); - my $js_title = $link_title; - $js_title =~ s/\'/\\\'/mgo; - $line_cell = $prefix . - $query->a({name=>$key, - href=>$edit_url, - onmouseover=>"return overlib('<pre>$js_title</pre>');", - onmouseout=>"return nd();"}, - $query->span({-class=>$comment_class}, $linenumber)); - } - else { - $line_cell = $prefix . - $query->a({name=>$key, - href=>$edit_url}, - $query->span({-class=>$no_comment_class}, - $linenumber)); - } - } - else { + if ($link == 0) { # A line outside of the review. Just render the line number, as # the "name" of the linenumber should not be used. $line_cell = "$prefix$linenumber"; + } else { + $line_cell = $prefix . + $self->render_comment_link($filenumber, $linenumber, $new, + $linenumber, $comment_class, + $no_comment_class); } - } + # Render the line data. If the user clicks on a topic line, the + # edit window is focused to the appropriate line. + my $query = $self->{query}; + + # Replace the line data with spaces. my $newdata = tabadjust($self, $self->{tabwidth}, $data, 0); if ($class ne "") { |
|
From: <si...@us...> - 2005-02-17 21:29:45
|
Topic "CVS commit: Defined the function render_comment_link, whi..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1550573&action=view -------------------------------------------------------------- Description: Defined the function render_comment_link, which is the only place where text is rendered when it is associated with a comment, such as a line number, or a file or general-level comment. As a side effect, we can now see comments in the tool-tips associated with the file-level and general-level comments. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.css codestriker/lib/Codestriker/Http/Render.pm |
|
From: <si...@us...> - 2005-02-16 23:31:40
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=7473208&action=view User: sits Date: 05/02/16 15:31:24 Modified: . CHANGELOG Log: Updated CHANGELOG Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.166 retrieving revision 1.167 diff -u -r1.166 -r1.167 --- CHANGELOG 16 Feb 2005 11:54:23 -0000 1.166 +++ CHANGELOG 16 Feb 2005 23:31:21 -0000 1.167 @@ -49,9 +49,12 @@ * When creating new topics linked to Bugzilla, also include the topic description field in the Bugzilla comment. -* Searching on the bugid and cc fields was not working ocrrectly. +* Searching on the bugid and cc fields was not working correctly. This has now been fixed. +* On UNIX platforms, missing modules can be fetched and installed + automatically using the CPAN module, if required. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS |
|
From: <si...@us...> - 2005-02-16 23:31:33
|
Topic "CVS commit: Updated CHANGELOG" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=7473208&action=view -------------------------------------------------------------- Description: Updated CHANGELOG -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG |