Skip to content
Browse files

Merge branch 'wip-mdl-26674-m22' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_22_STABLE
  • Loading branch information...
2 parents 739d5c9 + 2e32076 commit 56f55380a9c97fc2dd772db07ec5168219d510c7 Sam Hemelryk committed Mar 19, 2012
View
3 mod/wiki/admin.php
@@ -58,7 +58,8 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:managewiki', $context);
-add_to_log($course->id, "wiki", "admin", "admin.php?id=$cm->id", "$wiki->id");
+
+add_to_log($course->id, "wiki", "admin", "admin.php?pageid=".$page->id, $page->id, $cm->id);
//Delete page if a page ID to delete was supplied
if (!empty($delete) && confirm_sesskey()) {
View
2 mod/wiki/comments.php
@@ -59,7 +59,7 @@
require_login($course->id, true, $cm);
-add_to_log($course->id, 'wiki', 'comments', 'comments.php?id=' . $cm->id, $wiki->id);
+add_to_log($course->id, 'wiki', 'comments', "comments.php?pageid=".$pageid, $pageid, $cm->id);
/// Print the page header
$wikipage = new page_wiki_comments($wiki, $subwiki, $cm);
View
17 mod/wiki/create.php
@@ -66,8 +66,6 @@
require_login($course->id, true, $cm);
-add_to_log($course->id, 'createpage', 'createpage', 'view.php?id=' . $cm->id, $wiki->id);
-
$wikipage = new page_wiki_create($wiki, $subwiki, $cm);
if (!empty($swid)) {
@@ -80,22 +78,25 @@
$wikipage->set_uid($uid);
}
-if (!empty($title)) {
- $wikipage->set_title($title);
-} else {
- $wikipage->set_title(get_string('newpage', 'wiki'));
+if (empty($title)) {
+ $title = get_string('newpage', 'wiki');
}
+$wikipage->set_title($title);
// set page action, and initialise moodle form
$wikipage->set_action($action);
switch ($action) {
case 'create':
- $wikipage->create_page($title);
+ $newpageid = $wikipage->create_page($title);
+ add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
+ redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
break;
case 'new':
if ((int)$wiki->forceformat == 1 && !empty($title)) {
- $wikipage->create_page($title);
+ $newpageid = $wikipage->create_page($title);
+ add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
+ redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
} else {
// create link from moodle navigation block without pagetitle
$wikipage->print_header();
View
3 mod/wiki/diff.php
@@ -67,13 +67,14 @@
}
require_login($course->id, true, $cm);
-add_to_log($course->id, "wiki", "diff", "diff.php?id=$cm->id", "$wiki->id");
$wikipage = new page_wiki_diff($wiki, $subwiki, $cm);
$wikipage->set_page($page);
$wikipage->set_comparison($compare, $comparewith);
+add_to_log($course->id, "wiki", "diff", "diff.php?pageid=".$pageid."&comparewith=".$comparewith."&compare=".$compare, $pageid, $cm->id);
+
$wikipage->print_header();
$wikipage->print_content();
View
3 mod/wiki/edit.php
@@ -77,8 +77,6 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:editpage', $context);
-add_to_log($course->id, 'wiki', 'edit', "edit.php?id=$cm->id", "$wiki->id");
-
if ($option == get_string('save', 'wiki')) {
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
@@ -87,6 +85,7 @@
$wikipage->set_page($page);
$wikipage->set_newcontent($newcontent);
$wikipage->set_upload(true);
+ add_to_log($course->id, 'wiki', 'edit', "view.php?pageid=".$pageid, $pageid, $cm->id);
} else {
if ($option == get_string('preview')) {
if (!confirm_sesskey()) {
View
2 mod/wiki/history.php
@@ -61,7 +61,7 @@
require_login($course->id, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:viewpage', $context);
-add_to_log($course->id, 'wiki', 'history', 'history.php?id=' . $cm->id, $wiki->id);
+add_to_log($course->id, 'wiki', 'history', "history.php?pageid=".$pageid, $pageid, $cm->id);
/// Print the page header
$wikipage = new page_wiki_history($wiki, $subwiki, $cm);
View
2 mod/wiki/index.php
@@ -45,7 +45,7 @@
$PAGE->set_pagelayout('incourse');
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-add_to_log($course->id, 'wiki', 'view all', "index.php?id=$course->id", "");
+add_to_log($course->id, 'wiki', 'view', "index.php?id=".$id, "");
/// Get all required stringswiki
$strwikis = get_string("modulenameplural", "wiki");
View
2 mod/wiki/instancecomments.php
@@ -94,12 +94,12 @@
if ($action == 'edit') {
$comm->set_action($action, $id, $content);
-
} else {
$action = 'add';
$comm->set_action($action, 0, $content);
}
}
+add_to_log($course->id, 'wiki', 'comment', "comments.php?pageid=".$pageid, $pageid, $cm->id);
$comm->print_header();
$comm->print_content();
View
2 mod/wiki/lock.php
@@ -71,8 +71,6 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:editpage', $context);
-//add_to_log($course->id, "wiki", "lock", "lock.php?id=$cm->id", "$wiki->id");
-
$wikipage = new page_wiki_lock($wiki, $subwiki, $cm);
$wikipage->set_page($page);
View
6 mod/wiki/map.php
@@ -56,13 +56,11 @@
require_login($course->id, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:viewpage', $context);
-add_to_log($course->id, "wiki", "map", "map.php?id=$cm->id", "$wiki->id");
-/// Print page header
-
-/// Finish the page
$wikipage = new page_wiki_map($wiki, $subwiki, $cm);
+add_to_log($course->id, "wiki", "map", "map.php?pageid=".$pageid, $pageid, $cm->id);
+// Print page header
$wikipage->set_view($option);
$wikipage->set_page($page);
$wikipage->print_header();
View
3 mod/wiki/overridelocks.php
@@ -67,8 +67,6 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:overridelock', $context);
-add_to_log($course->id, "wiki", "overridelocks", "overridelocks.php?id=$cm->id", "$wiki->id");
-
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
}
@@ -79,6 +77,7 @@
if (!empty($section)) {
$wikipage->set_section($sectioncontent, $section);
}
+add_to_log($course->id, "wiki", "overridelocks", "view.php?pageid=".$pageid, $pageid, $cm->id);
$wikipage->print_header();
View
5 mod/wiki/pagelib.php
@@ -935,11 +935,14 @@ function create_page($pagetitle) {
$this->subwiki = wiki_get_subwiki($swid);
}
if ($data) {
+ $this->set_title($data->pagetitle);
$id = wiki_create_page($this->subwiki->id, $data->pagetitle, $data->pageformat, $USER->id);
} else {
+ $this->set_title($pagetitle);
$id = wiki_create_page($this->subwiki->id, $pagetitle, $PAGE->activityrecord->defaultformat, $USER->id);
}
- redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $id);
+ $this->page = $id;
+ return $id;
}
}
View
3 mod/wiki/prettyview.php
@@ -56,11 +56,10 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:viewpage', $context);
-add_to_log($course->id, "wiki", "view", "prettyview.php?pageid=$pageid", "$wiki->id");
-
$wikipage = new page_wiki_prettyview($wiki, $subwiki, $cm);
$wikipage->set_page($page);
+add_to_log($course->id, "wiki", "view", "prettyview.php?pageid=".$pageid, $pageid, $cm->id);
$wikipage->print_header();
$wikipage->print_content();
View
3 mod/wiki/restoreversion.php
@@ -60,8 +60,6 @@
require_login($course->id, true, $cm);
-add_to_log($course->id, "restore", "restore", "view.php?id=$cm->id", "$wiki->id");
-
if ($confirm) {
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
@@ -77,6 +75,7 @@
$wikipage->set_versionid($versionid);
}
+add_to_log($course->id, "wiki", "restore", "view.php?pageid=".$pageid, $pageid, $cm->id);
$wikipage->print_header();
$wikipage->print_content();
View
10 mod/wiki/view.php
@@ -269,8 +269,6 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:viewpage', $context);
-add_to_log($course->id, 'wiki', 'view', 'view.php?id=' . $cm->id, $wiki->id);
-
// Update 'viewed' state if required by completion system
require_once($CFG->libdir . '/completionlib.php');
$completion = new completion_info($course);
@@ -294,6 +292,14 @@
$wikipage->set_gid($currentgroup);
$wikipage->set_page($page);
+if($pageid) {
+ add_to_log($course->id, 'wiki', 'view', "view.php?pageid=".$pageid, $pageid, $cm->id);
+} else if($id) {
+ add_to_log($course->id, 'wiki', 'view', "view.php?id=".$id, $id, $cm->id);
+} else if($wid && $title) {
+ add_to_log($course->id, 'wiki', 'view', "view.php?wid=".$wid."&title=".$title, $wid, $cm->id);
+}
+
$wikipage->print_header();
$wikipage->print_content();
View
5 mod/wiki/viewversion.php
@@ -59,14 +59,15 @@
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course->id, true, $cm);
-add_to_log($course->id, "wiki", "history", "history.php?id=$cm->id", "$wiki->id");
-/// Print the page header
$wikipage = new page_wiki_viewversion($wiki, $subwiki, $cm);
$wikipage->set_page($page);
$wikipage->set_versionid($versionid);
+add_to_log($course->id, "wiki", "history", "viewversion.php?pageid=".$pageid."&versionid=".$versionid, $pageid, $cm->id);
+
+// Print the page header
$wikipage->print_header();
$wikipage->print_content();

0 comments on commit 56f5538

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