[%# 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 Maciej Maczynski.
  # Portions created by Maciej Maczynski are Copyright (C) 2001
  # Maciej Maczynski. All Rights Reserved.
  #
  # Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
  #                 David Koenig <dkoenig@novell.com>
  #%]

[%# Testopia Test Case CSV row export template #%]

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

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

[% FOREACH column = displaycolumns %]
    [% SWITCH column %]
        [% CASE 'action' %]
            [% case.text.action FILTER csv %]
        [% CASE 'author_id' %]
            [% case.author.email FILTER csv %]
        [% CASE 'blocks' %]
            [% case.blocked_list FILTER csv %]
        [% CASE 'break_down' %]
            [% case.text.breakdown FILTER csv %]
        [% CASE 'case_status_id' %]
            [% case.status FILTER csv %]
        [% CASE 'category_id' %]
            [% case.category.name FILTER csv %]
        [% CASE 'components' %]
            [% FILTER csv %]
                [% FOREACH component = case.components %]
                    [% component.name %](product=[% component.product_name %])
                    [% IF component != case.components.last %]
                        [% colsepchar %]
                    [% END %]
                [% END %]
            [% END %]
        [% CASE 'default_tester_id' %]
            [% case.default_tester.email FILTER csv %]
        [% CASE 'depends_on' %]
            [% case.dependson_list FILTER csv %]
        [% CASE 'expected_results' %]
            [% case.text.effect FILTER csv %]
        [% CASE 'isautomated' %]
            [% case.isautomated ? "YES" : "NO" FILTER csv %]
        [% CASE 'plans' %]
            [% FILTER csv %]
                [% FOREACH plan = case.plans %]
                    [% plan.id %]
                    [% IF plan != case.plans.last %]
                        [% colsepchar %]
                    [% END %]
                [% END %]
            [% END %]
        [% CASE 'priority_id' %]
            [% case.priority FILTER csv %]
        [% CASE 'set_up' %]
            [% case.text.setup FILTER csv %]
        [% CASE 'tags' %]
            [% FILTER csv %]
                [% FOREACH tag = case.tags %]
                    [% tag.name %]
                    [% IF tag != case.tags.last %]
                        [% colsepchar %]
                    [% END %]
                [% END %]
            [% END %]
        [% CASE 'bugs' %]
            [% FILTER csv %]
                [% FOREACH bug = case.bugs %]
                    [% bug.id %]
                    [% IF bug != case.bugs.last %]
                        [% colsepchar %]
                    [% END %]
                [% END %]
            [% END %]
        [% CASE 'runs' %]
            [% FILTER csv %]
                [% FOREACH run = case.runs %]
                    [% run.id %]
                    [% IF run != case.runs.last %]
                        [% colsepchar %]
                    [% END %]
                [% END %]
            [% END %]
        [% CASE DEFAULT %]
            [% case.$column FILTER csv %]
    [% END %]
    [% IF column != displaycolumns.last %]
        [% colsepchar %]
    [% END %]
[% END %]