[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Test Runner System.
  #
  # The Initial Developer of the Original Code is Greg Hendricks.
  # Portions created by Maciej Maczynski are Copyright (C) 2006
  # Novell. All Rights Reserved.
  #
  # Contributor(s): Greg Hendricks <ghendricks@novell.com>
  #%]

[% PROCESS global/variables.none.tmpl %]

[% colsepchar = user.settings.csv_colsepchar.value %]

[% FOREACH column = displaycolumns %]
    [% column FILTER remove('_id') FILTER csv %]
    [% IF column != displaycolumns.last %]
        [% colsepchar %]
    [% END %]
[% END %]
[% FOREACH cr = table.list %]

    [% FOREACH column = displaycolumns %]
        [% SWITCH column %]
            [% CASE 'case_id' %]
                [% cr.case_id FILTER csv %]
            [% CASE 'case_summary' %]
                [% cr.case.summary FILTER csv %]
            [% CASE 'build_id' %]
                [% cr.build.name FILTER csv %]
            [% CASE 'environment_id' %]
                [% cr.environment.name FILTER csv %]
            [% CASE 'status_id' %]
                [% cr.status FILTER csv %]
            [% CASE 'assignee' %]
                [% cr.assignee.identity FILTER csv %]
            [% CASE 'testedby' %]
                [% cr.testedby.identity FILTER csv %]
            [% CASE 'components' %]
                [% FILTER csv %]
                    [% FOREACH component = cr.case.components %]
                        [% component.name %](product=[% component.product_name %])
                        [% IF component != case.components.last %]
                            [% colsepchar %]
                        [% END %]
                    [% END %]
                [% END %]
            [% CASE 'tags' %]
                [% FILTER csv %]
                    [% FOREACH tag = cr.case.tags %]
                        [% tag.name %]
                        [% IF tag != cr.case.tags.last %]
                            [% colsepchar %]
                        [% END %]
                    [% END %]
                [% END %]
            [% CASE 'case_text_version' %]
                [% cr.case.case_text_version FILTER csv %]
            [% CASE 'priority_id' %]
                [% cr.priority FILTER csv %]
            [% CASE 'running_date' %]
                [% cr.running_date FILTER time FILTER csv %]
            [% CASE 'close_date' %]
                [% cr.close_date FILTER time FILTER csv %]
            [% CASE 'plans' %]
                [% FILTER csv %]
                    [% FOREACH plan = case.plans %]
                        [% plan.id %]
                        [% IF plan != case.plans.last %]
                            [% colsepchar %]
                        [% END %]
                    [% END %]
                [% END %]
            [% CASE 'most_current' %]
                [% case.iscurrent ? "YES" : "NO" FILTER csv %]
            [% CASE 'bugs' %]
                [% cr.get_buglist FILTER csv %]
            [% CASE DEFAULT %]
                [% case.$column FILTER csv %]
        [% END %]
        [% IF column != displaycolumns.last %]
            [% colsepchar %]
        [% END %]
    [% END %]
[% END %]    