diff --git a/mod/README.txt b/mod/README.txt
deleted file mode 100644
index c9c4152..0000000
--- a/mod/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-ACTIVITY MODULES
-----------------
-
-These are main modules in Moodle, allowing various activities.
-
-
-Each of these modules contains a number of expected components:
-
- mod_form.php: a form to setup/update a module instance
-
- version.php: defines some meta-info and provides upgrading code
-
- pix/icon.gif: a 16x16 icon for the module
-
- db/install.xml: an SQL dump of all the required db tables and data
-
- index.php: a page to list all instances in a course
-
- view.php: a page to view a particular instance
-
- lib.php: any/all functions defined by the module should be in here.
- constants should be defined using MODULENAME_xxxxxx
- functions should be defined using modulename_xxxxxx
-
- There are a number of standard functions:
-
- modulename_add_instance()
- modulename_update_instance()
- modulename_delete_instance()
-
- modulename_user_complete()
- modulename_user_outline()
-
- modulename_cron()
-
- modulename_print_recent_activity()
-
-
-If you are a developer and interested in developing new Modules see:
-
- Moodle Documentation: http://moodle.org/doc
- Moodle Community: http://moodle.org/community
diff --git a/mod/assign/feedback/editpdf/ajax.php b/mod/assign/feedback/editpdf/ajax.php
deleted file mode 100644
index 8baf3ff..0000000
--- a/mod/assign/feedback/editpdf/ajax.php
+++ /dev/null
@@ -1,193 +0,0 @@
-.
-
-/**
- * Process ajax requests
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-use \assignfeedback_editpdf\document_services;
-use \assignfeedback_editpdf\page_editor;
-use \assignfeedback_editpdf\comments_quick_list;
-
-define('AJAX_SCRIPT', true);
-
-require('../../../../config.php');
-require_once($CFG->dirroot . '/mod/assign/locallib.php');
-
-require_sesskey();
-
-$action = optional_param('action', '', PARAM_ALPHANUM);
-$assignmentid = required_param('assignmentid', PARAM_INT);
-$userid = required_param('userid', PARAM_INT);
-$attemptnumber = required_param('attemptnumber', PARAM_INT);
-$readonly = optional_param('readonly', false, PARAM_BOOL);
-
-$cm = \get_coursemodule_from_instance('assign', $assignmentid, 0, false, MUST_EXIST);
-$context = \context_module::instance($cm->id);
-
-$assignment = new \assign($context, null, null);
-
-require_login($assignment->get_course(), false, $cm);
-
-if (!$assignment->can_view_submission($userid)) {
- print_error('nopermission');
-}
-
-if ($action == 'loadallpages') {
- $draft = true;
- if (!has_capability('mod/assign:grade', $context)) {
- $draft = false;
- $readonly = true; // A student always sees the readonly version.
- require_capability('mod/assign:submit', $context);
- }
-
- // Whoever is viewing the readonly version should not use the drafts, but the actual annotations.
- if ($readonly) {
- $draft = false;
- }
-
- $pages = document_services::get_page_images_for_attempt($assignment,
- $userid,
- $attemptnumber,
- $readonly);
-
- $response = new stdClass();
- $response->pagecount = count($pages);
- $response->pages = array();
-
- $grade = $assignment->get_user_grade($userid, true);
-
- // The readonly files are stored in a different file area.
- $filearea = document_services::PAGE_IMAGE_FILEAREA;
- if ($readonly) {
- $filearea = document_services::PAGE_IMAGE_READONLY_FILEAREA;
- }
-
- foreach ($pages as $id => $pagefile) {
- $index = count($response->pages);
- $page = new stdClass();
- $comments = page_editor::get_comments($grade->id, $index, $draft);
- $page->url = moodle_url::make_pluginfile_url($context->id,
- 'assignfeedback_editpdf',
- $filearea,
- $grade->id,
- '/',
- $pagefile->get_filename())->out();
- $page->comments = $comments;
- $annotations = page_editor::get_annotations($grade->id, $index, $draft);
- $page->annotations = $annotations;
- array_push($response->pages, $page);
- }
-
- echo json_encode($response);
- die();
-} else if ($action == 'savepage') {
- require_capability('mod/assign:grade', $context);
-
- $response = new stdClass();
- $response->errors = array();
-
- $grade = $assignment->get_user_grade($userid, true);
-
- $pagejson = required_param('page', PARAM_RAW);
- $page = json_decode($pagejson);
- $index = required_param('index', PARAM_INT);
-
- $added = page_editor::set_comments($grade->id, $index, $page->comments);
- if ($added != count($page->comments)) {
- array_push($response->errors, get_string('couldnotsavepage', 'assignfeedback_editpdf', $index+1));
- }
- $added = page_editor::set_annotations($grade->id, $index, $page->annotations);
- if ($added != count($page->annotations)) {
- array_push($response->errors, get_string('couldnotsavepage', 'assignfeedback_editpdf', $index+1));
- }
- echo json_encode($response);
- die();
-
-} else if ($action == 'generatepdf') {
-
- require_capability('mod/assign:grade', $context);
- $response = new stdClass();
- $grade = $assignment->get_user_grade($userid, true);
- $file = document_services::generate_feedback_document($assignment, $userid, $attemptnumber);
-
- $response->url = '';
- if ($file) {
- $url = moodle_url::make_pluginfile_url($assignment->get_context()->id,
- 'assignfeedback_editpdf',
- document_services::FINAL_PDF_FILEAREA,
- $grade->id,
- '/',
- $file->get_filename(),
- false);
- $response->url = $url->out(true);
- $response->filename = $file->get_filename();
- }
-
- echo json_encode($response);
- die();
-} else if ($action == 'loadquicklist') {
- require_capability('mod/assign:grade', $context);
-
- $result = comments_quick_list::get_comments();
-
- echo json_encode($result);
- die();
-
-} else if ($action == 'addtoquicklist') {
- require_capability('mod/assign:grade', $context);
-
- $comment = required_param('commenttext', PARAM_RAW);
- $width = required_param('width', PARAM_INT);
- $colour = required_param('colour', PARAM_ALPHA);
-
- $result = comments_quick_list::add_comment($comment, $width, $colour);
-
- echo json_encode($result);
- die();
-} else if ($action == 'revertchanges') {
- require_capability('mod/assign:grade', $context);
-
- $grade = $assignment->get_user_grade($userid, true);
-
- $result = page_editor::revert_drafts($gradeid);
-
- echo json_encode($result);
- die();
-} else if ($action == 'removefromquicklist') {
- require_capability('mod/assign:grade', $context);
-
- $commentid = required_param('commentid', PARAM_INT);
-
- $result = comments_quick_list::remove_comment($commentid);
-
- echo json_encode($result);
- die();
-} else if ($action == 'deletefeedbackdocument') {
- require_capability('mod/assign:grade', $context);
-
- $grade = $assignment->get_user_grade($userid, true);
- $result = document_services::delete_feedback_document($assignment, $userid, $attemptnumber);
-
- $result = $result && page_editor::unrelease_drafts($grade->id);
- echo json_encode($result);
- die();
-}
-
diff --git a/mod/assign/feedback/editpdf/ajax_progress.php b/mod/assign/feedback/editpdf/ajax_progress.php
deleted file mode 100644
index 8154848..0000000
--- a/mod/assign/feedback/editpdf/ajax_progress.php
+++ /dev/null
@@ -1,73 +0,0 @@
-.
-
-/**
- * Process concurrent ajax request.
- * ALL RETURNED INFO IS PUBLIC.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Jerome Mouneyrac
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-define('AJAX_SCRIPT', true);
-// To be able to process concurrent ajax request with the generate pdf ajax request we can not use cookie.
-define('NO_MOODLE_COOKIES', true);
-
-use \assignfeedback_editpdf\document_services;
-require_once('../../../../config.php');
-
-try {
- $assignmentid = required_param('assignmentid', PARAM_INT);
- $userid = required_param('userid', PARAM_INT);
- $attemptnumber = required_param('attemptnumber', PARAM_INT);
-
- // Retrieve the assignments.
- require_once($CFG->dirroot . '/mod/assign/locallib.php');
- $cm = get_coursemodule_from_instance('assign', $assignmentid, 0, false, MUST_EXIST);
- $context = context_module::instance($cm->id);
- $assignment = new assign($context, null, null);
-
- // Get the generated images from file API call.
- $grade = $assignment->get_user_grade($userid, false, $attemptnumber);
-
- // Check we found a grade.
- if (empty($grade)) {
- throw new coding_exception('grade not found');
- }
-
- // No need to handle the readonly files here, the should be already generated.
- $component = 'assignfeedback_editpdf';
- $filearea = document_services::PAGE_IMAGE_FILEAREA;
- $filepath = '/';
- $fs = get_file_storage();
- $files = $fs->get_directory_files($context->id, $component, $filearea, $grade->id, $filepath);
-
- // The important security part: we ONLY RETURN the total NUMBER of generated images.
- echo $OUTPUT->header();
- echo json_encode(count($files));
- echo $OUTPUT->footer();
-} catch (Exception $e) {
- // This should never happened!
- // Return a 500 HTTP header so Y.io gets it as a failure.
- if (substr(php_sapi_name(), 0, 3) == 'cgi') {
- header("Status: 500 Internal Server Error");
- } else {
- header('HTTP/1.0 500 Internal Server Error');
- }
- throw new moodle_exception('An exception was caught but can not be returned for security purpose.
- To easily debug, comment the try catch.');
-}
diff --git a/mod/assign/feedback/editpdf/backup/moodle2/backup_assignfeedback_editpdf_subplugin.class.php b/mod/assign/feedback/editpdf/backup/moodle2/backup_assignfeedback_editpdf_subplugin.class.php
deleted file mode 100644
index 4fe8cc6..0000000
--- a/mod/assign/feedback/editpdf/backup/moodle2/backup_assignfeedback_editpdf_subplugin.class.php
+++ /dev/null
@@ -1,73 +0,0 @@
-.
-
-/**
- * This file contains the backup code for the feedback_editpdf plugin.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Provides the information to backup feedback pdf annotations.
- *
- * This just adds its fileareas to the annotations and the comments and annotation data.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class backup_assignfeedback_editpdf_subplugin extends backup_subplugin {
-
- /**
- * Returns the subplugin information to attach to feedback element
- * @return backup_subplugin_element
- */
- protected function define_grade_subplugin_structure() {
-
- // Create XML elements.
- $subplugin = $this->get_subplugin_element();
- $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
- $subpluginelementfiles = new backup_nested_element('feedback_editpdf_files', null, array('gradeid'));
- $subpluginelementannotations = new backup_nested_element('feedback_editpdf_annotations');
- $subpluginelementannotation = new backup_nested_element('annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft'));
- $subpluginelementcomments = new backup_nested_element('feedback_editpdf_comments');
- $subpluginelementcomment = new backup_nested_element('comment', null, array('gradeid', 'pageno', 'x', 'y', 'width', 'rawtext', 'colour', 'draft'));
-
- // Connect XML elements into the tree.
- $subplugin->add_child($subpluginwrapper);
- $subpluginelementannotations->add_child($subpluginelementannotation);
- $subpluginelementcomments->add_child($subpluginelementcomment);
- $subpluginwrapper->add_child($subpluginelementfiles);
- $subpluginwrapper->add_child($subpluginelementannotations);
- $subpluginwrapper->add_child($subpluginelementcomments);
-
- // Set source to populate the data.
- $subpluginelementfiles->set_source_sql('SELECT id AS gradeid from {assign_grades} where id = :gradeid', array('gradeid' => backup::VAR_PARENTID));
- $subpluginelementannotation->set_source_table('assignfeedback_editpdf_annot', array('gradeid' => backup::VAR_PARENTID));
- $subpluginelementcomment->set_source_table('assignfeedback_editpdf_cmnt', array('gradeid' => backup::VAR_PARENTID));
- // We only need to backup the files in the final pdf area, and the readonly page images - the others can be regenerated.
- $subpluginelementfiles->annotate_files('assignfeedback_editpdf',
- \assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'gradeid');
- $subpluginelementfiles->annotate_files('assignfeedback_editpdf',
- \assignfeedback_editpdf\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'gradeid');
- $subpluginelementfiles->annotate_files('assignfeedback_editpdf', 'stamps', 'gradeid');
- return $subplugin;
- }
-
-}
diff --git a/mod/assign/feedback/editpdf/backup/moodle2/restore_assignfeedback_editpdf_subplugin.class.php b/mod/assign/feedback/editpdf/backup/moodle2/restore_assignfeedback_editpdf_subplugin.class.php
deleted file mode 100644
index c520e2b..0000000
--- a/mod/assign/feedback/editpdf/backup/moodle2/restore_assignfeedback_editpdf_subplugin.class.php
+++ /dev/null
@@ -1,112 +0,0 @@
-.
-
-/**
- * This file contains the restore code for the feedback_editpdf plugin.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Restore subplugin class.
- *
- * Provides the necessary information needed
- * to restore one assign_feedback subplugin.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class restore_assignfeedback_editpdf_subplugin extends restore_subplugin {
-
- /**
- * Returns the paths to be handled by the subplugin at assignment level
- * @return array
- */
- protected function define_grade_subplugin_structure() {
-
- $paths = array();
-
- // We used get_recommended_name() so this works.
- // The files node is a placeholder just containing gradeid so we can restore files once per grade.
- $elename = $this->get_namefor('files');
- $elepath = $this->get_pathfor('/feedback_editpdf_files');
- $paths[] = new restore_path_element($elename, $elepath);
-
- // Now we have the list of comments and annotations per grade.
- $elename = $this->get_namefor('comment');
- $elepath = $this->get_pathfor('/feedback_editpdf_comments/comment');
- $paths[] = new restore_path_element($elename, $elepath);
- $elename = $this->get_namefor('annotation');
- $elepath = $this->get_pathfor('/feedback_editpdf_annotations/annotation');
- $paths[] = new restore_path_element($elename, $elepath);
-
- return $paths;
- }
-
- /**
- * Processes one feedback_editpdf_files element
- * @param mixed $data
- */
- public function process_assignfeedback_editpdf_files($data) {
- $data = (object)$data;
-
- // In this case the id is the old gradeid which will be mapped.
- $this->add_related_files('assignfeedback_editpdf',
- \assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data->gradeid);
- $this->add_related_files('assignfeedback_editpdf',
- \assignfeedback_editpdf\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'grade', null, $data->gradeid);
- $this->add_related_files('assignfeedback_editpdf', 'stamps', 'grade', null, $data->gradeid);
- }
-
- /**
- * Processes one feedback_editpdf_annotations/annotation element
- * @param mixed $data
- */
- public function process_assignfeedback_editpdf_annotation($data) {
- global $DB;
-
- $data = (object)$data;
- $oldgradeid = $data->gradeid;
- // The mapping is set in the restore for the core assign activity
- // when a grade node is processed.
- $data->gradeid = $this->get_mappingid('grade', $data->gradeid);
-
- $DB->insert_record('assignfeedback_editpdf_annot', $data);
-
- }
-
- /**
- * Processes one feedback_editpdf_comments/comment element
- * @param mixed $data
- */
- public function process_assignfeedback_editpdf_comment($data) {
- global $DB;
-
- $data = (object)$data;
- $oldgradeid = $data->gradeid;
- // The mapping is set in the restore for the core assign activity
- // when a grade node is processed.
- $data->gradeid = $this->get_mappingid('grade', $data->gradeid);
-
- $DB->insert_record('assignfeedback_editpdf_cmnt', $data);
-
- }
-
-}
diff --git a/mod/assign/feedback/editpdf/classes/annotation.php b/mod/assign/feedback/editpdf/classes/annotation.php
deleted file mode 100644
index f6bd313..0000000
--- a/mod/assign/feedback/editpdf/classes/annotation.php
+++ /dev/null
@@ -1,84 +0,0 @@
-.
-
-/**
- * This file contains the annotation class for the assignfeedback_editpdf plugin
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-namespace assignfeedback_editpdf;
-
-/**
- * This class adds and removes annotations from a page of a response.
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class annotation {
-
- /** @var int unique id for this annotation */
- public $id = 0;
-
- /** @var int gradeid for this annotation */
- public $gradeid = 0;
-
- /** @var int page number for this annotation */
- public $pageno = 0;
-
- /** @var int starting location in pixels. Image resolution is 100 pixels per inch */
- public $x = 0;
-
- /** @var int ending location in pixels. Image resolution is 100 pixels per inch */
- public $endx = 0;
-
- /** @var int starting location in pixels. Image resolution is 100 pixels per inch */
- public $y = 0;
-
- /** @var int ending location in pixels. Image resolution is 100 pixels per inch */
- public $endy = 0;
-
- /** @var string path information for drawing the annotation. */
- public $path = '';
-
- /** @var string colour - One of red, yellow, green, blue, white */
- public $colour = 'yellow';
-
- /** @var string type - One of line, oval, rect, etc */
- public $type = 'line';
-
- /**
- * Convert a compatible stdClass into an instance of this class.
- * @param stdClass $record
- */
- public function __construct(\stdClass $record = null) {
- if ($record) {
- $intcols = array('endx', 'endy', 'x', 'y');
- foreach ($this as $key => $value) {
- if (isset($record->$key)) {
- if (in_array($key, $intcols)) {
- $this->$key = intval($record->$key);
- } else {
- $this->$key = $record->$key;
- }
- }
- }
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/classes/comment.php b/mod/assign/feedback/editpdf/classes/comment.php
deleted file mode 100644
index d0cfded..0000000
--- a/mod/assign/feedback/editpdf/classes/comment.php
+++ /dev/null
@@ -1,76 +0,0 @@
-.
-
-/**
- * This file contains the comment class for the assignfeedback_editpdf plugin
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-namespace assignfeedback_editpdf;
-
-/**
- * This class represents a comment box on a page of feedback.
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class comment {
-
- /** @var int unique id for this annotation */
- public $id = 0;
-
- /** @var int gradeid for this annotation */
- public $gradeid = 0;
-
- /** @var int page number for this annotation */
- public $pageno = 0;
-
- /** @var int starting location in pixels. Image resolution is 100 pixels per inch */
- public $x = 0;
-
- /** @var int starting location in pixels. Image resolution is 100 pixels per inch */
- public $y = 0;
-
- /** @var int width of the comment box */
- public $width = 120;
-
- /** @var string The comment text. */
- public $rawtext = '';
-
- /** @var string colour - One of red, yellow, green, blue, white */
- public $colour = 'yellow';
-
- /**
- * Convert a compatible stdClass into an instance of a comment.
- * @param \stdClass $record
- */
- public function __construct(\stdClass $record = null) {
- if ($record) {
- $intcols = array('width', 'x', 'y');
- foreach ($this as $key => $value) {
- if (isset($record->$key)) {
- if (in_array($key, $intcols)) {
- $this->$key = intval($record->$key);
- } else {
- $this->$key = $record->$key;
- }
- }
- }
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/classes/comments_quick_list.php b/mod/assign/feedback/editpdf/classes/comments_quick_list.php
deleted file mode 100644
index deb8be2..0000000
--- a/mod/assign/feedback/editpdf/classes/comments_quick_list.php
+++ /dev/null
@@ -1,94 +0,0 @@
-.
-
-/**
- * This file contains the functions for managing a users comments quicklist.
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-namespace assignfeedback_editpdf;
-
-/**
- * This class performs crud operations on a users quicklist comments.
- *
- * No capability checks are done - they should be done by the calling class.
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class comments_quick_list {
-
- /**
- * Get all comments for the current user.
- * @return array(comment)
- */
- public static function get_comments() {
- global $DB, $USER;
-
- $comments = array();
- $records = $DB->get_records('assignfeedback_editpdf_quick', array('userid'=>$USER->id));
-
- return $records;
- }
-
- /**
- * Add a comment to the quick list.
- * @param string $commenttext
- * @param int $width
- * @param string $colour
- * @return stdClass - the comment record (with new id set)
- */
- public static function add_comment($commenttext, $width, $colour) {
- global $DB, $USER;
-
- $comment = new \stdClass();
- $comment->userid = $USER->id;
- $comment->rawtext = $commenttext;
- $comment->width = $width;
- $comment->colour = $colour;
-
- $comment->id = $DB->insert_record('assignfeedback_editpdf_quick', $comment);
- return $comment;
- }
-
- /**
- * Get a single comment by id.
- * @param int $commentid
- * @return comment or false
- */
- public static function get_comment($commentid) {
- global $DB;
-
- $record = $DB->get_record('assignfeedback_editpdf_quick', array('id'=>$commentid), '*', IGNORE_MISSING);
- if ($record) {
- return $record;
- }
- return false;
- }
-
- /**
- * Remove a comment from the quick list.
- * @param int $commentid
- * @return bool
- */
- public static function remove_comment($commentid) {
- global $DB, $USER;
- return $DB->delete_records('assignfeedback_editpdf_quick', array('id'=>$commentid, 'userid'=>$USER->id));
- }
-}
diff --git a/mod/assign/feedback/editpdf/classes/document_services.php b/mod/assign/feedback/editpdf/classes/document_services.php
deleted file mode 100644
index 912bd8a..0000000
--- a/mod/assign/feedback/editpdf/classes/document_services.php
+++ /dev/null
@@ -1,729 +0,0 @@
-.
-
-/**
- * This file contains the ingest manager for the assignfeedback_editpdf plugin
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-namespace assignfeedback_editpdf;
-
-/**
- * Functions for generating the annotated pdf.
- *
- * This class controls the ingest of student submission files to a normalised
- * PDF 1.4 document with all submission files concatinated together. It also
- * provides the functions to generate a downloadable pdf with all comments and
- * annotations embedded.
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class document_services {
-
- /** File area for generated pdf */
- const FINAL_PDF_FILEAREA = 'download';
- /** File area for combined pdf */
- const COMBINED_PDF_FILEAREA = 'combined';
- /** File area for page images */
- const PAGE_IMAGE_FILEAREA = 'pages';
- /** File area for readonly page images */
- const PAGE_IMAGE_READONLY_FILEAREA = 'readonlypages';
- /** Filename for combined pdf */
- const COMBINED_PDF_FILENAME = 'combined.pdf';
-
- /**
- * This function will take an int or an assignment instance and
- * return an assignment instance. It is just for convenience.
- * @param int|\assign $assignment
- * @return assign
- */
- private static function get_assignment_from_param($assignment) {
- global $CFG;
-
- require_once($CFG->dirroot . '/mod/assign/locallib.php');
-
- if (!is_object($assignment)) {
- $cm = \get_coursemodule_from_instance('assign', $assignment, 0, false, MUST_EXIST);
- $context = \context_module::instance($cm->id);
-
- $assignment = new \assign($context, null, null);
- }
- return $assignment;
- }
-
- /**
- * Get a hash that will be unique and can be used in a path name.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- */
- private static function hash($assignment, $userid, $attemptnumber) {
- if (is_object($assignment)) {
- $assignmentid = $assignment->get_instance()->id;
- } else {
- $assignmentid = $assignment;
- }
- return sha1($assignmentid . '_' . $userid . '_' . $attemptnumber);
- }
-
- /**
- * This function will search for all files that can be converted
- * and concatinated into a PDF (1.4) - for any submission plugin
- * for this students attempt.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return array(stored_file)
- */
- public static function list_compatible_submission_files_for_attempt($assignment, $userid, $attemptnumber) {
- global $USER, $DB;
-
- $assignment = self::get_assignment_from_param($assignment);
-
- // Capability checks.
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- $files = array();
-
- if ($assignment->get_instance()->teamsubmission) {
- $submission = $assignment->get_group_submission($userid, 0, false);
- } else {
- $submission = $assignment->get_user_submission($userid, false);
- }
- $user = $DB->get_record('user', array('id' => $userid));
-
- // User has not submitted anything yet.
- if (!$submission) {
- return $files;
- }
- // Ask each plugin for it's list of files.
- foreach ($assignment->get_submission_plugins() as $plugin) {
- if ($plugin->is_enabled() && $plugin->is_visible()) {
- $pluginfiles = $plugin->get_files($submission, $user);
- foreach ($pluginfiles as $filename => $file) {
- if (($file instanceof \stored_file) && ($file->get_mimetype() === 'application/pdf')) {
- $files[$filename] = $file;
- }
- }
- }
- }
- return $files;
- }
-
- /**
- * This function return the combined pdf for all valid submission files.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return stored_file
- */
- public static function get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
-
- global $USER, $DB;
-
- $assignment = self::get_assignment_from_param($assignment);
-
- // Capability checks.
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- if ($assignment->get_instance()->teamsubmission) {
- $submission = $assignment->get_group_submission($userid, 0, false);
- } else {
- $submission = $assignment->get_user_submission($userid, false);
- }
-
- $contextid = $assignment->get_context()->id;
- $component = 'assignfeedback_editpdf';
- $filearea = self::COMBINED_PDF_FILEAREA;
- $itemid = $grade->id;
- $filepath = '/';
- $filename = self::COMBINED_PDF_FILENAME;
- $fs = \get_file_storage();
-
- $combinedpdf = $fs->get_file($contextid, $component, $filearea, $itemid, $filepath, $filename);
- if (!$combinedpdf ||
- ($submission && ($combinedpdf->get_timemodified() < $submission->timemodified))) {
- return self::generate_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
- }
- return $combinedpdf;
- }
-
- /**
- * This function will take all of the compatible files for a submission
- * and combine them into one PDF.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return stored_file
- */
- public static function generate_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
- global $CFG;
-
- require_once($CFG->libdir . '/pdflib.php');
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- $files = self::list_compatible_submission_files_for_attempt($assignment, $userid, $attemptnumber);
-
- $pdf = new pdf();
- if (!$files) {
- // No valid submission files - create an empty pdf.
- $pdf->AddPage();
- } else {
-
- // Create a mega joined PDF.
- $compatiblepdfs = array();
- foreach ($files as $file) {
- $compatiblepdf = pdf::ensure_pdf_compatible($file);
- if ($compatiblepdf) {
- array_push($compatiblepdfs, $compatiblepdf);
- }
- }
-
- $tmpdir = \make_temp_directory('assignfeedback_editpdf/combined/' . self::hash($assignment, $userid, $attemptnumber));
- $tmpfile = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
-
- @unlink($tmpfile);
- try {
- $pagecount = $pdf->combine_pdfs($compatiblepdfs, $tmpfile);
- } catch (\Exception $e) {
- debugging('TCPDF could not process the pdf files:' . $e->getMessage(), DEBUG_DEVELOPER);
- // TCPDF does not recover from errors so we need to re-initialise the class.
- $pagecount = 0;
- }
- if ($pagecount == 0) {
- // We at least want a single blank page.
- debugging('TCPDF did not produce a valid pdf:' . $tmpfile . '. Replacing with a blank pdf.', DEBUG_DEVELOPER);
- $pdf = new pdf();
- $pdf->AddPage();
- @unlink($tmpfile);
- $files = false;
- }
- }
-
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- $record = new \stdClass();
-
- $record->contextid = $assignment->get_context()->id;
- $record->component = 'assignfeedback_editpdf';
- $record->filearea = self::COMBINED_PDF_FILEAREA;
- $record->itemid = $grade->id;
- $record->filepath = '/';
- $record->filename = self::COMBINED_PDF_FILENAME;
- $fs = \get_file_storage();
-
- $fs->delete_area_files($record->contextid, $record->component, $record->filearea, $record->itemid);
-
- // Detect corrupt generated pdfs and replace with a blank one.
- if ($files) {
- $pagecount = $pdf->load_pdf($tmpfile);
- if ($pagecount <= 0) {
- $files = false;
- }
- }
-
- if (!$files) {
- // This was a blank pdf.
- unset($pdf);
- $pdf = new pdf();
- $content = $pdf->Output(self::COMBINED_PDF_FILENAME, 'S');
- $file = $fs->create_file_from_string($record, $content);
- } else {
- // This was a combined pdf.
- $file = $fs->create_file_from_pathname($record, $tmpfile);
- @unlink($tmpfile);
-
- // Test the generated file for correctness.
- $compatiblepdf = pdf::ensure_pdf_compatible($file);
- }
-
- return $file;
- }
-
- /**
- * This function will return the number of pages of a pdf.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @param bool $readonly When true we get the number of pages for the readonly version.
- * @return int number of pages
- */
- public static function page_number_for_attempt($assignment, $userid, $attemptnumber, $readonly = false) {
- global $CFG;
-
- require_once($CFG->libdir . '/pdflib.php');
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- // When in readonly we can return the number of images in the DB because they should already exist,
- // if for some reason they do not, then we proceed as for the normal version.
- if ($readonly) {
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- $fs = get_file_storage();
- $files = $fs->get_directory_files($assignment->get_context()->id, 'assignfeedback_editpdf',
- self::PAGE_IMAGE_READONLY_FILEAREA, $grade->id, '/');
- $pagecount = count($files);
- if ($pagecount > 0) {
- return $pagecount;
- }
- }
-
- // Get a combined pdf file from all submitted pdf files.
- $file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
- if (!$file) {
- \print_error('Could not generate combined pdf.');
- }
-
- // Store the combined pdf file somewhere to be opened by tcpdf.
- $tmpdir = \make_temp_directory('assignfeedback_editpdf/pagetotal/'
- . self::hash($assignment, $userid, $attemptnumber));
- $combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
- $file->copy_content_to($combined); // Copy the file.
-
- // Get the total number of pages.
- $pdf = new pdf();
- $pagecount = $pdf->set_pdf($combined);
-
- // Delete temporary folders and files.
- @unlink($combined);
- @rmdir($tmpdir);
-
- return $pagecount;
- }
-
- /**
- * This function will generate and return a list of the page images from a pdf.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return array(stored_file)
- */
- public static function generate_page_images_for_attempt($assignment, $userid, $attemptnumber) {
- global $CFG;
-
- require_once($CFG->libdir . '/pdflib.php');
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- // Need to generate the page images - first get a combined pdf.
- $file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
- if (!$file) {
- throw new \moodle_exception('Could not generate combined pdf.');
- }
-
- $tmpdir = \make_temp_directory('assignfeedback_editpdf/pageimages/' . self::hash($assignment, $userid, $attemptnumber));
- $combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
- $file->copy_content_to($combined); // Copy the file.
-
- $pdf = new pdf();
-
- $pdf->set_image_folder($tmpdir);
- $pagecount = $pdf->set_pdf($combined);
-
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
-
- $record = new \stdClass();
- $record->contextid = $assignment->get_context()->id;
- $record->component = 'assignfeedback_editpdf';
- $record->filearea = self::PAGE_IMAGE_FILEAREA;
- $record->itemid = $grade->id;
- $record->filepath = '/';
- $fs = \get_file_storage();
-
- $files = array();
- for ($i = 0; $i < $pagecount; $i++) {
- $image = $pdf->get_image($i);
- $record->filename = basename($image);
- $files[$i] = $fs->create_file_from_pathname($record, $tmpdir . '/' . $image);
- @unlink($tmpdir . '/' . $image);
- }
-
- @unlink($combined);
- @rmdir($tmpdir);
-
- return $files;
- }
-
- /**
- * This function returns a list of the page images from a pdf.
- *
- * The readonly version is different than the normal one. The readonly version contains a copy
- * of the pages in the state they were when the PDF was annotated, by doing so we prevent the
- * the pages that are displayed to change as soon as the submission changes.
- *
- * Though there is an edge case, if the PDF was annotated before MDL-45580, then it is possible
- * that we do not find any readonly version of the pages. In that case, we will get the normal
- * pages and copy them to the readonly area. This ensures that the pages will remain in that
- * state until the submission is updated. When the normal files do not exist, we throw an exception
- * because the readonly pages should only ever be displayed after a teacher has annotated the PDF,
- * they would not exist until they do.
- *
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @param bool $readonly If true, then we are requesting the readonly version.
- * @return array(stored_file)
- */
- public static function get_page_images_for_attempt($assignment, $userid, $attemptnumber, $readonly = false) {
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- if ($assignment->get_instance()->teamsubmission) {
- $submission = $assignment->get_group_submission($userid, 0, false);
- } else {
- $submission = $assignment->get_user_submission($userid, false);
- }
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
-
- $contextid = $assignment->get_context()->id;
- $component = 'assignfeedback_editpdf';
- $itemid = $grade->id;
- $filepath = '/';
- $filearea = self::PAGE_IMAGE_FILEAREA;
-
- $fs = \get_file_storage();
-
- // If we are after the readonly pages...
- $copytoreadonly = false;
- if ($readonly) {
- $filearea = self::PAGE_IMAGE_READONLY_FILEAREA;
- if ($fs->is_area_empty($contextid, $component, $filearea, $itemid)) {
- // We have a problem here, we were supposed to find the files...
- // let's fallback on the other area, and copy the files to the readonly area.
- $copytoreadonly = true;
- $filearea = self::PAGE_IMAGE_FILEAREA;
- }
- }
-
- $files = $fs->get_directory_files($contextid, $component, $filearea, $itemid, $filepath);
-
- $pages = array();
- if (!empty($files)) {
- $first = reset($files);
- if (!$readonly && $first->get_timemodified() < $submission->timemodified) {
- // Image files are stale, we need to regenerate them, except in readonly mode.
- // We also need to remove the draft annotations and comments associated with this attempt.
- $fs->delete_area_files($contextid, $component, $filearea, $itemid);
- page_editor::delete_draft_content($itemid);
- $files = array();
- } else {
-
- // Need to reorder the files following their name.
- // because get_directory_files() return a different order than generate_page_images_for_attempt().
- foreach($files as $file) {
- // Extract the page number from the file name image_pageXXXX.png.
- preg_match('/page([\d]+)\./', $file->get_filename(), $matches);
- if (empty($matches) or !is_numeric($matches[1])) {
- throw new \coding_exception("'" . $file->get_filename()
- . "' file hasn't the expected format filename: image_pageXXXX.png.");
- }
- $pagenumber = (int)$matches[1];
-
- // Save the page in the ordered array.
- $pages[$pagenumber] = $file;
- }
- ksort($pages);
-
- if ($copytoreadonly) {
- self::copy_pages_to_readonly_area($assignment, $grade);
- }
- }
- }
-
- if (empty($pages)) {
- if ($readonly) {
- // This should never happen, there should be a version of the pages available
- // whenever we are requesting the readonly version.
- throw new \moodle_exception('Could not find readonly pages for grade ' . $grade->id);
- }
- $pages = self::generate_page_images_for_attempt($assignment, $userid, $attemptnumber);
- }
-
- return $pages;
- }
-
- /**
- * This function returns sensible filename for a feedback file.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return string
- */
- protected static function get_downloadable_feedback_filename($assignment, $userid, $attemptnumber) {
- global $DB;
-
- $assignment = self::get_assignment_from_param($assignment);
-
- $groupmode = groups_get_activity_groupmode($assignment->get_course_module());
- $groupname = '';
- if ($groupmode) {
- $groupid = groups_get_activity_group($assignment->get_course_module(), true);
- $groupname = groups_get_group_name($groupid).'-';
- }
- if ($groupname == '-') {
- $groupname = '';
- }
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- $user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
-
- if ($assignment->is_blind_marking()) {
- $prefix = $groupname . get_string('participant', 'assign');
- $prefix = str_replace('_', ' ', $prefix);
- $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
- } else {
- $prefix = $groupname . fullname($user);
- $prefix = str_replace('_', ' ', $prefix);
- $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
- }
- $prefix .= $grade->attemptnumber;
-
- return $prefix . '.pdf';
- }
-
- /**
- * This function takes the combined pdf and embeds all the comments and annotations.
- *
- * This also moves the annotations and comments from drafts to not drafts. And it will
- * copy all the images stored to the readonly area, so that they can be viewed online, and
- * not be overwritten when a new submission is sent.
- *
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return stored_file
- */
- public static function generate_feedback_document($assignment, $userid, $attemptnumber) {
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
- if (!$assignment->can_grade()) {
- \print_error('nopermission');
- }
-
- // Need to generate the page images - first get a combined pdf.
- $file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
- if (!$file) {
- throw new \moodle_exception('Could not generate combined pdf.');
- }
-
- $tmpdir = \make_temp_directory('assignfeedback_editpdf/final/' . self::hash($assignment, $userid, $attemptnumber));
- $combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
- $file->copy_content_to($combined); // Copy the file.
-
- $pdf = new pdf();
-
- $fs = \get_file_storage();
- $stamptmpdir = \make_temp_directory('assignfeedback_editpdf/stamps/' . self::hash($assignment, $userid, $attemptnumber));
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- // Copy any new stamps to this instance.
- if ($files = $fs->get_area_files($assignment->get_context()->id,
- 'assignfeedback_editpdf',
- 'stamps',
- $grade->id,
- "filename",
- false)) {
- foreach ($files as $file) {
- $filename = $stamptmpdir . '/' . $file->get_filename();
- $file->copy_content_to($filename); // Copy the file.
- }
- }
-
- $pagecount = $pdf->set_pdf($combined);
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
- page_editor::release_drafts($grade->id);
-
- for ($i = 0; $i < $pagecount; $i++) {
- $pdf->copy_page();
- $comments = page_editor::get_comments($grade->id, $i, false);
- $annotations = page_editor::get_annotations($grade->id, $i, false);
-
- foreach ($comments as $comment) {
- $pdf->add_comment($comment->rawtext,
- $comment->x,
- $comment->y,
- $comment->width,
- $comment->colour);
- }
-
- foreach ($annotations as $annotation) {
- $pdf->add_annotation($annotation->x,
- $annotation->y,
- $annotation->endx,
- $annotation->endy,
- $annotation->colour,
- $annotation->type,
- $annotation->path,
- $stamptmpdir);
- }
- }
-
- fulldelete($stamptmpdir);
-
- $filename = self::get_downloadable_feedback_filename($assignment, $userid, $attemptnumber);
- $filename = clean_param($filename, PARAM_FILE);
-
- $generatedpdf = $tmpdir . '/' . $filename;
- $pdf->save_pdf($generatedpdf);
-
-
- $record = new \stdClass();
-
- $record->contextid = $assignment->get_context()->id;
- $record->component = 'assignfeedback_editpdf';
- $record->filearea = self::FINAL_PDF_FILEAREA;
- $record->itemid = $grade->id;
- $record->filepath = '/';
- $record->filename = $filename;
-
-
- // Only keep one current version of the generated pdf.
- $fs->delete_area_files($record->contextid, $record->component, $record->filearea, $record->itemid);
-
- $file = $fs->create_file_from_pathname($record, $generatedpdf);
-
- // Cleanup.
- @unlink($generatedpdf);
- @unlink($combined);
- @rmdir($tmpdir);
-
- self::copy_pages_to_readonly_area($assignment, $grade);
-
- return $file;
- }
-
- /**
- * Copy the pages image to the readonly area.
- *
- * @param int|\assign $assignment The assignment.
- * @param \stdClass $grade The grade record.
- * @return void
- */
- public static function copy_pages_to_readonly_area($assignment, $grade) {
- $fs = get_file_storage();
- $assignment = self::get_assignment_from_param($assignment);
- $contextid = $assignment->get_context()->id;
- $component = 'assignfeedback_editpdf';
- $itemid = $grade->id;
-
- // Get all the pages.
- $originalfiles = $fs->get_area_files($contextid, $component, self::PAGE_IMAGE_FILEAREA, $itemid);
- if (empty($originalfiles)) {
- // Nothing to do here...
- return;
- }
-
- // Delete the old readonly files.
- $fs->delete_area_files($contextid, $component, self::PAGE_IMAGE_READONLY_FILEAREA, $itemid);
-
- // Do the copying.
- foreach ($originalfiles as $originalfile) {
- $fs->create_file_from_storedfile(array('filearea' => self::PAGE_IMAGE_READONLY_FILEAREA), $originalfile);
- }
- }
-
- /**
- * This function returns the generated pdf (if it exists).
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return stored_file
- */
- public static function get_feedback_document($assignment, $userid, $attemptnumber) {
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
-
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
-
- $contextid = $assignment->get_context()->id;
- $component = 'assignfeedback_editpdf';
- $filearea = self::FINAL_PDF_FILEAREA;
- $itemid = $grade->id;
- $filepath = '/';
-
- $fs = \get_file_storage();
- $files = $fs->get_area_files($contextid,
- $component,
- $filearea,
- $itemid,
- "itemid, filepath, filename",
- false);
- if ($files) {
- return reset($files);
- }
- return false;
- }
-
- /**
- * This function deletes the generated pdf for a student.
- * @param int|\assign $assignment
- * @param int $userid
- * @param int $attemptnumber (-1 means latest attempt)
- * @return bool
- */
- public static function delete_feedback_document($assignment, $userid, $attemptnumber) {
-
- $assignment = self::get_assignment_from_param($assignment);
-
- if (!$assignment->can_view_submission($userid)) {
- \print_error('nopermission');
- }
- if (!$assignment->can_grade()) {
- \print_error('nopermission');
- }
-
- $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
-
- $contextid = $assignment->get_context()->id;
- $component = 'assignfeedback_editpdf';
- $filearea = self::FINAL_PDF_FILEAREA;
- $itemid = $grade->id;
-
- $fs = \get_file_storage();
- return $fs->delete_area_files($contextid, $component, $filearea, $itemid);
- }
-
-}
diff --git a/mod/assign/feedback/editpdf/classes/renderer.php b/mod/assign/feedback/editpdf/classes/renderer.php
deleted file mode 100644
index a5d32e0..0000000
--- a/mod/assign/feedback/editpdf/classes/renderer.php
+++ /dev/null
@@ -1,258 +0,0 @@
-.
-
-/**
- * This file contains the definition for the library class for edit PDF renderer.
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * A custom renderer class that extends the plugin_renderer_base and is used by the editpdf feedback plugin.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class assignfeedback_editpdf_renderer extends plugin_renderer_base {
-
- /**
- * Return the PDF button shortcut.
- *
- * @param string $name the name of a specific button.
- * @return string the specific shortcut.
- */
- private function get_shortcut($name) {
-
- $shortcuts = array('navigate-previous-button' => 'j',
- 'navigate-page-select' => 'k',
- 'navigate-next-button' => 'l',
- 'searchcomments' => 'h',
- 'comment' => 'z',
- 'commentcolour' => 'x',
- 'select' => 'c',
- 'pen' => 'y',
- 'line' => 'u',
- 'rectangle' => 'i',
- 'oval' => 'o',
- 'highlight' => 'p',
- 'annotationcolour' => 'r',
- 'stamp' => 'n',
- 'currentstamp' => 'm');
-
-
- // Return the shortcut.
- return $shortcuts[$name];
- }
-
- /**
- * Render a single colour button.
- *
- * @param string $icon - The key for the icon
- * @param string $tool - The key for the lang string.
- * @param string $accesskey Optional - The access key for the button.
- * @param bool $disabled Optional - Is this button disabled.
- * @return string
- */
- private function render_toolbar_button($icon, $tool, $accesskey = null, $disabled=false) {
-
- // Build button alt text.
- $alttext = new stdClass();
- $alttext->tool = $tool;
- if (!empty($accesskey)) {
- $alttext->shortcut = '(Alt/Shift-Alt/Ctrl-Option + ' . $accesskey . ')';
- } else {
- $alttext->shortcut = '';
- }
- $iconalt = get_string('toolbarbutton', 'assignfeedback_editpdf', $alttext);
-
- $iconhtml = $this->pix_icon($icon, $iconalt, 'assignfeedback_editpdf');
- $iconparams = array('data-tool'=>$tool, 'class'=>$tool . 'button');
- if ($disabled) {
- $iconparams['disabled'] = 'true';
- }
- if (!empty($accesskey)) {
- $iconparams['accesskey'] = $accesskey;
- }
-
- return html_writer::tag('button', $iconhtml, $iconparams);
- }
-
- /**
- * Render the editpdf widget in the grading form.
- *
- * @param assignfeedback_editpdf_widget $widget - Renderable widget containing assignment, user and attempt number.
- * @return string
- */
- public function render_assignfeedback_editpdf_widget(assignfeedback_editpdf_widget $widget) {
- global $CFG;
-
- $html = '';
-
- $html .= html_writer::div(get_string('jsrequired', 'assignfeedback_editpdf'), 'hiddenifjs');
- $linkid = html_writer::random_id();
- if ($widget->readonly) {
- $launcheditorlink = html_writer::tag('a',
- get_string('viewfeedbackonline', 'assignfeedback_editpdf'),
- array('id'=>$linkid, 'class'=>'btn', 'href'=>'#'));
- } else {
- $launcheditorlink = html_writer::tag('a',
- get_string('launcheditor', 'assignfeedback_editpdf'),
- array('id'=>$linkid, 'class'=>'btn', 'href'=>'#'));
- }
- $links = $launcheditorlink;
-
- $links .= html_writer::tag('div',
- get_string('unsavedchanges', 'assignfeedback_editpdf'),
- array('class'=>'assignfeedback_editpdf_unsavedchanges warning'));
-
- $html .= html_writer::div($links, 'visibleifjs');
- $header = get_string('pluginname', 'assignfeedback_editpdf');
- $body = '';
- // Create the page navigation.
- $navigation1 = '';
- $navigation2 = '';
-
- // Pick the correct arrow icons for right to left mode.
- if (right_to_left()) {
- $nav_prev = 'nav_next';
- $nav_next = 'nav_prev';
- } else {
- $nav_prev = 'nav_prev';
- $nav_next = 'nav_next';
- }
-
- $iconalt = get_string('navigateprevious', 'assignfeedback_editpdf');
- $iconhtml = $this->pix_icon($nav_prev, $iconalt, 'assignfeedback_editpdf');
- $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true',
- 'class'=>'navigate-previous-button', 'accesskey' => $this->get_shortcut('navigate-previous-button')));
- $navigation1 .= html_writer::tag('select', null, array('disabled'=>'true',
- 'aria-label' => get_string('gotopage', 'assignfeedback_editpdf'), 'class'=>'navigate-page-select',
- 'accesskey' => $this->get_shortcut('navigate-page-select')));
- $iconalt = get_string('navigatenext', 'assignfeedback_editpdf');
- $iconhtml = $this->pix_icon($nav_next, $iconalt, 'assignfeedback_editpdf');
- $navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true',
- 'class'=>'navigate-next-button', 'accesskey' => $this->get_shortcut('navigate-next-button')));
-
- $navigation1 = html_writer::div($navigation1, 'navigation', array('role'=>'navigation'));
-
- $navigation2 .= $this->render_toolbar_button('comment_search', 'searchcomments', $this->get_shortcut('searchcomments'));
- $navigation2 = html_writer::div($navigation2, 'navigation-search', array('role'=>'navigation'));
-
- $toolbar1 = '';
- $toolbar2 = '';
- $toolbar3 = '';
- $toolbar4 = '';
- $clearfix = html_writer::div('', 'clearfix');
- if (!$widget->readonly) {
-
- // Comments.
- $toolbar1 .= $this->render_toolbar_button('comment', 'comment', $this->get_shortcut('comment'));
- $toolbar1 .= $this->render_toolbar_button('background_colour_clear', 'commentcolour', $this->get_shortcut('commentcolour'));
- $toolbar1 = html_writer::div($toolbar1, 'toolbar', array('role'=>'toolbar'));
-
- // Select Tool.
- $toolbar2 .= $this->render_toolbar_button('select', 'select', $this->get_shortcut('select'));
- $toolbar2 = html_writer::div($toolbar2, 'toolbar', array('role'=>'toolbar'));
-
- // Other Tools.
- $toolbar3 = $this->render_toolbar_button('pen', 'pen', $this->get_shortcut('pen'));
- $toolbar3 .= $this->render_toolbar_button('line', 'line', $this->get_shortcut('line'));
- $toolbar3 .= $this->render_toolbar_button('rectangle', 'rectangle', $this->get_shortcut('rectangle'));
- $toolbar3 .= $this->render_toolbar_button('oval', 'oval', $this->get_shortcut('oval'));
- $toolbar3 .= $this->render_toolbar_button('highlight', 'highlight', $this->get_shortcut('highlight'));
- $toolbar3 .= $this->render_toolbar_button('background_colour_clear', 'annotationcolour', $this->get_shortcut('annotationcolour'));
- $toolbar3 = html_writer::div($toolbar3, 'toolbar', array('role'=>'toolbar'));
-
- // Stamps.
- $toolbar4 .= $this->render_toolbar_button('stamp', 'stamp', 'n');
- $toolbar4 .= $this->render_toolbar_button('background_colour_clear', 'currentstamp', $this->get_shortcut('currentstamp'));
- $toolbar4 = html_writer::div($toolbar4, 'toolbar', array('role'=>'toolbar'));
- }
-
- // Toobars written in reverse order because they are floated right.
- $pageheader = html_writer::div($navigation1 .
- $navigation2 .
- $toolbar4 .
- $toolbar3 .
- $toolbar2 .
- $toolbar1 .
- $clearfix,
- 'pageheader');
- $body = $pageheader;
-
- // Loading progress bar.
- $progressbar = html_writer::div('', 'bar', array('style' => 'width: 0%'));
- $progressbar = html_writer::div($progressbar, 'progress progress-info progress-striped active',
- array('title' => get_string('loadingeditor', 'assignfeedback_editpdf'),
- 'role'=> 'progressbar', 'aria-valuenow' => 0, 'aria-valuemin' => 0,
- 'aria-valuemax' => 100));
- $progressbarlabel = html_writer::div(get_string('generatingpdf', 'assignfeedback_editpdf'),
- 'progressbarlabel');
- $loading = html_writer::div($progressbar . $progressbarlabel, 'loading');
-
- $canvas = html_writer::div($loading, 'drawingcanvas');
- $body .= html_writer::div($canvas, 'drawingregion');
-
- $body .= '
';
-
- $footer = '';
-
- $editorparams = array(array('header'=>$header,
- 'body'=>$body,
- 'footer'=>$footer,
- 'linkid'=>$linkid,
- 'assignmentid'=>$widget->assignment,
- 'userid'=>$widget->userid,
- 'attemptnumber'=>$widget->attemptnumber,
- 'stampfiles'=>$widget->stampfiles,
- 'readonly'=>$widget->readonly,
- 'pagetotal'=>$widget->pagetotal));
-
- $this->page->requires->yui_module('moodle-assignfeedback_editpdf-editor',
- 'M.assignfeedback_editpdf.editor.init',
- $editorparams);
-
- $this->page->requires->strings_for_js(array(
- 'yellow',
- 'white',
- 'red',
- 'blue',
- 'green',
- 'black',
- 'clear',
- 'colourpicker',
- 'loadingeditor',
- 'pagexofy',
- 'deletecomment',
- 'addtoquicklist',
- 'filter',
- 'searchcomments',
- 'commentcontextmenu',
- 'deleteannotation',
- 'stamp',
- 'stamppicker',
- 'cannotopenpdf',
- 'pagenumber'
- ), 'assignfeedback_editpdf');
-
- return $html;
- }
-}
diff --git a/mod/assign/feedback/editpdf/classes/widget.php b/mod/assign/feedback/editpdf/classes/widget.php
deleted file mode 100644
index 83b17c7..0000000
--- a/mod/assign/feedback/editpdf/classes/widget.php
+++ /dev/null
@@ -1,75 +0,0 @@
-.
-
-/**
- * This file contains the definition for the library class for edit PDF renderer.
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * A custom renderer class that extends the plugin_renderer_base and is used by the editpdf feedback plugin.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class assignfeedback_editpdf_widget implements renderable {
-
- /** @var int $assignment - Assignment instance id */
- public $assignment = 0;
- /** @var int $userid - The user id we are grading */
- public $userid = 0;
- /** @var mixed $attemptnumber - The attempt number we are grading */
- public $attemptnumber = 0;
- /** @var moodle_url $downloadurl */
- public $downloadurl = null;
- /** @var string $downloadfilename */
- public $downloadfilename = null;
- /** @var string[] $stampfiles */
- public $stampfiles = array();
- /** @var bool $readonly */
- public $readonly = true;
- /** @var integer $pagetotal */
- public $pagetotal = 0;
-
- /**
- * Constructor
- * @param int $assignment - Assignment instance id
- * @param int $userid - The user id we are grading
- * @param int $attemptnumber - The attempt number we are grading
- * @param moodle_url $downloadurl - A url to download the current generated pdf.
- * @param string $downloadfilename - Name of the generated pdf.
- * @param string[] $stampfiles - The file names of the stamps.
- * @param bool $readonly - Show the readonly interface (no tools).
- * @param integer $pagetotal - The total number of pages.
- */
- public function __construct($assignment, $userid, $attemptnumber, $downloadurl,
- $downloadfilename, $stampfiles, $readonly, $pagetotal) {
- $this->assignment = $assignment;
- $this->userid = $userid;
- $this->attemptnumber = $attemptnumber;
- $this->downloadurl = $downloadurl;
- $this->downloadfilename = $downloadfilename;
- $this->stampfiles = $stampfiles;
- $this->readonly = $readonly;
- $this->pagetotal = $pagetotal;
- }
-}
diff --git a/mod/assign/feedback/editpdf/db/install.php b/mod/assign/feedback/editpdf/db/install.php
deleted file mode 100644
index 1214a6a..0000000
--- a/mod/assign/feedback/editpdf/db/install.php
+++ /dev/null
@@ -1,53 +0,0 @@
-.
-
-/**
- * Install code for the feedback_editpdf module.
- *
- * @package assignfeedback_editpdf
- * @copyright 2013 Jerome Mouneyrac
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * EditPDF install code
- */
-function xmldb_assignfeedback_editpdf_install() {
- global $CFG;
-
- // List of default stamps.
- $defaultstamps = array('smile.png', 'sad.png', 'tick.png', 'cross.png');
-
- // Stamp file object.
- $filerecord = new stdClass;
- $filerecord->component = 'assignfeedback_editpdf';
- $filerecord->contextid = context_system::instance()->id;
- $filerecord->userid = get_admin()->id;
- $filerecord->filearea = 'stamps';
- $filerecord->filepath = '/';
- $filerecord->itemid = 0;
-
- $fs = get_file_storage();
-
- // Load all default stamps.
- foreach ($defaultstamps as $stamp) {
- $filerecord->filename = $stamp;
- $fs->create_file_from_pathname($filerecord,
- $CFG->dirroot . '/mod/assign/feedback/editpdf/pix/' . $filerecord->filename);
- }
-}
diff --git a/mod/assign/feedback/editpdf/db/install.xml b/mod/assign/feedback/editpdf/db/install.xml
deleted file mode 100644
index 39af982..0000000
--- a/mod/assign/feedback/editpdf/db/install.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/fpdi/ASL20.txt b/mod/assign/feedback/editpdf/fpdi/ASL20.txt
deleted file mode 100644
index d645695..0000000
--- a/mod/assign/feedback/editpdf/fpdi/ASL20.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85.php b/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85.php
deleted file mode 100644
index a86c91f..0000000
--- a/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85.php
+++ /dev/null
@@ -1,101 +0,0 @@
- ORD_u) {
- return $this->error('Illegal character in ASCII85Decode.');
- }
-
- $chn[$state++] = $ch - ORD_exclmark;
-
- if ($state == 5) {
- $state = 0;
- $r = 0;
- for ($j = 0; $j < 5; ++$j)
- $r = $r * 85 + $chn[$j];
- $out .= chr($r >> 24);
- $out .= chr($r >> 16);
- $out .= chr($r >> 8);
- $out .= chr($r);
- }
- }
- $r = 0;
-
- if ($state == 1)
- return $this->error('Illegal length in ASCII85Decode.');
- if ($state == 2) {
- $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
- $out .= chr($r >> 24);
- }
- else if ($state == 3) {
- $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85;
- $out .= chr($r >> 24);
- $out .= chr($r >> 16);
- }
- else if ($state == 4) {
- $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ;
- $out .= chr($r >> 24);
- $out .= chr($r >> 16);
- $out .= chr($r >> 8);
- }
-
- return $out;
- }
-
- function encode($in) {
- return $this->error("ASCII85 encoding not implemented.");
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85_FPDI.php b/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85_FPDI.php
deleted file mode 100644
index 03413eb..0000000
--- a/mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85_FPDI.php
+++ /dev/null
@@ -1,33 +0,0 @@
-fpdi =& $fpdi;
- }
-
- function error($msg) {
- $this->fpdi->error($msg);
- }
-}
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php b/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php
deleted file mode 100644
index d3d3333..0000000
--- a/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php
+++ /dev/null
@@ -1,157 +0,0 @@
-error('LZW flavour not supported.');
- }
-
- $this->initsTable();
-
- $this->data = $data;
- $this->dataLength = strlen($data);
-
- // Initialize pointers
- $this->bytePointer = 0;
- $this->bitPointer = 0;
-
- $this->nextData = 0;
- $this->nextBits = 0;
-
- $oldCode = 0;
-
- $string = '';
- $uncompData = '';
-
- while (($code = $this->getNextCode()) != 257) {
- if ($code == 256) {
- $this->initsTable();
- $code = $this->getNextCode();
-
- if ($code == 257) {
- break;
- }
-
- $uncompData .= $this->sTable[$code];
- $oldCode = $code;
-
- } else {
-
- if ($code < $this->tIdx) {
- $string = $this->sTable[$code];
- $uncompData .= $string;
-
- $this->addStringToTable($this->sTable[$oldCode], $string[0]);
- $oldCode = $code;
- } else {
- $string = $this->sTable[$oldCode];
- $string = $string . $string[0];
- $uncompData .= $string;
-
- $this->addStringToTable($string);
- $oldCode = $code;
- }
- }
- }
-
- return $uncompData;
- }
-
-
- /**
- * Initialize the string table.
- */
- function initsTable() {
- $this->sTable = array();
-
- for ($i = 0; $i < 256; $i++)
- $this->sTable[$i] = chr($i);
-
- $this->tIdx = 258;
- $this->bitsToGet = 9;
- }
-
- /**
- * Add a new string to the string table.
- */
- function addStringToTable ($oldString, $newString='') {
- $string = $oldString.$newString;
-
- // Add this new String to the table
- $this->sTable[$this->tIdx++] = $string;
-
- if ($this->tIdx == 511) {
- $this->bitsToGet = 10;
- } else if ($this->tIdx == 1023) {
- $this->bitsToGet = 11;
- } else if ($this->tIdx == 2047) {
- $this->bitsToGet = 12;
- }
- }
-
- // Returns the next 9, 10, 11 or 12 bits
- function getNextCode() {
- if ($this->bytePointer == $this->dataLength) {
- return 257;
- }
-
- $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
- $this->nextBits += 8;
-
- if ($this->nextBits < $this->bitsToGet) {
- $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
- $this->nextBits += 8;
- }
-
- $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9];
- $this->nextBits -= $this->bitsToGet;
-
- return $code;
- }
-
- function encode($in) {
- $this->error("LZW encoding not implemented.");
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW_FPDI.php b/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW_FPDI.php
deleted file mode 100644
index decc170..0000000
--- a/mod/assign/feedback/editpdf/fpdi/filters/FilterLZW_FPDI.php
+++ /dev/null
@@ -1,33 +0,0 @@
-fpdi =& $fpdi;
- }
-
- function error($msg) {
- $this->fpdi->error($msg);
- }
-}
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/fpdi/fpdf_tpl.php b/mod/assign/feedback/editpdf/fpdi/fpdf_tpl.php
deleted file mode 100644
index 20584a5..0000000
--- a/mod/assign/feedback/editpdf/fpdi/fpdf_tpl.php
+++ /dev/null
@@ -1,460 +0,0 @@
-Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
- return;
- }
-
- if ($this->page <= 0)
- $this->error("You have to add a page to fpdf first!");
-
- if ($x == null)
- $x = 0;
- if ($y == null)
- $y = 0;
- if ($w == null)
- $w = $this->w;
- if ($h == null)
- $h = $this->h;
-
- // Save settings
- $this->tpl++;
- $tpl =& $this->tpls[$this->tpl];
- $tpl = array(
- 'o_x' => $this->x,
- 'o_y' => $this->y,
- 'o_AutoPageBreak' => $this->AutoPageBreak,
- 'o_bMargin' => $this->bMargin,
- 'o_tMargin' => $this->tMargin,
- 'o_lMargin' => $this->lMargin,
- 'o_rMargin' => $this->rMargin,
- 'o_h' => $this->h,
- 'o_w' => $this->w,
- 'o_FontFamily' => $this->FontFamily,
- 'o_FontStyle' => $this->FontStyle,
- 'o_FontSizePt' => $this->FontSizePt,
- 'o_FontSize' => $this->FontSize,
- 'buffer' => '',
- 'x' => $x,
- 'y' => $y,
- 'w' => $w,
- 'h' => $h
- );
-
- $this->SetAutoPageBreak(false);
-
- // Define own high and width to calculate possitions correct
- $this->h = $h;
- $this->w = $w;
-
- $this->_intpl = true;
- $this->SetXY($x + $this->lMargin, $y + $this->tMargin);
- $this->SetRightMargin($this->w - $w + $this->rMargin);
-
- if ($this->CurrentFont) {
- $fontkey = $this->FontFamily . $this->FontStyle;
- $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
-
- $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
- }
-
- return $this->tpl;
- }
-
- /**
- * End Template
- *
- * This method ends a template and reset initiated variables on beginTemplate.
- *
- * @return mixed If a template is opened, the ID is returned. If not a false is returned.
- */
- function endTemplate() {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
- }
-
- if ($this->_intpl) {
- $this->_intpl = false;
- $tpl =& $this->tpls[$this->tpl];
- $this->SetXY($tpl['o_x'], $tpl['o_y']);
- $this->tMargin = $tpl['o_tMargin'];
- $this->lMargin = $tpl['o_lMargin'];
- $this->rMargin = $tpl['o_rMargin'];
- $this->h = $tpl['o_h'];
- $this->w = $tpl['o_w'];
- $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
-
- $this->FontFamily = $tpl['o_FontFamily'];
- $this->FontStyle = $tpl['o_FontStyle'];
- $this->FontSizePt = $tpl['o_FontSizePt'];
- $this->FontSize = $tpl['o_FontSize'];
-
- $fontkey = $this->FontFamily . $this->FontStyle;
- if ($fontkey)
- $this->CurrentFont =& $this->fonts[$fontkey];
-
- return $this->tpl;
- } else {
- return false;
- }
- }
-
- /**
- * Use a Template in current Page or other Template
- *
- * You can use a template in a page or in another template.
- * You can give the used template a new size like you use the Image()-method.
- * All parameters are optional. The width or height is calculated automaticaly
- * if one is given. If no parameter is given the origin size as defined in
- * beginTemplate() is used.
- * The calculated or used width and height are returned as an array.
- *
- * @param int $tplidx A valid template-Id
- * @param int $_x The x-position
- * @param int $_y The y-position
- * @param int $_w The new width of the template
- * @param int $_h The new height of the template
- * @return array The height and width of the template
- */
- function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
- if ($this->page <= 0)
- $this->error('You have to add a page first!');
-
- if (!isset($this->tpls[$tplidx]))
- $this->error('Template does not exist!');
-
- if ($this->_intpl) {
- $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
- }
-
- $tpl =& $this->tpls[$tplidx];
- $w = $tpl['w'];
- $h = $tpl['h'];
-
- if ($_x == null)
- $_x = 0;
- if ($_y == null)
- $_y = 0;
-
- $_x += $tpl['x'];
- $_y += $tpl['y'];
-
- $wh = $this->getTemplateSize($tplidx, $_w, $_h);
- $_w = $wh['w'];
- $_h = $wh['h'];
-
- $tData = array(
- 'x' => $this->x,
- 'y' => $this->y,
- 'w' => $_w,
- 'h' => $_h,
- 'scaleX' => ($_w / $w),
- 'scaleY' => ($_h / $h),
- 'tx' => $_x,
- 'ty' => ($this->h - $_y - $_h),
- 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
- );
-
- $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
- $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
-
- $this->lastUsedTemplateData = $tData;
-
- return array('w' => $_w, 'h' => $_h);
- }
-
- /**
- * Get The calculated Size of a Template
- *
- * If one size is given, this method calculates the other one.
- *
- * @param int $tplidx A valid template-Id
- * @param int $_w The width of the template
- * @param int $_h The height of the template
- * @return array The height and width of the template
- */
- function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
- if (!isset($this->tpls[$tplidx]))
- return false;
-
- $tpl =& $this->tpls[$tplidx];
- $w = $tpl['w'];
- $h = $tpl['h'];
-
- if ($_w == 0 and $_h == 0) {
- $_w = $w;
- $_h = $h;
- }
-
- if($_w == 0)
- $_w = $_h * $w / $h;
- if($_h == 0)
- $_h = $_w * $h / $w;
-
- return array("w" => $_w, "h" => $_h);
- }
-
- /**
- * See FPDF/TCPDF-Documentation ;-)
- */
- public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
- }
-
- parent::SetFont($family, $style, $size);
-
- $fontkey = $this->FontFamily . $this->FontStyle;
-
- if ($this->_intpl) {
- $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
- } else {
- $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
- }
- }
-
- /**
- * See FPDF/TCPDF-Documentation ;-)
- */
- function Image(
- $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
- $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false,
- $hidden = false, $fitonpage = false, $alt = false, $altimgs = array()
- ) {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::Image'), $args);
- }
-
- $ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
- if ($this->_intpl) {
- $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
- } else {
- $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
- }
-
- return $ret;
- }
-
- /**
- * See FPDF-Documentation ;-)
- *
- * AddPage is not available when you're "in" a template.
- */
- function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
- }
-
- if ($this->_intpl)
- $this->Error('Adding pages in templates isn\'t possible!');
-
- parent::AddPage($orientation, $format);
- }
-
- /**
- * Preserve adding Links in Templates ...won't work
- */
- function Link($x, $y, $w, $h, $link, $spaces = 0) {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::Link'), $args);
- }
-
- if ($this->_intpl)
- $this->Error('Using links in templates aren\'t possible!');
-
- parent::Link($x, $y, $w, $h, $link);
- }
-
- function AddLink() {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
- }
-
- if ($this->_intpl)
- $this->Error('Adding links in templates aren\'t possible!');
- return parent::AddLink();
- }
-
- function SetLink($link, $y = 0, $page = -1) {
- if (is_subclass_of($this, 'TCPDF')) {
- $args = func_get_args();
- return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
- }
-
- if ($this->_intpl)
- $this->Error('Setting links in templates aren\'t possible!');
- parent::SetLink($link, $y, $page);
- }
-
- /**
- * Private Method that writes the form xobjects
- */
- function _putformxobjects() {
- $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
- reset($this->tpls);
- foreach($this->tpls AS $tplidx => $tpl) {
-
- $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
- $this->_newobj();
- $this->tpls[$tplidx]['n'] = $this->n;
- $this->_out('<<'.$filter.'/Type /XObject');
- $this->_out('/Subtype /Form');
- $this->_out('/FormType 1');
- $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
- // llx
- $tpl['x'] * $this->k,
- // lly
- -$tpl['y'] * $this->k,
- // urx
- ($tpl['w'] + $tpl['x']) * $this->k,
- // ury
- ($tpl['h'] - $tpl['y']) * $this->k
- ));
-
- if ($tpl['x'] != 0 || $tpl['y'] != 0) {
- $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
- -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
- ));
- }
-
- $this->_out('/Resources ');
-
- $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
- $this->_out('/Font <<');
- foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
- $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
- $this->_out('>>');
- }
- if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
- isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
- {
- $this->_out('/XObject <<');
- if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
- foreach($this->_res['tpl'][$tplidx]['images'] as $image)
- $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
- }
- if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
- foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
- $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
- }
- $this->_out('>>');
- }
- $this->_out('>>');
-
- $this->_out('/Length ' . strlen($p) . ' >>');
- $this->_putstream($p);
- $this->_out('endobj');
- }
- }
-
- /**
- * Overwritten to add _putformxobjects() after _putimages()
- *
- */
- function _putimages() {
- parent::_putimages();
- $this->_putformxobjects();
- }
-
- function _putxobjectdict() {
- parent::_putxobjectdict();
-
- if (count($this->tpls)) {
- foreach($this->tpls as $tplidx => $tpl) {
- $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
- }
- }
- }
-
- /**
- * Private Method
- */
- function _out($s) {
- if ($this->state == 2 && $this->_intpl) {
- $this->tpls[$this->tpl]['buffer'] .= $s . "\n";
- } else {
- parent::_out($s);
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/fpdi.php b/mod/assign/feedback/editpdf/fpdi/fpdi.php
deleted file mode 100644
index 8cae46c..0000000
--- a/mod/assign/feedback/editpdf/fpdi/fpdi.php
+++ /dev/null
@@ -1,588 +0,0 @@
-current_filename = $filename;
-
- if (!isset($this->parsers[$filename]))
- $this->parsers[$filename] = $this->_getPdfParser($filename);
- $this->current_parser =& $this->parsers[$filename];
-
- return $this->parsers[$filename]->getPageCount();
- }
-
- /**
- * Returns a PDF parser object
- *
- * @param string $filename
- * @return fpdi_pdf_parser
- */
- function _getPdfParser($filename) {
- return new fpdi_pdf_parser($filename, $this);
- }
-
- /**
- * Get the current PDF version
- *
- * @return string
- */
- function getPDFVersion() {
- return $this->PDFVersion;
- }
-
- /**
- * Set the PDF version
- *
- * @return string
- */
- function setPDFVersion($version = '1.3') {
- $this->PDFVersion = $version;
- }
-
- /**
- * Import a page
- *
- * @param int $pageno pagenumber
- * @return int Index of imported page - to use with fpdf_tpl::useTemplate()
- */
- function importPage($pageno, $boxName = '/CropBox') {
- if ($this->_intpl) {
- return $this->error('Please import the desired pages before creating a new template.');
- }
-
- $fn = $this->current_filename;
-
- // check if page already imported
- $pageKey = $fn . '-' . ((int)$pageno) . $boxName;
- if (isset($this->_importedPages[$pageKey]))
- return $this->_importedPages[$pageKey];
-
- $parser =& $this->parsers[$fn];
- $parser->setPageno($pageno);
-
- if (!in_array($boxName, $parser->availableBoxes))
- return $this->Error(sprintf('Unknown box: %s', $boxName));
-
- $pageboxes = $parser->getPageBoxes($pageno, $this->k);
-
- /**
- * MediaBox
- * CropBox: Default -> MediaBox
- * BleedBox: Default -> CropBox
- * TrimBox: Default -> CropBox
- * ArtBox: Default -> CropBox
- */
- if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox'))
- $boxName = '/CropBox';
- if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox')
- $boxName = '/MediaBox';
-
- if (!isset($pageboxes[$boxName]))
- return false;
-
- $this->lastUsedPageBox = $boxName;
-
- $box = $pageboxes[$boxName];
-
- $this->tpl++;
- $this->tpls[$this->tpl] = array();
- $tpl =& $this->tpls[$this->tpl];
- $tpl['parser'] =& $parser;
- $tpl['resources'] = $parser->getPageResources();
- $tpl['buffer'] = $parser->getContent();
- $tpl['box'] = $box;
-
- // To build an array that can be used by PDF_TPL::useTemplate()
- $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl], $box);
-
- // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects()
- $tpl['x'] = 0;
- $tpl['y'] = 0;
-
- // handle rotated pages
- $rotation = $parser->getPageRotation($pageno);
- $tpl['_rotationAngle'] = 0;
- if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) {
- $steps = $angle / 90;
-
- $_w = $tpl['w'];
- $_h = $tpl['h'];
- $tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
- $tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
-
- if ($angle < 0)
- $angle += 360;
-
- $tpl['_rotationAngle'] = $angle * -1;
- }
-
- $this->_importedPages[$pageKey] = $this->tpl;
-
- return $this->tpl;
- }
-
- /**
- * Returns the last used page box
- *
- * @return string
- */
- function getLastUsedPageBox() {
- return $this->lastUsedPageBox;
- }
-
-
- function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) {
- if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
- $size = $this->getTemplateSize($tplidx, $_w, $_h);
- $orientation = $size['w'] > $size['h'] ? 'L' : 'P';
- $size = array($size['w'], $size['h']);
-
- if (is_subclass_of($this, 'TCPDF')) {
- $this->setPageFormat($size, $orientation);
- } else {
- $size = $this->_getpagesize($size);
-
- if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1])
- {
- // New size or orientation
- if($orientation=='P')
- {
- $this->w = $size[0];
- $this->h = $size[1];
- }
- else
- {
- $this->w = $size[1];
- $this->h = $size[0];
- }
- $this->wPt = $this->w*$this->k;
- $this->hPt = $this->h*$this->k;
- $this->PageBreakTrigger = $this->h-$this->bMargin;
- $this->CurOrientation = $orientation;
- $this->CurPageSize = $size;
- $this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
- }
- }
- }
-
- $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
- $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
- $this->_out('Q');
-
- return $s;
- }
-
- /**
- * Private method, that rebuilds all needed objects of source files
- */
- function _putimportedobjects() {
- if (is_array($this->parsers) && count($this->parsers) > 0) {
- foreach($this->parsers AS $filename => $p) {
- $this->current_parser =& $this->parsers[$filename];
- if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) {
- while(($n = key($this->_obj_stack[$filename])) !== null) {
- $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c, $this->_obj_stack[$filename][$n][1]);
-
- $this->_newobj($this->_obj_stack[$filename][$n][0]);
-
- if ($nObj[0] == PDF_TYPE_STREAM) {
- $this->pdf_write_value($nObj);
- } else {
- $this->pdf_write_value($nObj[1]);
- }
-
- $this->_out('endobj');
- $this->_obj_stack[$filename][$n] = null; // free memory
- unset($this->_obj_stack[$filename][$n]);
- reset($this->_obj_stack[$filename]);
- }
- }
- }
- }
- }
-
-
- /**
- * Private Method that writes the form xobjects
- */
- function _putformxobjects() {
- $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
- reset($this->tpls);
- foreach($this->tpls AS $tplidx => $tpl) {
- $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
- $this->_newobj();
- $cN = $this->n; // TCPDF/Protection: rem current "n"
-
- $this->tpls[$tplidx]['n'] = $this->n;
- $this->_out('<<' . $filter . '/Type /XObject');
- $this->_out('/Subtype /Form');
- $this->_out('/FormType 1');
-
- $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
- (isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k,
- (isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k,
- (isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k,
- (isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k
- ));
-
- $c = 1;
- $s = 0;
- $tx = 0;
- $ty = 0;
-
- if (isset($tpl['box'])) {
- $tx = -$tpl['box']['llx'];
- $ty = -$tpl['box']['lly'];
-
- if ($tpl['_rotationAngle'] <> 0) {
- $angle = $tpl['_rotationAngle'] * M_PI/180;
- $c=cos($angle);
- $s=sin($angle);
-
- switch($tpl['_rotationAngle']) {
- case -90:
- $tx = -$tpl['box']['lly'];
- $ty = $tpl['box']['urx'];
- break;
- case -180:
- $tx = $tpl['box']['urx'];
- $ty = $tpl['box']['ury'];
- break;
- case -270:
- $tx = $tpl['box']['ury'];
- $ty = -$tpl['box']['llx'];
- break;
- }
- }
- } elseif ($tpl['x'] != 0 || $tpl['y'] != 0) {
- $tx = -$tpl['x'] * 2;
- $ty = $tpl['y'] * 2;
- }
-
- $tx *= $this->k;
- $ty *= $this->k;
-
- if ($c != 1 || $s != 0 || $tx != 0 || $ty != 0) {
- $this->_out(sprintf('/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]',
- $c, $s, -$s, $c, $tx, $ty
- ));
- }
-
- $this->_out('/Resources ');
-
- if (isset($tpl['resources'])) {
- $this->current_parser =& $tpl['parser'];
- $this->pdf_write_value($tpl['resources']); // "n" will be changed
- } else {
- $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
- $this->_out('/Font <<');
- foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
- $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
- $this->_out('>>');
- }
- if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
- isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
- {
- $this->_out('/XObject <<');
- if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
- foreach($this->_res['tpl'][$tplidx]['images'] as $image)
- $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
- }
- if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
- foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
- $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
- }
- $this->_out('>>');
- }
- $this->_out('>>');
- }
-
- $this->_out('/Group <>');
-
- $nN = $this->n; // TCPDF: rem new "n"
- $this->n = $cN; // TCPDF: reset to current "n"
- if (is_subclass_of($this, 'TCPDF')) {
- $p = $this->_getrawstream($p);
- $this->_out('/Length ' . strlen($p) . ' >>');
- $this->_out("stream\n" . $p . "\nendstream");
- } else {
- $this->_out('/Length ' . strlen($p) . ' >>');
- $this->_putstream($p);
- }
- $this->_out('endobj');
- $this->n = $nN; // TCPDF: reset to new "n"
- }
-
- $this->_putimportedobjects();
- }
-
- /**
- * Rewritten to handle existing own defined objects
- */
- function _newobj($obj_id = false, $onlynewobj = false) {
- if (!$obj_id) {
- $obj_id = ++$this->n;
- }
-
- //Begin a new object
- if (!$onlynewobj) {
- $this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer);
- $this->_out($obj_id . ' 0 obj');
- $this->_current_obj_id = $obj_id; // for later use with encryption
- }
-
- return $obj_id;
- }
-
- /**
- * Writes a value
- * Needed to rebuild the source document
- *
- * @param mixed $value A PDF-Value. Structure of values see cases in this method
- */
- function pdf_write_value(&$value)
- {
- if (is_subclass_of($this, 'TCPDF')) {
- parent::pdf_write_value($value);
- }
-
- switch ($value[0]) {
-
- case PDF_TYPE_TOKEN:
- $this->_straightOut($value[1] . ' ');
- break;
- case PDF_TYPE_NUMERIC:
- case PDF_TYPE_REAL:
- if (is_float($value[1]) && $value[1] != 0) {
- $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' ');
- } else {
- $this->_straightOut($value[1] . ' ');
- }
- break;
-
- case PDF_TYPE_ARRAY:
-
- // An array. Output the proper
- // structure and move on.
-
- $this->_straightOut('[');
- for ($i = 0; $i < count($value[1]); $i++) {
- $this->pdf_write_value($value[1][$i]);
- }
-
- $this->_out(']');
- break;
-
- case PDF_TYPE_DICTIONARY:
-
- // A dictionary.
- $this->_straightOut('<<');
-
- reset ($value[1]);
-
- while (list($k, $v) = each($value[1])) {
- $this->_straightOut($k . ' ');
- $this->pdf_write_value($v);
- }
-
- $this->_straightOut('>>');
- break;
-
- case PDF_TYPE_OBJREF:
-
- // An indirect object reference
- // Fill the object stack if needed
- $cpfn =& $this->current_parser->filename;
-
- if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
- $this->_newobj(false, true);
- $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
- $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!!
- }
- $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
-
- $this->_out($objid . ' 0 R');
- break;
-
- case PDF_TYPE_STRING:
-
- // A string.
- $this->_straightOut('(' . $value[1] . ')');
-
- break;
-
- case PDF_TYPE_STREAM:
-
- // A stream. First, output the
- // stream dictionary, then the
- // stream data itself.
- $this->pdf_write_value($value[1]);
- $this->_out('stream');
- $this->_out($value[2][1]);
- $this->_out('endstream');
- break;
-
- case PDF_TYPE_HEX:
- $this->_straightOut('<' . $value[1] . '>');
- break;
-
- case PDF_TYPE_BOOLEAN:
- $this->_straightOut($value[1] ? 'true ' : 'false ');
- break;
-
- case PDF_TYPE_NULL:
- // The null object.
-
- $this->_straightOut('null ');
- break;
- }
- }
-
-
- /**
- * Modified so not each call will add a newline to the output.
- */
- function _straightOut($s) {
- if (!is_subclass_of($this, 'TCPDF')) {
- if($this->state==2)
- $this->pages[$this->page] .= $s;
- else
- $this->buffer .= $s;
- } else {
- if ($this->state == 2) {
- if ($this->inxobj) {
- // we are inside an XObject template
- $this->xobjects[$this->xobjid]['outdata'] .= $s;
- } elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
- // puts data before page footer
- $pagebuff = $this->getPageBuffer($this->page);
- $page = substr($pagebuff, 0, -$this->footerlen[$this->page]);
- $footer = substr($pagebuff, -$this->footerlen[$this->page]);
- $this->setPageBuffer($this->page, $page.$s.$footer);
- // update footer position
- $this->footerpos[$this->page] += strlen($s);
- } else {
- // set page data
- $this->setPageBuffer($this->page, $s, true);
- }
- } elseif ($this->state > 0) {
- // set general data
- $this->setBuffer($s);
- }
- }
- }
-
- /**
- * rewritten to close opened parsers
- *
- */
- function _enddoc() {
- parent::_enddoc();
- $this->_closeParsers();
- }
-
- /**
- * close all files opened by parsers
- */
- function _closeParsers() {
- if ($this->state > 2 && count($this->parsers) > 0) {
- $this->cleanUp();
- return true;
- }
- return false;
- }
-
- /**
- * Removes cylced references and closes the file handles of the parser objects
- */
- function cleanUp() {
- foreach ($this->parsers as $k => $_){
- $this->parsers[$k]->cleanUp();
- $this->parsers[$k] = null;
- unset($this->parsers[$k]);
- }
- }
-}
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/fpdi/fpdi2tcpdf_bridge.php b/mod/assign/feedback/editpdf/fpdi/fpdi2tcpdf_bridge.php
deleted file mode 100644
index b4a6c70..0000000
--- a/mod/assign/feedback/editpdf/fpdi/fpdi2tcpdf_bridge.php
+++ /dev/null
@@ -1,171 +0,0 @@
-libdir.'/pdflib.php');
-
-/**
- * This class is used as a bridge between TCPDF and FPDI
- * and will create the possibility to use both FPDF and TCPDF
- * via one FPDI version.
- *
- * We'll simply remap TCPDF to FPDF again.
- *
- * It'll be loaded and extended by FPDF_TPL.
- * Modified to extend the moodle TCPDF wrapper instead.
- */
-class FPDF extends pdf {
-
- function _putstream($s, $n=0) {
- $this->_out($this->_getstream($s));
- }
-
- function _getxobjectdict() {
- $out = parent::_getxobjectdict();
- if (count($this->tpls)) {
- foreach($this->tpls as $tplidx => $tpl) {
- $out .= sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']);
- }
- }
-
- return $out;
- }
-
- /**
- * Encryption of imported data by FPDI
- *
- * @param array $value
- */
- function pdf_write_value(&$value) {
- switch ($value[0]) {
- case PDF_TYPE_STRING:
- if ($this->encrypted) {
- $value[1] = $this->_unescape($value[1]);
- $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
- $value[1] = TCPDF_STATIC::_escape($value[1]);
- }
- break;
-
- case PDF_TYPE_STREAM:
- if ($this->encrypted) {
- $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
- $value[1][1]['/Length'] = array(
- PDF_TYPE_NUMERIC,
- strlen($value[2][1])
- );
- }
- break;
-
- case PDF_TYPE_HEX:
- if ($this->encrypted) {
- $value[1] = $this->hex2str($value[1]);
- $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
-
- // remake hexstring of encrypted string
- $value[1] = $this->str2hex($value[1]);
- }
- break;
- }
- }
-
- /**
- * Unescapes a PDF string
- *
- * @param string $s
- * @return string
- */
- function _unescape($s) {
- $out = '';
- for ($count = 0, $n = strlen($s); $count < $n; $count++) {
- if ($s[$count] != '\\' || $count == $n-1) {
- $out .= $s[$count];
- } else {
- switch ($s[++$count]) {
- case ')':
- case '(':
- case '\\':
- $out .= $s[$count];
- break;
- case 'f':
- $out .= chr(0x0C);
- break;
- case 'b':
- $out .= chr(0x08);
- break;
- case 't':
- $out .= chr(0x09);
- break;
- case 'r':
- $out .= chr(0x0D);
- break;
- case 'n':
- $out .= chr(0x0A);
- break;
- case "\r":
- if ($count != $n-1 && $s[$count+1] == "\n")
- $count++;
- break;
- case "\n":
- break;
- default:
- // Octal-Values
- if (ord($s[$count]) >= ord('0') &&
- ord($s[$count]) <= ord('9')) {
- $oct = ''. $s[$count];
-
- if (ord($s[$count+1]) >= ord('0') &&
- ord($s[$count+1]) <= ord('9')) {
- $oct .= $s[++$count];
-
- if (ord($s[$count+1]) >= ord('0') &&
- ord($s[$count+1]) <= ord('9')) {
- $oct .= $s[++$count];
- }
- }
-
- $out .= chr(octdec($oct));
- } else {
- $out .= $s[$count];
- }
- }
- }
- }
- return $out;
- }
-
- /**
- * Hexadecimal to string
- *
- * @param string $hex
- * @return string
- */
- function hex2str($hex) {
- return pack('H*', str_replace(array("\r", "\n", ' '), '', $hex));
- }
-
- /**
- * String to hexadecimal
- *
- * @param string $str
- * @return string
- */
- function str2hex($str) {
- return current(unpack('H*', $str));
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/fpdi_pdf_parser.php b/mod/assign/feedback/editpdf/fpdi/fpdi_pdf_parser.php
deleted file mode 100644
index 41a0e03..0000000
--- a/mod/assign/feedback/editpdf/fpdi/fpdi_pdf_parser.php
+++ /dev/null
@@ -1,423 +0,0 @@
-fpdi =& $fpdi;
-
- parent::pdf_parser($filename);
-
- // resolve Pages-Dictonary
- $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
-
- // Read pages
- $this->read_pages($this->c, $pages, $this->pages);
-
- // count pages;
- $this->page_count = count($this->pages);
- }
-
- /**
- * Removes reference to fpdi object and closes the file handle
- */
- function cleanUp() {
- $this->fpdi = null;
- $this->closeFile();
- }
-
- /**
- * Overwrite parent::error()
- *
- * @param string $msg Error-Message
- */
- function error($msg) {
- $this->fpdi->error($msg);
- }
-
- /**
- * Get pagecount from sourcefile
- *
- * @return int
- */
- function getPageCount() {
- return $this->page_count;
- }
-
-
- /**
- * Set pageno
- *
- * @param int $pageno Pagenumber to use
- */
- function setPageno($pageno) {
- $pageno = ((int) $pageno) - 1;
-
- if ($pageno < 0 || $pageno >= $this->getPageCount()) {
- $this->fpdi->error('Pagenumber is wrong!');
- }
-
- $this->pageno = $pageno;
- }
-
- /**
- * Get page-resources from current page
- *
- * @return array
- */
- function getPageResources() {
- return $this->_getPageResources($this->pages[$this->pageno]);
- }
-
- /**
- * Get page-resources from /Page
- *
- * @param array $obj Array of pdf-data
- */
- function _getPageResources ($obj) { // $obj = /Page
- $obj = $this->pdf_resolve_object($this->c, $obj);
-
- // If the current object has a resources
- // dictionary associated with it, we use
- // it. Otherwise, we move back to its
- // parent object.
- if (isset ($obj[1][1]['/Resources'])) {
- $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
- if ($res[0] == PDF_TYPE_OBJECT)
- return $res[1];
- return $res;
- } else {
- if (!isset ($obj[1][1]['/Parent'])) {
- return false;
- } else {
- $res = $this->_getPageResources($obj[1][1]['/Parent']);
- if ($res[0] == PDF_TYPE_OBJECT)
- return $res[1];
- return $res;
- }
- }
- }
-
-
- /**
- * Get content of current page
- *
- * If more /Contents is an array, the streams are concated
- *
- * @return string
- */
- function getContent() {
- $buffer = '';
-
- if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
- $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
- foreach($contents AS $tmp_content) {
- $buffer .= $this->_rebuildContentStream($tmp_content) . ' ';
- }
- }
-
- return $buffer;
- }
-
-
- /**
- * Resolve all content-objects
- *
- * @param array $content_ref
- * @return array
- */
- function _getPageContent($content_ref) {
- $contents = array();
-
- if ($content_ref[0] == PDF_TYPE_OBJREF) {
- $content = $this->pdf_resolve_object($this->c, $content_ref);
- if ($content[1][0] == PDF_TYPE_ARRAY) {
- $contents = $this->_getPageContent($content[1]);
- } else {
- $contents[] = $content;
- }
- } elseif ($content_ref[0] == PDF_TYPE_ARRAY) {
- foreach ($content_ref[1] AS $tmp_content_ref) {
- $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
- }
- }
-
- return $contents;
- }
-
-
- /**
- * Rebuild content-streams
- *
- * @param array $obj
- * @return string
- */
- function _rebuildContentStream($obj) {
- $filters = array();
-
- if (isset($obj[1][1]['/Filter'])) {
- $_filter = $obj[1][1]['/Filter'];
-
- if ($_filter[0] == PDF_TYPE_OBJREF) {
- $tmpFilter = $this->pdf_resolve_object($this->c, $_filter);
- $_filter = $tmpFilter[1];
- }
-
- if ($_filter[0] == PDF_TYPE_TOKEN) {
- $filters[] = $_filter;
- } elseif ($_filter[0] == PDF_TYPE_ARRAY) {
- $filters = $_filter[1];
- }
- }
-
- $stream = $obj[2][1];
-
- foreach ($filters AS $_filter) {
- switch ($_filter[1]) {
- case '/FlateDecode':
- case '/Fl':
- // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work
- // $stream .= "\x0A";
- // $stream .= "\x0D";
- if (function_exists('gzuncompress')) {
- $oStream = $stream;
- $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
- } else {
- $this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1]));
- }
-
- if ($stream === false) {
- $oStream = substr($oStream, 2);
- $stream = @gzinflate($oStream);
- if ($stream == false) {
- $this->error('Error while decompressing stream.');
- }
- }
- break;
- case '/LZWDecode':
- include_once('filters/FilterLZW_FPDI.php');
- $decoder = new FilterLZW_FPDI($this->fpdi);
- $stream = $decoder->decode($stream);
- break;
- case '/ASCII85Decode':
- include_once('filters/FilterASCII85_FPDI.php');
- $decoder = new FilterASCII85_FPDI($this->fpdi);
- $stream = $decoder->decode($stream);
- break;
- case null:
- $stream = $stream;
- break;
- default:
- $this->error(sprintf('Unsupported Filter: %s',$_filter[1]));
- }
- }
-
- return $stream;
- }
-
-
- /**
- * Get a Box from a page
- * Arrayformat is same as used by fpdf_tpl
- *
- * @param array $page a /Page
- * @param string $box_index Type of Box @see $availableBoxes
- * @param float Scale factor from user space units to points
- * @return array
- */
- function getPageBox($page, $box_index, $k) {
- $page = $this->pdf_resolve_object($this->c, $page);
- $box = null;
- if (isset($page[1][1][$box_index]))
- $box =& $page[1][1][$box_index];
-
- if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
- $tmp_box = $this->pdf_resolve_object($this->c, $box);
- $box = $tmp_box[1];
- }
-
- if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
- $b =& $box[1];
- return array('x' => $b[0][1] / $k,
- 'y' => $b[1][1] / $k,
- 'w' => abs($b[0][1] - $b[2][1]) / $k,
- 'h' => abs($b[1][1] - $b[3][1]) / $k,
- 'llx' => min($b[0][1], $b[2][1]) / $k,
- 'lly' => min($b[1][1], $b[3][1]) / $k,
- 'urx' => max($b[0][1], $b[2][1]) / $k,
- 'ury' => max($b[1][1], $b[3][1]) / $k,
- );
- } elseif (!isset ($page[1][1]['/Parent'])) {
- return false;
- } else {
- return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k);
- }
- }
-
- /**
- * Get all page boxes by page no
- *
- * @param int The page number
- * @param float Scale factor from user space units to points
- * @return array
- */
- function getPageBoxes($pageno, $k) {
- return $this->_getPageBoxes($this->pages[$pageno - 1], $k);
- }
-
- /**
- * Get all boxes from /Page
- *
- * @param array a /Page
- * @return array
- */
- function _getPageBoxes($page, $k) {
- $boxes = array();
-
- foreach($this->availableBoxes AS $box) {
- if ($_box = $this->getPageBox($page, $box, $k)) {
- $boxes[$box] = $_box;
- }
- }
-
- return $boxes;
- }
-
- /**
- * Get the page rotation by pageno
- *
- * @param integer $pageno
- * @return array
- */
- function getPageRotation($pageno) {
- return $this->_getPageRotation($this->pages[$pageno - 1]);
- }
-
- function _getPageRotation($obj) { // $obj = /Page
- $obj = $this->pdf_resolve_object($this->c, $obj);
- if (isset ($obj[1][1]['/Rotate'])) {
- $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
- if ($res[0] == PDF_TYPE_OBJECT)
- return $res[1];
- return $res;
- } else {
- if (!isset ($obj[1][1]['/Parent'])) {
- return false;
- } else {
- $res = $this->_getPageRotation($obj[1][1]['/Parent']);
- if ($res[0] == PDF_TYPE_OBJECT)
- return $res[1];
- return $res;
- }
- }
- }
-
- /**
- * Read all /Page(es)
- *
- * @param object pdf_context
- * @param array /Pages
- * @param array the result-array
- */
- function read_pages(&$c, &$pages, &$result) {
- // Get the kids dictionary
- $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
-
- if (!is_array($_kids))
- $this->error('Cannot find /Kids in current /Page-Dictionary');
-
- if ($_kids[1][0] == PDF_TYPE_ARRAY) {
- $kids = $_kids[1][1];
- } else {
- $kids = $_kids[1];
- }
-
- foreach ($kids as $v) {
- $pg = $this->pdf_resolve_object ($c, $v);
- if ($pg[1][1]['/Type'][1] === '/Pages') {
- // If one of the kids is an embedded
- // /Pages array, resolve it as well.
- if ($pg !== $pages) {
- $this->read_pages($c, $pg, $result);
- }
- } else {
- $result[] = $pg;
- }
- }
- }
-
-
-
- /**
- * Get PDF-Version
- *
- * And reset the PDF Version used in FPDI if needed
- */
- function getPDFVersion() {
- parent::getPDFVersion();
- $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion));
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/pdf_context.php b/mod/assign/feedback/editpdf/fpdi/pdf_context.php
deleted file mode 100644
index f404039..0000000
--- a/mod/assign/feedback/editpdf/fpdi/pdf_context.php
+++ /dev/null
@@ -1,104 +0,0 @@
-file =& $f;
- if (is_string($this->file))
- $this->_mode = 1;
- $this->reset();
- }
-
- // Optionally move the file
- // pointer to a new location
- // and reset the buffered data
-
- function reset($pos = null, $l = 100) {
- if ($this->_mode == 0) {
- if (!is_null ($pos)) {
- fseek ($this->file, $pos);
- }
-
- $this->buffer = $l > 0 ? fread($this->file, $l) : '';
- $this->length = strlen($this->buffer);
- if ($this->length < $l)
- $this->increase_length($l - $this->length);
- } else {
- $this->buffer = $this->file;
- $this->length = strlen($this->buffer);
- }
- $this->offset = 0;
- $this->stack = array();
- }
-
- // Make sure that there is at least one
- // character beyond the current offset in
- // the buffer to prevent the tokenizer
- // from attempting to access data that does
- // not exist
-
- function ensure_content() {
- if ($this->offset >= $this->length - 1) {
- return $this->increase_length();
- } else {
- return true;
- }
- }
-
- // Forcefully read more data into the buffer
-
- function increase_length($l = 100) {
- if ($this->_mode == 0 && feof($this->file)) {
- return false;
- } elseif ($this->_mode == 0) {
- $totalLength = $this->length + $l;
- do {
- $toRead = $totalLength - $this->length;
- if ($toRead < 1)
- break;
-
- $this->buffer .= fread($this->file, $toRead);
- } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
-
- return true;
- } else {
- return false;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/fpdi/pdf_parser.php b/mod/assign/feedback/editpdf/fpdi/pdf_parser.php
deleted file mode 100644
index b1e7b8d..0000000
--- a/mod/assign/feedback/editpdf/fpdi/pdf_parser.php
+++ /dev/null
@@ -1,719 +0,0 @@
-filename = $filename;
-
- $this->f = @fopen($this->filename, 'rb');
-
- if (!$this->f)
- $this->error(sprintf('Cannot open %s !', $filename));
-
- $this->getPDFVersion();
-
- $this->c = new pdf_context($this->f);
-
- // Read xref-Data
- $this->xref = array();
- $this->pdf_read_xref($this->xref, $this->pdf_find_xref());
-
- // Check for Encryption
- $this->getEncryption();
-
- // Read root
- $this->pdf_read_root();
- }
-
- /**
- * Close the opened file
- */
- function closeFile() {
- if (isset($this->f) && is_resource($this->f)) {
- fclose($this->f);
- unset($this->f);
- }
- }
-
- /**
- * Print Error and die
- *
- * @param string $msg Error-Message
- */
- function error($msg) {
- die('PDF-Parser Error: ' . $msg);
- }
-
- /**
- * Check Trailer for Encryption
- */
- function getEncryption() {
- if (isset($this->xref['trailer'][1]['/Encrypt'])) {
- $this->error('File is encrypted!');
- }
- }
-
- /**
- * Find/Return /Root
- *
- * @return array
- */
- function pdf_find_root() {
- if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) {
- $this->error('Wrong Type of Root-Element! Must be an indirect reference');
- }
-
- return $this->xref['trailer'][1]['/Root'];
- }
-
- /**
- * Read the /Root
- */
- function pdf_read_root() {
- // read root
- $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root());
- }
-
- /**
- * Get PDF-Version
- *
- * And reset the PDF Version used in FPDI if needed
- */
- function getPDFVersion() {
- fseek($this->f, 0);
- preg_match('/\d\.\d/',fread($this->f, 16), $m);
- if (isset($m[0]))
- $this->pdfVersion = $m[0];
- return $this->pdfVersion;
- }
-
- /**
- * Find the xref-Table
- */
- function pdf_find_xref() {
- $toRead = 1500;
-
- $stat = fseek ($this->f, -$toRead, SEEK_END);
- if ($stat === -1) {
- fseek ($this->f, 0);
- }
- $data = fread($this->f, $toRead);
-
- $pos = strlen($data) - strpos(strrev($data), strrev('startxref'));
- $data = substr($data, $pos);
-
- if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) {
- $this->error('Unable to find pointer to xref table');
- }
-
- return (int) $matches[1];
- }
-
- /**
- * Read xref-table
- *
- * @param array $result Array of xref-table
- * @param integer $offset of xref-table
- */
- function pdf_read_xref(&$result, $offset) {
- $o_pos = $offset-min(20, $offset);
- fseek($this->f, $o_pos); // set some bytes backwards to fetch errorious docs
-
- $data = fread($this->f, 100);
-
- $xrefPos = strrpos($data, 'xref');
-
- if ($xrefPos === false) {
- fseek($this->f, $offset);
- $c = new pdf_context($this->f);
- $xrefStreamObjDec = $this->pdf_read_value($c);
-
- if (is_array($xrefStreamObjDec) && isset($xrefStreamObjDec[0]) && $xrefStreamObjDec[0] == PDF_TYPE_OBJDEC) {
- $this->error(sprintf('This document (%s) probably uses a compression technique which is not supported by the free parser shipped with FPDI.', $this->filename));
- } else {
- $this->error('Unable to find xref table.');
- }
- }
-
- if (!isset($result['xref_location'])) {
- $result['xref_location'] = $o_pos + $xrefPos;
- $result['max_object'] = 0;
- }
-
- $cylces = -1;
- $bytesPerCycle = 100;
-
- fseek($this->f, $o_pos = $o_pos + $xrefPos + 4); // set the handle directly after the "xref"-keyword
- $data = fread($this->f, $bytesPerCycle);
-
- while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle * $cylces++, 0))) === false && !feof($this->f)) {
- $data .= fread($this->f, $bytesPerCycle);
- }
-
- if ($trailerPos === false) {
- $this->error('Trailer keyword not found after xref table');
- }
-
- $data = substr($data, 0, $trailerPos);
-
- // get Line-Ending
- preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks
-
- $differentLineEndings = count(array_unique($m[0]));
- if ($differentLineEndings > 1) {
- $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY);
- } else {
- $lines = explode($m[0][1], $data);
- }
-
- $data = $differentLineEndings = $m = null;
- unset($data, $differentLineEndings, $m);
-
- $linesCount = count($lines);
-
- $start = 1;
-
- for ($i = 0; $i < $linesCount; $i++) {
- $line = trim($lines[$i]);
- if ($line) {
- $pieces = explode(' ', $line);
- $c = count($pieces);
- switch($c) {
- case 2:
- $start = (int)$pieces[0];
- $end = $start + (int)$pieces[1];
- if ($end > $result['max_object'])
- $result['max_object'] = $end;
- break;
- case 3:
- if (!isset($result['xref'][$start]))
- $result['xref'][$start] = array();
-
- if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) {
- $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null;
- }
- $start++;
- break;
- default:
- $this->error('Unexpected data in xref table');
- }
- }
- }
-
- $lines = $pieces = $line = $start = $end = $gen = null;
- unset($lines, $pieces, $line, $start, $end, $gen);
-
- fseek($this->f, $o_pos + $trailerPos + 7);
-
- $c = new pdf_context($this->f);
- $trailer = $this->pdf_read_value($c);
-
- $c = null;
- unset($c);
-
- if (!isset($result['trailer'])) {
- $result['trailer'] = $trailer;
- }
-
- if (isset($trailer[1]['/Prev'])) {
- $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]);
- }
-
- $trailer = null;
- unset($trailer);
-
- return true;
- }
-
- /**
- * Reads an Value
- *
- * @param object $c pdf_context
- * @param string $token a Token
- * @return mixed
- */
- function pdf_read_value(&$c, $token = null) {
- if (is_null($token)) {
- $token = $this->pdf_read_token($c);
- }
-
- if ($token === false) {
- return false;
- }
-
- switch ($token) {
- case '<':
- // This is a hex string.
- // Read the value, then the terminator
-
- $pos = $c->offset;
-
- while(1) {
-
- $match = strpos ($c->buffer, '>', $pos);
-
- // If you can't find it, try
- // reading more data from the stream
-
- if ($match === false) {
- if (!$c->increase_length()) {
- return false;
- } else {
- continue;
- }
- }
-
- $result = substr ($c->buffer, $c->offset, $match - $c->offset);
- $c->offset = $match + 1;
-
- return array (PDF_TYPE_HEX, $result);
- }
-
- break;
- case '<<':
- // This is a dictionary.
-
- $result = array();
-
- // Recurse into this function until we reach
- // the end of the dictionary.
- while (($key = $this->pdf_read_token($c)) !== '>>') {
- if ($key === false) {
- return false;
- }
-
- if (($value = $this->pdf_read_value($c)) === false) {
- return false;
- }
-
- // Catch missing value
- if ($value[0] == PDF_TYPE_TOKEN && $value[1] == '>>') {
- $result[$key] = array(PDF_TYPE_NULL);
- break;
- }
-
- $result[$key] = $value;
- }
-
- return array (PDF_TYPE_DICTIONARY, $result);
-
- case '[':
- // This is an array.
-
- $result = array();
-
- // Recurse into this function until we reach
- // the end of the array.
- while (($token = $this->pdf_read_token($c)) !== ']') {
- if ($token === false) {
- return false;
- }
-
- if (($value = $this->pdf_read_value($c, $token)) === false) {
- return false;
- }
-
- $result[] = $value;
- }
-
- return array (PDF_TYPE_ARRAY, $result);
-
- case '(' :
- // This is a string
- $pos = $c->offset;
-
- $openBrackets = 1;
- do {
- for (; $openBrackets != 0 && $pos < $c->length; $pos++) {
- switch (ord($c->buffer[$pos])) {
- case 0x28: // '('
- $openBrackets++;
- break;
- case 0x29: // ')'
- $openBrackets--;
- break;
- case 0x5C: // backslash
- $pos++;
- }
- }
- } while($openBrackets != 0 && $c->increase_length());
-
- $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1);
- $c->offset = $pos;
-
- return array (PDF_TYPE_STRING, $result);
-
- case 'stream':
- $o_pos = ftell($c->file)-strlen($c->buffer);
- $o_offset = $c->offset;
-
- $c->reset($startpos = $o_pos + $o_offset);
-
- $e = 0; // ensure line breaks in front of the stream
- if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13))
- $e++;
- if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10))
- $e++;
-
- if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) {
- $tmp_c = new pdf_context($this->f);
- $tmp_length = $this->pdf_resolve_object($tmp_c, $this->actual_obj[1][1]['/Length']);
- $length = $tmp_length[1][1];
- } else {
- $length = $this->actual_obj[1][1]['/Length'][1];
- }
-
- if ($length > 0) {
- $c->reset($startpos + $e,$length);
- $v = $c->buffer;
- } else {
- $v = '';
- }
- $c->reset($startpos + $e + $length + 9); // 9 = strlen("endstream")
-
- return array(PDF_TYPE_STREAM, $v);
-
- default :
- if (is_numeric ($token)) {
- // A numeric token. Make sure that
- // it is not part of something else.
- if (($tok2 = $this->pdf_read_token ($c)) !== false) {
- if (is_numeric ($tok2)) {
-
- // Two numeric tokens in a row.
- // In this case, we're probably in
- // front of either an object reference
- // or an object specification.
- // Determine the case and return the data
- if (($tok3 = $this->pdf_read_token ($c)) !== false) {
- switch ($tok3) {
- case 'obj':
- return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2);
- case 'R':
- return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2);
- }
- // If we get to this point, that numeric value up
- // there was just a numeric value. Push the extra
- // tokens back into the stack and return the value.
- array_push ($c->stack, $tok3);
- }
- }
-
- array_push ($c->stack, $tok2);
- }
-
- if ($token === (string)((int)$token))
- return array (PDF_TYPE_NUMERIC, (int)$token);
- else
- return array (PDF_TYPE_REAL, (float)$token);
- } elseif ($token == 'true' || $token == 'false') {
- return array (PDF_TYPE_BOOLEAN, $token == 'true');
- } elseif ($token == 'null') {
- return array (PDF_TYPE_NULL);
- } else {
- // Just a token. Return it.
- return array (PDF_TYPE_TOKEN, $token);
- }
- }
- }
-
- /**
- * Resolve an object
- *
- * @param object $c pdf_context
- * @param array $obj_spec The object-data
- * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para
- */
- function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) {
- // Exit if we get invalid data
- if (!is_array($obj_spec)) {
- $ret = false;
- return $ret;
- }
-
- if ($obj_spec[0] == PDF_TYPE_OBJREF) {
-
- // This is a reference, resolve it
- if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) {
-
- // Save current file position
- // This is needed if you want to resolve
- // references while you're reading another object
- // (e.g.: if you need to determine the length
- // of a stream)
-
- $old_pos = ftell($c->file);
-
- // Reposition the file pointer and
- // load the object header.
-
- $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]);
-
- $header = $this->pdf_read_value($c);
-
- if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) {
- $toSearchFor = $obj_spec[1] . ' ' . $obj_spec[2] . ' obj';
- if (preg_match('/' . $toSearchFor . '/', $c->buffer)) {
- $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor);
- // reset stack
- $c->stack = array();
- } else {
- $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location");
- }
- }
-
- // If we're being asked to store all the information
- // about the object, we add the object ID and generation
- // number for later use
- $result = array();
- $this->actual_obj =& $result;
- if ($encapsulate) {
- $result = array (
- PDF_TYPE_OBJECT,
- 'obj' => $obj_spec[1],
- 'gen' => $obj_spec[2]
- );
- }
-
- // Now simply read the object data until
- // we encounter an end-of-object marker
- while(1) {
- $value = $this->pdf_read_value($c);
- if ($value === false || count($result) > 4) {
- // in this case the parser coudn't find an endobj so we break here
- break;
- }
-
- if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') {
- break;
- }
-
- $result[] = $value;
- }
-
- $c->reset($old_pos);
-
- if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) {
- $result[0] = PDF_TYPE_STREAM;
- }
-
- return $result;
- }
- } else {
- return $obj_spec;
- }
- }
-
-
-
- /**
- * Reads a token from the file
- *
- * @param object $c pdf_context
- * @return mixed
- */
- function pdf_read_token(&$c)
- {
- // If there is a token available
- // on the stack, pop it out and
- // return it.
-
- if (count($c->stack)) {
- return array_pop($c->stack);
- }
-
- // Strip away any whitespace
-
- do {
- if (!$c->ensure_content()) {
- return false;
- }
- $c->offset += strspn($c->buffer, "\x20\x0A\x0C\x0D\x09\x00", $c->offset);
- } while ($c->offset >= $c->length - 1);
-
- // Get the first character in the stream
-
- $char = $c->buffer[$c->offset++];
-
- switch ($char) {
-
- case '[':
- case ']':
- case '(':
- case ')':
-
- // This is either an array or literal string
- // delimiter, Return it
-
- return $char;
-
- case '<':
- case '>':
-
- // This could either be a hex string or
- // dictionary delimiter. Determine the
- // appropriate case and return the token
-
- if ($c->buffer[$c->offset] == $char) {
- if (!$c->ensure_content()) {
- return false;
- }
- $c->offset++;
- return $char . $char;
- } else {
- return $char;
- }
-
- case '%':
-
- // This is a comment - jump over it!
-
- $pos = $c->offset;
- while(1) {
- $match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos);
- if ($match === 0) {
- if (!$c->increase_length()) {
- return false;
- } else {
- continue;
- }
- }
-
- $c->offset = $m[0][1]+strlen($m[0][0]);
-
- return $this->pdf_read_token($c);
- }
-
- default:
-
- // This is "another" type of token (probably
- // a dictionary entry or a numeric value)
- // Find the end and return it.
-
- if (!$c->ensure_content()) {
- return false;
- }
-
- while(1) {
-
- // Determine the length of the token
-
- $pos = strcspn($c->buffer, "\x20%[]<>()/\x0A\x0C\x0D\x09\x00", $c->offset);
-
- if ($c->offset + $pos <= $c->length - 1) {
- break;
- } else {
- // If the script reaches this point,
- // the token may span beyond the end
- // of the current buffer. Therefore,
- // we increase the size of the buffer
- // and try again--just to be safe.
-
- $c->increase_length();
- }
- }
-
- $result = substr($c->buffer, $c->offset - 1, $pos + 1);
-
- $c->offset += $pos;
- return $result;
- }
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/fpdi/readme_moodle.txt b/mod/assign/feedback/editpdf/fpdi/readme_moodle.txt
deleted file mode 100644
index 93a9dee..0000000
--- a/mod/assign/feedback/editpdf/fpdi/readme_moodle.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-FPDI
-==================================
-
-No changes from the upstream version have been made. Both FPDI and FPDF_TPL have
-been downloaded and unzipped to this directory.
-
-Information
------------
-
-URL: http://www.setasign.de/products/pdf-php-solutions/fpdi/
-Download from: http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads
-Documentation: http://www.setasign.de/products/pdf-php-solutions/fpdi/manuals/
-License: Apache Software License 2.0
-
-Downloaded versions:
-FPDI: 1.4.4
-FPDF_TPL: 1.2.3
diff --git a/mod/assign/feedback/editpdf/lib.php b/mod/assign/feedback/editpdf/lib.php
deleted file mode 100644
index 80f98e5..0000000
--- a/mod/assign/feedback/editpdf/lib.php
+++ /dev/null
@@ -1,78 +0,0 @@
-.
-
-/**
- * This file contains the version information for the comments feedback plugin
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Serves assignment feedback and other files.
- *
- * @param mixed $course course or id of the course
- * @param mixed $cm course module or id of the course module
- * @param context $context
- * @param string $filearea
- * @param array $args
- * @param bool $forcedownload
- * @return bool false if file not found, does not return if found - just send the file
- */
-function assignfeedback_editpdf_pluginfile($course,
- $cm,
- context $context,
- $filearea,
- $args,
- $forcedownload) {
- global $USER, $DB, $CFG;
-
- if ($context->contextlevel == CONTEXT_MODULE) {
-
- require_login($course, false, $cm);
- $itemid = (int)array_shift($args);
-
- if (!$assign = $DB->get_record('assign', array('id'=>$cm->instance))) {
- return false;
- }
-
- $record = $DB->get_record('assign_grades', array('id'=>$itemid), 'userid,assignment', MUST_EXIST);
- $userid = $record->userid;
- if ($assign->id != $record->assignment) {
- return false;
- }
-
- // Check is users feedback or has grading permission.
- if ($USER->id != $userid and !has_capability('mod/assign:grade', $context)) {
- return false;
- }
-
- $relativepath = implode('/', $args);
-
- $fullpath = "/{$context->id}/assignfeedback_editpdf/$filearea/$itemid/$relativepath";
-
- $fs = get_file_storage();
- if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
- return false;
- }
- // Download MUST be forced - security!
- send_stored_file($file, 0, 0, true);// Check if we want to retrieve the stamps.
- }
-
-}
diff --git a/mod/assign/feedback/editpdf/locallib.php b/mod/assign/feedback/editpdf/locallib.php
deleted file mode 100644
index 0bde754..0000000
--- a/mod/assign/feedback/editpdf/locallib.php
+++ /dev/null
@@ -1,297 +0,0 @@
-.
-
-/**
- * This file contains the definition for the library class for PDF feedback plugin
- *
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-use \assignfeedback_editpdf\document_services;
-use \assignfeedback_editpdf\page_editor;
-
-/**
- * library class for editpdf feedback plugin extending feedback plugin base class
- *
- * @package assignfeedback_editpdf
- * @copyright 2012 Davo Smith
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class assign_feedback_editpdf extends assign_feedback_plugin {
-
- /** @var boolean|null $enabledcache Cached lookup of the is_enabled function */
- private $enabledcache = null;
-
- /**
- * Get the name of the file feedback plugin
- * @return string
- */
- public function get_name() {
- return get_string('pluginname', 'assignfeedback_editpdf');
- }
-
- /**
- * Create a widget for rendering the editor.
- *
- * @param int $userid
- * @param stdClass $grade
- * @param bool $readonly
- * @return assignfeedback_editpdf_widget
- */
- public function get_widget($userid, $grade, $readonly) {
- $attempt = -1;
- if ($grade && $grade->attemptnumber) {
- $attempt = $grade->attemptnumber;
- } else {
- $grade = $this->assignment->get_user_grade($userid, true);
- }
-
- $feedbackfile = document_services::get_feedback_document($this->assignment->get_instance()->id,
- $userid,
- $attempt);
-
- $stampfiles = array();
- $fs = get_file_storage();
- $syscontext = context_system::instance();
-
- // Copy any new stamps to this instance.
- if ($files = $fs->get_area_files($syscontext->id,
- 'assignfeedback_editpdf',
- 'stamps',
- 0,
- "filename",
- false)) {
- foreach ($files as $file) {
- $filename = $file->get_filename();
- if ($filename !== '.') {
-
- $existingfile = $fs->get_file($this->assignment->get_context()->id,
- 'assignfeedback_editpdf',
- 'stamps',
- $grade->id,
- '/',
- $file->get_filename());
- if (!$existingfile) {
- $newrecord = new stdClass();
- $newrecord->contextid = $this->assignment->get_context()->id;
- $newrecord->itemid = $grade->id;
- $fs->create_file_from_storedfile($newrecord, $file);
- }
- }
- }
- }
-
- // Now get the full list of stamp files for this instance.
- if ($files = $fs->get_area_files($this->assignment->get_context()->id,
- 'assignfeedback_editpdf',
- 'stamps',
- $grade->id,
- "filename",
- false)) {
- foreach ($files as $file) {
- $filename = $file->get_filename();
- if ($filename !== '.') {
- $url = moodle_url::make_pluginfile_url($this->assignment->get_context()->id,
- 'assignfeedback_editpdf',
- 'stamps',
- $grade->id,
- '/',
- $file->get_filename(),
- false);
- array_push($stampfiles, $url->out());
- }
- }
- }
-
- $url = false;
- $filename = '';
- if ($feedbackfile) {
- $url = moodle_url::make_pluginfile_url($this->assignment->get_context()->id,
- 'assignfeedback_editpdf',
- document_services::FINAL_PDF_FILEAREA,
- $grade->id,
- '/',
- $feedbackfile->get_filename(),
- false);
- $filename = $feedbackfile->get_filename();
- }
-
- // Retrieve total number of pages.
- $pagetotal = document_services::page_number_for_attempt($this->assignment->get_instance()->id,
- $userid,
- $attempt,
- $readonly);
-
- $widget = new assignfeedback_editpdf_widget($this->assignment->get_instance()->id,
- $userid,
- $attempt,
- $url,
- $filename,
- $stampfiles,
- $readonly,
- $pagetotal);
- return $widget;
- }
-
- /**
- * Get form elements for grading form
- *
- * @param stdClass $grade
- * @param MoodleQuickForm $mform
- * @param stdClass $data
- * @param int $userid
- * @return bool true if elements were added to the form
- */
- public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
- global $PAGE;
-
- $attempt = -1;
- if ($grade) {
- $attempt = $grade->attemptnumber;
- }
-
- $files = document_services::list_compatible_submission_files_for_attempt($this->assignment, $userid, $attempt);
- // Only show the editor if there was a compatible file submitted.
- if (count($files)) {
-
- $renderer = $PAGE->get_renderer('assignfeedback_editpdf');
-
- $widget = $this->get_widget($userid, $grade, false);
-
- $html = $renderer->render($widget);
- $mform->addElement('static', 'editpdf', get_string('editpdf', 'assignfeedback_editpdf'), $html);
- $mform->addHelpButton('editpdf', 'editpdf', 'assignfeedback_editpdf');
- $mform->addElement('hidden', 'editpdf_source_userid', $userid);
- $mform->setType('editpdf_source_userid', PARAM_INT);
- $mform->setConstant('editpdf_source_userid', $userid);
- }
- }
-
- /**
- * Generate the pdf.
- *
- * @param stdClass $grade
- * @param stdClass $data
- * @return bool
- */
- public function save(stdClass $grade, stdClass $data) {
- // Source user id is only added to the form if there was a pdf.
- if (!empty($data->editpdf_source_userid)) {
- $sourceuserid = $data->editpdf_source_userid;
- // Copy drafts annotations and comments if current user is different to sourceuserid.
- if ($sourceuserid != $grade->userid) {
- page_editor::copy_drafts_from_to($this->assignment, $grade, $sourceuserid);
- }
- }
- if (page_editor::has_annotations_or_comments($grade->id, true)) {
- document_services::generate_feedback_document($this->assignment, $grade->userid, $grade->attemptnumber);
- }
-
- return true;
- }
-
- /**
- * Display the list of files in the feedback status table.
- *
- * @param stdClass $grade
- * @param bool $showviewlink (Always set to false).
- * @return string
- */
- public function view_summary(stdClass $grade, & $showviewlink) {
- $showviewlink = false;
- return $this->view($grade);
- }
-
- /**
- * Display the list of files in the feedback status table.
- *
- * @param stdClass $grade
- * @return string
- */
- public function view(stdClass $grade) {
- global $PAGE;
- $html = '';
- // Show a link to download the pdf.
- if (page_editor::has_annotations_or_comments($grade->id, false)) {
- $html = $this->assignment->render_area_files('assignfeedback_editpdf',
- document_services::FINAL_PDF_FILEAREA,
- $grade->id);
-
- // Also show the link to the read-only interface.
- $renderer = $PAGE->get_renderer('assignfeedback_editpdf');
- $widget = $this->get_widget($grade->userid, $grade, true);
-
- $html .= $renderer->render($widget);
- }
- return $html;
- }
-
- /**
- * Return true if there are no released comments/annotations.
- *
- * @param stdClass $grade
- */
- public function is_empty(stdClass $grade) {
- global $DB;
-
- $comments = $DB->count_records('assignfeedback_editpdf_cmnt', array('gradeid'=>$grade->id, 'draft'=>0));
- $annotations = $DB->count_records('assignfeedback_editpdf_annot', array('gradeid'=>$grade->id, 'draft'=>0));
- return $comments == 0 && $annotations == 0;
- }
-
- /**
- * The assignment has been deleted - remove the plugin specific data
- *
- * @return bool
- */
- public function delete_instance() {
- global $DB;
- $grades = $DB->get_records('assign_grades', array('assignment'=>$this->assignment->get_instance()->id), '', 'id');
- if ($grades) {
- list($gradeids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED);
- $DB->delete_records_select('assignfeedback_editpdf_annot', 'gradeid ' . $gradeids, $params);
- $DB->delete_records_select('assignfeedback_editpdf_cmnt', 'gradeid ' . $gradeids, $params);
- }
- return true;
- }
-
- /**
- * Automatically enable or disable editpdf feedback plugin based on
- * whether the ghostscript path is set correctly.
- *
- * @return bool
- */
- public function is_enabled() {
- if ($this->enabledcache === null) {
- $testpath = assignfeedback_editpdf\pdf::test_gs_path(false);
- $this->enabledcache = ($testpath->status == assignfeedback_editpdf\pdf::GSPATH_OK);
- }
- return $this->enabledcache;
- }
- /**
- * Automatically hide the setting for the editpdf feedback plugin.
- *
- * @return bool false
- */
- public function is_configurable() {
- return false;
- }
-}
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_blue.png b/mod/assign/feedback/editpdf/pix/background_colour_blue.png
deleted file mode 100644
index c233e18..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_blue.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_blue.svg b/mod/assign/feedback/editpdf/pix/background_colour_blue.svg
deleted file mode 100644
index 032b557..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_blue.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_clear.png b/mod/assign/feedback/editpdf/pix/background_colour_clear.png
deleted file mode 100644
index 139d1c1..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_clear.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_clear.svg b/mod/assign/feedback/editpdf/pix/background_colour_clear.svg
deleted file mode 100644
index 5c32932..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_clear.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_green.png b/mod/assign/feedback/editpdf/pix/background_colour_green.png
deleted file mode 100644
index e47b064..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_green.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_green.svg b/mod/assign/feedback/editpdf/pix/background_colour_green.svg
deleted file mode 100644
index 04e73d7..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_green.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_red.png b/mod/assign/feedback/editpdf/pix/background_colour_red.png
deleted file mode 100644
index bc6fdf8..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_red.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_red.svg b/mod/assign/feedback/editpdf/pix/background_colour_red.svg
deleted file mode 100644
index 23f146c..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_red.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_white.png b/mod/assign/feedback/editpdf/pix/background_colour_white.png
deleted file mode 100644
index 0060462..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_white.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_white.svg b/mod/assign/feedback/editpdf/pix/background_colour_white.svg
deleted file mode 100644
index 43a77c2..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_white.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-]>
-
-
-
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_yellow.png b/mod/assign/feedback/editpdf/pix/background_colour_yellow.png
deleted file mode 100644
index 6fd29ed..0000000
Binary files a/mod/assign/feedback/editpdf/pix/background_colour_yellow.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/background_colour_yellow.svg b/mod/assign/feedback/editpdf/pix/background_colour_yellow.svg
deleted file mode 100644
index 9fbecc0..0000000
--- a/mod/assign/feedback/editpdf/pix/background_colour_yellow.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/colour_black.png b/mod/assign/feedback/editpdf/pix/colour_black.png
deleted file mode 100644
index 156d9ca..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_black.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_black.svg b/mod/assign/feedback/editpdf/pix/colour_black.svg
deleted file mode 100644
index a83eb2a..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_black.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/colour_blue.png b/mod/assign/feedback/editpdf/pix/colour_blue.png
deleted file mode 100644
index 64e9957..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_blue.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_blue.svg b/mod/assign/feedback/editpdf/pix/colour_blue.svg
deleted file mode 100644
index 72e341d..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_blue.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/colour_green.png b/mod/assign/feedback/editpdf/pix/colour_green.png
deleted file mode 100644
index 350829d..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_green.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_green.svg b/mod/assign/feedback/editpdf/pix/colour_green.svg
deleted file mode 100644
index 0ff9f53..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_green.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/colour_red.png b/mod/assign/feedback/editpdf/pix/colour_red.png
deleted file mode 100644
index f6aa1a4..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_red.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_red.svg b/mod/assign/feedback/editpdf/pix/colour_red.svg
deleted file mode 100644
index d2576aa..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_red.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/colour_white.png b/mod/assign/feedback/editpdf/pix/colour_white.png
deleted file mode 100644
index 03cd4d1..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_white.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_white.svg b/mod/assign/feedback/editpdf/pix/colour_white.svg
deleted file mode 100644
index 2bdf8f6..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_white.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-]>
-
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/colour_yellow.png b/mod/assign/feedback/editpdf/pix/colour_yellow.png
deleted file mode 100644
index 9a1c349..0000000
Binary files a/mod/assign/feedback/editpdf/pix/colour_yellow.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/colour_yellow.svg b/mod/assign/feedback/editpdf/pix/colour_yellow.svg
deleted file mode 100644
index a1486a8..0000000
--- a/mod/assign/feedback/editpdf/pix/colour_yellow.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-image/svg+xml
-
-
-
-
\ No newline at end of file
diff --git a/mod/assign/feedback/editpdf/pix/comment.png b/mod/assign/feedback/editpdf/pix/comment.png
deleted file mode 100644
index 4836397..0000000
Binary files a/mod/assign/feedback/editpdf/pix/comment.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/comment.svg b/mod/assign/feedback/editpdf/pix/comment.svg
deleted file mode 100644
index ce84664..0000000
--- a/mod/assign/feedback/editpdf/pix/comment.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/comment_search.png b/mod/assign/feedback/editpdf/pix/comment_search.png
deleted file mode 100644
index d50342a..0000000
Binary files a/mod/assign/feedback/editpdf/pix/comment_search.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/comment_search.svg b/mod/assign/feedback/editpdf/pix/comment_search.svg
deleted file mode 100644
index 5cde175..0000000
--- a/mod/assign/feedback/editpdf/pix/comment_search.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/cross.png b/mod/assign/feedback/editpdf/pix/cross.png
deleted file mode 100644
index daf333d..0000000
Binary files a/mod/assign/feedback/editpdf/pix/cross.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/highlight.png b/mod/assign/feedback/editpdf/pix/highlight.png
deleted file mode 100644
index 447957d..0000000
Binary files a/mod/assign/feedback/editpdf/pix/highlight.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/highlight.svg b/mod/assign/feedback/editpdf/pix/highlight.svg
deleted file mode 100644
index 1f18f9e..0000000
--- a/mod/assign/feedback/editpdf/pix/highlight.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/line.png b/mod/assign/feedback/editpdf/pix/line.png
deleted file mode 100644
index e8c6ec5..0000000
Binary files a/mod/assign/feedback/editpdf/pix/line.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/line.svg b/mod/assign/feedback/editpdf/pix/line.svg
deleted file mode 100644
index b162dea..0000000
--- a/mod/assign/feedback/editpdf/pix/line.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/nav_next.png b/mod/assign/feedback/editpdf/pix/nav_next.png
deleted file mode 100644
index 52058995..0000000
Binary files a/mod/assign/feedback/editpdf/pix/nav_next.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/nav_next.svg b/mod/assign/feedback/editpdf/pix/nav_next.svg
deleted file mode 100644
index 7bceca8..0000000
--- a/mod/assign/feedback/editpdf/pix/nav_next.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/nav_prev.png b/mod/assign/feedback/editpdf/pix/nav_prev.png
deleted file mode 100644
index 039e8a9..0000000
Binary files a/mod/assign/feedback/editpdf/pix/nav_prev.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/nav_prev.svg b/mod/assign/feedback/editpdf/pix/nav_prev.svg
deleted file mode 100644
index d1a828b..0000000
--- a/mod/assign/feedback/editpdf/pix/nav_prev.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/oval.png b/mod/assign/feedback/editpdf/pix/oval.png
deleted file mode 100644
index 4e87cb1..0000000
Binary files a/mod/assign/feedback/editpdf/pix/oval.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/oval.svg b/mod/assign/feedback/editpdf/pix/oval.svg
deleted file mode 100644
index f6059c1..0000000
--- a/mod/assign/feedback/editpdf/pix/oval.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/pen.png b/mod/assign/feedback/editpdf/pix/pen.png
deleted file mode 100644
index 85b3d6b..0000000
Binary files a/mod/assign/feedback/editpdf/pix/pen.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/pen.svg b/mod/assign/feedback/editpdf/pix/pen.svg
deleted file mode 100644
index 77c11fc..0000000
--- a/mod/assign/feedback/editpdf/pix/pen.svg
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/rectangle.png b/mod/assign/feedback/editpdf/pix/rectangle.png
deleted file mode 100644
index d7e79c8..0000000
Binary files a/mod/assign/feedback/editpdf/pix/rectangle.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/rectangle.svg b/mod/assign/feedback/editpdf/pix/rectangle.svg
deleted file mode 100644
index 0befc1c..0000000
--- a/mod/assign/feedback/editpdf/pix/rectangle.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/sad.png b/mod/assign/feedback/editpdf/pix/sad.png
deleted file mode 100644
index e87bf42..0000000
Binary files a/mod/assign/feedback/editpdf/pix/sad.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/select.png b/mod/assign/feedback/editpdf/pix/select.png
deleted file mode 100644
index e8d8e6a..0000000
Binary files a/mod/assign/feedback/editpdf/pix/select.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/select.svg b/mod/assign/feedback/editpdf/pix/select.svg
deleted file mode 100644
index 7c8e459..0000000
--- a/mod/assign/feedback/editpdf/pix/select.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/smile.png b/mod/assign/feedback/editpdf/pix/smile.png
deleted file mode 100644
index ec6d945..0000000
Binary files a/mod/assign/feedback/editpdf/pix/smile.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/stamp.png b/mod/assign/feedback/editpdf/pix/stamp.png
deleted file mode 100644
index 371642b..0000000
Binary files a/mod/assign/feedback/editpdf/pix/stamp.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/stamp.svg b/mod/assign/feedback/editpdf/pix/stamp.svg
deleted file mode 100644
index 4a0a8e4..0000000
--- a/mod/assign/feedback/editpdf/pix/stamp.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/pix/tick.png b/mod/assign/feedback/editpdf/pix/tick.png
deleted file mode 100644
index a74ec2d..0000000
Binary files a/mod/assign/feedback/editpdf/pix/tick.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/trash.png b/mod/assign/feedback/editpdf/pix/trash.png
deleted file mode 100644
index fc6aa0c..0000000
Binary files a/mod/assign/feedback/editpdf/pix/trash.png and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/pix/trash.svg b/mod/assign/feedback/editpdf/pix/trash.svg
deleted file mode 100644
index a772952..0000000
--- a/mod/assign/feedback/editpdf/pix/trash.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-]>
-
-
-
-
-
diff --git a/mod/assign/feedback/editpdf/styles.css b/mod/assign/feedback/editpdf/styles.css
deleted file mode 100644
index d596434..0000000
--- a/mod/assign/feedback/editpdf/styles.css
+++ /dev/null
@@ -1,282 +0,0 @@
-.assignfeedback_editpdf_widget .toolbar ul {
- display: none;
-}
-
-.assignfeedback_editpdf_widget .toolbar li {
- list-style-type: none;
-}
-.assignfeedback_editpdf_widget .drawingcanvas {
- position: relative;
- min-width: 817px;
- min-height: 1169px;
- cursor: crosshair;
-}
-
-.assignfeedback_editpdf_widget {
- user-select: none;
- -moz-user-select: none;
- -webkit-user-select: none;
- -o-user-select: none;
-}
-
-.assignfeedback_editpdf_widget .pageheader {
- background-color: #ebebeb;
- border-bottom: 1px solid #cccccc;
- padding: 0px;
- padding-left: 20px;
- padding-right: 20px;
- min-height: 50px;
-}
-
-.moodle-dialogue-base .moodle-dialogue.assignfeedback_editpdf_widget .moodle-dialogue-bd {
- padding: 0px;
-}
-
-.assignfeedback_editpdf_unsavedchanges.haschanges{
- display: block;
-}
-.assignfeedback_editpdf_unsavedchanges {
- display: none;
- margin-top: 1em;
-}
-.yui3-colourpicker-hidden,
-.yui3-commentsearch-hidden,
-.yui3-commentmenu-hidden {
- display: none;
-}
-.assignfeedback_editpdf_widget .pageheader button img {
- padding-top: 3px;
- vertical-align: top;
-}
-.assignfeedback_editpdf_widget .pageheader button:active {
- background-color: #ccc;
-}
-.assignfeedback_editpdf_widget .pageheader select,
-.assignfeedback_editpdf_widget .pageheader button {
- background: none;
- padding: 4px 7px;
- border: 0px;
- border-radius: 0px;
- margin: 0px;
- height: 30px;
- line-height: 30px;
- vertical-align: top;
- cursor: pointer;
-}
-.assignfeedback_editpdf_widget .pageheader select {
- vertical-align: top;
- -webkit-appearance: none;
- -moz-appearance: menulist-text;
- background-color: #fff;
- padding: 0px 10px;
-}
-.assignfeedback_editpdf_widget .pageheader select::-ms-expand {
- display: none;
-}
-
-.assignfeedback_editpdf_widget .pageheader .navigation button + button,
-.assignfeedback_editpdf_widget .pageheader .toolbar button + button,
-.assignfeedback_editpdf_widget .pageheader .navigation select + button,
-.assignfeedback_editpdf_widget .pageheader .toolbar select + button {
- border-left: 1px solid #cccccc;
- border-right: 0px;
-}
-
-.assignfeedback_editpdf_widget .pageheader .navigation button {
- border-right: 1px solid #cccccc;
-}
-.assignfeedback_editpdf_widget .pageheader .toolbar,
-.assignfeedback_editpdf_widget .pageheader .navigation-search,
-.assignfeedback_editpdf_widget .pageheader .navigation {
- border: 1px solid #cccccc;
- border-bottom-color: #b3b3b3;
- border-radius: 4px;
- margin: 10px 4px;
- background-color: white;
- height: 30px;
- line-height: 30px;
- padding: 0px;
-}
-
-.assignfeedback_editpdf_commentsearch ul {
- max-height: 400px;
- overflow-y: auto;
- padding: 1em;
-}
-.assignfeedback_editpdf_commentsearch ul li pre {
- background-color: #efefef;
-}
-.assignfeedback_editpdf_commentsearch ul li pre:hover {
- background-color: #ddd;
-}
-.assignfeedback_editpdf_commentsearch ul li {
- line-height: 0px;
- margin: 2px;
-}
-.assignfeedback_editpdf_commentsearch a pre {
- font-family: helvetica;
- margin: 0px;
- padding: 4px;
-}
-
-.assignfeedback_editpdf_widget .navigation-search,
-.assignfeedback_editpdf_widget .navigation {
- float: left;
-}
-
-.dir-rtl .assignfeedback_editpdf_widget .navigation-search,
-.dir-rtl .assignfeedback_editpdf_widget .navigation {
- float: right;
-}
-.assignfeedback_editpdf_widget .toolbar button {
- box-shadow: none;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
-}
-.assignfeedback_editpdf_widget .toolbar {
- float: right;
-}
-.dir-rtl .assignfeedback_editpdf_widget .toolbar {
- float: left;
-}
-.assignfeedback_editpdf_widget .navigation,
-.assignfeedback_editpdf_widget .navigation-search,
-.assignfeedback_editpdf_widget .toolbar {
- display: inline-block;
-}
-
-.assignfeedback_editpdf_colourpicker ul {
- margin: 0px;
-}
-
-.assignfeedback_editpdf_commentmenu li.quicklist_comment {
- width: 150px;
-}
-.assignfeedback_editpdf_commentmenu li.quicklist_comment a {
- white-space: nowrap;
- display: inline-block;
- max-width: 130px;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.assignfeedback_editpdf_commentmenu a.delete_quicklist_comment {
- float: right;
-}
-.dir-rtl .assignfeedback_editpdf_commentmenu a.delete_quicklist_comment {
- float: left;
-}
-.assignfeedback_editpdf_dropdown button {
- border: 0px;
- background: none;
- padding: 6px 7px;
- border-radius: 0px;
- border-top: 1px solid #cccccc;
-}
-.assignfeedback_editpdf_dropdown li:first-child button {
- border-top: 0px;
-}
-.moodle-dialogue-base .moodle-dialogue.assignfeedback_editpdf_dropdown .moodle-dialogue-wrap {
- box-shadow: none;
- -moz-box-shadow: none;
- -webkit-box-shadow: none;
- margin-left: 0px;
- margin-right: 0px;
- margin-top: 0px;
- border-radius: 4px;
-}
-.moodle-dialogue-base .moodle-dialogue.assignfeedback_editpdf_dropdown .moodle-dialogue-bd {
- padding: 0px;
-}
-.assignfeedback_editpdf_dropdown .moodle-dialogue-hd,
-.assignfeedback_editpdf_dropdown .moodle-dialogue-ft {
- display: none;
-}
-.assignfeedback_editpdf_menu li hr {
- margin: 0px;
-}
-.assignfeedback_editpdf_menu li a {
- text-decoration: none;
- color: #555;
- margin: 10px;
-}
-.assignfeedback_editpdf_menu li:hover,
-.assignfeedback_editpdf_menu li:hover a,
-.assignfeedback_editpdf_menu li a:hover {
- background-color: #ebebeb;
- background-image: radial-gradient(ellipse at center, #ffffff 60%,#dfdfdf 100%);
-}
-ul.assignfeedback_editpdf_menu {
- margin: 0px;
-}
-.assignfeedback_editpdf_menu li {
- list-style-type: none;
- margin: 0px;
- border-radius: 4px;
-}
-.assignfeedback_editpdf_menu li img {
- height: auto;
-}
-.assignfeedback_editpdf_menu li button {
- margin: 0px;
- background: none;
-}
-
-.assignfeedback_editpdf_widget .pageheader button:hover {
- background-color: #ebebeb;
- background-image: radial-gradient(ellipse at center, #ffffff 60%,#dfdfdf 100%);
-}
-
-.assignfeedback_editpdf_widget .pageheader button.assignfeedback_editpdf_selectedbutton:hover,
-.assignfeedback_editpdf_widget .pageheader button.assignfeedback_editpdf_selectedbutton {
- background-color: #dfdfdf;
- background-image: radial-gradient(ellipse at center, #ffffff 40%,#dfdfdf 100%);
-}
-
-.assignfeedback_editpdf_widget .commentdrawable img {
- padding: 1px;
-}
-
-.assignfeedback_editpdf_widget .commentdrawable a {
- float: right;
- position: relative;
- left: -17px;
- top: 2px;
- height: 14px;
- background-color: white;
- border-left: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- line-height: 14px;
-}
-
-.dir-rtl .assignfeedback_editpdf_widget .commentdrawable a {
- float: left;
- left: none;
- right: -17px;
- border-left: 0px;
- border-right: 1px solid #ccc;
-}
-
-.assignfeedback_editpdf_widget .commentdrawable textarea {
- padding: 4px;
- padding-right: 20px;
- resize: none;
- overflow: hidden;
- color: black;
- border: 2px solid #ccc;
- border-radius: 4px;
- font-size: 16px;
- font-family: helvetica;
- min-height: 1.2em;
-}
-
-.assignfeedback_editpdf_widget .commentdrawable {
- display: inline-block;
-}
-
-.dir-rtl .assignfeedback_editpdf_widget .commentdrawable textarea {
- padding-left: 20px;
- padding-right: 4px;
-}
-.assignfeedback_editpdf_widget .drawingcanvas .loading .progressbarlabel {
- text-align: center;
-}
diff --git a/mod/assign/feedback/editpdf/tests/behat/behat_assignfeedback_editpdf.php b/mod/assign/feedback/editpdf/tests/behat/behat_assignfeedback_editpdf.php
deleted file mode 100644
index 41fab07..0000000
--- a/mod/assign/feedback/editpdf/tests/behat/behat_assignfeedback_editpdf.php
+++ /dev/null
@@ -1,54 +0,0 @@
-.
-
-/**
- * Behat editpdf-related steps definitions.
- *
- * @package assignfeedback_editpdf
- * @category test
- * @copyright 2013 Jerome Mouneyrac
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
-
-require_once(__DIR__ . '/../../../../../../lib/behat/behat_base.php');
-
-use Behat\Behat\Context\Step\Given as Given;
-
-/**
- * Steps definitions related with the editpdf.
- *
- * @package assignfeedback_editpdf
- * @category test
- * @copyright 2013 Jerome Mouneyrac
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class behat_assignfeedback_editpdf extends behat_base {
-
- /**
- * Checks that Ghostscript is installed.
- *
- * @Given /^ghostscript is installed$/
- */
- public function ghostscript_is_installed() {
- $testpath = assignfeedback_editpdf\pdf::test_gs_path();
- if (!extension_loaded('zlib') or
- $testpath->status !== assignfeedback_editpdf\pdf::GSPATH_OK) {
- throw new \Moodle\BehatExtension\Exception\SkippedException;
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/tests/fixtures/submission.pdf b/mod/assign/feedback/editpdf/tests/fixtures/submission.pdf
deleted file mode 100644
index 576d378..0000000
Binary files a/mod/assign/feedback/editpdf/tests/fixtures/submission.pdf and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf b/mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf
deleted file mode 100644
index f96796a..0000000
Binary files a/mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf and /dev/null differ
diff --git a/mod/assign/feedback/editpdf/thirdpartylibs.xml b/mod/assign/feedback/editpdf/thirdpartylibs.xml
deleted file mode 100644
index fafb71c..0000000
--- a/mod/assign/feedback/editpdf/thirdpartylibs.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- fpdi
- FPDI
- Apache
- 1.4.4
- 2.0
-
-
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/build.json b/mod/assign/feedback/editpdf/yui/src/editor/build.json
deleted file mode 100644
index d61260b..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/build.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "moodle-assignfeedback_editpdf-editor",
- "builds": {
- "moodle-assignfeedback_editpdf-editor": {
- "jsfiles": [
- "globals.js",
- "point.js",
- "rect.js",
- "edit.js",
- "drawable.js",
- "annotation.js",
- "annotationline.js",
- "annotationrectangle.js",
- "annotationoval.js",
- "annotationpen.js",
- "annotationhighlight.js",
- "annotationstamp.js",
- "dropdown.js",
- "colourpicker.js",
- "stamppicker.js",
- "commentmenu.js",
- "commentsearch.js",
- "comment.js",
- "quickcomment.js",
- "quickcommentlist.js",
- "editor.js"
- ]
- }
- }
-}
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotation.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotation.js
deleted file mode 100644
index ed05e28..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotation.js
+++ /dev/null
@@ -1,339 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a highlight.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotation
- * @constructor
- */
-ANNOTATION = function(config) {
- ANNOTATION.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATION.NAME = "annotation";
-ANNOTATION.ATTRS = {};
-
-Y.extend(ANNOTATION, Y.Base, {
- /**
- * Reference to M.assignfeedback_editpdf.editor.
- * @property editor
- * @type M.assignfeedback_editpdf.editor
- * @public
- */
- editor : null,
-
- /**
- * Grade id
- * @property gradeid
- * @type Int
- * @public
- */
- gradeid : 0,
-
- /**
- * Comment page number
- * @property pageno
- * @type Int
- * @public
- */
- pageno : 0,
-
- /**
- * X position
- * @property x
- * @type Int
- * @public
- */
- x : 0,
-
- /**
- * Y position
- * @property y
- * @type Int
- * @public
- */
- y : 0,
-
- /**
- * Ending x position
- * @property endx
- * @type Int
- * @public
- */
- endx : 0,
-
- /**
- * Ending y position
- * @property endy
- * @type Int
- * @public
- */
- endy : 0,
-
- /**
- * Path
- * @property path
- * @type String - list of points like x1,y1:x2,y2
- * @public
- */
- path : '',
-
- /**
- * Tool.
- * @property type
- * @type String
- * @public
- */
- type : 'rect',
-
- /**
- * Annotation colour.
- * @property colour
- * @type String
- * @public
- */
- colour : 'red',
-
- /**
- * Reference to M.assignfeedback_editpdf.drawable
- * @property drawable
- * @type M.assignfeedback_editpdf.drawable
- * @public
- */
- drawable : false,
-
- /**
- * Initialise the annotation.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- this.editor = config.editor || null;
- this.gradeid = parseInt(config.gradeid, 10) || 0;
- this.pageno = parseInt(config.pageno, 10) || 0;
- this.x = parseInt(config.x, 10) || 0;
- this.y = parseInt(config.y, 10) || 0;
- this.endx = parseInt(config.endx, 10) || 0;
- this.endy = parseInt(config.endy, 10) || 0;
- this.path = config.path || '';
- this.type = config.type || 'rect';
- this.colour = config.colour || 'red';
- this.drawable = false;
- },
-
- /**
- * Clean a comment record, returning an oject with only fields that are valid.
- * @public
- * @method clean
- * @return {}
- */
- clean : function() {
- return {
- gradeid : this.gradeid,
- x : parseInt(this.x, 10),
- y : parseInt(this.y, 10),
- endx : parseInt(this.endx, 10),
- endy : parseInt(this.endy, 10),
- type : this.type,
- path : this.path,
- pageno : this.pageno,
- colour : this.colour
- };
- },
-
- /**
- * Draw a selection around this annotation if it is selected.
- * @public
- * @method draw_highlight
- * @return M.assignfeedback_editpdf.drawable
- */
- draw_highlight : function() {
- var bounds,
- drawingregion = Y.one(SELECTOR.DRAWINGREGION),
- offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
- shape;
-
- if (this.editor.currentannotation === this) {
- // Draw a highlight around the annotation.
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y),
- new M.assignfeedback_editpdf.point(this.endx, this.endy)]);
-
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: bounds.height,
- stroke: {
- weight: STROKEWEIGHT,
- color: SELECTEDBORDERCOLOUR
- },
- fill: {
- color: SELECTEDFILLCOLOUR
- },
- x: bounds.x,
- y: bounds.y
- });
- this.drawable.shapes.push(shape);
-
- // Add a delete X to the annotation.
- var deleteicon = Y.Node.create(' '),
- deletelink = Y.Node.create(' ');
-
- deleteicon.setAttrs({
- 'alt': M.util.get_string('deleteannotation', 'assignfeedback_editpdf')
- });
- deleteicon.setStyles({
- 'backgroundColor' : 'white'
- });
- deletelink.addClass('deleteannotationbutton');
- deletelink.append(deleteicon);
-
- drawingregion.append(deletelink);
- deletelink.setData('annotation', this);
- deletelink.setStyle('zIndex', '200');
-
- deletelink.on('click', this.remove, this);
- deletelink.on('key', this.remove, 'space,enter', this);
-
- deletelink.setX(offsetcanvas[0] + bounds.x + bounds.width - 18);
- deletelink.setY(offsetcanvas[1] + bounds.y + 6);
- this.drawable.nodes.push(deletelink);
- }
- return this.drawable;
- },
-
- /**
- * Draw an annotation
- * @public
- * @method draw
- * @return M.assignfeedback_editpdf.drawable|false
- */
- draw : function() {
- // Should be overridden by the subclass.
- this.draw_highlight();
- return this.drawable;
- },
-
- /**
- * Delete an annotation
- * @protected
- * @method remove
- * @param event
- */
- remove : function(e) {
- var annotations;
-
- e.preventDefault();
-
- annotations = this.editor.pages[this.editor.currentpage].annotations;
- for (i = 0; i < annotations.length; i++) {
- if (annotations[i] === this) {
- annotations.splice(i, 1);
- if (this.drawable) {
- this.drawable.erase();
- }
- this.editor.currentannotation = false;
- this.editor.save_current_page();
- return;
- }
- }
- },
-
- /**
- * Move an annotation to a new location.
- * @public
- * @param int newx
- * @param int newy
- * @method move_annotation
- */
- move : function(newx, newy) {
- var diffx = newx - this.x,
- diffy = newy - this.y,
- newpath, oldpath, xy,
- x, y;
-
- this.x += diffx;
- this.y += diffy;
- this.endx += diffx;
- this.endy += diffy;
-
- if (this.path) {
- newpath = [];
- oldpath = this.path.split(':');
- Y.each(oldpath, function(position) {
- xy = position.split(',');
- x = parseInt(xy[0], 10);
- y = parseInt(xy[1], 10);
- newpath.push((x + diffx) + ',' + (y + diffy));
- });
-
- this.path = newpath.join(':');
-
- }
- if (this.drawable) {
- this.drawable.erase();
- }
- this.editor.drawables.push(this.draw());
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var noop = edit && false;
- // Override me please.
- return noop;
- },
-
- /**
- * Promote the current edit to a real annotation.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool if width/height is more than min. required.
- */
- init_from_edit : function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([edit.start, edit.end]);
-
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = bounds.x;
- this.y = bounds.y;
- this.endx = bounds.x + bounds.width;
- this.endy = bounds.y + bounds.height;
- this.colour = edit.annotationcolour;
- this.path = '';
- return (bounds.has_min_width() && bounds.has_min_height());
- }
-
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotation = ANNOTATION;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationhighlight.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationhighlight.js
deleted file mode 100644
index 136d8cb..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationhighlight.js
+++ /dev/null
@@ -1,153 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a highlight.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationhighlight
- * @extends M.assignfeedback_editpdf.annotation
- * @module moodle-assignfeedback_editpdf-editor
- */
-ANNOTATIONHIGHLIGHT = function(config) {
- ANNOTATIONHIGHLIGHT.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONHIGHLIGHT.NAME = "annotationhighlight";
-ANNOTATIONHIGHLIGHT.ATTRS = {};
-
-Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a highlight annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable,
- shape,
- bounds,
- highlightcolour;
-
- drawable = new M.assignfeedback_editpdf.drawable(this.editor);
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y),
- new M.assignfeedback_editpdf.point(this.endx, this.endy)]);
-
- highlightcolour = ANNOTATIONCOLOUR[this.colour];
-
- // Add an alpha channel to the rgb colour.
-
- highlightcolour = highlightcolour.replace('rgb', 'rgba');
- highlightcolour = highlightcolour.replace(')', ',0.5)');
-
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: bounds.height,
- stroke: false,
- fill: {
- color: highlightcolour
- },
- x: bounds.x,
- y: bounds.y
- });
-
- drawable.shapes.push(shape);
- this.drawable = drawable;
-
- return ANNOTATIONHIGHLIGHT.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape,
- bounds,
- highlightcolour;
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(edit.start.x, edit.start.y),
- new M.assignfeedback_editpdf.point(edit.end.x, edit.end.y)]);
-
- // Set min. width of highlight.
- if (!bounds.has_min_width()) {
- bounds.set_min_width();
- }
-
- highlightcolour = ANNOTATIONCOLOUR[edit.annotationcolour];
- // Add an alpha channel to the rgb colour.
-
- highlightcolour = highlightcolour.replace('rgb', 'rgba');
- highlightcolour = highlightcolour.replace(')', ',0.5)');
-
- // We will draw a box with the current background colour.
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: 16,
- stroke: false,
- fill: {
- color: highlightcolour
- },
- x: bounds.x,
- y: edit.start.y
- });
-
- drawable.shapes.push(shape);
-
- return drawable;
- },
-
- /**
- * Promote the current edit to a real annotation.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool true if highlight bound is more than min width/height, else false.
- */
- init_from_edit : function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([edit.start, edit.end]);
-
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = bounds.x;
- this.y = edit.start.y;
- this.endx = bounds.x + bounds.width;
- this.endy = edit.start.y + 16;
- this.colour = edit.annotationcolour;
- this.page = '';
-
- return (bounds.has_min_width());
- }
-
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationhighlight = ANNOTATIONHIGHLIGHT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationline.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationline.js
deleted file mode 100644
index 6539040..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationline.js
+++ /dev/null
@@ -1,120 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a line.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationline
- * @extends M.assignfeedback_editpdf.annotation
- */
-ANNOTATIONLINE = function(config) {
- ANNOTATIONLINE.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONLINE.NAME = "annotationline";
-ANNOTATIONLINE.ATTRS = {};
-
-Y.extend(ANNOTATIONLINE, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a line annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable,
- shape;
-
- drawable = new M.assignfeedback_editpdf.drawable(this.editor);
-
- shape = this.editor.graphic.addShape({
- type: Y.Path,
- fill: false,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[this.colour]
- }
- });
-
- shape.moveTo(this.x, this.y);
- shape.lineTo(this.endx, this.endy);
- shape.end();
- drawable.shapes.push(shape);
- this.drawable = drawable;
-
- return ANNOTATIONLINE.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape;
-
- shape = this.editor.graphic.addShape({
- type: Y.Path,
- fill: false,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[edit.annotationcolour]
- }
- });
-
- shape.moveTo(edit.start.x, edit.start.y);
- shape.lineTo(edit.end.x, edit.end.y);
- shape.end();
-
- drawable.shapes.push(shape);
-
- return drawable;
- },
-
- /**
- * Promote the current edit to a real annotation.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool true if line bound is more than min width/height, else false.
- */
- init_from_edit : function(edit) {
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = edit.start.x;
- this.y = edit.start.y;
- this.endx = edit.end.x;
- this.endy = edit.end.y;
- this.colour = edit.annotationcolour;
- this.path = '';
-
- return !(((this.endx - this.x) === 0) && ((this.endy - this.y) === 0));
- }
-
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationline = ANNOTATIONLINE;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationoval.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationoval.js
deleted file mode 100644
index 8c39409..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationoval.js
+++ /dev/null
@@ -1,113 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a oval.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationoval
- * @extends M.assignfeedback_editpdf.annotation
- */
-ANNOTATIONOVAL = function(config) {
- ANNOTATIONOVAL.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONOVAL.NAME = "annotationoval";
-ANNOTATIONOVAL.ATTRS = {};
-
-Y.extend(ANNOTATIONOVAL, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a oval annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable,
- shape;
-
- drawable = new M.assignfeedback_editpdf.drawable(this.editor);
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y),
- new M.assignfeedback_editpdf.point(this.endx, this.endy)]);
-
- shape = this.editor.graphic.addShape({
- type: Y.Ellipse,
- width: bounds.width,
- height: bounds.height,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[this.colour]
- },
- x: bounds.x,
- y: bounds.y
- });
- drawable.shapes.push(shape);
- this.drawable = drawable;
-
- return ANNOTATIONOVAL.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape,
- bounds;
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(edit.start.x, edit.start.y),
- new M.assignfeedback_editpdf.point(edit.end.x, edit.end.y)]);
-
- // Set min. width and height of oval.
- if (!bounds.has_min_width()) {
- bounds.set_min_width();
- }
- if (!bounds.has_min_height()) {
- bounds.set_min_height();
- }
-
- shape = this.editor.graphic.addShape({
- type: Y.Ellipse,
- width: bounds.width,
- height: bounds.height,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[edit.annotationcolour]
- },
- x: bounds.x,
- y: bounds.y
- });
-
- drawable.shapes.push(shape);
-
- return drawable;
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationoval = ANNOTATIONOVAL;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationpen.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationpen.js
deleted file mode 100644
index 96aa832..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationpen.js
+++ /dev/null
@@ -1,160 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a pen.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationpen
- * @extends M.assignfeedback_editpdf.annotation
- */
-ANNOTATIONPEN = function(config) {
- ANNOTATIONPEN.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONPEN.NAME = "annotationpen";
-ANNOTATIONPEN.ATTRS = {};
-
-Y.extend(ANNOTATIONPEN, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a pen annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable,
- shape,
- first,
- positions,
- xy;
-
- drawable = new M.assignfeedback_editpdf.drawable(this.editor);
-
- shape = this.editor.graphic.addShape({
- type: Y.Path,
- fill: false,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[this.colour]
- }
- });
-
- first = true;
- // Recreate the pen path array.
- positions = this.path.split(':');
- // Redraw all the lines.
- Y.each(positions, function(position) {
- xy = position.split(',');
- if (first) {
- shape.moveTo(xy[0], xy[1]);
- first = false;
- } else {
- shape.lineTo(xy[0], xy[1]);
- }
- }, this);
-
- shape.end();
-
- drawable.shapes.push(shape);
- this.drawable = drawable;
-
- return ANNOTATIONPEN.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape,
- first;
-
- shape = this.editor.graphic.addShape({
- type: Y.Path,
- fill: false,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[edit.annotationcolour]
- }
- });
-
- first = true;
- // Recreate the pen path array.
- // Redraw all the lines.
- Y.each(edit.path, function(position) {
- if (first) {
- shape.moveTo(position.x, position.y);
- first = false;
- } else {
- shape.lineTo(position.x, position.y);
- }
- }, this);
-
- shape.end();
-
- drawable.shapes.push(shape);
-
- return drawable;
- },
-
-
- /**
- * Promote the current edit to a real annotation.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool true if pen bound is more than min width/height, else false.
- */
- init_from_edit : function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect(),
- pathlist = [],
- i = 0;
-
- // This will get the boundaries of all points in the path.
- bounds.bound(edit.path);
-
- for (i = 0; i < edit.path.length; i++) {
- pathlist.push(parseInt(edit.path[i].x, 10) + ',' + parseInt(edit.path[i].y, 10));
- }
-
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = bounds.x;
- this.y = bounds.y;
- this.endx = bounds.x + bounds.width;
- this.endy = bounds.y + bounds.height;
- this.colour = edit.annotationcolour;
- this.path = pathlist.join(':');
-
- return (bounds.has_min_width() || bounds.has_min_height());
- }
-
-
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationpen = ANNOTATIONPEN;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationrectangle.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationrectangle.js
deleted file mode 100644
index c732014..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationrectangle.js
+++ /dev/null
@@ -1,113 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a rectangle.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationrectangle
- * @extends M.assignfeedback_editpdf.annotation
- */
-ANNOTATIONRECTANGLE = function(config) {
- ANNOTATIONRECTANGLE.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONRECTANGLE.NAME = "annotationrectangle";
-ANNOTATIONRECTANGLE.ATTRS = {};
-
-Y.extend(ANNOTATIONRECTANGLE, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a rectangle annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable,
- shape;
-
- drawable = new M.assignfeedback_editpdf.drawable(this.editor);
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(this.x, this.y),
- new M.assignfeedback_editpdf.point(this.endx, this.endy)]);
-
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: bounds.height,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[this.colour]
- },
- x: bounds.x,
- y: bounds.y
- });
- drawable.shapes.push(shape);
- this.drawable = drawable;
-
- return ANNOTATIONRECTANGLE.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape,
- bounds;
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([new M.assignfeedback_editpdf.point(edit.start.x, edit.start.y),
- new M.assignfeedback_editpdf.point(edit.end.x, edit.end.y)]);
-
- // Set min. width and height of rectangle.
- if (!bounds.has_min_width()) {
- bounds.set_min_width();
- }
- if (!bounds.has_min_height()) {
- bounds.set_min_height();
- }
-
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: bounds.height,
- stroke: {
- weight: STROKEWEIGHT,
- color: ANNOTATIONCOLOUR[edit.annotationcolour]
- },
- x: bounds.x,
- y: bounds.y
- });
-
- drawable.shapes.push(shape);
-
- return drawable;
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationrectangle = ANNOTATIONRECTANGLE;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationstamp.js b/mod/assign/feedback/editpdf/yui/src/editor/js/annotationstamp.js
deleted file mode 100644
index 71db2f6..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/annotationstamp.js
+++ /dev/null
@@ -1,169 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a stamp.
- *
- * @namespace M.assignfeedback_editpdf
- * @class annotationstamp
- * @extends M.assignfeedback_editpdf.annotation
- */
-ANNOTATIONSTAMP = function(config) {
- ANNOTATIONSTAMP.superclass.constructor.apply(this, [config]);
-};
-
-ANNOTATIONSTAMP.NAME = "annotationstamp";
-ANNOTATIONSTAMP.ATTRS = {};
-
-Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
- /**
- * Draw a stamp annotation
- * @protected
- * @method draw
- * @return M.assignfeedback_editpdf.drawable
- */
- draw : function() {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- drawingregion = Y.one(SELECTOR.DRAWINGREGION),
- node,
- position;
-
- position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x, this.y));
- node = Y.Node.create('
');
- node.setStyles({
- 'position': 'absolute',
- 'display': 'inline-block',
- 'backgroundImage': 'url(' + this.editor.get_stamp_image_url(this.path) + ')',
- 'width': (this.endx - this.x),
- 'height': (this.endy - this.y),
- 'backgroundSize': '100% 100%',
- 'zIndex': 50
- });
-
- drawingregion.append(node);
- node.setX(position.x);
- node.setY(position.y);
-
- // Pass throught the event handlers on the div.
- node.on('gesturemovestart', this.editor.edit_start, null, this.editor);
- node.on('gesturemove', this.editor.edit_move, null, this.editor);
- node.on('gesturemoveend', this.editor.edit_end, null, this.editor);
-
- drawable.nodes.push(node);
-
- this.drawable = drawable;
- return ANNOTATIONSTAMP.superclass.draw.apply(this);
- },
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- draw_current_edit : function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect(),
- drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- drawingregion = Y.one(SELECTOR.DRAWINGREGION),
- node,
- position;
-
- bounds.bound([edit.start, edit.end]);
- position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(bounds.x, bounds.y));
-
- node = Y.Node.create('
');
- node.setStyles({
- 'position': 'absolute',
- 'display': 'inline-block',
- 'backgroundImage': 'url(' + this.editor.get_stamp_image_url(edit.stamp) + ')',
- 'width': bounds.width,
- 'height': bounds.height,
- 'backgroundSize': '100% 100%',
- 'zIndex': 50
- });
-
- drawingregion.append(node);
- node.setX(position.x);
- node.setY(position.y);
-
- drawable.nodes.push(node);
-
- return drawable;
- },
-
- /**
- * Promote the current edit to a real annotation.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool if width/height is more than min. required.
- */
- init_from_edit : function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([edit.start, edit.end]);
-
- if (bounds.width < 40) {
- bounds.width = 40;
- }
- if (bounds.height < 40) {
- bounds.height = 40;
- }
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = bounds.x;
- this.y = bounds.y;
- this.endx = bounds.x + bounds.width;
- this.endy = bounds.y + bounds.height;
- this.colour = edit.annotationcolour;
- this.path = edit.stamp;
-
- // Min width and height is always more than 40px.
- return true;
- },
-
- /**
- * Move an annotation to a new location.
- * @public
- * @param int newx
- * @param int newy
- * @method move_annotation
- */
- move : function(newx, newy) {
- var diffx = newx - this.x,
- diffy = newy - this.y;
-
- this.x += diffx;
- this.y += diffy;
- this.endx += diffx;
- this.endy += diffy;
-
- if (this.drawable) {
- this.drawable.erase();
- }
- this.editor.drawables.push(this.draw());
- }
-
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.annotationstamp = ANNOTATIONSTAMP;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/colourpicker.js b/mod/assign/feedback/editpdf/yui/src/editor/js/colourpicker.js
deleted file mode 100644
index 919ac88..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/colourpicker.js
+++ /dev/null
@@ -1,130 +0,0 @@
-var COLOURPICKER_NAME = "Colourpicker",
- COLOURPICKER;
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * COLOURPICKER
- * This is a drop down list of colours.
- *
- * @namespace M.assignfeedback_editpdf
- * @class colourpicker
- * @constructor
- * @extends M.assignfeedback_editpdf.dropdown
- */
-COLOURPICKER = function(config) {
- COLOURPICKER.superclass.constructor.apply(this, [config]);
-};
-
-Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
-
- /**
- * Initialise the menu.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- var colourlist = Y.Node.create(''),
- body;
-
- // Build a list of coloured buttons.
- Y.each(this.get('colours'), function(rgb, colour) {
- var button, listitem, title, img, iconname;
-
- title = M.util.get_string(colour, 'assignfeedback_editpdf');
- iconname = this.get('iconprefix') + colour;
- img = M.util.image_url(iconname, 'assignfeedback_editpdf');
- button = Y.Node.create(' ');
- button.setAttribute('data-colour', colour);
- button.setAttribute('data-rgb', rgb);
- button.setStyle('backgroundImage', 'none');
- listitem = Y.Node.create(' ');
- listitem.append(button);
- colourlist.append(listitem);
- }, this);
-
- body = Y.Node.create('
');
-
- // Set the call back.
- colourlist.delegate('click', this.callback_handler, 'button', this);
- colourlist.delegate('key', this.callback_handler, 'down:13', 'button', this);
-
- // Set the accessible header text.
- this.set('headerText', M.util.get_string('colourpicker', 'assignfeedback_editpdf'));
-
- // Set the body content.
- body.append(colourlist);
- this.set('bodyContent', body);
-
- COLOURPICKER.superclass.initializer.call(this, config);
- },
- callback_handler : function(e) {
- e.preventDefault();
-
- var callback = this.get('callback'),
- callbackcontext = this.get('context'),
- bind;
-
- this.hide();
-
- // Call the callback with the specified context.
- bind = Y.bind(callback, callbackcontext, e);
-
- bind();
- }
-}, {
- NAME : COLOURPICKER_NAME,
- ATTRS : {
- /**
- * The list of colours this colour picker supports.
- *
- * @attribute colours
- * @type {String: String} (The keys of the array are the colour names and the values are localized strings)
- * @default {}
- */
- colours : {
- value : {}
- },
-
- /**
- * The function called when a new colour is chosen.
- *
- * @attribute callback
- * @type function
- * @default null
- */
- callback : {
- value : null
- },
-
- /**
- * The context passed to the callback when a colour is chosen.
- *
- * @attribute context
- * @type Y.Node
- * @default null
- */
- context : {
- value : null
- },
-
- /**
- * The prefix for the icon image names.
- *
- * @attribute iconprefix
- * @type String
- * @default 'colour_'
- */
- iconprefix : {
- value : 'colour_'
- }
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.colourpicker = COLOURPICKER;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/comment.js b/mod/assign/feedback/editpdf/yui/src/editor/js/comment.js
deleted file mode 100644
index 62bb213..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/comment.js
+++ /dev/null
@@ -1,441 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a list of comments.
- *
- * @namespace M.assignfeedback_editpdf
- * @class comment
- * @param M.assignfeedback_editpdf.editor editor
- * @param Int gradeid
- * @param Int pageno
- * @param Int x
- * @param Int y
- * @param Int width
- * @param String colour
- * @param String rawtext
- */
-COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
-
- /**
- * Reference to M.assignfeedback_editpdf.editor.
- * @property editor
- * @type M.assignfeedback_editpdf.editor
- * @public
- */
- this.editor = editor;
-
- /**
- * Grade id
- * @property gradeid
- * @type Int
- * @public
- */
- this.gradeid = gradeid || 0;
-
- /**
- * X position
- * @property x
- * @type Int
- * @public
- */
- this.x = parseInt(x, 10) || 0;
-
- /**
- * Y position
- * @property y
- * @type Int
- * @public
- */
- this.y = parseInt(y, 10) || 0;
-
- /**
- * Comment width
- * @property width
- * @type Int
- * @public
- */
- this.width = parseInt(width, 10) || 0;
-
- /**
- * Comment rawtext
- * @property rawtext
- * @type String
- * @public
- */
- this.rawtext = rawtext || '';
-
- /**
- * Comment page number
- * @property pageno
- * @type Int
- * @public
- */
- this.pageno = pageno || 0;
-
- /**
- * Comment background colour.
- * @property colour
- * @type String
- * @public
- */
- this.colour = colour || 'yellow';
-
- /**
- * Reference to M.assignfeedback_editpdf.drawable
- * @property drawable
- * @type M.assignfeedback_editpdf.drawable
- * @public
- */
- this.drawable = false;
-
- /**
- * Boolean used by a timeout to delete empty comments after a short delay.
- * @property deleteme
- * @type Boolean
- * @public
- */
- this.deleteme = false;
-
- /**
- * Reference to the link that opens the menu.
- * @property menulink
- * @type Y.Node
- * @public
- */
- this.menulink = null;
-
- /**
- * Reference to the dialogue that is the context menu.
- * @property menu
- * @type M.assignfeedback_editpdf.dropdown
- * @public
- */
- this.menu = null;
-
- /**
- * Clean a comment record, returning an oject with only fields that are valid.
- * @public
- * @method clean
- * @return {}
- */
- this.clean = function() {
- return {
- gradeid : this.gradeid,
- x : parseInt(this.x, 10),
- y : parseInt(this.y, 10),
- width : parseInt(this.width, 10),
- rawtext : this.rawtext,
- pageno : this.currentpage,
- colour : this.colour
- };
- };
-
- /**
- * Draw a comment.
- * @public
- * @method draw_comment
- * @param boolean focus - Set the keyboard focus to the new comment if true
- * @return M.assignfeedback_editpdf.drawable
- */
- this.draw = function(focus) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- node,
- drawingregion = Y.one(SELECTOR.DRAWINGREGION),
- container,
- menu,
- position,
- scrollheight;
-
- // Lets add a contenteditable div.
- node = Y.Node.create('');
- container = Y.Node.create('');
- menu = Y.Node.create(' ');
-
- this.menulink = menu;
- container.append(node);
-
- if (!this.editor.get('readonly')) {
- container.append(menu);
- } else {
- node.setAttribute('readonly', 'readonly');
- }
- if (this.width < 100) {
- this.width = 100;
- }
-
- position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x, this.y));
- node.setStyles({
- width: this.width + 'px',
- backgroundColor: COMMENTCOLOUR[this.colour],
- color: COMMENTTEXTCOLOUR
- });
-
- drawingregion.append(container);
- container.setStyle('position', 'absolute');
- container.setX(position.x);
- container.setY(position.y);
- drawable.nodes.push(container);
- node.set('value', this.rawtext);
- scrollheight = node.get('scrollHeight'),
- node.setStyles({
- 'height' : scrollheight + 'px',
- 'overflow': 'hidden'
- });
- if (!this.editor.get('readonly')) {
- this.attach_events(node, menu);
- }
- if (focus) {
- node.focus();
- }
- this.drawable = drawable;
-
-
- return drawable;
- };
-
- /**
- * Delete an empty comment if it's menu hasn't been opened in time.
- * @method delete_comment_later
- */
- this.delete_comment_later = function() {
- if (this.deleteme) {
- this.remove();
- }
- };
-
- /**
- * Comment nodes have a bunch of event handlers attached to them directly.
- * This is all done here for neatness.
- *
- * @protected
- * @method attach_comment_events
- * @param node - The Y.Node representing the comment.
- * @param menu - The Y.Node representing the menu.
- */
- this.attach_events = function(node, menu) {
- // Save the text on blur.
- node.on('blur', function() {
- // Save the changes back to the comment.
- this.rawtext = node.get('value');
- this.width = parseInt(node.getStyle('width'), 10);
-
- // Trim.
- if (this.rawtext.replace(/^\s+|\s+$/g, "") === '') {
- // Delete empty comments.
- this.deleteme = true;
- Y.later(400, this, this.delete_comment_later);
- }
- this.editor.save_current_page();
- this.editor.editingcomment = false;
- }, this);
-
- // For delegated event handler.
- menu.setData('comment', this);
-
- node.on('keyup', function() {
- var scrollheight = node.get('scrollHeight'),
- height = parseInt(node.getStyle('height'), 10);
-
- // Webkit scrollheight fix.
- if (scrollheight === height + 8) {
- scrollheight -= 8;
- }
- node.setStyle('height', scrollheight + 'px');
-
- });
-
- node.on('gesturemovestart', function(e) {
- node.setData('dragging', true);
- node.setData('offsetx', e.clientX - node.getX());
- node.setData('offsety', e.clientY - node.getY());
- });
- node.on('gesturemoveend', function() {
- node.setData('dragging', false);
- this.editor.save_current_page();
- }, null, this);
- node.on('gesturemove', function(e) {
- var x = e.clientX - node.getData('offsetx'),
- y = e.clientY - node.getData('offsety'),
- nodewidth,
- nodeheight,
- newlocation,
- windowlocation,
- bounds;
-
- nodewidth = parseInt(node.getStyle('width'), 10);
- nodeheight = parseInt(node.getStyle('height'), 10);
-
- newlocation = this.editor.get_canvas_coordinates(new M.assignfeedback_editpdf.point(x, y));
- bounds = this.editor.get_canvas_bounds(true);
- bounds.x = 0;
- bounds.y = 0;
-
- bounds.width -= nodewidth + 42;
- bounds.height -= nodeheight + 8;
- // Clip to the window size - the comment size.
- newlocation.clip(bounds);
-
- this.x = newlocation.x;
- this.y = newlocation.y;
-
- windowlocation = this.editor.get_window_coordinates(newlocation);
- node.ancestor().setX(windowlocation.x);
- node.ancestor().setY(windowlocation.y);
- }, null, this);
-
- this.menu = new M.assignfeedback_editpdf.commentmenu({
- buttonNode: this.menulink,
- comment: this
- });
- };
-
- /**
- * Delete a comment.
- * @method remove
- */
- this.remove = function() {
- var i = 0, comments;
-
- comments = this.editor.pages[this.editor.currentpage].comments;
- for (i = 0; i < comments.length; i++) {
- if (comments[i] === this) {
- comments.splice(i, 1);
- this.drawable.erase();
- this.editor.save_current_page();
- return;
- }
- }
- };
-
- /**
- * Event handler to remove a comment from the users quicklist.
- *
- * @protected
- * @method remove_from_quicklist
- */
- this.remove_from_quicklist = function(e, quickcomment) {
- e.preventDefault();
-
- this.menu.hide();
-
- this.editor.quicklist.remove(quickcomment);
- };
-
- /**
- * A quick comment was selected in the list, update the active comment and redraw the page.
- *
- * @param Event e
- * @protected
- * @method set_from_quick_comment
- */
- this.set_from_quick_comment = function(e, quickcomment) {
- e.preventDefault();
-
- this.menu.hide();
-
- this.rawtext = quickcomment.rawtext;
- this.width = quickcomment.width;
- this.colour = quickcomment.colour;
-
- this.editor.save_current_page();
-
- this.editor.redraw();
- };
-
- /**
- * Event handler to add a comment to the users quicklist.
- *
- * @protected
- * @method add_to_quicklist
- */
- this.add_to_quicklist = function(e) {
- e.preventDefault();
- this.menu.hide();
- this.editor.quicklist.add(this);
- };
-
- /**
- * Draw the in progress edit.
- *
- * @public
- * @method draw_current_edit
- * @param M.assignfeedback_editpdf.edit edit
- */
- this.draw_current_edit = function(edit) {
- var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
- shape,
- bounds;
-
- bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([edit.start, edit.end]);
-
- // We will draw a box with the current background colour.
- shape = this.editor.graphic.addShape({
- type: Y.Rect,
- width: bounds.width,
- height: bounds.height,
- fill: {
- color: COMMENTCOLOUR[edit.commentcolour]
- },
- x: bounds.x,
- y: bounds.y
- });
-
- drawable.shapes.push(shape);
-
- return drawable;
- };
-
- /**
- * Promote the current edit to a real comment.
- *
- * @public
- * @method init_from_edit
- * @param M.assignfeedback_editpdf.edit edit
- * @return bool true if comment bound is more than min width/height, else false.
- */
- this.init_from_edit = function(edit) {
- var bounds = new M.assignfeedback_editpdf.rect();
- bounds.bound([edit.start, edit.end]);
-
- // Minimum comment width.
- if (bounds.width < 100) {
- bounds.width = 100;
- }
-
- // Save the current edit to the server and the current page list.
-
- this.gradeid = this.editor.get('gradeid');
- this.pageno = this.editor.currentpage;
- this.x = bounds.x;
- this.y = bounds.y;
- this.width = bounds.width;
- this.colour = edit.commentcolour;
- this.rawtext = '';
-
- return (bounds.has_min_width() && bounds.has_min_height());
- };
-
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.comment = COMMENT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/commentmenu.js b/mod/assign/feedback/editpdf/yui/src/editor/js/commentmenu.js
deleted file mode 100644
index a07591c..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/commentmenu.js
+++ /dev/null
@@ -1,121 +0,0 @@
-var COMMENTMENUNAME = "Commentmenu",
- COMMENTMENU;
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * COMMENTMENU
- * This is a drop down list of comment context functions.
- *
- * @namespace M.assignfeedback_editpdf
- * @class commentmenu
- * @constructor
- * @extends M.assignfeedback_editpdf.dropdown
- */
-COMMENTMENU = function(config) {
- COMMENTMENU.superclass.constructor.apply(this, [config]);
-};
-
-Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, {
-
- /**
- * Initialise the menu.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- var commentlinks,
- link,
- body,
- comment;
-
- comment = this.get('comment');
- // Build the list of menu items.
- commentlinks = Y.Node.create('');
-
- link = Y.Node.create('' + M.util.get_string('addtoquicklist', 'assignfeedback_editpdf') + ' ');
- link.on('click', comment.add_to_quicklist, comment);
- link.on('key', comment.add_to_quicklist, 'enter,space', comment);
-
- commentlinks.append(link);
-
- link = Y.Node.create('' + M.util.get_string('deletecomment', 'assignfeedback_editpdf') + ' ');
- link.on('click', function(e) { e.preventDefault(); this.menu.hide(); this.remove(); }, comment);
- link.on('key', function() { comment.menu.hide(); comment.remove(); }, 'enter,space', comment);
-
- commentlinks.append(link);
-
- link = Y.Node.create(' ');
- commentlinks.append(link);
-
- // Set the accessible header text.
- this.set('headerText', M.util.get_string('commentcontextmenu', 'assignfeedback_editpdf'));
-
- body = Y.Node.create('
');
-
- // Set the body content.
- body.append(commentlinks);
- this.set('bodyContent', body);
-
- COMMENTMENU.superclass.initializer.call(this, config);
- },
-
- /**
- * Show the menu.
- *
- * @method show
- * @return void
- */
- show : function() {
- var commentlinks = this.get('boundingBox').one('ul');
- commentlinks.all('.quicklist_comment').remove(true),
- comment = this.get('comment');
-
- comment.deleteme = false; // Cancel the deleting of blank comments.
-
- // Now build the list of quicklist comments.
- Y.each(comment.editor.quicklist.comments, function(quickcomment) {
- var listitem = Y.Node.create(''),
- linkitem = Y.Node.create('' + quickcomment.rawtext + ' '),
- deletelinkitem = Y.Node.create('');
- listitem.append(linkitem);
- listitem.append(deletelinkitem);
-
- commentlinks.append(listitem);
-
- linkitem.on('click', comment.set_from_quick_comment, comment, quickcomment);
- linkitem.on('key', comment.set_from_quick_comment, 'space,enter', comment, quickcomment);
-
- deletelinkitem.on('click', comment.remove_from_quicklist, comment, quickcomment);
- deletelinkitem.on('key', comment.remove_from_quicklist, 'space,enter', comment, quickcomment);
- }, this);
-
- COMMENTMENU.superclass.show.call(this);
- }
-}, {
- NAME : COMMENTMENUNAME,
- ATTRS : {
- /**
- * The comment this menu is attached to.
- *
- * @attribute comment
- * @type M.assignfeedback_editpdf.comment
- * @default null
- */
- comment : {
- value : null
- }
-
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.commentmenu = COMMENTMENU;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/commentsearch.js b/mod/assign/feedback/editpdf/yui/src/editor/js/commentsearch.js
deleted file mode 100644
index 0dece81..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/commentsearch.js
+++ /dev/null
@@ -1,174 +0,0 @@
-var COMMENTSEARCHNAME = "commentsearch",
- COMMENTSEARCH;
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * This is a searchable dialogue of comments.
- *
- * @namespace M.assignfeedback_editpdf
- * @class commentsearch
- * @constructor
- * @extends M.core.dialogue
- */
-COMMENTSEARCH = function(config) {
- config.draggable = false;
- config.centered = true;
- config.width = '400px';
- config.visible = false;
- config.headerContent = M.util.get_string('searchcomments', 'assignfeedback_editpdf');
- config.footerContent = '';
- COMMENTSEARCH.superclass.constructor.apply(this, [config]);
-};
-
-Y.extend(COMMENTSEARCH, M.core.dialogue, {
- /**
- * Initialise the menu.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- var editor,
- container,
- placeholder,
- commentfilter,
- commentlist,
- bb;
-
- bb = this.get('boundingBox');
- bb.addClass('assignfeedback_editpdf_commentsearch');
-
- editor = this.get('editor');
- container = Y.Node.create('
');
-
- placeholder = M.util.get_string('filter', 'assignfeedback_editpdf');
- commentfilter = Y.Node.create(' ');
- container.append(commentfilter);
- commentlist = Y.Node.create('');
- container.append(commentlist);
-
- commentfilter.on('keyup', this.filter_search_comments, null, this);
- commentlist.delegate('click', this.focus_on_comment, 'a', this);
- commentlist.delegate('key', this.focus_on_comment, 'enter,space', 'a', this);
-
- // Set the body content.
- this.set('bodyContent', container);
-
- COMMENTSEARCH.superclass.initializer.call(this, config);
- },
-
- /**
- * Event handler to filter the list of comments.
- *
- * @protected
- * @method filter_search_comments
- */
- filter_search_comments : function() {
- var filternode,
- commentslist,
- filtertext;
-
- filternode = Y.one(SELECTOR.SEARCHFILTER);
- commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
-
- filtertext = filternode.get('value');
-
- commentslist.all('li').each(function (node) {
- if (node.get('text').indexOf(filtertext) !== -1) {
- node.show();
- } else {
- node.hide();
- }
- });
- },
-
- /**
- * Event handler to focus on a selected comment.
- *
- * @param Event e
- * @protected
- * @method focus_on_comment
- */
- focus_on_comment : function(e) {
- e.preventDefault();
- var target = e.target.ancestor('li'),
- comment = target.getData('comment'),
- editor = this.get('editor');
-
- this.hide();
-
- if (comment.pageno === editor.currentpage) {
- comment.drawable.nodes[0].one('textarea').focus();
- } else {
- // Comment is on a different page.
- editor.currentpage = comment.pageno;
- editor.change_page();
- comment.drawable.nodes[0].one('textarea').focus();
- }
- },
-
- /**
- * Show the menu.
- *
- * @method show
- * @return void
- */
- show : function() {
- var commentlist = this.get('boundingBox').one('ul'),
- editor = this.get('editor');
-
- commentlist.all('li').remove(true);
-
- // Rebuild the latest list of comments.
- Y.each(editor.pages, function(page) {
- Y.each(page.comments, function(comment) {
- var commentnode = Y.Node.create('' + comment.rawtext + ' ');
- commentlist.append(commentnode);
- commentnode.setData('comment', comment);
- }, this);
- }, this);
-
- this.centerDialogue();
- COMMENTSEARCH.superclass.show.call(this);
- }
-}, {
- NAME : COMMENTSEARCHNAME,
- ATTRS : {
- /**
- * The editor this search window is attached to.
- *
- * @attribute editor
- * @type M.assignfeedback_editpdf.editor
- * @default null
- */
- editor : {
- value : null
- }
-
- }
-});
-
-Y.Base.modifyAttrs(COMMENTSEARCH, {
- /**
- * Whether the widget should be modal or not.
- *
- * Moodle override: We override this for commentsearch to force it always true.
- *
- * @attribute Modal
- * @type Boolean
- * @default true
- */
- modal: {
- getter: function() {
- return true;
- }
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.commentsearch = COMMENTSEARCH;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/drawable.js b/mod/assign/feedback/editpdf/yui/src/editor/js/drawable.js
deleted file mode 100644
index 9f627f8..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/drawable.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a drawable thing which contains both Y.Nodes, and Y.Shapes.
- *
- * @namespace M.assignfeedback_editpdf
- * @param M.assignfeedback_editpdf.editor editor
- * @class drawable
- */
-DRAWABLE = function(editor) {
-
- /**
- * Reference to M.assignfeedback_editpdf.editor.
- * @property editor
- * @type M.assignfeedback_editpdf.editor
- * @public
- */
- this.editor = editor;
-
- /**
- * Array of Y.Shape
- * @property shapes
- * @type Y.Shape[]
- * @public
- */
- this.shapes = [];
-
- /**
- * Array of Y.Node
- * @property nodes
- * @type Y.Node[]
- * @public
- */
- this.nodes = [];
-
- /**
- * Delete the shapes from the drawable.
- * @protected
- * @method erase_drawable
- */
- this.erase = function() {
- if (this.shapes) {
- while (this.shapes.length > 0) {
- this.editor.graphic.removeShape(this.shapes.pop());
- }
- }
- if (this.nodes) {
- while (this.nodes.length > 0) {
- this.nodes.pop().remove();
- }
- }
- };
-
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.drawable = DRAWABLE;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/dropdown.js b/mod/assign/feedback/editpdf/yui/src/editor/js/dropdown.js
deleted file mode 100644
index d566c8c..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/dropdown.js
+++ /dev/null
@@ -1,123 +0,0 @@
-var DROPDOWN_NAME = "Dropdown menu",
- DROPDOWN;
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * This is a drop down list of buttons triggered (and aligned to) a button.
- *
- * @namespace M.assignfeedback_editpdf
- * @class dropdown
- * @constructor
- * @extends M.core.dialogue
- */
-DROPDOWN = function(config) {
- config.draggable = false;
- config.centered = false;
- config.width = 'auto';
- config.visible = false;
- config.footerContent = '';
- DROPDOWN.superclass.constructor.apply(this, [config]);
-};
-
-Y.extend(DROPDOWN, M.core.dialogue, {
- /**
- * Initialise the menu.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- var button, body, headertext, bb;
- DROPDOWN.superclass.initializer.call(this, config);
-
- bb = this.get('boundingBox');
- bb.addClass('assignfeedback_editpdf_dropdown');
-
- // Align the menu to the button that opens it.
- button = this.get('buttonNode');
-
- // Close the menu when clicked outside (excluding the button that opened the menu).
- body = this.bodyNode;
-
- headertext = Y.Node.create(' ');
- headertext.addClass('accesshide');
- headertext.setHTML(this.get('headerText'));
- body.prepend(headertext);
-
- body.on('clickoutside', function(e) {
- if (this.get('visible')) {
- // Note: we need to compare ids because for some reason - sometimes button is an Object, not a Y.Node.
- if (e.target.get('id') !== button.get('id') && e.target.ancestor().get('id') !== button.get('id')) {
- e.preventDefault();
- this.hide();
- }
- }
- }, this);
-
- button.on('click', function(e) {e.preventDefault(); this.show();}, this);
- button.on('key', this.show, 'enter,space', this);
- },
-
- /**
- * Override the show method to align to the button.
- *
- * @method show
- * @return void
- */
- show : function() {
- var button = this.get('buttonNode');
-
- result = DROPDOWN.superclass.show.call(this);
- this.align(button, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
- }
-}, {
- NAME : DROPDOWN_NAME,
- ATTRS : {
- /**
- * The header for the drop down (only accessible to screen readers).
- *
- * @attribute headerText
- * @type String
- * @default ''
- */
- headerText : {
- value : ''
- },
-
- /**
- * The button used to show/hide this drop down menu.
- *
- * @attribute buttonNode
- * @type Y.Node
- * @default null
- */
- buttonNode : {
- value : null
- }
- }
-});
-
-Y.Base.modifyAttrs(DROPDOWN, {
- /**
- * Whether the widget should be modal or not.
- *
- * Moodle override: We override this for commentsearch to force it always false.
- *
- * @attribute Modal
- * @type Boolean
- * @default false
- */
- modal: {
- getter: function() {
- return false;
- }
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.dropdown = DROPDOWN;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/edit.js b/mod/assign/feedback/editpdf/yui/src/editor/js/edit.js
deleted file mode 100644
index 2e4f88e..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/edit.js
+++ /dev/null
@@ -1,104 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * EDIT
- *
- * @namespace M.assignfeedback_editpdf
- * @class edit
- */
-EDIT = function() {
-
- /**
- * Starting point for the edit.
- * @property start
- * @type M.assignfeedback_editpdf.point|false
- * @public
- */
- this.start = false;
-
- /**
- * Finishing point for the edit.
- * @property end
- * @type M.assignfeedback_editpdf.point|false
- * @public
- */
- this.end = false;
-
- /**
- * Starting time for the edit.
- * @property starttime
- * @type int
- * @public
- */
- this.starttime = 0;
-
- /**
- * Starting point for the currently selected annotation.
- * @property annotationstart
- * @type M.assignfeedback_editpdf.point|false
- * @public
- */
- this.annotationstart = false;
-
- /**
- * The currently selected tool
- * @property tool
- * @type String
- * @public
- */
- this.tool = "comment";
-
- /**
- * The currently comment colour
- * @property commentcolour
- * @type String
- * @public
- */
- this.commentcolour = 'yellow';
-
- /**
- * The currently annotation colour
- * @property annotationcolour
- * @type String
- * @public
- */
- this.annotationcolour = 'red';
-
- /**
- * The current stamp image.
- * @property stamp
- * @type String
- * @public
- */
- this.stamp = '';
-
- /**
- * List of points the the current drawing path.
- * @property path
- * @type M.assignfeedback_editpdf.point[]
- * @public
- */
- this.path = [];
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.edit = EDIT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/globals.js b/mod/assign/feedback/editpdf/yui/src/editor/js/globals.js
deleted file mode 100644
index 7eab77e..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/globals.js
+++ /dev/null
@@ -1,76 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * A list of globals used by this module.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
- AJAXBASEPROGRESS = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax_progress.php',
- CSS = {
- DIALOGUE : 'assignfeedback_editpdf_widget'
- },
- SELECTOR = {
- PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
- NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
- SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
- SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
- SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
- PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
- LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
- PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
- DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
- DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
- SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
- COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
- COMMENTMENU : ' .commentdrawable a',
- ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
- DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
- UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
- STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
- DIALOGUE : '.' + CSS.DIALOGUE
- },
- SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
- SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
- COMMENTTEXTCOLOUR = 'rgb(51, 51, 51)',
- COMMENTCOLOUR = {
- 'white' : 'rgb(255,255,255)',
- 'yellow' : 'rgb(255,236,174)',
- 'red' : 'rgb(249,181,179)',
- 'green' : 'rgb(214,234,178)',
- 'blue' : 'rgb(203,217,237)',
- 'clear' : 'rgba(255,255,255, 0)'
- },
- ANNOTATIONCOLOUR = {
- 'white' : 'rgb(255,255,255)',
- 'yellow' : 'rgb(255,207,53)',
- 'red' : 'rgb(239,69,64)',
- 'green' : 'rgb(152,202,62)',
- 'blue' : 'rgb(125,159,211)',
- 'black' : 'rgb(51,51,51)'
- },
- CLICKTIMEOUT = 300,
- TOOLSELECTOR = {
- 'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
- 'pen': '.' + CSS.DIALOGUE + ' .penbutton',
- 'line': '.' + CSS.DIALOGUE + ' .linebutton',
- 'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
- 'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
- 'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
- 'select': '.' + CSS.DIALOGUE + ' .selectbutton',
- 'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
- },
- STROKEWEIGHT = 4;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/point.js b/mod/assign/feedback/editpdf/yui/src/editor/js/point.js
deleted file mode 100644
index ce4cd40..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/point.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a 2d point.
- *
- * @namespace M.assignfeedback_editpdf
- * @param Number x
- * @param Number y
- * @class point
- */
-POINT = function(x, y) {
-
- /**
- * X coordinate.
- * @property x
- * @type int
- * @public
- */
- this.x = parseInt(x, 10);
-
- /**
- * Y coordinate.
- * @property y
- * @type int
- * @public
- */
- this.y = parseInt(y, 10);
-
- /**
- * Clip this point to the rect
- * @method clip
- * @param M.assignfeedback_editpdf.point
- * @public
- */
- this.clip = function(bounds) {
- if (this.x < bounds.x) {
- this.x = bounds.x;
- }
- if (this.x > (bounds.x + bounds.width)) {
- this.x = bounds.x + bounds.width;
- }
- if (this.y < bounds.y) {
- this.y = bounds.y;
- }
- if (this.y > (bounds.y + bounds.height)) {
- this.y = bounds.y + bounds.height;
- }
- // For chaining.
- return this;
- };
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.point = POINT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/quickcomment.js b/mod/assign/feedback/editpdf/yui/src/editor/js/quickcomment.js
deleted file mode 100644
index 7495141..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/quickcomment.js
+++ /dev/null
@@ -1,64 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a users quick comment.
- *
- * @namespace M.assignfeedback_editpdf
- * @class quickcomment
- */
-QUICKCOMMENT = function(id, rawtext, width, colour) {
-
- /**
- * Quick comment text.
- * @property rawtext
- * @type String
- * @public
- */
- this.rawtext = rawtext || '';
-
- /**
- * ID of the comment
- * @property id
- * @type Int
- * @public
- */
- this.id = id || 0;
-
- /**
- * Width of the comment
- * @property width
- * @type Int
- * @public
- */
- this.width = width || 100;
-
- /**
- * Colour of the comment.
- * @property colour
- * @type String
- * @public
- */
- this.colour = colour || "yellow";
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.quickcomment = QUICKCOMMENT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/quickcommentlist.js b/mod/assign/feedback/editpdf/yui/src/editor/js/quickcommentlist.js
deleted file mode 100644
index 548f67b..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/quickcommentlist.js
+++ /dev/null
@@ -1,200 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a users list of quick comments.
- *
- * @namespace M.assignfeedback_editpdf
- * @class quickcommentlist
- */
-QUICKCOMMENTLIST = function(editor) {
-
- /**
- * Reference to M.assignfeedback_editpdf.editor.
- * @property editor
- * @type M.assignfeedback_editpdf.editor
- * @public
- */
- this.editor = editor;
-
- /**
- * Array of Comments
- * @property shapes
- * @type M.assignfeedback_editpdf.quickcomment[]
- * @public
- */
- this.comments = [];
-
- /**
- * Add a comment to the users quicklist.
- *
- * @protected
- * @method add
- */
- this.add = function(comment) {
- var ajaxurl = AJAXBASE,
- config;
-
- // Do not save empty comments.
- if (comment.rawtext === '') {
- return;
- }
-
- config = {
- method: 'post',
- context: this,
- sync: false,
- data : {
- 'sesskey' : M.cfg.sesskey,
- 'action' : 'addtoquicklist',
- 'userid' : this.editor.get('userid'),
- 'commenttext' : comment.rawtext,
- 'width' : comment.width,
- 'colour' : comment.colour,
- 'attemptnumber' : this.editor.get('attemptnumber'),
- 'assignmentid' : this.editor.get('assignmentid')
- },
- on: {
- success: function(tid, response) {
- var jsondata, quickcomment;
- try {
- jsondata = Y.JSON.parse(response.responseText);
- if (jsondata.error) {
- return new M.core.ajaxException(jsondata);
- } else {
- quickcomment = new M.assignfeedback_editpdf.quickcomment(jsondata.id,
- jsondata.rawtext,
- jsondata.width,
- jsondata.colour);
- this.comments.push(quickcomment);
- }
- } catch (e) {
- return new M.core.exception(e);
- }
- },
- failure: function(tid, response) {
- return M.core.exception(response.responseText);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- };
-
- /**
- * Remove a comment from the users quicklist.
- *
- * @public
- * @method remove
- */
- this.remove = function(comment) {
- var ajaxurl = AJAXBASE,
- config;
-
- // Should not happen.
- if (!comment) {
- return;
- }
-
- config = {
- method: 'post',
- context: this,
- sync: false,
- data : {
- 'sesskey' : M.cfg.sesskey,
- 'action' : 'removefromquicklist',
- 'userid' : this.editor.get('userid'),
- 'commentid' : comment.id,
- 'attemptnumber' : this.editor.get('attemptnumber'),
- 'assignmentid' : this.editor.get('assignmentid')
- },
- on: {
- success: function() {
- var i;
-
- // Find and remove the comment from the quicklist.
- i = this.comments.indexOf(comment);
- if (i >= 0) {
- this.comments.splice(i, 1);
- }
- },
- failure: function(tid, response) {
- return M.core.exception(response.responseText);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- };
-
- /**
- * Load the users quick comments list.
- *
- * @protected
- * @method load_quicklist
- */
- this.load = function() {
- var ajaxurl = AJAXBASE,
- config;
-
- config = {
- method: 'get',
- context: this,
- sync: false,
- data : {
- 'sesskey' : M.cfg.sesskey,
- 'action' : 'loadquicklist',
- 'userid' : this.editor.get('userid'),
- 'attemptnumber' : this.editor.get('attemptnumber'),
- 'assignmentid' : this.editor.get('assignmentid')
- },
- on: {
- success: function(tid, response) {
- var jsondata;
- try {
- jsondata = Y.JSON.parse(response.responseText);
- if (jsondata.error) {
- return new M.core.ajaxException(jsondata);
- } else {
- Y.each(jsondata, function(comment) {
- var quickcomment = new M.assignfeedback_editpdf.quickcomment(comment.id,
- comment.rawtext,
- comment.width,
- comment.colour);
- this.comments.push(quickcomment);
- }, this);
- }
- } catch (e) {
- return new M.core.exception(e);
- }
- },
- failure: function(tid, response) {
- return M.core.exception(response.responseText);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- };
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.quickcommentlist = QUICKCOMMENTLIST;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/rect.js b/mod/assign/feedback/editpdf/yui/src/editor/js/rect.js
deleted file mode 100644
index 01ec89b..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/rect.js
+++ /dev/null
@@ -1,143 +0,0 @@
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle. If not, see .
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * Class representing a 2d rect.
- *
- * @namespace M.assignfeedback_editpdf
- * @param int x
- * @param int y
- * @param int width
- * @param int height
- * @class rect
- */
-RECT = function(x, y, width, height) {
-
- /**
- * X coordinate.
- * @property x
- * @type int
- * @public
- */
- this.x = x;
-
- /**
- * Y coordinate.
- * @property y
- * @type int
- * @public
- */
- this.y = y;
-
- /**
- * Width
- * @property width
- * @type int
- * @public
- */
- this.width = width;
-
- /**
- * Height
- * @property height
- * @type int
- * @public
- */
- this.height = height;
-
- /**
- * Set this rect to represent the smallest possible rectangle containing this list of points.
- * @method bounds
- * @param M.assignfeedback_editpdf.point[]
- * @public
- */
- this.bound = function(points) {
- var minx = 0,
- maxx = 0,
- miny = 0,
- maxy = 0,
- i = 0,
- point;
-
- for (i = 0; i < points.length; i++) {
- point = points[i];
- if (point.x < minx || i === 0) {
- minx = point.x;
- }
- if (point.x > maxx || i === 0) {
- maxx = point.x;
- }
- if (point.y < miny || i === 0) {
- miny = point.y;
- }
- if (point.y > maxy || i === 0) {
- maxy = point.y;
- }
- }
- this.x = minx;
- this.y = miny;
- this.width = maxx - minx;
- this.height = maxy - miny;
- // Allow chaining.
- return this;
- };
-
- /**
- * Checks if rect has min width.
- * @method has_min_width
- * @return bool true if width is more than 5px.
- * @public
- */
- this.has_min_width = function() {
- return (this.width >= 5);
- };
-
- /**
- * Checks if rect has min height.
- * @method has_min_height
- * @return bool true if height is more than 5px.
- * @public
- */
- this.has_min_height = function() {
- return (this.height >= 5);
- };
-
- /**
- * Set min. width of annotation bound.
- * @method set_min_width
- * @public
- */
- this.set_min_width = function() {
- this.width = 5;
- };
-
- /**
- * Set min. height of annotation bound.
- * @method set_min_height
- * @public
- */
- this.set_min_height = function() {
- this.height = 5;
- };
-};
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.rect = RECT;
diff --git a/mod/assign/feedback/editpdf/yui/src/editor/js/stamppicker.js b/mod/assign/feedback/editpdf/yui/src/editor/js/stamppicker.js
deleted file mode 100644
index efc76d1..0000000
--- a/mod/assign/feedback/editpdf/yui/src/editor/js/stamppicker.js
+++ /dev/null
@@ -1,111 +0,0 @@
-var STAMPPICKER_NAME = "Colourpicker",
- STAMPPICKER;
-
-/**
- * Provides an in browser PDF editor.
- *
- * @module moodle-assignfeedback_editpdf-editor
- */
-
-/**
- * This is a drop down list of stamps.
- *
- * @namespace M.assignfeedback_editpdf
- * @class stamppicker
- * @constructor
- * @extends M.assignfeedback_editpdf.dropdown
- */
-STAMPPICKER = function(config) {
- STAMPPICKER.superclass.constructor.apply(this, [config]);
-};
-
-Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
-
- /**
- * Initialise the menu.
- *
- * @method initializer
- * @return void
- */
- initializer : function(config) {
- var stamplist = Y.Node.create('');
-
- // Build a list of stamped buttons.
- Y.each(this.get('stamps'), function(stamp) {
- var button, listitem, title;
-
- title = M.util.get_string('stamp', 'assignfeedback_editpdf');
- button = Y.Node.create(' ');
- button.setAttribute('data-stamp', stamp);
- button.setStyle('backgroundImage', 'none');
- listitem = Y.Node.create(' ');
- listitem.append(button);
- stamplist.append(listitem);
- }, this);
-
-
- // Set the call back.
- stamplist.delegate('click', this.callback_handler, 'button', this);
- stamplist.delegate('key', this.callback_handler, 'down:13', 'button', this);
-
- // Set the accessible header text.
- this.set('headerText', M.util.get_string('stamppicker', 'assignfeedback_editpdf'));
-
- // Set the body content.
- this.set('bodyContent', stamplist);
-
- STAMPPICKER.superclass.initializer.call(this, config);
- },
- callback_handler : function(e) {
- e.preventDefault();
- var callback = this.get('callback'),
- callbackcontext = this.get('context'),
- bind;
-
- this.hide();
-
- // Call the callback with the specified context.
- bind = Y.bind(callback, callbackcontext, e);
-
- bind();
- }
-}, {
- NAME : STAMPPICKER_NAME,
- ATTRS : {
- /**
- * The list of stamps this stamp picker supports.
- *
- * @attribute stamps
- * @type String[] - the stamp filenames.
- * @default {}
- */
- stamps : {
- value : []
- },
-
- /**
- * The function called when a new stamp is chosen.
- *
- * @attribute callback
- * @type function
- * @default null
- */
- callback : {
- value : null
- },
-
- /**
- * The context passed to the callback when a stamp is chosen.
- *
- * @attribute context
- * @type Y.Node
- * @default null
- */
- context : {
- value : null
- }
- }
-});
-
-M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
-M.assignfeedback_editpdf.stamppicker = STAMPPICKER;
diff --git a/mod/assignment/backup/moodle1/lib.php b/mod/assignment/backup/moodle1/lib.php
deleted file mode 100644
index e518e85..0000000
--- a/mod/assignment/backup/moodle1/lib.php
+++ /dev/null
@@ -1,253 +0,0 @@
-.
-
-/**
- * Provides support for the conversion of moodle1 backup to the moodle2 format
- * Based off of a template @ http://docs.moodle.org/dev/Backup_1.9_conversion_for_developers
- *
- * @package mod_assignment
- * @copyright 2011 Aparup Banerjee
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Assignment conversion handler
- */
-class moodle1_mod_assignment_handler extends moodle1_mod_handler {
-
- /** @var moodle1_file_manager */
- protected $fileman = null;
-
- /** @var int cmid */
- protected $moduleid = null;
-
- /** @var string current subplugin being processed*/
- private $currentsubpluginname = null;
-
- /** @var array of a moodle1_assignment_[subplugin_name]_handler instances */
- private $subpluginhandlers = null;
-
- /**
- * Declare the paths in moodle.xml we are able to convert
- *
- * The method returns list of {@link convert_path} instances.
- * For each path returned, the corresponding conversion method must be
- * defined.
- *
- * Note that the path /MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT does not
- * actually exist in the file. The last element with the module name was
- * appended by the moodle1_converter class.
- *
- * @return array of {@link convert_path} instances
- */
- public function get_paths() {
- return array(
- new convert_path(
- 'assignment', '/MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT',
- array(
- 'renamefields' => array(
- 'description' => 'intro',
- 'format' => 'introformat',
- )
- )
- )
- //@todo process user data
- //new convert_path('assignment_submission', '/MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT/SUBMISSIONS/SUBMISSION')
- );
- }
-
- /**
- * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT
- * data available
- */
- public function process_assignment($data) {
- global $CFG;
-
- // get the course module id and context id
- $instanceid = $data['id'];
- $cminfo = $this->get_cminfo($instanceid);
- $this->moduleid = $cminfo['id'];
- $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid);
-
- //store assignment type for possible subplugin conversions.
- $this->currentsubpluginname = $data['assignmenttype'];
-
- // get a fresh new file manager for this instance
- $this->fileman = $this->converter->get_file_manager($contextid, 'mod_assignment');
-
- // convert course files embedded into the intro
- $this->fileman->filearea = 'intro';
- $this->fileman->itemid = 0;
- $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
-
- // convert the introformat if necessary
- if ($CFG->texteditors !== 'textarea') {
- $data['intro'] = text_to_html($data['intro'], false, false, true);
- $data['introformat'] = FORMAT_HTML;
- }
-
- // start writing assignment.xml
- $this->open_xml_writer("activities/assignment_{$this->moduleid}/assignment.xml");
- $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid,
- 'modulename' => 'assignment', 'contextid' => $contextid));
- $this->xmlwriter->begin_tag('assignment', array('id' => $instanceid));
-
- foreach ($data as $field => $value) {
- if ($field <> 'id') {
- $this->xmlwriter->full_tag($field, $value);
- }
- }
-
- //after writing the assignment type element, let the subplugin add on whatever it wants.
- $this->handle_assignment_subplugin($data);
-
- $this->xmlwriter->begin_tag('submissions');
-
- return $data;
- }
-
- /**
- * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/ASSIGNMENT/SUBMISSIONS/SUBMISSION
- * data available
- */
- public function process_assignment_submission($data) {
- //@todo process user data
- //$this->write_xml('submission', $data, array('/submission/id'));
- }
-
- /**
- * This handles calls to subplugin conversion classes.
- * called from within process_assignment()
- */
- public function handle_assignment_subplugin($data) {
- $handler = $this->get_subplugin_handler($this->currentsubpluginname);
- $this->log('Instantiated assignment subplugin handler for '.$this->currentsubpluginname.'.', backup::LOG_DEBUG);
- $handler->use_xml_writer($this->xmlwriter);
-
- $this->log('Processing assignment subplugin handler callback for '.$this->currentsubpluginname.'.', backup::LOG_DEBUG);
- $handler->append_subplugin_data($data);
- }
-
- /**
- * This is executed when we reach the closing tag of our 'assignment' path
- */
- public function on_assignment_end() {
- // finish writing assignment.xml
- $this->xmlwriter->end_tag('submissions');
- $this->xmlwriter->end_tag('assignment');
- $this->xmlwriter->end_tag('activity');
- $this->close_xml_writer();
-
- // write inforef.xml
- $this->open_xml_writer("activities/assignment_{$this->moduleid}/inforef.xml");
- $this->xmlwriter->begin_tag('inforef');
- $this->xmlwriter->begin_tag('fileref');
- foreach ($this->fileman->get_fileids() as $fileid) {
- $this->write_xml('file', array('id' => $fileid));
- }
- $this->xmlwriter->end_tag('fileref');
- $this->xmlwriter->end_tag('inforef');
- $this->close_xml_writer();
- }
-
- /// internal implementation details follow /////////////////////////////////
-
- /**
- * Factory method returning the handler of the given assignment subplugin
- *
- * @param string $subplugin the name of the subplugin
- * @throws moodle1_convert_exception
- * @return moodle1_assignment_subplugin_handler the instance of the handler
- */
- protected function get_subplugin_handler($subplugin) {
- global $CFG; // we include other files here
-
- if (is_null($this->subpluginhandlers)) {
- $this->subpluginhandlers = array();
- $subplugins = core_component::get_plugin_list('assignment');
- foreach ($subplugins as $name => $dir) {
- $handlerfile = $dir.'/backup/moodle1/lib.php';
- $handlerclass = "moodle1_mod_assignment_{$name}_subplugin_handler";
- if (!file_exists($handlerfile)) {
- continue;
- }
- require_once($handlerfile);
-
- if (!class_exists($handlerclass)) {
- throw new moodle1_convert_exception('missing_handler_class', $handlerclass);
- }
- $this->log('preparing assignment subplugin handler', backup::LOG_DEBUG, $handlerclass);
- $this->subpluginhandlers[$name] = new $handlerclass($this, $name);
- if (!$this->subpluginhandlers[$name] instanceof moodle1_assignment_subplugin_handler) {
- throw new moodle1_convert_exception('wrong_handler_class', get_class($this->subpluginhandlers[$name]));
- }
- }
- }
-
- if (!isset($this->subpluginhandlers[$subplugin])) {
- // Generic handling, prevents breaking conversion process...
- $this->subpluginhandlers[$subplugin] = new moodle1_assignment_unsupported_subplugin_handler($this, $subplugin);
- }
-
- return $this->subpluginhandlers[$subplugin];
- }
-}
-
-
-/**
- * Base class for the assignment subplugin handler
- * Extend this for your own subplugin conversion handling purposes.
- */
-abstract class moodle1_assignment_subplugin_handler extends moodle1_submod_handler {
-
- /**
- * @param moodle1_mod_handler $assignmenthandler the handler of a module we are subplugin of
- * @param string $subpluginname the name of the subplugin
- */
- public function __construct(moodle1_mod_handler $assignmenthandler, $subpluginname) {
- parent::__construct($assignmenthandler, 'assignment', $subpluginname);
- }
-
- /**
- * Provides a xml_writer instance to this assignment subplugin type handler
- *
- * @param xml_writer $xmlwriter
- */
- public function use_xml_writer(xml_writer $xmlwriter) {
- $this->xmlwriter = $xmlwriter;
- }
-
- /**
- * a call back (entry point) to the subplugin conversion handler class.
- * $data are the elements of , any (@todo sub paths containing subplugindata isn't handed through).
- */
-
- public function append_subplugin_data($data) {
- // an example that does nothing - you'll do nothing if you don't overide it
- return false;
-
- //you will probably want to do stuff with $this->xmlwriter here (within your overridden method) to write plugin specific data.
- }
-}
-
-/**
- * This class handles subplugins that do not exist or that are not supported
- */
-class moodle1_assignment_unsupported_subplugin_handler extends moodle1_assignment_subplugin_handler {
-}
diff --git a/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php b/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php
deleted file mode 100644
index f2e7268..0000000
--- a/mod/assignment/backup/moodle2/backup_assignment_activity_task.class.php
+++ /dev/null
@@ -1,70 +0,0 @@
-.
-
-/**
- * Defines backup_assignment_activity_task class
- *
- * @package mod_assignment
- * @category backup
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-require_once($CFG->dirroot.'/mod/assignment/backup/moodle2/backup_assignment_stepslib.php');
-
-/**
- * Provides the steps to perform one complete backup of the Assignment instance
- */
-class backup_assignment_activity_task extends backup_activity_task {
-
- /**
- * No specific settings for this activity
- */
- protected function define_my_settings() {
- }
-
- /**
- * Defines a backup step to store the instance data in the assignment.xml file
- */
- protected function define_my_steps() {
- $this->add_step(new backup_assignment_activity_structure_step('assignment_structure', 'assignment.xml'));
- }
-
- /**
- * Encodes URLs to the index.php and view.php scripts
- *
- * @param string $content some HTML text that eventually contains URLs to the activity instance scripts
- * @return string the content with the URLs encoded
- */
- static public function encode_content_links($content) {
- global $CFG;
-
- $base = preg_quote($CFG->wwwroot,"/");
-
- // Link to the list of assignments
- $search="/(".$base."\/mod\/assignment\/index.php\?id\=)([0-9]+)/";
- $content= preg_replace($search, '$@ASSIGNMENTINDEX*$2@$', $content);
-
- // Link to assignment view by moduleid
- $search="/(".$base."\/mod\/assignment\/view.php\?id\=)([0-9]+)/";
- $content= preg_replace($search, '$@ASSIGNMENTVIEWBYID*$2@$', $content);
-
- return $content;
- }
-}
diff --git a/mod/assignment/backup/moodle2/backup_assignment_stepslib.php b/mod/assignment/backup/moodle2/backup_assignment_stepslib.php
deleted file mode 100644
index fcc2296..0000000
--- a/mod/assignment/backup/moodle2/backup_assignment_stepslib.php
+++ /dev/null
@@ -1,87 +0,0 @@
-.
-
-/**
- * @package mod_assignment
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * Define all the backup steps that will be used by the backup_assignment_activity_task
- */
-
-/**
- * Define the complete assignment structure for backup, with file and id annotations
- */
-class backup_assignment_activity_structure_step extends backup_activity_structure_step {
-
- protected function define_structure() {
-
- // To know if we are including userinfo
- $userinfo = $this->get_setting_value('userinfo');
-
- // Define each element separated
- $assignment = new backup_nested_element('assignment', array('id'), array(
- 'name', 'intro', 'introformat', 'assignmenttype',
- 'resubmit', 'preventlate', 'emailteachers', 'var1',
- 'var2', 'var3', 'var4', 'var5',
- 'maxbytes', 'timedue', 'timeavailable', 'grade',
- 'timemodified'));
-
- $submissions = new backup_nested_element('submissions');
-
- $submission = new backup_nested_element('submission', array('id'), array(
- 'userid', 'timecreated', 'timemodified', 'numfiles',
- 'data1', 'data2', 'grade', 'submissioncomment',
- 'format', 'teacher', 'timemarked', 'mailed'));
-
- // Build the tree
-
- // Apply for 'assignment' subplugins optional stuff at assignment level (not multiple)
- // Remember that order is important, try moving this line to the end and compare XML
- $this->add_subplugin_structure('assignment', $assignment, false);
-
- $assignment->add_child($submissions);
- $submissions->add_child($submission);
-
- // Apply for 'assignment' subplugins optional stuff at submission level (not multiple)
- $this->add_subplugin_structure('assignment', $submission, false);
-
- // Define sources
- $assignment->set_source_table('assignment', array('id' => backup::VAR_ACTIVITYID));
-
- // All the rest of elements only happen if we are including user info
- if ($userinfo) {
- $submission->set_source_table('assignment_submissions', array('assignment' => backup::VAR_PARENTID));
- }
-
- // Define id annotations
- $assignment->annotate_ids('scale', 'grade');
- $submission->annotate_ids('user', 'userid');
- $submission->annotate_ids('user', 'teacher');
-
- // Define file annotations
- $assignment->annotate_files('mod_assignment', 'intro', null); // This file area hasn't itemid
- $submission->annotate_files('mod_assignment', 'submission', 'id');
- $submission->annotate_files('mod_assignment', 'response', 'id');
-
- // Return the root element (assignment), wrapped into standard activity structure
- return $this->prepare_activity_structure($assignment);
- }
-}
diff --git a/mod/assignment/backup/moodle2/restore_assignment_activity_task.class.php b/mod/assignment/backup/moodle2/restore_assignment_activity_task.class.php
deleted file mode 100644
index bdfbab0..0000000
--- a/mod/assignment/backup/moodle2/restore_assignment_activity_task.class.php
+++ /dev/null
@@ -1,121 +0,0 @@
-.
-
-/**
- * @package mod_assignment
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-require_once($CFG->dirroot . '/mod/assignment/backup/moodle2/restore_assignment_stepslib.php'); // Because it exists (must)
-
-/**
- * assignment restore task that provides all the settings and steps to perform one
- * complete restore of the activity
- */
-class restore_assignment_activity_task extends restore_activity_task {
-
- /**
- * Define (add) particular settings this activity can have
- */
- protected function define_my_settings() {
- // No particular settings for this activity
- }
-
- /**
- * Define (add) particular steps this activity can have
- */
- protected function define_my_steps() {
- // Choice only has one structure step
- $this->add_step(new restore_assignment_activity_structure_step('assignment_structure', 'assignment.xml'));
- }
-
- /**
- * Define the contents in the activity that must be
- * processed by the link decoder
- */
- static public function define_decode_contents() {
- $contents = array();
-
- $contents[] = new restore_decode_content('assignment', array('intro'), 'assignment');
-
- return $contents;
- }
-
- /**
- * Define the decoding rules for links belonging
- * to the activity to be executed by the link decoder
- */
- static public function define_decode_rules() {
- $rules = array();
-
- $rules[] = new restore_decode_rule('ASSIGNMENTVIEWBYID', '/mod/assignment/view.php?id=$1', 'course_module');
- $rules[] = new restore_decode_rule('ASSIGNMENTINDEX', '/mod/assignment/index.php?id=$1', 'course');
-
- return $rules;
-
- }
-
- /**
- * Define the restore log rules that will be applied
- * by the {@link restore_logs_processor} when restoring
- * assignment logs. It must return one array
- * of {@link restore_log_rule} objects
- */
- static public function define_restore_log_rules() {
- $rules = array();
-
- $rules[] = new restore_log_rule('assignment', 'add', 'view.php?id={course_module}', '{assignment}');
- $rules[] = new restore_log_rule('assignment', 'update', 'view.php?id={course_module}', '{assignment}');
- $rules[] = new restore_log_rule('assignment', 'view', 'view.php?id={course_module}', '{assignment}');
- $rules[] = new restore_log_rule('assignment', 'upload', 'view.php?a={assignment}', '{assignment}');
- $rules[] = new restore_log_rule('assignment', 'view submission', 'submissions.php.php?id={course_module}', '{assignment}');
- $rules[] = new restore_log_rule('assignment', 'update grades', 'submissions.php.php?id={course_module}&user={user}', '{user}');
-
- return $rules;
- }
-
- /**
- * Define the restore log rules that will be applied
- * by the {@link restore_logs_processor} when restoring
- * course logs. It must return one array
- * of {@link restore_log_rule} objects
- *
- * Note this rules are applied when restoring course logs
- * by the restore final task, but are defined here at
- * activity level. All them are rules not linked to any module instance (cmid = 0)
- */
- static public function define_restore_log_rules_for_course() {
- $rules = array();
-
- $rules[] = new restore_log_rule('assignment', 'view all', 'index.php?id={course}', null);
-
- return $rules;
- }
-
- /**
- * Expose the restore mode so we can skip automatic upgrade for MODE_IMPORT (e.g. duplicate).
- *
- * @return int
- */
- public function get_mode() {
- return $this->plan->get_mode();
- }
-}
diff --git a/mod/assignment/backup/moodle2/restore_assignment_stepslib.php b/mod/assignment/backup/moodle2/restore_assignment_stepslib.php
deleted file mode 100644
index 3fbd606..0000000
--- a/mod/assignment/backup/moodle2/restore_assignment_stepslib.php
+++ /dev/null
@@ -1,174 +0,0 @@
-.
-
-/**
- * @package mod_assignment
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * Define all the restore steps that will be used by the restore_assignment_activity_task
- */
-
-/**
- * Structure step to restore one assignment activity
- */
-class restore_assignment_activity_structure_step extends restore_activity_structure_step {
-
- protected function define_structure() {
-
- $paths = array();
- $userinfo = $this->get_setting_value('userinfo');
-
- $assignment = new restore_path_element('assignment', '/activity/assignment');
- $paths[] = $assignment;
-
- // Apply for 'assignment' subplugins optional paths at assignment level
- $this->add_subplugin_structure('assignment', $assignment);
-
- if ($userinfo) {
- $submission = new restore_path_element('assignment_submission', '/activity/assignment/submissions/submission');
- $paths[] = $submission;
- // Apply for 'assignment' subplugins optional stuff at submission level
- $this->add_subplugin_structure('assignment', $submission);
- }
-
- // Return the paths wrapped into standard activity structure
- return $this->prepare_activity_structure($paths);
- }
-
- protected function process_assignment($data) {
- global $DB;
-
- $data = (object)$data;
- $oldid = $data->id;
- $data->course = $this->get_courseid();
-
- $data->timedue = $this->apply_date_offset($data->timedue);
- $data->timeavailable = $this->apply_date_offset($data->timeavailable);
- $data->timemodified = $this->apply_date_offset($data->timemodified);
-
- if ($data->grade < 0) { // scale found, get mapping
- $data->grade = -($this->get_mappingid('scale', abs($data->grade)));
- }
-
- // insert the assignment record
- $newitemid = $DB->insert_record('assignment', $data);
- // immediately after inserting "activity" record, call this
- $this->apply_activity_instance($newitemid);
-
- // Hide unsupported sub-plugins
- if (!$this->is_valid_assignment_subplugin($data->assignmenttype)) {
- $DB->set_field('course_modules', 'visible', 0, array('id' => $this->get_task()->get_moduleid()));
- }
- }
-
- protected function process_assignment_submission($data) {
- global $DB;
-
- $data = (object)$data;
- $oldid = $data->id;
-
- $data->assignment = $this->get_new_parentid('assignment');
- $data->timecreated = $this->apply_date_offset($data->timecreated);
- $data->timemodified = $this->apply_date_offset($data->timemodified);
- $data->timemarked = $this->apply_date_offset($data->timemarked);
-
- $data->userid = $this->get_mappingid('user', $data->userid);
- $data->teacher = $this->get_mappingid('user', $data->teacher);
-
- $newitemid = $DB->insert_record('assignment_submissions', $data);
- $this->set_mapping('assignment_submission', $oldid, $newitemid, true); // Going to have files
- $this->set_mapping(restore_gradingform_plugin::itemid_mapping('submission'), $oldid, $newitemid);
- }
-
- /**
- * This function will attempt to upgrade the newly restored assignment to an instance of mod_assign if
- * mod_assignment is currently disabled and mod_assign is enabled and mod_assign says it can upgrade this assignment.
- *
- * @return none
- */
- private function upgrade_mod_assign() {
- global $DB, $CFG;
-
- // The current module must exist.
- $pluginmanager = core_plugin_manager::instance();
-
- $plugininfo = $pluginmanager->get_plugin_info('mod_assign');
-
- // Check that the assignment module is installed.
- if ($plugininfo && $plugininfo->is_installed_and_upgraded()) {
- // Include the required mod assign upgrade code.
- require_once($CFG->dirroot . '/mod/assign/upgradelib.php');
- require_once($CFG->dirroot . '/mod/assign/locallib.php');
-
- // Get the id and type of this assignment.
- $newinstance = $this->task->get_activityid();
-
- $record = $DB->get_record('assignment', array('id'=>$newinstance), 'assignmenttype', MUST_EXIST);
- $type = $record->assignmenttype;
-
- $subplugininfo = $pluginmanager->get_plugin_info('assignment_' . $type);
-
- // See if it is possible to upgrade.
- if (assign::can_upgrade_assignment($type, $subplugininfo->versiondb)) {
- $assignment_upgrader = new assign_upgrade_manager();
- $log = '';
- $success = $assignment_upgrader->upgrade_assignment($newinstance, $log);
- if (!$success) {
- throw new restore_step_exception('mod_assign_upgrade_failed', $log);
- }
- }
- }
- }
-
- protected function after_execute() {
- // Add assignment related files, no need to match by itemname (just internally handled context)
- $this->add_related_files('mod_assignment', 'intro', null);
- // Add assignment submission files, matching by assignment_submission itemname
- $this->add_related_files('mod_assignment', 'submission', 'assignment_submission');
- $this->add_related_files('mod_assignment', 'response', 'assignment_submission');
- }
-
- /**
- * Hook to execute assignment upgrade after restore.
- */
- protected function after_restore() {
-
- if ($this->get_task()->get_mode() != backup::MODE_IMPORT) {
- // Moodle 2.2 assignment upgrade
- $this->upgrade_mod_assign();
- }
- }
-
- /**
- * Determine if a sub-plugin is supported or not
- *
- * @param string $type
- * @return bool
- */
- protected function is_valid_assignment_subplugin($type) {
- static $subplugins = null;
-
- if (is_null($subplugins)) {
- $subplugins = get_plugin_list('assignment');
- }
- return array_key_exists($type, $subplugins);
- }
-}
diff --git a/mod/assignment/classes/plugininfo/assignment.php b/mod/assignment/classes/plugininfo/assignment.php
deleted file mode 100644
index 656a963..0000000
--- a/mod/assignment/classes/plugininfo/assignment.php
+++ /dev/null
@@ -1,45 +0,0 @@
-.
-
-/**
- * Subplugin info class.
- *
- * @package mod_assignment
- * @copyright 2013 Petr Skoda {@link http://skodak.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-namespace mod_assignment\plugininfo;
-
-use core\plugininfo\base;
-
-defined('MOODLE_INTERNAL') || die();
-
-
-class assignment extends base {
- /**
- * Returns the information about plugin availability
- *
- * True means that the plugin is enabled. False means that the plugin is
- * disabled. Null means that the information is not available, or the
- * plugin does not support configurable availability or the availability
- * can not be changed.
- *
- * @return null|bool
- */
- public function is_enabled() {
- return false;
- }
-}
diff --git a/mod/assignment/db/access.php b/mod/assignment/db/access.php
deleted file mode 100644
index 73d3145..0000000
--- a/mod/assignment/db/access.php
+++ /dev/null
@@ -1,88 +0,0 @@
-.
-
-/**
- * Plugin capabilities
- *
- * @package mod_assignment
- * @copyright 2006 Martin Dougiamas
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$capabilities = array(
-
- 'mod/assignment:view' => array(
-
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'guest' => CAP_ALLOW,
- 'student' => CAP_ALLOW,
- 'teacher' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW
- )
- ),
-
- 'mod/assignment:addinstance' => array(
- 'riskbitmask' => RISK_XSS,
-
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_COURSE,
- 'archetypes' => array(
- 'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW
- ),
- 'clonepermissionsfrom' => 'moodle/course:manageactivities'
- ),
-
- 'mod/assignment:submit' => array(
-
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'student' => CAP_ALLOW
- )
- ),
-
- 'mod/assignment:grade' => array(
- 'riskbitmask' => RISK_XSS,
-
- 'captype' => 'write',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'teacher' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW
- )
- ),
-
- 'mod/assignment:exportownsubmission' => array(
-
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'teacher' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- 'student' => CAP_ALLOW,
- )
- ),
-);
-
-
diff --git a/mod/assignment/db/events.php b/mod/assignment/db/events.php
deleted file mode 100644
index 2655382..0000000
--- a/mod/assignment/db/events.php
+++ /dev/null
@@ -1,33 +0,0 @@
-.
-
-/**
- * Definition of assignment event handlers
- *
- * @package mod_assignment
- * @category event
- * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$handlers = array();
-
-/* List of events thrown from assignment module
-
-assignment_finalize_sent - object course, object user, object cm, object assignment, fileareaname
-assignment_file_sent - object course, object user, object cm, object assignment, object file
-
-*/
\ No newline at end of file
diff --git a/mod/assignment/db/install.php b/mod/assignment/db/install.php
deleted file mode 100644
index e11d9cd..0000000
--- a/mod/assignment/db/install.php
+++ /dev/null
@@ -1,43 +0,0 @@
-.
-
-/**
- * Disable the assignment module for new installs
- *
- * @package mod_assignment
- * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-defined('MOODLE_INTERNAL') || die();
-
-
-/**
- * Code run after the mod_assignment module database tables have been created.
- * Disables this plugin for new installs
- * @return bool
- */
-function xmldb_assignment_install() {
- global $DB;
-
- // do the install
- $DB->set_field('modules', 'visible', '0', array('name'=>'assignment')); // Hide main module
-
- // Should not need to modify course modinfo because this is a new install
-
- return true;
-}
-
-
diff --git a/mod/assignment/db/install.xml b/mod/assignment/db/install.xml
deleted file mode 100644
index a820de3..0000000
--- a/mod/assignment/db/install.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mod/assignment/db/log.php b/mod/assignment/db/log.php
deleted file mode 100644
index 62ca1fa..0000000
--- a/mod/assignment/db/log.php
+++ /dev/null
@@ -1,35 +0,0 @@
-.
-
-/**
- * Definition of log events
- *
- * @package mod_assignment
- * @category log
- * @copyright 2010 Petr Skoda (http://skodak.org)
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$logs = array(
- array('module'=>'assignment', 'action'=>'view', 'mtable'=>'assignment', 'field'=>'name'),
- array('module'=>'assignment', 'action'=>'add', 'mtable'=>'assignment', 'field'=>'name'),
- array('module'=>'assignment', 'action'=>'update', 'mtable'=>'assignment', 'field'=>'name'),
- array('module'=>'assignment', 'action'=>'view submission', 'mtable'=>'assignment', 'field'=>'name'),
- array('module'=>'assignment', 'action'=>'upload', 'mtable'=>'assignment', 'field'=>'name'),
-);
\ No newline at end of file
diff --git a/mod/assignment/db/messages.php b/mod/assignment/db/messages.php
deleted file mode 100644
index 3d80758..0000000
--- a/mod/assignment/db/messages.php
+++ /dev/null
@@ -1,32 +0,0 @@
-.
-
-/**
- * Defines message providers (types of messages being sent)
- *
- * @package mod_assignment
- * @copyright 2010 onwards Aparup Banerjee http://moodle.com
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$messageproviders = array (
-
-/// Ordinary single forum posts
- 'assignment_updates' => array (
- )
-
-);
diff --git a/mod/assignment/db/subplugins.php b/mod/assignment/db/subplugins.php
deleted file mode 100644
index 52e3b41..0000000
--- a/mod/assignment/db/subplugins.php
+++ /dev/null
@@ -1,3 +0,0 @@
-'mod/assignment/type');
diff --git a/mod/assignment/db/upgrade.php b/mod/assignment/db/upgrade.php
deleted file mode 100644
index 49293ac..0000000
--- a/mod/assignment/db/upgrade.php
+++ /dev/null
@@ -1,131 +0,0 @@
-get_manager();
-
- // Moodle v2.2.0 release upgrade line
- // Put any upgrade step following this
-
- // Moodle v2.3.0 release upgrade line
- // Put any upgrade step following this
-
-
- if ($oldversion < 2012061701) {
- // Fixed/updated numfiles field in assignment_submissions table to count the actual
- // number of files has been uploaded when sendformarking is disabled
- upgrade_set_timeout(600); // increase excution time for in large sites
- $fs = get_file_storage();
-
- // Fetch the moduleid for use in the course_modules table
- $moduleid = $DB->get_field('modules', 'id', array('name' => 'assignment'), MUST_EXIST);
-
- $selectcount = 'SELECT COUNT(s.id) ';
- $select = 'SELECT s.id, cm.id AS cmid ';
- $query = 'FROM {assignment_submissions} s
- JOIN {assignment} a ON a.id = s.assignment
- JOIN {course_modules} cm ON a.id = cm.instance AND cm.module = :moduleid
- WHERE assignmenttype = :assignmenttype';
-
- $params = array('moduleid' => $moduleid, 'assignmenttype' => 'upload');
-
- $countsubmissions = $DB->count_records_sql($selectcount.$query, $params);
- $submissions = $DB->get_recordset_sql($select.$query, $params);
-
- $pbar = new progress_bar('assignmentupgradenumfiles', 500, true);
- $i = 0;
- foreach ($submissions as $sub) {
- $i++;
- if ($context = context_module::instance($sub->cmid)) {
- $sub->numfiles = count($fs->get_area_files($context->id, 'mod_assignment', 'submission', $sub->id, 'sortorder', false));
- $DB->update_record('assignment_submissions', $sub);
- }
- $pbar->update($i, $countsubmissions, "Counting files of submissions ($i/$countsubmissions)");
- }
- $submissions->close();
-
- // assignment savepoint reached
- upgrade_mod_savepoint(true, 2012061701, 'assignment');
- }
-
- // Moodle v2.4.0 release upgrade line
- // Put any upgrade step following this
-
-
- // Moodle v2.5.0 release upgrade line.
- // Put any upgrade step following this.
-
-
- // Moodle v2.6.0 release upgrade line.
- // Put any upgrade step following this.
-
- if ($oldversion < 2013121900) {
- // Define table assignment_upgrade to be created.
- $table = new xmldb_table('assignment_upgrade');
-
- // Adding fields to table assignment_upgrade.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('oldcmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('oldinstance', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('newcmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('newinstance', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
-
- // Adding keys to table assignment_upgrade.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table assignment_upgrade.
- $table->add_index('oldcmid', XMLDB_INDEX_NOTUNIQUE, array('oldcmid'));
- $table->add_index('oldinstance', XMLDB_INDEX_NOTUNIQUE, array('oldinstance'));
-
- // Conditionally launch create table for assignment_upgrade.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- if ($module = $DB->get_record("modules", array("name" => "assignment"))) {
- $DB->set_field("modules", "visible", "0", array("id" => $module->id)); // Hide module.
- }
-
- $count = $DB->count_records('assignment');
- if ($count) {
- mod_assignment_pending_upgrades_notification($count);
- }
-
- // Assignment savepoint reached.
- upgrade_mod_savepoint(true, 2013121900, 'assignment');
- }
-
- // Moodle v2.7.0 release upgrade line.
- // Put any upgrade step following this.
-
- // Moodle v2.8.0 release upgrade line.
- // Put any upgrade step following this.
-
- return true;
-}
-
-
diff --git a/mod/assignment/db/upgradelib.php b/mod/assignment/db/upgradelib.php
deleted file mode 100644
index d245d35..0000000
--- a/mod/assignment/db/upgradelib.php
+++ /dev/null
@@ -1,54 +0,0 @@
-.
-
-/**
- * Assignment upgrade script.
- *
- * @package mod_assignment
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Inform admins about assignments that still need upgrading.
- */
-function mod_assignment_pending_upgrades_notification($count) {
- $admins = get_admins();
-
- if (empty($admins)) {
- return;
- }
-
- $a = new stdClass;
- $a->count = $count;
- $a->docsurl = get_docs_url('Assignment_upgrade_tool');
- foreach ($admins as $admin) {
- $message = new stdClass();
- $message->component = 'moodle';
- $message->name = 'notices';
- $message->userfrom = \core_user::get_noreply_user();
- $message->userto = $admin;
- $message->smallmessage = get_string('pendingupgrades_message_small', 'mod_assignment');
- $message->subject = get_string('pendingupgrades_message_subject', 'mod_assignment');
- $message->fullmessage = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
- $message->fullmessagehtml = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
- $message->fullmessageformat = FORMAT_PLAIN;
- $message->notification = 1;
- message_send($message);
- }
-}
diff --git a/mod/assignment/index.php b/mod/assignment/index.php
deleted file mode 100644
index 9108cf6..0000000
--- a/mod/assignment/index.php
+++ /dev/null
@@ -1,8 +0,0 @@
- $id)));
diff --git a/mod/assignment/lang/en/assignment.php b/mod/assignment/lang/en/assignment.php
deleted file mode 100644
index 76fd709..0000000
--- a/mod/assignment/lang/en/assignment.php
+++ /dev/null
@@ -1,47 +0,0 @@
-.
-
-/**
- * Strings for component 'assignment', language 'en', branch 'MOODLE_20_STABLE'
- *
- * @package mod_assignment
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['assignment:addinstance'] = 'Add a new assignment';
-$string['assignment:exportownsubmission'] = 'Export own submission';
-$string['assignment:exportsubmission'] = 'Export submission';
-$string['assignment:grade'] = 'Grade assignment';
-$string['assignment:submit'] = 'Submit assignment';
-$string['assignment:view'] = 'View assignment';
-$string['assignmentneedsupgrade'] = 'The legacy "Assignment 2.2" activity has been disabled. Please request that your site administrator runs the assignment upgrade tool for all legacy assignments in this site.';
-$string['messageprovider:assignment_updates'] = 'Assignment (2.2) notifications';
-$string['assignmentdisabled'] = 'The legacy "Assignment 2.2" activity is disabled.';
-$string['modulename'] = 'Assignment 2.2 (Disabled)';
-$string['modulename_help'] = 'Legacy activity module that has been removed from Moodle.';
-$string['modulenameplural'] = 'Assignments 2.2 (Disabled)';
-$string['page-mod-assignment-x'] = 'Any assignment module page';
-$string['page-mod-assignment-view'] = 'Assignment module main page';
-$string['page-mod-assignment-submissions'] = 'Assignment module submission page';
-$string['pluginname'] = 'Assignment 2.2 (Disabled)';
-$string['upgradenotification'] = 'This activity is based on an older assignment module.';
-$string['viewassignmentupgradetool'] = 'View the assignment upgrade tool';
-$string['pendingupgrades_message_small'] = 'This plugin has been disabled. All remaining assignments must be upgraded to the new assignment module using the assignment upgrade tool.';
-$string['pendingupgrades_message_subject'] = 'Important information regarding Assignment 2.2';
-$string['pendingupgrades_message_content'] = 'As part of the upgrade to Moodle 2.7, the legacy Assignment 2.2 activity has been disabled. Backups from the legacy Assignment 2.2 activity will seamlessly restore to the newer Assignment activity. All remaining instances of the legacy Assignment 2.2 activity must be upgraded using the assignment upgrade tool {$a->docsurl}. There are {$a->count} instances of the legacy Assignment 2.2 activity on this site that require upgrading. Users will not be able to access the content of these activities until they have been upgraded.';
-$string['pluginadministration'] = 'Assignment 2.2 (Disabled) administration';
diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php
deleted file mode 100644
index 9b12586..0000000
--- a/mod/assignment/lib.php
+++ /dev/null
@@ -1,93 +0,0 @@
-.
-
-/**
- * assignment_base is the base class for assignment types
- *
- * This class provides all the functionality for an assignment
- *
- * @package mod_assignment
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * Adds an assignment instance
- *
- * Only used by generators so we can create old assignments to test the upgrade.
- *
- * @param stdClass $assignment
- * @param mod_assignment_mod_form $mform
- * @return int intance id
- */
-function assignment_add_instance($assignment, $mform = null) {
- global $DB;
-
- $assignment->timemodified = time();
- $assignment->courseid = $assignment->course;
- $returnid = $DB->insert_record("assignment", $assignment);
- $assignment->id = $returnid;
- return $returnid;
-}
-
-/**
- * Deletes an assignment instance
- *
- * @param $id
- */
-function assignment_delete_instance($id){
- global $CFG, $DB;
-
- if (! $assignment = $DB->get_record('assignment', array('id'=>$id))) {
- return false;
- }
-
- $result = true;
- // Now get rid of all files
- $fs = get_file_storage();
- if ($cm = get_coursemodule_from_instance('assignment', $assignment->id)) {
- $context = context_module::instance($cm->id);
- $fs->delete_area_files($context->id);
- }
-
- if (! $DB->delete_records('assignment_submissions', array('assignment'=>$assignment->id))) {
- $result = false;
- }
-
- if (! $DB->delete_records('event', array('modulename'=>'assignment', 'instance'=>$assignment->id))) {
- $result = false;
- }
-
- if (! $DB->delete_records('assignment', array('id'=>$assignment->id))) {
- $result = false;
- }
-
- grade_update('mod/assignment', $assignment->course, 'mod', 'assignment', $assignment->id, 0, NULL, array('deleted'=>1));
-
- return $result;
-}
-
-/**
- * @param string $feature FEATURE_xx constant for requested feature
- * @return mixed True if module supports feature, null if doesn't know
- */
-function assignment_supports($feature) {
- switch($feature) {
- case FEATURE_BACKUP_MOODLE2: return true;
-
- default: return null;
- }
-}
diff --git a/mod/assignment/mod_form.php b/mod/assignment/mod_form.php
deleted file mode 100644
index f554e81..0000000
--- a/mod/assignment/mod_form.php
+++ /dev/null
@@ -1,48 +0,0 @@
-.
-
-/**
- * This file contains the forms to create and edit an instance of this module
- *
- * @package mod_assignment
- * @copyright 2007 Petr Skoda
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
-
-require_once($CFG->dirroot.'/course/moodleform_mod.php');
-
-/**
- * Disabled assignment settings form.
- *
- * @package mod_assignment
- * @copyright 2013 Damyon Wiese
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class mod_assignment_mod_form extends moodleform_mod {
-
- /**
- * Called to define this moodle form
- *
- * @return void
- */
- public function definition() {
- print_error('assignmentdisabled', 'assignment');
- }
-
-
-}
diff --git a/mod/assignment/pix/icon.gif b/mod/assignment/pix/icon.gif
deleted file mode 100644
index 0828117..0000000
Binary files a/mod/assignment/pix/icon.gif and /dev/null differ
diff --git a/mod/assignment/pix/icon.png b/mod/assignment/pix/icon.png
deleted file mode 100644
index 697ddc4..0000000
Binary files a/mod/assignment/pix/icon.png and /dev/null differ
diff --git a/mod/assignment/pix/icon.svg b/mod/assignment/pix/icon.svg
deleted file mode 100644
index 41a7889..0000000
--- a/mod/assignment/pix/icon.svg
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mod/assignment/tests/generator/lib.php b/mod/assignment/tests/generator/lib.php
deleted file mode 100644
index ce10386..0000000
--- a/mod/assignment/tests/generator/lib.php
+++ /dev/null
@@ -1,54 +0,0 @@
-.
-
-/**
- * mod_assignment data generator
- *
- * @package mod_assignment
- * @category test
- * @copyright 2012 Petr Skoda {@link http://skodak.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-
-/**
- * Assignment module data generator class
- *
- * @package mod_assignment
- * @category test
- * @copyright 2012 Petr Skoda {@link http://skodak.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class mod_assignment_generator extends testing_module_generator {
-
- public function create_instance($record = null, array $options = null) {
- $record = (object)(array)$record;
-
- if (!isset($record->assignmenttype)) {
- $record->assignmenttype = 'upload';
- }
- if (!isset($record->grade)) {
- $record->grade = 100;
- }
- if (!isset($record->timedue)) {
- $record->timedue = 0;
- }
-
- return parent::create_instance($record, (array)$options);
- }
-}
diff --git a/mod/assignment/type/offline/backup/moodle1/lib.php b/mod/assignment/type/offline/backup/moodle1/lib.php
deleted file mode 100644
index 12ca3e3..0000000
--- a/mod/assignment/type/offline/backup/moodle1/lib.php
+++ /dev/null
@@ -1,33 +0,0 @@
-.
-
-/**
- * @package assignment_offline
- * @copyright 2011 onwards Aparup Banerjee (nebgor)
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * A dummy class for offline conversions.
- * The offline subplugin doesn't really need anything converted.
- * See the moodle1_assignment_subplugin_handler class.
- */
-class moodle1_mod_assignment_offline_subplugin_handler extends moodle1_assignment_subplugin_handler {
- /**
- * Override the append_subplugin_data($data) method here for plugin specific processing.
- */
-}
diff --git a/mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php b/mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php
deleted file mode 100644
index cd6ac97..0000000
--- a/mod/assignment/type/offline/backup/moodle2/backup_assignment_offline_subplugin.class.php
+++ /dev/null
@@ -1,112 +0,0 @@
-.
-
-/**
- * @package assignment_offline
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * backup subplugin class that provides the necessary information
- * needed to backup one assignment->offline subplugin.
- *
- * Note: Offline assignments really haven't any special subplugin
- * information to backup/restore, hence code below is skipped (return false)
- * but it's a good example of sublugins supported at different
- * elements (assignment and submission) and conditions
- */
-class backup_assignment_offline_subplugin extends backup_subplugin {
-
- /**
- * Returns the subplugin information to attach at assignment element
- */
- protected function define_assignment_subplugin_structure() {
-
- return false; // This subplugin backup is only one example. Skip it.
-
- /**
- * Any activity sublugins is always rooted by one backup_subplugin_element()
- * Those elements have some unique characteristics:
- * - They are, basically, backup_nested_elements
- * - They cannot have attributes
- * - They don't have XML representations (only their final/child elements have
- * - They are able to specify one condition in order to decide if the subplugin
- * must be processed or no (usually we'll put the "type" condition here, but some
- * activities, may prefer not to use any condition, see workshop)
- */
-
- /**
- * Here we are defining the information that will be attached, within the "assignment" element
- * when assignments of type "offline" are sent to backup, so we define the backup_subplugin_element
- * as not having any final element (null) and with the condition of the '/assignment/assignmenttype'
- * being 'offline' (that will be checked on execution)
- *
- * Note that, while, we allow direct "injection" of final_elements at the "assignment" level (without
- * any nesting, we usually pass 'null', and later enclose the real subplugin information into deeper
- * levels (get_recommended_name() and 'config' in the example below). That will make things
- * on restore easier, as far as subplugin information will be clearly separated from module information.
- */
- $subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline');
-
- /**
- * Here we define the real structure the subplugin is going to generate - see note above. Obviously the
- * example below hasn't sense at all, we are exporting the whole config table that is 100% unrelated
- * with assignments. Take it as just one example. The only important bit is that it's highly recommended to
- * use some exclusive name in the main nested element (something that won't conflict with other subplugins/parts).
- * So we are using 'subplugin_assignment_offline_assignment' as name here (the type of the subplugin, the name of the
- * subplugin and the name of the connection point). get_recommended_name() will help, in any case ;-)
- *
- * All the code below is 100% standard backup structure code, so you define the structure, the sources,
- * annotations... whatever you need
- */
- $assassoff = new backup_nested_element($this->get_recommended_name());
- $config = new backup_nested_element('config', null, array('name', 'value'));
-
- $subplugin->add_child($assassoff);
- $assassoff->add_child($config);
-
- $config->set_source_table('config', array('id' => '/assignment/id'));
-
- return $subplugin; // And we return the root subplugin element
- }
-
- /**
- * Returns the subplugin information to attach at submission element
- */
- protected function define_submission_subplugin_structure() {
-
- return false; // This subplugin backup is only one example. Skip it.
-
- // remember this has not XML representation
- $subplugin = $this->get_subplugin_element(null, '/assignment/assignmenttype', 'offline');
-
- // type of the subplugin, name of the subplugin and name of the connection point (recommended)
- $asssuboff = new backup_nested_element($this->get_recommended_name());
- // Why 'submission_config' name? Because it must be unique in the hierarchy and we
- // already are using 'config' above withing the same file
- $config = new backup_nested_element('submission_config', null, array('name', 'value'));
-
- $subplugin->add_child($asssuboff);
- $asssuboff->add_child($config);
-
- $config->set_source_table('config', array('id' => backup::VAR_PARENTID));
-
- return $subplugin; // And we return the root subplugin element
- }
-}
diff --git a/mod/assignment/type/offline/backup/moodle2/restore_assignment_offline_subplugin.class.php b/mod/assignment/type/offline/backup/moodle2/restore_assignment_offline_subplugin.class.php
deleted file mode 100644
index 952abf2..0000000
--- a/mod/assignment/type/offline/backup/moodle2/restore_assignment_offline_subplugin.class.php
+++ /dev/null
@@ -1,95 +0,0 @@
-.
-
-/**
- * @package assignment_offline
- * @subpackage backup-moodle2
- * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * restore subplugin class that provides the necessary information
- * needed to restore one assignment->offline subplugin.
- *
- * Note: Offline assignments really haven't any special subplugin
- * information to backup/restore, hence code below is skipped (return false)
- * but it's a good example of subplugins supported at different
- * elements (assignment and submission)
- */
-class restore_assignment_offline_subplugin extends restore_subplugin {
-
- /**
- * Returns the paths to be handled by the subplugin at assignment level
- */
- protected function define_assignment_subplugin_structure() {
-
- return false; // This subplugin restore is only one example. Skip it.
-
- $paths = array();
-
- $elename = $this->get_namefor('config');
- $elepath = $this->get_pathfor('/config'); // because we used get_recommended_name() in backup this works
- $paths[] = new restore_path_element($elename, $elepath);
-
- return $paths; // And we return the interesting paths
- }
-
- /**
- * Returns the paths to be handled by the subplugin at submission level
- */
- protected function define_submission_subplugin_structure() {
-
- return false; // This subplugin restore is only one example. Skip it.
-
- $paths = array();
-
- $elename = $this->get_namefor('submission_config');
- $elepath = $this->get_pathfor('/submission_config'); // because we used get_recommended_name() in backup this works
- $paths[] = new restore_path_element($elename, $elepath);
-
- return $paths; // And we return the interesting paths
- }
-
- /**
- * This method processes the config element inside one offline assignment (see offline subplugin backup)
- */
- public function process_assignment_offline_config($data) {
- $data = (object)$data;
- print_object($data); // Nothing to do, just print the data
-
- // Just to check that the whole API is available here
- $this->set_mapping('assignment_offline_config', 1, 1, true);
- $this->add_related_files('mod_assignment', 'intro', 'assignment_offline_config');
- print_object($this->get_mappingid('assignment_offline_config', 1));
- print_object($this->get_old_parentid('assignment'));
- print_object($this->get_new_parentid('assignment'));
- print_object($this->get_mapping('assignment', $this->get_old_parentid('assignment')));
- print_object($this->apply_date_offset(1));
- print_object($this->task->get_courseid());
- print_object($this->task->get_contextid());
- print_object($this->get_restoreid());
- }
-
- /**
- * This method processes the submission_config element inside one offline assignment (see offline subplugin backup)
- */
- public function process_assignment_offline_submission_config($data) {
- $data = (object)$data;
- print_object($data); // Nothing to do, just print the data
- }
-}
diff --git a/mod/assignment/type/offline/lang/en/assignment_offline.php b/mod/assignment/type/offline/lang/en/assignment_offline.php
deleted file mode 100644
index 4f25729..0000000
--- a/mod/assignment/type/offline/lang/en/assignment_offline.php
+++ /dev/null
@@ -1,25 +0,0 @@
-.
-
-/**
- * Strings for component 'assignment_offline', language 'en', branch 'master'
- *
- * @package assignment_offline
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['pluginname'] = 'Offline';
diff --git a/mod/assignment/type/offline/version.php b/mod/assignment/type/offline/version.php
deleted file mode 100644
index c1376c0..0000000
--- a/mod/assignment/type/offline/version.php
+++ /dev/null
@@ -1,29 +0,0 @@
-.
-
-/**
- * Version details
- *
- * @package assignment_offline
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2014110400; // Requires this Moodle version
-$plugin->component = 'assignment_offline'; // Full name of the plugin (used for diagnostics)
diff --git a/mod/assignment/type/online/backup/moodle1/lib.php b/mod/assignment/type/online/backup/moodle1/lib.php
deleted file mode 100644
index 73a9562..0000000
--- a/mod/assignment/type/online/backup/moodle1/lib.php
+++ /dev/null
@@ -1,33 +0,0 @@
-.
-
-/**
- * @package assignment_online
- * @copyright 2011 onwards Aparup Banerjee (nebgor)
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * A dummy class for online conversions.
- * The online subplugin doesn't really need anything converted.
- * See the moodle1_assignment_subplugin_handler class.
- */
-class moodle1_mod_assignment_online_subplugin_handler extends moodle1_assignment_subplugin_handler {
- /**
- * Override the append_subplugin_data($data) method here for plugin specific processing.
- */
-}
diff --git a/mod/assignment/type/online/lang/en/assignment_online.php b/mod/assignment/type/online/lang/en/assignment_online.php
deleted file mode 100644
index 1b1b604..0000000
--- a/mod/assignment/type/online/lang/en/assignment_online.php
+++ /dev/null
@@ -1,26 +0,0 @@
-.
-
-/**
- * Strings for component 'assignment_online', language 'en', branch 'master'
- *
- * @package assignment_online
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['event_assessable_uploaded'] = 'An online text has been uploaded.';
-$string['pluginname'] = 'Online';
diff --git a/mod/assignment/type/online/version.php b/mod/assignment/type/online/version.php
deleted file mode 100644
index a045fcb..0000000
--- a/mod/assignment/type/online/version.php
+++ /dev/null
@@ -1,29 +0,0 @@
-.
-
-/**
- * Version details
- *
- * @package assignment_online
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2014110400; // Requires this Moodle version
-$plugin->component = 'assignment_online'; // Full name of the plugin (used for diagnostics)
diff --git a/mod/assignment/type/upgrade.txt b/mod/assignment/type/upgrade.txt
deleted file mode 100644
index 0166a1b..0000000
--- a/mod/assignment/type/upgrade.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This file describes changes in the assignment type API and DB structures.
-Information provided here is intended especially for developers.
-
-=== 2.7 ===
-
-mod_assignment has been deleted. Do not use it.
diff --git a/mod/assignment/type/upload/backup/moodle1/lib.php b/mod/assignment/type/upload/backup/moodle1/lib.php
deleted file mode 100644
index 57cf4db..0000000
--- a/mod/assignment/type/upload/backup/moodle1/lib.php
+++ /dev/null
@@ -1,33 +0,0 @@
-.
-
-/**
- * @package assignment_upload
- * @copyright 2011 onwards Aparup Banerjee (nebgor)
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * A dummy class for upload conversions.
- * The upload subplugin doesn't really need anything converted.
- * See the moodle1_assignment_subplugin_handler class.
- */
-class moodle1_mod_assignment_upload_subplugin_handler extends moodle1_assignment_subplugin_handler {
- /**
- * Override the append_subplugin_data($data) method here for plugin specific processing.
- */
-}
diff --git a/mod/assignment/type/upload/lang/en/assignment_upload.php b/mod/assignment/type/upload/lang/en/assignment_upload.php
deleted file mode 100644
index dc34e67..0000000
--- a/mod/assignment/type/upload/lang/en/assignment_upload.php
+++ /dev/null
@@ -1,27 +0,0 @@
-.
-
-/**
- * Strings for component 'assignment_upload', language 'en', branch 'master'
- *
- * @package assignment_upload
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['event_assessable_submitted'] = 'An upload submission has been submitted.';
-$string['event_assessable_uploaded'] = 'A file has been uploaded.';
-$string['pluginname'] = 'Upload';
diff --git a/mod/assignment/type/upload/version.php b/mod/assignment/type/upload/version.php
deleted file mode 100644
index 29c4b7b..0000000
--- a/mod/assignment/type/upload/version.php
+++ /dev/null
@@ -1,29 +0,0 @@
-.
-
-/**
- * Version details
- *
- * @package assignment_upload
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2014110400; // Requires this Moodle version
-$plugin->component = 'assignment_upload'; // Full name of the plugin (used for diagnostics)
diff --git a/mod/assignment/type/uploadsingle/backup/moodle1/lib.php b/mod/assignment/type/uploadsingle/backup/moodle1/lib.php
deleted file mode 100644
index 62e9322..0000000
--- a/mod/assignment/type/uploadsingle/backup/moodle1/lib.php
+++ /dev/null
@@ -1,33 +0,0 @@
-.
-
-/**
- * @package assignment_uploadsingle
- * @copyright 2011 onwards Aparup Banerjee (nebgor)
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * A dummy class for uploadsingle conversions.
- * The uploadsingle subplugin doesn't really need anything converted.
- * See the moodle1_assignment_subplugin_handler class.
- */
-class moodle1_mod_assignment_uploadsingle_subplugin_handler extends moodle1_assignment_subplugin_handler {
- /**
- * Override the append_subplugin_data($data) method here for plugin specific processing.
- */
-}
diff --git a/mod/assignment/type/uploadsingle/lang/en/assignment_uploadsingle.php b/mod/assignment/type/uploadsingle/lang/en/assignment_uploadsingle.php
deleted file mode 100644
index 15afd1b..0000000
--- a/mod/assignment/type/uploadsingle/lang/en/assignment_uploadsingle.php
+++ /dev/null
@@ -1,25 +0,0 @@
-.
-
-/**
- * Strings for component 'assignment_uploadsingle', language 'en', branch 'master'
- *
- * @package assignment_uploadsingle
- * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['pluginname'] = 'Upload single';
diff --git a/mod/assignment/type/uploadsingle/version.php b/mod/assignment/type/uploadsingle/version.php
deleted file mode 100644
index b653975..0000000
--- a/mod/assignment/type/uploadsingle/version.php
+++ /dev/null
@@ -1,29 +0,0 @@
-.
-
-/**
- * Version details
- *
- * @package assignment_uploadsingle
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2014110400; // Requires this Moodle version
-$plugin->component = 'assignment_uploadsingle'; // Full name of the plugin (used for diagnostics)
diff --git a/mod/assignment/version.php b/mod/assignment/version.php
deleted file mode 100644
index fd39e95..0000000
--- a/mod/assignment/version.php
+++ /dev/null
@@ -1,30 +0,0 @@
-.
-
-/**
- * Version information
- *
- * @package mod_assignment
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2014111000; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2014110400; // Requires this Moodle version
-$plugin->component = 'mod_assignment'; // Full name of the plugin (used for diagnostics)
-$plugin->cron = 60;
diff --git a/mod/assignment/view.php b/mod/assignment/view.php
deleted file mode 100644
index a83188b..0000000
--- a/mod/assignment/view.php
+++ /dev/null
@@ -1,31 +0,0 @@
-set_context(context_system::instance());
-
-if (!$id && !$a) {
- print_error('invalidcoursemodule');
-}
-
-$mapping = null;
-if ($id) {
- $mapping = $DB->get_record('assignment_upgrade', array('oldcmid' => $id), '*', IGNORE_MISSING);
-} else {
- $mapping = $DB->get_record('assignment_upgrade', array('oldinstance' => $a), '*', IGNORE_MISSING);
-}
-
-if (!$mapping) {
- $url = '';
- if (has_capability('moodle/site:config', context_system::instance())) {
- $url = new moodle_url('/admin/tool/assignmentupgrade/listnotupgraded.php');
- }
- print_error('assignmentneedsupgrade', 'assignment', $url);
-}
-
-$url = new moodle_url('/mod/assign/view.php', array('id' => $mapping->newcmid));
-redirect($url);