Skip to content

Commit

Permalink
Version 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fneumann committed Feb 24, 2024
1 parent d827aba commit ab3fd81
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 30 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Change log

## Version 1.3 (upcoming)
- Applied code style of ILIAS 8
- unnumbered headlines schemes with one or three levels
- switch to allow browser spellcheck for writing a task
- fixed 0040291: Imagemagick error in edutiek on ubuntu 22.04
- fixed 0040150: pdf upload generates an error
- fixed 0040296: Missing German Translation in Participant Management // Supervision Log
Expand All @@ -10,8 +11,9 @@
- keep and exclude participant if writing hasn't started (prevent further access in tasks with instant participation)
- log entries are not yet created for addition
- fixed 0040304: format templates for hierarchizing headings should display the preview in the dropdown menu
- Applied code style of ILIAS 8

## Version 1.2 (2042-01-21)
## Version 1.2 (2024-01-21)
- fixed error with ascii control characters when written text is processed
- fixed juristic headline scheme
- added settings for processing written text (paragraph numbers, correction margins)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Please clear your browser cache after an update before you start the writing and

The plugin is published for ILIAS in different branches:

* **release1_ilias7** will receive bug fixes only
* **release1_ilias7** will receive bug fixes mainly
* **release2_ilias8** will be created by March 2024
* **main** is the current development branch. Please do not use it for production.

Expand Down
32 changes: 17 additions & 15 deletions classes/Corrector/class.CorrectorContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ public function getCorrectionTask(): CorrectionTask
*/
public function getCorrectionSettings(): CorrectionSettings
{
if (!empty($repoSettings = $this->localDI->getTaskRepo()->getCorrectionSettingsById($this->task->getTaskId()))) {
return new CorrectionSettings(
(bool) $repoSettings->getMutualVisibility(),
(bool) $repoSettings->getMultiColorHighlight(),
(int) $repoSettings->getMaxPoints(),
(float) $repoSettings->getMaxAutoDistance(),
(bool) $repoSettings->getStitchWhenDistance(),
(bool) $repoSettings->getStitchWhenDecimals(),
(string) $repoSettings->getPositiveRating(),
(string) $repoSettings->getNegativeRating()
);
}
return new CorrectionSettings(false, false, 0, 0, false, false, '', '');
$repoEditorSettings = $this->localDI->getTaskRepo()->getEditorSettingsById($this->task->getTaskId());
$repoCorrectionSettings = $this->localDI->getTaskRepo()->getCorrectionSettingsById($this->task->getTaskId());
return new CorrectionSettings(
(bool) $repoCorrectionSettings->getMutualVisibility(),
(bool) $repoCorrectionSettings->getMultiColorHighlight(),
(int) $repoCorrectionSettings->getMaxPoints(),
(float) $repoCorrectionSettings->getMaxAutoDistance(),
(bool) $repoCorrectionSettings->getStitchWhenDistance(),
(bool) $repoCorrectionSettings->getStitchWhenDecimals(),
(string) $repoCorrectionSettings->getPositiveRating(),
(string) $repoCorrectionSettings->getNegativeRating(),
(string) $repoEditorSettings->getHeadlineScheme()
);
}

/**
Expand Down Expand Up @@ -548,8 +548,10 @@ public function getCorrectorsOfItem(string $item_key): array
$currentCorrectorKey = $this->getCurrentCorrectorKey();

$add_others = true;
if (empty($correctionSettings = $this->localDI->getTaskRepo()->getCorrectionSettingsById($this->task->getTaskId()))
|| $correctionSettings->getMutualVisibility() == 0) {
if (!$this->object->canMaintainCorrectors() && (
empty($correctionSettings = $this->localDI->getTaskRepo()->getCorrectionSettingsById($this->task->getTaskId()))
|| $correctionSettings->getMutualVisibility() == 0)
) {
$add_others = false;
}

Expand Down
20 changes: 17 additions & 3 deletions classes/Data/Task/class.EditorSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
*/
class EditorSettings extends RecordData
{
const HEADLINE_SCHEME_NONE = 'none';
const HEADLINE_SCHEME_SINGLE = 'single';
const HEADLINE_SCHEME_THREE = 'three';
const HEADLINE_SCHEME_NUMERIC = 'numeric';
const HEADLINE_SCHEME_EDUTIEK = 'edutiek';

Expand All @@ -33,24 +34,37 @@ class EditorSettings extends RecordData
'add_paragraph_numbers' => 'integer',
'add_correction_margin' => 'integer',
'left_correction_margin' => 'integer',
'right_correction_margin' => 'integer'
'right_correction_margin' => 'integer',
'allow_spellcheck' => 'integer',
];

