Skip to content

Commit

Permalink
Merge branch 'release_9' of https://github.com/ILIAS-eLearning/ILIAS
Browse files Browse the repository at this point in the history
…into feature/dashboard-co-page
  • Loading branch information
iszmais committed Oct 24, 2024
2 parents 75deece + 3a38e66 commit d298ccc
Show file tree
Hide file tree
Showing 337 changed files with 4,817 additions and 3,324 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/legacy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
type: choice
options:
- trunk
- release_8
- release_9
permissions:
contents: read
pull-requests: read
Expand All @@ -34,7 +34,7 @@ jobs:
uses: php-actions/composer@v6
with:
php_version: 8.1
args: --no-interaction --no-progress --ignore-platform-reqs --no-scripts
args: --no-interaction --no-progress --ignore-platform-reqs

- name: 'PHStan Custom Rules'
run: CI/PHPStan/run_legacy_ui_report.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style-to-repo_trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and deploy style files
on:
push:
branches:
- "trunk"
- "release_9"

jobs:
style-to-repo:
Expand Down
2 changes: 1 addition & 1 deletion CI/PHP-CS-Fixer/code-format.php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ return (new PhpCsFixer\Config())
'strict_param' => false,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'function_typehint_space' => true,
'type_declaration_spaces' => true,
'function_declaration' => ['closure_fn_spacing' => 'none'],
'binary_operator_spaces' => ['default' => 'single_space'],
// 'types_spaces' => ['space' => 'single'],
Expand Down
2 changes: 2 additions & 0 deletions CI/Style-To-Repo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ STYLE_REPO_NAME_SHORT="foo/style_test.git"

### Add a token for an user with admin access to style repository

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic

