diff --git a/classes/GUI/Form/Input/class.ilMultiSelectSearchInputGUI.php b/classes/GUI/Form/Input/class.ilMultiSelectSearchInputGUI.php index e302cb2b..295a0668 100644 --- a/classes/GUI/Form/Input/class.ilMultiSelectSearchInputGUI.php +++ b/classes/GUI/Form/Input/class.ilMultiSelectSearchInputGUI.php @@ -29,9 +29,9 @@ public function __construct($title, $post_var) parent::__construct($title, $post_var); $this->lng = $lng; - $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2.min.js"); + $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/node_modules/select2/dist/js/select2.js"); //$tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2_locale_".$ilUser->getCurrentLanguage().".js"); - $tpl->addCss("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2.css"); + $tpl->addCss("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/node_modules/select2/dist/css/select2.css"); $this->setInputTemplate(new ilTemplate("tpl.multiple_select.html", true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP")); $this->setWidth(308); diff --git a/classes/GUI/Form/class.xvmpConfFormGUI.php b/classes/GUI/Form/class.xvmpConfFormGUI.php index 447c36b4..baf7de28 100644 --- a/classes/GUI/Form/class.xvmpConfFormGUI.php +++ b/classes/GUI/Form/class.xvmpConfFormGUI.php @@ -22,6 +22,7 @@ class xvmpConfFormGUI extends xvmpFormGUI protected $db; protected Services $http; + protected const PASS_MASK = '********'; /** * xvmpConfFormGUI constructor. @@ -343,6 +344,11 @@ private function getValuesForItem($item, &$array) : void } else { $value = xvmpConf::getConfig($key); } + if($key === xvmpConf::F_API_PASSWORD && $value !== '' && $value !== null) { + $value = self::PASS_MASK; + } else if($key === xvmpConf::F_API_KEY && $value !== '' && $value !== null) { + $value = self::PASS_MASK; + } $array[$key] = $value; if (self::checkForSubItem($item)) { foreach ($item->getSubItems() as $subitem) { @@ -390,7 +396,15 @@ public function saveObject() : bool return false; } foreach ($this->getItems() as $item) { - $this->saveValueForItem($item); + if($item->getPostVar() === xvmpConf::F_API_PASSWORD || $item->getPostVar() === xvmpConf::F_API_KEY) { + $value = $this->getInput($item->getPostVar()); + if($value !== '' && $value !== self::PASS_MASK) { + xvmpConf::set($item->getPostVar(), $value); + $this->saveValueForItem($item); + } + } else { + $this->saveValueForItem($item); + } } xvmpConf::set(xvmpConf::F_CONFIG_VERSION, xvmpConf::CONFIG_VERSION); @@ -411,26 +425,29 @@ private function saveValueForItem($item) : void // obj $sql = $this->db->query('select value from lng_data where module = "rep_robj_xvmp" and identifier = "rep_robj_xvmp_obj_xvmp"'); $existing = $this->db->fetchObject($sql); - + $date_local_change = date('Y-m-d H:i:s'); if ($existing) { $this->db->update('lng_data', array( - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) ), array( 'module' => array('text', 'rep_robj_xvmp'), - 'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'), + 'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp') )); } else { $this->db->insert('lng_data', array( 'lang_key' => array('text', 'de'), 'module' => array('text', 'rep_robj_xvmp'), 'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'), - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) )); $this->db->insert('lng_data', array( 'lang_key' => array('text', 'en'), 'module' => array('text', 'rep_robj_xvmp'), 'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'), - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) )); } @@ -440,23 +457,26 @@ private function saveValueForItem($item) : void if ($existing) { $this->db->update('lng_data', array( - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) ), array( 'module' => array('text', 'rep_robj_xvmp'), - 'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'), + 'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp') )); } else { $this->db->insert('lng_data', array( 'lang_key' => array('text', 'de'), 'module' => array('text', 'rep_robj_xvmp'), 'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'), - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) )); $this->db->insert('lng_data', array( 'lang_key' => array('text', 'en'), 'module' => array('text', 'rep_robj_xvmp'), 'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'), - 'value' => array('text', $value) + 'value' => array('text', $value), + 'local_change' => array('text', $date_local_change) )); } return; diff --git a/classes/GUI/Table/class.xvmpSelectedVideosTableGUI.php b/classes/GUI/Table/class.xvmpSelectedVideosTableGUI.php index f13a1527..30e1e8b2 100644 --- a/classes/GUI/Table/class.xvmpSelectedVideosTableGUI.php +++ b/classes/GUI/Table/class.xvmpSelectedVideosTableGUI.php @@ -47,6 +47,12 @@ class xvmpSelectedVideosTableGUI extends xvmpTableGUI */ public function __construct($parent_gui, $parent_cmd) { + global $DIC; + $ilUser = $DIC['ilUser']; + $id = 'xvmp_selected_' . (int) $_GET['ref_id'] . '_' . $ilUser->getId(); + $this->setId($id); + $this->setPrefix($id); + $this->setFormName($id); parent::__construct($parent_gui, $parent_cmd); $this->setTitle($this->pl->txt('selected_videos')); @@ -59,8 +65,8 @@ public function __construct($parent_gui, $parent_cmd) $this->setDescription($description); $this->setExternalSorting(true); - $this->setEnableNumInfo(false); - $this->setShowRowsSelector(false); + $this->setEnableNumInfo(true); + $this->setShowRowsSelector(true); $base_link = $this->ctrl->getLinkTarget($this->parent_obj, '', '', true); $this->tpl_global->addOnLoadCode('VimpSelected.init("' . $base_link . '");'); @@ -98,7 +104,9 @@ protected function addRepositoryPreviewCss($number) : void public function parseData() : void { - $this->setData(xvmpMedium::getSelectedAsArray($this->parent_obj->getObjId())); + $data = xvmpMedium::getSelectedAsArray($this->parent_obj->getObjId()); + $this->setData($data); + $this->setMaxCount(count($data)); } protected function initColumns() : void diff --git a/classes/GUI/class.xvmpSelectedVideosGUI.php b/classes/GUI/class.xvmpSelectedVideosGUI.php index b6fe66e2..45ad7103 100644 --- a/classes/GUI/class.xvmpSelectedVideosGUI.php +++ b/classes/GUI/class.xvmpSelectedVideosGUI.php @@ -38,15 +38,34 @@ public function executeCommand() : void */ public function reorder() { - $ids = $_POST['ids']; - $sort = 10; + $ids = $_POST['ids'] ?? []; + $media = xvmpSelectedMedia::where(['mid' => $ids, 'obj_id' => $this->getObjId()])->get(); + + if (empty($media)) { + echo json_encode(['success' => true]); + exit; + } + + $mediaByMid = []; + foreach ($media as $obj) { + $mediaByMid[$obj->getMid()] = $obj; + } + + $orderedMedia = []; foreach ($ids as $id) { - $xvmpSelectedMedia = xvmpSelectedMedia::where(array('mid' => $id, 'obj_id' => $this->getObjId()))->first(); - $xvmpSelectedMedia->setSort($sort); - $xvmpSelectedMedia->update(); + if (isset($mediaByMid[$id])) { + $orderedMedia[] = $mediaByMid[$id]; + } + } + + $sort = min(array_map(fn($o) => $o->getSort(), $orderedMedia)); + foreach ($orderedMedia as $obj) { + $obj->setSort($sort); + $obj->update(); $sort += 10; } - echo "{\"success\": true}"; + + echo json_encode(['success' => true]); exit; } diff --git a/classes/Model/API/class.xvmpMedium.php b/classes/Model/API/class.xvmpMedium.php index 35143e30..5f470ce3 100644 --- a/classes/Model/API/class.xvmpMedium.php +++ b/classes/Model/API/class.xvmpMedium.php @@ -96,6 +96,7 @@ class xvmpMedium extends xvmpObject protected array|string $streaming; protected int $count_likes; protected ?array $subtitles = []; + protected ?array $channels = []; protected bool $download_allowed = false; protected ?DateTime $startdate = null; protected ?DateTime $enddate = null; diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index e7546d58..6d3c5014 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -244,6 +244,12 @@ "rust-result": "^1.0.0" } }, + "node_modules/select2": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/select2/-/select2-4.0.13.tgz", + "integrity": "sha512-1JeB87s6oN/TDxQQYCvS5EFoQyvV6eYMZZ0AeA4tdFDYWN3BAGZ8npr17UBFddU0lgAt3H0yjX3X6/ekOj1yjw==", + "license": "MIT" + }, "node_modules/three": { "version": "0.125.2", "resolved": "https://registry.npmjs.org/three/-/three-0.125.2.tgz", diff --git a/node_modules/select2/CHANGELOG.md b/node_modules/select2/CHANGELOG.md new file mode 100644 index 00000000..d6b2a758 --- /dev/null +++ b/node_modules/select2/CHANGELOG.md @@ -0,0 +1,427 @@ +# Change Log + +## 4.0.13 + +### New features / improvements + +* Trigger `input` event before `change` events (#4649) +* Feed back the keypress code that was responsible for the 'close' event (#5513) +* Only trigger `selection:update` once on DOM change events (#5734) + +### Bug fixes + +* Prevent opening of disabled elements (#5751) + +### Documentation + +* Fix "edit this page" links in docs (#5689) + +### Miscellaneous + +* Registered Select2 on Open Collective (#5700, #5721, #5741) + +## 4.0.12 + +### Bug fixes + +* Fixes incorrect offset when using the Shadow DOM and styling the `` element (#5682) + +### Miscellaneous + +* Replace cdnjs with jsDelivr in the documentation (#5687) +* Fix incorrect provider for the automated NPM deployment (#5686) + +## 4.0.11 + +### Bug fixes + +* Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584) + +### Miscellaneous + +* Enable GitHub actions for CI (#5591) +* Documentation has been moved into and is deployed from the code repository (#5638) +* Remove Travis CI integration (#5665) + +## 4.0.10 + +### New features / improvements + +* Support passing in a selector for `dropdownParent` option (#5622) + +### Bug fixes + +* Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621) + +## 4.0.9 + +### New features / improvements + +* Mirror disabled state through aria-disabled on selection (#5579) +* Select2 now clears the internal ID when it is destroyed (#5587) +* Set the main ARIA 1.1 roles and properties for comboboxes (#5582) +* The `language` option now has a clearly defined fallback chain (#5602) + +### Bug fixes + +* Do not propagate click when search box is not empty (#5580) +* Fix `maximumSelectionLength` being ignored by `closeOnSelect` (#5581) +* Fix generated options not receiving result IDs (#5586) +* Remove selection title attribute if text is empty (#5589) +* Reposition dropdown whenever items are selected (#5590) +* Fix dropdown positioning when displayed above with messages (#5592) +* Fix search box expanding width of container (#5595) +* `allowClear` no longer shifts selections to a new line (#5603) + +### Translations + +* Fix error in German translations (#5604) + +### Miscellaneous + +* Updated development grunt version so it no longer shows as vulnerable (#5597) +* Remove unused variables (#5554) + +## 4.0.8 + +### New features / improvements + +* Test against and fix compatibility with jQuery 3.4.1 (#5531) +* Results respect disabled state of `