Skip to content

Commit

Permalink
Component: build public resources (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
klees committed Apr 11, 2024
1 parent 3c75d2d commit a4b2bb0
Show file tree
Hide file tree
Showing 1,023 changed files with 2,735 additions and 20,889 deletions.
2 changes: 2 additions & 0 deletions components/ILIAS/AccessControl/AccessControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ public function init(
new \ilAccessRBACSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilPermSelect.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(ilPermissionGUI $a_parent_obj, string $a_parent_cmd,
$this->tree_path_ids = $this->tree->getPathId($this->ref_id);

$tpl = $DIC->ui()->mainTemplate();
$tpl->addJavaScript('./components/ILIAS/AccessControl/js/ilPermSelect.js');
$tpl->addJavaScript('assets/js/ilPermSelect.js');

$this->setTitle($this->lng->txt('permission_settings'));
$this->setEnableHeader(true);
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion components/ILIAS/Accordion/Accordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "accordion.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\NodeModule("owl.carousel/dist/owl.carousel.js");
}
}
4 changes: 2 additions & 2 deletions components/ILIAS/Accordion/classes/class.ilAccordionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public static function addCss(): void
public static function getLocalJavascriptFiles(): array
{
return array(
"./components/ILIAS/Accordion/js/accordion.js",
self::$owl_path . self::$owl_js_path
"assets/js/accordion.js",
"assets/js" . self::$owl_js_path
);
}

Expand Down
1 change: 0 additions & 1 deletion components/ILIAS/App/tests/RootFolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ final class RootFolderTest extends TestCase
'composer.json',
'composer_new.json',
'composer.lock',
'dependency_resolution.php',
'ilias.ini.php',
'ilias_version.php',
'LICENSE',
Expand Down
6 changes: 5 additions & 1 deletion components/ILIAS/AuthShibboleth/AuthShibboleth.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "shib_login.php");

$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "shib_logout.php");
}
}
2 changes: 1 addition & 1 deletion public/shib_login.php → ...S/AuthShibboleth/resources/shib_login.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
// @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
// $DIC->ctrl()->setCmd('doShibbolethAuthentication');
$DIC->ctrl()->callBaseClass(ilStartUpGUI::class);
}
}
2 changes: 1 addition & 1 deletion public/shib_logout.php → .../AuthShibboleth/resources/shib_logout.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ function unserializesession($serialized_string)
}

return ($variables);
}
}
5 changes: 5 additions & 0 deletions components/ILIAS/Authentication/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ public function init(
new \ilAuthenticationSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);

$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "sessioncheck.php");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "session_reminder.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function populatePage(): void

iljQueryUtil::initjQuery($this->page);

$this->page->addJavaScript('./components/ILIAS/Authentication/js/session_reminder.js');
$this->page->addJavaScript('assets/js/session_reminder.js');

$url = './sessioncheck.php?client_id=' . CLIENT_ID . '&lang=' . $this->lng->getLangKey();
$devMode = defined('DEVMODE') && DEVMODE ? 1 : 0;
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions public/sessioncheck.php → ...Authentication/resources/sessioncheck.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
/** @var ILIAS\DI\Container $DIC */
$DIC->http()->saveResponse(
(
new ilSessionReminderCheck(
$DIC->http(),
$DIC->refinery(),
$DIC->language(),
$DIC->database(),
$DIC['ilClientIniFile'],
$DIC->logger()->auth(),
(new DataFactory())->clock()->utc()
)
new ilSessionReminderCheck(
$DIC->http(),
$DIC->refinery(),
$DIC->language(),
$DIC->database(),
$DIC['ilClientIniFile'],
$DIC->logger()->auth(),
(new DataFactory())->clock()->utc()
)
)->handle()
);
$DIC->http()->sendResponse();
$DIC->http()->close();
$DIC->http()->close();
3 changes: 2 additions & 1 deletion components/ILIAS/Awareness/Awareness.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "Awareness.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function initJS(): void
{
$ilUser = $this->user;
// init js
$this->main_tpl->addJavaScript("./components/ILIAS/Awareness/js/Awareness.js");
$this->main_tpl->addJavaScript("./assets/js/Awareness.js");
$this->ctrl->setParameter($this, "ref_id", $this->ref_id);
$this->main_tpl->addOnLoadCode("il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
$this,
Expand Down
3 changes: 2 additions & 1 deletion components/ILIAS/BackgroundTasks_/BackgroundTasks_.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "background_task_refresh.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getNotifications(): array
return [];
}

$this->dic->ui()->mainTemplate()->addJavaScript("./components/ILIAS/BackgroundTasks_/js/background_task_refresh.js");
$this->dic->ui()->mainTemplate()->addJavaScript("assets/js/background_task_refresh.js");
$this->dic->language()->loadLanguageModule('background_tasks');

$id = fn (string $id): IdentificationInterface => $this->if->identifier($id);
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion components/ILIAS/Block/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilblockcallback.js");
}
}
2 changes: 1 addition & 1 deletion components/ILIAS/Block/classes/class.ilBlockGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function __construct()
$this->ui = $DIC->ui();

