[%# 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>
  #                 Greg Hendricks <ghendricks@novell.com>
  #%]

[%# INTERFACE:
  # ...
  #%]

[% PROCESS global/variables.none.tmpl %]
[% PROCESS testopia/blocks.html.tmpl %]
[% PROCESS testopia/style.none.tmpl %]

[% javascript_urls.push("extensions/Testopia/extjs/examples/ux/Portal.js") %]
[% javascript_urls.push("extensions/Testopia/extjs/examples/ux/PortalColumn.js") %]
[% javascript_urls.push("extensions/Testopia/extjs/examples/ux/Portlet.js") %]

[% IF report %]
  [% title = "Roll Up Report" %]
[% ELSE %]
  [% title = "Test Results List" %]
[% END %]
[% PROCESS global/header.html.tmpl %]

<script type="text/javascript">
Ext.onReady(function(){
    Ext.QuickTips.init();
    var params = Testopia.Util.urlQueryToJSON(window.location.search);
    var list_grid = new Testopia.TestCaseRun.List(params, {});
    var objPanel = new Ext.Panel({
        layout: 'border',
        height: 650,
        monitorResize: true,
        split: true,
        id:'list_view',
        applyTo: 'list_div',
        items: [{
            id: 'object_panel',
            region: 'center',
            xtype: 'tabpanel',
            enableTabScroll: true,
            activeTab: 0,
            items: [list_grid, new Testopia.Search.DashboardPanel({})]
        },{
            region: 'east',
            width: 250,
            split: true,
            enableTabScroll: true,
            activeTab: 2,
            xtype: 'tabpanel',
            items: [
                new Testopia.Search.SavedReportsList({
                    title: 'Dashboards',
                    id: 'dashboard_grid',
                    type: 3
                }),
                new Testopia.Search.SavedReportsList({
                    title: 'Reports',
                    id: 'reports_grid',
                    type: 1
                }),
                new Testopia.Search.SavedReportsList({
                    title: 'Searches',
                    id: 'searches_grid',
                    type: 0
                })
            ]
        }]
    });
    
    list_grid.store.baseParams = params;
    list_grid.store.baseParams.ctype ='json';

    list_grid.store.load();

    Ext.getCmp('dashboardpanel').on('render', function(){
        Ext.getCmp('dashboardpanel').getTopToolbar().add({
            xtype: 'button',
            id: 'save_dashboard_btn',
            icon: 'extensions/Testopia/img/save.png',
            iconCls: 'img_button_16x',
            tooltip: 'Save this dashboard',
            handler: function(b,e){
                Testopia.Search.save('dashboard', Testopia.Search.dashboard_urls);
            }
        });
    });
[% IF report %]
    Ext.getCmp('caserun_list_grid').store.remoteSort = false;
    Ext.getCmp('caserun_list_grid').getBottomToolbar().remove('caserun_paging_filter');
[% END %]
}); 

</script>
[% IF report %]
<h3>This is a Roll up report. Displayed are the most recent test results for each test case for run(s) [% " $run_ids" IF run_ids %] [% "in plan(s) $plan_ids" IF plan_ids %]. </h3>
[% END %]
<div id="list_div" style="height:650px"></div>
[% PROCESS global/footer.html.tmpl %]
