From 204338a5e8d619a20879e7fbf2b041306e8725a6 Mon Sep 17 00:00:00 2001 From: xus Date: Wed, 24 Jan 2018 13:54:52 +0100 Subject: [PATCH 01/11] First steps: modal replace content --- src/UI/Component/Modal/Modal.php | 14 +++ .../Component/Modal/ReplaceContentSignal.php | 31 ++++++ .../Implementation/Component/Modal/Modal.php | 29 ++++++ .../Component/Modal/Renderer.php | 98 +++++++++++++++++-- .../Component/Modal/ReplaceContentSignal.php | 39 ++++++++ .../Component/Modal/RoundTrip.php | 32 ++++++ src/UI/templates/js/Modal/modal.js | 65 +++++++++++- 7 files changed, 300 insertions(+), 8 deletions(-) create mode 100644 src/UI/Component/Modal/ReplaceContentSignal.php create mode 100644 src/UI/Implementation/Component/Modal/ReplaceContentSignal.php diff --git a/src/UI/Component/Modal/Modal.php b/src/UI/Component/Modal/Modal.php index 51519c2537ec..7baf4cd3a18c 100644 --- a/src/UI/Component/Modal/Modal.php +++ b/src/UI/Component/Modal/Modal.php @@ -65,4 +65,18 @@ public function getShowSignal(); */ public function getCloseSignal(); + /** + * Get the signal to replace the content of this modal. + * + * @return ReplaceContentSignal + */ + public function getReplaceContentSignal(); + + /** + * Get the url returning the rendered content, if the popovers content is rendered via ajax. + * + * @return string + */ + public function getAsyncContentUrl(); + } diff --git a/src/UI/Component/Modal/ReplaceContentSignal.php b/src/UI/Component/Modal/ReplaceContentSignal.php new file mode 100644 index 000000000000..11930b13b0d9 --- /dev/null +++ b/src/UI/Component/Modal/ReplaceContentSignal.php @@ -0,0 +1,31 @@ + + * @package ILIAS\UI\Component\Modal + */ +interface ReplaceContentSignal extends Signal +{ + + /** + * Get the same signal returning the Modal content from the given url. + * + * @param string $url + * + * @return ReplaceContentSignal + */ + public function withAsyncRenderUrl($url); + + /** + * Get the url called to return the content. + * + * @return string + */ + public function getAsyncRenderUrl(); +} \ No newline at end of file diff --git a/src/UI/Implementation/Component/Modal/Modal.php b/src/UI/Implementation/Component/Modal/Modal.php index 6ff3bc219444..04a5e850b1d6 100644 --- a/src/UI/Implementation/Component/Modal/Modal.php +++ b/src/UI/Implementation/Component/Modal/Modal.php @@ -34,6 +34,9 @@ abstract class Modal implements Component\Modal\Modal { */ protected $close_signal; + protected $ajax_content_url; + protected $replace_content_signal; + /** * @var string */ @@ -130,6 +133,32 @@ public function appendOnLoad(Signal $signal) { protected function initSignals() { $this->show_signal = $this->signal_generator->create(); $this->close_signal = $this->signal_generator->create(); + $this->replace_content_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\Modal\\ReplaceContentSignal"); + } + + /** + * @inheritdoc + */ + public function getReplaceContentSignal() { + return $this->replace_content_signal; + } + + /** + * @inheritdoc + */ + public function withAsyncContentUrl($url) { + $this->checkStringArg('url', $url); + $clone = clone $this; + $clone->ajax_content_url = $url; + + return $clone; + } + + /** + * @inheritdoc + */ + public function getAsyncContentUrl() { + return $this->ajax_content_url; } } diff --git a/src/UI/Implementation/Component/Modal/Renderer.php b/src/UI/Implementation/Component/Modal/Renderer.php index eec4525f7d62..ec7c82a218fc 100644 --- a/src/UI/Implementation/Component/Modal/Renderer.php +++ b/src/UI/Implementation/Component/Modal/Renderer.php @@ -17,11 +17,20 @@ class Renderer extends AbstractComponentRenderer { public function render(Component\Component $component, RendererInterface $default_renderer) { $this->checkComponent($component); + global $DIC; + + $log = $DIC->logger()->root(); + // If the modal is rendered async, we just create a fake container which will be // replaced by the modal upon successful ajax request /** @var Modal $component */ if ($component->getAsyncRenderUrl()) { + + $log->debug("///// Modal getAsyncRenderURL"); return $this->renderAsync($component); + } else + { + $log->debug("///// MOdal else not async render URL"); } if ($component instanceof Component\Modal\Interruptive) { @@ -48,12 +57,28 @@ public function registerResources(ResourceRegistry $registry) { * @param string $id */ protected function registerSignals(Component\Modal\Modal $modal) { + + /** + * THis method is not called temporary by the roundtrip modal. + */ + $replacement = array( + '"'=> '\"', + "\n"=>"", + "\t"=>"", + "\r"=>"", + ); + $show = $modal->getShowSignal(); $close = $modal->getCloseSignal(); - $options = json_encode(array( + $replace = $modal->getReplaceContentSignal(); + + $is_async = $modal->getAsyncContentUrl(); + + $options = array( 'ajaxRenderUrl' => $modal->getAsyncRenderUrl(), 'keyboard' => $modal->getCloseWithKeyboard(), - )); + //'template' => str_replace(array_keys($replacement), array_values($replacement), $tpl->get()) + ); // ATTENTION, ATTENTION: // with(Additional)OnLoadCode opens a wormhole into the future, where some unspecified // entity magically created an id for the component that can be used to refer to it @@ -70,10 +95,15 @@ protected function registerSignals(Component\Modal\Modal $modal) { // created // * since withAdditionalOnLoadCode refers to some yet unknown future, it disencourages // tempering with the id _here_. - return $modal->withAdditionalOnLoadCode(function($id) use ($show, $close, $options) { + return $modal->withAdditionalOnLoadCode(function($id) use ($show, $close, $options, $replace, $is_async) { + if (!$is_async) { + $options["url"] = "#{$id}"; + } + $options = json_encode($options); return "$(document).on('{$show}', function() { il.UI.modal.showModal('{$id}', {$options}); return false; });". - "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });"; + "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });". + "$(document).on('{$replace}', function(event, signalData) { il.UI.modal.replaceContentFromSignal('{$show}', signalData);});"; }); } @@ -126,10 +156,66 @@ protected function renderInterruptive(Component\Modal\Interruptive $modal, Rende * * @return string */ - protected function renderRoundTrip(Component\Modal\RoundTrip $modal, RendererInterface $default_renderer) { + protected function renderRoundTrip(Component\Modal\RoundTrip $modal, RendererInterface $default_renderer) + { + global $DIC; + + $log = $DIC->logger()->root(); + $tpl = $this->getTemplate('tpl.roundtrip.html', true, true); - $modal = $this->registerSignals($modal); + + /** + * Todo after fixing: Put the proper code in registerSignals method. + */ + //$modal = $this->registerSignals($modal); + + $replacement = array( + '"'=> '\"', + "\n"=>"", + "\t"=>"", + "\r"=>"", + ); + + $options = array( + 'ajaxRenderUrl' => $modal->getAsyncRenderUrl(), + 'keyboard' => $modal->getCloseWithKeyboard() + //'template' => str_replace(array_keys($replacement), array_values($replacement), $tpl->get()) + ); + $is_async = $modal->getAsyncContentUrl(); + if ($is_async) { + $options['type'] = 'async'; + $options['url'] = $modal->getAsyncContentUrl(); + } + + $show = $modal->getShowSignal(); + $close = $modal->getCloseSignal(); + $replace = $modal->getReplaceContentSignal(); + + $ar = $replace->getAsyncRenderUrl(); + $log->debug("Async render URL => ".$ar); + + $modal = $modal->withAdditionalOnLoadCode(function($id) use ($show, $close, $options, $replace, $is_async) { + if (!$is_async) { + $options["url"] = "#{$id}"; + } + $options = json_encode($options); + + return + "$(document).on('{$show}', function() { il.UI.modal.showModal('{$id}', {$options}); return false; });". + "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });". + "$(document).on('{$replace}', function(event, signalData) { il.UI.modal.replaceContentFromSignal('{$show}', signalData);});"; + }); + $id = $this->bindJavaScript($modal); + //este metodo existe? + + + if ($modal->getAsyncContentUrl()) { + $log->debug("RETURN WITHOUT CONTENT"); + return ''; + } else { + $log->debug("ELSE no async content"); + } $tpl->setVariable('ID', $id); $tpl->setVariable('TITLE', $modal->getTitle()); foreach ($modal->getContent() as $content) { diff --git a/src/UI/Implementation/Component/Modal/ReplaceContentSignal.php b/src/UI/Implementation/Component/Modal/ReplaceContentSignal.php new file mode 100644 index 000000000000..93f9a4368636 --- /dev/null +++ b/src/UI/Implementation/Component/Modal/ReplaceContentSignal.php @@ -0,0 +1,39 @@ + DRY and centralize it. + * + * @author Jesús López + * @package ILIAS\UI\Implementation\Component\Modal + */ +class ReplaceContentSignal extends Signal implements \ILIAS\UI\Component\Modal\ReplaceContentSignal { + + use ComponentHelper; + + + /** + * @inheritdoc + */ + public function withAsyncRenderUrl($url) { + $this->checkStringArg('url', $url); + $clone = clone $this; + $clone->addOption('url', $url); + + return $clone; + } + + + /** + * @inheritdoc + */ + public function getAsyncRenderUrl() { + return (string)$this->getOption('url'); + } +} \ No newline at end of file diff --git a/src/UI/Implementation/Component/Modal/RoundTrip.php b/src/UI/Implementation/Component/Modal/RoundTrip.php index 67c7c76bcfac..e68ec9ca682e 100644 --- a/src/UI/Implementation/Component/Modal/RoundTrip.php +++ b/src/UI/Implementation/Component/Modal/RoundTrip.php @@ -99,4 +99,36 @@ public function withCancelButtonLabel($label) { $clone->cancel_button_label = $label; return $clone; } + + + /** + * + * + * + * + * + * WORKING HERE + * + * + * + * + * + * + */ + /** + * @inheritdoc + */ + public function withAsyncContentUrl($url) { + $this->checkStringArg('url', $url); + $clone = clone $this; + $clone->ajax_content_url = $url; + + return $clone; + } + + public function getAsyncContentUrl() + { + //remove this dummy line + return $this->ajax_content_url; + } } diff --git a/src/UI/templates/js/Modal/modal.js b/src/UI/templates/js/Modal/modal.js index f07a66fb3036..4bfa3d1d6d4e 100644 --- a/src/UI/templates/js/Modal/modal.js +++ b/src/UI/templates/js/Modal/modal.js @@ -8,9 +8,13 @@ il.UI = il.UI || {}; var defaultShowOptions = { backdrop: true, keyboard: true, - ajaxRenderUrl: '' + ajaxRenderUrl: '', + trigger: 'click' }; + var initializedModalboxes = {}; + + var showModal = function (id, options) { options = $.extend(defaultShowOptions, options); if (options.ajaxRenderUrl) { @@ -31,9 +35,66 @@ il.UI = il.UI || {}; $('#' + id).modal('close'); }; + /** + * Show a modal for a triggerer element (the element triggering the show signal) with the given options. + * + * @param signalData Object containing all data from the signal + * @param options Object with modalbox options + */ + var showFromSignal = function (signalData, options) { + var $triggerer = signalData.triggerer; + if (!$triggerer.length) { + return; + } + var triggererId = $triggerer.attr('id'); + if (signalData.event === 'mouseenter') { + options.trigger = 'hover'; + } + var initialized = show($triggerer, options); + if (initialized === false) { + initializedModalboxes[signalData.id] = triggererId; + } + }; + + /** + * Replace the content of the modalbox showed by the given showSignal with the data returned by the URL + * set in the signal options. + * + * @param showSignal ID of the show signal for the modalbox + * @param signalData Object containing all data from the replace signal + */ + var replaceContentFromSignal = function (showSignal, signalData) { + console.log(signalData); + // Find the ID of the triggerer where this modalbox belongs to + var triggererId = (showSignal in initializedModalboxes) ? initializedModalboxes[showSignal] : 0; + if (!triggererId) return; + // Find the content of the modalbox + var $triggerer = $('#' + triggererId); + var url = signalData.options.url; + replaceContent($triggerer, url); + }; + + /** + * Replace the content of the modalbox of the $triggerer JQuery object with the data returned by the + * given url. + * + * @param $triggerer JQuery object where the modalbox belongs to + * @param url The URL where the ajax GET request is sent to load the new content + */ + var replaceContent = function($triggerer, url) { + var $content = $('#' + $triggerer.attr('data-target')).find('.il-modal-content'); + if (!$content.length) return; + $content.html('

 

'); + $content.load(url, function() { + console.log('loaded'); + }); + }; + return { showModal: showModal, - closeModal: closeModal + closeModal: closeModal, + showFromSignal: showFromSignal, + replaceContentFromSignal: replaceContentFromSignal }; })($); From e45e559e9ac22d88d36114b79316baf4eb5341ba Mon Sep 17 00:00:00 2001 From: xus Date: Wed, 24 Jan 2018 15:22:53 +0100 Subject: [PATCH 02/11] move the new staff from modal to roundtrip --- src/UI/Component/Modal/Modal.php | 15 ---------- src/UI/Component/Modal/RoundTrip.php | 21 +++++++++++++ .../Implementation/Component/Modal/Modal.php | 30 ------------------- .../Component/Modal/Renderer.php | 11 ++++--- .../Component/Modal/RoundTrip.php | 19 ++++++++++++ 5 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/UI/Component/Modal/Modal.php b/src/UI/Component/Modal/Modal.php index 7baf4cd3a18c..895e481eeda9 100644 --- a/src/UI/Component/Modal/Modal.php +++ b/src/UI/Component/Modal/Modal.php @@ -64,19 +64,4 @@ public function getShowSignal(); * @return Signal */ public function getCloseSignal(); - - /** - * Get the signal to replace the content of this modal. - * - * @return ReplaceContentSignal - */ - public function getReplaceContentSignal(); - - /** - * Get the url returning the rendered content, if the popovers content is rendered via ajax. - * - * @return string - */ - public function getAsyncContentUrl(); - } diff --git a/src/UI/Component/Modal/RoundTrip.php b/src/UI/Component/Modal/RoundTrip.php index 61a58559f5df..3365b31e69ae 100644 --- a/src/UI/Component/Modal/RoundTrip.php +++ b/src/UI/Component/Modal/RoundTrip.php @@ -57,4 +57,25 @@ public function withActionButtons(array $buttons); * @return RoundTrip */ public function withCancelButtonLabel($label); + + /** + * Get the signal to replace the content of this modal. + * + * @return ReplaceContentSignal + */ + public function getReplaceContentSignal(); + + /** + * Get the url returning the rendered content, if the popovers content is rendered via ajax. + * + * @return string + */ + public function getAsyncContentUrl(); + + public function withAsyncContentUrl($url); + + /** + * Init the default signals plus extra signals like replaceContent + */ + public function initSignals(); } diff --git a/src/UI/Implementation/Component/Modal/Modal.php b/src/UI/Implementation/Component/Modal/Modal.php index 04a5e850b1d6..d03f91c6a5b2 100644 --- a/src/UI/Implementation/Component/Modal/Modal.php +++ b/src/UI/Implementation/Component/Modal/Modal.php @@ -33,10 +33,6 @@ abstract class Modal implements Component\Modal\Modal { * @var Signal */ protected $close_signal; - - protected $ajax_content_url; - protected $replace_content_signal; - /** * @var string */ @@ -133,32 +129,6 @@ public function appendOnLoad(Signal $signal) { protected function initSignals() { $this->show_signal = $this->signal_generator->create(); $this->close_signal = $this->signal_generator->create(); - $this->replace_content_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\Modal\\ReplaceContentSignal"); - } - - /** - * @inheritdoc - */ - public function getReplaceContentSignal() { - return $this->replace_content_signal; - } - - /** - * @inheritdoc - */ - public function withAsyncContentUrl($url) { - $this->checkStringArg('url', $url); - $clone = clone $this; - $clone->ajax_content_url = $url; - - return $clone; - } - - /** - * @inheritdoc - */ - public function getAsyncContentUrl() { - return $this->ajax_content_url; } } diff --git a/src/UI/Implementation/Component/Modal/Renderer.php b/src/UI/Implementation/Component/Modal/Renderer.php index ec7c82a218fc..a1fe1c5a8611 100644 --- a/src/UI/Implementation/Component/Modal/Renderer.php +++ b/src/UI/Implementation/Component/Modal/Renderer.php @@ -183,16 +183,20 @@ protected function renderRoundTrip(Component\Modal\RoundTrip $modal, RendererInt ); $is_async = $modal->getAsyncContentUrl(); if ($is_async) { +$log->debug("RENDER IS ASYNCR."); $options['type'] = 'async'; $options['url'] = $modal->getAsyncContentUrl(); + } else + { +$log->debug("ELSE: RENDER IS NOT ASYNCR."); } $show = $modal->getShowSignal(); $close = $modal->getCloseSignal(); $replace = $modal->getReplaceContentSignal(); - $ar = $replace->getAsyncRenderUrl(); - $log->debug("Async render URL => ".$ar); +$ar = $replace->getAsyncRenderUrl(); +$log->debug("Async render URL => ".$ar); $modal = $modal->withAdditionalOnLoadCode(function($id) use ($show, $close, $options, $replace, $is_async) { if (!$is_async) { @@ -206,9 +210,8 @@ protected function renderRoundTrip(Component\Modal\RoundTrip $modal, RendererInt "$(document).on('{$replace}', function(event, signalData) { il.UI.modal.replaceContentFromSignal('{$show}', signalData);});"; }); + //should we send it via param to the renderer? $id = $this->bindJavaScript($modal); - //este metodo existe? - if ($modal->getAsyncContentUrl()) { $log->debug("RETURN WITHOUT CONTENT"); diff --git a/src/UI/Implementation/Component/Modal/RoundTrip.php b/src/UI/Implementation/Component/Modal/RoundTrip.php index e68ec9ca682e..a290f1ad06b1 100644 --- a/src/UI/Implementation/Component/Modal/RoundTrip.php +++ b/src/UI/Implementation/Component/Modal/RoundTrip.php @@ -30,6 +30,9 @@ class RoundTrip extends Modal implements Component\Modal\RoundTrip { */ protected $cancel_button_label = 'cancel'; + protected $ajax_content_url; + protected $replace_content_signal; + /** * @param string $title @@ -131,4 +134,20 @@ public function getAsyncContentUrl() //remove this dummy line return $this->ajax_content_url; } + + /** + * @inheritdoc + */ + public function getReplaceContentSignal() { + return $this->replace_content_signal; + } + + /** + * Set the show/close/replace signals for this modal + */ + protected function initSignals() { + parent::initSignals(); + //signal generator from parent class + $this->replace_content_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\Modal\\ReplaceContentSignal"); + } } From 6d99e0b3dc3cbfd85dfd58397b0ef77030dbc0b8 Mon Sep 17 00:00:00 2001 From: xus Date: Wed, 24 Jan 2018 15:28:41 +0100 Subject: [PATCH 03/11] roundtrip public initSignals --- src/UI/Implementation/Component/Modal/RoundTrip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UI/Implementation/Component/Modal/RoundTrip.php b/src/UI/Implementation/Component/Modal/RoundTrip.php index a290f1ad06b1..48ab96d9b7f7 100644 --- a/src/UI/Implementation/Component/Modal/RoundTrip.php +++ b/src/UI/Implementation/Component/Modal/RoundTrip.php @@ -145,7 +145,7 @@ public function getReplaceContentSignal() { /** * Set the show/close/replace signals for this modal */ - protected function initSignals() { + public function initSignals() { parent::initSignals(); //signal generator from parent class $this->replace_content_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\Modal\\ReplaceContentSignal"); From ca237cd470086ec9832ef9d7769f65063eac5b03 Mon Sep 17 00:00:00 2001 From: xus Date: Fri, 26 Jan 2018 15:22:49 +0100 Subject: [PATCH 04/11] js: find proper modal css class & alias for the signal use. --- .../Implementation/Component/Modal/RoundTrip.php | 15 --------------- .../Component/SignalGeneratorInterface.php | 4 +++- src/UI/templates/js/Modal/modal.js | 5 +++-- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/UI/Implementation/Component/Modal/RoundTrip.php b/src/UI/Implementation/Component/Modal/RoundTrip.php index 48ab96d9b7f7..45fdffecbaa4 100644 --- a/src/UI/Implementation/Component/Modal/RoundTrip.php +++ b/src/UI/Implementation/Component/Modal/RoundTrip.php @@ -103,21 +103,6 @@ public function withCancelButtonLabel($label) { return $clone; } - - /** - * - * - * - * - * - * WORKING HERE - * - * - * - * - * - * - */ /** * @inheritdoc */ diff --git a/src/UI/Implementation/Component/SignalGeneratorInterface.php b/src/UI/Implementation/Component/SignalGeneratorInterface.php index f85373e015a2..638d6f8041b8 100644 --- a/src/UI/Implementation/Component/SignalGeneratorInterface.php +++ b/src/UI/Implementation/Component/SignalGeneratorInterface.php @@ -1,7 +1,9 @@

 

'); $content.load(url, function() { @@ -94,7 +94,8 @@ il.UI = il.UI || {}; showModal: showModal, closeModal: closeModal, showFromSignal: showFromSignal, - replaceContentFromSignal: replaceContentFromSignal + replaceContentFromSignal: replaceContentFromSignal, + replaceContent: replaceContent }; })($); From 8cd1b416554a5d966a70dc0be267fb37a4561e14 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Tue, 30 Jan 2018 19:59:20 +0100 Subject: [PATCH 05/11] implemented replace content signal --- src/UI/Component/Modal/RoundTrip.php | 8 ++++ .../Component/Modal/Renderer.php | 2 +- .../Component/Modal/RoundTrip.php | 11 +++++ src/UI/templates/js/Modal/modal.js | 46 ++++++++----------- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/UI/Component/Modal/RoundTrip.php b/src/UI/Component/Modal/RoundTrip.php index 3365b31e69ae..bde0b396a092 100644 --- a/src/UI/Component/Modal/RoundTrip.php +++ b/src/UI/Component/Modal/RoundTrip.php @@ -23,6 +23,14 @@ public function getTitle(); */ public function getContent(); + /** + * Get Modal likee this with the provided components representing the content of the modal + * + * @param \ILIAS\UI\Component\Component[] $a_content + * @return RoundTrip + */ + public function withContent($a_content); + /** * Get all action buttons in the footer of the modal diff --git a/src/UI/Implementation/Component/Modal/Renderer.php b/src/UI/Implementation/Component/Modal/Renderer.php index a1fe1c5a8611..efd4004f96de 100644 --- a/src/UI/Implementation/Component/Modal/Renderer.php +++ b/src/UI/Implementation/Component/Modal/Renderer.php @@ -101,7 +101,7 @@ protected function registerSignals(Component\Modal\Modal $modal) { } $options = json_encode($options); return - "$(document).on('{$show}', function() { il.UI.modal.showModal('{$id}', {$options}); return false; });". + "$(document).on('{$show}', function(event, signalData) { il.UI.modal.showModal('{$id}', {$options}, signalData); return false; });". "$(document).on('{$close}', function() { il.UI.modal.closeModal('{$id}'); return false; });". "$(document).on('{$replace}', function(event, signalData) { il.UI.modal.replaceContentFromSignal('{$show}', signalData);});"; }); diff --git a/src/UI/Implementation/Component/Modal/RoundTrip.php b/src/UI/Implementation/Component/Modal/RoundTrip.php index 45fdffecbaa4..0009272ad305 100644 --- a/src/UI/Implementation/Component/Modal/RoundTrip.php +++ b/src/UI/Implementation/Component/Modal/RoundTrip.php @@ -135,4 +135,15 @@ public function initSignals() { //signal generator from parent class $this->replace_content_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\Modal\\ReplaceContentSignal"); } + + /** + * @inheritdoc + */ + public function withContent($content) { + $clone = clone $this; + $clone->content = $content; + + return $clone; + } + } diff --git a/src/UI/templates/js/Modal/modal.js b/src/UI/templates/js/Modal/modal.js index 2341a7e53470..53594a03039e 100644 --- a/src/UI/templates/js/Modal/modal.js +++ b/src/UI/templates/js/Modal/modal.js @@ -15,7 +15,7 @@ il.UI = il.UI || {}; var initializedModalboxes = {}; - var showModal = function (id, options) { + var showModal = function (id, options, signalData) { options = $.extend(defaultShowOptions, options); if (options.ajaxRenderUrl) { var $container = $('#' + id); @@ -29,33 +29,13 @@ il.UI = il.UI || {}; var $modal = $('#' + id); $modal.modal(options); } - }; + initializedModalboxes[signalData.id] = id; + }; var closeModal = function (id) { $('#' + id).modal('close'); }; - /** - * Show a modal for a triggerer element (the element triggering the show signal) with the given options. - * - * @param signalData Object containing all data from the signal - * @param options Object with modalbox options - */ - var showFromSignal = function (signalData, options) { - var $triggerer = signalData.triggerer; - if (!$triggerer.length) { - return; - } - var triggererId = $triggerer.attr('id'); - if (signalData.event === 'mouseenter') { - options.trigger = 'hover'; - } - var initialized = show($triggerer, options); - if (initialized === false) { - initializedModalboxes[signalData.id] = triggererId; - } - }; - /** * Replace the content of the modalbox showed by the given showSignal with the data returned by the URL * set in the signal options. @@ -64,14 +44,27 @@ il.UI = il.UI || {}; * @param signalData Object containing all data from the replace signal */ var replaceContentFromSignal = function (showSignal, signalData) { - console.log(signalData); + // Find the ID of the triggerer where this modalbox belongs to var triggererId = (showSignal in initializedModalboxes) ? initializedModalboxes[showSignal] : 0; if (!triggererId) return; + // Find the content of the modalbox - var $triggerer = $('#' + triggererId); + var $modal = $('#' + triggererId + " .modal"); var url = signalData.options.url; - replaceContent($triggerer, url); + + // get new stuff via ajax + $.ajax({ + url: url, + dataType: 'html' + }).done(function(html) { + var $new_modal = $("
" + html + "
"); + + // of the new modal, we want the inner html of the modal (without the new top modal node, since + // we want to keep our id. Additionally we want the script tag with its content. + // Since html() gives us the inner html of the script tag only, we clone, wrap and get the inner from the wrapper... + $modal.html($new_modal.find(".modal").first().html() + $new_modal.find("script").first().clone().wrap('

').parent().html()); + }); }; /** @@ -93,7 +86,6 @@ il.UI = il.UI || {}; return { showModal: showModal, closeModal: closeModal, - showFromSignal: showFromSignal, replaceContentFromSignal: replaceContentFromSignal, replaceContent: replaceContent }; From 766c0825056907347c1fccaf55eb74319cb528ec Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 2 Feb 2018 12:59:10 +0100 Subject: [PATCH 06/11] fixed ilCtrl integration in page plugin presentation --- Modules/Blog/classes/class.ilBlogPostingGUI.php | 2 +- .../Course/classes/Objectives/class.ilLOPageGUI.php | 2 +- .../class.ilDclDetailedViewDefinitionGUI.php | 2 +- .../Glossary/classes/class.ilGlossaryDefPageGUI.php | 2 +- Modules/LearningModule/classes/class.ilLMPageGUI.php | 2 +- .../MediaPool/classes/class.ilMediaPoolPageGUI.php | 2 +- .../Portfolio/classes/class.ilPortfolioPageGUI.php | 2 +- .../Scorm2004/classes/class.ilSCORM2004PageGUI.php | 2 +- .../classes/class.ilAssHintPageGUI.php | 2 +- .../classes/class.ilAssQuestionPageGUI.php | 2 +- .../feedback/class.ilAssGenFeedbackPageGUI.php | 2 +- .../feedback/class.ilAssSpecFeedbackPageGUI.php | 2 +- Modules/Wiki/classes/class.ilWikiPageGUI.php | 2 +- .../Authentication/classes/class.ilLoginPageGUI.php | 2 +- .../COPage/Layout/classes/class.ilPageLayoutGUI.php | 2 +- Services/COPage/classes/class.ilPCPluggedGUI.php | 2 +- .../COPage/classes/class.ilPageComponentPlugin.php | 10 ++++++++++ Services/COPage/classes/class.ilPageObjectGUI.php | 11 ++++++++++- .../Container/classes/class.ilContainerPageGUI.php | 2 +- .../classes/class.ilContainerStartObjectsPageGUI.php | 2 +- Services/Imprint/classes/class.ilImprintGUI.php | 2 +- 21 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Modules/Blog/classes/class.ilBlogPostingGUI.php b/Modules/Blog/classes/class.ilBlogPostingGUI.php index 61d6e7f1bffe..354d09bade96 100644 --- a/Modules/Blog/classes/class.ilBlogPostingGUI.php +++ b/Modules/Blog/classes/class.ilBlogPostingGUI.php @@ -11,7 +11,7 @@ * @version $Id$ * * @ilCtrl_Calls ilBlogPostingGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector - * @ilCtrl_Calls ilBlogPostingGUI: ilRatingGUI, ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI + * @ilCtrl_Calls ilBlogPostingGUI: ilRatingGUI, ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI, ilPCPluggedGUI * * @ingroup ModulesBlog */ diff --git a/Modules/Course/classes/Objectives/class.ilLOPageGUI.php b/Modules/Course/classes/Objectives/class.ilLOPageGUI.php index de7beefc665f..cc8735a822b4 100644 --- a/Modules/Course/classes/Objectives/class.ilLOPageGUI.php +++ b/Modules/Course/classes/Objectives/class.ilLOPageGUI.php @@ -12,7 +12,7 @@ * * @ilCtrl_Calls ilLOPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI * @ilCtrl_Calls ilLOPageGUI: ilPublicUserProfileGUI, ilNoteGUI - * @ilCtrl_Calls ilLOPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPageMultiLangGUI + * @ilCtrl_Calls ilLOPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPageMultiLangGUI, ilPCPluggedGUI * * @ingroup ModulesCourse */ diff --git a/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php b/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php index 5ebfa5055ae0..4bbde4dcc61c 100644 --- a/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php +++ b/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php @@ -11,7 +11,7 @@ * @author Jörg Lützenkirchen * * @ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector - * @ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPublicUserProfileGUI, ilPageObjectGUI + * @ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPublicUserProfileGUI, ilPageObjectGUI, ilPCPluggedGUI */ class ilDclDetailedViewDefinitionGUI extends ilPageObjectGUI { diff --git a/Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php b/Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php index a257e15928c9..c01fab477377 100755 --- a/Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php +++ b/Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php @@ -12,7 +12,7 @@ * * @ilCtrl_Calls ilGlossaryDefPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilObjectMetaDataGUI * @ilCtrl_Calls ilGlossaryDefPageGUI: ilPublicUserProfileGUI, ilNoteGUI - * @ilCtrl_Calls ilGlossaryDefPageGUI: ilPropertyFormGUI, ilInternalLinkGUI + * @ilCtrl_Calls ilGlossaryDefPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPCPluggedGUI * * @ingroup ModulesGlossary */ diff --git a/Modules/LearningModule/classes/class.ilLMPageGUI.php b/Modules/LearningModule/classes/class.ilLMPageGUI.php index ff4385ccbabf..53eb35f03dd5 100644 --- a/Modules/LearningModule/classes/class.ilLMPageGUI.php +++ b/Modules/LearningModule/classes/class.ilLMPageGUI.php @@ -11,7 +11,7 @@ * @author Alex Killing * @version $Id$ * @ilCtrl_Calls ilLMPageGUI: ilPageEditorGUI, ilObjectMetaDataGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector, ilCommonActionDispatcherGUI, ilPageObjectGUI - * @ilCtrl_Calls ilLMPageGUI: ilNewsItemGUI, ilQuestionEditGUI, ilAssQuestionFeedbackEditingGUI, ilPageMultiLangGUI, ilPropertyFormGUI + * @ilCtrl_Calls ilLMPageGUI: ilNewsItemGUI, ilQuestionEditGUI, ilAssQuestionFeedbackEditingGUI, ilPageMultiLangGUI, ilPropertyFormGUI, ilPCPluggedGUI * @ingroup ModuleLearningModule */ class ilLMPageGUI extends ilPageObjectGUI diff --git a/Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php b/Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php index 3e945d03e45f..06ef59833b0b 100644 --- a/Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php +++ b/Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php @@ -12,7 +12,7 @@ * @version $Id$ * * @ilCtrl_Calls ilMediaPoolPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector -* @ilCtrl_Calls ilMediaPoolPageGUI: ilPublicUserProfileGUI +* @ilCtrl_Calls ilMediaPoolPageGUI: ilPublicUserProfileGUI, ilPCPluggedGUI * * @ingroup ModulesMediaPool */ diff --git a/Modules/Portfolio/classes/class.ilPortfolioPageGUI.php b/Modules/Portfolio/classes/class.ilPortfolioPageGUI.php index 10013bf3fb37..0656dfb91330 100644 --- a/Modules/Portfolio/classes/class.ilPortfolioPageGUI.php +++ b/Modules/Portfolio/classes/class.ilPortfolioPageGUI.php @@ -11,7 +11,7 @@ * * @ilCtrl_Calls ilPortfolioPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector * @ilCtrl_Calls ilPortfolioPageGUI: ilPageObjectGUI, ilObjBlogGUI, ilBlogPostingGUI - * @ilCtrl_Calls ilPortfolioPageGUI: ilCalendarMonthGUI, ilConsultationHoursGUI + * @ilCtrl_Calls ilPortfolioPageGUI: ilCalendarMonthGUI, ilConsultationHoursGUI, ilPCPluggedGUI * * @ingroup ModulesPortfolio */ diff --git a/Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php b/Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php index ca52cf0422df..0a9b593a0c02 100755 --- a/Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php +++ b/Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php @@ -13,7 +13,7 @@ * @version $Id$ * * @ilCtrl_Calls ilSCORM2004PageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector - * @ilCtrl_Calls ilSCORM2004PageGUI: ilRatingGUI, ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI + * @ilCtrl_Calls ilSCORM2004PageGUI: ilRatingGUI, ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilSCORM2004PageGUI: ilObjectMetaDataGUI, ilQuestionEditGUI, ilAssQuestionFeedbackEditingGUI * * @ingroup ModulesScormAicc diff --git a/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php b/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php index a9c6cc993267..330d8fc2e437 100755 --- a/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php +++ b/Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php @@ -11,7 +11,7 @@ * * @ilCtrl_Calls ilAssHintPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI * @ilCtrl_Calls ilAssHintPageGUI: ilPublicUserProfileGUI, ilNoteGUI - * @ilCtrl_Calls ilAssHintPageGUI: ilPropertyFormGUI, ilInternalLinkGUI + * @ilCtrl_Calls ilAssHintPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPCPluggedGUI * * @ingroup ModulesTestQuestionPool * ilasshintpagegui diff --git a/Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php b/Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php index d3324c723ce7..6d3c40ca400a 100755 --- a/Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php +++ b/Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php @@ -10,7 +10,7 @@ * @author Alex Killing * * @ilCtrl_Calls ilAssQuestionPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilAssQuestionPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilAssQuestionPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilAssQuestionPageGUI: ilPropertyFormGUI, ilInternalLinkGUI * * @ingroup ModulesTestQuestionPool diff --git a/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php b/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php index 08eae46ab04d..a3f2c48bc9bb 100755 --- a/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php +++ b/Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php @@ -10,7 +10,7 @@ * @author Alex Killing * * @ilCtrl_Calls ilAssGenFeedbackPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilAssGenFeedbackPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilAssGenFeedbackPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilAssGenFeedbackPageGUI: ilPropertyFormGUI, ilInternalLinkGUI * * @ingroup ModulesTestQuestionPool diff --git a/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php b/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php index 799c457abb5b..d1c1241c0374 100755 --- a/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php +++ b/Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php @@ -10,7 +10,7 @@ * @author Alex Killing * * @ilCtrl_Calls ilAssSpecFeedbackPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilAssSpecFeedbackPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilAssSpecFeedbackPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilAssSpecFeedbackPageGUI: ilPropertyFormGUI, ilInternalLinkGUI * * @ingroup ModulesTestQuestionPool diff --git a/Modules/Wiki/classes/class.ilWikiPageGUI.php b/Modules/Wiki/classes/class.ilWikiPageGUI.php index 6179356677fd..a2b0d991f997 100755 --- a/Modules/Wiki/classes/class.ilWikiPageGUI.php +++ b/Modules/Wiki/classes/class.ilWikiPageGUI.php @@ -11,7 +11,7 @@ * @version $Id$ * * @ilCtrl_Calls ilWikiPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector -* @ilCtrl_Calls ilWikiPageGUI: ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI +* @ilCtrl_Calls ilWikiPageGUI: ilPublicUserProfileGUI, ilPageObjectGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilWikiPageGUI: ilCommonActionDispatcherGUI, ilRatingGUI, ilWikiStatGUI * @ilCtrl_Calls ilWikiPageGUI: ilObjectMetaDataGUI * diff --git a/Services/Authentication/classes/class.ilLoginPageGUI.php b/Services/Authentication/classes/class.ilLoginPageGUI.php index a6803be72097..074d7a78953b 100755 --- a/Services/Authentication/classes/class.ilLoginPageGUI.php +++ b/Services/Authentication/classes/class.ilLoginPageGUI.php @@ -11,7 +11,7 @@ * @author Alex Killing * * @ilCtrl_Calls ilLoginPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilLoginPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilLoginPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilLoginPageGUI: ilPropertyFormGUI, ilInternalLinkGUI * * @ingroup ServicesAuthentication diff --git a/Services/COPage/Layout/classes/class.ilPageLayoutGUI.php b/Services/COPage/Layout/classes/class.ilPageLayoutGUI.php index 304647375404..b7a6b38eea33 100755 --- a/Services/COPage/Layout/classes/class.ilPageLayoutGUI.php +++ b/Services/COPage/Layout/classes/class.ilPageLayoutGUI.php @@ -11,7 +11,7 @@ * @version $Id$ * * @ilCtrl_Calls ilPageLayoutGUI: ilPageEditorGUI, ilEditClipboardGUI -* @ilCtrl_Calls ilPageLayoutGUI: ilPublicUserProfileGUI, ilPageObjectGUI +* @ilCtrl_Calls ilPageLayoutGUI: ilPublicUserProfileGUI, ilPageObjectGUI, ilPCPluggedGUI * */ class ilPageLayoutGUI extends ilPageObjectGUI diff --git a/Services/COPage/classes/class.ilPCPluggedGUI.php b/Services/COPage/classes/class.ilPCPluggedGUI.php index 4a8a5bc3e702..c63afc5b3e02 100755 --- a/Services/COPage/classes/class.ilPCPluggedGUI.php +++ b/Services/COPage/classes/class.ilPCPluggedGUI.php @@ -34,7 +34,7 @@ class ilPCPluggedGUI extends ilPageContentGUI * Constructor * @access public */ - function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_plugin_name = "", $a_pc_id = "") + function __construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_plugin_name = "", $a_pc_id = "") { global $DIC; diff --git a/Services/COPage/classes/class.ilPageComponentPlugin.php b/Services/COPage/classes/class.ilPageComponentPlugin.php index c0eca24a15e5..4c58a99f6a55 100644 --- a/Services/COPage/classes/class.ilPageComponentPlugin.php +++ b/Services/COPage/classes/class.ilPageComponentPlugin.php @@ -181,6 +181,16 @@ public function getParentType() return ''; } + /** + * Get name of page gui class + * + * @return string + */ + public function getPageGUIClass() + { + return get_class($this->page_obj)."GUI"; + } + /** * This function is called when the page content is cloned * @param array $a_properties (properties saved in the page, should be modified if neccessary) diff --git a/Services/COPage/classes/class.ilPageObjectGUI.php b/Services/COPage/classes/class.ilPageObjectGUI.php index 6d5bb3c7bad2..a02416ac47fb 100755 --- a/Services/COPage/classes/class.ilPageObjectGUI.php +++ b/Services/COPage/classes/class.ilPageObjectGUI.php @@ -22,7 +22,7 @@ * @version $Id$ * * @ilCtrl_Calls ilPageObjectGUI: ilPageEditorGUI, ilEditClipboardGUI, ilObjectMetaDataGUI - * @ilCtrl_Calls ilPageObjectGUI: ilPublicUserProfileGUI, ilNoteGUI, ilNewsItemGUI + * @ilCtrl_Calls ilPageObjectGUI: ilPublicUserProfileGUI, ilNoteGUI, ilNewsItemGUI, ilPCPluggedGUI * @ilCtrl_Calls ilPageObjectGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPageMultiLangGUI * * @ingroup ServicesCOPage @@ -987,6 +987,7 @@ function executeCommand() $next_class = $this->ctrl->getNextClass($this); $this->log->debug("next_class: ".$next_class); + switch($next_class) { case 'ilobjectmetadatagui': @@ -1039,6 +1040,14 @@ function executeCommand() $ret = $this->ctrl->forwardCommand($page_editor); break; + // Plugged Component + case "ilpcpluggedgui": + include_once ("./Services/COPage/classes/class.ilPCPluggedGUI.php"); + $plugged_gui = new ilPCPluggedGUI($this->obj, null, 0, "", ""); + $ret = $this->ctrl->forwardCommand($plugged_gui); + break; + + case 'ilnewsitemgui': include_once("./Services/News/classes/class.ilNewsItemGUI.php"); $news_item_gui = new ilNewsItemGUI(); diff --git a/Services/Container/classes/class.ilContainerPageGUI.php b/Services/Container/classes/class.ilContainerPageGUI.php index bfd5cdb9605e..cef5cc0c4928 100755 --- a/Services/Container/classes/class.ilContainerPageGUI.php +++ b/Services/Container/classes/class.ilContainerPageGUI.php @@ -11,7 +11,7 @@ * @author Alex Killing * * @ilCtrl_Calls ilContainerPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilContainerPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilContainerPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilContainerPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPageMultiLangGUI * * @ingroup ServicesContainer diff --git a/Services/Container/classes/class.ilContainerStartObjectsPageGUI.php b/Services/Container/classes/class.ilContainerStartObjectsPageGUI.php index e98c94ce2a50..326f93a551e4 100644 --- a/Services/Container/classes/class.ilContainerStartObjectsPageGUI.php +++ b/Services/Container/classes/class.ilContainerStartObjectsPageGUI.php @@ -11,7 +11,7 @@ * @author Jörg Lützenkirchen * * @ilCtrl_Calls ilContainerStartObjectsPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI - * @ilCtrl_Calls ilContainerStartObjectsPageGUI: ilPublicUserProfileGUI, ilNoteGUI + * @ilCtrl_Calls ilContainerStartObjectsPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI * @ilCtrl_Calls ilContainerStartObjectsPageGUI: ilPropertyFormGUI, ilInternalLinkGUI, ilPageMultiLangGUI * * @ingroup ServicesContainer diff --git a/Services/Imprint/classes/class.ilImprintGUI.php b/Services/Imprint/classes/class.ilImprintGUI.php index 015634dba9bb..6b1183c6c8dd 100644 --- a/Services/Imprint/classes/class.ilImprintGUI.php +++ b/Services/Imprint/classes/class.ilImprintGUI.php @@ -10,7 +10,7 @@ * @author Jörg Lützenkirchen * * @ilCtrl_Calls ilImprintGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector -* @ilCtrl_Calls ilImprintGUI: ilPublicUserProfileGUI, ilPageObjectGUI +* @ilCtrl_Calls ilImprintGUI: ilPublicUserProfileGUI, ilPageObjectGUI, ilPCPluggedGUI * * @ingroup ModulesImprint */ From 583f342664d38d682f57ab3601737785a08b8072 Mon Sep 17 00:00:00 2001 From: xus Date: Mon, 5 Feb 2018 17:43:32 +0100 Subject: [PATCH 07/11] ctrl calls password assistant --- Services/COPage/classes/class.ilPCPluggedGUI.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Services/COPage/classes/class.ilPCPluggedGUI.php b/Services/COPage/classes/class.ilPCPluggedGUI.php index c63afc5b3e02..abce1904e7e2 100755 --- a/Services/COPage/classes/class.ilPCPluggedGUI.php +++ b/Services/COPage/classes/class.ilPCPluggedGUI.php @@ -14,6 +14,7 @@ * @author Alex Killing * @version $Id$ * + * @ilCtrl_Calls ilPCPluggedGUI: ilPasswordAssistanceGUI * @ingroup ServicesCOPage */ class ilPCPluggedGUI extends ilPageContentGUI From 9e5bd8f7b032151f182dc6c1977cb6f9af7d9285 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Fri, 19 Jan 2018 18:15:53 +0100 Subject: [PATCH 08/11] fixed bug #21692: Different behaviour when clicking on file-link From 4e84bda60095e1ac5b413bf9f000285bbbcebebb Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Wed, 14 Feb 2018 15:38:14 +0100 Subject: [PATCH 09/11] fixed permission check on page forwarding --- .../Container/classes/class.ilContainerGUI.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Services/Container/classes/class.ilContainerGUI.php b/Services/Container/classes/class.ilContainerGUI.php index 5f6e541d0b69..e616612f6c60 100644 --- a/Services/Container/classes/class.ilContainerGUI.php +++ b/Services/Container/classes/class.ilContainerGUI.php @@ -269,15 +269,8 @@ function &forwardToPageObject() $cmd = $ilCtrl->getCmd(); - if (in_array($cmd, array("displayMediaFullscreen", "downloadFile", "displayMedia"))) - { - $this->checkPermission("read"); - } - else - { - $this->checkPermission("write"); - } - + $this->checkPermission("read"); + $ilTabs->clearTargets(); if ($_GET["redirectSource"] == "ilinternallinkgui") @@ -329,6 +322,11 @@ function &forwardToPageObject() $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId( $this->object->getStyleSheetId(), $this->object->getType())); + if (!$this->access->checkAccess("write", "", $this->ref_id)) + { + $page_gui->setEnableEditing(false); + } + $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setFileDownloadLink(""); $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen")); From 9bda0d46ece8f35a983b8acf8f941f292935fc69 Mon Sep 17 00:00:00 2001 From: xus Date: Tue, 20 Feb 2018 15:59:45 +0100 Subject: [PATCH 10/11] close div tag --- src/UI/templates/js/Modal/modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UI/templates/js/Modal/modal.js b/src/UI/templates/js/Modal/modal.js index 53594a03039e..0be68521ef97 100644 --- a/src/UI/templates/js/Modal/modal.js +++ b/src/UI/templates/js/Modal/modal.js @@ -58,7 +58,7 @@ il.UI = il.UI || {}; url: url, dataType: 'html' }).done(function(html) { - var $new_modal = $("

" + html + "
"); + var $new_modal = $("
" + html + "
"); // of the new modal, we want the inner html of the modal (without the new top modal node, since // we want to keep our id. Additionally we want the script tag with its content. From 4358e54fdad944881d1776f64a05bffa57f7e664 Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Tue, 20 Feb 2018 17:25:15 +0100 Subject: [PATCH 11/11] fixed modal replacement --- src/UI/templates/js/Modal/modal.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/UI/templates/js/Modal/modal.js b/src/UI/templates/js/Modal/modal.js index 0be68521ef97..9a3813f44d3e 100644 --- a/src/UI/templates/js/Modal/modal.js +++ b/src/UI/templates/js/Modal/modal.js @@ -63,7 +63,11 @@ il.UI = il.UI || {}; // of the new modal, we want the inner html of the modal (without the new top modal node, since // we want to keep our id. Additionally we want the script tag with its content. // Since html() gives us the inner html of the script tag only, we clone, wrap and get the inner from the wrapper... - $modal.html($new_modal.find(".modal").first().html() + $new_modal.find("script").first().clone().wrap('

').parent().html()); + // console.log($new_modal.html()); + // console.log($new_modal.children("script").first().clone().wrap('

').parent().html()); + // console.log($new_modal.find("script").first().clone().wrap('

').parent().html()); + + $modal.html($new_modal.find(".modal").first().html() + $new_modal.children("script").first().clone().wrap('

').parent().html()); }); };