ilYuiUtil::initConnection();
$this->main_tpl->addJavaScript("./components/ILIAS/Block/js/ilblockcallback.js");
$this->main_tpl->addJavaScript("./assets/js/ilblockcallback.js");

$this->setLimit((int) $this->user->getPref("hits_per_page"));

Expand Down
3 changes: 2 additions & 1 deletion components/ILIAS/BookingManager/BookingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ScheduleInput.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function insert(ilTemplate $a_tpl): void
{
$tpl = $this->tpl;

$tpl->addJavascript("components/ILIAS/BookingManager/js/ScheduleInput.js");
$tpl->addJavascript("assets/js/ScheduleInput.js");

$html = $this->render();

Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion components/ILIAS/COPage/COPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilCOPagePres.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilCOPagePCInteractiveImage.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "page_history.js");
}
}
6 changes: 3 additions & 3 deletions components/ILIAS/COPage/Editor/UI/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public function initUI(
}

if (DEVMODE == 1) {
$main_tpl->addJavaScript("./node_modules/tinymce/tinymce.js");
$main_tpl->addJavaScript("assets/js/tinymce.js");
} else {
$main_tpl->addJavaScript("./node_modules/tinymce/tinymce.min.js");
$main_tpl->addJavaScript("assets/js/tinymce.min.js");
}

\ilYuiUtil::initConnection();
$main_tpl->addJavaScript("./components/ILIAS/UIComponent/Explorer/js/ilExplorer.js");
$main_tpl->addJavaScript("assets/js/ilExplorer.js");

// ensure that form.js is loaded which is needed for file input (js that shows file names)
$dummy = new \ilPropertyFormGUI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function __construct(
iljQueryUtil::initjQueryUI();
parent::__construct($a_content_obj, $a_page, $request);

$this->main_tpl->addJavaScript("./components/ILIAS/COPage/js/ilCOPagePres.js");
$this->main_tpl->addJavaScript("./components/ILIAS/COPage/js/ilCOPagePCInteractiveImage.js");
$this->main_tpl->addJavaScript("assets/js/ilCOPagePres.js");
$this->main_tpl->addJavaScript("assets/js/ilCOPagePCInteractiveImage.js");

ilAccordionGUI::addJavaScript();
ilAccordionGUI::addCss();
Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/COPage/PC/Table/class.ilPCTableGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ public function editData(): void
$this->displayValidationError();

$this->initEditor();
$this->tpl->addJavaScript("./components/ILIAS/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
$this->tpl->addJavaScript("assets/js/AdvancedSelectionList.js");
$this->tpl->addCss(ilObjStyleSheet::getBaseContentStylePath());
$this->tpl->setContent($this->getEditDataTable(true));
}
Expand Down
4 changes: 2 additions & 2 deletions components/ILIAS/COPage/Resources/ResourcesCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ protected function init(\ilPageObject $pg): void
if ($this->output_mode == \ilPageObjectGUI::OFFLINE) {
$this->js_files[] = \iljQueryUtil::getLocaljQueryPath();
$this->js_files[] = \iljQueryUtil::getLocaljQueryUIPath();
$this->js_files[] = './components/ILIAS/JavaScript/js/Basic.js';
$this->js_files[] = 'assets/js/Basic.js';
}

$this->js_files[] = "./components/ILIAS/COPage/js/ilCOPagePres.js";
$this->js_files[] = "assets/js/ilCOPagePres.js";

// for all page components...
$defs = $this->pc_definition->getPCDefinitions();
Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/COPage/classes/class.ilPageObjectGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ public function showPage(): string
// $this->initSelfAssessmentRendering();
ilObjMediaObjectGUI::includePresentationJS($main_tpl);

$main_tpl->addJavaScript("./components/ILIAS/COPage/js/ilCOPagePres.js");
$main_tpl->addJavaScript("assets/js/ilCOPagePres.js");

// needed for overlays in iim
ilOverlayGUI::initJavascript();
Expand Down Expand Up @@ -2429,7 +2429,7 @@ protected function initEditing(): void
$this->lng->toJS("copg_par_format_selection");
// workaroun: we need this js for the new editor version, e.g. for new section form to work
// @todo: solve this in a smarter way
$this->tpl->addJavaScript("./components/ILIAS/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
$this->tpl->addJavaScript("assets/js/AdvancedSelectionList.js");
\ilCalendarUtil::initDateTimePicker();
ilModalGUI::initJS();
}
Expand Down Expand Up @@ -2600,7 +2600,7 @@ public function history(): string

$this->setBackToEditTabs();

$this->tpl->addJavaScript("./components/ILIAS/COPage/js/page_history.js");
$this->tpl->addJavaScript("assets/js/page_history.js");

$table_gui = new ilPageHistoryTableGUI($this, "history");
$table_gui->setId("hist_table");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions components/ILIAS/Calendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,18 @@ public function init(
new \ilCalendarSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);

$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "calendar.php");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "recurrence_input.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "toggle_notification.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "calendar_appointment.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\NodeModule("moment/min/moment-with-locales.min.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\NodeModule("eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(string $a_title, string $a_postvar)
{
global $DIC;

$DIC->ui()->mainTemplate()->addJavaScript("./components/ILIAS/Calendar/js/recurrence_input.js");
$DIC->ui()->mainTemplate()->addJavaScript("assets/js/recurrence_input.js");
$this->user = $DIC->user();
$this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
$this->recurrence = new ilCalendarRecurrence();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected function initForm(string $a_mode, bool $a_edit_single_app = false): il
}
}

