GithubHelp home page GithubHelp logo

moodle-mod_masks's Introduction

MASK : Maskable PDF Activity Module

Purpose

MASK provides a simple solution for creating an interactive activity from a pdf document.

The teacher can upload their pdf file to Moodle, lay down masks that obscure parts of the underlying document and add questions for the students to answer in order to make the masks disappear.

The student is encouraged to try to answer questions correctly on their first attempt and receives a corresponding grade in the Moodle grade book when they have found the correct answers to all of the questions in the document. The teacher can add hint texts to be displayed after a student answers questions incorrectly in order to help them to identify the correct answer.

The teacher can additionally hide pages such as title pages and blank pages in the original pdf that are not of interest for their use within Moodle.

NOTE: For anyone considering using this module in assessments it is important to know that a student who uses the web developper functionality built into all modern browsers is able to view the document pages without the overlaid masks. As a result, in an assessment context the answers to questions should not be present in the pdf document.

Installation

This plugin relies on the presence on the server of the free to use application 'pdf2svg' which is available as a standard package under Debian and Ubuntu linux distributions and also exists for Microsft Windows and Mac.

Other than this requirement, MASK is a very standard Moodle plugin and can be installed and uninstalled via standard Moodle processes.

The only configuration option that needs to be set at install time is the command line to execute to run the pdf2svg application.

Getting Started

Once installed the plugin allows a teacher editing a course to add MASK activities.

Each such activity is based on a single pdf file, so the teacher's first job is to select the pdf file that they would like to upload.

Once the document is uploaded they can browse through its pages using the standard page navigation menu dispalyed at the top right of the screen, add masks and popup notes to the page by clicking the ADD button or perform maintenance operations (such as hiding and unhiding pages) by clicking on the cog icon.

Masks can be selected, moved and resized by clicking and dragging with the mouse. They can be edited, hidden, deleted and recoloured via the context menu that appears whenever a mask is selected.

Changes to the layout are not automatically saved. A SAVE buttonn appears next to the ADD button whenever there are unsaved changes.

Copyright & License

This plugin was developed as an extension to Moodle by Edunao SA on behalf of ENIT. It is an open source plugin that can be freely used and modified.

copyright 2016 Edunao SAS ([email protected]) license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Design Philosophy and future extension

This module is intended to be extremely simple to use.

It would not be desirable to add options that can be confusing or cause it to bloat.

It is desirable to improve the ergonomics, user feedback, clarity of presentation and any other such features that make the plugin easier or more pleasant to use.

The module has been designed to allow easy addition of new question types. It is generally prefereable to create a new question type instead of complexifying an existing question type to try to make it behave in several different ways.

The database models have been designed to allow future development of different views for the teacher that could allow them to better understand how their material is being used. It includes information such as the number of failed attempts that each student has at answering each of the questions, the times at which each question were first viewed and finally answered and so on.

Development of simple summary views for the teacher to use could be extremely worthwhile.

moodle-mod_masks's People

Contributors

dlm-sadge avatar

Watchers

James Cloos avatar Edunao avatar

moodle-mod_masks's Issues

Student can't answer the question

After clicking the question box mask, the PDF just gets grey. In the browser console I can see that the script mod/masks/frame_click_mask.php dies with status 404. Further debugging shows that there is another DB related exception thrown when clicking the question box, again related to the "user" being reserved keyword on PostgreSQL.

Debug info: ERROR: syntax error at or near "user"
LINE 1: INSERT INTO mdl_masks_user_state (user,question,state,failco...
^
INSERT INTO mdl_masks_user_state (user,question,state,failcount,firstview,lastupdate) VALUES($1,$2,$3,$4,$5,$6) RETURNING id
[array (
'user' => '3',
'question' => 1,
'state' => 16,
'failcount' => 0,
'firstview' => 1488987742,
'lastupdate' => 1488987742,
)]
Error code: dmlwriteexception
×Stack trace:
line 482 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 242 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 886 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 934 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
line 442 of /mod/masks/database_interface.class.php: call to pgsql_native_moodle_database->insert_record()
line 338 of /mod/masks/mask_type.class.php: call to mod_masks\database_interface->updateUserQuestionState()
line 91 of /mod/masks/mask_type_qtxt.class.php: call to mod_masks\mask_type->renderQuestionPage()
line 88 of /mod/masks/frame_click_mask.php: call to mod_masks\mask_type_qtxt->onClickMask()

Direct access to the raw user input and re-use of it on the rendered page

The custom code uses direct access to the raw user input via superglobals like $_GET. There is a path in the code how the raw user input can get through the form_writer back to a screen - for example via the lookupRefData() in addTextArea().

This is a serious and instant security risk (especially as there seems to be no CSRF protection).

Error reported on successful upload

After uploading a PDF, I get an error message:

image

  • Note in the background, the notice says the document has been uploaded.
  • After reloading, i can see the uploaded PDF
  • There seems to be no way to scroll down the error message (also this whole UI widget looks really not-natural in Moodle).

SQL error after the instance is added

In a comment on the plugin page, Daniel Miller said that "MYSQL-specific code fixed and verified on a postgresql install". However I do not think that the module was actually tested on PostgreSQL.

Just after adding a new module instance to the course, I get SQL error:

Debug info: ERROR: syntax error at or near "."
LINE 1: SELECT mask.*, question.type , user.state AS userstate FROM ...
^
SELECT mask.*, question.type , user.state AS userstate FROM mdl_masks_page page JOIN mdl_masks_mask mask ON page.id = mask.page LEFT JOIN mdl_masks_user_state user ON user.question = mask.question AND user.user = $1 LEFT JOIN mdl_masks_question question ON question.id = mask.question WHERE page.parentcm = $2 AND (mask.flags & 128) = 0 ORDER BY page.id, mask.id
[array (
0 => '2',
1 => '19',
)]
Error code: dmlreadexception
×Stack trace:
line 479 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 242 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 776 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 111 of /mod/masks/database_interface.class.php: call to pgsql_native_moodle_database->get_records_sql()
line 107 of /mod/masks/view.php: call to mod_masks\database_interface->fetchMaskData()

Unable to install

The upgrade function fix_id_field() has three serious problem.

  1. It has hard-coded mdl_ prefix for tables so it can't work well on sites using different prefixes.
  2. It uses MySQL specific SQL so it does not work on any other database for not good reason.
  3. It should not exist as steps like this should be executed via XMLDB API only and the code snippets that XMLDB editor generates.

Actually, the point 3. applies to all other functions in the upgradelib.php.

The rant in install.xml

As explained in the RANT in db/install.xml, the file is not maintained any more. That is not acceptable. The file must describe the up-to-date schema of all the tables owned by the plugin. There are parts in the Moodle core code that rely on it.

The db/upgrade.php is there only for what the name suggests - upgrades of the database scheme from one version to another.

https://docs.moodle.org/dev/XMLDB_Documentation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.