CRM-15941 separate parts of the report 'criteria' form
authorEileen McNaughton <eileen@fuzion.co.nz>
Wed, 25 Feb 2015 06:34:02 +0000 (19:34 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 2 Mar 2015 18:24:47 +0000 (05:24 +1100)
This puts them in regions & allows them to be overridden on a more granular level

CRM/Report/Form.php
templates/CRM/Report/Form/Criteria.tpl
templates/CRM/Report/Form/Criteria/FieldSelection.tpl [new file with mode: 0644]
templates/CRM/Report/Form/Criteria/Filters.tpl [new file with mode: 0644]
templates/CRM/Report/Form/Criteria/GroupBy.tpl [new file with mode: 0644]
templates/CRM/Report/Form/Criteria/OrderBy.tpl [new file with mode: 0644]
templates/CRM/Report/Form/Criteria/ReportOptions.tpl [new file with mode: 0644]

index 877e3b2f8f602438b314afaf17817e8bd13cb7eb..77f7c0e28d5c4c304b7a47a5ba200b165e665af1 100644 (file)
@@ -168,6 +168,13 @@ class CRM_Report_Form extends CRM_Core_Form {
 
   public $_drilldownReport = array();
 
+  /**
+   * Tabs to display on report.
+   *
+   * @var array
+   */
+  protected $tabs = array();
+
   /**
    * An attribute for checkbox/radio form field layout
    *
@@ -986,9 +993,16 @@ class CRM_Report_Form extends CRM_Core_Form {
     $this->addCheckBox("fields", ts('Select Columns'), $options, NULL,
       NULL, NULL, NULL, $this->_fourColumnAttribute, TRUE
     );
+    $this->tabs[] = 'FieldSelection';
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
     $this->assign('colGroups', $colGroups);
   }
 
+  /**
+   * Add filters to report.
+   */
   public function addFilters() {
     $filters = array();
     $count = 1;
@@ -1100,9 +1114,16 @@ class CRM_Report_Form extends CRM_Core_Form {
         }
       }
     }
+    $this->tabs[] = 'Filters';
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
     $this->assign('filters', $filters);
   }
 
+  /*
+   * Add options defined in $this->_options to the report.
+   */
   public function addOptions() {
     if (!empty($this->_options)) {
       // FIXME: For now lets build all elements as checkboxes.
@@ -1122,9 +1143,16 @@ class CRM_Report_Form extends CRM_Core_Form {
         }
       }
     }
+    $this->tabs[] = 'OrderBy';
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
     $this->assign('otherOptions', $this->_options);
   }
 
