Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Wiki: fixed issue if you tried to set a page content to completely bl…

…ank (you need to switch the html editor into text mode to get this, otherwise it puts in <br/>, but one of our QA people managed to find it anyway).

Also corrected whitespace on some of the lock stuff (weird - how did those tabs get in there? hrm)
  • Loading branch information...
commit e364a5368d738edbdb9af985c931a4b1734c8842 1 parent 1bece91
sam_marshall authored

Showing 1 changed file with 16 additions and 9 deletions. Show diff stats Hide diff stats

  1. +16 9 mod/wiki/view.php
25 mod/wiki/view.php
@@ -69,16 +69,23 @@
69 69
70 70 // Remove lock when we go to another wiki page (such as the cancel page)
71 71 if(!$reallyedit) {
72   - wiki_release_lock($wiki->id,$pagename);
  72 + wiki_release_lock($wiki->id,$pagename);
73 73 }
74   -
75   - // We must have the edit lock in order to be permitted to save
76   - if(!empty($_POST['content'])) {
77   - list($ok,$lock)=wiki_obtain_lock($wiki->id,$pagename);
78   - if(!$ok) {
79   - $strsavenolock=get_string('savenolock','wiki');
80   - error($strsavenolock,$CFG->wwwroot.'/mod/wiki/view.php?id='.$cm->id.'&page=view/'.urlencode($pagename));
81   - }
  74 + if(array_key_exists('content',$_POST)) {
  75 + // Do not allow blank content because it causes problems (the wiki decides
  76 + // the page should automatically go into edit mode, but Moodle doesn't realise
  77 + // this and filters out the JS)
  78 + if($_POST['content']=='') {
  79 + $_POST['content']="\n";
  80 + $_REQUEST['content']="\n";
  81 + }
  82 +
  83 + // We must have the edit lock in order to be permitted to save
  84 + list($ok,$lock)=wiki_obtain_lock($wiki->id,$pagename);
  85 + if(!$ok) {
  86 + $strsavenolock=get_string('savenolock','wiki');
  87 + error($strsavenolock,$CFG->wwwroot.'/mod/wiki/view.php?id='.$cm->id.'&page=view/'.urlencode($pagename));
  88 + }
82 89 }
83 90
84 91 /// Add the course module 'groupmode' to the wiki object, for easy access.

0 comments on commit e364a53

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