diff --git a/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerEditorGUI.php b/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerEditorGUI.php deleted file mode 100755 index 45e66d51ad57..000000000000 --- a/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerEditorGUI.php +++ /dev/null @@ -1,302 +0,0 @@ - - * @ilCtrl_Calls ilPCIIMTriggerEditorGUI: ilInternalLinkGUI - */ -class ilPCIIMTriggerEditorGUI extends ilPCImageMapEditorGUI -{ - public function __construct( - ilPCInteractiveImage $a_content_obj, - ilPageObject $a_page, - EditGUIRequest $request - ) { - iljQueryUtil::initjQueryUI(); - parent::__construct($a_content_obj, $a_page, $request); - - $this->main_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js"); - $this->main_tpl->addJavaScript("./Services/COPage/js/ilCOPagePCInteractiveImage.js"); - - ilAccordionGUI::addJavaScript(); - ilAccordionGUI::addCss(); - } - - public function getParentNodeName(): string - { - return "InteractiveImage"; - } - - public function getEditorTitle(): string - { - $lng = $this->lng; - - return $lng->txt("cont_pc_iim"); - } - - /** - * Get trigger table - */ - public function getImageMapTableHTML(): string - { - $ilToolbar = $this->toolbar; - $lng = $this->lng; - $ilCtrl = $this->ctrl; - - - $ilToolbar->addText($lng->txt("cont_drag_element_click_save")); - $ilToolbar->setId("drag_toolbar"); - $ilToolbar->setHidden(true); - $ilToolbar->addButton($lng->txt("save"), "#", "", null, "", "save_pos_button"); - - $ilToolbar->addButton( - $lng->txt("cancel"), - $ilCtrl->getLinkTarget($this, "editMapAreas") - ); - - $image_map_table = new ilPCIIMTriggerTableGUI( - $this, - "editMapAreas", - $this->content_obj, - $this->getParentNodeName() - ); - return $image_map_table->getHTML(); - } - - public function getToolbar(): ilToolbarGUI - { - $ilCtrl = $this->ctrl; - $lng = $this->lng; - - // toolbar - $tb = new ilToolbarGUI(); - $tb->setFormAction($ilCtrl->getFormAction($this)); - $options = array( - "Rect" => $lng->txt("cont_Rect"), - "Circle" => $lng->txt("cont_Circle"), - "Poly" => $lng->txt("cont_Poly"), - "Marker" => $lng->txt("cont_marker") - ); - $si = new ilSelectInputGUI($lng->txt("cont_trigger_area"), "shape"); - $si->setOptions($options); - $tb->addInputItem($si, true); - $tb->addFormButton($lng->txt("add"), "addNewArea"); - - return $tb; - } - - public function addNewArea(): string - { - $ilCtrl = $this->ctrl; - $lng = $this->lng; - - if ($this->edit_request->getString("shape") == "Marker") { - $this->content_obj->addTriggerMarker(); - $this->page->update(); - $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_data"), true); - $ilCtrl->redirect($this, "editMapAreas"); - } else { - return parent::addNewArea(); - } - return ""; - } - - /** - * Init area editing form. - */ - public function initAreaEditingForm( - string $a_edit_property - ): ilPropertyFormGUI { - $lng = $this->lng; - $form = new ilPropertyFormGUI(); - $form->setOpenTag(false); - $form->setCloseTag(false); - - // name - if ($a_edit_property != "link" && $a_edit_property != "shape") { - $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name"); - $ti->setMaxLength(200); - $ti->setSize(20); - //$ti->setRequired(true); - $form->addItem($ti); - } - - // save and cancel commands - if ($a_edit_property == "") { - $form->setTitle($lng->txt("cont_new_trigger_area")); - } else { - $form->setTitle($lng->txt("cont_new_area")); - } - $form->addCommandButton("saveArea", $lng->txt("save")); - - return $form; - } - - /** - * Save new or updated map area - */ - public function saveArea(): string - { - $lng = $this->lng; - $ilCtrl = $this->ctrl; - - switch ($this->map_repo->getMode()) { - // save edited shape - case "edit_shape": - $this->std_alias_item->setShape( - $this->map->getAreaNr(), - $this->map->getAreaType(), - $this->map->getCoords() - ); - $this->page->update(); - break; - - // save new area - default: - $area_type = $this->map->getAreaType(); - $coords = $this->map->getCoords(); - $this->content_obj->addTriggerArea( - $this->std_alias_item, - $area_type, - $coords, - $this->edit_request->getString("area_name") - ); - $this->page->update(); - break; - } - - //$this->initMapParameters(); - $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_area"), true); - $ilCtrl->redirect($this, "editMapAreas"); - return ""; - } - - /** - * Update trigger - */ - public function updateTrigger(): void - { - $lng = $this->lng; - $ilCtrl = $this->ctrl; - - $this->content_obj->setTriggerOverlays( - $this->edit_request->getStringArray("ov") - ); - $this->content_obj->setTriggerPopups( - $this->edit_request->getStringArray("pop") - ); - $this->content_obj->setTriggerOverlayPositions( - $this->edit_request->getStringArray("ovpos") - ); - $this->content_obj->setTriggerMarkerPositions( - $this->edit_request->getStringArray("markpos") - ); - $this->content_obj->setTriggerPopupPositions( - $this->edit_request->getStringArray("poppos") - ); - $this->content_obj->setTriggerPopupSize( - $this->edit_request->getStringArray("popsize") - ); - $this->content_obj->setTriggerTitles( - $this->edit_request->getStringArray("title") - ); - $this->page->update(); - $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true); - $ilCtrl->redirect($this, "editMapAreas"); - } - - /** - * Confirm trigger deletion - */ - public function confirmDeleteTrigger(): void - { - $ilCtrl = $this->ctrl; - $main_tpl = $this->main_tpl; - $lng = $this->lng; - - $trigger = $this->edit_request->getStringArray("tr"); - $titles = $this->edit_request->getStringArray("title"); - - if (count($trigger) == 0) { - $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true); - $ilCtrl->redirect($this, "editMapAreas"); - } else { - $cgui = new ilConfirmationGUI(); - $cgui->setFormAction($ilCtrl->getFormAction($this)); - $cgui->setHeaderText($lng->txt("cont_really_delete_triggers")); - $cgui->setCancel($lng->txt("cancel"), "editMapAreas"); - $cgui->setConfirm($lng->txt("delete"), "deleteTrigger"); - - foreach ($trigger as $i) { - $cgui->addItem("tr[]", $i, $titles[$i]); - } - $main_tpl->setContent($cgui->getHTML()); - } - } - - /** - * Delete trigger - * @throws ilDateTimeException - */ - public function deleteTrigger(): void - { - $ilCtrl = $this->ctrl; - $lng = $this->lng; - - $trigger = $this->edit_request->getStringArray("tr"); - - if (count($trigger) > 0) { - foreach ($trigger as $tr_nr) { - $this->content_obj->deleteTrigger($this->std_alias_item, $tr_nr); - } - $this->page->update(); - $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_areas_deleted"), true); - } - - $ilCtrl->redirect($this, "editMapAreas"); - } - - /** - * Get additional page xml (to be overwritten) - */ - public function getAdditionalPageXML(): string - { - return $this->page->getMultimediaXML(); - } - - public function outputPostProcessing(string $a_output): string - { - // for question html get the page gui object - $pg_gui = new ilPageObjectGUI($this->page->getParentType(), $this->page->getId()); - $pg_gui->setOutputMode(ilPageObjectGUI::PREVIEW); - $pg_gui->getPageConfig()->setEnableSelfAssessment(true); - // $pg_gui->initSelfAssessmentRendering(true); // todo: solve in other way - $qhtml = $pg_gui->getQuestionHTML(); - if (is_array($qhtml)) { - foreach ($qhtml as $k => $h) { - $a_output = str_replace($pg_gui->pl_start . "Question;il__qst_$k" . $pg_gui->pl_end, " " . $h, $a_output); - } - } - - return $a_output; - } -} diff --git a/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerTableGUI.php b/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerTableGUI.php deleted file mode 100755 index 29f98a021cb4..000000000000 --- a/Services/COPage/PC/InteractiveImage/class.ilPCIIMTriggerTableGUI.php +++ /dev/null @@ -1,196 +0,0 @@ - - */ -class ilPCIIMTriggerTableGUI extends ilImageMapTableGUI -{ - protected array $pop_options; - protected array $popups; - protected array $ov_files; - protected array $areas; - protected ilObjMediaObject $mob; - protected array $ov_options; - protected string $parent_node_name; - protected ilPCInteractiveImage $pc_media_object; - protected array $area; - - public function __construct( - object $a_parent_obj, - string $a_parent_cmd, - ilPCInteractiveImage $a_pc_media_object, - string $a_parent_node_name - ) { - global $DIC; - - $this->ctrl = $DIC->ctrl(); - $this->lng = $DIC->language(); - $this->access = $DIC->access(); - $lng = $DIC->language(); - - $this->setId("cont_iim_tr"); - - $this->parent_node_name = $a_parent_node_name; - $this->pc_media_object = $a_pc_media_object; - $this->mob = $this->pc_media_object->getMediaObject(); - - $this->areas = array(); - foreach ($this->pc_media_object->getStandardAliasItem()->getMapAreas() as $a) { - $this->area[$a["Id"]] = $a; - } - - $this->ov_files = $this->mob->getFilesOfDirectory("overlays"); - $this->ov_options = array("" => $lng->txt("please_select")); - foreach ($this->ov_files as $of) { - $this->ov_options[$of] = $of; - } - $this->popups = $this->pc_media_object->getPopups(); - $this->pop_options = array("" => $lng->txt("please_select")); - foreach ($this->popups as $k => $p) { - $this->pop_options[$p["nr"]] = $p["title"]; - } - parent::__construct($a_parent_obj, $a_parent_cmd, $a_pc_media_object->getMediaObject()); - $this->setRowTemplate("tpl.iim_trigger_row.html", "Services/COPage"); - } - - public function initColumns(): void - { - $this->addColumn("", "", "1"); // checkbox - $this->addColumn($this->lng->txt("title"), "Title", ""); - $this->addColumn($this->lng->txt("type"), "", ""); - $this->addColumn($this->lng->txt("cont_coords"), "", ""); - $this->addColumn($this->lng->txt("cont_overlay_image"), "", ""); - $this->addColumn($this->lng->txt("cont_content_popup"), "", ""); - $this->addColumn($this->lng->txt("actions"), "", ""); - } - - public function initActions(): void - { - $lng = $this->lng; - - // action commands - $this->addMultiCommand("confirmDeleteTrigger", $lng->txt("delete")); - - $data = $this->getData(); - if (count($data) > 0) { - $this->addCommandButton("updateTrigger", $lng->txt("save"), "", "update_tr_button"); - } - } - - public function getItems(): void - { - $triggers = $this->pc_media_object->getTriggers(); - - $triggers = ilArrayUtil::sortArray($triggers, "Title", "asc", false, true); - $this->setData($triggers); - } - - protected function fillRow(array $a_set): void - { - $lng = $this->lng; - - $i = $a_set["Nr"]; - - // command: edit marker position - if ($a_set["Overlay"] != "") { - $this->tpl->setCurrentBlock("cmd"); - $this->tpl->setVariable("CMD_ID", "ov_" . $i); - $this->tpl->setVariable("HREF_CMD", "#"); - $this->tpl->setVariable("CMD_CLASS", "ov_cmd"); - $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_overlay_position")); - $this->tpl->parseCurrentBlock(); - } - - // command: edit marker position - if ($a_set["PopupNr"] != "") { - $this->tpl->setCurrentBlock("cmd"); - $this->tpl->setVariable("CMD_ID", "pop_" . $i); - $this->tpl->setVariable("HREF_CMD", "#"); - $this->tpl->setVariable("CMD_CLASS", "pop_cmd"); - $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_popup_position")); - $this->tpl->parseCurrentBlock(); - } - - if ($a_set["Type"] == ilPCInteractiveImage::AREA) { - $this->tpl->setCurrentBlock("coords"); - $this->tpl->setVariable( - "VAL_COORDS", - implode(", ", explode(",", $this->area[$a_set["Nr"]]["Coords"])) - ); - $this->tpl->parseCurrentBlock(); - - $this->tpl->setVariable( - "TYPE", - $lng->txt("cont_" . $this->area[$a_set["Nr"]]["Shape"]) - ); - } else { - // command: edit marker position - $this->tpl->setCurrentBlock("cmd"); - $this->tpl->setVariable("CMD_ID", "mark_" . $i); - $this->tpl->setVariable("HREF_CMD", "#"); - $this->tpl->setVariable("CMD_CLASS", "mark_cmd"); - $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_marker_position")); - $this->tpl->parseCurrentBlock(); - - // marker position - $this->tpl->setCurrentBlock("marker_pos"); - $this->tpl->setVariable("VAR_MARK_POS", "markpos[" . $i . "]"); - $this->tpl->setVariable("ID_MARK_POS", "markpos_" . $i); - $this->tpl->setVariable("VAL_MARK_POS", $a_set["MarkerX"] . "," . $a_set["MarkerY"]); - $this->tpl->setVariable("TXT_MLEFT", $lng->txt("cont_left")); - $this->tpl->setVariable("TXT_MTOP", $lng->txt("cont_top")); - $this->tpl->parseCurrentBlock(); - - $this->tpl->setVariable("TYPE", $lng->txt("cont_marker")); - } - - $this->tpl->setVariable( - "CHECKBOX", - ilLegacyFormElementsUtil::formCheckbox("", "tr[]", $i) - ); - $this->tpl->setVariable("VAR_NAME", "title[" . $i . "]"); - $this->tpl->setVariable("VAL_NAME", $a_set["Title"]); - - - $this->tpl->setVariable("VAR_POS", "ovpos[" . $i . "]"); - $this->tpl->setVariable("ID_OV_POS", "ovpos_" . $i); - $this->tpl->setVariable("ID_POP_POS", "poppos_" . $i); - $this->tpl->setVariable("VAR_POP_POS", "poppos[" . $i . "]"); - $this->tpl->setVariable("VAR_POP_SIZE", "popsize[" . $i . "]"); - $this->tpl->setVariable("VAL_POS", $a_set["OverlayX"] . "," . $a_set["OverlayY"]); - $this->tpl->setVariable("VAL_POP_POS", $a_set["PopupX"] . "," . $a_set["PopupY"]); - $this->tpl->setVariable("VAL_POP_SIZE", $a_set["PopupWidth"] . "," . $a_set["PopupHeight"]); - $this->tpl->setVariable("TXT_IMG", $lng->txt("image")); - $this->tpl->setVariable("TXT_TITLE", $lng->txt("title")); - $this->tpl->setVariable("TXT_LEFT", $lng->txt("cont_left")); - $this->tpl->setVariable("TXT_TOP", $lng->txt("cont_top")); - $this->tpl->setVariable("TXT_WIDTH", $lng->txt("cont_width")); - $this->tpl->setVariable("TXT_HEIGHT", $lng->txt("cont_height")); - $this->tpl->setVariable( - "OVERLAY_IMAGE", - ilLegacyFormElementsUtil::formSelect($a_set["Overlay"], "ov[" . $i . "]", $this->ov_options, false, true) - ); - $this->tpl->setVariable( - "CONTENT_POPUP", - ilLegacyFormElementsUtil::formSelect($a_set["PopupNr"], "pop[" . $i . "]", $this->pop_options, false, true) - ); - } -} diff --git a/Services/COPage/PC/InteractiveImage/class.ilPCInteractiveImageGUI.php b/Services/COPage/PC/InteractiveImage/class.ilPCInteractiveImageGUI.php index a8ce3c538520..068f3e9fff1f 100755 --- a/Services/COPage/PC/InteractiveImage/class.ilPCInteractiveImageGUI.php +++ b/Services/COPage/PC/InteractiveImage/class.ilPCInteractiveImageGUI.php @@ -70,33 +70,6 @@ public function executeCommand(): void } switch ($next_class) { - // trigger editor - case "ilpciimtriggereditorgui": - $ilTabs->setTabActive("triggers"); - /** @var ilPCInteractiveImage $iim */ - $iim = $this->content_obj; - $image_map_edit = new ilPCIIMTriggerEditorGUI( - $iim, - $this->pg_obj, - $this->request - ); - $ret = $this->ctrl->forwardCommand($image_map_edit); - if ($ret != "") { - $tpl->setContent($ret); - } - break; - - /* - case "ilpageeditorserveradaptergui": - $adapter = new ilPageEditorServerAdapterGUI( - $this->page_gui, - $this->ctrl, - $this->ui, - $this->http_request - ); - $this->ctrl->forwardCommand($adapter); - break;*/ - case strtolower(ilRepoStandardUploadHandlerGUI::class): $this->forwardFormToUploadHandler(); break; diff --git a/Services/COPage/js/ilCOPagePCInteractiveImage.js b/Services/COPage/js/ilCOPagePCInteractiveImage.js deleted file mode 100644 index 6dc08106ef6a..000000000000 --- a/Services/COPage/js/ilCOPagePCInteractiveImage.js +++ /dev/null @@ -1,55 +0,0 @@ - -/** - * 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 - * - *********************************************************************/ - -ilCOPagePCInteractiveImage = -{ - /** - * Basic init function - */ - init: function () - { - $("a.mark_cmd").click(this.markerCommand); - $("a.ov_cmd").click(this.overlayCommand); - $("a.pop_cmd").click(this.popupCommand); - }, - - /** - * Marker command - */ - markerCommand: function (e) - { - il.COPagePres.startDraggingMarker(e.target.id.substr(5)); - }, - - /** - * Overlay command - */ - overlayCommand: function (e) - { - il.COPagePres.startDraggingOverlay(e.target.id.substr(3)); - }, - - /** - * Popup command - */ - popupCommand: function (e) - { - il.COPagePres.startDraggingPopup(e.target.id.substr(4)); - } - -} -il.Util.addOnLoad(function() {ilCOPagePCInteractiveImage.init();}); diff --git a/Services/COPage/js/ilCOPagePres.js b/Services/COPage/js/ilCOPagePres.js index 9da12bdcfea1..afd6c2a84fc1 100644 --- a/Services/COPage/js/ilCOPagePres.js +++ b/Services/COPage/js/ilCOPagePres.js @@ -1,4 +1,3 @@ - /** * This file is part of ILIAS, a powerful learning management system * published by ILIAS open source e-Learning e.V. @@ -13,943 +12,304 @@ * https://www.ilias.de * https://github.com/ILIAS-eLearning * - *********************************************************************/ + ******************************************************************** */ -il.COPagePres = -{ - /** +il.COPagePres = { + /** * Basic init function */ - init: function () { - this.initToc(); - this.initInteractiveImages(); - this.updateQuestionOverviews(); - this.initMapAreas(); - this.initAdvancedContent(); - this.initAudioVideo(); - this.initAccordions(); - }, - - // - // Toc (as used in Wikis) - // - - /** + init() { + this.initToc(); + this.updateQuestionOverviews(); + this.initMapAreas(); + this.initAdvancedContent(); + this.initAudioVideo(); + this.initAccordions(); + }, + + // + // Toc (as used in Wikis) + // + + /** * Init the table of content */ - initToc: function () { - // init toc - var cookiePos = document.cookie.indexOf("pg_hidetoc="); - if (cookiePos > -1 && document.cookie.charAt(cookiePos + 11) == 1) - { - this.toggleToc(); - } - }, - - initAccordions: function () { - if (typeof ilAccordionsInits !== "undefined") { - for (var i = 0; i < ilAccordionsInits.length; i++) { - il.Accordion.add(ilAccordionsInits[i]); - } - } - }, - - /** + initToc() { + // init toc + const cookiePos = document.cookie.indexOf('pg_hidetoc='); + if (cookiePos > -1 && document.cookie.charAt(cookiePos + 11) == 1) { + this.toggleToc(); + } + }, + + initAccordions() { + if (typeof ilAccordionsInits !== 'undefined') { + for (let i = 0; i < ilAccordionsInits.length; i++) { + il.Accordion.add(ilAccordionsInits[i]); + } + } + }, + + /** * Toggle the table of content */ - toggleToc: function() { - var toc_on, toc_off, toc = document.getElementById('ilPageTocContent'); - - if (!toc) { - return; - } - - toc_on = document.getElementById('ilPageTocOn'); - toc_off = document.getElementById('ilPageTocOff'); - - if (toc && toc.style.display == 'none') { - toc.style.display = 'block'; - toc_on.style.display = 'none'; - toc_off.style.display = ''; - document.cookie = "pg_hidetoc=0"; - } else { - toc_on.style.display = ''; - toc_off.style.display = 'none'; - toc.style.display = 'none'; - document.cookie = "pg_hidetoc=1"; - } - }, - - // - // Interactive Images - // - - iim_trigger: {}, - iim_area: {}, - iim_popup: {}, - iim_marker: {}, - dragging: false, - - /** - * Init interactive images - */ - initInteractiveImages: function () { - - // preload overlay images (necessary?) - // add onmouseover event to all map areas - //$("map.iim > area").mouseover(this.overBaseArea); - //$("map.iim > area").mouseout(this.outBaseArea); - //$("map.iim > area").click(this.clickBaseArea); - - //$("a.ilc_marker_Marker").mouseover(this.overMarker); - //$("a.ilc_marker_Marker").mouseout(this.outMarker); - //$("a.ilc_marker_Marker").click(this.clickMarker); - - // add areas - document.querySelectorAll("[data-copg-iim-data-type='area']").forEach(el => { - const d = el.dataset; - il.COPagePres.addIIMArea({ - area_id: d.copgIimAreaId, - iim_id: d.copgIimId, - tr_nr: d.copgIimTrNr, - title: d.copgIimTitle - }); - }); - - // add trigger for overlays/popups - document.querySelectorAll("[data-copg-iim-data-type='trigger']").forEach(el => { - const d = el.dataset; - il.COPagePres.addIIMTrigger({ - iim_id: d.copgIimId, - type: d.copgIimType, - title: d.copgIimTitle, - ovx: d.copgIimOvx, - ovy: d.copgIimOvy, - markx: d.copgIimMarkx, - marky: d.copgIimMarky, - popup_nr: d.copgIimPopupNr, - nr: d.copgIimNr, - popx: d.copgIimPopx, - popy: d.copgIimPopy, - popwidth: d.copgIimPopwidth, - popheight: d.copgIimPopheight, - tr_id: d.copgIimTrId - }); - }); - - // add markers - document.querySelectorAll("[data-copg-iim-data-type='marker']").forEach(el => { - const d = el.dataset; - il.COPagePres.addIIMMarker({ - iim_id: d.copgIimId, - m_id: d.copgIimMId, - markx: d.copgIimMarkx, - marky: d.copgIimMarky, - tr_nr: d.copgIimTrNr, - tr_id: d.copgIimTrId, - edit_mode: d.copgIimEditMode - }); - }); - - // add popups - document.querySelectorAll("[data-copg-iim-data-type='popup']").forEach(el => { - const d = el.dataset; - il.COPagePres.addIIMPopup({ - iim_id: d.copgIimId, - pop_id: d.copgIimPopId, - div_id: d.copgIimDivId, - nr: d.copgIimNr, - title: d.copgIimTitle - }); - }); - - $(document).on("il.accordion.start-opening", function (ev, el) { - il.COPagePres.fixMarkerPositions(); - }); - }, - - /** - * Mouse over marker -> show the overlay image - */ - overMarker: function (e) { - var marker_tr_nr, iim_id; - - if (this.dragging) { - return; - } - - marker_tr_nr = il.COPagePres.iim_marker[e.target.id].tr_nr; - iim_id = il.COPagePres.iim_marker[e.target.id].iim_id; - il.COPagePres.handleOverEvent(iim_id, marker_tr_nr, true); - }, - - /** - * Mouse leaves marker -> hide the overlay image - */ - outMarker: function (e) { - var marker_tr_nr, iim_id; - if (this.dragging) { - return; - } - - marker_tr_nr = il.COPagePres.iim_marker[e.target.id].tr_nr; - iim_id = il.COPagePres.iim_marker[e.target.id].iim_id; - il.COPagePres.handleOutEvent(iim_id, marker_tr_nr); - }, - - /** - * Mouse over base image map area -> show the overlay image - * and (on first time) init the image map of the overlay image - */ - overBaseArea: function (e) { - var area_tr_nr = il.COPagePres.iim_area[e.target.id].tr_nr, - iim_id = il.COPagePres.iim_area[e.target.id].iim_id; - - il.COPagePres.handleOverEvent(iim_id, area_tr_nr, false); - }, - - /** - * Mouse over base image map area or marker -> show the overlay image - * and (on first time) init the image map of the overlay image - */ - handleOverEvent: function (iim_id, area_tr_nr, is_marker) - { - var k, j, tr, coords, ovx, ovy, base, ov, base_map_name, c, k2, i2, tr2; - - if (this.dragging) { - return; - } - - for (k in il.COPagePres.iim_trigger) { - tr = il.COPagePres.iim_trigger[k]; - - if (tr.nr == area_tr_nr && tr.iim_id == iim_id) { - base = $("img#base_img_" + tr.iim_id); - ov = $("img#iim_ov_" + tr.tr_id); - // no overlay image? -> skip - if (ov.length == 0) { - continue; - } - - // no usamap (e.g. edit mode) -> skip) - if (typeof(base.attr('usemap')) === "undefined") { - continue; - } - - base_map_name = base.attr('usemap').substr(1); - - // display the overlay at the correct position - ov.css('position', 'absolute'); - ovx = parseInt(tr.ovx, 10); - ovy = parseInt(tr.ovy, 10); - ov.css('display', ''); - - // this fixes the position in case of the toc2win - // view, if the fixed div has been scrolled - $(ov).position({ - my: "left top", - at: "left+" + ovx + " top+" + ovy, - of: "img#base_img_" + tr.iim_id, - collision: "none" - }); - - // on first time we need to initialize the - // image map of the overlay image - if (tr.map_initialized == null && !is_marker) - { - tr.map_initialized = true; - $("map[name='" + base_map_name + "'] > area").each( - function (i,el) { - // if title is the same, add area to overlay map - if (il.COPagePres.iim_area[el.id].tr_nr == area_tr_nr) { - coords = $(el).attr("coords"); - // fix coords - switch($(el).attr("shape").toLowerCase()) { - - case "rect": - c = coords.split(","); - coords = String((parseInt(c[0], 10) - ovx) + "," + - (parseInt(c[1], 10) - ovy) + "," + - (parseInt(c[2], 10) - ovx) + "," + - (parseInt(c[3], 10) - ovy)); - break; - - case "poly": - c = coords.split(","); - coords = ""; - var sep = ""; - for (j in c) { - if (j % 2 == 0) { - coords = coords + sep + parseInt(c[j] - ovx, 10); - } else { - coords = coords + sep + parseInt(c[j] - ovy, 10); - } - sep = ","; - } - break; - - case "circle": - c = coords.split(","); - coords = String((parseInt(c[0], 10) - ovx) + "," + - (parseInt(c[1], 10) - ovy) + "," + - (parseInt(c[2], 10))); - break; - } - - // set shape and coords - $("area#iim_ov_area_" + tr.tr_id).attr("coords", coords); - $("area#iim_ov_area_" + tr.tr_id).attr("shape", $(el).attr("shape")); - - // add mouse event listeners - k2 = k; - i2 = "iim_ov_" + tr.tr_id; - tr2 = tr.tr_id; - $("area#iim_ov_area_" + tr.tr_id).mouseover( - function() {il.COPagePres.overOvArea(k2, true, i2);}); - $("area#iim_ov_area_" + tr.tr_id).mouseout( - function() {il.COPagePres.overOvArea(k2, false, i2);}); - $("area#iim_ov_area_" + tr.tr_id).click( - function(e) {il.COPagePres.clickOvArea(e, tr2);}); - } - }); - } - } - } - }, - - /** - * Leave a base image map area: hide corresponding images - */ - outBaseArea: function (e) { - var area_tr_nr = il.COPagePres.iim_area[e.target.id].tr_nr, - iim_id = il.COPagePres.iim_area[e.target.id].iim_id; - il.COPagePres.handleOutEvent(iim_id, area_tr_nr); - }, - - /** - * Leave a base image map area: hide corresponding images - */ - handleOutEvent: function (iim_id, area_tr_nr) - { - var k, tr; - - if (this.dragging) { - return; - } - - for (k in il.COPagePres.iim_trigger) { - tr = il.COPagePres.iim_trigger[k]; - if (tr.nr == area_tr_nr && tr.iim_id == iim_id && - (il.COPagePres.iim_trigger[k].over_ov_area == null || - !il.COPagePres.iim_trigger[k].over_ov_area - )) { - $("img#iim_ov_" + tr.tr_id).css('display', 'none'); - } - } - }, - - - /** - * Triggered by mouseover/out on imagemap of overlay image - */ - overOvArea: function (k, value, ov_id) { - if (this.dragging) { - return; - } - - il.COPagePres.iim_trigger[k].over_ov_area = value; - if (value) { - $("img#" + ov_id).css('display', ''); - } else { - $("img#" + ov_id).css('display', 'none'); - } - }, - - /** - * A marker is clicked - */ - clickMarker: function (e) - { - var k, tr, - marker_tr_nr = il.COPagePres.iim_marker[e.target.id].tr_nr, - iim_id = il.COPagePres.iim_marker[e.target.id].iim_id; - - if (il.COPagePres.iim_marker[e.target.id].edit_mode == "1") { - return; - } - - if (this.dragging) { - return; - } - - // iterate through the triggers and search the correct one - for (k in il.COPagePres.iim_trigger) { - tr = il.COPagePres.iim_trigger[k]; - if (tr.nr == marker_tr_nr && tr.iim_id == iim_id) { - il.COPagePres.handleAreaClick(e, tr.tr_id); - } - } - }, - - /** - * A base image map area is clicked - */ - clickBaseArea: function (e) { - var k, tr, - area_tr_nr = il.COPagePres.iim_area[e.target.id].tr_nr, - iim_id = il.COPagePres.iim_area[e.target.id].iim_id; - - if (this.dragging) { - return; - } - - // iterate through the triggers and search the correct one - for (k in il.COPagePres.iim_trigger) { - tr = il.COPagePres.iim_trigger[k]; - if (tr.nr == area_tr_nr && tr.iim_id == iim_id) { - il.COPagePres.handleAreaClick(e, tr.tr_id); - } - } - }, - - /** - * Handle area click (triggered by base or overlay image map area) - */ - handleAreaClick: function (e, tr_id) { - const areaEl = e.target; - console.log(areaEl); - console.log(tr_id); - console.log(il.COPagePres.iim_trigger); - - var tr = il.COPagePres.iim_trigger[tr_id]; - var el = document.getElementById("iim_popup_" + tr.iim_id + "_" + tr.popup_nr), - base, pos, x, y; - - if (el == null || this.dragging) { - e.preventDefault(); - return; - } - - const nr = tr.popup_nr; - const popupEl = document.querySelector("[data-copg-cont-type='iim-popup'][data-copg-popup-nr='" + nr + "']"); - - const button = e.target; - const tooltip = popupEl; - - if (popupEl) { - if (popupEl.style.display == "none") { - popupEl.style.display = ''; - } else { - popupEl.style.display = 'none'; - } - e.preventDefault(); - return; - - - const signalId = popupEl.dataset.signalId; - console.log("TRIGGER"); - $(document).trigger(signalId, - { - 'id' : signalId, 'event' : 'click', - 'triggerer' : $(areaEl), - 'options' : JSON.parse('[]') - } - ); - if (tr.popup_initialized == null) { - tr.popup_initialized = true; - /* - console.log("TRIGGER"); - $(document).trigger(signalId, - { - 'id' : signalId, 'event' : 'click', - 'triggerer' : $(areaEl), - 'options' : JSON.parse('[]') - } - );*/ - } - } - - // on first time we need to initialize content overlay - - if (tr.popup_initialized == null) { - tr.popup_initialized = true; - /* - if (popupEl) { - $(document).trigger(signalId, - { - 'id': signalId, 'event': 'click', - 'triggerer': $(areaEl), - 'options': JSON.parse('[]') - } - ); - }*/ - /*il.Overlay.add("iim_popup_" + tr.iim_id + "_" + tr.popup_nr, - {"yuicfg":{"visible":false,"fixedcenter":false}, - "auto_hide":false});*/ - } - - - // show the overlay - /* - base = $("img#base_img_" + il.COPagePres.iim_trigger[tr_id].iim_id); - pos = base.offset(); - x = pos.left + parseInt(il.COPagePres.iim_trigger[tr_id].popx, 10); - y = pos.top + parseInt(il.COPagePres.iim_trigger[tr_id].popy, 10); - il.Overlay.setWidth("iim_popup_" + tr.iim_id + "_" + tr.popup_nr, il.COPagePres.iim_trigger[tr_id].popwidth); - il.Overlay.setHeight("iim_popup_" + tr.iim_id + "_" + tr.popup_nr, il.COPagePres.iim_trigger[tr_id].popheight); - il.Overlay.toggle(e, "iim_popup_" + tr.iim_id + "_" + tr.popup_nr, null, false, null, null, "click"); - il.Overlay.setX("iim_popup_" + tr.iim_id + "_" + tr.popup_nr, x); - il.Overlay.setY("iim_popup_" + tr.iim_id + "_" + tr.popup_nr, y);*/ - - e.preventDefault(); - }, - - /** - * A overlay image map area is clicked - */ - clickOvArea: function (e, tr_id){ - il.COPagePres.handleAreaClick(e, tr_id); - }, - - addIIMTrigger: function(tr) { - this.iim_trigger[tr.tr_id] = tr; - }, - - addIIMArea: function(a) { - this.iim_area[a.area_id] = a; - }, - - addIIMPopup: function(p) { - this.iim_popup[p.pop_id] = p; - }, - - addIIMMarker: function(m) { - var base, pos, mark, mx, my; - - this.iim_marker[m.m_id] = m; - const p = this.fixMarkerPosition; - p(m); - window.setTimeout(function() { - p(m); - }, 500); - - }, - - fixMarkerPosition: function(m) { - var base, pos, mark, mx, my; - base = $("img#base_img_" + m.iim_id); - pos = base.offset(); - mark = $("a#" + m.m_id); - // display the marker at the correct position - mark.css('position', 'absolute'); - mx = pos.left + parseInt(m.markx, 10); - my = pos.top + parseInt(m.marky, 10); - mark.css('display', ''); - il.Overlay.setX(m.m_id, mx); - il.Overlay.setY(m.m_id, my); - - }, - - fixMarkerPositions: function () { - var m, k, base, pos, mark, mx, my; - - for (k in il.COPagePres.iim_marker) { - m = il.COPagePres.iim_marker[k]; - this.fixMarkerPosition(m); - } - }, - - /** - * Make marker draggable - */ - startDraggingMarker: function(tr_nr) { - var k, mark; - - this.dragging = true; - for (k in il.COPagePres.iim_marker) { - if (il.COPagePres.iim_marker[k].tr_nr == tr_nr) { - mark = il.COPagePres.iim_marker[k]; - $("a#" + il.COPagePres.iim_marker[k].m_id).css("display", ""); - il.COPagePres.fixMarkerPositions(); - $("a#" + il.COPagePres.iim_marker[k].m_id).draggable({ - drag: function(event, ui) { - var base, bpos, marker, mpos, position; - - base = $("img#base_img_" + mark.iim_id); - bpos = base.position(); - marker = $("a#" + mark.m_id); - mpos = marker.position(); - //position = (Math.round(mpos.left) - Math.round(bpos.left)) + "," + - // (Math.round(mpos.top) - Math.round(bpos.top)); - position = (Math.round(marker.offset().left) - Math.round(base.offset().left)) + "," + - (Math.round(marker.offset().top) - Math.round(base.offset().top)); - - $("input#markpos_" + mark.tr_nr).attr("value", position); - } - }); - - il.COPagePres.initDragToolbar(); - } - else - { - $("a#" + il.COPagePres.iim_marker[k].m_id).css("display", "none"); - } - } - }, - - stopDraggingMarker: function() { - this.dragging = false; - }, - - /** - * Make overlay draggable - */ - startDraggingOverlay: function(tr_nr) { - var k, trigger, dtr, ov, base, bpos, ovx, ovy; - - this.dragging = true; - - for (k in il.COPagePres.iim_trigger) { - trigger = il.COPagePres.iim_trigger[k]; - - if (trigger.nr == tr_nr) { - dtr = trigger; - ov = $("img#iim_ov_" + dtr.tr_id); - - // remove map for dragging - ov.attr('usemap',''); - - il.COPagePres.initDragToolbar(); - - base = $("img#base_img_" + dtr.iim_id); - bpos = base.offset(); - ovx = bpos.left + parseInt(dtr.ovx, 10); - ovy = bpos.top + parseInt(dtr.ovy, 10); - ov.css('display', ''); - ov.css("position", "absolute"); - il.Overlay.setX("iim_ov_" + dtr.tr_id, ovx); - il.Overlay.setY("iim_ov_" + dtr.tr_id, ovy); - - dtr = trigger; - ov.draggable({ - stop: function(event, ui) { - var ovpos, position; - - ovpos = ov.position(); - position = (Math.round(ov.offset().left) - Math.round(base.offset().left)) + "," + - (Math.round(ov.offset().top) - Math.round(base.offset().top)); - - $("input#ovpos_" + dtr.nr).attr("value", position); - } - }); - } - } - }, - - /** - * Make popup draggable - */ - startDraggingPopup: function(tr_nr) { - var i, k, dtr, cpop, pdummy, base, bpos, popx, popy; - - this.dragging = true; - - // get correct trigger - for (k in il.COPagePres.iim_trigger) { - if (il.COPagePres.iim_trigger[k].nr == tr_nr) { - dtr = il.COPagePres.iim_trigger[k]; - - // get correct popup - for (i in il.COPagePres.iim_popup) { - if (il.COPagePres.iim_popup[i].nr == - il.COPagePres.iim_trigger[k].popup_nr) { - - cpop = il.COPagePres.iim_popup[i]; - pdummy = document.getElementById("popupdummy"); - if (pdummy == null) { - $('div#il_center_col').append('
'); - pdummy = $("div#popupdummy"); - } else { - pdummy = $("div#popupdummy"); - } - - il.COPagePres.initDragToolbar(); - - base = $("img#base_img_" + cpop.iim_id); - bpos = base.offset(); - popx = bpos.left + parseInt(dtr.popx, 10); - popy = bpos.top + parseInt(dtr.popy, 10); - pdummy.css("position", "absolute"); - pdummy.css('width', dtr.popwidth); - pdummy.css('height', dtr.popheight); - pdummy.css('display', ''); - il.Overlay.setX("popupdummy", popx); - il.Overlay.setY("popupdummy", popy); - - - pdummy.draggable({ - stop: function(event, ui) { - var pdpos, position; - - pdpos = pdummy.position(); - position = (Math.round(pdummy.offset().left) - Math.round(base.offset().left)) + "," + - (Math.round(pdummy.offset().top) - Math.round(base.offset().top)); - $("input#poppos_" + dtr.nr).attr("value", position); - } - }); - } - } - } - } - }, - - /** - * Init drag toolbar - */ - initDragToolbar: function() { - // show the toolbar - $("#drag_toolbar").removeClass("ilNoDisplay"); - this.fixMarkerPositions(); - $("#save_pos_button").click(function () { - $("input#update_tr_button").trigger("click"); - }); - }, - - - // - // Question Overviews - // - - qover: {}, - ganswer_data: {}, - - addQuestionOverview: function(conf) { - this.qover[conf.id] = conf; - }, - - updateQuestionOverviews: function() { - var correct = {}, - incorrect = {}, - correct_cnt = 0, - incorrect_cnt = 0, - answered_correctly, index, k, i, ov_el,ul, j, qtext; - - if (typeof questions === 'undefined') { - - // #17532 - question overview does not work in copage editor / preview - for (i in this.qover) { - ov_el = $('div#' + this.qover[i].div_id); - $(ov_el).addClass('ilBox'); - $(ov_el).css('margin', '5px'); - ov_el.empty(); - ov_el.append('
' + ilias.questions.txt.ov_preview + '
'); - } - - return; - } - - for (k in questions) { - answered_correctly = true; - index=parseInt(k, 10); - if (!isNaN(index)) { - if (!answers[index]) { - answered_correctly = false; - } else { - if (answers[index].passed!=true) { - answered_correctly = false; - } - } - if (!answered_correctly) { - incorrect[k] = k; - incorrect_cnt++; - } else { - correct[k] = k; - correct_cnt++; - } - } - } - - // iterate all question overview elements - for (i in this.qover) { - ov_el = $('div#' + this.qover[i].div_id); - - // remove all children - ov_el.empty(); - - // show success message, if all questions have been answered - if (incorrect_cnt == 0) { - ov_el.attr("class", 'ilc_qover_Correct'); - ov_el.append( - ilias.questions.txt.ov_all_correct); - } else { - ov_el.attr("class", 'ilc_qover_Incorrect'); - // show message including of number of not - // correctly answered questions - if (this.qover[i].short_message == "y") { - ov_el.append('
' + - ilias.questions.txt.ov_some_correct.split("[x]").join(String(correct_cnt)) - .split("[y]").join(String(incorrect_cnt + correct_cnt)) + - "
" - ); - } - - if (this.qover[i].list_wrong_questions == "y") { - ov_el.append( - '
' + - ilias.questions.txt.ov_wrong_answered + ":" + '
' - ); - - // list all incorrect answered questions - ov_el.append(''); - ul = $('div#' + this.qover[i].div_id + " > ul"); - for (j in incorrect) { - qtext = questions[j].question; - - if (questions[j].type == "assClozeTest") { - qtext = questions[j].title; - } - - ul.append( - '
  • ' + - '' + qtext + '' - + '
  • '); - } - } - } - } - }, - - // jump to a question - jumpToQuestion: function(qid) { - if (typeof pager !== "undefined") { - pager.jumpToElement("container" + qid); - } - return false; - }, - - setGivenAnswerData: function (data) { - ilCOPagePres.ganswer_data = data; - }, - - // - // Map area functions - // - - // init map areas - initMapAreas: function() { - - $('img[usemap^="#map_il_"][class!="ilIim"]').maphilight({"neverOn":true}); - }, - - //// - //// Handle advanced content - //// - showadvcont: true, - initAdvancedContent: function() { - var c = $("div.ilc_section_AdvancedKnowledge"), - b = $("#ilPageShowAdvContent"), cookiePos; - if (c.length > 0 && b.length > 0) { - cookiePos = document.cookie.indexOf("pg_hideadv="); - if (cookiePos > -1 && document.cookie.charAt(cookiePos + 11) == 1) { - this.showadvcont = false; - } - - $("#ilPageShowAdvContent").css("display", "block"); - if (il.COPagePres.showadvcont) { - $("div.ilc_section_AdvancedKnowledge").css("display", ""); - $("#ilPageShowAdvContent > span:nth-child(1)").css("display", "none"); - } else { - $("div.ilc_section_AdvancedKnowledge").css("display", "none"); - $("#ilPageShowAdvContent > span:nth-child(2)").css("display", "none"); - } - $("#ilPageShowAdvContent").click(function () { - if (il.COPagePres.showadvcont) { - $("div.ilc_section_AdvancedKnowledge").css("display", "none"); - $("#ilPageShowAdvContent > span:nth-child(1)").css("display", ""); - $("#ilPageShowAdvContent > span:nth-child(2)").css("display", "none"); - il.COPagePres.showadvcont = false; - document.cookie = "pg_hideadv=1"; - } else { - $("div.ilc_section_AdvancedKnowledge").css("display", ""); - $("#ilPageShowAdvContent > span:nth-child(1)").css("display", "none"); - $("#ilPageShowAdvContent > span:nth-child(2)").css("display", ""); - il.COPagePres.showadvcont = true; - document.cookie = "pg_hideadv=0"; - } - return false; - }); - } - }, - - //// - //// Audio/Video - //// - - initAudioVideo: function (acc_el) { - var $elements; - if (acc_el) { - $elements = $(acc_el).find('video.ilPageVideo,audio.ilPageAudio'); - } else { - $elements = $('video.ilPageVideo,audio.ilPageAudio'); - } - - if ($elements.mediaelementplayer) { - $elements.each(function(i, el) { - var def, cfg; - - def = $(el).find("track[default='default']").first().attr("srclang"); - cfg = {}; - if (def != ""){ - cfg.startLanguage = def; - } - $(el).mediaelementplayer(cfg); - }); - } - }, - - setFullscreenModalShowSignal: function (signal, suffix) { - il.COPagePres.fullscreen_signal = signal; - il.COPagePres.fullscreen_suffix = suffix - $('#il-copg-mob-fullscreen' + suffix).closest(".modal").on('shown.bs.modal', function () { - il.COPagePres.resizeFullScreenModal(suffix); - }).on('hidden.bs.modal', function () { - $("#il-copg-mob-fullscreen" + suffix).attr("src", ""); - }); - }, - - inIframe: function () { - try { - return window.self !== window.top; - } catch (e) { - return true; - } - }, - - openFullScreenModal: function (target) { - // see 32198 - if (il.COPagePres.inIframe()) { - window.parent.il.COPagePres.openFullScreenModal(target); - return; - } - $("#il-copg-mob-fullscreen" + il.COPagePres.fullscreen_suffix).attr("src", target); - // workaround for media pool full screen view - $("#ilMepPreviewContent").attr("src", target); - if (il.COPagePres.fullscreen_signal) { - $(document).trigger(il.COPagePres.fullscreen_signal, { - id: il.COPagePres.fullscreen_signal, - event: 'click', - triggerer: $(document), - options: JSON.parse('[]') - }); - } - }, - - resizeFullScreenModal: function (suffix) { - var vp = il.Util.getViewportRegion(); - var ifr = il.Util.getRegion('#il-copg-mob-fullscreen' + suffix); - $('.il-copg-mob-fullscreen').css("height", (vp.height - ifr.top + vp.top - 120) + "px"); - } - + toggleToc() { + let toc_on; let toc_off; const + toc = document.getElementById('ilPageTocContent'); + + if (!toc) { + return; + } + + toc_on = document.getElementById('ilPageTocOn'); + toc_off = document.getElementById('ilPageTocOff'); + + if (toc && toc.style.display == 'none') { + toc.style.display = 'block'; + toc_on.style.display = 'none'; + toc_off.style.display = ''; + document.cookie = 'pg_hidetoc=0'; + } else { + toc_on.style.display = ''; + toc_off.style.display = 'none'; + toc.style.display = 'none'; + document.cookie = 'pg_hidetoc=1'; + } + }, + + // + // Question Overviews + // + + qover: {}, + ganswer_data: {}, + + addQuestionOverview(conf) { + this.qover[conf.id] = conf; + }, + + updateQuestionOverviews() { + const correct = {}; + const incorrect = {}; + let correct_cnt = 0; + let incorrect_cnt = 0; + let answered_correctly; let index; let k; let i; let ov_el; let ul; let j; let + qtext; + + if (typeof questions === 'undefined') { + // #17532 - question overview does not work in copage editor / preview + for (i in this.qover) { + ov_el = $(`div#${this.qover[i].div_id}`); + $(ov_el).addClass('ilBox'); + $(ov_el).css('margin', '5px'); + ov_el.empty(); + ov_el.append(`
    ${ilias.questions.txt.ov_preview}
    `); + } + + return; + } + + for (k in questions) { + answered_correctly = true; + index = parseInt(k, 10); + if (!isNaN(index)) { + if (!answers[index]) { + answered_correctly = false; + } else if (answers[index].passed != true) { + answered_correctly = false; + } + if (!answered_correctly) { + incorrect[k] = k; + incorrect_cnt++; + } else { + correct[k] = k; + correct_cnt++; + } + } + } + + // iterate all question overview elements + for (i in this.qover) { + ov_el = $(`div#${this.qover[i].div_id}`); + + // remove all children + ov_el.empty(); + + // show success message, if all questions have been answered + if (incorrect_cnt == 0) { + ov_el.attr('class', 'ilc_qover_Correct'); + ov_el.append( + ilias.questions.txt.ov_all_correct, + ); + } else { + ov_el.attr('class', 'ilc_qover_Incorrect'); + // show message including of number of not + // correctly answered questions + if (this.qover[i].short_message == 'y') { + ov_el.append(`
    ${ + ilias.questions.txt.ov_some_correct.split('[x]').join(String(correct_cnt)) + .split('[y]').join(String(incorrect_cnt + correct_cnt)) + }
    `); + } + + if (this.qover[i].list_wrong_questions == 'y') { + ov_el.append( + `
    ${ + ilias.questions.txt.ov_wrong_answered}:` + '
    ', + ); + + // list all incorrect answered questions + ov_el.append(''); + ul = $(`div#${this.qover[i].div_id} > ul`); + for (j in incorrect) { + qtext = questions[j].question; + + if (questions[j].type == 'assClozeTest') { + qtext = questions[j].title; + } + + ul.append( + '
  • ' + + `${qtext}` + + '
  • ', + ); + } + } + } + } + }, + + // jump to a question + jumpToQuestion(qid) { + if (typeof pager !== 'undefined') { + pager.jumpToElement(`container${qid}`); + } + return false; + }, + + setGivenAnswerData(data) { + ilCOPagePres.ganswer_data = data; + }, + + // + // Map area functions + // + + // init map areas + initMapAreas() { + $('img[usemap^="#map_il_"][class!="ilIim"]').maphilight({ neverOn: true }); + }, + + /// / + /// / Handle advanced content + /// / + showadvcont: true, + initAdvancedContent() { + const c = $('div.ilc_section_AdvancedKnowledge'); + const b = $('#ilPageShowAdvContent'); let + cookiePos; + if (c.length > 0 && b.length > 0) { + cookiePos = document.cookie.indexOf('pg_hideadv='); + if (cookiePos > -1 && document.cookie.charAt(cookiePos + 11) == 1) { + this.showadvcont = false; + } + + $('#ilPageShowAdvContent').css('display', 'block'); + if (il.COPagePres.showadvcont) { + $('div.ilc_section_AdvancedKnowledge').css('display', ''); + $('#ilPageShowAdvContent > span:nth-child(1)').css('display', 'none'); + } else { + $('div.ilc_section_AdvancedKnowledge').css('display', 'none'); + $('#ilPageShowAdvContent > span:nth-child(2)').css('display', 'none'); + } + $('#ilPageShowAdvContent').click(() => { + if (il.COPagePres.showadvcont) { + $('div.ilc_section_AdvancedKnowledge').css('display', 'none'); + $('#ilPageShowAdvContent > span:nth-child(1)').css('display', ''); + $('#ilPageShowAdvContent > span:nth-child(2)').css('display', 'none'); + il.COPagePres.showadvcont = false; + document.cookie = 'pg_hideadv=1'; + } else { + $('div.ilc_section_AdvancedKnowledge').css('display', ''); + $('#ilPageShowAdvContent > span:nth-child(1)').css('display', 'none'); + $('#ilPageShowAdvContent > span:nth-child(2)').css('display', ''); + il.COPagePres.showadvcont = true; + document.cookie = 'pg_hideadv=0'; + } + return false; + }); + } + }, + + /// / + /// / Audio/Video + /// / + + initAudioVideo(acc_el) { + let $elements; + if (acc_el) { + $elements = $(acc_el).find('video.ilPageVideo,audio.ilPageAudio'); + } else { + $elements = $('video.ilPageVideo,audio.ilPageAudio'); + } + + if ($elements.mediaelementplayer) { + $elements.each((i, el) => { + let def; let + cfg; + + def = $(el).find("track[default='default']").first().attr('srclang'); + cfg = {}; + if (def != '') { + cfg.startLanguage = def; + } + $(el).mediaelementplayer(cfg); + }); + } + }, + + setFullscreenModalShowSignal(signal, suffix) { + il.COPagePres.fullscreen_signal = signal; + il.COPagePres.fullscreen_suffix = suffix; + $(`#il-copg-mob-fullscreen${suffix}`).closest('.modal').on('shown.bs.modal', () => { + il.COPagePres.resizeFullScreenModal(suffix); + }).on('hidden.bs.modal', () => { + $(`#il-copg-mob-fullscreen${suffix}`).attr('src', ''); + }); + }, + + inIframe() { + try { + return window.self !== window.top; + } catch (e) { + return true; + } + }, + + openFullScreenModal(target) { + // see 32198 + if (il.COPagePres.inIframe()) { + window.parent.il.COPagePres.openFullScreenModal(target); + return; + } + $(`#il-copg-mob-fullscreen${il.COPagePres.fullscreen_suffix}`).attr('src', target); + // workaround for media pool full screen view + $('#ilMepPreviewContent').attr('src', target); + if (il.COPagePres.fullscreen_signal) { + $(document).trigger(il.COPagePres.fullscreen_signal, { + id: il.COPagePres.fullscreen_signal, + event: 'click', + triggerer: $(document), + options: JSON.parse('[]'), + }); + } + }, + + resizeFullScreenModal(suffix) { + const vp = il.Util.getViewportRegion(); + const ifr = il.Util.getRegion(`#il-copg-mob-fullscreen${suffix}`); + $('.il-copg-mob-fullscreen').css('height', `${vp.height - ifr.top + vp.top - 120}px`); + }, }; -il.Util.addOnLoad(function() {il.COPagePres.init();}); +il.Util.addOnLoad(() => { il.COPagePres.init(); }); diff --git a/Services/MediaObjects/ImageMap/class.ilMapArea.php b/Services/MediaObjects/ImageMap/class.ilMapArea.php index 2fdc8290f5ab..40ac96bcb788 100755 --- a/Services/MediaObjects/ImageMap/class.ilMapArea.php +++ b/Services/MediaObjects/ImageMap/class.ilMapArea.php @@ -699,7 +699,7 @@ public function drawCircle( * @param string $c coordinate string * @return int number of coordinates */ - public static function countCoords(string $c): int + public static function countCoords(string $c): float { if ($c == "") { return 0;