Skip to content

Commit a7cbc01

Browse files
committed
Add clean address. Modify views etc. Handle KLE taxonomies
1 parent 194c8fa commit a7cbc01

7 files changed

+264
-34
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Todo
1818
OS2web 1.0 migration
1919
- Use os2web_taxonomies field as kle_ref instead of os2web_cp_service_kle_ref.
2020
- Change dependency to os2web_taxonomies instead of old one.
21+
- Use os2web_base date only date format
2122

2223
Dependencies
2324
-----------

os2web_cp_service.context.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function os2web_cp_service_context_default_contexts() {
2727
);
2828
$context->reactions = array(
2929
'delta' => array(
30-
'delta_template' => 'os2web_theme_uden_h_jre_sidebar',
30+
'delta_template' => 'hide_second_sidebar',
3131
),
3232
);
3333
$context->condition_mode = 0;

os2web_cp_service.features.field.inc

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,119 @@
1010
function os2web_cp_service_field_default_fields() {
1111
$fields = array();
1212

13+
// Exported field: 'node-os2web_cp_service_cp_case-field_os2web_cp_service_address'.
14+
$fields['node-os2web_cp_service_cp_case-field_os2web_cp_service_address'] = array(
15+
'field_config' => array(
16+
'active' => '1',
17+
'cardinality' => '1',
18+
'deleted' => '0',
19+
'entity_types' => array(),
20+
'field_name' => 'field_os2web_cp_service_address',
21+
'foreign keys' => array(
22+
'format' => array(
23+
'columns' => array(
24+
'format' => 'format',
25+
),
26+
'table' => 'filter_format',
27+
),
28+
),
29+
'indexes' => array(
30+
'format' => array(
31+
0 => 'format',
32+
),
33+
),
34+
'locked' => '0',
35+
'module' => 'text',
36+
'settings' => array(
37+
'max_length' => '255',
38+
),
39+
'translatable' => '0',
40+
'type' => 'text',
41+
),
42+
'field_instance' => array(
43+
'bundle' => 'os2web_cp_service_cp_case',
44+
'default_value' => NULL,
45+
'deleted' => '0',
46+
'description' => '',
47+
'display' => array(
48+
'default' => array(
49+
'label' => 'above',
50+
'module' => 'text',
51+
'settings' => array(),
52+
'type' => 'text_default',
53+
'weight' => 22,
54+
),
55+
'related_block' => array(
56+
'label' => 'above',
57+
'settings' => array(),
58+
'type' => 'hidden',
59+
'weight' => 0,
60+
),
61+
'teaser' => array(
62+
'label' => 'above',
63+
'settings' => array(),
64+
'type' => 'hidden',
65+
'weight' => 0,
66+
),
67+
),
68+
'entity_type' => 'node',
69+
'field_name' => 'field_os2web_cp_service_address',
70+
'label' => 'Sagstitel',
71+
'required' => 0,
72+
'settings' => array(
73+
'better_formats' => array(
74+
'allowed_formats' => array(
75+
'blokindhold' => 'blokindhold',
76+
'filtered_html' => 'filtered_html',
77+
'full_html' => 'full_html',
78+
'php_code' => 'php_code',
79+
'plain_text' => 'plain_text',
80+
'raw' => 'raw',
81+
),
82+
'allowed_formats_toggle' => 0,
83+
'default_order_toggle' => 0,
84+
'default_order_wrapper' => array(
85+
'formats' => array(
86+
'blokindhold' => array(
87+
'weight' => '-7',
88+
),
89+
'filtered_html' => array(
90+
'weight' => '-10',
91+
),
92+
'full_html' => array(
93+
'weight' => '-9',
94+
),
95+
'php_code' => array(
96+
'weight' => '-6',
97+
),
98+
'plain_text' => array(
99+
'weight' => '-8',
100+
),
101+
'raw' => array(
102+
'weight' => '0',
103+
),
104+
),
105+
),
106+
),
107+
'linkit' => array(
108+
'enable' => 0,
109+
'insert_plugin' => '',
110+
),
111+
'text_processing' => '0',
112+
'user_register_form' => FALSE,
113+
),
114+
'widget' => array(
115+
'active' => 1,
116+
'module' => 'text',
117+
'settings' => array(
118+
'size' => '60',
119+
),
120+
'type' => 'text_textfield',
121+
'weight' => '39',
122+
),
123+
),
124+
);
125+
13126
// Exported field: 'node-os2web_cp_service_cp_case-field_os2web_cp_service_case_id'.
14127
$fields['node-os2web_cp_service_cp_case-field_os2web_cp_service_case_id'] = array(
15128
'field_config' => array(
@@ -2122,6 +2235,7 @@ function os2web_cp_service_field_default_fields() {
21222235
t('Sagsindhold');
21232236
t('Sagsnummer');
21242237
t('Sagsstatus - Sagstypebetegnelse');
2238+
t('Sagstitel');
21252239
t('Sagstype - Sagstype');
21262240
t('SystemID');
21272241
t('TriggerRules');

os2web_cp_service.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ features[ctools][] = page_manager:pages_default:1
3232
features[ctools][] = strongarm:strongarm:1
3333
features[ctools][] = views:views_default:3.0
3434
features[features_api][] = api:1
35+
features[field][] = node-os2web_cp_service_cp_case-field_os2web_cp_service_address
3536
features[field][] = node-os2web_cp_service_cp_case-field_os2web_cp_service_case_id
3637
features[field][] = node-os2web_cp_service_cp_case-field_os2web_cp_service_casetype
3738
features[field][] = node-os2web_cp_service_cp_case-field_os2web_cp_service_content

os2web_cp_service.module

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,29 @@ function os2web_cs_service_create_case(array $data) {
219219
break;
220220

221221
case 'taxonomy_term_reference':
222+
$choosen_term = NULL;
223+
224+
// Search of the term in KLE vocabulary.
225+
if (strpos($field['label'], 'KL emnenummer') !== FALSE) {
226+
// TODO: Use os2web_taxonomies_kle.
227+
$vocabulary = taxonomy_vocabulary_machine_name_load('kle');
228+
$terms = taxonomy_get_tree($vocabulary->vid);
229+
foreach ($terms as $term) {
230+
// Does the term start with the numbers xx.xx.xx.
231+
if (strpos($term->name, substr($data['fields'][$field['label']], 0, strpos($data['fields'][$field['label']], ' '))) !== FALSE) {
232+
$choosen_term = $term->name;
233+
break;
234+
}
235+
}
236+
}
237+
238+
// If non found, find in every vocabularies.
222239
// Retrieve the first occurance of the term.
223-
$term = array_pop(taxonomy_get_term_by_name((string) $data['fields'][$field['label']], NULL));
224-
if (!empty($term)) {
240+
if (empty($choosen_term)) {
241+
$choosen_term = array_pop(taxonomy_get_term_by_name((string) $data['fields'][$field['label']], NULL));
242+
}
243+
244+
if (!empty($choosen_term)) {
225245
// Note that if its an update of an existing node,
226246
// it will ńot be resat.
227247
$node->{$field_name}['und'][0]['tid'] = $term->tid;
@@ -783,6 +803,29 @@ function os2web_cp_service_form_os2web_settings_settings_form_alter(&$form, &$fo
783803
);
784804
}
785805

806+
/**
807+
* Implements hook_date_formats().
808+
*/
809+
function os2web_cp_service_date_formats() {
810+
return array(
811+
array(
812+
'type' => 'os2web_cp_service_date_only',
813+
'format' => 'Y',
814+
'locales' => array(),
815+
),
816+
);
817+
}
818+
/**
819+
* Implements hook_date_format_types().
820+
*/
821+
function os2web_cp_service_date_format_types() {
822+
// Define the core date format types.
823+
return array(
824+
'os2web_cp_service_date_only' => t('Date Only'),
825+
);
826+
827+
}
828+
786829
/**
787830
* Turns a mime type to its corresponding file ext.
788831
*

os2web_cp_service.pages_default.inc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,17 @@ function os2web_cp_service_default_page_manager_pages() {
245245
$pane = new stdClass();
246246
$pane->pid = 'new-1';
247247
$pane->panel = 'center';
248-
$pane->type = 'views_panes';
249-
$pane->subtype = 'os2web_cp_service_cp_case_search-panel_pane_1';
248+
$pane->type = 'custom';
249+
$pane->subtype = 'custom';
250250
$pane->shown = TRUE;
251251
$pane->access = array();
252-
$pane->configuration = array();
252+
$pane->configuration = array(
253+
'admin_title' => 'Beskrivende tekst',
254+
'title' => '',
255+
'body' => '<p>Søg i sagssystemet efter sager og dokumenter. Du kan søge efter specifikke ord i en angiven tidsinterval.</p>',
256+
'format' => 'filtered_html',
257+
'substitute' => TRUE,
258+
);
253259
$pane->cache = array();
254260
$pane->style = array(
255261
'settings' => NULL,
@@ -260,8 +266,26 @@ function os2web_cp_service_default_page_manager_pages() {
260266
$pane->locks = array();
261267
$display->content['new-1'] = $pane;
262268
$display->panels['center'][0] = 'new-1';
269+
$pane = new stdClass();
270+
$pane->pid = 'new-2';
271+
$pane->panel = 'center';
272+
$pane->type = 'views_panes';
273+
$pane->subtype = 'os2web_cp_service_cp_case_search-panel_pane_1';
274+
$pane->shown = TRUE;
275+
$pane->access = array();
276+
$pane->configuration = array();
277+
$pane->cache = array();
278+
$pane->style = array(
279+
'settings' => NULL,
280+
);
281+
$pane->css = array();
282+
$pane->extras = array();
283+
$pane->position = 1;
284+
$pane->locks = array();
285+
$display->content['new-2'] = $pane;
286+
$display->panels['center'][1] = 'new-2';
263287
$display->hide_title = PANELS_TITLE_FIXED;
264-
$display->title_pane = 'new-1';
288+
$display->title_pane = 'new-2';
265289
$handler->conf['display'] = $display;
266290
$page->default_handlers[$handler->name] = $handler;
267291
$pages['os2web_cp_service_cp_case_search_panel'] = $page;

0 commit comments

Comments
 (0)