protected int $task_id;
protected string $headline_scheme = self::HEADLINE_SCHEME_NONE;
protected string $headline_scheme = self::HEADLINE_SCHEME_THREE;
protected string $formatting_options = self::FORMATTING_OPTIONS_MEDIUM;
protected int $notice_boards = 0;
protected int $copy_allowed = 0;
protected int $add_paragraph_numbers = 1;
protected int $add_correction_margin = 0;
protected int $left_correction_margin = 0;
protected int $right_correction_margin = 0;
protected int $allow_spellcheck = 0;

public function __construct(int $task_id)
{
$this->task_id = $task_id;
}

public function getAllowSpellcheck() : bool
{
return (bool) $this->allow_spellcheck;
}

public function setAllowSpellcheck(bool $allow_spellcheck) : self
{
$this->allow_spellcheck = (int) $allow_spellcheck;
return $this;
}

public static function model()
{
return new self(0);
Expand Down
11 changes: 9 additions & 2 deletions classes/Task/class.EditorSettingsGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ protected function editSettings()
$fields['headline_scheme'] = $factory->select(
$this->plugin->txt('headline_scheme'),
[
EditorSettings::HEADLINE_SCHEME_NONE => $this->plugin->txt('headline_scheme_none'),
EditorSettings::HEADLINE_SCHEME_SINGLE => $this->plugin->txt('headline_scheme_single'),
EditorSettings::HEADLINE_SCHEME_THREE => $this->plugin->txt('headline_scheme_three'),
EditorSettings::HEADLINE_SCHEME_NUMERIC => $this->plugin->txt('headline_scheme_numeric'),
EditorSettings::HEADLINE_SCHEME_EDUTIEK => $this->plugin->txt('headline_scheme_edutiek'),
]
],
$this->plugin->txt('headline_scheme_description')
)
->withRequired(true)
->withValue($editorSettings->getHeadlineScheme());
Expand Down Expand Up @@ -104,6 +106,10 @@ protected function editSettings()
$fields['copy_allowed'] = $factory->checkbox($this->plugin->txt('copy_allowed'), $this->plugin->txt('copy_allowed_info'))
->withValue($editorSettings->isCopyAllowed());

$fields['allow_spellcheck'] = $factory->checkbox($this->plugin->txt('allow_spellcheck'), $this->plugin->txt('allow_spellcheck_info'))
->withValue($editorSettings->getAllowSpellcheck());


$sections['editor'] = $factory->section($fields, $this->plugin->txt('editor_settings'));

// Processing
Expand Down Expand Up @@ -198,6 +204,7 @@ protected function editSettings()
$editorSettings->setFormattingOptions($data['editor']['formatting_options']);
$editorSettings->setNoticeBoards((int) $data['editor']['notice_boards']);
$editorSettings->setCopyAllowed((bool) $data['editor']['copy_allowed']);
$editorSettings->setAllowSpellcheck((bool) $data['editor']['allow_spellcheck']);

