mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
Merge branch 'MDL-30790_25' of git://github.com/rlorenzo/moodle
This commit is contained in:
commit
0cabeada65
8 changed files with 38 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/folder/db" VERSION="20130121" COMMENT="XMLDB file for Folder module"
|
||||
<XMLDB PATH="mod/folder/db" VERSION="20130315" COMMENT="XMLDB file for Folder module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
|
@ -14,6 +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"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
|
@ -23,4 +24,4 @@
|
|||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
|
|
@ -58,7 +58,6 @@ function xmldb_folder_upgrade($oldversion) {
|
|||
// Moodle v2.3.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
|
@ -77,5 +76,20 @@ function xmldb_folder_upgrade($oldversion) {
|
|||
upgrade_mod_savepoint(true, 2013012100, 'folder');
|
||||
}
|
||||
|
||||
if ($oldversion < 2013031500) {
|
||||
|
||||
// Define field show_expanded to be added to folder
|
||||
$table = new xmldb_table('folder');
|
||||
$field = new xmldb_field('show_expanded', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'revision');
|
||||
|
||||
// Conditionally launch add field show_expanded
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// folder savepoint reached
|
||||
upgrade_mod_savepoint(true, 2013031500, 'folder');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -51,3 +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.';
|
||||
|
|
|
@ -55,7 +55,10 @@ class mod_folder_mod_form extends moodleform_mod {
|
|||
$mform->addHelpButton('display', 'display', 'mod_folder');
|
||||
$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);
|
||||
//-------------------------------------------------------
|
||||
$this->standard_coursemodule_elements();
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ M.mod_folder.init_tree = function(Y, id, expand_all) {
|
|||
|
||||
if (expand_all) {
|
||||
tree.expandAll();
|
||||
} else {
|
||||
// Else just expand the top node.
|
||||
tree.getNodeByIndex(1).expand();
|
||||
}
|
||||
|
||||
tree.render();
|
||||
|
|
|
@ -78,8 +78,12 @@ 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>';
|
||||
$this->page->requires->js_init_call('M.mod_folder.init_tree', array($id, true));
|
||||
return $content;
|
||||
$show_expanded = true;
|
||||
if (empty($tree->folder->show_expanded)) {
|
||||
$show_expanded = false;
|
||||
}
|
||||
$this->page->requires->js_init_call('M.mod_folder.init_tree', array($id, $show_expanded));
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,4 +30,8 @@ if ($ADMIN->fulltree) {
|
|||
//--- general settings -----------------------------------------------------------------------------------
|
||||
$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));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$module->version = 2013012100; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2013031500; // 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…
Add table
Add a link
Reference in a new issue