Skip to content
Browse files

MDL-38646 folder: change column from show_expanded to showexpanded

  • Loading branch information...
1 parent 3a8c438 commit 57e228045b8d003d54d65c90e7ad0d8bbed427d8 @rlorenzo rlorenzo committed with rlorenzo Apr 7, 2013
View
2 mod/folder/backup/moodle2/backup_folder_stepslib.php
@@ -39,7 +39,7 @@ protected function define_structure() {
// 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)
View
6 mod/folder/backup/moodle2/restore_folder_stepslib.php
@@ -48,9 +48,9 @@ protected function process_folder($data) {
$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
View
4 mod/folder/db/install.xml
@@ -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"/>
View
19 mod/folder/db/upgrade.php
@@ -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;
}
View
4 mod/folder/lang/en/folder.php
@@ -51,5 +51,5 @@
$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.';
View
4 mod/folder/lib.php
@@ -426,15 +426,15 @@ 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();
$cminfo->name = $folder->name;
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) {
View
6 mod/folder/mod_form.php
@@ -56,9 +56,9 @@ function definition() {
$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();
View
8 mod/folder/renderer.php
@@ -79,11 +79,11 @@ public function render_folder_tree(folder_tree $tree) {
$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;
}
View
6 mod/folder/settings.php
@@ -31,7 +31,7 @@
$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));
}
View
2 mod/folder/version.php
@@ -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;

0 comments on commit 57e2280

Please sign in to comment.
Something went wrong with that request. Please try again.