Compare commits
306 Commits
Author | SHA1 | Date | |
---|---|---|---|
0fe7bac594 | |||
8d345ce1f3 | |||
06b2409c61 | |||
99e57d9747 | |||
1d257538fe | |||
34a2d9e23b | |||
bc98ecb541 | |||
0f0281c58c | |||
c65012315d | |||
715f5f34c4 | |||
403965fe6f | |||
eec5b876a3 | |||
077455b4d3 | |||
7a995060ce | |||
9646e216aa | |||
5afbeb956b | |||
2895dcdab8 | |||
3dd71bf2c0 | |||
6fbaf433e8 | |||
4639ff7ffd | |||
4285e1952f | |||
eee7604440 | |||
0399c83646 | |||
2bc1abc7a7 | |||
06937b7443 | |||
6d281625b7 | |||
208240badc | |||
c479e3b995 | |||
517938ab7b | |||
b48ba012cb | |||
53648faff7 | |||
a993e09bc6 | |||
3aa4fbc5cf | |||
0caf2cb7c8 | |||
e49ad3fc9c | |||
146eb2b8ba | |||
360fe56a6d | |||
91cc94d3d7 | |||
2b9cd117ba | |||
36eb9d9667 | |||
d026173c8f | |||
7ecdfbf3e6 | |||
113ff6361b | |||
ca1a0eda29 | |||
dfb12d9be6 | |||
ea71314345 | |||
31be127d30 | |||
7c5ee54a44 | |||
21528a436e | |||
ffb99bcac6 | |||
a7f0e8fb02 | |||
eb405674dc | |||
342459daa3 | |||
cde0bbc7e6 | |||
aff262a535 | |||
0d927126a2 | |||
2f485f19c5 | |||
8b07bbe63f | |||
690ec3b509 | |||
7a9b95bf0d | |||
675a85dfb6 | |||
17f8ddba2e | |||
27cb58512e | |||
df2c826a33 | |||
6f33d59842 | |||
e37a41de2b | |||
c47df855bc | |||
af3b4727f1 | |||
011029d3b3 | |||
9af1d58de8 | |||
6d93242fa9 | |||
c9a843a35f | |||
c46bbc6ffd | |||
5d1844304a | |||
be45fd2d42 | |||
18a0846348 | |||
18e32335f5 | |||
b83f0b44b4 | |||
7f88d409f0 | |||
8841fd4d25 | |||
87241c1f87 | |||
2a1607c6d9 | |||
d8fd12a7b9 | |||
e4a04a254d | |||
88b5ce3d2e | |||
ae3976c7b8 | |||
f47ded38fa | |||
c63cae6b71 | |||
a7a96ab03c | |||
a6db6615df | |||
1c3370a784 | |||
59f4987371 | |||
c1e24593fa | |||
c98f028045 | |||
873f751795 | |||
6b9ff3a5e7 | |||
b24ba377d2 | |||
33168ecb62 | |||
3eacbc952f | |||
47ea8493ce | |||
eb6cfb89dd | |||
94e2635ee1 | |||
fa7516b03a | |||
bfa4f27cf7 | |||
36aff5564e | |||
e0260256fa | |||
fd47bee26a | |||
150cc6cfd1 | |||
44c948d22a | |||
99733415c8 | |||
5e127358b2 | |||
9a937e2d46 | |||
e45cbb6a76 | |||
ca04c3e259 | |||
658ba667b1 | |||
309a31e012 | |||
8ccd0313a7 | |||
ab2662195b | |||
b81d6b5f31 | |||
ad6811b5e9 | |||
da0c0ff1b5 | |||
3e6011a359 | |||
7e28f88b86 | |||
0efab1af06 | |||
4b14537dc4 | |||
52eb5898e3 | |||
acf3e704cc | |||
142c22f8e2 | |||
570d442d41 | |||
981439d3c6 | |||
0333e20afd | |||
ec25af3858 | |||
30a4d13081 | |||
904cf2d63c | |||
78a44718fb | |||
7c30d9d02e | |||
fdd07ea104 | |||
10b99f132e | |||
fd5d145866 | |||
530df37e92 | |||
7fd551982d | |||
0aa6b92490 | |||
b62f2f34a9 | |||
8187f6b306 | |||
56be669fe9 | |||
5cde32c975 | |||
bfef673d42 | |||
9f735eb492 | |||
a8c454c509 | |||
9424aca1e9 | |||
b5f718647e | |||
7e1889346b | |||
1e0a6a41d3 | |||
e14a68ef62 | |||
c48f58d49b | |||
7a61f76a93 | |||
354bb0adba | |||
e02721217b | |||
d5fe23418e | |||
c81ebc4d94 | |||
7fbc35915c | |||
987adc97ce | |||
3faabda3f2 | |||
eb6356f715 | |||
92cec4c513 | |||
e5db0007c9 | |||
cc108076bb | |||
714ceeb3d0 | |||
0371c37786 | |||
e1e40bc8ad | |||
9b9bce4bc4 | |||
1d86b2a5bc | |||
ee5c82cb0b | |||
20b3ff0cd4 | |||
393ce2501c | |||
2be2cc7837 | |||
e45d49e299 | |||
51db7f00d4 | |||
e5da065d0c | |||
14575008d6 | |||
8e43ad637d | |||
d5e767ea9f | |||
f97c43bbb2 | |||
ac92336b0e | |||
bc77e1995d | |||
fd661f6a2f | |||
679f40c16d | |||
ebd755d86c | |||
c507fb29b7 | |||
af0040479e | |||
3198c00f5a | |||
2e40dc46f2 | |||
7a21352ac4 | |||
8b274c0d6c | |||
775a08319c | |||
352ea000f0 | |||
ec99009f16 | |||
d2bd27c960 | |||
b5f567f872 | |||
221d16c7fa | |||
6b3b744900 | |||
1c0195a632 | |||
a47a06aef3 | |||
33feac1977 | |||
ddab3e450a | |||
e588a70a1b | |||
c0c415e691 | |||
6c384605ec | |||
09650469bf | |||
48dabf1701 | |||
08fe6dc362 | |||
3f01a3ad41 | |||
d589ef8d69 | |||
a267e222b8 | |||
910350699d | |||
c729750705 | |||
351bdb5afd | |||
2a31b1c8ce | |||
667b109de8 | |||
92d4f74ad7 | |||
487415c679 | |||
7bf0f67a06 | |||
8dc840a53d | |||
288751274b | |||
aa130aeede | |||
f373ac419e | |||
b1d5c4eddf | |||
6c6c6d5c92 | |||
73e7ff2656 | |||
8dd56d5b51 | |||
d229e02f67 | |||
7ef0628bd6 | |||
5863fb7faa | |||
36939720fe | |||
7e04836ff1 | |||
b28c7a3f5d | |||
5688f89857 | |||
cf0078d1be | |||
f4c3512501 | |||
4c7cd2067b | |||
a0ab7282b8 | |||
12afa00df8 | |||
1878d1e2fd | |||
050bee1a9b | |||
d46142ee2b | |||
fd1a0d5156 | |||
e601fde1ef | |||
74b6f90c94 | |||
e10096c1ca | |||
8941cdfb49 | |||
9715401dfc | |||
7448048f2d | |||
48e5080a9c | |||
cba43a04e5 | |||
ce1d3ca38b | |||
8294a9647f | |||
c261552cc1 | |||
2708b0193d | |||
5e6f1e01c4 | |||
54c3895eb0 | |||
20ab150226 | |||
c31706467a | |||
57a797ba6d | |||
85260daa0e | |||
f2e7e8b6be | |||
b8e49fb9cb | |||
98d856303a | |||
d8aaacec2d | |||
e2f77bf301 | |||
83264f93b2 | |||
eae1a2b03d | |||
53507dae33 | |||
b8bba0b332 | |||
7dba72ef66 | |||
1eb54e69e5 | |||
c151f84692 | |||
80f42c7bf3 | |||
555087f3b2 | |||
f770659cef | |||
1786fce0e8 | |||
a43aa0dc08 | |||
588b159dbd | |||
c28e048db0 | |||
7dc3e5d563 | |||
18d0303f54 | |||
c1c981fddd | |||
c909a51c1c | |||
abd6ee896b | |||
0c9377f48e | |||
b89cfcc2ee | |||
7cf4ee557b | |||
59964e653e | |||
3b7e8c9cbe | |||
fc1ae79562 | |||
fc982f8376 | |||
9d8c6a34d9 | |||
469f2413ec | |||
900ba263c7 | |||
76f61b16b7 | |||
4b7f983b27 | |||
249003bf16 | |||
398a6c71a3 | |||
03846a27f7 | |||
0dceb8c38d | |||
d21109ebca | |||
7097cac863 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.swp
|
||||
vendor
|
||||
|
31
README.md
31
README.md
@ -1,17 +1,36 @@
|
||||
# OpenCase
|
||||
A simple, case-management-focused CRM for small altruistic organisations.
|
||||
|
||||
## Current Status
|
||||
**15 April 2018** A demo site, with basic functionality is available at demo.opencase.org.uk.
|
||||
A simple case-management system
|
||||
|
||||
## The Plan
|
||||
OpenCase will be available as:
|
||||
* A Drupal module, on drupal.org
|
||||
* A Drupal install profile / distribution
|
||||
* A hosted service
|
||||
|
||||
### Features
|
||||
#### Existing
|
||||
* Completely configurable person types, case types and activity types
|
||||
* Search
|
||||
* Basic Reporting
|
||||
* Basic user roles (caseworker, volunteer co-ordinator, site admin etc) with access control
|
||||
|
||||
#### Coming soon
|
||||
* Better reporting (currently only reports on defaults fields and not user-added ones)
|
||||
* Allocation of tasks, overview of tasks and their stage of completion
|
||||
* Appointments and notifications
|
||||
|
||||
## Current Status
|
||||
**11 Nov 2018**
|
||||
### User Base
|
||||
OpenCase is being used by a couple of organisations, early adopters on the hosted platform.
|
||||
### Availability as Free Software
|
||||
If you want to install OpenCase for yourself, please get in touch via Issues. It is changing rapidly and the install process is currently undocumented but I am more than happy to guide you through.
|
||||
### Try it out
|
||||
A demo site, with basic functionality is available at demo.opencase.org.uk. If you are interested, raise an issue and I will get the login to you somehow.
|
||||
|
||||
## Find out more
|
||||
* More details, including user stories, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/zen-crm/content/)
|
||||
* More details, including user stories for future development, can be found in the [OpenCase Gitbook](https://hoegrammer.gitbooks.io/opencase/content/)
|
||||
* Raise an issue to contact the developer.
|
||||
|
||||
|
||||
|
||||
|
||||
|
5
ciac_opencase_customisations.libraries.yml
Normal file
5
ciac_opencase_customisations.libraries.yml
Normal file
@ -0,0 +1,5 @@
|
||||
ciac_grouped_views:
|
||||
version: 1.x
|
||||
css:
|
||||
layout:
|
||||
css/grouped_views.css: {}
|
@ -1,14 +1,16 @@
|
||||
{
|
||||
"name": "drupal/zencrm",
|
||||
"type": "drupal-module",
|
||||
"description": "Zen CRM",
|
||||
"keywords": ["Drupal"],
|
||||
"license": "GPL-2.0+",
|
||||
"homepage": "https://www.drupal.org/project/zencrm",
|
||||
"minimum-stability": "dev",
|
||||
"support": {
|
||||
"issues": "https://www.drupal.org/project/issues/zencrm",
|
||||
"source": "http://cgit.drupalcode.org/zencrm"
|
||||
},
|
||||
"require": { }
|
||||
"name": "autonomic/opencase",
|
||||
"type": "drupal-module",
|
||||
"authors": [
|
||||
{
|
||||
"name": "autonomic",
|
||||
"email": "helo@autonomic.zone"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "*",
|
||||
"drupal/superfish": "*",
|
||||
"drupal/smtp": "*",
|
||||
"drupal/paragraphs_collapsible": "*"
|
||||
}
|
||||
}
|
||||
|
@ -2,24 +2,24 @@ langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase
|
||||
- system
|
||||
- zencrm
|
||||
theme:
|
||||
- bartik
|
||||
id: activitycreator
|
||||
id: actortypehelp
|
||||
theme: bartik
|
||||
region: content
|
||||
weight: -7
|
||||
weight: -11
|
||||
provider: null
|
||||
plugin: activity_creator
|
||||
plugin: actor_type_help
|
||||
settings:
|
||||
id: activity_creator
|
||||
label: 'Activity creator'
|
||||
provider: zencrm
|
||||
id: actor_type_help
|
||||
label: 'Actor Type Help'
|
||||
provider: opencase
|
||||
label_display: '0'
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/case/*'
|
||||
pages: '/admin/opencase/oc_actor_type/*/edit/fields'
|
||||
negate: false
|
||||
context_mapping: { }
|
69
config/install/block.block.opencase.yml
Normal file
69
config/install/block.block.opencase.yml
Normal file
@ -0,0 +1,69 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- system.menu.opencase
|
||||
module:
|
||||
- superfish
|
||||
theme:
|
||||
- bartik
|
||||
id: opencase
|
||||
theme: bartik
|
||||
region: primary_menu
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'superfish:opencase'
|
||||
settings:
|
||||
id: 'superfish:opencase'
|
||||
label: OpenCase
|
||||
provider: superfish
|
||||
label_display: '0'
|
||||
level: '1'
|
||||
depth: '0'
|
||||
menu_type: horizontal
|
||||
style: none
|
||||
arrow: 0
|
||||
shadow: 1
|
||||
speed: fast
|
||||
delay: '800'
|
||||
slide: vertical
|
||||
supposition: 1
|
||||
hoverintent: 1
|
||||
touch: '1'
|
||||
touchbh: '1'
|
||||
touchbp: '768'
|
||||
touchua: '0'
|
||||
touchual: ''
|
||||
touchuam: '0'
|
||||
small: '2'
|
||||
smallbp: '768'
|
||||
smallua: '0'
|
||||
smallual: ''
|
||||
smalluam: '0'
|
||||
smallact: '1'
|
||||
smallset: ''
|
||||
smallasa: 0
|
||||
smallcmc: 0
|
||||
smallecm: ''
|
||||
smallchc: 0
|
||||
smallech: ''
|
||||
smallicm: ''
|
||||
smallich: ''
|
||||
smallamt: ''
|
||||
smallabt: '1'
|
||||
supersubs: 1
|
||||
minwidth: '12'
|
||||
maxwidth: '27'
|
||||
multicolumn: 0
|
||||
multicolumn_depth: '1'
|
||||
multicolumn_levels: '1'
|
||||
pathlevels: '1'
|
||||
expanded: 0
|
||||
clone_parent: 0
|
||||
hide_linkdescription: 0
|
||||
add_linkdescription: 0
|
||||
link_depth_class: 1
|
||||
custom_list_class: ''
|
||||
custom_item_class: ''
|
||||
custom_link_class: ''
|
||||
visibility: { }
|
7
config/install/system.menu.opencase.yml
Normal file
7
config/install/system.menu.opencase.yml
Normal file
@ -0,0 +1,7 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: opencase
|
||||
label: OpenCase
|
||||
description: 'Main navigation menu for OpenCase'
|
||||
locked: false
|
852
config/install/views.view.contact_details_changes.yml
Normal file
852
config/install/views.view.contact_details_changes.yml
Normal file
@ -0,0 +1,852 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- user
|
||||
id: contact_details_changes
|
||||
label: 'Contact Details History'
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: oc_actor_field_revision
|
||||
base_field: vid
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
id: default
|
||||
display_title: Master
|
||||
position: 0
|
||||
display_options:
|
||||
access:
|
||||
type: perm
|
||||
options:
|
||||
perm: 'view published client entities'
|
||||
cache:
|
||||
type: tag
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
options:
|
||||
disable_sql_rewrite: false
|
||||
distinct: false
|
||||
replica: false
|
||||
query_comment: ''
|
||||
query_tags: { }
|
||||
exposed_form:
|
||||
type: basic
|
||||
options:
|
||||
submit_button: Apply
|
||||
reset_button: false
|
||||
reset_button_label: Reset
|
||||
exposed_sorts_label: 'Sort by'
|
||||
expose_sort_order: true
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
pager:
|
||||
type: none
|
||||
options:
|
||||
offset: 0
|
||||
style:
|
||||
type: table
|
||||
options:
|
||||
grouping:
|
||||
1:
|
||||
field: view_oc_actor
|
||||
rendered: true
|
||||
rendered_strip: false
|
||||
row_class: ''
|
||||
default_row_class: true
|
||||
override: true
|
||||
sticky: false
|
||||
caption: ''
|
||||
summary: ''
|
||||
description: ''
|
||||
columns:
|
||||
first_name: first_name
|
||||
middle_names: middle_names
|
||||
last_name: last_name
|
||||
id: id
|
||||
revision_created: revision_created
|
||||
view_oc_actor: view_oc_actor
|
||||
info:
|
||||
first_name:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
middle_names:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
last_name:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
id:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
revision_created:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
view_oc_actor:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: ''
|
||||
default: '-1'
|
||||
empty_table: false
|
||||
row:
|
||||
type: fields
|
||||
options:
|
||||
inline: { }
|
||||
separator: ''
|
||||
hide_empty: false
|
||||
default_field_elements: true
|
||||
fields:
|
||||
revision_created:
|
||||
id: revision_created
|
||||
table: oc_actor_revision
|
||||
field: revision_created
|
||||
relationship: none
|
||||
group_type: min
|
||||
admin_label: ''
|
||||
label: Date
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: true
|
||||
text: '{{ revision_created | date(''d/m/Y'') }}'
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
set_precision: false
|
||||
precision: 0
|
||||
decimal: .
|
||||
separator: ''
|
||||
format_plural: 0
|
||||
format_plural_string: !!binary MQNAY291bnQ=
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
click_sort_column: value
|
||||
type: timestamp
|
||||
settings: { }
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: revision_created
|
||||
plugin_id: field
|
||||
first_name:
|
||||
id: first_name
|
||||
table: oc_actor_field_revision
|
||||
field: first_name
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'First Name'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: first_name
|
||||
plugin_id: field
|
||||
middle_names:
|
||||
id: middle_names
|
||||
table: oc_actor_field_revision
|
||||
field: middle_names
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Middle Names'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: middle_names
|
||||
plugin_id: field
|
||||
last_name:
|
||||
id: last_name
|
||||
table: oc_actor_field_revision
|
||||
field: last_name
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Last Name'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: last_name
|
||||
plugin_id: field
|
||||
email:
|
||||
id: email
|
||||
table: oc_actor_field_revision
|
||||
field: email
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Email Address'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: email
|
||||
plugin_id: field
|
||||
phone:
|
||||
id: phone
|
||||
table: oc_actor_field_revision
|
||||
field: phone
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Main Phone Number'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: phone
|
||||
plugin_id: field
|
||||
phone2:
|
||||
id: phone2
|
||||
table: oc_actor_field_revision
|
||||
field: phone2
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Alternative Phone Number'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: phone2
|
||||
plugin_id: field
|
||||
postal_address:
|
||||
id: postal_address
|
||||
table: oc_actor_field_revision
|
||||
field: postal_address
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Postal Address'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: basic_string
|
||||
settings: { }
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: postal_address
|
||||
plugin_id: field
|
||||
post_code:
|
||||
id: post_code
|
||||
table: oc_actor_field_revision
|
||||
field: post_code
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Post Code'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: false
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: oc_actor
|
||||
entity_field: post_code
|
||||
plugin_id: field
|
||||
view_oc_actor:
|
||||
id: view_oc_actor
|
||||
table: oc_actor_field_revision
|
||||
field: view_oc_actor
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: ''
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: true
|
||||
text: "◀\tBack to current record"
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
text: 'See "rewrite results" (had to do it that way because contains HTML).'
|
||||
output_url_as_text: false
|
||||
absolute: false
|
||||
entity_type: oc_actor
|
||||
plugin_id: entity_link
|
||||
filters: { }
|
||||
sorts:
|
||||
revision_created:
|
||||
id: revision_created
|
||||
table: oc_actor_revision
|
||||
field: revision_created
|
||||
relationship: none
|
||||
group_type: min
|
||||
admin_label: ''
|
||||
order: DESC
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
granularity: second
|
||||
entity_type: oc_actor
|
||||
entity_field: revision_created
|
||||
plugin_id: date
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
relationships: { }
|
||||
arguments:
|
||||
id:
|
||||
id: id
|
||||
table: oc_actor_field_revision
|
||||
field: id
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
default_action: 'not found'
|
||||
exception:
|
||||
value: all
|
||||
title_enable: false
|
||||
title: All
|
||||
title_enable: false
|
||||
title: ''
|
||||
default_argument_type: fixed
|
||||
default_argument_options:
|
||||
argument: ''
|
||||
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: { }
|
||||
break_phrase: false
|
||||
not: false
|
||||
entity_type: oc_actor
|
||||
entity_field: id
|
||||
plugin_id: numeric
|
||||
display_extenders: { }
|
||||
group_by: true
|
||||
title: 'Contact Details History'
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- user.permissions
|
||||
tags: { }
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
display_title: Page
|
||||
position: 1
|
||||
display_options:
|
||||
path: opencase/oc_actor/%/contact_details_history
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- user.permissions
|
||||
tags: { }
|
@ -1,25 +0,0 @@
|
||||
langcode: en
|
||||
status: false
|
||||
dependencies:
|
||||
module:
|
||||
- system
|
||||
- zencrm
|
||||
theme:
|
||||
- bartik
|
||||
id: hatcreator
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: -6
|
||||
provider: null
|
||||
plugin: hat_creator
|
||||
settings:
|
||||
id: hat_creator
|
||||
label: ''
|
||||
provider: zencrm
|
||||
label_display: visible
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/person/*'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -1,25 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- system
|
||||
- zencrm
|
||||
theme:
|
||||
- bartik
|
||||
id: personpanel
|
||||
theme: bartik
|
||||
region: content
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: person_panel
|
||||
settings:
|
||||
id: person_panel
|
||||
label: 'Person Panel'
|
||||
provider: zencrm
|
||||
label_display: '0'
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/person/*'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -1,30 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- views.view.single_case_with_activities
|
||||
module:
|
||||
- system
|
||||
- views
|
||||
theme:
|
||||
- bartik
|
||||
id: views_block__single_case_with_activities_block_1
|
||||
theme: bartik
|
||||
region: content
|
||||
weight: -5
|
||||
provider: null
|
||||
plugin: 'views_block:single_case_with_activities-block_1'
|
||||
settings:
|
||||
id: 'views_block:single_case_with_activities-block_1'
|
||||
label: ''
|
||||
provider: views
|
||||
label_display: '0'
|
||||
views_label: ''
|
||||
items_per_page: none
|
||||
context_mapping: { }
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/case/*'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -1,29 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- views.view.this_person_s_contact_details
|
||||
module:
|
||||
- system
|
||||
- views
|
||||
theme:
|
||||
- bartik
|
||||
id: views_block__this_person_s_contact_details_block_1
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: -7
|
||||
provider: null
|
||||
plugin: 'views_block:this_person_s_contact_details-block_1'
|
||||
settings:
|
||||
id: 'views_block:this_person_s_contact_details-block_1'
|
||||
label: ''
|
||||
provider: views
|
||||
label_display: visible
|
||||
views_label: ''
|
||||
items_per_page: none
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/person/*'
|
||||
negate: false
|
||||
context_mapping: { }
|
11
config/optional/contact.form.contact_opencase.yml
Normal file
11
config/optional/contact.form.contact_opencase.yml
Normal file
@ -0,0 +1,11 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: contact_opencase
|
||||
label: 'Contact the OpenCase Developers'
|
||||
recipients:
|
||||
- naomirosenberguk@gmail.com
|
||||
reply: ''
|
||||
weight: 0
|
||||
message: 'Thank you for your message. The OpenCase team will get back to you ASAP.'
|
||||
redirect: ''
|
@ -0,0 +1,39 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- contact.form.contact_opencase
|
||||
id: contact_message.contact_opencase.default
|
||||
targetEntityType: contact_message
|
||||
bundle: contact_opencase
|
||||
mode: default
|
||||
content:
|
||||
copy:
|
||||
weight: 50
|
||||
region: content
|
||||
mail:
|
||||
weight: -40
|
||||
region: content
|
||||
message:
|
||||
type: string_textarea
|
||||
weight: 0
|
||||
settings:
|
||||
rows: 12
|
||||
placeholder: ''
|
||||
region: content
|
||||
third_party_settings: { }
|
||||
name:
|
||||
weight: -50
|
||||
region: content
|
||||
preview:
|
||||
weight: 40
|
||||
region: content
|
||||
subject:
|
||||
type: string_textfield
|
||||
weight: -10
|
||||
region: content
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -0,0 +1,19 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- contact.form.contact_opencase
|
||||
id: contact_message.contact_opencase.default
|
||||
targetEntityType: contact_message
|
||||
bundle: contact_opencase
|
||||
mode: default
|
||||
content:
|
||||
message:
|
||||
type: string
|
||||
weight: 0
|
||||
label: above
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,6 +1,6 @@
|
||||
zencrm_entities.hat_type.*:
|
||||
opencase.oc_event.*:
|
||||
type: config_entity
|
||||
label: 'Hat type config'
|
||||
label: 'Event config'
|
||||
mapping:
|
||||
id:
|
||||
type: string
|
182
css/opencase.css
182
css/opencase.css
@ -1,152 +1,104 @@
|
||||
/* this part is for the wider theme and will be removed */
|
||||
a.site-branding__logo img {
|
||||
max-width: 100px;
|
||||
body {
|
||||
font-size: 100% !important;
|
||||
}
|
||||
|
||||
/* a hack to show different links in sidebar - temporary */
|
||||
.zencrm_creationlinks.authorised_only {
|
||||
display: none;
|
||||
/* remove this confusing thing from user creation page */
|
||||
#edit-password-policy-status {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.form-composite > .fieldset-wrapper > .description, .form-item .description {
|
||||
font-size: 1em !important;
|
||||
}
|
||||
|
||||
.user-logged-in .zencrm_creationlinks.authorised_only {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.zencrm_creationlinks.anonymous_only {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.user-logged-in .zencrm_creationlinks.anonymous_only {
|
||||
div[data-drupal-selector=edit-user-bulk-form] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Module-specific from here. */
|
||||
|
||||
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
|
||||
width: 100%;
|
||||
.layout-container {
|
||||
max-width: 95% !important;
|
||||
}
|
||||
|
||||
button.button--primary.js-form-submit.form-submit.ui-button.ui-corner-all.ui-widget {
|
||||
margin-left: 73%;
|
||||
}
|
||||
|
||||
button.button.button--danger.ui-button.ui-corner-all.ui-widget {
|
||||
float: left;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons {
|
||||
min-width: 550px;
|
||||
border: 20px solid rgba(0, 0, 0, 0.51);
|
||||
}
|
||||
|
||||
.tabledrag-toggle-weight-wrapper {
|
||||
/* Free the people from the tyranny of the useless search button */
|
||||
#edit-submit-actor-search, #edit-submit-actor-search--2{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#content .zencrm_case_details {
|
||||
display: none; /* don't show case as main content - it's shown in sidebar */
|
||||
/* Remove the revision message box. Temporary until can place it properly */
|
||||
#edit-revision-log-message-wrapper{
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.region.region-primary-menu {
|
||||
display:none;
|
||||
/* Same for revision checkbox. */
|
||||
.js-form-item.form-item.js-form-type-checkbox.form-type-checkbox.js-form-item-new-revision.form-item-new-revision {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.field--name-contact-details a {
|
||||
border-bottom: none;
|
||||
/* Style the search box in header bar. */
|
||||
#block-exposedformactor-searchpage-1 {
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
.sidebar .field--type-entity-reference {
|
||||
margin: 1em 0 0 0;
|
||||
#block-exposedformactor-searchpage-1 #edit-actions {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.region-sidebar-second .view-content li, .region-sidebar-second .views-row, .region-sidebar-second .zencrm_inner_sidebar_block {
|
||||
border-bottom: 10px solid #e6e6d3;
|
||||
padding-bottom: 20px;
|
||||
padding-top: 10px;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
background: #eeeedb;
|
||||
border: 1px solid lightgrey;
|
||||
margin-bottom: 10px;
|
||||
#block-exposedformactor-searchpage-1 .form-text {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.sidebar .region-sidebar-second h2 {
|
||||
font-size: 1.6em;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid grey;
|
||||
/* Make drop-down nav menu opaque */
|
||||
.block-superfish .menu ul {
|
||||
background: white;
|
||||
color: darkgray;
|
||||
}
|
||||
.block-superfish .menu ul li {
|
||||
border-bottom: 1px dotted darkgray;
|
||||
}
|
||||
.block-superfish .menu ul li a:hover {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.sidebar .views-field.views-field-type, .sidebar .field--name-type, .zencrm_inner_sidebar_block .zencrm_title {
|
||||
padding-bottom: 12px;
|
||||
font-size: 1.4em;
|
||||
text-align: center;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
/* In views, display label at top of field. Ths is because full descriptions are displayed in the activity view so having the label in the middle means it disappears down the page. */
|
||||
td.views-field {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.zencrm_inner_sidebar_block .zencrm_title {
|
||||
font-size: 1.2em;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.sidebar .field__label, .sidebar .field--type-entity-reference .field__label, .form-item label {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
/* Entity displays */
|
||||
.oc_entity .left {
|
||||
display: inline-block;
|
||||
width: 45%;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.sidebar .views-element-container .field, .sidebar .zencrm_inner_sidebar_block .field {
|
||||
padding-bottom: 15px;
|
||||
.oc_entity .right {
|
||||
display: inline-block;
|
||||
width: 45%;
|
||||
padding: 1em;
|
||||
float: right;
|
||||
}
|
||||
.oc_entity .field {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.sidebar .views-element-container .field .field__item, .sidebar .zencrm_inner_sidebar_block .field__item {
|
||||
font-size: 1.1em;
|
||||
/* Make entity reference field labels match normal field labels */
|
||||
.field--type-entity-reference .field__label {
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
font-size: 1em !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.region-sidebar-second .view-content li, .region-sidebar-second .views-row {
|
||||
padding-bottom: 20px;
|
||||
padding-top: 10px;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
background: #eeeedb;
|
||||
/* Styling for grouped views */
|
||||
table.views-table.views-view-table caption {
|
||||
text-align: left;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.region-sidebar-second .views-element-container.block, #block-casedetails {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
/* remove "details" accordion, see https://drupal.stackexchange.com/questions/294312/why-has-this-details-accordion-appeared-in-this-view */
|
||||
.views-table details {
|
||||
|
||||
.zencrm_creationlinks {
|
||||
padding: 10px 10px 10px 20px;
|
||||
font-size: 1.2em;
|
||||
|
||||
}
|
||||
|
||||
.sidebar .zencrm_links {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.sidebar .zencrm_links p, .sidebar .zencrm_creationlinks p {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.zencrm_creationlinks p {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.sidebar .zencrm_creationlinks {
|
||||
padding: 5px;
|
||||
font-size: 1.3em;
|
||||
display: none;
|
||||
|
||||
}
|
||||
|
||||
.sidebar .zencrm_editlink {
|
||||
font-size: 1.2em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#block-hatcreator {
|
||||
padding: 0;
|
||||
border: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
67
docs/install.txt
Normal file
67
docs/install.txt
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
composer create-project drupal/recommended-project:8.9.8 drupal
|
||||
|
||||
# ADD THIS TO drupal/composer.json IN THE REPOSITORIES SECTION
|
||||
,{
|
||||
|
||||
"type": "vcs",
|
||||
"url": "https://git.autonomic.zone/autonomic-cooperative/opencase.git"
|
||||
}
|
||||
|
||||
|
||||
# INSTALL MODULES VIA COMPOSER (this will add them to composer.json, which is better than using a premade one, because this way the versions will all sort themselves out)
|
||||
composer require drupal/admin_toolbar drupal/security_review drupal/smtp drupal/opencase drupal/superfish
|
||||
|
||||
# CREATE DIRECTORIES AND SET UP FILE PERMISSIONS
|
||||
|
||||
# start in drupal directory
|
||||
mkdir -p config/sync
|
||||
mkdir private
|
||||
|
||||
# if web server user =/= deployment user:
|
||||
# start in drupal directory
|
||||
sudo chgrp www-data config/sync
|
||||
cd web
|
||||
cp sites/default/default.settings.php sites/default/settings.php
|
||||
sudo chgrp www-data . -R
|
||||
mkdir sites/default/files
|
||||
sudo chmod g+w sites/default/files -R
|
||||
chmod g+w sites/default/settings.php
|
||||
sudo find -type d -exec chmod g+s {} \;
|
||||
sudo chmod g-w sites/default/
|
||||
sudo chmod g-w sites
|
||||
sudo chmod g-w sites ./sites/example.settings.local.php ./sites/development.services.yml ./sites/example.sites.php ./sites/default/default.services.yml ./sites/default/default.settings.php ./autoload.php
|
||||
sudo chmod g-w -R modules/
|
||||
sudo chmod g-w -R core
|
||||
sudo chmod g-w profiles index.php update.php
|
||||
sudo chmod g-w themes -R
|
||||
sudo chmod g-w web.config robots.txt
|
||||
cd ../
|
||||
sudo chmod g-w -R web/modules
|
||||
sudo chgrp www-data private
|
||||
sudo chmod g+w,o-r,o-x private
|
||||
|
||||
|
||||
# INSTALL THE SITE
|
||||
|
||||
- Create a database
|
||||
- Go to the url and run the installer
|
||||
|
||||
# make settings file unwriteable now that it has been generated
|
||||
sudo chmod a-w sites/default/settings.php
|
||||
|
||||
# ENABLE all the above modules
|
||||
drush en admin_toolbar security_review smtp opencase -y
|
||||
|
||||
|
||||
# TODO set $trusted_host_patterns (in settings.php)
|
||||
# TODO private files (in settings.php)
|
||||
# TODO Set all the HTML roles to admin only - /admin/config/content/formats
|
||||
# TODO run security review (make eveything untrusted except CRM Admin and Admin) - /admin/config/security-review
|
||||
# TODO homepage -> /opencase/whatever-the-chosen-homepage, 403 - /user/login - /admin/config/system/site-information
|
||||
# TODO disable blocks: tools, main navigation, footer menu - /admin/structure/block
|
||||
# TODO logo & colours - admin/appearance/settings/bartik
|
||||
# TODO disallow registering an account & turn off personal contact forms - /admin/config/people/accounts
|
||||
# TODO add linked actor field to form display and display display - top of both
|
||||
# TODO change which contact form is the default - /admin/structure/contact
|
||||
# TODO change "short" date formate to d/m/Y - /admin/config/regional/date-time
|
@ -1,38 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.activity.case_note.field_file
|
||||
- field.field.activity.case_note.field_notes
|
||||
- zencrm_entities.activity_type.case_note
|
||||
module:
|
||||
- file
|
||||
id: activity.case_note.default
|
||||
targetEntityType: activity
|
||||
bundle: case_note
|
||||
mode: default
|
||||
content:
|
||||
field_file:
|
||||
weight: 4
|
||||
settings:
|
||||
progress_indicator: throbber
|
||||
third_party_settings: { }
|
||||
type: file_generic
|
||||
region: content
|
||||
field_notes:
|
||||
weight: 3
|
||||
settings:
|
||||
rows: 5
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textarea
|
||||
region: content
|
||||
name:
|
||||
type: string_textfield
|
||||
weight: -4
|
||||
region: content
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,32 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.activity.self_assessment.field_how_is_your_housing_situat
|
||||
- field.field.activity.self_assessment.field_how_is_your_mental_health_
|
||||
- field.field.activity.self_assessment.field_how_is_your_physical_healt
|
||||
- zencrm_entities.activity_type.self_assessment
|
||||
id: activity.self_assessment.default
|
||||
targetEntityType: activity
|
||||
bundle: self_assessment
|
||||
mode: default
|
||||
content:
|
||||
field_how_is_your_housing_situat:
|
||||
weight: 5
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_buttons
|
||||
region: content
|
||||
field_how_is_your_mental_health_:
|
||||
weight: 4
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_buttons
|
||||
region: content
|
||||
field_how_is_your_physical_healt:
|
||||
weight: 3
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_buttons
|
||||
region: content
|
||||
hidden: { }
|
@ -1,29 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.case_entity.asylum.field_asyl
|
||||
- field.field.case_entity.asylum.field_home_offi
|
||||
- zencrm_entities.case_entity_type.asylum
|
||||
id: case_entity.asylum.default
|
||||
targetEntityType: case_entity
|
||||
bundle: asylum
|
||||
mode: default
|
||||
content:
|
||||
field_asyl:
|
||||
weight: 6
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_home_offi:
|
||||
weight: 7
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
hidden: { }
|
@ -1,20 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- zencrm_entities.case_entity_type.housing
|
||||
id: case_entity.housing.default
|
||||
targetEntityType: case_entity
|
||||
bundle: housing
|
||||
mode: default
|
||||
content:
|
||||
user_id:
|
||||
type: entity_reference_autocomplete
|
||||
weight: 5
|
||||
settings:
|
||||
match_operator: CONTAINS
|
||||
size: 60
|
||||
placeholder: ''
|
||||
region: content
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,20 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- zencrm_entities.case_entity_type.volunteer_recruitment
|
||||
id: case_entity.volunteer_recruitment.default
|
||||
targetEntityType: case_entity
|
||||
bundle: volunteer_recruitment
|
||||
mode: default
|
||||
content:
|
||||
user_id:
|
||||
type: entity_reference_autocomplete
|
||||
weight: 5
|
||||
settings:
|
||||
match_operator: CONTAINS
|
||||
size: 60
|
||||
placeholder: ''
|
||||
region: content
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,29 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.hat.client.field_country
|
||||
- field.field.hat.client.field_language
|
||||
- zencrm_entities.hat_type.client
|
||||
id: hat.client.default
|
||||
targetEntityType: hat
|
||||
bundle: client
|
||||
mode: default
|
||||
content:
|
||||
field_country:
|
||||
weight: 3
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_language:
|
||||
weight: 4
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
hidden: { }
|
@ -1,38 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.hat.volunteer.field_availability
|
||||
- field.field.hat.volunteer.field_date_started
|
||||
- field.field.hat.volunteer.field_team
|
||||
- zencrm_entities.hat_type.volunteer
|
||||
module:
|
||||
- datetime
|
||||
id: hat.volunteer.default
|
||||
targetEntityType: hat
|
||||
bundle: volunteer
|
||||
mode: default
|
||||
content:
|
||||
field_availability:
|
||||
weight: 6
|
||||
settings:
|
||||
rows: 5
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textarea
|
||||
region: content
|
||||
field_date_started:
|
||||
weight: 5
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: datetime_default
|
||||
region: content
|
||||
field_team:
|
||||
weight: 4
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
hidden: { }
|
@ -1,38 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.activity.case_note.field_file
|
||||
- field.field.activity.case_note.field_notes
|
||||
- zencrm_entities.activity_type.case_note
|
||||
module:
|
||||
- file
|
||||
id: activity.case_note.default
|
||||
targetEntityType: activity
|
||||
bundle: case_note
|
||||
mode: default
|
||||
content:
|
||||
field_file:
|
||||
weight: -2
|
||||
label: above
|
||||
settings:
|
||||
use_description_as_link_text: true
|
||||
third_party_settings: { }
|
||||
type: file_default
|
||||
region: content
|
||||
field_notes:
|
||||
weight: -3
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: basic_string
|
||||
region: content
|
||||
name:
|
||||
label: above
|
||||
type: string
|
||||
weight: -4
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,37 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.activity.self_assessment.field_how_is_your_housing_situat
|
||||
- field.field.activity.self_assessment.field_how_is_your_mental_health_
|
||||
- field.field.activity.self_assessment.field_how_is_your_physical_healt
|
||||
- zencrm_entities.activity_type.self_assessment
|
||||
module:
|
||||
- options
|
||||
id: activity.self_assessment.default
|
||||
targetEntityType: activity
|
||||
bundle: self_assessment
|
||||
mode: default
|
||||
content:
|
||||
field_how_is_your_housing_situat:
|
||||
weight: -1
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_how_is_your_mental_health_:
|
||||
weight: -2
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_how_is_your_physical_healt:
|
||||
weight: -3
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
hidden: { }
|
@ -1,29 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.case_entity.asylum.field_asyl
|
||||
- field.field.case_entity.asylum.field_home_offi
|
||||
- zencrm_entities.case_entity_type.asylum
|
||||
id: case_entity.asylum.default
|
||||
targetEntityType: case_entity
|
||||
bundle: asylum
|
||||
mode: default
|
||||
content:
|
||||
field_asyl:
|
||||
weight: 1
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_home_offi:
|
||||
weight: 2
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
hidden: { }
|
@ -1,26 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- zencrm_entities.case_entity_type.housing
|
||||
id: case_entity.housing.default
|
||||
targetEntityType: case_entity
|
||||
bundle: housing
|
||||
mode: default
|
||||
content:
|
||||
name:
|
||||
label: above
|
||||
type: string
|
||||
weight: -4
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
user_id:
|
||||
label: hidden
|
||||
type: author
|
||||
weight: 0
|
||||
region: content
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,26 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- zencrm_entities.case_entity_type.volunteer_recruitment
|
||||
id: case_entity.volunteer_recruitment.default
|
||||
targetEntityType: case_entity
|
||||
bundle: volunteer_recruitment
|
||||
mode: default
|
||||
content:
|
||||
name:
|
||||
label: above
|
||||
type: string
|
||||
weight: -4
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
user_id:
|
||||
label: hidden
|
||||
type: author
|
||||
weight: 0
|
||||
region: content
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
hidden: { }
|
@ -1,29 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.hat.client.field_country
|
||||
- field.field.hat.client.field_language
|
||||
- zencrm_entities.hat_type.client
|
||||
id: hat.client.default
|
||||
targetEntityType: hat
|
||||
bundle: client
|
||||
mode: default
|
||||
content:
|
||||
field_country:
|
||||
weight: 1
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_language:
|
||||
weight: 2
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
hidden: { }
|
@ -1,40 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.field.hat.volunteer.field_availability
|
||||
- field.field.hat.volunteer.field_date_started
|
||||
- field.field.hat.volunteer.field_team
|
||||
- zencrm_entities.hat_type.volunteer
|
||||
module:
|
||||
- datetime
|
||||
id: hat.volunteer.default
|
||||
targetEntityType: hat
|
||||
bundle: volunteer
|
||||
mode: default
|
||||
content:
|
||||
field_availability:
|
||||
weight: 104
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: basic_string
|
||||
region: content
|
||||
field_date_started:
|
||||
weight: 103
|
||||
label: above
|
||||
settings:
|
||||
format_type: medium
|
||||
timezone_override: ''
|
||||
third_party_settings: { }
|
||||
type: datetime_default
|
||||
region: content
|
||||
field_team:
|
||||
weight: 102
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
hidden: { }
|
@ -1,26 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.activity.field_file
|
||||
- zencrm_entities.activity_type.case_note
|
||||
module:
|
||||
- file
|
||||
id: activity.case_note.field_file
|
||||
field_name: field_file
|
||||
entity_type: activity
|
||||
bundle: case_note
|
||||
label: Files
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings:
|
||||
file_directory: '[date:custom:Y]-[date:custom:m]'
|
||||
file_extensions: 'txt jpg rtf doc png pdf'
|
||||
max_filesize: ''
|
||||
description_field: false
|
||||
handler: 'default:file'
|
||||
handler_settings: { }
|
||||
field_type: file
|
@ -1,18 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.activity.field_notes
|
||||
- zencrm_entities.activity_type.case_note
|
||||
id: activity.case_note.field_notes
|
||||
field_name: field_notes
|
||||
entity_type: activity
|
||||
bundle: case_note
|
||||
label: Notes
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string_long
|
@ -1,20 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.activity.field_how_is_your_housing_situat
|
||||
- zencrm_entities.activity_type.self_assessment
|
||||
module:
|
||||
- options
|
||||
id: activity.self_assessment.field_how_is_your_housing_situat
|
||||
field_name: field_how_is_your_housing_situat
|
||||
entity_type: activity
|
||||
bundle: self_assessment
|
||||
label: 'How is your housing situation?'
|
||||
description: ''
|
||||
required: true
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
@ -1,20 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.activity.field_how_is_your_mental_health_
|
||||
- zencrm_entities.activity_type.self_assessment
|
||||
module:
|
||||
- options
|
||||
id: activity.self_assessment.field_how_is_your_mental_health_
|
||||
field_name: field_how_is_your_mental_health_
|
||||
entity_type: activity
|
||||
bundle: self_assessment
|
||||
label: 'How is your mental health?'
|
||||
description: ''
|
||||
required: true
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
@ -1,20 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.activity.field_how_is_your_physical_healt
|
||||
- zencrm_entities.activity_type.self_assessment
|
||||
module:
|
||||
- options
|
||||
id: activity.self_assessment.field_how_is_your_physical_healt
|
||||
field_name: field_how_is_your_physical_healt
|
||||
entity_type: activity
|
||||
bundle: self_assessment
|
||||
label: 'How is your physical health?'
|
||||
description: ''
|
||||
required: true
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
@ -1,18 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.case_entity.field_asyl
|
||||
- zencrm_entities.case_entity_type.asylum
|
||||
id: case_entity.asylum.field_asyl
|
||||
field_name: field_asyl
|
||||
entity_type: case_entity
|
||||
bundle: asylum
|
||||
label: 'Asylum status when taken on'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
@ -1,18 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.case_entity.field_home_offi
|
||||
- zencrm_entities.case_entity_type.asylum
|
||||
id: case_entity.asylum.field_home_offi
|
||||
field_name: field_home_offi
|
||||
entity_type: case_entity
|
||||
bundle: asylum
|
||||
label: 'Home Office Number'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
@ -1,23 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.hat.field_date_started
|
||||
- zencrm_entities.hat_type.volunteer
|
||||
module:
|
||||
- datetime
|
||||
id: hat.volunteer.field_date_started
|
||||
field_name: field_date_started
|
||||
entity_type: hat
|
||||
bundle: volunteer
|
||||
label: 'Date Started'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value:
|
||||
-
|
||||
default_date_type: now
|
||||
default_date: now
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: datetime
|
@ -1,18 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.hat.field_team
|
||||
- zencrm_entities.hat_type.volunteer
|
||||
id: hat.volunteer.field_team
|
||||
field_name: field_team
|
||||
entity_type: hat
|
||||
bundle: volunteer
|
||||
label: Team
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
@ -1,35 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- options
|
||||
- zencrm_entities
|
||||
id: activity.field_how_is_your_housing_situat
|
||||
field_name: field_how_is_your_housing_situat
|
||||
entity_type: activity
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values:
|
||||
-
|
||||
value: Excellent
|
||||
label: Excellent
|
||||
-
|
||||
value: Good
|
||||
label: Good
|
||||
-
|
||||
value: OK
|
||||
label: OK
|
||||
-
|
||||
value: Bad
|
||||
label: Bad
|
||||
-
|
||||
value: Terrible
|
||||
label: Terrible
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
@ -1,35 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- options
|
||||
- zencrm_entities
|
||||
id: activity.field_how_is_your_mental_health_
|
||||
field_name: field_how_is_your_mental_health_
|
||||
entity_type: activity
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values:
|
||||
-
|
||||
value: Excellent
|
||||
label: Excellent
|
||||
-
|
||||
value: Good
|
||||
label: Good
|
||||
-
|
||||
value: OK
|
||||
label: OK
|
||||
-
|
||||
value: Bad
|
||||
label: Bad
|
||||
-
|
||||
value: Terrible
|
||||
label: Terrible
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
@ -1,35 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- options
|
||||
- zencrm_entities
|
||||
id: activity.field_how_is_your_physical_healt
|
||||
field_name: field_how_is_your_physical_healt
|
||||
entity_type: activity
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values:
|
||||
-
|
||||
value: Excellent
|
||||
label: Excellent
|
||||
-
|
||||
value: Good
|
||||
label: Good
|
||||
-
|
||||
value: OK
|
||||
label: OK
|
||||
-
|
||||
value: Bad
|
||||
label: Bad
|
||||
-
|
||||
value: Terrible
|
||||
label: Terrible
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
@ -1,5 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: volunteer_recruitment
|
||||
label: 'Volunteer recruitment'
|
@ -1,6 +0,0 @@
|
||||
bundle: opencase
|
||||
excluded:
|
||||
- block.block.views_block__single_case_with_activities_block_1
|
||||
- block.block.views_block__this_person_s_contact_details_block_1
|
||||
- block.block.views_block__this_person_s_hats_block_1
|
||||
required: true
|
@ -1,11 +0,0 @@
|
||||
name: 'Default Subtypes'
|
||||
type: module
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- block
|
||||
- datetime
|
||||
- field
|
||||
- system
|
||||
- views
|
||||
- zencrm_entities
|
||||
package: 'OpenCase'
|
@ -1,7 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: anonymous
|
||||
label: 'Anonymous user'
|
||||
weight: 0
|
||||
is_admin: false
|
@ -1,6 +0,0 @@
|
||||
bundle: opencase
|
||||
excluded:
|
||||
- block.block.views_block__single_case_with_activities_block_1
|
||||
- block.block.views_block__this_person_s_contact_details_block_1
|
||||
- block.block.views_block__this_person_s_hats_block_1
|
||||
required: true
|
@ -1,9 +0,0 @@
|
||||
name: default_user_config
|
||||
type: module
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- block
|
||||
- system
|
||||
- user
|
||||
- views
|
||||
package: 'OpenCase'
|
@ -1,4 +1,3 @@
|
||||
(function ($, Drupal) {
|
||||
$(".field--name-contact-details a").contents().unwrap();
|
||||
$('#edit-search-api-fulltext').attr('autocomplete', 'off');
|
||||
})(jQuery, Drupal);
|
||||
|
15
modules/opencase_cases/config/schema/oc_case_type.schema.yml
Normal file
15
modules/opencase_cases/config/schema/oc_case_type.schema.yml
Normal file
@ -0,0 +1,15 @@
|
||||
opencase_cases.oc_case_type.*:
|
||||
type: config_entity
|
||||
label: 'Case type config'
|
||||
mapping:
|
||||
id:
|
||||
type: string
|
||||
label: 'ID'
|
||||
label:
|
||||
type: label
|
||||
label: 'Label'
|
||||
allowedActivityTypes:
|
||||
type: sequence
|
||||
label: 'Allowed Activity Types'
|
||||
uuid:
|
||||
type: string
|
40
modules/opencase_cases/oc_case.page.inc
Normal file
40
modules/opencase_cases/oc_case.page.inc
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains oc_case.page.inc.
|
||||
*
|
||||
* Page callback for Case entities.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Render\Element;
|
||||
|
||||
/**
|
||||
* Prepares variables for Case templates.
|
||||
*
|
||||
* Default template: oc_case.html.twig.
|
||||
*
|
||||
* @param array $variables
|
||||
* An associative array containing:
|
||||
* - elements: An associative array containing the user information and any
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
*/
|
||||
function template_preprocess_oc_case(array &$variables) {
|
||||
// Separate the fields into two sections to be displayed in two columns.
|
||||
// Remove the name (title) field as this is displayed anyway.
|
||||
$variables['id'] = $variables['elements']['#oc_case']->get('id')[0]->get('value')->getValue();
|
||||
$variables['eva_fields'] = array(); // if the installation has any "EVA" (embedded view) fields this should catch them.
|
||||
$variables['base_fields'] = array();
|
||||
$variables['other_fields'] = array();
|
||||
foreach (Element::children($variables['elements']) as $key) {
|
||||
$variables['content'][$key] = $variables['elements'][$key];
|
||||
if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
|
||||
$variables['base_fields'][$key] = $variables['elements'][$key];
|
||||
} else if (strpos($key, "entity_view") !== false) {
|
||||
$variables['eva_fields'][$key] = $variables['elements'][$key];
|
||||
} else {
|
||||
$variables['other_fields'][$key] = $variables['elements'][$key];
|
||||
unset($variables['other_fields']['name']);
|
||||
}
|
||||
}
|
||||
}
|
7
modules/opencase_cases/opencase_cases.info.yml
Normal file
7
modules/opencase_cases/opencase_cases.info.yml
Normal file
@ -0,0 +1,7 @@
|
||||
name: 'Opencase Cases'
|
||||
type: module
|
||||
description: 'Provides case entities and a required field on activities linking them to a case.'
|
||||
core: 8.x
|
||||
package: 'OpenCase'
|
||||
dependencies:
|
||||
- opencase_entities
|
12
modules/opencase_cases/opencase_cases.links.action.yml
Normal file
12
modules/opencase_cases/opencase_cases.links.action.yml
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
entity.oc_case.add_form:
|
||||
route_name: entity.oc_case.add_page
|
||||
title: 'Add Case'
|
||||
appears_on:
|
||||
- entity.oc_case.collection
|
||||
entity.oc_case_type.add_form:
|
||||
route_name: entity.oc_case_type.add_form
|
||||
title: 'Add Case type'
|
||||
appears_on:
|
||||
- entity.oc_case_type.collection
|
||||
|
25
modules/opencase_cases/opencase_cases.links.menu.yml
Normal file
25
modules/opencase_cases/opencase_cases.links.menu.yml
Normal file
@ -0,0 +1,25 @@
|
||||
opencase_cases.manage_case_types:
|
||||
title: 'Manage case types'
|
||||
description: 'Configure types of cases and their fields'
|
||||
menu_name: opencase
|
||||
parent: opencase.opencase_admin_menu
|
||||
url: internal:/admin/opencase/oc_case_type
|
||||
weight: 2
|
||||
# Case menu items definition
|
||||
entity.oc_case.collection:
|
||||
title: 'Case list'
|
||||
route_name: entity.oc_case.collection
|
||||
description: 'List Case entities'
|
||||
parent: system.admin_structure
|
||||
weight: 100
|
||||
|
||||
|
||||
# Case type menu items definition
|
||||
entity.oc_case_type.collection:
|
||||
title: 'Case type'
|
||||
route_name: entity.oc_case_type.collection
|
||||
description: 'List Case type (bundles)'
|
||||
parent: system.admin_structure
|
||||
weight: 99
|
||||
|
||||
|
23
modules/opencase_cases/opencase_cases.links.task.yml
Normal file
23
modules/opencase_cases/opencase_cases.links.task.yml
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
# Case routing definition
|
||||
|
||||
entity.oc_case.canonical:
|
||||
route_name: entity.oc_case.canonical
|
||||
base_route: entity.oc_case.canonical
|
||||
title: 'View'
|
||||
|
||||
entity.oc_case.edit_form:
|
||||
route_name: entity.oc_case.edit_form
|
||||
base_route: entity.oc_case.canonical
|
||||
title: 'Edit'
|
||||
|
||||
entity.oc_case.version_history:
|
||||
route_name: entity.oc_case.version_history
|
||||
base_route: entity.oc_case.canonical
|
||||
title: 'Revisions'
|
||||
|
||||
entity.oc_case.delete_form:
|
||||
route_name: entity.oc_case.delete_form
|
||||
base_route: entity.oc_case.canonical
|
||||
title: Delete
|
||||
weight: 10
|
138
modules/opencase_cases/opencase_cases.module
Normal file
138
modules/opencase_cases/opencase_cases.module
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains opencase_cases.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function opencase_cases_help($route_name, RouteMatchInterface $route_match) {
|
||||
switch ($route_name) {
|
||||
// Main module help for the opencase_cases module.
|
||||
case 'help.page.opencase_cases':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('Provides case entities and a required field on activities linking them to a case.') . '</p>';
|
||||
return $output;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function opencase_cases_theme() {
|
||||
return [
|
||||
'opencase_cases' => [
|
||||
'render element' => 'children',
|
||||
],
|
||||
'oc_case' => [
|
||||
'render element' => 'elements',
|
||||
'file' => 'oc_case.page.inc',
|
||||
'template' => 'oc_case',
|
||||
],
|
||||
'oc_case_content_add_list' => [
|
||||
'render element' => 'content',
|
||||
'variables' => ['content' => NULL],
|
||||
'file' => 'oc_case.page.inc',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function opencase_cases_entity_base_field_info($entity_type) {
|
||||
$fields = array();
|
||||
|
||||
// Add Case field to Activity
|
||||
if ($entity_type->id() === 'oc_activity') {
|
||||
$fields['oc_case'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Case'))
|
||||
->setDescription(t('The case this activity belongs to.'))
|
||||
->setSetting('target_type', 'oc_case')
|
||||
->setSetting('handler', 'default')
|
||||
->setTranslatable(TRUE)
|
||||
->setCardinality(1)
|
||||
->setDefaultValueCallback('opencase_cases_default_activity_case_value')
|
||||
->setDisplayOptions('view', [
|
||||
'type' => 'string',
|
||||
'weight' => -3,
|
||||
])
|
||||
->setRequired(TRUE);
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/* When creating an activity, it sets the case id from the URL.
|
||||
/*/
|
||||
public static function opencase_cases_default_activity_case_value() {
|
||||
return array(\Drupal::request()->query->get('case_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_form_alter()
|
||||
* Changes what page is redirected to after deleting things
|
||||
*/
|
||||
function opencase_cases_form_alter(&$form, &$form_state, $form_id) {
|
||||
if (preg_match('/oc_actor_.*_delete_form/', $form_id) or (preg_match('/oc_case_.*_delete_form/', $form_id)) or (preg_match('/oc_organisation_.*_delete_form/', $form_id))) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_cases_redirect_to_home';
|
||||
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
if (preg_match('/oc_activity_.*_delete_form/', $form_id)) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_cases_delete_activity_redirect';
|
||||
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
}
|
||||
|
||||
function _opencase_cases_redirect_to_home($form, &$form_state) {
|
||||
$form_state->setRedirect('<front>');
|
||||
|
||||
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
|
||||
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
|
||||
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
|
||||
|
||||
/**
|
||||
* Implements hook_theme_suggestions_HOOK().
|
||||
*/
|
||||
function opencase_cases_theme_suggestions_oc_case(array $variables) {
|
||||
$suggestions = [];
|
||||
$entity = $variables['elements']['#oc_case'];
|
||||
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
|
||||
|
||||
$suggestions[] = 'oc_case__' . $sanitized_view_mode;
|
||||
$suggestions[] = 'oc_case__' . $entity->bundle();
|
||||
$suggestions[] = 'oc_case__' . $entity->bundle() . '__' . $sanitized_view_mode;
|
||||
$suggestions[] = 'oc_case__' . $entity->id();
|
||||
$suggestions[] = 'oc_case__' . $entity->id() . '__' . $sanitized_view_mode;
|
||||
return $suggestions;
|
||||
}
|
||||
|
||||
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
|
||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
|
||||
$query->addTag('oc_case_access');
|
||||
}
|
||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
|
||||
$query->addTag('oc_activity_access');
|
||||
}
|
||||
}
|
||||
|
||||
function opencase_query_oc_case_access_alter($query) {
|
||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||
return;
|
||||
}
|
||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
||||
$query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id');
|
||||
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||
}
|
||||
|
||||
function opencase_query_oc_activity_access_alter($query) {
|
||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||
return;
|
||||
}
|
||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
||||
$query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case');
|
||||
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||
}
|
22
modules/opencase_cases/src/CaseInvolvement.php
Normal file
22
modules/opencase_cases/src/CaseInvolvement.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
class CaseInvolvement {
|
||||
|
||||
public static function getLinkedActorId($account) {
|
||||
return \Drupal\user\Entity\User::load($account->id())->get('field_linked_opencase_actor')->target_id;
|
||||
}
|
||||
|
||||
public static function userIsInvolved($account, $case) {
|
||||
$actorId = self::getLinkedActorId($account);
|
||||
$involvedIds = array_column($case->actors_involved->getValue(), 'target_id');
|
||||
return in_array($actorId, $involvedIds);
|
||||
}
|
||||
|
||||
public static function userIsInvolved_activity($account, $activity) {
|
||||
$case_id = $activity->oc_case->target_id;
|
||||
$case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id);
|
||||
return self::userIsInvolved($account, $case);
|
||||
}
|
||||
}
|
163
modules/opencase_cases/src/Controller/OCCaseController.php
Normal file
163
modules/opencase_cases/src/Controller/OCCaseController.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Class OCCaseController.
|
||||
*
|
||||
* Returns responses for Case routes.
|
||||
*/
|
||||
class OCCaseController extends ControllerBase implements ContainerInjectionInterface {
|
||||
|
||||
/**
|
||||
* Displays a Case revision.
|
||||
*
|
||||
* @param int $oc_case_revision
|
||||
* The Case revision ID.
|
||||
*
|
||||
* @return array
|
||||
* An array suitable for drupal_render().
|
||||
*/
|
||||
public function revisionShow($oc_case_revision) {
|
||||
$oc_case = $this->entityManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
$view_builder = $this->entityManager()->getViewBuilder('oc_case');
|
||||
|
||||
return $view_builder->view($oc_case);
|
||||
}
|
||||
|
||||
/**
|
||||
* Page title callback for a Case revision.
|
||||
*
|
||||
* @param int $oc_case_revision
|
||||
* The Case revision ID.
|
||||
*
|
||||
* @return string
|
||||
* The page title.
|
||||
*/
|
||||
public function revisionPageTitle($oc_case_revision) {
|
||||
$oc_case = $this->entityManager()->getStorage('oc_case')->loadRevision($oc_case_revision);
|
||||
return $this->t('Revision of %title from %date', ['%title' => $oc_case->label(), '%date' => format_date($oc_case->getRevisionCreationTime())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an overview table of older revisions of a Case .
|
||||
*
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $oc_case
|
||||
* A Case object.
|
||||
*
|
||||
* @return array
|
||||
* An array as expected by drupal_render().
|
||||
*/
|
||||
public function revisionOverview(OCCaseInterface $oc_case) {
|
||||
$account = $this->currentUser();
|
||||
$langcode = $oc_case->language()->getId();
|
||||
$langname = $oc_case->language()->getName();
|
||||
$languages = $oc_case->getTranslationLanguages();
|
||||
$has_translations = (count($languages) > 1);
|
||||
$oc_case_storage = $this->entityManager()->getStorage('oc_case');
|
||||
|
||||
$build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $oc_case->label()]) : $this->t('Revisions for %title', ['%title' => $oc_case->label()]);
|
||||
$header = [$this->t('Revision'), $this->t('Operations')];
|
||||
|
||||
$revert_permission = (($account->hasPermission("revert all case revisions") || $account->hasPermission('administer case entities')));
|
||||
$delete_permission = (($account->hasPermission("delete all case revisions") || $account->hasPermission('administer case entities')));
|
||||
|
||||
$rows = [];
|
||||
|
||||
$vids = $oc_case_storage->revisionIds($oc_case);
|
||||
|
||||
$latest_revision = TRUE;
|
||||
|
||||
foreach (array_reverse($vids) as $vid) {
|
||||
/** @var \Drupal\opencase_cases\OCCaseInterface $revision */
|
||||
$revision = $oc_case_storage->loadRevision($vid);
|
||||
// Only show revisions that are affected by the language that is being
|
||||
// displayed.
|
||||
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
|
||||
$username = [
|
||||
'#theme' => 'username',
|
||||
'#account' => $revision->getRevisionUser(),
|
||||
];
|
||||
|
||||
// Use revision link to link to revisions that are not active.
|
||||
$date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short');
|
||||
if ($vid != $oc_case->getRevisionId()) {
|
||||
$link = $this->l($date, new Url('entity.oc_case.revision', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid]));
|
||||
}
|
||||
else {
|
||||
$link = $oc_case->link($date);
|
||||
}
|
||||
|
||||
$row = [];
|
||||
$column = [
|
||||
'data' => [
|
||||
'#type' => 'inline_template',
|
||||
'#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
|
||||
'#context' => [
|
||||
'date' => $link,
|
||||
'username' => \Drupal::service('renderer')->renderPlain($username),
|
||||
'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()],
|
||||
],
|
||||
],
|
||||
];
|
||||
$row[] = $column;
|
||||
|
||||
if ($latest_revision) {
|
||||
$row[] = [
|
||||
'data' => [
|
||||
'#prefix' => '<em>',
|
||||
'#markup' => $this->t('Current revision'),
|
||||
'#suffix' => '</em>',
|
||||
],
|
||||
];
|
||||
foreach ($row as &$current) {
|
||||
$current['class'] = ['revision-current'];
|
||||
}
|
||||
$latest_revision = FALSE;
|
||||
}
|
||||
else {
|
||||
$links = [];
|
||||
if ($revert_permission) {
|
||||
$links['revert'] = [
|
||||
'title' => $this->t('Revert'),
|
||||
'url' => $has_translations ?
|
||||
Url::fromRoute('entity.oc_case.translation_revert', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid, 'langcode' => $langcode]) :
|
||||
Url::fromRoute('entity.oc_case.revision_revert', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid]),
|
||||
];
|
||||
}
|
||||
|
||||
if ($delete_permission) {
|
||||
$links['delete'] = [
|
||||
'title' => $this->t('Delete'),
|
||||
'url' => Url::fromRoute('entity.oc_case.revision_delete', ['oc_case' => $oc_case->id(), 'oc_case_revision' => $vid]),
|
||||
];
|
||||
}
|
||||
|
||||
$row[] = [
|
||||
'data' => [
|
||||
'#type' => 'operations',
|
||||
'#links' => $links,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$build['oc_case_revisions_table'] = [
|
||||
'#theme' => 'table',
|
||||
'#rows' => $rows,
|
||||
'#header' => $header,
|
||||
];
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
290
modules/opencase_cases/src/Entity/OCCase.php
Normal file
290
modules/opencase_cases/src/Entity/OCCase.php
Normal file
@ -0,0 +1,290 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Entity\RevisionableContentEntityBase;
|
||||
use Drupal\Core\Entity\RevisionableInterface;
|
||||
use Drupal\Core\Entity\EntityChangedTrait;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\user\UserInterface;
|
||||
|
||||
/**
|
||||
* Defines the Case entity.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "oc_case",
|
||||
* label = @Translation("Case"),
|
||||
* bundle_label = @Translation("Case type"),
|
||||
* handlers = {
|
||||
* "storage" = "Drupal\opencase_cases\OCCaseStorage",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_cases\OCCaseListBuilder",
|
||||
* "views_data" = "Drupal\opencase_cases\Entity\OCCaseViewsData",
|
||||
* "translation" = "Drupal\opencase_cases\OCCaseTranslationHandler",
|
||||
*
|
||||
* "form" = {
|
||||
* "default" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "add" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "edit" = "Drupal\opencase_cases\Form\OCCaseForm",
|
||||
* "delete" = "Drupal\opencase_cases\Form\OCCaseDeleteForm",
|
||||
* },
|
||||
* "access" = "Drupal\opencase_cases\OCCaseAccessControlHandler",
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_cases\OCCaseHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* base_table = "oc_case",
|
||||
* data_table = "oc_case_field_data",
|
||||
* revision_table = "oc_case_revision",
|
||||
* revision_data_table = "oc_case_field_revision",
|
||||
* translatable = TRUE,
|
||||
* admin_permission = "administer case entities",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "revision" = "vid",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "uuid" = "uuid",
|
||||
* "uid" = "user_id",
|
||||
* "langcode" = "langcode",
|
||||
* "status" = "status",
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/opencase/oc_case/{oc_case}",
|
||||
* "add-page" = "/opencase/oc_case/add",
|
||||
* "add-form" = "/opencase/oc_case/add/{oc_case_type}",
|
||||
* "edit-form" = "/opencase/oc_case/{oc_case}/edit",
|
||||
* "delete-form" = "/opencase/oc_case/{oc_case}/delete",
|
||||
* "version-history" = "/opencase/oc_case/{oc_case}/revisions",
|
||||
* "revision" = "/opencase/oc_case/{oc_case}/revisions/{oc_case_revision}/view",
|
||||
* "revision_revert" = "/opencase/oc_case/{oc_case}/revisions/{oc_case_revision}/revert",
|
||||
* "revision_delete" = "/opencase/oc_case/{oc_case}/revisions/{oc_case_revision}/delete",
|
||||
* "translation_revert" = "/opencase/oc_case/{oc_case}/revisions/{oc_case_revision}/revert/{langcode}",
|
||||
* "collection" = "/opencase/oc_case",
|
||||
* },
|
||||
* bundle_entity_type = "oc_case_type",
|
||||
* field_ui_base_route = "entity.oc_case_type.edit_form"
|
||||
* )
|
||||
*/
|
||||
class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
|
||||
|
||||
use EntityChangedTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
|
||||
parent::preCreate($storage_controller, $values);
|
||||
$values += [
|
||||
'user_id' => \Drupal::currentUser()->id(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function urlRouteParameters($rel) {
|
||||
$uri_route_parameters = parent::urlRouteParameters($rel);
|
||||
|
||||
if ($rel === 'revision_revert' && $this instanceof RevisionableInterface) {
|
||||
$uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
|
||||
}
|
||||
elseif ($rel === 'revision_delete' && $this instanceof RevisionableInterface) {
|
||||
$uri_route_parameters[$this->getEntityTypeId() . '_revision'] = $this->getRevisionId();
|
||||
}
|
||||
|
||||
return $uri_route_parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function preSave(EntityStorageInterface $storage) {
|
||||
parent::preSave($storage);
|
||||
|
||||
foreach (array_keys($this->getTranslationLanguages()) as $langcode) {
|
||||
$translation = $this->getTranslation($langcode);
|
||||
|
||||
// If no owner has been set explicitly, make the anonymous user the owner.
|
||||
if (!$translation->getOwner()) {
|
||||
$translation->setOwnerId(0);
|
||||
}
|
||||
}
|
||||
|
||||
// If no revision author has been set explicitly, make the oc_case owner the
|
||||
// revision author.
|
||||
if (!$this->getRevisionUser()) {
|
||||
$this->setRevisionUserId($this->getOwnerId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->get('name')->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->set('name', $name);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCreatedTime() {
|
||||
return $this->get('created')->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCreatedTime($timestamp) {
|
||||
$this->set('created', $timestamp);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOwner() {
|
||||
return $this->get('user_id')->entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOwnerId() {
|
||||
return $this->get('user_id')->target_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOwnerId($uid) {
|
||||
$this->set('user_id', $uid);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOwner(UserInterface $account) {
|
||||
$this->set('user_id', $account->id());
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isPublished() {
|
||||
return (bool) $this->getEntityKey('status');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPublished($published) {
|
||||
$this->set('status', $published ? TRUE : FALSE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
// not currently used. Will add form and view settings when ready
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
->setDescription(t('A boolean indicating whether the Case is published.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setDefaultValue(TRUE);
|
||||
|
||||
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Created by'))
|
||||
->setDescription(t('The user ID of author of the Case entity.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSetting('target_type', 'user')
|
||||
->setSetting('handler', 'default')
|
||||
->setTranslatable(TRUE)
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'author',
|
||||
'weight' => 80,
|
||||
]);
|
||||
$fields['name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Title'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'hidden',
|
||||
'type' => 'string',
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -100,
|
||||
])
|
||||
->setRequired(TRUE);
|
||||
|
||||
|
||||
$fields['files'] = BaseFieldDefinition::create('file')
|
||||
->setLabel(t('Files'))
|
||||
->setDescription(t('Files attached to this case'))
|
||||
->setSetting('file_directory', '[date:custom:Y]-[date:custom:m]')
|
||||
->setSetting('handler', 'default:file')
|
||||
->setSetting('file_extensions', 'txt jpg jpeg gif rtf xls xlsx doc swf png pdf docx csv')
|
||||
->setSetting('description_field', 'true')
|
||||
->setSetting('uri_scheme', 'private')
|
||||
->setCardinality(-1)
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'file_generic',
|
||||
'weight' => -1,
|
||||
'settings' => [
|
||||
'progress_indicator' => 'throbber',
|
||||
],
|
||||
])
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'settings' => ['use_description_as_link_text' => 'true']
|
||||
]);
|
||||
|
||||
$fields['created'] = BaseFieldDefinition::create('created')
|
||||
->setLabel(t('Created on'))
|
||||
->setDescription(t('When the case was created.'))
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'weight' => 80,
|
||||
]);
|
||||
|
||||
$fields['changed'] = BaseFieldDefinition::create('changed')
|
||||
->setLabel(t('Last updated'))
|
||||
->setDescription(t('When the case was last edited.'))
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'weight' => 80,
|
||||
]);
|
||||
|
||||
$fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Revision translation affected'))
|
||||
->setDescription(t('Indicates if the last edit of a translation belongs to current revision.'))
|
||||
->setReadOnly(TRUE)
|
||||
->setRevisionable(TRUE)
|
||||
->setTranslatable(TRUE);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
}
|
116
modules/opencase_cases/src/Entity/OCCaseInterface.php
Normal file
116
modules/opencase_cases/src/Entity/OCCaseInterface.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
use Drupal\Core\Entity\RevisionLogInterface;
|
||||
use Drupal\Core\Entity\EntityChangedInterface;
|
||||
use Drupal\user\EntityOwnerInterface;
|
||||
|
||||
/**
|
||||
* Provides an interface for defining Case entities.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
interface OCCaseInterface extends ContentEntityInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface {
|
||||
|
||||
// Add get/set methods for your configuration properties here.
|
||||
|
||||
/**
|
||||
* Gets the Case name.
|
||||
*
|
||||
* @return string
|
||||
* Name of the Case.
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Sets the Case name.
|
||||
*
|
||||
* @param string $name
|
||||
* The Case name.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setName($name);
|
||||
|
||||
/**
|
||||
* Gets the Case creation timestamp.
|
||||
*
|
||||
* @return int
|
||||
* Creation timestamp of the Case.
|
||||
*/
|
||||
public function getCreatedTime();
|
||||
|
||||
/**
|
||||
* Sets the Case creation timestamp.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* The Case creation timestamp.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setCreatedTime($timestamp);
|
||||
|
||||
/**
|
||||
* Returns the Case published status indicator.
|
||||
*
|
||||
* Unpublished Case are only visible to restricted users.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the Case is published.
|
||||
*/
|
||||
public function isPublished();
|
||||
|
||||
/**
|
||||
* Sets the published status of a Case.
|
||||
*
|
||||
* @param bool $published
|
||||
* TRUE to set this Case to published, FALSE to set it to unpublished.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setPublished($published);
|
||||
|
||||
/**
|
||||
* Gets the Case revision creation timestamp.
|
||||
*
|
||||
* @return int
|
||||
* The UNIX timestamp of when this revision was created.
|
||||
*/
|
||||
public function getRevisionCreationTime();
|
||||
|
||||
/**
|
||||
* Sets the Case revision creation timestamp.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* The UNIX timestamp of when this revision was created.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setRevisionCreationTime($timestamp);
|
||||
|
||||
/**
|
||||
* Gets the Case revision author.
|
||||
*
|
||||
* @return \Drupal\user\UserInterface
|
||||
* The user entity for the revision author.
|
||||
*/
|
||||
public function getRevisionUser();
|
||||
|
||||
/**
|
||||
* Sets the Case revision author.
|
||||
*
|
||||
* @param int $uid
|
||||
* The user ID of the revision author.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The called Case entity.
|
||||
*/
|
||||
public function setRevisionUserId($uid);
|
||||
|
||||
}
|
65
modules/opencase_cases/src/Entity/OCCaseType.php
Normal file
65
modules/opencase_cases/src/Entity/OCCaseType.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
|
||||
/**
|
||||
* Defines the Case type entity.
|
||||
*
|
||||
* @ConfigEntityType(
|
||||
* id = "oc_case_type",
|
||||
* label = @Translation("Case type"),
|
||||
* handlers = {
|
||||
* "access" = "Drupal\opencase_cases\OCCaseTypeAccessControlHandler",
|
||||
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
|
||||
* "list_builder" = "Drupal\opencase_cases\OCCaseTypeListBuilder",
|
||||
* "form" = {
|
||||
* "add" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||
* "edit" = "Drupal\opencase_cases\Form\OCCaseTypeForm",
|
||||
* "delete" = "Drupal\opencase_cases\Form\OCCaseTypeDeleteForm"
|
||||
* },
|
||||
* "route_provider" = {
|
||||
* "html" = "Drupal\opencase_cases\OCCaseTypeHtmlRouteProvider",
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_case_type",
|
||||
* admin_permission = "administer case bundles",
|
||||
* bundle_of = "oc_case",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "label" = "label",
|
||||
* "uuid" = "uuid"
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/admin/opencase/oc_case_type/{oc_case_type}",
|
||||
* "add-form" = "/admin/opencase/oc_case_type/add",
|
||||
* "edit-form" = "/admin/opencase/oc_case_type/{oc_case_type}/edit",
|
||||
* "delete-form" = "/admin/opencase/oc_case_type/{oc_case_type}/delete",
|
||||
* "collection" = "/admin/opencase/oc_case_type"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class OCCaseType extends ConfigEntityBundleBase implements OCCaseTypeInterface {
|
||||
|
||||
/**
|
||||
* The Case type ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The Case type label.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* Activity types that can be attached to this type of case.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $allowedActivityTypes;
|
||||
}
|
13
modules/opencase_cases/src/Entity/OCCaseTypeInterface.php
Normal file
13
modules/opencase_cases/src/Entity/OCCaseTypeInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
||||
/**
|
||||
* Provides an interface for defining Case type entities.
|
||||
*/
|
||||
interface OCCaseTypeInterface extends ConfigEntityInterface {
|
||||
|
||||
// Add get/set methods for your configuration properties here.
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities\Entity;
|
||||
namespace Drupal\opencase_cases\Entity;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
||||
/**
|
||||
* Provides Views data for Hat entities.
|
||||
* Provides Views data for Case entities.
|
||||
*/
|
||||
class HatViewsData extends EntityViewsData {
|
||||
class OCCaseViewsData extends EntityViewsData {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
15
modules/opencase_cases/src/Form/OCCaseDeleteForm.php
Normal file
15
modules/opencase_cases/src/Form/OCCaseDeleteForm.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
||||
/**
|
||||
* Provides a form for deleting Case entities.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseDeleteForm extends ContentEntityDeleteForm {
|
||||
|
||||
|
||||
}
|
71
modules/opencase_cases/src/Form/OCCaseForm.php
Normal file
71
modules/opencase_cases/src/Form/OCCaseForm.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Form controller for Case edit forms.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseForm extends ContentEntityForm {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
||||
if (!$this->entity->isNew()) {
|
||||
$form['new_revision'] = [
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Create new revision'),
|
||||
'#default_value' => FALSE,
|
||||
'#weight' => 10,
|
||||
];
|
||||
}
|
||||
|
||||
$entity = $this->entity;
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
$entity = $this->entity;
|
||||
|
||||
// Save as a new revision if requested to do so.
|
||||
if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) {
|
||||
$entity->setNewRevision();
|
||||
|
||||
// If a new revision is created, save the current user as revision author.
|
||||
$entity->setRevisionCreationTime(REQUEST_TIME);
|
||||
$entity->setRevisionUserId(\Drupal::currentUser()->id());
|
||||
}
|
||||
else {
|
||||
$entity->setNewRevision(FALSE);
|
||||
}
|
||||
|
||||
$status = parent::save($form, $form_state);
|
||||
|
||||
switch ($status) {
|
||||
case SAVED_NEW:
|
||||
drupal_set_message($this->t('Created the %label Case.', [
|
||||
'%label' => $entity->label(),
|
||||
]));
|
||||
break;
|
||||
|
||||
default:
|
||||
drupal_set_message($this->t('Saved the %label Case.', [
|
||||
'%label' => $entity->label(),
|
||||
]));
|
||||
}
|
||||
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $entity->id()]);
|
||||
}
|
||||
|
||||
}
|
123
modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php
Normal file
123
modules/opencase_cases/src/Form/OCCaseRevisionDeleteForm.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for deleting a Case revision.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionDeleteForm extends ConfirmFormBase {
|
||||
|
||||
|
||||
/**
|
||||
* The Case revision.
|
||||
*
|
||||
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
*/
|
||||
protected $revision;
|
||||
|
||||
/**
|
||||
* The Case storage.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityStorageInterface
|
||||
*/
|
||||
protected $OCCaseStorage;
|
||||
|
||||
/**
|
||||
* The database connection.
|
||||
*
|
||||
* @var \Drupal\Core\Database\Connection
|
||||
*/
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* Constructs a new OCCaseRevisionDeleteForm.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage
|
||||
* The entity storage.
|
||||
* @param \Drupal\Core\Database\Connection $connection
|
||||
* The database connection.
|
||||
*/
|
||||
public function __construct(EntityStorageInterface $entity_storage, Connection $connection) {
|
||||
$this->OCCaseStorage = $entity_storage;
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
$entity_manager = $container->get('entity.manager');
|
||||
return new static(
|
||||
$entity_manager->getStorage('oc_case'),
|
||||
$container->get('database')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'oc_case_revision_delete_confirm';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCancelUrl() {
|
||||
return new Url('entity.oc_case.version_history', ['oc_case' => $this->revision->id()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfirmText() {
|
||||
return t('Delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state, $oc_case_revision = NULL) {
|
||||
$this->revision = $this->OCCaseStorage->loadRevision($oc_case_revision);
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->OCCaseStorage->deleteRevision($this->revision->getRevisionId());
|
||||
|
||||
$this->logger('content')->notice('Case: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
|
||||
drupal_set_message(t('Revision from %revision-date of Case %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()]));
|
||||
$form_state->setRedirect(
|
||||
'entity.oc_case.canonical',
|
||||
['oc_case' => $this->revision->id()]
|
||||
);
|
||||
if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {oc_case_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) {
|
||||
$form_state->setRedirect(
|
||||
'entity.oc_case.version_history',
|
||||
['oc_case' => $this->revision->id()]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
149
modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php
Normal file
149
modules/opencase_cases/src/Form/OCCaseRevisionRevertForm.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for reverting a Case revision.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionRevertForm extends ConfirmFormBase {
|
||||
|
||||
|
||||
/**
|
||||
* The Case revision.
|
||||
*
|
||||
* @var \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
*/
|
||||
protected $revision;
|
||||
|
||||
/**
|
||||
* The Case storage.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityStorageInterface
|
||||
*/
|
||||
protected $OCCaseStorage;
|
||||
|
||||
/**
|
||||
* The date formatter service.
|
||||
*
|
||||
* @var \Drupal\Core\Datetime\DateFormatterInterface
|
||||
*/
|
||||
protected $dateFormatter;
|
||||
|
||||
/**
|
||||
* Constructs a new OCCaseRevisionRevertForm.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage
|
||||
* The Case storage.
|
||||
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
|
||||
* The date formatter service.
|
||||
*/
|
||||
public function __construct(EntityStorageInterface $entity_storage, DateFormatterInterface $date_formatter) {
|
||||
$this->OCCaseStorage = $entity_storage;
|
||||
$this->dateFormatter = $date_formatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('entity.manager')->getStorage('oc_case'),
|
||||
$container->get('date.formatter')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'oc_case_revision_revert_confirm';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCancelUrl() {
|
||||
return new Url('entity.oc_case.version_history', ['oc_case' => $this->revision->id()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfirmText() {
|
||||
return t('Revert');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state, $oc_case_revision = NULL) {
|
||||
$this->revision = $this->OCCaseStorage->loadRevision($oc_case_revision);
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
// The revision timestamp will be updated when the revision is saved. Keep
|
||||
// the original one for the confirmation message.
|
||||
$original_revision_timestamp = $this->revision->getRevisionCreationTime();
|
||||
|
||||
$this->revision = $this->prepareRevertedRevision($this->revision, $form_state);
|
||||
$this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]);
|
||||
$this->revision->save();
|
||||
|
||||
$this->logger('content')->notice('Case: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
|
||||
drupal_set_message(t('Case %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
|
||||
$form_state->setRedirect(
|
||||
'entity.oc_case.version_history',
|
||||
['oc_case' => $this->revision->id()]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a revision to be reverted.
|
||||
*
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $revision
|
||||
* The revision to be reverted.
|
||||
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
||||
* The current state of the form.
|
||||
*
|
||||
* @return \Drupal\opencase_cases\Entity\OCCaseInterface
|
||||
* The prepared revision ready to be stored.
|
||||
*/
|
||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||
$revision->setNewRevision();
|
||||
$revision->isDefaultRevision(TRUE);
|
||||
$revision->setRevisionCreationTime(REQUEST_TIME);
|
||||
|
||||
return $revision;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a form for reverting a Case revision for a single translation.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseRevisionRevertTranslationForm extends OCCaseRevisionRevertForm {
|
||||
|
||||
|
||||
/**
|
||||
* The language to be reverted.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $langcode;
|
||||
|
||||
/**
|
||||
* The language manager.
|
||||
*
|
||||
* @var \Drupal\Core\Language\LanguageManagerInterface
|
||||
*/
|
||||
protected $languageManager;
|
||||
|
||||
/**
|
||||
* Constructs a new OCCaseRevisionRevertTranslationForm.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage
|
||||
* The Case storage.
|
||||
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
|
||||
* The date formatter service.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
*/
|
||||
public function __construct(EntityStorageInterface $entity_storage, DateFormatterInterface $date_formatter, LanguageManagerInterface $language_manager) {
|
||||
parent::__construct($entity_storage, $date_formatter);
|
||||
$this->languageManager = $language_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('entity.manager')->getStorage('oc_case'),
|
||||
$container->get('date.formatter'),
|
||||
$container->get('language_manager')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'oc_case_revision_revert_translation_confirm';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state, $oc_case_revision = NULL, $langcode = NULL) {
|
||||
$this->langcode = $langcode;
|
||||
$form = parent::buildForm($form, $form_state, $oc_case_revision);
|
||||
|
||||
$form['revert_untranslated_fields'] = [
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Revert content shared among translations'),
|
||||
'#default_value' => FALSE,
|
||||
];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareRevertedRevision(OCCaseInterface $revision, FormStateInterface $form_state) {
|
||||
$revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields');
|
||||
|
||||
/** @var \Drupal\opencase_cases\Entity\OCCaseInterface $default_revision */
|
||||
$latest_revision = $this->OCCaseStorage->load($revision->id());
|
||||
$latest_revision_translation = $latest_revision->getTranslation($this->langcode);
|
||||
|
||||
$revision_translation = $revision->getTranslation($this->langcode);
|
||||
|
||||
foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) {
|
||||
if ($definition->isTranslatable() || $revert_untranslated_fields) {
|
||||
$latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
$latest_revision_translation->setNewRevision();
|
||||
$latest_revision_translation->isDefaultRevision(TRUE);
|
||||
$revision->setRevisionCreationTime(REQUEST_TIME);
|
||||
|
||||
return $latest_revision_translation;
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Class HatSettingsForm.
|
||||
* Class OCCaseSettingsForm.
|
||||
*
|
||||
* @ingroup zencrm_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class HatSettingsForm extends FormBase {
|
||||
class OCCaseSettingsForm extends FormBase {
|
||||
|
||||
/**
|
||||
* Returns a unique string identifying the form.
|
||||
@ -19,7 +19,7 @@ class HatSettingsForm extends FormBase {
|
||||
* The unique string identifying the form.
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'hat_settings';
|
||||
return 'occase_settings';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,7 +35,7 @@ class HatSettingsForm extends FormBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the settings form for Hat entities.
|
||||
* Defines the settings form for Case entities.
|
||||
*
|
||||
* @param array $form
|
||||
* An associative array containing the structure of the form.
|
||||
@ -46,7 +46,7 @@ class HatSettingsForm extends FormBase {
|
||||
* Form definition array.
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['hat_settings']['#markup'] = 'Settings form for Hat entities. Manage field settings here.';
|
||||
$form['occase_settings']['#markup'] = 'Settings form for Case entities. Manage field settings here.';
|
||||
return $form;
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities\Form;
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Builds the form to delete Hat type entities.
|
||||
* Builds the form to delete Case type entities.
|
||||
*/
|
||||
class HatTypeDeleteForm extends EntityConfirmFormBase {
|
||||
class OCCaseTypeDeleteForm extends EntityConfirmFormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -22,7 +22,7 @@ class HatTypeDeleteForm extends EntityConfirmFormBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCancelUrl() {
|
||||
return new Url('entity.hat_type.collection');
|
||||
return new Url('entity.oc_case_type.collection');
|
||||
}
|
||||
|
||||
/**
|
65
modules/opencase_cases/src/Form/OCCaseTypeForm.php
Normal file
65
modules/opencase_cases/src/Form/OCCaseTypeForm.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Class OCCaseTypeForm.
|
||||
*/
|
||||
class OCCaseTypeForm extends EntityForm {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, FormStateInterface $form_state) {
|
||||
$form = parent::form($form, $form_state);
|
||||
|
||||
$oc_case_type = $this->entity;
|
||||
$form['label'] = [
|
||||
'#type' => 'textfield',
|
||||
'#title' => $this->t('Label'),
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => $oc_case_type->label(),
|
||||
'#description' => $this->t("Label for the Case type."),
|
||||
'#required' => TRUE,
|
||||
];
|
||||
|
||||
$form['id'] = [
|
||||
'#type' => 'machine_name',
|
||||
'#default_value' => $oc_case_type->id(),
|
||||
'#machine_name' => [
|
||||
'exists' => '\Drupal\opencase_cases\Entity\OCCaseType::load',
|
||||
],
|
||||
'#disabled' => !$oc_case_type->isNew(),
|
||||
];
|
||||
|
||||
/* You will need additional form elements for your custom properties. */
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
$oc_case_type = $this->entity;
|
||||
$status = $oc_case_type->save();
|
||||
|
||||
switch ($status) {
|
||||
case SAVED_NEW:
|
||||
drupal_set_message($this->t('Created the %label Case type.', [
|
||||
'%label' => $oc_case_type->label(),
|
||||
]));
|
||||
break;
|
||||
|
||||
default:
|
||||
drupal_set_message($this->t('Saved the %label Case type.', [
|
||||
'%label' => $oc_case_type->label(),
|
||||
]));
|
||||
}
|
||||
$form_state->setRedirectUrl($oc_case_type->toUrl('collection'));
|
||||
}
|
||||
|
||||
}
|
55
modules/opencase_cases/src/OCCaseAccessControlHandler.php
Normal file
55
modules/opencase_cases/src/OCCaseAccessControlHandler.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\opencase_cases\CaseInvolvement;
|
||||
|
||||
/**
|
||||
* Access controller for the Case entity.
|
||||
*
|
||||
* @see \Drupal\opencase_cases\Entity\OCCase.
|
||||
*/
|
||||
class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
/** @var \Drupal\opencase_cases\Entity\OCCaseInterface $entity */
|
||||
switch ($operation) {
|
||||
case 'view':
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'view unpublished case entities');
|
||||
}
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('view published case entities')
|
||||
|| CaseInvolvement::userIsInvolved($account, $entity)
|
||||
);
|
||||
case 'update': // you can edit the case only if a) you can see it and b) you have the permission to edit cases.
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('edit case entities')
|
||||
&& ($account->hasPermission('view published case entities') || CaseInvolvement::userIsInvolved($account, $entity))
|
||||
);
|
||||
case 'delete': // you can delete the case only if a) you can see it and b) you have the permission to delete cases.
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('delete case entities')
|
||||
&& ($account->hasPermission('view published case entities') || CaseInvolvement::userIsInvolved($account, $entity))
|
||||
);
|
||||
}
|
||||
|
||||
// Unknown operation, no opinion.
|
||||
return AccessResult::neutral();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'add case entities');
|
||||
}
|
||||
|
||||
}
|
196
modules/opencase_cases/src/OCCaseHtmlRouteProvider.php
Normal file
196
modules/opencase_cases/src/OCCaseHtmlRouteProvider.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Provides routes for Case entities.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||
* @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||
*/
|
||||
class OCCaseHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoutes(EntityTypeInterface $entity_type) {
|
||||
$collection = parent::getRoutes($entity_type);
|
||||
|
||||
$entity_type_id = $entity_type->id();
|
||||
|
||||
if ($history_route = $this->getHistoryRoute($entity_type)) {
|
||||
$collection->add("entity.{$entity_type_id}.version_history", $history_route);
|
||||
}
|
||||
|
||||
if ($revision_route = $this->getRevisionRoute($entity_type)) {
|
||||
$collection->add("entity.{$entity_type_id}.revision", $revision_route);
|
||||
}
|
||||
|
||||
if ($revert_route = $this->getRevisionRevertRoute($entity_type)) {
|
||||
$collection->add("entity.{$entity_type_id}.revision_revert", $revert_route);
|
||||
}
|
||||
|
||||
if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) {
|
||||
$collection->add("entity.{$entity_type_id}.revision_delete", $delete_route);
|
||||
}
|
||||
|
||||
if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) {
|
||||
$collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route);
|
||||
}
|
||||
|
||||
if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) {
|
||||
$collection->add("$entity_type_id.settings", $settings_form_route);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the version history route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getHistoryRoute(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->hasLinkTemplate('version-history')) {
|
||||
$route = new Route($entity_type->getLinkTemplate('version-history'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_title' => "{$entity_type->getLabel()} revisions",
|
||||
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionOverview',
|
||||
])
|
||||
->setRequirement('_permission', 'access case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the revision route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getRevisionRoute(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->hasLinkTemplate('revision')) {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_controller' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionShow',
|
||||
'_title_callback' => '\Drupal\opencase_cases\Controller\OCCaseController::revisionPageTitle',
|
||||
])
|
||||
->setRequirement('_permission', 'access case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the revision revert route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->hasLinkTemplate('revision_revert')) {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision_revert'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertForm',
|
||||
'_title' => 'Revert to earlier revision',
|
||||
])
|
||||
->setRequirement('_permission', 'revert all case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the revision delete route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->hasLinkTemplate('revision_delete')) {
|
||||
$route = new Route($entity_type->getLinkTemplate('revision_delete'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionDeleteForm',
|
||||
'_title' => 'Delete earlier revision',
|
||||
])
|
||||
->setRequirement('_permission', 'delete all case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the revision translation revert route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->hasLinkTemplate('translation_revert')) {
|
||||
$route = new Route($entity_type->getLinkTemplate('translation_revert'));
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => '\Drupal\opencase_cases\Form\OCCaseRevisionRevertTranslationForm',
|
||||
'_title' => 'Revert to earlier revision of a translation',
|
||||
])
|
||||
->setRequirement('_permission', 'revert all case revisions')
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the settings form route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
|
||||
if (!$entity_type->getBundleEntityType()) {
|
||||
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
|
||||
$route
|
||||
->setDefaults([
|
||||
'_form' => 'Drupal\opencase_cases\Form\OCCaseSettingsForm',
|
||||
'_title' => "{$entity_type->getLabel()} settings",
|
||||
])
|
||||
->setRequirement('_permission', $entity_type->getAdminPermission())
|
||||
->setOption('_admin_route', TRUE);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityListBuilder;
|
||||
use Drupal\Core\Link;
|
||||
|
||||
/**
|
||||
* Defines a class to build a listing of Hat entities.
|
||||
* Defines a class to build a listing of Case entities.
|
||||
*
|
||||
* @ingroup zencrm_entities
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class HatListBuilder extends EntityListBuilder {
|
||||
class OCCaseListBuilder extends EntityListBuilder {
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['id'] = $this->t('Hat ID');
|
||||
$header['id'] = $this->t('Case ID');
|
||||
$header['name'] = $this->t('Name');
|
||||
return $header + parent::buildHeader();
|
||||
}
|
||||
@ -27,12 +27,12 @@ class HatListBuilder extends EntityListBuilder {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
/* @var $entity \Drupal\zencrm_entities\Entity\Hat */
|
||||
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
|
||||
$row['id'] = $entity->id();
|
||||
$row['name'] = Link::createFromRoute(
|
||||
$entity->label(),
|
||||
'entity.hat.edit_form',
|
||||
['hat' => $entity->id()]
|
||||
'entity.oc_case.edit_form',
|
||||
['oc_case' => $entity->id()]
|
||||
);
|
||||
return $row + parent::buildRow($entity);
|
||||
}
|
58
modules/opencase_cases/src/OCCaseStorage.php
Normal file
58
modules/opencase_cases/src/OCCaseStorage.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Defines the storage handler class for Case entities.
|
||||
*
|
||||
* This extends the base storage class, adding required special handling for
|
||||
* Case entities.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
class OCCaseStorage extends SqlContentEntityStorage implements OCCaseStorageInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function revisionIds(OCCaseInterface $entity) {
|
||||
return $this->database->query(
|
||||
'SELECT vid FROM {oc_case_revision} WHERE id=:id ORDER BY vid',
|
||||
[':id' => $entity->id()]
|
||||
)->fetchCol();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function userRevisionIds(AccountInterface $account) {
|
||||
return $this->database->query(
|
||||
'SELECT vid FROM {oc_case_field_revision} WHERE uid = :uid ORDER BY vid',
|
||||
[':uid' => $account->id()]
|
||||
)->fetchCol();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function countDefaultLanguageRevisions(OCCaseInterface $entity) {
|
||||
return $this->database->query('SELECT COUNT(*) FROM {oc_case_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()])
|
||||
->fetchField();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clearRevisionsLanguage(LanguageInterface $language) {
|
||||
return $this->database->update('oc_case_revision')
|
||||
->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED])
|
||||
->condition('langcode', $language->getId())
|
||||
->execute();
|
||||
}
|
||||
|
||||
}
|
61
modules/opencase_cases/src/OCCaseStorageInterface.php
Normal file
61
modules/opencase_cases/src/OCCaseStorageInterface.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\opencase_cases\Entity\OCCaseInterface;
|
||||
|
||||
/**
|
||||
* Defines the storage handler class for Case entities.
|
||||
*
|
||||
* This extends the base storage class, adding required special handling for
|
||||
* Case entities.
|
||||
*
|
||||
* @ingroup opencase_cases
|
||||
*/
|
||||
interface OCCaseStorageInterface extends ContentEntityStorageInterface {
|
||||
|
||||
/**
|
||||
* Gets a list of Case revision IDs for a specific Case.
|
||||
*
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
|
||||
* The Case entity.
|
||||
*
|
||||
* @return int[]
|
||||
* Case revision IDs (in ascending order).
|
||||
*/
|
||||
public function revisionIds(OCCaseInterface $entity);
|
||||
|
||||
/**
|
||||
* Gets a list of revision IDs having a given user as Case author.
|
||||
*
|
||||
* @param \Drupal\Core\Session\AccountInterface $account
|
||||
* The user entity.
|
||||
*
|
||||
* @return int[]
|
||||
* Case revision IDs (in ascending order).
|
||||
*/
|
||||
public function userRevisionIds(AccountInterface $account);
|
||||
|
||||
/**
|
||||
* Counts the number of revisions in the default language.
|
||||
*
|
||||
* @param \Drupal\opencase_cases\Entity\OCCaseInterface $entity
|
||||
* The Case entity.
|
||||
*
|
||||
* @return int
|
||||
* The number of revisions in the default language.
|
||||
*/
|
||||
public function countDefaultLanguageRevisions(OCCaseInterface $entity);
|
||||
|
||||
/**
|
||||
* Unsets the language for all Case with the given language.
|
||||
*
|
||||
* @param \Drupal\Core\Language\LanguageInterface $language
|
||||
* The language object.
|
||||
*/
|
||||
public function clearRevisionsLanguage(LanguageInterface $language);
|
||||
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\content_translation\ContentTranslationHandler;
|
||||
|
||||
/**
|
||||
* Defines the translation handler for hat.
|
||||
* Defines the translation handler for oc_case.
|
||||
*/
|
||||
class HatTranslationHandler extends ContentTranslationHandler {
|
||||
class OCCaseTranslationHandler extends ContentTranslationHandler {
|
||||
|
||||
// Override here the needed methods from ContentTranslationHandler.
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
||||
/**
|
||||
* Defines the access control handler for the OCCaseType Config Entity.
|
||||
* Always allows viewing the label of the bundle.
|
||||
*
|
||||
* @see Drupal\opencase_cases\Entity\OCCaseType
|
||||
*/
|
||||
class OCCaseTypeAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
protected $viewLabelOperation = TRUE;
|
||||
|
||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
if ($operation == 'view label') {
|
||||
return AccessResult::allowed();
|
||||
}
|
||||
return parent::checkAccess($entity, $operation, $account);
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Provides routes for Hat type entities.
|
||||
* Provides routes for Case type entities.
|
||||
*
|
||||
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
|
||||
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
|
||||
*/
|
||||
class HatTypeHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
class OCCaseTypeHtmlRouteProvider extends AdminHtmlRouteProvider {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm_entities;
|
||||
namespace Drupal\opencase_cases;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* Provides a listing of Case entity type entities.
|
||||
* Provides a listing of Case type entities.
|
||||
*/
|
||||
class CaseEntityTypeListBuilder extends ConfigEntityListBuilder {
|
||||
class OCCaseTypeListBuilder extends ConfigEntityListBuilder {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['label'] = $this->t('Case entity type');
|
||||
$header['label'] = $this->t('Case type');
|
||||
$header['id'] = $this->t('Machine name');
|
||||
return $header + parent::buildHeader();
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
* - link: A link to add a content entity of this type.
|
||||
* - description: A description of this content entity types/bundle.
|
||||
*
|
||||
* @see template_preprocess_hat_content_add_list()
|
||||
* @see template_preprocess_oc_case_content_add_list()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
38
modules/opencase_cases/templates/oc_case.html.twig
Normal file
38
modules/opencase_cases/templates/oc_case.html.twig
Normal file
@ -0,0 +1,38 @@
|
||||
{#
|
||||
/**
|
||||
* @file oc_case.html.twig
|
||||
* Default theme implementation to present Case data.
|
||||
*
|
||||
* This template is used when viewing Case pages.
|
||||
*
|
||||
*
|
||||
* Available variables:
|
||||
* - content: A list of content items. Use 'content' to print all content, or
|
||||
* - attributes: HTML attributes for the container element.
|
||||
*
|
||||
* @see template_preprocess_oc_case()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<div{{ attributes.addClass('oc_case') }}>
|
||||
<h2>{{ title }}</h2>
|
||||
<div class="oc_entity">
|
||||
<div class="left">
|
||||
{{ base_fields.actors_involved }}
|
||||
{{ base_fields.changed }}
|
||||
{{ base_fields.created }}
|
||||
{{ base_fields.user_id }}
|
||||
</div>
|
||||
<div class="right">
|
||||
{% for field in other_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="eva_fields">
|
||||
{% for field in eva_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!-- Add you custom twig html here -->
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.asylum_status
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: facet_asylum_status
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:asylum_status'
|
||||
settings:
|
||||
id: 'facet_block:asylum_status'
|
||||
label: 'Asylum Status'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: facet_asylum_status
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/opencase/reporting/clients'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.created
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: facet_created
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:created'
|
||||
settings:
|
||||
id: 'facet_block:created'
|
||||
label: 'Created Date'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: facet_created
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/opencase/reporting/clients'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.disability
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: facet_disability
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:disability'
|
||||
settings:
|
||||
id: 'facet_block:disability'
|
||||
label: 'Disability'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: facet_disability
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/opencase/reporting/clients'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.gender_identified_with
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: facet_gender_identified_with
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:gender_identified_with'
|
||||
settings:
|
||||
id: 'facet_block:gender_identified_with'
|
||||
label: 'Gender Identity'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: facet_gender_identified_with
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/opencase/reporting/clients'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.languages
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: facet_languages
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:languages'
|
||||
settings:
|
||||
id: 'facet_block:languages'
|
||||
label: 'Languages'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: facet_languages
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/opencase/reporting/clients'
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.involved_parties
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: involvedparties
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:involved_parties'
|
||||
settings:
|
||||
id: 'facet_block:involved_parties'
|
||||
label: 'Involved Parties'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: involvedparties
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: /opencase/reporting/cases
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.nationalities
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: nationalities
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:nationalities'
|
||||
settings:
|
||||
id: 'facet_block:nationalities'
|
||||
label: Nationalities
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: nationalities
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: /opencase/reporting/clients
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.osic_level
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
theme:
|
||||
- bartik
|
||||
id: osiclevel
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: 'facet_block:osic_level'
|
||||
settings:
|
||||
id: 'facet_block:osic_level'
|
||||
label: 'OSIC level'
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: osiclevel
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: /opencase/reporting/volunteers
|
||||
negate: false
|
||||
context_mapping: { }
|
@ -1,25 +1,29 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- facets.facet.outcome
|
||||
module:
|
||||
- facets
|
||||
- system
|
||||
- zencrm
|
||||
theme:
|
||||
- bartik
|
||||
id: casedetails
|
||||
id: outcome
|
||||
theme: bartik
|
||||
region: sidebar_second
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: case_details
|
||||
plugin: 'facet_block:outcome'
|
||||
settings:
|
||||
id: case_details
|
||||
label: 'Case Details'
|
||||
provider: zencrm
|
||||
id: 'facet_block:outcome'
|
||||
label: Outcome
|
||||
provider: facets
|
||||
label_display: visible
|
||||
block_id: outcome
|
||||
visibility:
|
||||
request_path:
|
||||
id: request_path
|
||||
pages: '/zencrm/case/*'
|
||||
pages: /opencase/reporting/cases
|
||||
negate: false
|
||||
context_mapping: { }
|
||||
|
@ -0,0 +1,47 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
- views.view.reporting_clients
|
||||
module:
|
||||
- search_api
|
||||
id: asylum_status
|
||||
name: 'Asylum status'
|
||||
url_alias: asylum_status
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: field_asylum_status
|
||||
facet_source_id: 'search_api:views_page__reporting_clients__page_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: false
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: 40
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
@ -0,0 +1,47 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
- views.view.reporting_clients
|
||||
module:
|
||||
- search_api
|
||||
id: asylum_status_export
|
||||
name: 'Asylum status'
|
||||
url_alias: asylum_status
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: field_asylum_status
|
||||
facet_source_id: 'search_api:views_data_export__reporting_clients__data_export_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: false
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: 40
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
@ -0,0 +1,67 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
- views.view.reporting_clients
|
||||
module:
|
||||
- search_api
|
||||
id: created
|
||||
name: Created
|
||||
url_alias: created
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: created
|
||||
facet_source_id: 'search_api:views_page__reporting_clients__page_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: true
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
active_widget_order:
|
||||
processor_id: active_widget_order
|
||||
weights:
|
||||
sort: -8
|
||||
settings:
|
||||
sort: DESC
|
||||
count_widget_order:
|
||||
processor_id: count_widget_order
|
||||
weights:
|
||||
sort: -9
|
||||
settings:
|
||||
sort: DESC
|
||||
date_item:
|
||||
processor_id: date_item
|
||||
weights:
|
||||
build: 35
|
||||
settings:
|
||||
date_display: actual_date
|
||||
granularity: 5
|
||||
date_format: ''
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: -10
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
@ -0,0 +1,67 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
module:
|
||||
- views_data_export
|
||||
id: created_export
|
||||
name: 'Created - Export'
|
||||
url_alias: created
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: created
|
||||
facet_source_id: 'search_api:views_data_export__reporting_clients__data_export_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: true
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
active_widget_order:
|
||||
processor_id: active_widget_order
|
||||
weights:
|
||||
sort: 20
|
||||
settings:
|
||||
sort: DESC
|
||||
count_widget_order:
|
||||
processor_id: count_widget_order
|
||||
weights:
|
||||
sort: 30
|
||||
settings:
|
||||
sort: DESC
|
||||
date_item:
|
||||
processor_id: date_item
|
||||
weights:
|
||||
build: 35
|
||||
settings:
|
||||
date_display: actual_date
|
||||
granularity: 5
|
||||
date_format: ''
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: 40
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
||||
|
@ -0,0 +1,47 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
- views.view.reporting_clients
|
||||
module:
|
||||
- search_api
|
||||
id: disability
|
||||
name: 'Disability'
|
||||
url_alias: disability
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: field_disability
|
||||
facet_source_id: 'search_api:views_page__reporting_clients__page_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: false
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: 40
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
@ -0,0 +1,47 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.opencase_reporting_clients
|
||||
- views.view.reporting_clients
|
||||
module:
|
||||
- search_api
|
||||
id: disability_export
|
||||
name: 'Disability'
|
||||
url_alias: disability
|
||||
weight: 0
|
||||
min_count: 0
|
||||
show_only_one_result: false
|
||||
field_identifier: field_disability
|
||||
facet_source_id: 'search_api:views_data_export__reporting_clients__data_export_1'
|
||||
widget:
|
||||
type: checkbox
|
||||
config:
|
||||
show_numbers: false
|
||||
soft_limit: 0
|
||||
soft_limit_settings:
|
||||
show_less_label: 'Show less'
|
||||
show_more_label: 'Show more'
|
||||
query_operator: or
|
||||
use_hierarchy: false
|
||||
expand_hierarchy: false
|
||||
enable_parent_when_child_gets_disabled: true
|
||||
hard_limit: 0
|
||||
exclude: false
|
||||
only_visible_when_facet_source_is_visible: true
|
||||
processor_configs:
|
||||
display_value_widget_order:
|
||||
processor_id: display_value_widget_order
|
||||
weights:
|
||||
sort: 40
|
||||
settings:
|
||||
sort: ASC
|
||||
url_processor_handler:
|
||||
processor_id: url_processor_handler
|
||||
weights:
|
||||
pre_query: 50
|
||||
build: 15
|
||||
settings: { }
|
||||
empty_behavior:
|
||||
behavior: none
|
||||
show_title: false
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user