Skip to content

Commit

Permalink
wiki: Added a link to force reloading of the page (WR#515)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
martinlanghoff committed Jul 31, 2006
1 parent c58f4f1 commit 21c2f2e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lang/en_utf8/wiki.php
Expand Up @@ -130,6 +130,8 @@
$string['preview'] = 'Preview'; $string['preview'] = 'Preview';
$string['readonly'] = 'Read only page'; $string['readonly'] = 'Read only page';
$string['refs'] = 'References'; $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['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['removepagecheck'] = 'Are you sure that you want to delete these pages ?';
$string['removepages'] = 'Remove pages'; $string['removepages'] = 'Remove pages';
Expand Down Expand Up @@ -187,5 +189,4 @@
$string['withbinaries'] = 'Include binary content'; $string['withbinaries'] = 'Include binary content';
$string['withvirtualpages'] = 'Include Wiki-Links'; $string['withvirtualpages'] = 'Include Wiki-Links';
$string['wrongversionrange'] = '$a is not a correct range!'; $string['wrongversionrange'] = '$a is not a correct range!';

?> ?>
22 changes: 19 additions & 3 deletions mod/wiki/view.php
Expand Up @@ -16,12 +16,11 @@
$userid = optional_param('userid', 0, PARAM_INT); // User wiki. $userid = optional_param('userid', 0, PARAM_INT); // User wiki.
$groupid = optional_param('groupid', 0, PARAM_INT); // Group wiki. $groupid = optional_param('groupid', 0, PARAM_INT); // Group wiki.
$canceledit = optional_param('canceledit','', PARAM_ALPHA); // Editing has been cancelled $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 // Only want to add edit log entries if we have made some changes ie submitted a form
$editsave = optional_param('thankyou', ''); $editsave = optional_param('thankyou', '');




if ($id) { if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) { if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
Expand Down Expand Up @@ -245,7 +244,7 @@


print_header_simple($ewiki_title?$ewiki_title:format_string($wiki->name), "", 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":""), "<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)); navmenu($course, $cm));




Expand Down Expand Up @@ -346,7 +345,24 @@
print_tabs($tabrows, $currenttab); 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'); print_simple_box_start('center', '100%', '', '20');


/// Don't filter any pages containing wiki actions (except view). A wiki page containing /// Don't filter any pages containing wiki actions (except view). A wiki page containing
Expand Down

0 comments on commit 21c2f2e

Please sign in to comment.