Skip to content

Commit 4fa68f2

Browse files
committed
fixes: according to change requests
1 parent 886fed0 commit 4fa68f2

10 files changed

+154
-38
lines changed

lang/ilias_de.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ workflow_config_panel_icon_with#:#Mit Konfigurationspanel
601601
workflow_config_panel_icon_without#:#Ohne Konfigurationspanel
602602
workflow_empty_select_option#:#--einen Workflow auswählen--
603603
workflow_description_section_header#:#Beschreibung
604-
workflow_configpanel_section_header#:#Konfigurationspanel
604+
workflow_configpanel_section_header#:#Einstellungen
605605
msg_startworkflow_no_workflow_seleced#:#Bitte wählen Sie zunächst einen Workflow aus
606606
msg_startworkflow_required_config_panel_item#:#Erforderliche Felder müssen Werte enthalten
607607
publication_usage_type_captions#:#Captions

lang/ilias_en.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ workflow_config_panel_icon_with#:#With Configuration Panel
602602
workflow_config_panel_icon_without#:#Without Configuration Panel
603603
workflow_empty_select_option#:#--Select a workflow--
604604
workflow_description_section_header#:#Description
605-
workflow_configpanel_section_header#:#Configuration Panel
605+
workflow_configpanel_section_header#:#Settings
606606
msg_startworkflow_no_workflow_seleced#:#Please select a workflow first
607607
msg_startworkflow_required_config_panel_item#:#Required fields must have values
608608
publication_usage_type_captions#:#Captions

src/Model/Workflow/WorkflowDBRepository.php

Lines changed: 102 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,41 @@ public function __construct()
2222
$this->api = $opencastContainer[API::class];
2323
}
2424

25+
/**
26+
* {@inheritdoc}
27+
*/
2528
public function anyWorkflowExists(): bool
2629
{
2730
return (WorkflowAR::count() > 0);
2831
}
2932

33+
/**
34+
* {@inheritdoc}
35+
*/
3036
public function anyWorkflowAvailable(): bool
3137
{
3238
return (count($this->getFilteredWorkflowsArray()) > 0);
3339
}
3440

41+
/**
42+
* {@inheritdoc}
43+
*/
3544
public function getAllWorkflows(): array
3645
{
3746
return WorkflowAR::get();
3847
}
3948

49+
/**
50+
* {@inheritdoc}
51+
*/
4052
public function getAllWorkflowsAsArray($key = null, $values = null): array
4153
{
4254
return WorkflowAR::getArray($key, $values);
4355
}
4456