if (!$hasComments) {
$editorSettings->setAddParagraphNumbers((bool) $data['processing']['add_paragraph_numbers']);
Expand Down
12 changes: 12 additions & 0 deletions classes/class.BaseGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public function displayContent(?string $html) : string
{
if (!empty($settings = $this->localDI->getTaskRepo()->getEditorSettingsById($this->object->getId()))) {
switch ($settings->getHeadlineScheme()) {
case EditorSettings::HEADLINE_SCHEME_SINGLE:
$headline_class = "headlines-single";
break;
case EditorSettings::HEADLINE_SCHEME_THREE:
$headline_class = "headlines-three";
break;
case EditorSettings::HEADLINE_SCHEME_EDUTIEK:
$headline_class = "headlines-edutiek";
break;
Expand All @@ -163,6 +169,12 @@ public function addContentCss() : void

if (!empty($settings = $this->localDI->getTaskRepo()->getEditorSettingsById($this->object->getId()))) {
switch ($settings->getHeadlineScheme()) {
case EditorSettings::HEADLINE_SCHEME_SINGLE:
$this->tpl->addCss($this->plugin->getDirectory() .'/templates/css/headlines-single.css');
break;
case EditorSettings::HEADLINE_SCHEME_THREE:
$this->tpl->addCss($this->plugin->getDirectory() .'/templates/css/headlines-three.css');
break;
case EditorSettings::HEADLINE_SCHEME_EDUTIEK:
$this->tpl->addCss($this->plugin->getDirectory() .'/templates/css/headlines-edutiek.css');
break;
Expand Down
3 changes: 2 additions & 1 deletion classes/class.ServiceContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ public function getWritingSettings(): WritingSettings
$repoSettings->getAddParagraphNumbers(),
$repoSettings->getAddCorrectionMargin(),
$repoSettings->getLeftCorrectionMargin(),
$repoSettings->getRightCorrectionMargin()
$repoSettings->getRightCorrectionMargin(),
$repoSettings->getAllowSpellcheck()
);
}

Expand Down
10 changes: 7 additions & 3 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ task_solution#:#Lösungshinweise
task_solution_info#:#Die Lösungshinweise werden erst ab einem festgelegten Zeitpunkt oder am Ende angezeigt. Dieser wird unter „Organisation ► Lösungshinweise verfügbar“ aktiviert und konfiguriert. Zusätzliche Hinweise können als Datei oder Weblink unter "Material" bereitgestellt werden.
editor_settings#:#Schreiben der Aufgabe
headline_scheme#:#Überschriften-Schema
headline_scheme_none#:#Ohne Numerierung
headline_scheme_numeric#:#Numeriert: 1 ‧ 1.1 ‧ 1.1.1
headline_scheme_edutiek#:#Gutachten: A. ‧ I. ‧ 1. ‧ a. ‧ aa. ‧ (1)
headline_scheme_single#:#Eine Ebene, ohne Numerierung
headline_scheme_three#:#Drei Ebenen, ohne Numerierung
headline_scheme_numeric#:#Hierarchische Numerierung: 1 ‧ 1.1 ‧ 1.1.1 ‧ ...
headline_scheme_edutiek#:#Gutachten-Stil: A. ‧ I. ‧ 1. ‧ a. ‧ aa. ‧ (1)
headline_scheme_description#:#Bei drei Ebenen ohne Numerierung haben die Überschriften unterschiedliche Größe, sonst eine einheitliche.
formatting_options#:#Text-Formatierung
formatting_options_none#:#Aus
formatting_options_none_info#:#Keine Formatatierungs-Optionen
Expand All @@ -124,6 +126,8 @@ notice_boards#:#Notizbretter
notice_boards_info#:#Anzahl der zur Verfügung gestellten Notitzbretter
copy_allowed#:#Freies Kopieren erlauben
copy_allowed_info#:#Texte können auch von anderen Webseiten kopiert werden. Das Kopieren im Text und von den Notizbrettern ist immer erlaubt.
allow_spellcheck#:#Rechtschreibprüfung zulassen
allow_spellcheck_info#:#Beim Schreiben der Aufgabe wird eine Rechtschreibprüfung durch den Browser zugelassen.
add_resource#:#Material hinzufügen
lp_passed#:#Bestanden
lp_passed_info#:#Für Lernfortschritt und Vorbedingungen gilt diese Notenstufe als bestanden.
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$id = 'xlas';

// code version; must be changed for all code changes
$version = '1.2';
$version = '1.3';
// ilias min and max version; must always reflect the versions that should
// run with the plugin
$ilias_min_version = '7.25';
Expand Down
15 changes: 15 additions & 0 deletions sql/dbupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2036,4 +2036,19 @@
]);
$ilDB->addPrimaryKey('xlas_pdf_settings', ['task_id']);
}
?>
<#91>
<?php
$ilDB->manipulate("UPDATE xlas_editor_settings SET headline_scheme='three' WHERE headline_scheme='none'");
?>
<#92>
<?php
if (!$ilDB->tableColumnExists('xlas_editor_settings', 'allow_spellcheck')) {
$ilDB->addTableColumn('xlas_editor_settings', 'allow_spellcheck', [
'notnull' => '1',
'type' => 'integer',
'length' => '4',
'default' => '0'
]);
}
?>
49 changes: 47 additions & 2 deletions templates/css/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.mce-content-body, .long-essay-content {
font-family: serif;
font-size: 16px;
font-size: 1em;
max-width: 60em;
line-height: 150%;
}
Expand All @@ -14,7 +14,7 @@
.mce-content-body h4, .long-essay-content h4,
.mce-content-body h5, .long-essay-content h5,
.mce-content-body h6, .long-essay-content h6 {
font-size: 16px;
font-size: 1em;
font-weight: bold;
padding: 0;
margin-top: 0;
Expand All @@ -26,3 +26,48 @@
margin-left: 10px;
margin-bottom: 20px;
}

.mce-content-body li, .long-essay-content li {
margin-left: 20px;
margin-bottom: 5px;
}

.mce-content-body p, .long-essay-content p {
margin-top: 0;
margin-bottom: 10px;
}

.mce-content-body, .long-essay-content, .tox-menu {
counter-reset: h1 h2 h3 h4 h5 h6;
}
.mce-content-body h1, .long-essay-content h1, .tox-menu h1 {
counter-increment: h1;
counter-reset: h2 h3 h4 h5 h6;
}
.mce-content-body h2, .long-essay-content h2, .tox-menu h2 {
counter-increment: h2;
counter-reset: h3 h4 h5 h6;
}
.mce-content-body h3, .long-essay-content h3, .tox-menu h3 {
counter-increment: h3;
counter-reset: h4 h5 h6;
}
.mce-content-body h4, .long-essay-content h4, .tox-menu h4 {
counter-increment: h4;
counter-reset: h5 h6;
}
.mce-content-body h5, .long-essay-content h5, .tox-menu h5 {
counter-increment: h5;
counter-reset: h6;
}
.mce-content-body h6, .long-essay-content h6, .tox-menu h6 {
counter-increment: h6;
}

/*
Make font sizes in the tiny formats menu independent from changing font sizes in the content area
May be refined by headlines css files
*/
.tox-menu p, .tox-menu h1, .tox-menu h2, .tox-menu h3, .tox-menu h4, .tox-menu h5, .tox-menu h6, .tox-menu pre, .tox-menu li {
font-size:1em!important;
}
4 changes: 4 additions & 0 deletions templates/css/headlines-single.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Single Level headline style of written contents
*/

13 changes: 13 additions & 0 deletions templates/css/headlines-three.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Three level headline style of written contents
*/

.mce-content-body h1, .tox-menu h1, .headlines-three h1 {
font-size: 1.3em!important;
}
.mce-content-body h2, .tox-menu h2, .headlines-three h2 {
font-size: 1.15em!important;
}
.mce-content-body h3, .tox-menu h3, .headlines-three h3 {
font-size: 1.0em!important;
}

0 comments on commit ab3fd81

Please sign in to comment.