$this->tpl->addJavaScript('./components/ILIAS/Calendar/js/toggle_notification.js');
$this->tpl->addJavaScript('assets/js/toggle_notification.js');
$not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not');
$not->setInfo($this->lng->txt('cal_notification_info'));
$not->setValue('1');
Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/Calendar/classes/class.ilCalendarUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ public static function initDateTimePicker(): void
$tpl = $DIC->ui()->mainTemplate();

if (!self::$init_datetimepicker) {
$tpl->addJavaScript("./node_modules/moment/min/moment-with-locales.min.js");
$tpl->addJavaScript("assets/js/moment-with-locales.min.js");
// unminified version does not work with jQuery 3.0
// https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1684
$tpl->addJavaScript("./node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
$tpl->addJavaScript("components/ILIAS/Form/js/Form.js"); // see ilPropertyFormGUI
$tpl->addJavaScript("assets/js/bootstrap-datetimepicker.min.js");
$tpl->addJavaScript("assets/js/Form.js"); // see ilPropertyFormGUI
self::$init_datetimepicker = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function initialize(int $a_calendar_presentation_type): void
if ($this->presentation_type == self::CAL_PRESENTATION_DAY ||
$this->presentation_type == self::CAL_PRESENTATION_WEEK) {
iljQueryUtil::initjQuery($this->main_tpl);
$this->main_tpl->addJavaScript('./components/ILIAS/Calendar/js/calendar_appointment.js');
$this->main_tpl->addJavaScript('assets/js/calendar_appointment.js');
}
$this->http = $DIC->http();
$this->refinery = $DIC->refinery();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 14 additions & 1 deletion components/ILIAS/Chart/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// ...
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "excanvas.min.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.min.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.resize.min.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.stack.min.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.pie.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.highlighter.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "jquery.flot.spider.js");
}
}
8 changes: 4 additions & 4 deletions components/ILIAS/Chart/classes/class.ilChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,16 @@ protected function initJS(): void

iljQueryUtil::initjQuery();

$tpl->addJavaScript("components/ILIAS/Chart/js/flot/excanvas.min.js");
$tpl->addJavaScript("components/ILIAS/Chart/js/flot/jquery.flot.min.js");
$tpl->addJavaScript("assets/js/excanvas.min.js");
$tpl->addJavaScript("assets/js/jquery.flot.min.js");

if ($this->auto_resize) {
// #13108
$tpl->addJavaScript("components/ILIAS/Chart/js/flot/jquery.flot.resize.min.js");
$tpl->addJavaScript("assets/js/jquery.flot.resize.min.js");
}

if ($this->stacked) {
$tpl->addJavaScript("components/ILIAS/Chart/js/flot/jquery.flot.stack.min.js");
$tpl->addJavaScript("assets/js/jquery.flot.stack.min.js");
}

$this->addCustomJS();
Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/Chart/classes/class.ilChartPie.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function addCustomJS(): void
{
$tpl = $this->tpl;

$tpl->addJavaScript("components/ILIAS/Chart/js/flot/jquery.flot.pie.js");
$tpl->addJavaScript("assets/js/jquery.flot.pie.js");
}

public function parseGlobalOptions(stdClass $a_options): void
Expand Down
Loading

0 comments on commit a4b2bb0

Please sign in to comment.