Skip to content

Commit

Permalink
Merge branch 'release_10' of https://github.com/ILIAS-eLearning/ILIAS
Browse files Browse the repository at this point in the history
…into release_10
  • Loading branch information
alex40724 committed Nov 5, 2024
2 parents a34fc14 + b2f15d2 commit 2272870
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 53 deletions.
8 changes: 4 additions & 4 deletions components/ILIAS/Session/classes/class.ilObjSessionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ public static function _goto(string $a_target): void
*/
public function infoScreenObject(): void
{
// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
// $this->ctrl->setCmd("showSummary");
// $this->ctrl->setCmdClass("ilinfoscreengui");
$this->infoScreen();
$this->ctrl->redirectByClass(
[self::class, ilInfoScreenGUI::class],
'showSummary'
);
}

public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path): void
Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/Skill/Node/class.SkillDeletionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function deleteTree(int $node_id): void

public function deleteNode(int $node_id, \ilSkillTree $tree = null): void
{
if ($node_id != \ilTree::POS_FIRST_NODE) {
if ($node_id != \ilTree::POS_FIRST_NODE || $node_id !== 0) {
if (!$tree) {
$tree = $this->tree_repo->getTreeForNodeId($node_id);
}
Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/Table/resources/ServiceTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ilInitTableFilters()
filtrs = document.getElementsByClassName('ilTableFilterSec');
for (var i = 0; i < filtrs.length; i++)
{
if (ilTableHideFilter[filtrs[i].id] === 1)
if (ilTableHideFilter[filtrs[i].id] == 1)
{
filtrs[i].style.display = 'none';
}
Expand All @@ -25,7 +25,7 @@ function ilInitTableFilters()
filactvtrs = document.getElementsByClassName('ilTableFilterActivator');
for (var i = 0; i < filactvtrs.length; i++)
{
if (ilTableHideFilter[filactvtrs[i].id] === 1)
if (ilTableHideFilter[filactvtrs[i].id] == 1)
{
filactvtrs[i].style.display = '';
}
Expand All @@ -39,7 +39,7 @@ function ilInitTableFilters()
fildctvtrs = document.getElementsByClassName('ilTableFilterDeactivator');
for (var i = 0; i < fildctvtrs.length; i++)
{
if (ilTableHideFilter[fildctvtrs[i].id] === 1)
if (ilTableHideFilter[fildctvtrs[i].id] == 1)
{
fildctvtrs[i].style.display = 'none';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,20 +735,23 @@ protected function populateNumericGapFormPart($form, $gap, $gapCounter): ilPrope
*/
public function createGaps(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->object->saveToDb();
$this->editQuestion();
}

public function removegap(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->object->deleteAnswerText($this->gapIndex, key($_POST['cmd']['removegap_' . $this->gapIndex]));
$this->editQuestion();
}

public function addgap(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->object->addGapAnswer($this->gapIndex, key($_POST['cmd']['addgap_' . $this->gapIndex]) + 1, "");
$this->editQuestion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form): ilPro
*/
public function analyze(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->saveTaxonomyAssignments();
$this->object->setErrorsFromParsedErrorText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ protected function setQuestionSpecificTabs(ilTabsGUI $ilTabs): void

public function suggestRange(): void
{
$this->setAdditionalContentEditingModeFromPost();
$suggest_range_for_result = $this->request->string('suggest_range_for');
if ($this->writePostData()) {
$this->tpl->setOnScreenMessage('info', $this->getErrorMessage());
Expand Down Expand Up @@ -761,6 +762,7 @@ private function canUseAdvancedRating($result): bool

public function parseQuestion(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData();
$this->addSaveOnEnterOnLoadCode();
$this->setTestSpecificProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function editQuestion(

protected function uploadImage(): void
{
$this->setAdditionalContentEditingModeFromPost();
$result = $this->writePostData(true);

if ($result == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ public function writeQuestionSpecificPostData(ilPropertyFormGUI $form): void

public function uploadterms(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->editQuestion();
}

public function removeimageterms(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST['cmd']['removeimageterms']);
$this->object->removeTermImage($position);
Expand All @@ -214,12 +216,14 @@ public function removeimageterms(): void

public function uploaddefinitions(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->editQuestion();
}

public function removeimagedefinitions(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST['cmd']['removeimagedefinitions']);
$this->object->removeDefinitionImage($position);
Expand All @@ -228,6 +232,7 @@ public function removeimagedefinitions(): void

public function addterms(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["addterms"]);
$this->object->insertTerm($position + 1);
Expand All @@ -236,6 +241,7 @@ public function addterms(): void

public function removeterms(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["removeterms"]);
$this->object->deleteTerm($position);
Expand All @@ -244,6 +250,7 @@ public function removeterms(): void

public function adddefinitions(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["adddefinitions"]);
$this->object->insertDefinition($position + 1);
Expand All @@ -252,6 +259,7 @@ public function adddefinitions(): void

public function removedefinitions(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["removedefinitions"]);
$this->object->deleteDefinition($position);
Expand All @@ -260,6 +268,7 @@ public function removedefinitions(): void

public function addpairs(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["addpairs"]);
$this->object->insertMatchingPair($position + 1);
Expand All @@ -268,6 +277,7 @@ public function addpairs(): void

public function removepairs(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($_POST["cmd"]["removepairs"]);
$this->object->deleteMatchingPair($position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use ILIAS\TestQuestionPool\Questions\QuestionLMExportable;
use ILIAS\TestQuestionPool\Questions\QuestionAutosaveable;
use ILIAS\TestQuestionPool\ManipulateImagesInChoiceQuestionsTrait;

use ILIAS\Test\Logging\AdditionalInformationGenerator;

/**
Expand All @@ -47,7 +46,7 @@ class assMultipleChoice extends assQuestion implements ilObjQuestionScoringAdjus
public const OUTPUT_RANDOM = 1;

public array $answers = [];
public bool $is_singleline = false;
public bool $is_singleline = true;
public int $feedback_setting = 0;
protected ?int $selection_limit = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,38 @@ public function addBasicQuestionFormProperties(ilPropertyFormGUI $form): void
$form->getItemByPostVar('question')->setInitialRteWidth('100');
}

/**
* Upload an image
*/
public function uploadchoice(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$this->editQuestion();
}

/**
* Remove an image
*/
public function removeimagechoice(): void
{
$this->setAdditionalContentEditingModeFromPost();
$this->writePostData(true);
$position = key($this->request->raw('cmd')['removeimagechoice']);
$this->object->removeAnswerImage($position);
$this->editQuestion();
}

public function addchoice(): void
{
$this->writePostData(true);
$position = key($this->request->raw('cmd')['addchoice']);
$this->object->addAnswer("", 0, $position + 1);
$this->editQuestion();
}

public function removechoice(): void
{
$this->writePostData(true);
$position = key($this->request->raw('cmd')['removechoice']);
$this->object->deleteAnswer($position);
$this->editQuestion();
}

public function getSolutionOutput(
int $active_id,
?int $pass = null,
Expand Down
36 changes: 21 additions & 15 deletions components/ILIAS/TestQuestionPool/classes/class.assQuestionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function getHeaderAction(): string
return $ha->getHeaderAction($this->ui->mainTemplate());
}

public function geCommentsPanelHTML(): string
public function getCommentsPanelHTML(): string
{
$comment_gui = new ilCommentGUI($this->object->getObjId(), $this->object->getId(), 'quest');
return $comment_gui->getListHTML();
Expand Down Expand Up @@ -691,6 +691,7 @@ public function syncQuestion(): void
public function saveReturn(): void
{
$old_id = $this->request->getQuestionId();
$this->setAdditionalContentEditingModeFromPost();
$result = $this->writePostData();
if ($result == 0) {
$this->object->getCurrentUser()->setPref("tst_lastquestiontype", $this->object->getQuestionType());
Expand All @@ -712,6 +713,7 @@ public function saveReturn(): void

public function saveQuestion(): bool
{
$this->setAdditionalContentEditingModeFromPost();
$result = $this->writePostData();

if ($result !== 0) {
Expand All @@ -737,12 +739,13 @@ public function saveQuestion(): bool
return true;
}

public function apply(): void
public function setAdditionalContentEditingModeFromPost(): void
{
$this->writePostData();
$this->object->saveToDb();
$this->ctrl->setParameter($this, 'q_id', $this->object->getId());
$this->editQuestion();
$additional_content_editing_mode = $this->request->retrieveStringValueFromPost('additional_content_editing_mode');
if ($additional_content_editing_mode !== null
&& in_array($additional_content_editing_mode, $this->object->getValidAdditionalContentEditingModes())) {
$this->object->setAdditionalContentEditingMode($additional_content_editing_mode);
}
}

protected function setTestSpecificProperties(): void
Expand Down Expand Up @@ -840,29 +843,28 @@ public function addQuestionFormCommandButtons(ilPropertyFormGUI $form): void

public function addBasicQuestionFormProperties(ilPropertyFormGUI $form): void
{
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setMaxLength(100);
$title->setValue($this->object->getTitle());
$title->setRequired(true);
$form->addItem($title);

if (!$this->object->getSelfAssessmentEditingMode()) {
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author = new ilTextInputGUI($this->lng->txt('author'), 'author');
$author->setValue($this->object->getAuthor());
$author->setMaxLength(512);
$author->setRequired(true);
$form->addItem($author);

// description
$description = new ilTextInputGUI($this->lng->txt("description"), "comment");
$description = new ilTextInputGUI($this->lng->txt('description'), 'comment');
$description->setValue($this->object->getComment());
$description->setRequired(false);
$form->addItem($description);
} else {
// author as hidden field
$hi = new ilHiddenInputGUI("author");
$hi = new ilHiddenInputGUI('author');
$author = ilLegacyFormElementsUtil::prepareFormOutput($this->object->getAuthor());
if (trim($author) == "") {
$author = "-";
Expand All @@ -878,7 +880,7 @@ public function addBasicQuestionFormProperties(ilPropertyFormGUI $form): void
$form->addItem($lifecycle);

// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question = new ilTextAreaInputGUI($this->lng->txt('question'), 'question');
$question->setValue($this->object->getQuestion());
$question->setRequired(true);
$question->setRows(10);
Expand All @@ -887,13 +889,14 @@ public function addBasicQuestionFormProperties(ilPropertyFormGUI $form): void
if (!$this->object->getSelfAssessmentEditingMode()) {
if ($this->object->getAdditionalContentEditingMode() !== assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_IPE) {
$question->setUseRte(true);
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$question->setRTESupport($this->object->getId(), "qpl", "assessment");
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags('assessment'));
$question->setRTESupport($this->object->getId(), 'qpl', 'assessment');
}
} else {
$question->setRteTags(ilAssSelfAssessmentQuestionFormatter::getSelfAssessmentTags());
$question->setUseTagsForRteOnly(false);
}
$form->addItem($question);

$question_type = new ilHiddenInputGUI('question_type');
$question_type->setValue((string) $this->getQuestionType());
Expand All @@ -917,7 +920,10 @@ public function addBasicQuestionFormProperties(ilPropertyFormGUI $form): void
$form->addItem($move_after_question_id);
}

$form->addItem($question);
$additional_content_editing_mode = new ilHiddenInputGUI('additional_content_editing_mode');
$additional_content_editing_mode->setValue($this->object->getAdditionalContentEditingMode());
$form->addItem($additional_content_editing_mode);

$this->addNumberOfTriesToFormIfNecessary($form);
}

Expand Down
Loading

1 comment on commit 2272870

@alex40724
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.