+  /**
+   * Add chart options to the report.
+   */
   public function addChartOptions() {
     if (!empty($this->_charts)) {
       $this->addElement('select', "charts", ts('Chart'), $this->_charts);
@@ -1133,6 +1161,9 @@ class CRM_Report_Form extends CRM_Core_Form {
     }
   }
 
+  /**
+   * Add group by options to the report.
+   */
   public function addGroupBys() {
     $options = $freqElements = array();
 
@@ -1152,6 +1183,10 @@ class CRM_Report_Form extends CRM_Core_Form {
       NULL, NULL, NULL, $this->_fourColumnAttribute
     );
     $this->assign('groupByElements', $options);
+    $this->tabs[] = 'GroupBy';
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
 
     foreach ($freqElements as $name) {
       $this->addElement('select', "group_bys_freq[$name]",
@@ -1190,6 +1225,10 @@ class CRM_Report_Form extends CRM_Core_Form {
     asort($options);
 
     $this->assign('orderByOptions', $options);
+    $this->tabs[] = 'OrderBy.tpl';
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
 
     if (!empty($options)) {
       $options = array(
@@ -1278,6 +1317,9 @@ class CRM_Report_Form extends CRM_Core_Form {
     ))) {
       $this->addFormRule(array(get_class($this), 'formRule'), $this);
     }
+    // Note this assignment is only really required in buildForm. It is being 'over-called'
+    // to reduce risk of being missed due to overridden functions.
+    $this->assign('tabs', $this->tabs);
   }
 
   /**
index 4051bf24645bb515309b9ffac00e0333c0a0cbcf..7ebb5ad8f58e490e0decf7c81d3b71eb7a233555 100644 (file)
  +--------------------------------------------------------------------+
 *}
 {* Report form criteria section *}
-{if $colGroups}
-  <div id="report-tab-col-groups" class="civireport-criteria">
-    {foreach from=$colGroups item=grpFields key=dnc}
-      {assign  var="count" value="0"}
-      {* Wrap custom field sets in collapsed accordion pane. *}
-      {if $grpFields.group_title}
-        <div class="crm-accordion-wrapper crm-accordion collapsed">
-        <div class="crm-accordion-header">
-          {$grpFields.group_title}
-        </div><!-- /.crm-accordion-header -->
-        <div class="crm-accordion-body">
-      {/if}
-      <table class="criteria-group">
-        <tr class="crm-report crm-report-criteria-field crm-report-criteria-field-{$dnc}">
-          {foreach from=$grpFields.fields item=title key=field}
-          {assign var="count" value=`$count+1`}
-          <td width="25%">{$form.fields.$field.html}</td>
-          {if $count is div by 4}
-        </tr><tr class="crm-report crm-report-criteria-field crm-report-criteria-field_{$dnc}">
-          {/if}
-          {/foreach}
-          {if $count is not div by 4}
-            <td colspan="4 - ($count % 4)"></td>
-          {/if}
-        </tr>
-      </table>
-      {if $grpFields.group_title}
-        </div><!-- /.crm-accordion-body -->
-        </div><!-- /.crm-accordion-wrapper -->
-      {/if}
-    {/foreach}
-  </div>
-{/if}
 
-{if $groupByElements}
-  <div id="report-tab-group-by-elements" class="civireport-criteria">
-    {assign  var="count" value="0"}
-    <table class="report-layout">
-      <tr class="crm-report crm-report-criteria-groupby">
-        {foreach from=$groupByElements item=gbElem key=dnc}
-        {assign var="count" value=`$count+1`}
-        <td width="25%" {if $form.fields.$gbElem}"{/if}>
-        {$form.group_bys[$gbElem].html}
-        {if $form.group_bys_freq[$gbElem].html}:<br>
-          &nbsp;&nbsp;{$form.group_bys_freq[$gbElem].label}&nbsp;{$form.group_bys_freq[$gbElem].html}
-        {/if}
-        </td>
-        {if $count is div by 4}
-      </tr><tr class="crm-report crm-report-criteria-groupby">
-        {/if}
-        {/foreach}
-        {if $count is not div by 4}
-          <td colspan="4 - ($count % 4)"></td>
-        {/if}
-      </tr>
-    </table>
-  </div>
-{/if}
+{foreach from=$tabs item=tab}
+  $region = {"report-tab"|cat:$tab}
+  $fileName = {"Criteria/"|cat:$tab|cat:".tpl"}
+  {crmRegion name=$region}
+    {include file=$fileName}
+  {/crmRegion}
+{/foreach}
 
-{if $orderByOptions}
-  <div id="report-tab-order-by-elements" class="civireport-criteria">
-    <table id="optionField">
-      <tr>
-        <th>&nbsp;</th>
-        <th> {ts}Column{/ts}</th>
-        <th> {ts}Order{/ts}</th>
-        <th> {ts}Section Header / Group By{/ts}</th>
-        <th> {ts}Page Break{/ts}</th>
-      </tr>
-
-      {section name=rowLoop start=1 loop=6}
-        {assign var=index value=$smarty.section.rowLoop.index}
-        <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
-          <td>
-            {if $index GT 1}
-              <a onclick="hideRow({$index}); return false;" name="orderBy_{$index}" href="#" class="form-link"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}hide field or section{/ts}"/></a>
-            {/if}
-          </td>
-          <td> {$form.order_bys.$index.column.html}</td>
-          <td> {$form.order_bys.$index.order.html}</td>
-          <td> {$form.order_bys.$index.section.html}</td>
-          <td> {$form.order_bys.$index.pageBreak.html}</td>
-        </tr>
-      {/section}
-    </table>
-    <div id="optionFieldLink" class="add-remove-link">
-      <a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}show field or section{/ts}"/>{ts}another column{/ts}</a>
-    </div>
-    <script type="text/javascript">
-      var showRows   = new Array({$showBlocks});
-      var hideBlocks = new Array({$hideBlocks});
-      var rowcounter = 0;
-      {literal}
-      if (navigator.appName == "Microsoft Internet Explorer") {
-        for ( var count = 0; count < hideBlocks.length; count++ ) {
-          var r = document.getElementById(hideBlocks[count]);
-          r.style.display = 'none';
-        }
-      }
-
-      // hide and display the appropriate blocks as directed by the php code
-      on_load_init_blocks( showRows, hideBlocks, '');
-
-      cj('input[id^="order_by_section_"]').click(disPageBreak).each(disPageBreak);
-
-      function disPageBreak() {
-        if (!cj(this).prop('checked')) {
-          cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({checked: false, disabled: true});
-        }
-        else {
-          cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({disabled: false});
-        }
-      }
-
-      function hideRow(i) {
-        showHideRow(i);
-        // clear values on hidden field, so they're not saved
-        cj('select#order_by_column_'+ i).val('');
-        cj('select#order_by_order_'+ i).val('ASC');
-        cj('input#order_by_section_'+ i).prop('checked', false);
-        cj('input#order_by_pagebreak_'+ i).prop('checked', false);
-      }
-
-      {/literal}
-    </script>
-  </div>
-{/if}
-
-{if $otherOptions}
-  <div id="report-tab-other-options" class="civireport-criteria">
-    <table class="report-layout">
-      {assign var="optionCount" value=0}
-      <tr class="crm-report crm-report-criteria-field">
-        {foreach from=$otherOptions item=optionField key=optionName}
-        {assign var="optionCount" value=`$optionCount+1`}
-        <td>{if $form.$optionName.label}{$form.$optionName.label}&nbsp;{/if}{$form.$optionName.html}</td>
-        {if $optionCount is div by 2}
-      </tr><tr class="crm-report crm-report-criteria-field">
-        {/if}
-        {/foreach}
-        {if $optionCount is not div by 2}
-          <td colspan="2 - ($count % 2)"></td>
-        {/if}
-      </tr>
-    </table>
-  </div>
-{/if}
-
-{if $filters}
-<div id="report-tab-set-filters" class="civireport-criteria">
-  <table class="report-layout">
-    {assign var="counter" value=1}
-    {foreach from=$filters     item=table key=tableName}
-    {assign  var="filterCount" value=$table|@count}
-    {* Wrap custom field sets in collapsed accordion pane. *}
-    {if $colGroups.$tableName.group_title and $filterCount gte 1}
-    {* we should close table that contains other filter elements before we start building custom group accordian  *}
-    {if $counter eq 1}
-  </table>
-  {assign var="counter" value=0}
-  {/if}
-  <div class="crm-accordion-wrapper crm-accordion collapsed">
-    <div class="crm-accordion-header">
-      {$colGroups.$tableName.group_title}
-    </div><!-- /.crm-accordion-header -->
-    <div class="crm-accordion-body">
-      <table class="report-layout">
-        {/if}
-        {foreach from=$table       item=field key=fieldName}
-          {assign var=fieldOp     value=$fieldName|cat:"_op"}
-          {assign var=filterVal   value=$fieldName|cat:"_value"}
-          {assign var=filterMin   value=$fieldName|cat:"_min"}
-          {assign var=filterMax   value=$fieldName|cat:"_max"}
-          {if $field.operatorType & 4}
-            <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}">
-              <td class="label report-contents">{$field.title}</td>
-              {include file="CRM/Core/DateRange.tpl" fieldName=$fieldName from='_from' to='_to'}
-            </tr>
-          {elseif $form.$fieldOp.html}
-            <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if $field.no_display} style="display: none;"{/if}>
-              <td class="label report-contents">{$field.title}</td>
-              <td class="report-contents">{$form.$fieldOp.html}</td>
-              <td>
-                <span id="{$filterVal}_cell">{$form.$filterVal.label}&nbsp;{$form.$filterVal.html}</span>
-                <span id="{$filterMin}_max_cell">{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}&nbsp;&nbsp;{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}</span>
-              </td>
-            </tr>
-          {/if}
-        {/foreach}
-        {if $colGroups.$tableName.group_title}
-      </table>
-    </div><!-- /.crm-accordion-body -->
-  </div><!-- /.crm-accordion-wrapper -->
-  {assign var=closed     value=1"} {*-- ie table tags are closed-- *}
-                {else}
-                     {assign var=closed     value=0"} {*-- ie table tags are not closed-- *}
-                {/if}
-
-            {/foreach}
-            {if $closed eq 0 }</table>{/if}
-        </div>
-    {/if}
-
-    {literal}
+{literal}
   <script type="text/javascript">
-      {/literal}
-          {foreach from=$filters item=table key=tableName}
-              {foreach from=$table item=field key=fieldName}
-      {literal}var val = "dnc";{/literal}
-                {assign var=fieldOp     value=$fieldName|cat:"_op"}
-                {if !($field.operatorType & 4) && !$field.no_display && $form.$fieldOp.html}
-                    {literal}var val = document.getElementById("{/literal}{$fieldOp}{literal}").value;{/literal}
+{/literal}
+{foreach from=$filters item=table key=tableName}
+  {foreach from=$table item=field key=fieldName}
+    {literal}var val = "dnc";{/literal}
+    {assign var=fieldOp     value=$fieldName|cat:"_op"}
+    {if !($field.operatorType & 4) && !$field.no_display && $form.$fieldOp.html}
+      {literal}var val = document.getElementById("{/literal}{$fieldOp}{literal}").value;{/literal}
     {/if}
-                {literal}showHideMaxMinVal( "{/literal}{$fieldName}{literal}", val );{/literal}
-            {/foreach}
-        {/foreach}
+    {literal}showHideMaxMinVal( "{/literal}{$fieldName}{literal}", val );{/literal}
+  {/foreach}
+{/foreach}
 
-        {literal}
-    function showHideMaxMinVal( field, val ) {
-      var fldVal    = field + "_value_cell";
-      var fldMinMax = field + "_min_max_cell";
-      if ( val == "bw" || val == "nbw" ) {
-        cj('#' + fldVal ).hide();
-        cj('#' + fldMinMax ).show();
-      } else if (val =="nll" || val == "nnll") {
-        cj('#' + fldVal).hide() ;
-        cj('#' + field + '_value').val('');
-        cj('#' + fldMinMax ).hide();
-      } else {
-        cj('#' + fldVal ).show();
-        cj('#' + fldMinMax ).hide();
-      }
+{literal}
+  function showHideMaxMinVal( field, val ) {
+    var fldVal    = field + "_value_cell";
+    var fldMinMax = field + "_min_max_cell";
+    if ( val == "bw" || val == "nbw" ) {
+      cj('#' + fldVal ).hide();
+      cj('#' + fldMinMax ).show();
+    } else if (val =="nll" || val == "nnll") {
+      cj('#' + fldVal).hide() ;
+      cj('#' + field + '_value').val('');
+      cj('#' + fldMinMax ).hide();
+    } else {
+      cj('#' + fldVal ).show();
+      cj('#' + fldMinMax ).hide();
     }
+  }
 
-    CRM.$(function($) {
-      $('.crm-report-criteria-groupby input:checkbox').click(function() {
-        $('#fields_' + this.id.substr(10)).prop('checked', this.checked);
-      });
-      {/literal}{if $displayToggleGroupByFields}{literal}
+  CRM.$(function($) {
+    $('.crm-report-criteria-groupby input:checkbox').click(function() {
+      $('#fields_' + this.id.substr(10)).prop('checked', this.checked);
+    });
+    {/literal}{if $displayToggleGroupByFields}{literal}
       $('.crm-report-criteria-field input:checkbox').click(function() {
         $('#group_bys_' + this.id.substr(7)).prop('checked', this.checked);
       });
     });
   </script>
 {/literal}
-
diff --git a/templates/CRM/Report/Form/Criteria/FieldSelection.tpl b/templates/CRM/Report/Form/Criteria/FieldSelection.tpl
new file mode 100644 (file)
index 0000000..4775750
--- /dev/null
@@ -0,0 +1,57 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+
+  <div id="report-tab-col-groups" class="civireport-criteria">
+    {foreach from=$colGroups item=grpFields key=dnc}
+      {assign  var="count" value="0"}
+      {* Wrap custom field sets in collapsed accordion pane. *}
+      {if $grpFields.group_title}
+        <div class="crm-accordion-wrapper crm-accordion collapsed">
+        <div class="crm-accordion-header">
+          {$grpFields.group_title}
+        </div><!-- /.crm-accordion-header -->
+        <div class="crm-accordion-body">
+      {/if}
+      <table class="criteria-group">
+        <tr class="crm-report crm-report-criteria-field crm-report-criteria-field-{$dnc}">
+          {foreach from=$grpFields.fields item=title key=field}
+          {assign var="count" value=`$count+1`}
+          <td width="25%">{$form.fields.$field.html}</td>
+          {if $count is div by 4}
+        </tr><tr class="crm-report crm-report-criteria-field crm-report-criteria-field_{$dnc}">
+          {/if}
+          {/foreach}
+          {if $count is not div by 4}
+            <td colspan="4 - ($count % 4)"></td>
+          {/if}
+        </tr>
+      </table>
+      {if $grpFields.group_title}
+        </div><!-- /.crm-accordion-body -->
+        </div><!-- /.crm-accordion-wrapper -->
+      {/if}
+    {/foreach}
+  </div>
diff --git a/templates/CRM/Report/Form/Criteria/Filters.tpl b/templates/CRM/Report/Form/Criteria/Filters.tpl
new file mode 100644 (file)
index 0000000..2b99f1c
--- /dev/null
@@ -0,0 +1,78 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+
+  <div id="report-tab-set-filters" class="civireport-criteria">
+    <table class="report-layout">
+      {assign var="counter" value=1}
+      {foreach from=$filters item=table key=tableName}
+      {assign  var="filterCount" value=$table|@count}
+      {* Wrap custom field sets in collapsed accordion pane. *}
+      {if $colGroups.$tableName.group_title and $filterCount gte 1}
+      {* we should close table that contains other filter elements before we start building custom group accordian  *}
+      {if $counter eq 1}
+    </table>
+    {assign var="counter" value=0}
+    {/if}
+    <div class="crm-accordion-wrapper crm-accordion collapsed">
+      <div class="crm-accordion-header">
+        {$colGroups.$tableName.group_title}
+      </div><!-- /.crm-accordion-header -->
+      <div class="crm-accordion-body">
+        <table class="report-layout">
+          {/if}
+          {foreach from=$table       item=field key=fieldName}
+            {assign var=fieldOp     value=$fieldName|cat:"_op"}
+            {assign var=filterVal   value=$fieldName|cat:"_value"}
+            {assign var=filterMin   value=$fieldName|cat:"_min"}
+            {assign var=filterMax   value=$fieldName|cat:"_max"}
+            {if $field.operatorType & 4}
+              <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}">
+                <td class="label report-contents">{$field.title}</td>
+                {include file="CRM/Core/DateRange.tpl" fieldName=$fieldName from='_from' to='_to'}
+              </tr>
+            {elseif $form.$fieldOp.html}
+              <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if $field.no_display} style="display: none;"{/if}>
+                <td class="label report-contents">{$field.title}</td>
+                <td class="report-contents">{$form.$fieldOp.html}</td>
+                <td>
+                  <span id="{$filterVal}_cell">{$form.$filterVal.label}&nbsp;{$form.$filterVal.html}</span>
+                  <span id="{$filterMin}_max_cell">{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}&nbsp;&nbsp;{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}</span>
+                </td>
+              </tr>
+            {/if}
+          {/foreach}
+          {if $colGroups.$tableName.group_title}
+        </table>
+      </div><!-- /.crm-accordion-body -->
+    </div><!-- /.crm-accordion-wrapper -->
+    {assign var=closed value="1"} {*-- ie table tags are closed-- *}
+    {else}
+    {assign var=closed     value="0"} {*-- ie table tags are not closed-- *}
+    {/if}
+
+    {/foreach}
+    {if $closed eq 0 }</table>{/if}
+  </div>
diff --git a/templates/CRM/Report/Form/Criteria/GroupBy.tpl b/templates/CRM/Report/Form/Criteria/GroupBy.tpl
new file mode 100644 (file)
index 0000000..e247e29
--- /dev/null
@@ -0,0 +1,47 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+  <div id="report-tab-group-by-elements" class="civireport-criteria">
+    {assign  var="count" value="0"}
+    <table class="report-layout">
+      <tr class="crm-report crm-report-criteria-groupby">
+        {foreach from=$groupByElements item=gbElem key=dnc}
+        {assign var="count" value=`$count+1`}
+        <td width="25%" {if $form.fields.$gbElem}"{/if}>
+        {$form.group_bys[$gbElem].html}
+        {if $form.group_bys_freq[$gbElem].html}:<br>
+          &nbsp;&nbsp;{$form.group_bys_freq[$gbElem].label}&nbsp;{$form.group_bys_freq[$gbElem].html}
+        {/if}
+        </td>
+        {if $count is div by 4}
+      </tr><tr class="crm-report crm-report-criteria-groupby">
+        {/if}
+        {/foreach}
+        {if $count is not div by 4}
+          <td colspan="4 - ($count % 4)"></td>
+        {/if}
+      </tr>
+    </table>
+  </div>
diff --git a/templates/CRM/Report/Form/Criteria/OrderBy.tpl b/templates/CRM/Report/Form/Criteria/OrderBy.tpl
new file mode 100644 (file)
index 0000000..3be45c1
--- /dev/null
@@ -0,0 +1,93 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+
+
+  <div id="report-tab-order-by-elements" class="civireport-criteria">
+    <table id="optionField">
+      <tr>
+        <th>&nbsp;</th>
+        <th> {ts}Column{/ts}</th>
+        <th> {ts}Order{/ts}</th>
+        <th> {ts}Section Header / Group By{/ts}</th>
+        <th> {ts}Page Break{/ts}</th>
+      </tr>
+
+      {section name=rowLoop start=1 loop=6}
+        {assign var=index value=$smarty.section.rowLoop.index}
+        <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
+          <td>
+            {if $index GT 1}
+              <a onclick="hideRow({$index}); return false;" name="orderBy_{$index}" href="#" class="form-link"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}hide field or section{/ts}"/></a>
+            {/if}
+          </td>
+          <td> {$form.order_bys.$index.column.html}</td>
+          <td> {$form.order_bys.$index.order.html}</td>
+          <td> {$form.order_bys.$index.section.html}</td>
+          <td> {$form.order_bys.$index.pageBreak.html}</td>
+        </tr>
+      {/section}
+    </table>
+    <div id="optionFieldLink" class="add-remove-link">
+      <a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}show field or section{/ts}"/>{ts}another column{/ts}</a>
+    </div>
+    <script type="text/javascript">
+      var showRows   = new Array({$showBlocks});
+      var hideBlocks = new Array({$hideBlocks});
+      var rowcounter = 0;
+      {literal}
+      if (navigator.appName == "Microsoft Internet Explorer") {
+        for ( var count = 0; count < hideBlocks.length; count++ ) {
+          var r = document.getElementById(hideBlocks[count]);
+          r.style.display = 'none';
+        }
+      }
+
+      // hide and display the appropriate blocks as directed by the php code
+      on_load_init_blocks( showRows, hideBlocks, '');
+
+      cj('input[id^="order_by_section_"]').click(disPageBreak).each(disPageBreak);
+
+      function disPageBreak() {
+        if (!cj(this).prop('checked')) {
+          cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({checked: false, disabled: true});
+        }
+        else {
+          cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({disabled: false});
+        }
+      }
+
+      function hideRow(i) {
+        showHideRow(i);
+        // clear values on hidden field, so they're not saved
+        cj('select#order_by_column_'+ i).val('');
+        cj('select#order_by_order_'+ i).val('ASC');
+        cj('input#order_by_section_'+ i).prop('checked', false);
+        cj('input#order_by_pagebreak_'+ i).prop('checked', false);
+      }
+
+      {/literal}
+    </script>
+  </div>
diff --git a/templates/CRM/Report/Form/Criteria/ReportOptions.tpl b/templates/CRM/Report/Form/Criteria/ReportOptions.tpl
new file mode 100644 (file)
index 0000000..1f7cdd5
--- /dev/null
@@ -0,0 +1,44 @@
+{*
++--------------------------------------------------------------------+
+| CiviCRM version 4.6                                                |
++--------------------------------------------------------------------+
+| Copyright CiviCRM LLC (c) 2004-2014                                |
++--------------------------------------------------------------------+
+| This file is a part of CiviCRM.                                    |
+|                                                                    |
+| CiviCRM is free software; you can copy, modify, and distribute it  |
+| under the terms of the GNU Affero General Public License           |
+| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+|                                                                    |
+| CiviCRM is distributed in the hope that it will be useful, but     |
+| WITHOUT ANY WARRANTY; without even the implied warranty of         |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+| See the GNU Affero General Public License for more details.        |
+|                                                                    |
+| You should have received a copy of the GNU Affero General Public   |
+| License and the CiviCRM Licensing Exception along                  |
+| with this program; if not, contact CiviCRM LLC                     |
+| at info[AT]civicrm[DOT]org. If you have questions about the        |
+| GNU Affero General Public License or the licensing of CiviCRM,     |
+| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
++--------------------------------------------------------------------+
+*}
+{if $otherOptions}
+  <div id="report-tab-other-options" class="civireport-criteria">
+    <table class="report-layout">
+      {assign var="optionCount" value=0}
+      <tr class="crm-report crm-report-criteria-field">
+        {foreach from=$otherOptions item=optionField key=optionName}
+        {assign var="optionCount" value=`$optionCount+1`}
+        <td>{if $form.$optionName.label}{$form.$optionName.label}&nbsp;{/if}{$form.$optionName.html}</td>
+        {if $optionCount is div by 2}
+      </tr><tr class="crm-report crm-report-criteria-field">
+        {/if}
+        {/foreach}
+        {if $optionCount is not div by 2}
+          <td colspan="2 - ($count % 2)"></td>
+        {/if}
+      </tr>
+    </table>
+  </div>
+{/if}