Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## Unreleased

- Show the eXeLearning **Edit** button on the activity view when **Display** is set to *In pop-up*, *Open* or *New window* (issue #43). Previously the button only appeared for *Embed* activities, leaving teachers no way to edit the package from those modes.
- Remove the legacy *In frame* (HTML4 frameset) display option. The mode duplicated *Embed* (which already uses an `<iframe>`) and prevented the editor modal and fullscreen control from working correctly. Existing activities configured with *In frame* are migrated automatically to *Embed* on upgrade, and the orphan `framesize` admin setting is removed.

## v4.0.0 – 2025-04-30

- Version jump to 4.0.0 to align numbering with eXeLearning for consistency across related projects.
Expand Down
14 changes: 12 additions & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,21 @@
*/

function xmldb_exeweb_upgrade($oldversion) {
global $DB;
global $DB, $CFG;

$dbman = $DB->get_manager();

// Put any upgrade step here.
if ($oldversion < 2026050900) {
require_once($CFG->libdir . '/resourcelib.php');

// Frameset display has been removed in favour of the equivalent
// IFRAME-based EMBED mode. Migrate legacy activities and drop the
// orphan framesize plugin config.
$DB->set_field('exeweb', 'display', RESOURCELIB_DISPLAY_EMBED, ['display' => RESOURCELIB_DISPLAY_FRAME]);
unset_config('framesize', 'exeweb');

upgrade_mod_savepoint(true, 2026050900, 'exeweb');
}

return true;
}
3 changes: 0 additions & 3 deletions lang/ca/exeweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$string['clicktodownload'] = 'Haga clic en {$a} para descargar el archivo.';
$string['clicktoopen2'] = 'Haga clic en {$a} para ver el archivo.';
$string['configdisplayoptions'] = 'Puede seleccionar cualquiera de las opciones disponibles (los ajustes existentes no se modificarán). Mantenga pulsada la tecla CTRL para seleccionar varios campos simultáneamente.';
$string['configframesize'] = 'Cuando se muestra una página web o un archivo cargado dentro de un marco (FRAME), este valor es el tamaño en píxeles del marco superior, que contiene la navegación.';
$string['configparametersettings'] = 'Configura el valor por defecto del panel de ajustes cuando se agregan nuevos recursos. Tras esta primera vez, se convierte en una preferencia del usuario.';
$string['configpopup'] = 'Cuando se agrega un recurso que puede mostrarse en un ventana emergente ("popup"), ¿esta opción se debe activar por defecto?';
$string['configpopupdirectories'] = 'Las ventanas "popup", ¿deben mostrar por defecto los enlaces del directorio?';
Expand All @@ -49,7 +48,6 @@
$string['displayselect_help'] = 'Este ajuste determina cómo se muestra el contenido. Las opciones pueden incluir:

* Incrustar - Un IFRAME dentro de una página de actividad de Moodle, con sus bloques laterales (dependerá del tema).
* En el marco - Un FRAMESET con dos marcos. El superior muestra algún dato del curso en el que estás y las opciones para ir a las actividades anterior y siguiente. El inferior muestra el contenido del paquete.
* Nueva ventana - Se abre en una nueva ventana del navegador.
* Abrir - Se abre en la misma ventana del navegador.
* En ventana emergente - Ventana tipo "popup".';
Expand Down Expand Up @@ -83,7 +81,6 @@
$string['filterfilesexplain'] = 'Seleccione el tipo de archivo que contiene el filtro. Esto puede causar problemas en algunos contenidos. Por favor, asegúrese de que todos los archivos de texto están en UTF-8.';
$string['filtername'] = 'Auto-enlace de nombres de recursos';
$string['forcedownload'] = 'Forzar descarga';
$string['framesize'] = 'Altura del marco';
$string['indicator:cognitivedepth'] = 'Archivo cognitivo';
$string['indicator:cognitivedepth_help'] = 'Este indicador está basado en la profundidad cognitiva alcanzada por el estudiante.';
$string['indicator:cognitivedepthdef'] = 'Archivo cognitivo';
Expand Down
3 changes: 0 additions & 3 deletions lang/en/exeweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$string['clicktodownload'] = 'Click {$a} link to download the file.';
$string['clicktoopen2'] = 'Click {$a} link to view the file.';
$string['configdisplayoptions'] = 'Select all options that should be available, existing settings are not modified. Hold CTRL key to select multiple fields.';
$string['configframesize'] = 'When a web page or an uploaded file is displayed within a frame, this value is the height (in pixels) of the top frame (which contains the navigation).';
$string['configparametersettings'] = 'This sets the default value for the Parameter settings pane in the form when adding some new contents. After the first time, this becomes an individual user preference.';
$string['configpopup'] = 'When adding a new content that can be shown in a popup window, should this option be enabled by default?';
$string['configpopupdirectories'] = 'Should popup windows show directory links by default?';
Expand All @@ -49,7 +48,6 @@
$string['displayselect_help'] = 'This setting determines how the content is displayed. Options may include:

* Embed - The file is displayed in an IFRAME, below the navigation bar, together with the file description and any blocks.
* In frame - The file is displayed using a FRAMESET with two FRAMES, below the navigation bar and the file description.
* New window - The content is open on a new browser window.
* Open - The content is open on the same browser window.
* In pop-up - The file is displayed in a new browser window without menus or address bar (popup window).';
Expand Down Expand Up @@ -83,7 +81,6 @@
$string['filterfilesexplain'] = 'Select type of file content filtering, please note this may cause problems in some contents. Please make sure that all text files are in UTF-8 encoding.';
$string['filtername'] = 'Content names auto-linking';
$string['forcedownload'] = 'Force download';
$string['framesize'] = 'Frame height';
$string['indicator:cognitivedepth'] = 'File cognitive';
$string['indicator:cognitivedepth_help'] = 'This indicator is based on the cognitive depth reached by the student.';
$string['indicator:cognitivedepthdef'] = 'File cognitive';
Expand Down
3 changes: 0 additions & 3 deletions lang/es/exeweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$string['clicktodownload'] = 'Haga clic en {$a} para descargar el archivo.';
$string['clicktoopen2'] = 'Haga clic en {$a} para ver el archivo.';
$string['configdisplayoptions'] = 'Puede seleccionar cualquiera de las opciones disponibles (los ajustes existentes no se modificarán). Mantenga pulsada la tecla CTRL para seleccionar varios campos simultáneamente.';
$string['configframesize'] = 'Cuando se muestra una página web o un archivo cargado dentro de un marco (FRAME), este valor es el tamaño en píxeles del marco superior, que contiene la navegación.';
$string['configparametersettings'] = 'Configura el valor por defecto del panel de ajustes cuando se agregan nuevos recursos. Tras esta primera vez, se convierte en una preferencia del usuario.';
$string['configpopup'] = 'Cuando se agrega un recurso que puede mostrarse en un ventana emergente ("popup"), ¿esta opción se debe activar por defecto?';
$string['configpopupdirectories'] = 'Las ventanas "popup", ¿deben mostrar por defecto los enlaces del directorio?';
Expand All @@ -49,7 +48,6 @@
$string['displayselect_help'] = 'Este ajuste determina cómo se muestra el contenido. Las opciones pueden incluir:

* Incrustar - Un IFRAME dentro de una página de actividad de Moodle, con sus bloques laterales (dependerá del tema).
* En el marco - Un FRAMESET con dos marcos. El superior muestra algún dato del curso en el que estás y las opciones para ir a las actividades anterior y siguiente. El inferior muestra el contenido del paquete.
* Nueva ventana - Se abre en una nueva ventana del navegador.
* Abrir - Se abre en la misma ventana del navegador.
* En ventana emergente - Ventana tipo "popup".';
Expand Down Expand Up @@ -83,7 +81,6 @@
$string['filterfilesexplain'] = 'Seleccione el tipo de archivo que contiene el filtro. Esto puede causar problemas en algunos contenidos. Por favor, asegúrese de que todos los archivos de texto están en UTF-8.';
$string['filtername'] = 'Auto-enlace de nombres de recursos';
$string['forcedownload'] = 'Forzar descarga';
$string['framesize'] = 'Altura del marco';
$string['indicator:cognitivedepth'] = 'Archivo cognitivo';
$string['indicator:cognitivedepth_help'] = 'Este indicador está basado en la profundidad cognitiva alcanzada por el estudiante.';
$string['indicator:cognitivedepthdef'] = 'Archivo cognitivo';
Expand Down
3 changes: 0 additions & 3 deletions lang/eu/exeweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$string['clicktodownload'] = 'Haga clic en {$a} para descargar el archivo.';
$string['clicktoopen2'] = 'Haga clic en {$a} para ver el archivo.';
$string['configdisplayoptions'] = 'Puede seleccionar cualquiera de las opciones disponibles (los ajustes existentes no se modificarán). Mantenga pulsada la tecla CTRL para seleccionar varios campos simultáneamente.';
$string['configframesize'] = 'Cuando se muestra una página web o un archivo cargado dentro de un marco (FRAME), este valor es el tamaño en píxeles del marco superior, que contiene la navegación.';
$string['configparametersettings'] = 'Configura el valor por defecto del panel de ajustes cuando se agregan nuevos recursos. Tras esta primera vez, se convierte en una preferencia del usuario.';
$string['configpopup'] = 'Cuando se agrega un recurso que puede mostrarse en un ventana emergente ("popup"), ¿esta opción se debe activar por defecto?';
$string['configpopupdirectories'] = 'Las ventanas "popup", ¿deben mostrar por defecto los enlaces del directorio?';
Expand All @@ -49,7 +48,6 @@
$string['displayselect_help'] = 'Este ajuste determina cómo se muestra el contenido. Las opciones pueden incluir:

* Incrustar - Un IFRAME dentro de una página de actividad de Moodle, con sus bloques laterales (dependerá del tema).
* En el marco - Un FRAMESET con dos marcos. El superior muestra algún dato del curso en el que estás y las opciones para ir a las actividades anterior y siguiente. El inferior muestra el contenido del paquete.
* Nueva ventana - Se abre en una nueva ventana del navegador.
* Abrir - Se abre en la misma ventana del navegador.
* En ventana emergente - Ventana tipo "popup".';
Expand Down Expand Up @@ -83,7 +81,6 @@
$string['filterfilesexplain'] = 'Seleccione el tipo de archivo que contiene el filtro. Esto puede causar problemas en algunos contenidos. Por favor, asegúrese de que todos los archivos de texto están en UTF-8.';
$string['filtername'] = 'Auto-enlace de nombres de recursos';
$string['forcedownload'] = 'Forzar descarga';
$string['framesize'] = 'Altura del marco';
$string['indicator:cognitivedepth'] = 'Archivo cognitivo';
$string['indicator:cognitivedepth_help'] = 'Este indicador está basado en la profundidad cognitiva alcanzada por el estudiante.';
$string['indicator:cognitivedepthdef'] = 'Archivo cognitivo';
Expand Down
3 changes: 0 additions & 3 deletions lang/gl/exeweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$string['clicktodownload'] = 'Faga clic en {$a} para descargar o ficheiro.';
$string['clicktoopen2'] = 'Faga clic en {$a} para ver o ficheiro.';
$string['configdisplayoptions'] = 'Pode seleccionar calquera das opcións dispoñibles (os axustes existentes non se modificarán). Manteña premida a tecla CTRL para seleccionar varios campos simultaneamente.';
$string['configframesize'] = 'Cando se amosa unha páxina web ou un ficheiro cargado dentro dun marco (FRAME), este valor é o tamaño en píxeles do marco superior que contén a navegación.';
$string['configparametersettings'] = 'Configura o valor por defecto do panel de axustes cando se agregan novos recursos. Logo desta primeira vez, convértese nunha preferencia do usuario.';
$string['configpopup'] = 'Cando se agrega un recurso que pode amosarse nunha xanela emerxente ("popup"), esta opción débese activar por defecto?';
$string['configpopupdirectories'] = 'As xanelas "popup", deben amosar por defecto as ligazóns do directorio?';
Expand All @@ -49,7 +48,6 @@
$string['displayselect_help'] = 'Este axuste determina como se amosa o contido. As opcións poden incluír:

* Incrustar - Un IFRAME dentro dunha páxina de actividade de Moodle, cos seus bloques laterais (dependerá do estilo de eXeLearning).
* No marco - Un FRAMESET con dous marcos. O superior amosa algún dato do curso no que estás e as opcións para ir ás actividades anterior e seguinte. O inferior amosa o contido do paquete.
* Nova xanela - Ábrese unha nova xanela do navegador.
* Abrir - Ábrese na mesma xanela do navegador.
* En xanela emerxente - Xanela tipo "popup".';
Expand Down Expand Up @@ -83,7 +81,6 @@
$string['filterfilesexplain'] = 'Seleccione o tipo de ficheiro que contén o filtro. Esto pode causar problemas nalgúns contidos. Por favor, revise que todos os ficheiros de texto están en UTF-8.';
$string['filtername'] = 'Auto-ligazón de nomes de recursos';
$string['forcedownload'] = 'Forzar descarga';
$string['framesize'] = 'Altura do marco';
$string['indicator:cognitivedepth'] = 'Ficheiro cognitivo';
$string['indicator:cognitivedepth_help'] = 'Este indicador está baseado na profundidade cognitiva acadada polo estudante.';
$string['indicator:cognitivedepthdef'] = 'Ficheiro cognitivo';
Expand Down
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function exeweb_set_display_options($data) {
$displayoptions['popupwidth'] = $data->popupwidth;
$displayoptions['popupheight'] = $data->popupheight;
}
if (in_array($data->display, [RESOURCELIB_DISPLAY_EMBED, RESOURCELIB_DISPLAY_FRAME])) {
if ($data->display == RESOURCELIB_DISPLAY_EMBED) {
$displayoptions['printintro'] = (int)!empty($data->printintro);
}
if (!empty($data->showsize)) {
Expand Down
86 changes: 3 additions & 83 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,68 +67,6 @@ function exeweb_display_embed($exeweb, $cm, $course, $file) {
die;
}




/**
* Display exeweb frames.
* @param object $exeweb
* @param object $cm
* @param object $course
* @param stored_file $file main file
* @return does not return
*/
function exeweb_display_frame($exeweb, $cm, $course, $file) {
global $PAGE, $OUTPUT, $CFG;

$frame = optional_param('frameset', 'main', PARAM_ALPHA);

if ($frame === 'top') {
$PAGE->set_pagelayout('frametop');
$PAGE->activityheader->set_description(exeweb_get_intro($exeweb, $cm, true));
exeweb_print_header($exeweb, $cm, $course);
if (!exeweb_is_teacher_mode_visible($exeweb)) {
exeweb_require_teacher_mode_hider_for_content_frame();
}
echo $OUTPUT->footer();
die;

} else {
$config = get_config('exeweb');
$context = context_module::instance($cm->id);
$fileurl = moodle_url::make_pluginfile_url($context->id, 'mod_exeweb', 'content', $exeweb->revision,
$file->get_filepath(), $file->get_filename());
$navurl = "$CFG->wwwroot/mod/exeweb/view.php?id=$cm->id&amp;frameset=top";
$title = strip_tags(format_string($course->shortname.': '.$exeweb->name));
$framesize = $config->framesize;
$contentframetitle = s(format_string($exeweb->name));
$modulename = s(get_string('modulename', 'mod_exeweb'));
$dir = get_string('thisdirection', 'langconfig');

$file = <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html dir="$dir">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>$title</title>
</head>
<frameset rows="$framesize,*">
<frame src="$navurl" title="$modulename" />
<frame src="$fileurl" title="$contentframetitle" />
</frameset>
</html>
EOF;

@header('Content-Type: text/html; charset=utf-8');
echo $file;
die;
}
}

/**
* Internal function - create click to open text with link.
*/

/**
* Check whether teacher mode toggler should be visible for this activity.
*
Expand Down Expand Up @@ -168,27 +106,6 @@ function exeweb_require_teacher_mode_hider_for_iframe(string $iframeid): void {
$PAGE->requires->js_init_code($js);
}

/**
* Inject CSS into the frame content document to hide teacher mode toggler.
*
* @return void
*/
function exeweb_require_teacher_mode_hider_for_content_frame(): void {
global $PAGE;

$cssjson = json_encode('#teacher-mode-toggler-wrapper { visibility: hidden !important; }');
$js = "(function(){"
. "var css=" . $cssjson . ";"
. "var inject=function(){try{if(!window.parent||!window.parent.frames||!window.parent.frames[1]){return;}"
. "var frameWin=window.parent.frames[1];if(!frameWin.document){return;}"
. "var d=frameWin.document;var st=d.createElement('style');st.textContent=css;"
. "(d.head||d.documentElement).appendChild(st);}catch(e){}};"
. "window.addEventListener('load', inject);setTimeout(inject, 300);"
. "})();";

$PAGE->requires->js_init_code($js);
}

function exeweb_get_clicktoopen($file, $revision, $extra='') {
global $CFG;

Expand Down Expand Up @@ -218,6 +135,9 @@ function exeweb_print_workaround($exeweb, $cm, $course, $file) {

exeweb_print_header($exeweb, $cm, $course);

// Show action bar with Edit button when user has edit capability.
echo $PAGE->get_renderer('mod_exeweb')->generate_action_bar($cm);

echo '<div class="exewebworkaround">';
switch ($exeweb->display) {
case RESOURCELIB_DISPLAY_POPUP:
Expand Down
3 changes: 1 addition & 2 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public function definition() {
$mform->setAdvanced('popupheight', true);
}

if (array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) ||
array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) {
if (array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options)) {
$mform->addElement('checkbox', 'printintro', get_string('printintro', 'mod_exeweb'));
$mform->hideIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP);
$mform->hideIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN);
Expand Down
4 changes: 0 additions & 4 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ function toggleConnectionSettings() {

$displayoptions = resourcelib_get_displayoptions([
RESOURCELIB_DISPLAY_EMBED,
RESOURCELIB_DISPLAY_FRAME,
RESOURCELIB_DISPLAY_OPEN,
RESOURCELIB_DISPLAY_NEW,
RESOURCELIB_DISPLAY_POPUP,
Expand All @@ -196,9 +195,6 @@ function toggleConnectionSettings() {
RESOURCELIB_DISPLAY_POPUP,
];

// General settings.
$settings->add(new admin_setting_configtext('exeweb/framesize',
new lang_string('framesize', 'mod_exeweb'), new lang_string('configframesize', 'mod_exeweb'), 130, PARAM_INT));
$settings->add(new admin_setting_configmultiselect('exeweb/displayoptions',
new lang_string('displayoptions', 'mod_exeweb'), new lang_string('configdisplayoptions', 'mod_exeweb'),
$defaultdisplayoptions, $displayoptions));
Expand Down
5 changes: 2 additions & 3 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@
$PAGE->requires->js_call_amd('mod_exeweb/editor_modal', 'init');
switch ($displaytype) {
case RESOURCELIB_DISPLAY_EMBED:
exeweb_display_embed($exeweb, $cm, $course, $file);
break;
case RESOURCELIB_DISPLAY_FRAME:
exeweb_display_frame($exeweb, $cm, $course, $file);
// FRAME mode is deprecated; legacy activities fall back to EMBED.
exeweb_display_embed($exeweb, $cm, $course, $file);
break;
default:
exeweb_print_workaround($exeweb, $cm, $course, $file);
Expand Down
Loading