Skip to content

Commit 844d733

Browse files
committed
add confirm dialog, add title for post blocks and change plugin name
1 parent 98d5e3f commit 844d733

4 files changed

Lines changed: 27 additions & 23 deletions

File tree

command/MigrateCoursewareCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,12 +799,13 @@ private function createBlock($block, $container)
799799
case 'PostBlock':
800800
// convert this to a TextBlock and put content into comments
801801
$block_type = 'text';
802-
$hint = 'Dies ist ein automatisch konvertierter Block des Typs "Kommentare &
802+
$title = '<h3>' . $block['fields']['post_title'] . '</h3>';
803+
$hint = '<p>Dies ist ein automatisch konvertierter Block des Typs "Kommentare &
803804
Diskussion". Um die vorhandenen Kommentare anzuzeigen, wählen Sie bitte
804805
links die Ansicht "Bearbeiten" und aktivieren Sie dann im Menü an diesem
805-
Block die Aktion "Kommentare anzeigen".';
806+
Block die Aktion "Kommentare anzeigen".</p>';
806807
$payload = array(
807-
'text' => $hint
808+
'text' => $title . $hint
808809
);
809810
$addBlock = true;
810811
break;

controllers/courseware.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,12 +745,13 @@ private function createBlock($block, $container)
745745
case 'PostBlock':
746746
// convert this to a TextBlock and put content into comments
747747
$block_type = 'text';
748-
$hint = 'Dies ist ein automatisch konvertierter Block des Typs "Kommentare &
748+
$title = '<h3>' . $block['fields']['post_title'] . '</h3>';
749+
$hint = '<p>Dies ist ein automatisch konvertierter Block des Typs "Kommentare &
749750
Diskussion". Um die vorhandenen Kommentare anzuzeigen, wählen Sie bitte
750751
links die Ansicht "Bearbeiten" und aktivieren Sie dann im Menü an diesem
751-
Block die Aktion "Kommentare anzeigen".';
752+
Block die Aktion "Kommentare anzeigen".</p>';
752753
$payload = array(
753-
'text' => $hint
754+
'text' => $title . $hint
754755
);
755756
$addBlock = true;
756757
break;

plugin.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pluginname=Courseware
1+
pluginname=Migration alter Courseware-Inhalte
22
pluginclassname=Courseware
33
origin=virtUOS
44
version=5.0.3

views/courseware/index.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,26 @@
7575
$('.state-done').hide();
7676
$('.state-error').hide();
7777
$('#migrate').on('click', function() {
78-
$('.state-idle').hide();
79-
$('.state-loading').show();
80-
$.ajax({
81-
url: STUDIP.ABSOLUTE_URI_STUDIP + 'plugins.php/courseware/courseware/migrate?cid=' + STUDIP.URLHelper.parameters.cid,
82-
type: 'POST',
83-
success: response => {
84-
$('.state-loading').hide();
85-
if (response.code === 200) {
86-
$('.state-done').show();
87-
} else {
88-
$('.state-error .error-message').html(response.error);
78+
STUDIP.Dialog.confirm('Möchten Sie die Migration wirklich starten?').done(function() {
79+
$('.state-idle').hide();
80+
$('.state-loading').show();
81+
$.ajax({
82+
url: STUDIP.ABSOLUTE_URI_STUDIP + 'plugins.php/courseware/courseware/migrate?cid=' + STUDIP.URLHelper.parameters.cid,
83+
type: 'POST',
84+
success: response => {
85+
$('.state-loading').hide();
86+
if (response.code === 200) {
87+
$('.state-done').show();
88+
} else {
89+
$('.state-error .error-message').html(response.error);
90+
$('.state-error').show();
91+
}
92+
},
93+
error: response => {
94+
$('.state-loading').hide();
8995
$('.state-error').show();
9096
}
91-
},
92-
error: response => {
93-
$('.state-loading').hide();
94-
$('.state-error').show();
95-
}
97+
});
9698
});
9799
});
98100

0 commit comments

Comments
 (0)