From 1fe0ecabf15f6543227be821fbe7c7d772755f43 Mon Sep 17 00:00:00 2001 From: "Andrew Davis (andyjdavis)" Date: Fri, 1 Jul 2011 10:01:38 +0800 Subject: [PATCH 1/3] MDL-27829 blocks: altered some strings so page type strings match the names of the course reports in the UI --- course/report/log/lang/en/coursereport_log.php | 2 +- course/report/outline/lang/en/coursereport_outline.php | 2 +- course/report/progress/lang/en/coursereport_progress.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/course/report/log/lang/en/coursereport_log.php b/course/report/log/lang/en/coursereport_log.php index 431e260135c..1a59f3f43bd 100644 --- a/course/report/log/lang/en/coursereport_log.php +++ b/course/report/log/lang/en/coursereport_log.php @@ -27,5 +27,5 @@ $string['loglive'] = 'Live logs'; $string['log:view'] = 'View course logs'; $string['log:viewlive'] = 'View live logs'; $string['log:viewtoday'] = 'View today\'s logs'; -$string['pluginpagetype'] = 'Log course report'; +$string['pluginpagetype'] = 'Logs course report'; $string['pluginname'] = 'Logs'; diff --git a/course/report/outline/lang/en/coursereport_outline.php b/course/report/outline/lang/en/coursereport_outline.php index 6bce7b86913..e3c05d4352b 100644 --- a/course/report/outline/lang/en/coursereport_outline.php +++ b/course/report/outline/lang/en/coursereport_outline.php @@ -24,5 +24,5 @@ */ $string['outline:view'] = 'View course activity report'; -$string['pluginpagetype'] = 'Course activity report'; +$string['pluginpagetype'] = 'Activity course report'; $string['pluginname'] = 'Course activity'; diff --git a/course/report/progress/lang/en/coursereport_progress.php b/course/report/progress/lang/en/coursereport_progress.php index dd27c662acb..bf8adf16775 100644 --- a/course/report/progress/lang/en/coursereport_progress.php +++ b/course/report/progress/lang/en/coursereport_progress.php @@ -24,5 +24,5 @@ */ $string['pluginname'] = 'Activity completion'; -$string['pluginpagetype'] = 'Progress course report'; +$string['pluginpagetype'] = 'Activity completion report'; $string['progress:view'] = 'View activity completion reports'; From 346a32a75b4fc1b0aa51355424d9d41a0c251fa2 Mon Sep 17 00:00:00 2001 From: "Andrew Davis (andyjdavis)" Date: Fri, 1 Jul 2011 15:43:26 +0800 Subject: [PATCH 2/3] MDL-27829 blocks: added some more page types to some _page_type_list() functions --- course/report/completion/lib.php | 2 +- course/report/log/lib.php | 3 ++- course/report/outline/lib.php | 2 +- course/report/participation/lib.php | 2 +- course/report/progress/lib.php | 2 +- course/report/stats/lib.php | 2 +- mod/glossary/lang/en/glossary.php | 2 ++ mod/glossary/lib.php | 5 ++++- mod/glossary/view.php | 1 - mod/lesson/edit.php | 1 + mod/lesson/lang/en/lesson.php | 4 +++- mod/lesson/lib.php | 5 ++++- mod/quiz/lang/en/quiz.php | 1 + mod/quiz/lib.php | 4 +++- 14 files changed, 25 insertions(+), 11 deletions(-) diff --git a/course/report/completion/lib.php b/course/report/completion/lib.php index 7bf087e0694..21874c68d12 100644 --- a/course/report/completion/lib.php +++ b/course/report/completion/lib.php @@ -55,7 +55,7 @@ function completion_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-completion-*' => get_string('pluginpagetype', 'coursereport_completion') + 'course-report-completion-index' => get_string('pluginpagetype', 'coursereport_completion') ); return $array; } diff --git a/course/report/log/lib.php b/course/report/log/lib.php index de2769280a4..cef00a0af58 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -548,7 +548,8 @@ function log_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-log-*' => get_string('pluginpagetype', 'coursereport_log') + 'course-report-log-index' => get_string('pluginpagetype', 'coursereport_log') + //course-report-log-live not included as theres no blocks on the live log page ); return $array; } \ No newline at end of file diff --git a/course/report/outline/lib.php b/course/report/outline/lib.php index f3632b37185..3d30cce536d 100644 --- a/course/report/outline/lib.php +++ b/course/report/outline/lib.php @@ -49,7 +49,7 @@ function outline_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-outline-*' => get_string('pluginpagetype', 'coursereport_outline') + 'course-report-outline-index' => get_string('pluginpagetype', 'coursereport_outline') ); return $array; } \ No newline at end of file diff --git a/course/report/participation/lib.php b/course/report/participation/lib.php index 62429c9bbe8..c11c2a7579b 100644 --- a/course/report/participation/lib.php +++ b/course/report/participation/lib.php @@ -49,7 +49,7 @@ function participation_page_type_list($pagetype, $parentcontext, $currentcontext $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-participation-*' => get_string('pluginpagetype', 'coursereport_participation') + 'course-report-participation-index' => get_string('pluginpagetype', 'coursereport_participation') ); return $array; } \ No newline at end of file diff --git a/course/report/progress/lib.php b/course/report/progress/lib.php index 23a9686f933..6a5919f1c15 100644 --- a/course/report/progress/lib.php +++ b/course/report/progress/lib.php @@ -60,7 +60,7 @@ function progress_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-progress-*' => get_string('pluginpagetype', 'coursereport_progress') + 'course-report-progress-index' => get_string('pluginpagetype', 'coursereport_progress') ); return $array; } \ No newline at end of file diff --git a/course/report/stats/lib.php b/course/report/stats/lib.php index 220e8dff677..974463cdd63 100644 --- a/course/report/stats/lib.php +++ b/course/report/stats/lib.php @@ -102,7 +102,7 @@ function stats_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( '*' => get_string('page-x', 'pagetype'), 'course-report-*' => get_string('page-course-report-x', 'pagetype'), - 'course-report-stats-*' => get_string('pluginpagetype', 'coursereport_stats') + 'course-report-stats-index' => get_string('pluginpagetype', 'coursereport_stats') ); return $array; } \ No newline at end of file diff --git a/mod/glossary/lang/en/glossary.php b/mod/glossary/lang/en/glossary.php index 77282a09289..bfca2442218 100644 --- a/mod/glossary/lang/en/glossary.php +++ b/mod/glossary/lang/en/glossary.php @@ -220,6 +220,8 @@ $string['notapproved'] = 'glossary entry is not approved yet.'; $string['numberofentries'] = 'Number of entries'; $string['onebyline'] = '(one per line)'; $string['page-mod-glossary-x'] = 'Any glossary module page'; +$string['page-mod-glossary-edit'] = 'Glossary add/edit entry page'; +$string['page-mod-glossary-view'] = 'View glossary edit page'; $string['pluginadministration'] = 'Glossary administration'; $string['pluginname'] = 'Glossary'; $string['popupformat'] = 'Popup format'; diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 5b4a9f70710..fba072b823a 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -2864,6 +2864,9 @@ function glossary_comment_validate($comment_param) { * @param stdClass $currentcontext Current context of block */ function glossary_page_type_list($pagetype, $parentcontext, $currentcontext) { - $module_pagetype = array('mod-glossary-*'=>get_string('page-mod-glossary-x', 'glossary')); + $module_pagetype = array( + 'mod-glossary-*'=>get_string('page-mod-glossary-x', 'glossary'), + 'mod-glossary-view'=>get_string('page-mod-glossary-view', 'glossary'), + 'mod-glossary-edit'=>get_string('page-mod-glossary-edit', 'glossary')); return $module_pagetype; } diff --git a/mod/glossary/view.php b/mod/glossary/view.php index f5d8687d076..bad1c245000 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -62,7 +62,6 @@ if ($tab == GLOSSARY_ADDENTRY_VIEW ) { } /// setting the defaut number of entries per page if not set - if ( !$entriesbypage = $glossary->entbypage ) { $entriesbypage = $CFG->glossary_entbypage; } diff --git a/mod/lesson/edit.php b/mod/lesson/edit.php index cd849458dbc..c3466014baa 100644 --- a/mod/lesson/edit.php +++ b/mod/lesson/edit.php @@ -48,6 +48,7 @@ if ($mode != get_user_preferences('lesson_view', 'collapsed') && $mode !== 'sing $lessonoutput = $PAGE->get_renderer('mod_lesson'); $PAGE->navbar->add(get_string('edit')); echo $lessonoutput->header($lesson, $cm, $mode); + if (!$lesson->has_pages()) { // There are no pages; give teacher some options require_capability('mod/lesson:edit', $context); diff --git a/mod/lesson/lang/en/lesson.php b/mod/lesson/lang/en/lesson.php index 4a2a3b1803b..d15ec5244f6 100644 --- a/mod/lesson/lang/en/lesson.php +++ b/mod/lesson/lang/en/lesson.php @@ -307,7 +307,9 @@ $string['outof'] = 'Out of {$a}'; $string['overview'] = 'Overview'; $string['overview_help'] = 'A lesson is made up of a number of pages and optionally content pages. A page contains some content and usually ends with a question. Associated with each answer to the question is a jump. The jump can be relative, such as this page or next page, or absolute, specifying any one of the pages in the lesson. A content page is a page containing a set of links to other pages in the lesson, for example a Table of Contents.'; $string['page'] = 'Page: {$a}'; -$string['page-mod-lesson-x'] = 'Any lesson module page'; +$string['page-mod-lesson-x'] = 'Any lesson page'; +$string['page-mod-lesson-view'] = 'View or preview lesson page'; +$string['page-mod-lesson-edit'] = 'Edit lesson page'; $string['pagecontents'] = 'Page contents'; $string['pages'] = 'Pages'; $string['pagetitle'] = 'Page title'; diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index e87fa0cdce0..76107538943 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -997,6 +997,9 @@ function lesson_get_file_info($browser, $areas, $course, $cm, $context, $fileare * @param stdClass $currentcontext Current context of block */ function lesson_page_type_list($pagetype, $parentcontext, $currentcontext) { - $module_pagetype = array('mod-lesson-*'=>get_string('page-mod-lesson-x', 'lesson')); + $module_pagetype = array( + 'mod-lesson-*'=>get_string('page-mod-lesson-x', 'lesson'), + 'mod-lesson-view'=>get_string('page-mod-lesson-view', 'lesson'), + 'mod-lesson-edit'=>get_string('page-mod-lesson-edit', 'lesson')); return $module_pagetype; } diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index 11585068268..3c669256ea2 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -496,6 +496,7 @@ $string['overrides'] = 'Overrides'; $string['overrideuser'] = 'Override user'; $string['overrideusereventname'] = '{$a->quiz} - Override'; $string['page-mod-quiz-x'] = 'Any quiz module page'; +$string['page-mod-quiz-edit'] = 'Edit quiz page'; $string['pagesize'] = 'Attempts shown per page:'; $string['parent'] = 'Parent'; $string['parentcategory'] = 'Parent category'; diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 857e310a5ab..e44b2ab2583 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1712,6 +1712,8 @@ function mod_quiz_question_pluginfile($course, $context, $component, * @param stdClass $currentcontext Current context of block */ function quiz_page_type_list($pagetype, $parentcontext, $currentcontext) { - $module_pagetype = array('mod-quiz-*'=>get_string('page-mod-quiz-x', 'quiz')); + $module_pagetype = array( + 'mod-quiz-*'=>get_string('page-mod-quiz-x', 'quiz'), + 'mod-quiz-edit'=>get_string('page-mod-quiz-edit', 'quiz')); return $module_pagetype; } From 2f9bdadfd23321951a7fbf7a33ddc5af57c5ef74 Mon Sep 17 00:00:00 2001 From: "Andrew Davis (andyjdavis)" Date: Fri, 1 Jul 2011 17:02:44 +0800 Subject: [PATCH 3/3] MDL-27829 blocks: made the ability to add a block to all site administration pages work --- admin/lib.php | 4 ++-- blocks/edit_form.php | 4 ++-- lang/en/pagetype.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/lib.php b/admin/lib.php index dde1bc58e22..7b4331961ca 100644 --- a/admin/lib.php +++ b/admin/lib.php @@ -32,8 +32,8 @@ */ function admin_page_type_list($pagetype, $parentcontext, $currentcontext) { $array = array( - 'admin-setting-*' => get_string('page-admin-setting-x', 'pagetype'), - $pagetype => get_string('page-admin-setting', 'pagetype') + 'admin-*' => get_string('page-admin-x', 'pagetype'), + $pagetype => get_string('page-admin-current', 'pagetype') ); return $array; } \ No newline at end of file diff --git a/blocks/edit_form.php b/blocks/edit_form.php index c5280938a42..01e2a403246 100644 --- a/blocks/edit_form.php +++ b/blocks/edit_form.php @@ -99,8 +99,8 @@ class block_edit_form extends moodleform { $contextoptions = array(); if ( ($parentcontext->contextlevel == CONTEXT_COURSE && $parentcontext->instanceid == SITEID) || ($parentcontext->contextlevel == CONTEXT_SYSTEM)) { // Home page - if ($bits[0] == 'tag' || ($bits[0] == 'admin' && $bits[1] == 'setting')) { - // tag and admin settings always use system context + if ($bits[0] == 'tag' || $bits[0] == 'admin') { + // tag and admin pages always use system context // the contexts options don't make differences, so we use // page type patterns only $mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_ENTIRE_SITE); diff --git a/lang/en/pagetype.php b/lang/en/pagetype.php index 13d432568f5..7d196a09164 100644 --- a/lang/en/pagetype.php +++ b/lang/en/pagetype.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['page-admin-setting'] = 'The current admin setting page'; -$string['page-admin-setting-x'] = 'Any admin setting page'; +$string['page-admin-current'] = 'The current site administration page'; +$string['page-admin-x'] = 'Any site administration page'; $string['page-course-view-x'] = 'Any type of course main page'; $string['page-course-x'] = 'Any course page'; $string['page-course-report-x'] = 'Any course report';