- open settings for the user on github
- click 'Developer settings/Personal access tokens/Tokens (classic)'
- click 'Generate new token (classic)'
Expand Down
6 changes: 6 additions & 0 deletions CI/Style-To-Repo/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,10 @@ function deploy() {
git -C ${DEPLOY_BASE_FOLDER} commit -m "Style changes from '${HASH}'" -m "Original message: '${MSG}'" -m "${URL}"
git -C ${DEPLOY_BASE_FOLDER} push origin ${BRANCH}
fi
if [ $? = 0 ] ; then
echo "[${NOW}] remote repo updated."
else
echo "[${NOW}] git commit/push failed."
exit $?
fi
}
6 changes: 4 additions & 2 deletions Modules/Bibliographic/classes/class.ilObjBibliographic.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public function __construct(int $existant_bibl_id = 0)
*/
private function handleUpload(): ?\ILIAS\ResourceStorage\Identification\ResourceIdentification
{
$this->upload_service->process();
if (!$this->upload_service->hasBeenProcessed()) {
$this->upload_service->process();
}
$array_result = $this->upload_service->getResults();
$result = reset($array_result); // FileUpload is the first element
if (!$result->isOK()) {
Expand All @@ -114,7 +116,7 @@ private function handleUpload(): ?\ILIAS\ResourceStorage\Identification\Resource
* @param bool $clone_mode*/
protected function doCreate(bool $clone_mode = false): void
{
if ($this->upload_service->hasUploads() && !$this->upload_service->hasBeenProcessed()) {
if ($this->upload_service->hasUploads()) {
$this->setResourceId($this->handleUpload());
}

Expand Down
131 changes: 0 additions & 131 deletions Modules/Blog/Exercise/class.ilBlogExerciseGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,137 +76,6 @@ public function executeCommand(): void
}
}

/*
public static function checkExercise(
int $a_node_id
): string {
$be = new ilBlogExercise($a_node_id);
$info = [];
foreach ($be->getAssignmentsOfBlog() as $ass) {
$part = self::getExerciseInfo($ass["ass_id"]);
if ($part) {
$info[] = $part;
}
}
if (count($info) > 0) {
return implode("<br />", $info);
}
return "";
}*/

/*
protected static function getExerciseInfo(
int $a_assignment_id
): string {
global $DIC;
$ui = $DIC->ui();
$links = [];
$buttons = [];
$elements = [];
$items = [];
$lng = $DIC->language();
$ilCtrl = $DIC->ctrl();
$ilUser = $DIC->user();
$ass = new ilExAssignment($a_assignment_id);
$exercise_id = $ass->getExerciseId();
if (!$exercise_id) {
return "";
}
// is the assignment still open?
$times_up = $ass->afterDeadlineStrict();
// exercise goto
$exc_ref_id = current(ilObject::_getAllReferences($exercise_id));
$exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
$text = sprintf(
$lng->txt("blog_exercise_info"),
$ass->getTitle(),
ilObject::_lookupTitle($exercise_id)
);
$links[] = $ui->factory()->link()->standard(ilObject::_lookupTitle($exercise_id), $exc_link);
// submit button
if (!$times_up) {
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
$submit_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "finalize");
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
$buttons[] = $ui->factory()->button()->primary($lng->txt("blog_finalize_blog"), $submit_link);
}
// submitted files
$submission = new ilExSubmission($ass, $ilUser->getId());
if ($submission->hasSubmitted()) {
// #16888
$submitted = $submission->getSelectedObject();
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
$dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcSubFile");
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
$rel = ilDatePresentation::useRelativeDates();
ilDatePresentation::setUseRelativeDates(false);
$text .= "<br />" . sprintf(
$lng->txt("blog_exercise_submitted_info"),
ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)),
""
);
ilDatePresentation::setUseRelativeDates($rel);
$buttons[] = $ui->factory()->button()->standard($lng->txt("blog_download_submission"), $dl_link);
}
// work instructions incl. files
$tooltip = "";
$inst = $ass->getInstruction();
if ($inst) {
$tooltip .= nl2br($inst);
}
$ass_files = $ass->getFiles();
if (count($ass_files) > 0) {
$tooltip .= "<br /><br />";
foreach ($ass_files as $file) {
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", $a_assignment_id);
$ilCtrl->setParameterByClass("ilblogexercisegui", "file", urlencode($file["name"]));
$dl_link = $ilCtrl->getLinkTargetByClass("ilblogexercisegui", "downloadExcAssFile");
$ilCtrl->setParameterByClass("ilblogexercisegui", "file", "");
$ilCtrl->setParameterByClass("ilblogexercisegui", "ass", "");
$items[] = $ui->renderer()->render($ui->factory()->button()->shy($file["name"], $dl_link));
}
$list = $ui->factory()->listing()->unordered($items);
$tooltip .= $ui->renderer()->render($list);
}
if ($tooltip) {
$modal = $ui->factory()->modal()->roundtrip($lng->txt("exc_instruction"), $ui->factory()->legacy($tooltip))
->withCancelButtonLabel($lng->txt("close"));
$elements[] = $modal;
$buttons[] = $ui->factory()->button()->standard($lng->txt("exc_instruction"), '#')
->withOnClick($modal->getShowSignal());
}
$elements[] = $ui->factory()->messageBox()->info($text)
->withLinks($links)
->withButtons($buttons);
return $ui->renderer()->render($elements);
}*/

protected function downloadExcAssFile(): void
{
if ($this->file) {
Expand Down
97 changes: 97 additions & 0 deletions Modules/Blog/PermanentLink/PermanentLinkManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\Blog\PermanentLink;

use ILIAS\Blog\InternalGUIService;
use ILIAS\Blog\InternalDomainService;
use ILIAS\UICore\PageContentProvider;
use ILIAS\StaticURL\Services as StaticUrl;
use ILIAS\Data\ReferenceId;

/**
* search for illink::
* target=blog_4 : blog
* target=blog_4_4 : blog posting
* target=blog_4_4_edit : edit blog posting (tasks)
* target=blog_4_wsp : workspace blog
* target=blog_4_4_wsp : posting in workspace blog
* target=blog_4_4_edit_wsp : edit posting in workspace blog (tasks)
*/
class PermanentLinkManager
{
protected InternalGUIService $gui;
protected InternalDomainService $domain;

public function __construct(
protected StaticUrl $static_url,
InternalGUIService $gui,
protected $ref_id = 0,
protected $wsp_id = 0
) {
$this->gui = $gui;
if ($ref_id === 0 && !$wsp_id) {
$this->ref_id = $this->gui->standardRequest()->getRefId();
}
if ($wsp_id === 0 && !$ref_id) {
$this->wsp_id = $this->gui->standardRequest()->getWspId();
}
}

public function getAppend(
int $posting = 0,
bool $edit = false
): array {
$append = [];
if ($posting > 0) {
$append[] = $posting;
}
if ($edit) {
$append[] = "edit";
}
if ($this->ref_id === 0 && $this->wsp_id > 0) {
$append[] = "wsp";
}
return $append;
}

public function getPermanentLink(
int $posting = 0,
bool $edit = false
): string {
$id = $this->ref_id > 0
? $this->ref_id
: $this->wsp_id;
$uri = $this->static_url->builder()->build(
'blog', // namespace
$id > 0 ? new ReferenceId($id) : null,
$this->getAppend($posting, $edit)
);
return (string) $uri;
}

public function setPermanentLink(
int $posting = 0,
bool $edit = false
): void {
$uri = $this->getPermanentLink($posting, $edit);
PageContentProvider::setPermaLink($uri);
}
}
Loading

0 comments on commit d298ccc

Please sign in to comment.