mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 03:58:34 +01:00
Merge branch 'MDL-38646' of git://github.com/rlorenzo/moodle
This commit is contained in:
commit
a03fdbb099
@ -39,7 +39,7 @@ class backup_folder_activity_structure_step extends backup_activity_structure_st
|
||||
// Define each element separated
|
||||
$folder = new backup_nested_element('folder', array('id'), array(
|
||||
'name', 'intro', 'introformat', 'revision',
|
||||
'timemodified', 'display', 'show_expanded'));
|
||||
'timemodified', 'display', 'showexpanded'));
|
||||
|
||||
// Build the tree
|
||||
// (nice mono-tree, lol)
|
||||
|
@ -48,9 +48,9 @@ class restore_folder_activity_structure_step extends restore_activity_structure_
|
||||
$data->course = $this->get_courseid();
|
||||
$data->timemodified = $this->apply_date_offset($data->timemodified);
|
||||
|
||||
// If show_expanded is not set, apply site default.
|
||||
if (!isset($data->show_expanded)) {
|
||||
$data->show_expanded = get_config('folder', 'show_expanded');
|
||||
// If showexpanded is not set, apply site default.
|
||||
if (!isset($data->showexpanded)) {
|
||||
$data->showexpanded = get_config('folder', 'showexpanded');
|
||||
}
|
||||
|
||||
// insert the folder record
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/folder/db" VERSION="20130315" COMMENT="XMLDB file for Folder module"
|
||||
<XMLDB PATH="mod/folder/db" VERSION="20130407" COMMENT="XMLDB file for Folder module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -14,7 +14,7 @@
|
||||
<FIELD NAME="revision" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="incremented when after each file changes, solves browser caching issues"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="display" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Display type of folder contents - on a separate page or inline"/>
|
||||
<FIELD NAME="show_expanded" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" COMMENT="1 = expanded, 0 = collapsed for sub-folders"/>
|
||||
<FIELD NAME="showexpanded" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" COMMENT="1 = expanded, 0 = collapsed for sub-folders"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
|
@ -91,5 +91,24 @@ function xmldb_folder_upgrade($oldversion) {
|
||||
upgrade_mod_savepoint(true, 2013031500, 'folder');
|
||||
}
|
||||
|
||||
// Rename show_expanded to showexpanded (see MDL-38646).
|
||||
if ($oldversion < 2013040700) {
|
||||
|
||||
// Rename site config setting.
|
||||
$showexpanded = get_config('folder', 'show_expanded');
|
||||
set_config('showexpanded', $showexpanded, 'folder');
|
||||
set_config('show_expanded', null, 'folder');
|
||||
|
||||
// Rename table column.
|
||||
$table = new xmldb_table('folder');
|
||||
$field = new xmldb_field('show_expanded', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'revision');
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->rename_field($table, $field, 'showexpanded');
|
||||
}
|
||||
|
||||
// folder savepoint reached
|
||||
upgrade_mod_savepoint(true, 2013040700, 'folder');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,5 +51,5 @@ Also note that participants view actions can not be logged in this case.';
|
||||
$string['displaypage'] = 'On a separate page';
|
||||
$string['displayinline'] = 'Inline on a course page';
|
||||
$string['noautocompletioninline'] = 'Automatic completion on viewing of activity can not be selected together with "Display inline" option';
|
||||
$string['show_expanded'] = 'Show sub-folders expanded';
|
||||
$string['show_expanded_help'] = 'If enabled, will display sub-folders expanded by default. Else, sub-folders will display collapsed.';
|
||||
$string['showexpanded'] = 'Show sub-folders expanded';
|
||||
$string['showexpanded_help'] = 'If enabled, will display sub-folders expanded by default. Else, sub-folders will display collapsed.';
|
||||
|
@ -426,7 +426,7 @@ function folder_dndupload_handle($uploadinfo) {
|
||||
function folder_get_coursemodule_info($cm) {
|
||||
global $DB;
|
||||
if (!($folder = $DB->get_record('folder', array('id' => $cm->instance),
|
||||
'id, name, display, show_expanded, intro, introformat'))) {
|
||||
'id, name, display, showexpanded, intro, introformat'))) {
|
||||
return NULL;
|
||||
}
|
||||
$cminfo = new cached_cm_info();
|
||||
@ -434,7 +434,7 @@ function folder_get_coursemodule_info($cm) {
|
||||
if ($folder->display == FOLDER_DISPLAY_INLINE) {
|
||||
// prepare folder object to store in customdata
|
||||
$fdata = new stdClass();
|
||||
$fdata->show_expanded = $folder->show_expanded;
|
||||
$fdata->showexpanded = $folder->showexpanded;
|
||||
if ($cm->showdescription && strlen(trim($folder->intro))) {
|
||||
$fdata->intro = $folder->intro;
|
||||
if ($folder->introformat != FORMAT_MOODLE) {
|
||||
|
@ -56,9 +56,9 @@ class mod_folder_mod_form extends moodleform_mod {
|
||||
$mform->setExpanded('content');
|
||||
|
||||
// Adding option to show sub-folders expanded or collapsed by default.
|
||||
$mform->addElement('advcheckbox', 'show_expanded', get_string('show_expanded', 'folder'));
|
||||
$mform->addHelpButton('show_expanded', 'show_expanded', 'mod_folder');
|
||||
$mform->setDefault('show_expanded', $config->show_expanded);
|
||||
$mform->addElement('advcheckbox', 'showexpanded', get_string('showexpanded', 'folder'));
|
||||
$mform->addHelpButton('showexpanded', 'showexpanded', 'mod_folder');
|
||||
$mform->setDefault('showexpanded', $config->showexpanded);
|
||||
//-------------------------------------------------------
|
||||
$this->standard_coursemodule_elements();
|
||||
|
||||
|
@ -79,11 +79,11 @@ class mod_folder_renderer extends plugin_renderer_base {
|
||||
$content .= '<div id="'.$id.'" class="filemanager">';
|
||||
$content .= $this->htmllize_tree($tree, array('files' => array(), 'subdirs' => array($tree->dir)));
|
||||
$content .= '</div>';
|
||||
$show_expanded = true;
|
||||
if (empty($tree->folder->show_expanded)) {
|
||||
$show_expanded = false;
|
||||
$showexpanded = true;
|
||||
if (empty($tree->folder->showexpanded)) {
|
||||
$showexpanded = false;
|
||||
}
|
||||
$this->page->requires->js_init_call('M.mod_folder.init_tree', array($id, $show_expanded));
|
||||
$this->page->requires->js_init_call('M.mod_folder.init_tree', array($id, $showexpanded));
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configcheckbox('folder/requiremodintro',
|
||||
get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('folder/show_expanded',
|
||||
get_string('show_expanded', 'folder'),
|
||||
get_string('show_expanded_help', 'folder'), 1));
|
||||
$settings->add(new admin_setting_configcheckbox('folder/showexpanded',
|
||||
get_string('showexpanded', 'folder'),
|
||||
get_string('showexpanded_help', 'folder'), 1));
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$module->version = 2013031500; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2013040700; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2012112900; // Requires this Moodle version
|
||||
$module->component = 'mod_folder'; // Full name of the plugin (used for diagnostics)
|
||||
$module->cron = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user