Commit 1a0c9eac authored by jaapjansma's avatar jaapjansma
Browse files

added a no result text to the outputs

parent 06849e48
......@@ -15,6 +15,7 @@
* Added current user to contact filter.
* Added data source for permissioned contact (#25).
* Fixed issue with configuration contact source sub type filter.
* Added a no result text to the outputs.
# Version 1.3.0
......
......@@ -55,6 +55,8 @@ class CRM_Contact_DataProcessorContactSearch implements UIFormOutputInterface {
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -75,6 +77,11 @@ class CRM_Contact_DataProcessorContactSearch implements UIFormOutputInterface {
if (isset($output['configuration']['contact_id_field'])) {
$defaults['contact_id_field'] = $output['configuration']['contact_id_field'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['navigation_id'])) {
$defaults['navigation_parent_path'] = $navigation->getNavigationParentPathById($output['configuration']['navigation_id']);
}
......@@ -121,6 +128,7 @@ class CRM_Contact_DataProcessorContactSearch implements UIFormOutputInterface {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['help_text'] = $submittedValues['help_text'];
......
......@@ -41,6 +41,7 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\UIOu
$form->add('text', 'default_limit', E::ts('Default Limit'));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this dashlet'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
......@@ -58,6 +59,11 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\UIOu
if (isset($output['configuration']['default_limit'])) {
$defaults['default_limit'] = $output['configuration']['default_limit'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -123,6 +129,7 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\UIOu
$output['permission'] = $submittedValues['permission'];
$configuration['default_limit'] = $submittedValues['default_limit'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
......
......@@ -56,6 +56,7 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIFormOutputInterface {
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -84,6 +85,11 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIFormOutputInterface {
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -121,6 +127,7 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIFormOutputInterface {
$configuration['activity_id_field'] = $submittedValues['activity_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
......
......@@ -61,6 +61,7 @@ class CRM_DataprocessorSearch_CaseSearch implements UIFormOutputInterface {
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -95,6 +96,11 @@ class CRM_DataprocessorSearch_CaseSearch implements UIFormOutputInterface {
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['expanded_search'])) {
$defaults['expanded_search'] = $output['configuration']['expanded_search'];
}
......@@ -128,6 +134,7 @@ class CRM_DataprocessorSearch_CaseSearch implements UIFormOutputInterface {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['case_id_field'] = $submittedValues['case_id_field'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_fields'] = $submittedValues['hide_id_fields'];
......
......@@ -57,6 +57,7 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIFormOutputInterfac
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -79,6 +80,11 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIFormOutputInterfac
if (isset($output['configuration']['navigation_id'])) {
$defaults['navigation_parent_path'] = $navigation->getNavigationParentPathById($output['configuration']['navigation_id']);
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
......@@ -123,6 +129,7 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIFormOutputInterfac
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -117,6 +117,18 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
return $hiddenFields;
}
/**
* Retrieve the text for no results.
*
* @return string
*/
protected function getNoResultText() {
if (isset($this->dataProcessorOutput['configuration']['no_result_text'])) {
return $this->dataProcessorOutput['configuration']['no_result_text'];
}
return E::ts('No results');
}
/**
* Returns the url for view of the record action
*
......@@ -345,6 +357,7 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
$this->addElement('checkbox', 'toggleSelect', NULL, NULL, ['class' => 'select-rows']);
$this->assign('rows', $rows);
$this->assign('no_result_text', $this->getNoResultText());
$this->assign('debug_info', $this->dataProcessorClass->getDataFlow()->getDebugInformation());
if ($this->usePrevNextCache()) {
$cacheKey = "civicrm search {$this->controller->_key}";
......
......@@ -57,6 +57,7 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIFormOutputInterface
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -76,6 +77,11 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIFormOutputInterface
if (isset($output['configuration']['membership_id_field'])) {
$defaults['membership_id_field'] = $output['configuration']['membership_id_field'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['navigation_id'])) {
$defaults['navigation_parent_path'] = $navigation->getNavigationParentPathById($output['configuration']['navigation_id']);
}
......@@ -122,6 +128,7 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIFormOutputInterface
$configuration['membership_id_field'] = $submittedValues['membership_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
......
......@@ -57,6 +57,7 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIFormOutputInterface
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
// navigation field
......@@ -82,6 +83,11 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIFormOutputInterface
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
......@@ -120,6 +126,7 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIFormOutputInterface
public function processConfiguration($submittedValues, &$output) {
$output['permission'] = $submittedValues['permission'];
$configuration['participant_id_field'] = $submittedValues['participant_id_field'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
......
......@@ -57,6 +57,7 @@ class CRM_DataprocessorSearch_Search implements UIFormOutputInterface {
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
$form->add('checkbox', 'expose_aggregate', E::ts('Expose aggregate options'));
......@@ -77,6 +78,11 @@ class CRM_DataprocessorSearch_Search implements UIFormOutputInterface {
if (isset($output['configuration']['id_field'])) {
$defaults['id_field'] = $output['configuration']['id_field'];
}
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['navigation_id'])) {
$defaults['navigation_parent_path'] = $navigation->getNavigationParentPathById($output['configuration']['navigation_id']);
}
......@@ -124,6 +130,7 @@ class CRM_DataprocessorSearch_Search implements UIFormOutputInterface {
$output['permission'] = $submittedValues['permission'];
$configuration['id_field'] = $submittedValues['id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
......
......@@ -70,4 +70,10 @@
</div>
{include file="CRM/DataprocessorSearch/Form/ResultsJavascript.tpl"}
{elseif isset($no_result_text)}
<div class="crm-content-block">
<div class="crm-results-block">
{$no_result_text}
</div>
</div>
{/if}
......@@ -34,5 +34,10 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
{crmScope extensionKey='dataprocessor'}
<div class="crm-section">
<div class="label">{$form.permission.label}</div>
<div class="content">{$form.permission.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.permission.label}</div>
<div class="content">{$form.permission.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.default_limit.label}</div>
......
......@@ -34,4 +34,9 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
......@@ -39,4 +39,9 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
......@@ -34,4 +34,9 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
......@@ -34,4 +34,9 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
......@@ -34,4 +34,9 @@
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
......@@ -34,9 +34,14 @@
<div class="content">{$form.expose_aggregate.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
<div class="content">{$form.help_text.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
<div class="clear"></div>
</div>
{/crmScope}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment