From: skodak Date: Sat, 29 Nov 2008 16:15:40 +0000 (+0000) Subject: MDL-17465 - separate live log capability adn admin tree link X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e0f81e94a6523802551b7f6792e7037847e15443;p=moodle.git MDL-17465 - separate live log capability adn admin tree link --- diff --git a/admin/report/log/settings.php b/admin/report/log/settings.php index 4bccaf7e7b..be15280d86 100644 --- a/admin/report/log/settings.php +++ b/admin/report/log/settings.php @@ -1,4 +1,5 @@ add('reports', new admin_externalpage('reportlog', get_string('log', 'admin'), "$CFG->wwwroot/course/report/log/index.php?id=".SITEID, 'coursereport/log:view')); +$ADMIN->add('reports', new admin_externalpage('reportloglive', get_string('loglive', 'coursereport_log'), "$CFG->wwwroot/course/report/log/indexlive.php?id=".SITEID, 'coursereport/log:viewlive')); ?> \ No newline at end of file diff --git a/course/report/log/db/access.php b/course/report/log/db/access.php index b8873df06f..85377d3774 100644 --- a/course/report/log/db/access.php +++ b/course/report/log/db/access.php @@ -35,8 +35,22 @@ $coursereport_log_capabilities = array( 'admin' => CAP_ALLOW ), + 'clonepermissionsfrom' => 'moodle/site:viewreports', + ), + + 'coursereport/log:viewlive' => array( + 'riskbitmask' => RISK_PERSONAL, + 'captype' => 'read', + 'contextlevel' => CONTEXT_COURSE, + 'legacy' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ), + 'clonepermissionsfrom' => 'moodle/site:viewreports', ) + ); ?> diff --git a/course/report/log/index.php b/course/report/log/index.php index b23670bf7e..76186f1d8f 100644 --- a/course/report/log/index.php +++ b/course/report/log/index.php @@ -137,14 +137,6 @@ print_heading(get_string('chooselogs') .':'); print_log_selector_form($course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat); - - echo '
'; - print_heading(get_string('chooselivelogs') .':'); - - echo '

'; - link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800); - echo '

'; - } print_footer($course); diff --git a/course/report/log/indexlive.php b/course/report/log/indexlive.php new file mode 100644 index 0000000000..8c59224a92 --- /dev/null +++ b/course/report/log/indexlive.php @@ -0,0 +1,43 @@ +libdir.'/adminlib.php'); + + $id = optional_param('id', 0, PARAM_INT);// Course ID + + if (!$course = $DB->get_record('course', array('id'=>$id)) ) { + error('That\'s an invalid course id'.$id); + } + + require_login($course); + $context = get_context_instance(CONTEXT_COURSE, $course->id); + + require_capability('coursereport/log:viewlive', $context); + + $strlogs = get_string('logs'); + $strreports = get_string('reports'); + + if ($course->id == SITEID) { + admin_externalpage_setup('reportloglive'); + admin_externalpage_print_header(); + + } else { + $navlinks = array(); + $navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc'); + $navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation, ''); + } + + print_heading(get_string('loglive', 'coursereport_log')); + + echo '
'; + link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800); + echo '
'; + + print_footer($course); + +?> diff --git a/course/report/log/live.php b/course/report/log/live.php index 3f1f518ea3..8dce7e5219 100644 --- a/course/report/log/live.php +++ b/course/report/log/live.php @@ -14,7 +14,7 @@ require_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); - require_capability('coursereport/log:view', $context); + require_capability('coursereport/log:viewlive', $context); add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->id); diff --git a/course/report/log/mod.php b/course/report/log/mod.php index a3eff2b780..970253b84c 100644 --- a/course/report/log/mod.php +++ b/course/report/log/mod.php @@ -11,7 +11,9 @@ print_heading(get_string('chooselogs') .':'); print_log_selector_form($course); + } + if (has_capability('coursereport/log:viewlive', $context)) { print_heading(get_string('chooselivelogs') .':'); echo '

'; link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800); diff --git a/course/report/log/version.php b/course/report/log/version.php index c62920f9d7..702efd5e03 100644 --- a/course/report/log/version.php +++ b/course/report/log/version.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$plugin->version = 2007101500; +$plugin->version = 2007101502; $plugin->requires = 2007101532; ?> diff --git a/lang/en_utf8/coursereport_log.php b/lang/en_utf8/coursereport_log.php index 6b1de33712..721454522e 100644 --- a/lang/en_utf8/coursereport_log.php +++ b/lang/en_utf8/coursereport_log.php @@ -1,5 +1,8 @@ diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 90194a6734..186824e851 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -2389,7 +2389,8 @@ body#course-info .generalbox.info { margin-right:5px; } -#course-report-log-index .info { +#course-report-log-index .info, +#course-report-log-indexlive .info { margin-left:auto; margin-right:auto; text-align:center; diff --git a/version.php b/version.php index 466df6e87a..9add45692a 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2008112900; // YYYYMMDD = date of the last version bump + $version = 2008112901; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20081128)'; // Human-friendly version name