]> git.mjollnir.org Git - moodle.git/commitdiff
wiki: Added a link to force reloading of the page (WR#515)
authormartinlanghoff <martinlanghoff>
Mon, 31 Jul 2006 04:56:12 +0000 (04:56 +0000)
committermartinlanghoff <martinlanghoff>
Mon, 31 Jul 2006 04:56:12 +0000 (04:56 +0000)
The link allows the page to be reloaded, which saves people from only seeing the cached copy. This is the equivalent of doing Shift+Reload in most
browsers.

Author: Luke Hudson <luke@catalyst.net.nz>

lang/en_utf8/wiki.php
mod/wiki/view.php

index 9a2e9f609e0bced8f1af8f8d4b180308ad53dc67..c55a0f66341413c7e316e93a51d6c1834675f980 100644 (file)
@@ -130,6 +130,8 @@ $string['plaintext'] = 'Plain Text';
 $string['preview'] = 'Preview';
 $string['readonly'] = 'Read only page';
 $string['refs'] = 'References';
+$string['reloadlinkdescription'] = 'Reloads the page, so that any new content is shown.';
+$string['reloadlinktext'] = 'Reload this page'; 
 $string['removenotice'] = 'Note that only unreferenced pages will be listed here. And because the ewiki engine itself does only limited testing if a page is referenced it may miss some of them here.<br />If you however empty a page first, it will get listed here too. Various other database diagnostics are made as well.';
 $string['removepagecheck'] = 'Are you sure that you want to delete these pages ?';
 $string['removepages'] = 'Remove pages';
@@ -187,5 +189,4 @@ $string['wikiusage'] = 'Wiki usage';
 $string['withbinaries'] = 'Include binary content';
 $string['withvirtualpages'] = 'Include Wiki-Links';
 $string['wrongversionrange'] = '$a is not a correct range!';
-
 ?>
index 979b488cdacab63d75480d9a2f4151f362ab8b12..fb73310061ef433168f95ec67f0030f80afc6754 100644 (file)
     $userid       = optional_param('userid', 0, PARAM_INT);              // User wiki.
     $groupid      = optional_param('groupid', 0, PARAM_INT);             // Group wiki.
     $canceledit   = optional_param('canceledit','', PARAM_ALPHA);          // Editing has been cancelled
+    $cacheme      = optional_param('allowcache', 1, PARAM_INT);   // Set this to 0 to try and disable page caching.
 
     // Only want to add edit log entries if we have made some changes ie submitted a form
     $editsave = optional_param('thankyou', '');
     
-
-
     if ($id) {
         if (! $cm = get_record("course_modules", "id", $id)) {
             error("Course Module ID was incorrect");
 
     print_header_simple($ewiki_title?$ewiki_title:format_string($wiki->name), "",
                 "<a href=\"index.php?id=$course->id\">$strwikis</a> -> <a href=\"view.php?id=$moodleID\">".format_string($wiki->name,true)."</a>".($ewiki_title?" -> $ewiki_title":""),
-                "", "", true, update_module_button($cm->id, $course->id, $strwiki),
+                "", "", $cacheme, update_module_button($cm->id, $course->id, $strwiki),
                 navmenu($course, $cm));
 
 
         print_tabs($tabrows, $currenttab);
     }
 
+    /// Insert a link to force page refresh if new content isn't showing.
     
+    // build new URL + query string
+    $queries = preg_split('/[?&]/', me());     
+    $nqueries = count($queries);
+    $me = $queries[0] . '?';
+    for($i=1; $i < $nqueries; $i++)
+    {
+        if( !strstr($queries[$i], 'allowcache') )
+               $me .= $queries[$i] . '&'; 
+    }
+    $me .= 'allowcache=0';
+
+    // Insert the link
+    $linkdesc = get_string('reloadlinkdescription', 'wiki');
+    $linktext = get_string('reloadlinktext', 'wiki');
+    echo "<div align='right' style='padding-bottom: 0.5em;'><a href='$me' title='$linkdesc'><input type='button' value='$linktext'></a></div>";
+
     print_simple_box_start('center', '100%', '', '20');
 
     /// Don't filter any pages containing wiki actions (except view). A wiki page containing