Subversion Repositories DevTools

Rev

Rev 1293 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

[%# Display a list of comments #%]

[% USE AutomagicLinks %]
[% USE FormatWhitespace tabwidth = tabwidth %]

[% PROCESS viewtopicheader.html.tmpl version = version
   help = "x602.html" topicview = 0 topicproperties = 0 topiccomments = 1
   topicinfo = 0 closehead = 1 %]

<SCRIPT type="text/javascript">
<!-- This function handles the three filter select boxes at the top of the table.
function SelectFilter(post)
{
    var url = '';

    var userSelectionIndex = document.form.filter_comments_author.options.selectedIndex;    
    if (userSelectionIndex > 0)
    {
        var userSelection = document.form.filter_comments_author.options[userSelectionIndex].value;
        url = url + '&sauthor=' + userSelection;
    }
        
    var contextIndex = document.form.show_context_in_comments.options.selectedIndex;
    var contextSelection = document.form.show_context_in_comments.options[contextIndex].value;
    
    url = url + '&scontext=' + contextSelection;

    // Try to piece together the current values of the metric dropdown boxes.
    var metricIndex;
    var metricSelection;
    [% FOREACH metric = metrics %]

      metricIndex = document.form.comment_state_metric_[% metric.name %].options.selectedIndex;
      metricSelection = document.form.comment_state_metric_[% metric.name %].options[metricIndex].value;
      url = url + '&comment_state_metric_[% metric.name %]=' + metricSelection;

    [% END %]
    
    // The filtering url parameters have been build, now a "get" back to the web server
    // with the updated filter paramters, the ListComments.pm script will refilter then.
    if (post == 0)
    {
        window.location='[% view_comments_url %]' + url;
    }
    return true;
}

// -->
</SCRIPT>

<FORM METHOD="post" ENCTYPE="multipart/form-data" name="form">
<INPUT TYPE="hidden" NAME="action" VALUE="change_comments_state" />
<INPUT TYPE="hidden" NAME="topic" VALUE="[% topic %]" />

<INPUT TYPE="hidden" NAME="scontext" VALUE="[% scontext %]" />
<INPUT TYPE="hidden" NAME="sauthor" VALUE="[% sauthor %]" />
<INPUT TYPE="hidden" NAME="sstate" VALUE="[% sstate %]" />


<P><FONT size="5">Comments: &nbsp; &nbsp;</FONT>

<BR/>
<TABLE>
<TR>
  <TD ALIGN="right">Show authored by: &nbsp;</TD>
  <TD ALIGN="left">
  <SELECT name="filter_comments_author" onChange="SelectFilter(0)">
     <OPTION value="1"> Everybody </OPTION>
     [% FOREACH user = users %]
     <OPTION value="[% user %]" [% IF sauthor == user %] SELECTED [% END %] >[% user %]</OPTION>
     [% END %]
  </SELECT>

with
  <SELECT name="show_context_in_comments" onChange="SelectFilter(0)">
     <OPTION value="0" [% IF scontext == 0 %] SELECTED [% END %]>no context</OPTION>
     <OPTION value="3" [% IF scontext == 3 %] SELECTED [% END %]>with context 3 lines</OPTION>
     <OPTION value="6" [% IF scontext == 6 %] SELECTED [% END %]>with context 6 lines</OPTION>
  </SELECT>
  </TD>
</TR>

[% IF metrics != '' %]
[% FOREACH metric = metrics %]
  [% IF loop.index() % 4 == 0 %]<TR><TD>&nbsp;</TD><TD ALIGN="left">[% END %]
  [% metric.name %]:
  <SELECT NAME="comment_state_metric_[% metric.name %]" onChange="SelectFilter(0)">
    <OPTION VALUE="__any__">Any</OPTION>
    [% SET selected_value = metrics_selection.${metric.name} %]
    [% FOREACH value = metric.values %]
      [% IF selected_value != '' && selected_value == value %]
        <OPTION SELECTED VALUE="[% value %]">[% value %]</OPTION>
      [% ELSE %]
        <OPTION VALUE="[% value %]">[% value %]</OPTION>
      [% END %]
    [% END %]
  </SELECT>
  &nbsp;&nbsp;&nbsp;&nbsp;
  [% IF loop.index() % 4 == 3 || loop.last() %]</TD></TR>[% END %]
[% END %]
[% END %]
</TABLE>

<P>
<TABLE CELLPADDING="1" CELLSPACING="3" BORDER="0" WIDTH="100%">

[% last_fileline = -999 %]
[% last_filenumber = -999 %]
[% FOREACH comment = comments %]
[% FLUSH IF loop.count() % 10 == 1 %]

    [% IF comment.fileline != last_fileline ||
          comment.filenumber != last_filenumber %]
    <TR CLASS="comments">
        [%# Display the comment thread information #%]
        <TD>
            [% IF comment.filename != '' %]
               <A HREF="[% comment.view_file %]">[% comment.filename %][% IF comment.fileline != -1 %]:[% comment.fileline %]</A>[% ELSE %]</A> (File Level)[% END %]
               [% IF allow_repositories != 0 %] | <A HREF="[% comment.view_parallel %]">Parallel</A> [% END %]
            [% ELSIF comment.fileline == -1 && comment.filenumber == -1 %]
               Topic Level
            [% ELSE %]
               Line: [% comment.line %]
            [% END %]

            [%# Check to see if the topic is open or not #%]
            [% IF topic_readonly == 0 %]
            | <A NAME="[% comment.anchor %]" HREF="[% comment.edit_url %]">Add comment</A>
            [% END %]
        </TD>
    </TR>

    [%# Now display the metric dropdowns #%]
    [% IF metrics != '' %]
    [% FOREACH metric = metrics %]
        [% IF loop.index() % 4 == 0 %]<TR><TD>[% END %]
        [% SET metric_name = metric.name %]
        [% metric_name %]:
        <SELECT NAME="comment_state_metric|[% metric_name %]|[%comment.filenumber %]|[% comment.fileline %]|[% comment.filenew %]|[% comment.version %]"

        [%# Check to see if the topic is readonly or not #%]
        [% IF topic_readonly != 0 %]
                disabled
        [% END %]
        >

        [% SET comment_metric_value = comment.metrics.$metric_name %]
        [% SET found_current_value = 0 %]
        [% FOREACH value = metric.values %]
            [% IF value == comment_metric_value %]
                <OPTION SELECTED VALUE="[% value %]">[% value %]</OPTION>
                [% SET found_current_value = 1 %]
            [% ELSE %]
                <OPTION VALUE="[% value %]">[% value %]</OPTION>
            [% END %]
        [% END %]

        [% IF found_current_value == 0 %]
            <OPTION SELECTED VALUE="[% comment_metric_value %]">[% comment_metric_value %]</OPTION>
        [% END %]
        </SELECT>
        &nbsp;&nbsp;&nbsp;&nbsp;
        [% IF loop.index() % 4 == 3 || loop.last() %]</TD></TR>[% END %]
    [% END %]
    [% END %]

    [% IF comment.context != '' %]
    <TR CLASS="commentc">
        <TD><PRE>[% comment.context %]</PRE></TD>
    </TR>
    [% END %]
    [% last_fileline = comment.fileline %]
    [% last_filenumber = comment.filenumber %]

    [% END %]

    <TR CLASS="commenth">
        <TD>[% comment.author | html_entity %]&nbsp;[% comment.date | html_entity %]</TD>
    </TR>
    <TR CLASS="commentb">
        <TD>[% comment.data | html_entity | $FormatWhitespace | $AutomagicLinks %]</TD>
    </TR>
    <TR><TD><HR></TD></TR>
[% END %]

</TABLE>

[%# Check to see if the topic is open or not #%]
[% IF topic_readonly == 0 %]
<P>
<INPUT TYPE="submit" NAME="button" VALUE="Update" />
[% END %]

</FORM>

[% PROCESS trailer.html.tmpl %]

</body>
</html>