MDL-42575 mod_page: revert heading option display

Reverted heading option display for page resource; made sure to not re-introduce class issues.
This commit is contained in:
Jetha Chan 2014-03-21 15:29:52 +08:00
parent 9b8555fbea
commit 846ffe600c
7 changed files with 19 additions and 2 deletions

View File

@ -72,7 +72,7 @@ class moodle1_mod_page_handler extends moodle1_resource_successor_handler {
$page['timemodified'] = $data['timemodified'];
// populate display and displayoptions fields
$options = array('printintro' => 0);
$options = array('printheading' => 1, 'printintro' => 0);
if ($data['popup']) {
$page['display'] = RESOURCELIB_DISPLAY_POPUP;
$rawoptions = explode(',', $data['popup']);

View File

@ -57,5 +57,7 @@ $string['popupheight'] = 'Pop-up height (in pixels)';
$string['popupheightexplain'] = 'Specifies default height of popup windows.';
$string['popupwidth'] = 'Pop-up width (in pixels)';
$string['popupwidthexplain'] = 'Specifies default width of popup windows.';
$string['printheading'] = 'Display page name';
$string['printheadingexplain'] = 'Display page name above content?';
$string['printintro'] = 'Display page description';
$string['printintroexplain'] = 'Display page description above content?';

View File

@ -96,6 +96,7 @@ function page_add_instance($data, $mform = null) {
$displayoptions['popupwidth'] = $data->popupwidth;
$displayoptions['popupheight'] = $data->popupheight;
}
$displayoptions['printheading'] = $data->printheading;
$displayoptions['printintro'] = $data->printintro;
$data->displayoptions = serialize($displayoptions);
@ -141,6 +142,7 @@ function page_update_instance($data, $mform) {
$displayoptions['popupwidth'] = $data->popupwidth;
$displayoptions['popupheight'] = $data->popupheight;
}
$displayoptions['printheading'] = $data->printheading;
$displayoptions['printintro'] = $data->printintro;
$data->displayoptions = serialize($displayoptions);
@ -507,6 +509,7 @@ function page_dndupload_handle($uploadinfo) {
$data->display = $config->display;
$data->popupheight = $config->popupheight;
$data->popupwidth = $config->popupwidth;
$data->printheading = $config->printheading;
$data->printintro = $config->printintro;
return page_add_instance($data, null);

View File

@ -88,6 +88,8 @@ class mod_page_mod_form extends moodleform_mod {
$mform->setDefault('popupheight', $config->popupheight);
}
$mform->addElement('advcheckbox', 'printheading', get_string('printheading', 'page'));
$mform->setDefault('printheading', $config->printheading);
$mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'page'));
$mform->setDefault('printintro', $config->printintro);
@ -123,6 +125,9 @@ class mod_page_mod_form extends moodleform_mod {
if (isset($displayoptions['printintro'])) {
$default_values['printintro'] = $displayoptions['printintro'];
}
if (isset($displayoptions['printheading'])) {
$default_values['printheading'] = $displayoptions['printheading'];
}
if (!empty($displayoptions['popupwidth'])) {
$default_values['popupwidth'] = $displayoptions['popupwidth'];
}

View File

@ -41,6 +41,8 @@ if ($ADMIN->fulltree) {
//--- modedit defaults -----------------------------------------------------------------------------------
$settings->add(new admin_setting_heading('pagemodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
$settings->add(new admin_setting_configcheckbox('page/printheading',
get_string('printheading', 'page'), get_string('printheadingexplain', 'page'), 1));
$settings->add(new admin_setting_configcheckbox('page/printintro',
get_string('printintro', 'page'), get_string('printintroexplain', 'page'), 0));
$settings->add(new admin_setting_configselect('page/display',

View File

@ -51,6 +51,9 @@ class mod_page_generator extends testing_module_generator {
if (!isset($record->display)) {
$record->display = RESOURCELIB_DISPLAY_AUTO;
}
if (!isset($record->printheading)) {
$record->printheading = 1;
}
if (!isset($record->printintro)) {
$record->printintro = 0;
}

View File

@ -79,7 +79,9 @@ if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) {
$PAGE->set_activity_record($page);
}
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($page->name), 2);
if (!isset($options['printheading']) || !empty($options['printheading'])) {
echo $OUTPUT->heading(format_string($page->name), 2);
}
if (!empty($options['printintro'])) {
if (trim(strip_tags($page->intro))) {