57+
/**
58+
* {@inheritdoc}
59+
*/
4560
public function store(string $workflow_id, string $title, string $description,
4661
string $tags, string $config_panel, int $id = 0): void
4762
{
@@ -65,27 +80,42 @@ public function store(string $workflow_id, string $title, string $description,
6580
$workflow->store();
6681
}
6782

83+
/**
84+
* {@inheritdoc}
85+
*/
6886
public function exists(string $workflow_id): bool
6987
{
7088
return WorkflowAR::where(['workflow_id' => $workflow_id])->hasSets();
7189
}
7290

91+
/**
92+
* {@inheritdoc}
93+
*/
7394
public function delete($id): void
7495
{
7596
$workflow = WorkflowAR::find($id);
7697
$workflow->delete();
7798
}
7899

100+
/**
101+
* {@inheritdoc}
102+
*/
79103
public function getByWorkflowId(string $workflow_id)
80104
{
81105
return WorkflowAR::where(['workflow_id' => $workflow_id])->first();
82106
}
83107

108+
/**
109+
* {@inheritdoc}
110+
*/
84111
public function getById(int $id)
85112
{
86113
return WorkflowAR::where(['id' => $id])->first();
87114
}
88115

116+
/**
117+
* {@inheritdoc}
118+
*/
89119
public function getConfigPanelAsArrayById(string $id): array
90120
{
91121
$config_panel_array = [];
@@ -151,6 +181,9 @@ public function getConfigPanelAsArrayById(string $id): array
151181
return $config_panel_array;
152182
}
153183

184+
/**
185+
* {@inheritdoc}
186+
*/
154187
public function getWorkflowsFromOpencastApi(array $filter = [], bool $with_configuration_panel = false,
155188
bool $with_tags = false): array
156189
{
@@ -166,6 +199,9 @@ public function getWorkflowsFromOpencastApi(array $filter = [], bool $with_confi
166199
return $workflows;
167200
}
168201

202+
/**
203+
* {@inheritdoc}
204+
*/
169205
public function updateList(?string $tags_str = null): bool
170206
{
171207
$oc_workflows_all = $this->getWorkflowsFromOpencastApi([], true, true);
@@ -228,6 +264,9 @@ public function updateList(?string $tags_str = null): bool
228264
return $success;
229265
}
230266

267+
/**
268+
* {@inheritdoc}
269+
*/
231270
public function resetList(): bool
232271
{
233272
$oc_workflows_all = $this->getWorkflowsFromOpencastApi([], true, true);
@@ -268,6 +307,9 @@ public function resetList(): bool
268307
return $success;
269308
}
270309

310+
/**
311+
* {@inheritdoc}
312+
*/
271313
public function createOrUpdate(string $workflow_id, string $title, string $description, string $tags = '', string $config_panel = ''): WorkflowAR
272314
{
273315
$id = 0;
@@ -282,6 +324,12 @@ public function createOrUpdate(string $workflow_id, string $title, string $descr
282324
return $new_workflow;
283325
}
284326

327+
/**
328+
* Helper function to convert comma separated list string to array
329+
* @param string $comma_separated_str
330+
*
331+
* @return array
332+
*/
285333
private function commaToArray($comma_separated_str): array
286334
{
287335
$converted_list = [];
@@ -292,6 +340,14 @@ private function commaToArray($comma_separated_str): array
292340
return $converted_list;
293341
}
294342

343+
/**
344+
* Helper function to check if an array contains an item
345+
*
346+
* @param array $base
347+
* @param string|int $check
348+
*
349+
* @return bool
350+
*/
295351
private function hasItem($base, $check): bool
296352
{
297353
foreach ($base as $item) {
@@ -302,6 +358,9 @@ private function hasItem($base, $check): bool
302358
return false;
303359
}
304360

361+
/**
362+
* {@inheritdoc}
363+
*/
305364
public function getFilteredWorkflowsArray(
306365
array $workflows = [],
307366
?string $tags_str = null): array
@@ -353,11 +412,13 @@ public function getFilteredWorkflowsArray(
353412
return $filtered_list;
354413
}
355414

356-
public function buildWorkflowSelectOptions(): string
415+
416+
/**
417+
* {@inheritdoc}
418+
*/
419+
public function getWorkflowSelectionArray(): array
357420
{
358-
$options = [
359-
'<option value="">' . $this->translate('empty_select_option', 'workflow') . '</option>'
360-
];
421+
$workflow_selection_list = [];
361422
foreach ($this->getFilteredWorkflowsArray() as $workflow) {
362423
$title = $workflow->getTitle();
363424
$workflow_record_id = $workflow->getId();
@@ -370,11 +431,28 @@ public function buildWorkflowSelectOptions(): string
370431
if (empty($title)) {
371432
$title = $workflow_identifier;
372433
}
434+
$workflow_selection_list[$workflow_record_id] = $title;
435+
}
436+
return $workflow_selection_list;
437+
}
438+
439+
/**
440+
* {@inheritdoc}
441+
*/
442+
public function buildWorkflowSelectOptions(): string
443+
{
444+
$options = [
445+
'<option value="">' . $this->translate('empty_select_option', 'workflow') . '</option>'
446+
];
447+
foreach ($this->getWorkflowSelectionArray() as $workflow_record_id => $title) {
373448
$options[] = "<option value='{$workflow_record_id}'>{$title}</option>";
374449
}
375450
return implode("\n", $options);
376451
}
377452

453+
/**
454+
* {@inheritdoc}
455+
*/
378456
public function parseConfigPanels(): array
379457
{
380458
$config_panels = [];
@@ -388,6 +466,14 @@ public function parseConfigPanels(): array
388466
return $config_panels;
389467
}
390468

469+
/**
470+
* Helper function to extract, map and generate configuration panel elements received from opencast.
471+
*
472+
* @param string $workflow_id
473+
* @param string $configuration_panel_html
474+
*
475+
* @return string
476+
*/
391477
private function mapConfigPanelElements(string $workflow_id, string $configuration_panel_html): string
392478
{
393479
$dom = new \DOMDocument();
@@ -416,10 +502,10 @@ private function mapConfigPanelElements(string $workflow_id, string $configurati
416502
// Legends replacements. We need to legend to be displayed in there!
417503
foreach ($legends as $legend) {
418504
$text = $legend->textContent;
419-
$h3 = $dom->createElement('h3');
420-
$h3->textContent = $text;
505+
$em = $dom->createElement('em');
506+
$em->textContent = $text;
421507
$legend->setAttribute('class', 'hidden');
422-
$legend->parentNode->insertBefore($h3, $legend);
508+
$legend->parentNode->insertBefore($em, $legend);
423509
}
424510

425511
// Stylings and classes of ul li elements.
@@ -481,6 +567,9 @@ private function mapConfigPanelElements(string $workflow_id, string $configurati
481567
$input->setAttribute('name', $new_name);
482568
}
483569
$classes = ['wf-inputs'];
570+
if ($input->parentNode->tagName === 'li') {
571+
$classes[] = 'wf-list-inputs';
572+
}
484573
if ($input->hasAttribute('class')) {
485574
$classes[] = $input->getAttribute('class');
486575
}
@@ -573,12 +662,12 @@ private function mapConfigPanelElements(string $workflow_id, string $configurati
573662
}
574663
$label->nodeValue = $label_text;
575664

576-
$classes = ['control-label'];
577-
if ($label->parentNode->tagName !== 'li') {
578-
$classes[] = 'col-sm-3';
579-
$classes[] = 'configLabel';
580-
} else {
581-
$classes[] = 'configListLabel';
665+
$classes = [
666+
'wf-labels',
667+
'col-sm-4'
668+
];
669+
if ($label->parentNode->tagName == 'li') {
670+
$classes[] = 'wf-list-labels';
582671
}
583672
if ($label->hasAttribute('class')) {
584673
$classes[] = $label->getAttribute('class');

src/Model/Workflow/WorkflowRepository.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public function createOrUpdate(string $workflow_id, string $title, string $descr
6363
*/
6464
public function parseConfigPanels(): array;
6565

66+
/**
67+
* Generates the list of workflow selections in array form of key:value pairr
68+
* @return array
69+
*/
70+
public function getWorkflowSelectionArray(): array;
71+
6672
/**
6773
* @return string
6874
* @throws xoctException

src/UI/Modal/EventModals.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,17 @@ public function initWorkflows(): void
8080
// Descriptions.
8181
$description_section_tpl = new ilTemplate("tpl.startworkflow_description_section.html",
8282
true, true, $this->plugin->getDirectory());
83-
$description_section_tpl->setVariable('HEADER',
84-
$this->plugin->txt('workflow_description_section_header'));
8583
$description_blocks = [];
84+
$workflow_selection_array = $this->workflow_repository->getWorkflowSelectionArray();
8685
foreach ($this->workflow_repository->getFilteredWorkflowsArray() as $workflow) {
8786
$description_block_tpl = new ilTemplate("tpl.startworkflow_description_block.html",
8887
true, true, $this->plugin->getDirectory());
8988
$description = $workflow->getDescription();
9089
$id = $workflow->getId();
90+
$header = $workflow_selection_array[$id] ?? $this->plugin->txt('workflow_description_section_header');
9191
if (!empty(trim($description))) {
9292
$description_block_tpl->setVariable('BLOCK_ID', $id);
93+
$description_block_tpl->setVariable('HEADER', $header);
9394
$description_block_tpl->setVariable('DESCRIPTION_TEXT', $description);
9495
$description_blocks[] = $description_block_tpl->get();
9596
}

templates/default/startworkflow_modal.css

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
1+
.startworkflow-form {
2+
padding-left: 15px;
3+
padding-right: 15px;
4+
}
15
.startworkflow-form .wf-section {
26
border-top: 1px solid #e5e5e5;
3-
padding: 10px 20px 0 20px;
4-
}
5-
.startworkflow-form .wf-section .wf-section-header {
6-
font-weight: 600;
7+
padding-top: 10px;
78
}
89
.startworkflow-form .wf-section:last-of-type {
9-
margin-top: 20px;
10+
margin-top: 10px;
11+
}
12+
.startworkflow-form input[type="radio"],.startworkflow-form input[type="checkbox"] {
13+
width: auto;
1014
}
11-
.startworkflow-form .configField {
12-
width: auto !important;
15+
.startworkflow-form input:not([type="radio"], [type="checkbox"]) {
16+
min-width: 180px;
17+
}
18+
.startworkflow-form .wf-inputs {
1319
height: 25px;
1420
font-size: 12px;
1521
color: #161616;
1622
border: 1px solid #757575;
1723
border-radius: 0;
24+
margin-right: 5px !important;
25+
margin-top: 0px !important;
1826
}
1927

20-
.startworkflow-form .configLabel {
21-
width: 175px;
28+
.startworkflow-form .wf-labels {
29+
text-align: left !important;
30+
padding-left: 0 !important;
31+
padding-right: 0 !important;
32+
margin-bottom: 0 !important;
33+
padding-bottom: 4px;
34+
padding-top: 4px;
35+
min-width: 175px;
36+
37+
}
38+
.startworkflow-form ul {
39+
padding: 0 !important;
2240
}
2341
.startworkflow-form ul li {
2442
align-items: center;
2543
}
26-
.startworkflow-form ul li .configField {
27-
margin: 0;
44+
45+
.startworkflow-form ul li input[type="radio"].wf-list-inputs,.startworkflow-form input[type="checkbox"].wf-list-inputs {
46+
flex-grow: 0;
2847
}
29-
.startworkflow-form ul li label.configListLabel {
30-
margin-left: 10px;
31-
margin-right: 10px;
32-
margin-top: 4px;
33-
text-align: justify;
34-
min-width: 175px;
48+
49+
.startworkflow-form ul li input[type="radio"].wf-list-inputs + .wf-list-labels,.startworkflow-form input[type="checkbox"].wf-list-inputs + .wf-list-labels{
50+
flex-grow: 1;
51+
}
52+
53+
.startworkflow-form ul ul {
54+
margin: 0.8em 0 !important;
3555
}
3656
.startworkflow-form .submit-btn {
3757
display: none;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div class="wf-section workflows-configpanel-section hidden">
2-
<h4 class="wf-section-header">{HEADER}</h4>
2+
<strong>{HEADER}</strong>
33
{BLOCK_CONTENT}
44
</div>

0 commit comments

Comments
 (0)