Saved reports (templates) are now just called "reports".
This commit is contained in:
parent
c81ebc4d94
commit
d5fe23418e
@ -398,43 +398,7 @@ display:
|
|||||||
footer: { }
|
footer: { }
|
||||||
empty: { }
|
empty: { }
|
||||||
relationships: { }
|
relationships: { }
|
||||||
arguments:
|
arguments: { }
|
||||||
'null':
|
|
||||||
id: 'null'
|
|
||||||
table: views
|
|
||||||
field: 'null'
|
|
||||||
relationship: none
|
|
||||||
group_type: group
|
|
||||||
admin_label: ''
|
|
||||||
default_action: default
|
|
||||||
exception:
|
|
||||||
value: all
|
|
||||||
title_enable: false
|
|
||||||
title: All
|
|
||||||
title_enable: true
|
|
||||||
title: '{{ raw_arguments.null }}'
|
|
||||||
default_argument_type: query_parameter
|
|
||||||
default_argument_options:
|
|
||||||
query_param: preset_title
|
|
||||||
fallback: 'New actor report'
|
|
||||||
multiple: and
|
|
||||||
default_argument_skip_url: false
|
|
||||||
summary_options:
|
|
||||||
base_path: ''
|
|
||||||
count: true
|
|
||||||
items_per_page: 25
|
|
||||||
override: false
|
|
||||||
summary:
|
|
||||||
sort_order: asc
|
|
||||||
number_of_records: 0
|
|
||||||
format: default_summary
|
|
||||||
specify_validation: false
|
|
||||||
validate:
|
|
||||||
type: none
|
|
||||||
fail: 'not found'
|
|
||||||
validate_options: { }
|
|
||||||
must_not_be: false
|
|
||||||
plugin_id: 'null'
|
|
||||||
display_extenders: { }
|
display_extenders: { }
|
||||||
use_ajax: true
|
use_ajax: true
|
||||||
cache_metadata:
|
cache_metadata:
|
||||||
@ -442,7 +406,6 @@ display:
|
|||||||
contexts:
|
contexts:
|
||||||
- 'languages:language_content'
|
- 'languages:language_content'
|
||||||
- 'languages:language_interface'
|
- 'languages:language_interface'
|
||||||
- url
|
|
||||||
- url.query_args
|
- url.query_args
|
||||||
- user.permissions
|
- user.permissions
|
||||||
tags: { }
|
tags: { }
|
||||||
@ -491,43 +454,7 @@ display:
|
|||||||
type: none
|
type: none
|
||||||
options:
|
options:
|
||||||
offset: 0
|
offset: 0
|
||||||
arguments:
|
arguments: { }
|
||||||
'null':
|
|
||||||
id: 'null'
|
|
||||||
table: views
|
|
||||||
field: 'null'
|
|
||||||
relationship: none
|
|
||||||
group_type: group
|
|
||||||
admin_label: ''
|
|
||||||
default_action: default
|
|
||||||
exception:
|
|
||||||
value: all
|
|
||||||
title_enable: false
|
|
||||||
title: All
|
|
||||||
title_enable: true
|
|
||||||
title: '{{ raw_arguments.null }}'
|
|
||||||
default_argument_type: query_parameter
|
|
||||||
default_argument_options:
|
|
||||||
query_param: preset_title
|
|
||||||
fallback: 'Untitled actor report'
|
|
||||||
multiple: and
|
|
||||||
default_argument_skip_url: false
|
|
||||||
summary_options:
|
|
||||||
base_path: ''
|
|
||||||
count: true
|
|
||||||
items_per_page: 25
|
|
||||||
override: false
|
|
||||||
summary:
|
|
||||||
sort_order: asc
|
|
||||||
number_of_records: 0
|
|
||||||
format: default_summary
|
|
||||||
specify_validation: false
|
|
||||||
validate:
|
|
||||||
type: none
|
|
||||||
fail: 'not found'
|
|
||||||
validate_options: { }
|
|
||||||
must_not_be: false
|
|
||||||
plugin_id: 'null'
|
|
||||||
auth:
|
auth:
|
||||||
- cookie
|
- cookie
|
||||||
cache_metadata:
|
cache_metadata:
|
||||||
@ -536,7 +463,6 @@ display:
|
|||||||
- 'languages:language_content'
|
- 'languages:language_content'
|
||||||
- 'languages:language_interface'
|
- 'languages:language_interface'
|
||||||
- request_format
|
- request_format
|
||||||
- url
|
|
||||||
- user.permissions
|
- user.permissions
|
||||||
tags: { }
|
tags: { }
|
||||||
page_1:
|
page_1:
|
||||||
@ -556,7 +482,6 @@ display:
|
|||||||
contexts:
|
contexts:
|
||||||
- 'languages:language_content'
|
- 'languages:language_content'
|
||||||
- 'languages:language_interface'
|
- 'languages:language_interface'
|
||||||
- url
|
|
||||||
- url.query_args
|
- url.query_args
|
||||||
- user.permissions
|
- user.permissions
|
||||||
tags: { }
|
tags: { }
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
opencase_reporting.opencase_report.*:
|
||||||
|
type: config_entity
|
||||||
|
label: 'OpenCase Report config'
|
||||||
|
mapping:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
label: 'ID'
|
||||||
|
label:
|
||||||
|
type: label
|
||||||
|
label: 'Label'
|
||||||
|
uuid:
|
||||||
|
type: string
|
@ -0,0 +1,6 @@
|
|||||||
|
entity.opencase_report.add_form:
|
||||||
|
route_name: entity.opencase_report.add_form
|
||||||
|
title: 'Add OpenCase Report'
|
||||||
|
appears_on:
|
||||||
|
- entity.opencase_report.collection
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
opencase_reporting.reporting:
|
opencase_reporting.reporting:
|
||||||
title: 'Reporting'
|
title: 'Reporting'
|
||||||
menu_name: main
|
menu_name: main
|
||||||
url: internal:/opencase/reporting/actors
|
url: internal:/opencase/reporting
|
||||||
weight: 1
|
weight: 1
|
||||||
|
|
||||||
# Preset menu items definition
|
# OpenCase Report menu items definition
|
||||||
entity.preset.collection:
|
entity.opencase_report.collection:
|
||||||
title: 'Preset'
|
title: 'OpenCase Reports'
|
||||||
route_name: entity.preset.collection
|
route_name: entity.opencase_report.collection
|
||||||
description: 'List Preset (bundles)'
|
description: 'List OpenCase Reports'
|
||||||
parent: system.admin_structure
|
parent: system.admin_structure
|
||||||
weight: 99
|
weight: 99
|
||||||
|
|
||||||
|
@ -23,18 +23,6 @@ function opencase_reporting_help($route_name, RouteMatchInterface $route_match)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements hook_theme().
|
|
||||||
*/
|
|
||||||
function opencase_reporting_theme() {
|
|
||||||
return array(
|
|
||||||
'opencase_reporting_presets' => array(
|
|
||||||
'variables' => array('presets' => array()),
|
|
||||||
'template' => 'block--opencase-reporting-presets',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_page_attachments
|
* Implements hook_page_attachments
|
||||||
*
|
*
|
||||||
|
57
modules/opencase_reporting/src/Entity/OpenCaseReport.php
Normal file
57
modules/opencase_reporting/src/Entity/OpenCaseReport.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting\Entity;
|
||||||
|
|
||||||
|
use Drupal\Core\Config\Entity\ConfigEntityBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the OpenCase Report entity.
|
||||||
|
*
|
||||||
|
* @ConfigEntityType(
|
||||||
|
* id = "opencase_report",
|
||||||
|
* label = @Translation("OpenCase Report"),
|
||||||
|
* handlers = {
|
||||||
|
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||||
|
* "list_builder" = "Drupal\opencase_reporting\OpenCaseReportListBuilder",
|
||||||
|
* "form" = {
|
||||||
|
* "add" = "Drupal\opencase_reporting\Form\OpenCaseReportForm",
|
||||||
|
* "edit" = "Drupal\opencase_reporting\Form\OpenCaseReportForm",
|
||||||
|
* "delete" = "Drupal\opencase_reporting\Form\OpenCaseReportDeleteForm"
|
||||||
|
* },
|
||||||
|
* "route_provider" = {
|
||||||
|
* "html" = "Drupal\opencase_reporting\OpenCaseReportHtmlRouteProvider",
|
||||||
|
* },
|
||||||
|
* },
|
||||||
|
* config_prefix = "opencase_report",
|
||||||
|
* admin_permission = "administer site configuration",
|
||||||
|
* entity_keys = {
|
||||||
|
* "id" = "id",
|
||||||
|
* "label" = "label",
|
||||||
|
* "uuid" = "uuid"
|
||||||
|
* },
|
||||||
|
* links = {
|
||||||
|
* "canonical" = "/opencase/reporting/opencase_report/{opencase_report}",
|
||||||
|
* "add-form" = "/opencase/reporting/opencase_report/add",
|
||||||
|
* "edit-form" = "/opencase/reporting/opencase_report/{opencase_report}/edit",
|
||||||
|
* "delete-form" = "/opencase/reporting/opencase_report/{opencase_report}/delete",
|
||||||
|
* "collection" = "/opencase/reporting/opencase_report"
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
class OpenCaseReport extends ConfigEntityBase implements OpenCaseReportInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OpenCase Report ID.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OpenCase Report label.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $label;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting\Entity;
|
||||||
|
|
||||||
|
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an interface for defining OpenCase Report entities.
|
||||||
|
*/
|
||||||
|
interface OpenCaseReportInterface extends ConfigEntityInterface {
|
||||||
|
|
||||||
|
// Add get/set methods for your configuration properties here.
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting\Form;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||||
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
use Drupal\Core\Url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the form to delete OpenCase Report entities.
|
||||||
|
*/
|
||||||
|
class OpenCaseReportDeleteForm extends EntityConfirmFormBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getQuestion() {
|
||||||
|
return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getCancelUrl() {
|
||||||
|
return new Url('entity.opencase_report.collection');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfirmText() {
|
||||||
|
return $this->t('Delete');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||||
|
$this->entity->delete();
|
||||||
|
|
||||||
|
drupal_set_message(
|
||||||
|
$this->t('content @type: deleted @label.',
|
||||||
|
[
|
||||||
|
'@type' => $this->entity->bundle(),
|
||||||
|
'@label' => $this->entity->label(),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$form_state->setRedirectUrl($this->getCancelUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
65
modules/opencase_reporting/src/Form/OpenCaseReportForm.php
Normal file
65
modules/opencase_reporting/src/Form/OpenCaseReportForm.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting\Form;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityForm;
|
||||||
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OpenCaseReportForm.
|
||||||
|
*/
|
||||||
|
class OpenCaseReportForm extends EntityForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function form(array $form, FormStateInterface $form_state) {
|
||||||
|
$form = parent::form($form, $form_state);
|
||||||
|
|
||||||
|
$opencase_report = $this->entity;
|
||||||
|
$form['label'] = [
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => $this->t('Label'),
|
||||||
|
'#maxlength' => 255,
|
||||||
|
'#default_value' => $opencase_report->label(),
|
||||||
|
'#description' => $this->t("Label for the OpenCase Report."),
|
||||||
|
'#required' => TRUE,
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['id'] = [
|
||||||
|
'#type' => 'machine_name',
|
||||||
|
'#default_value' => $opencase_report->id(),
|
||||||
|
'#machine_name' => [
|
||||||
|
'exists' => '\Drupal\opencase_reporting\Entity\OpenCaseReport::load',
|
||||||
|
],
|
||||||
|
'#disabled' => !$opencase_report->isNew(),
|
||||||
|
];
|
||||||
|
|
||||||
|
/* You will need additional form elements for your custom properties. */
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function save(array $form, FormStateInterface $form_state) {
|
||||||
|
$opencase_report = $this->entity;
|
||||||
|
$status = $opencase_report->save();
|
||||||
|
|
||||||
|
switch ($status) {
|
||||||
|
case SAVED_NEW:
|
||||||
|
drupal_set_message($this->t('Created the %label OpenCase Report.', [
|
||||||
|
'%label' => $opencase_report->label(),
|
||||||
|
]));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
drupal_set_message($this->t('Saved the %label OpenCase Report.', [
|
||||||
|
'%label' => $opencase_report->label(),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
$form_state->setRedirectUrl($opencase_report->toUrl('collection'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting;
|
||||||
|
|
||||||
|
use Drupal\Core\Entity\EntityTypeInterface;
|
||||||
|
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||||
|
use Symfony\Component\Routing\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides routes for OpenCase Report entities.
|
||||||
|
*
|
||||||
|
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||||
|
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||||
|
*/
|
||||||
|
class OpenCaseReportHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getRoutes(EntityTypeInterface $entity_type) {
|
||||||
|
$collection = parent::getRoutes($entity_type);
|
||||||
|
|
||||||
|
// Provide your custom entity routes here.
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
modules/opencase_reporting/src/OpenCaseReportListBuilder.php
Normal file
32
modules/opencase_reporting/src/OpenCaseReportListBuilder.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase_reporting;
|
||||||
|
|
||||||
|
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||||
|
use Drupal\Core\Entity\EntityInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a listing of OpenCase Report entities.
|
||||||
|
*/
|
||||||
|
class OpenCaseReportListBuilder extends ConfigEntityListBuilder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildHeader() {
|
||||||
|
$header['label'] = $this->t('OpenCase Report');
|
||||||
|
$header['id'] = $this->t('Machine name');
|
||||||
|
return $header + parent::buildHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildRow(EntityInterface $entity) {
|
||||||
|
$row['label'] = $entity->label();
|
||||||
|
$row['id'] = $entity->id();
|
||||||
|
// You probably want a few more properties here...
|
||||||
|
return $row + parent::buildRow($entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Drupal\opencase_reporting\Plugin\Block;
|
|
||||||
|
|
||||||
use Drupal\opencase\EntityTypeRelations;
|
|
||||||
use Drupal\Core\Block\BlockBase;
|
|
||||||
use Drupal\Core\Link;
|
|
||||||
use Drupal\Core\Url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a block for loading, saving and creating report presets.
|
|
||||||
*
|
|
||||||
* @Block(
|
|
||||||
* id = "opencase_reporting_presets",
|
|
||||||
* admin_label = @Translation("OpenCase Reporting Presets"),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
class Presets extends BlockBase {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function build() {
|
|
||||||
return array(
|
|
||||||
'#presets' => array(array('title'=>'me and you', 'basis'=>'actors', 'filter'=>'&f%5B0%5D=actor_type%3Afat&f%5B1%5D=created%3A2018-09'), array('title'=>'them', 'basis'=>'actors')),
|
|
||||||
'#theme' => 'opencase_reporting_presets'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
<div id="opencase_reporting_buttons">
|
|
||||||
<button id="update-preset">Update template</button>
|
|
||||||
<button id="save-as-new-preset">Save as new template</button>
|
|
||||||
<button id="download-data">Download data</button>
|
|
||||||
</div>
|
|
Reference in New Issue
Block a user