Skip to content

Commit

Permalink
UI/Legacy: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen committed Jan 6, 2025
1 parent 9df5aec commit 9254274
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public static function getInitHTML(string $a_url): string
$mt = self::getModalTemplate();
$tpl->addOnLoadCode('il.IntLink.setModalTemplate("' . addslashes(json_encode($mt["template"])) . '");');

$html = "<div id='ilIntLinkModal' data-show-signal='".$mt["show"]."' data-close-signal='".$mt["close"]."'></div>";
$html = "<div id='ilIntLinkModal' data-show-signal='" . $mt["show"] . "' data-close-signal='" . $mt["close"] . "'></div>";

return $html;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,19 +396,6 @@ public function addCommandActions(): void
}

if ($this->removeMultipleEnabled()) {
<<<<<<< HEAD
=======
$roundtrip_modal = $this->ui->factory()->modal()->roundtrip(
$this->getRemoveMultipleActionText(),
$this->ui->factory()->legacy()->content('PH')
);
$roundtrip_modal = $roundtrip_modal->withAsyncRenderUrl(
$this->ctrl->getLinkTarget(
$this,
'removeFromDeskRoundtrip'
) . '&page=manage&replaceSignal=' . $roundtrip_modal->getReplaceSignal()->getId()
);
>>>>>>> 636a31c90da (UI/Legacy: rename LegacyContent to Content)
$this->addBlockCommand(
$this->ctrl->getLinkTarget($this, 'manage'),
$this->getRemoveMultipleActionText(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,4 @@ public function getRemoveMultipleActionText(): string
{
return $this->lng->txt('pd_remove_multiple');
}

public function getConfigureModal(): RoundTrip
{
$roundtrip_modal = $this->ui->factory()->modal()->roundtrip(
$this->lng->txt('rep_configure'),
$this->ui->factory()->legacy()->content('PH')
)->withAdditionalOnLoadCode(function ($id) {
return "document.body.appendChild(document.getElementById('$id'));
let configure_modal_script = document.body.appendChild(document.createElement('script'));
configure_modal_script.src = 'Services/Dashboard/Block/js/ReplaceModalContent.js';
document.body.appendChild(configure_modal_script);
let modal_js_script = document.body.appendChild(document.createElement('script'));
modal_js_script.src = 'src/UI/templates/js/Modal/modal.js';
document.body.appendChild(modal_js_script);
";
});

return $roundtrip_modal->withAsyncRenderUrl(
$this->ctrl->getLinkTargetByClass(
[ilDashboardGUI::class, ilColumnGUI::class, $this::class],
'removeFromDeskRoundtrip'
) . '&page=manage&replaceSignal=' . $roundtrip_modal->getReplaceSignal()->getId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __invoke(Closure $footer): Closure
public function renderModal(DocumentContent $content): Modal
{
return $this->ui->create()->modal()->roundtrip($content->title(), [
$this->ui->create()->legacy->legacyContent($this->ui->txt('usr_agreement_footer_intro')),
$this->ui->create()->legacy()->content($this->ui->txt('usr_agreement_footer_intro')),
$this->ui->create()->divider()->horizontal(),
$this->legal_documents->document()->contentAsComponent($content),
$this->ui->create()->divider()->horizontal(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
use ILIAS\LegalDocuments\Value\Criterion;
use ILIAS\LegalDocuments\Value\Document;
use ILIAS\LegalDocuments\EditLinks;
use ILIAS\LegalDocuments\Table\EditableDocumentTable;
use ILIAS\UI\Component\Legacy;
use ILIAS\UI\Component\Legacy\Legacy;
use ILIAS\LegalDocuments\Legacy\Table as LegacyTable;
use ILIAS\LegalDocuments\Table as TableInterface;
use ILIAS\LegalDocuments\Table\DocumentTable;
Expand Down Expand Up @@ -75,17 +74,10 @@ public function testTableReadOnly(): void

$uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50';

$legacy = $this->mock(Legacy\Content::class);
$legacy_factory = $this->mock(Legacy\Factory::class);
$legacy_factory
->expects($this->once())
->method('content')
->willReturn($legacy);

$container = $this->mockTree(Container::class, [
'ui' => [
'factory' => $this->mockMethod(UIFactory::class, 'legacy', [], $legacy_factory),
'mainTemplate' => $this->mock(ilGlobalTemplateInterface::class),
'factory' => [],
'mainTemplate' => [],
],
'language' => [],
'http' => ['request' => ['getUri' => ['__toString' => $uri]]],
Expand All @@ -107,17 +99,10 @@ public function testTableEditable(): void

$uri = 'http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50';

$legacy = $this->mock(Legacy\Content::class);
$legacy_factory = $this->mock(Legacy\Factory::class);
$legacy_factory
->expects($this->once())
->method('content')
->willReturn($legacy);

$container = $this->mockTree(Container::class, [
'ui' => [
'factory' => $this->mockMethod(UIFactory::class, 'legacy', [], $legacy_factory),
'mainTemplate' => $this->mock(ilGlobalTemplateInterface::class),
'factory' => ['table' => ['action' => ['multi' => []]]],
'mainTemplate' => [],
],
'language' => [],
'http' => ['request' => ['getUri' => ['__toString' => $uri]]],
Expand Down
50 changes: 0 additions & 50 deletions components/ILIAS/LegalDocuments/tests/Table/DocumentTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use ILIAS\Data\Factory;
use ILIAS\LegalDocuments\EditLinks;
use ILIAS\UI\Component\Component;
use ILIAS\UI\Component\Legacy;
use ILIAS\UI\Factory as UIFactory;
use ILIAS\LegalDocuments\Value\CriterionContent;
use ILIAS\LegalDocuments\Value\Criterion;
Expand Down Expand Up @@ -73,55 +72,6 @@ public function testConstruct(): void
));
}

public function testShowCriteria(): void
{
$ui = $this->mock(UI::class);
$ui->method('txt')->willReturnCallback(fn($s) => 'txt: ' . $s);

$instance = new DocumentTable(
$this->fail(...),
$this->mock(DocumentRepository::class),
$ui,
$this->mock(DocumentModal::class)
);

$criteria = [
$this->mock(Criterion::class),
$this->mock(Criterion::class),
];

$this->assertSame(['a', 'b', 'a', 'b'], $instance->showCriteria(
$this->mockTree(Document::class, ['criteria' => $criteria]),
function (Criterion $criterion) use ($criteria) {
$this->assertTrue(in_array($criterion, $criteria, true));
return ['a', 'b'];
}
));
}

public function testShowCriterion(): void
{
$content = $this->mock(CriterionContent::class);
$legacy = $this->mock(Legacy\Factory::class);
$component = $this->mock(Component::class);

$ui = $this->mockTree(UI::class, ['create' => $this->mockMethod(UIFactory::class, 'legacy', ['<br/>'], $legacy)]);

$instance = new DocumentTable(
function (CriterionContent $c) use ($content, $component) {
$this->assertSame($content, $c);
return $component;
},
$this->mock(DocumentRepository::class),
$ui,
$this->mock(DocumentModal::class)
);

$criterion = $this->mockTree(Criterion::class, ['content' => $content]);

$this->assertSame([$component, $legacy], $instance->showCriterion($criterion));
}

public function testCriterionName(): void
{
$uri = $this->mock(UriInterface::class);
Expand Down
57 changes: 0 additions & 57 deletions components/ILIAS/UI/tests/UITestHelperTest.php

This file was deleted.

0 comments on commit 9254274

Please sign in to comment.