MDL-21249 + MDL-16089 finalizing the mod/page module

This commit is contained in:
Petr Skoda 2010-07-15 15:45:20 +00:00
parent 44b64a5683
commit 2c49daf789
14 changed files with 79 additions and 52 deletions

View File

@ -16,12 +16,14 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package moodlecore
* @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
* @package mod
* @subpackage page
* @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/page/backup/moodle2/backup_page_stepslib.php'); // Because it exists (must)
/**

View File

@ -16,12 +16,14 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package moodlecore
* @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
* @package mod
* @subpackage page
* @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;
/**
* Define all the backup steps that will be used by the backup_page_activity_task
*/

View File

@ -18,11 +18,14 @@
/**
* Page module capability definition
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$capabilities = array(
/* TODO: review public portfolio API first!
'mod/page:portfolioexport' => array(

View File

@ -23,11 +23,14 @@
* - lib.php/modulename_install() post installation hook
* - partially defaults.php
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
function xmldb_page_install() {
global $CFG;

View File

@ -38,11 +38,14 @@
* Please do not forget to use upgrade_set_timeout()
* before any action that may take longer time to finish.
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
function xmldb_page_upgrade($oldversion) {
global $CFG, $DB;
require_once("$CFG->dirroot/mod/page/db/upgradelib.php");

View File

@ -18,11 +18,14 @@
/**
* Folder module upgrade related helper functions
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
/**
* Migrate page module data from 1.9 resource_old table to new page table
* @return void

View File

@ -18,9 +18,10 @@
/**
* List of all pages in course
*
* @package mod-page
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../config.php');

View File

@ -16,11 +16,14 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in Page module
* @param string $feature FEATURE_xx constant for requested feature
@ -285,7 +288,7 @@ function page_get_file_areas($course, $cm, $context) {
}
/**
* File browsing support for page module ontent area.
* File browsing support for page module content area.
* @param object $browser
* @param object $areas
* @param object $course
@ -337,7 +340,7 @@ function page_get_file_info($browser, $areas, $course, $cm, $context, $filearea,
* @param string $filearea
* @param array $args
* @param bool $forcedownload
* @return bool false if file not found, does not return if found - justsend the file
* @return bool false if file not found, does not return if found - just send the file
*/
function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) {
global $CFG, $DB;
@ -378,7 +381,7 @@ function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
/**
* This function extends the global navigaiton for the site.
* This function extends the global navigation for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
@ -386,7 +389,7 @@ function page_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
* @param navigation_node $navigation The page node within the global navigation
* @param stdClass $course The course object returned from the DB
* @param stdClass $module The module object returned from the DB
* @param stdClass $cm The course module isntance returned from the DB
* @param stdClass $cm The course module instance returned from the DB
*/
function page_extend_navigation($navigation, $course, $module, $cm) {
/**

View File

@ -18,11 +18,14 @@
/**
* Private page module utility functions
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once("$CFG->libdir/filelib.php");
require_once("$CFG->libdir/resourcelib.php");
require_once("$CFG->dirroot/mod/page/lib.php");
@ -47,5 +50,6 @@ class page_content_file_info extends file_info_stored {
}
function page_get_editor_options($context) {
return array('subdirs'=>1, 'maxbytes'=>0, 'maxfiles'=>-1, 'changeformat'=>1, 'context'=>$context, 'noclean'=>1, 'trusttext'=>0);
global $CFG;
return array('subdirs'=>1, 'maxbytes'=>$CFG->maxbytes, 'maxfiles'=>-1, 'changeformat'=>1, 'context'=>$context, 'noclean'=>1, 'trusttext'=>0);
}

View File

@ -18,14 +18,13 @@
/**
* Page configuration form
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot.'/course/moodleform_mod.php');
require_once($CFG->dirroot.'/mod/page/locallib.php');
@ -34,7 +33,8 @@ require_once($CFG->libdir.'/filelib.php');
class mod_page_mod_form extends moodleform_mod {
function definition() {
global $CFG, $DB;
$mform =& $this->_form;
$mform = $this->_form;
$config = get_config('page');
@ -52,7 +52,6 @@ class mod_page_mod_form extends moodleform_mod {
//-------------------------------------------------------
$mform->addElement('header', 'contentsection', get_string('contentheader', 'page'));
$mform->addElement('editor', 'page', get_string('content', 'page'), null, page_get_editor_options($this->context));
$mform->addElement('static', 'note', '', '<i>(TODO: The format switching is not implemented yet, sorry...)</i>');
//-------------------------------------------------------
$mform->addElement('header', 'optionssection', get_string('optionsheader', 'page'));

View File

@ -26,4 +26,3 @@ Page module is a successor to original 'html' and 'text' type plugins of Resourc
TODO:
* implement portfolio support (MDL-20076)
* new backup/restore and old restore migration (MDL-20077)
* implement format switching in formslib editor element (MDL-20078)

View File

@ -18,9 +18,10 @@
/**
* Page module admin settings and defaults
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;

View File

@ -18,11 +18,14 @@
/**
* Page module version information
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$module->version = 2009080500;
$module->requires = 2009073101; // Requires this Moodle version
$module->cron = 0;

View File

@ -18,9 +18,10 @@
/**
* Page module version information
*
* @package mod-page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod
* @subpackage page
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../config.php');