From: skaldrom Date: Tue, 8 Jun 2004 20:22:13 +0000 (+0000) Subject: Better fix for Bug #1530 - Wiki diffs useless when using HTML editor X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bc1f9c7349c23eb36f26a9d8d5257dfe921c7161;p=moodle.git Better fix for Bug #1530 - Wiki diffs useless when using HTML editor --- diff --git a/lang/en/wiki.php b/lang/en/wiki.php index bc0fde5cac..c53c056cb9 100644 --- a/lang/en/wiki.php +++ b/lang/en/wiki.php @@ -172,6 +172,7 @@ $string['contentsize']='Content size'; $string['pageslinkingto']="Pages linking to this page"; $string['viewsmfor']="View sitemap for"; $string['smfor']="Sitemap for"; +$string['uplinsect']="Upload into"; $string['invalidroot']="You are not authorized to access the current root page so no sitemap can be created."; $string['thispageisntlinkedfromanywhereelse'] = 'This page isn\'t linked from anywhere else.'; diff --git a/mod/wiki/TODO.txt b/mod/wiki/TODO.txt index 6ee32ca578..4507b2a003 100644 --- a/mod/wiki/TODO.txt +++ b/mod/wiki/TODO.txt @@ -8,7 +8,8 @@ Mike: - Grading Michael: - - More Logging + - Upload: There is an error when having a bin html-wiki: File does not show up + - Log when up- or download - Notify when page changes Unassigned or not ready: diff --git a/mod/wiki/admin.php b/mod/wiki/admin.php index 9e94bfe75d..fde84fd51a 100644 --- a/mod/wiki/admin.php +++ b/mod/wiki/admin.php @@ -78,7 +78,7 @@ # Check for dangerous events (hacking) ! if(in_array($action,array("removepages","strippages","revertpages"))) { if(!($wiki->wtype=="student" || isteacher($course->id))) { - add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with $action."); + add_to_log($course->id, "wiki", "hack", "", $wiki->name.": Tried to trick admin.php with action=$action."); error("Hack attack detected !"); } } @@ -151,7 +151,7 @@ // No additional info break; } - add_to_log($course->id, "wiki", $action, "admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id", $wiki->name.($addloginfo?" ".$addloginfo:"")); + add_to_log($course->id, "wiki", $action, "admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id", $wiki->name.($addloginfo?": ".$addloginfo:"")); $link="admin.php?action=$action&userid=$userid&groupid=$groupid&id=$id&wikipage=$wikipage"; switch($action) { case "removepages": diff --git a/mod/wiki/ewiki/ewiki.php b/mod/wiki/ewiki/ewiki.php index 631e6c11ea..f63541f507 100644 --- a/mod/wiki/ewiki/ewiki.php +++ b/mod/wiki/ewiki/ewiki.php @@ -1144,7 +1144,7 @@ function ewiki_page_info($id, &$data, $action) { ##### BEGIN MOODLE ADDITION ##### $o .= '$current["version"])) . - '">' . get_string($title,"wiki") . ' '; + '">' . get_string($title,"wiki") . ' '; ##### END MOODLE ADDITION ##### } $o .= "\n"; diff --git a/mod/wiki/ewiki/plugins/moodle/diff.php b/mod/wiki/ewiki/plugins/moodle/diff.php index 9a393b8bee..bd09eba198 100755 --- a/mod/wiki/ewiki/plugins/moodle/diff.php +++ b/mod/wiki/ewiki/plugins/moodle/diff.php @@ -34,17 +34,29 @@ # Different handling for html: closes Bug #1530 - Wiki diffs useless when using HTML editor if($wiki->htmlmode==2) { - $htmlendings=array("
","
","

","
","
","",""); - $splitregexp="+\s*\n|\s*(".join("|",$htmlendings).")+"; - $content0=preg_replace("+(".join("|",$htmlendings).")+","\n",$data0["content"]); - $content=preg_replace("+(".join("|",$htmlendings).")+","\n",$data["content"]); + $htmlendings=array("
","
","

","

","

","


","
","",""); + /// Replace

 

+ $content0=preg_replace("+

 

+i","\n",$data0["content"]); + $content0=preg_replace("+(".join("|",$htmlendings).")+","\n",$content0); + $content=preg_replace("+

 

+i","\n",$data["content"]); + $content=preg_replace("+(".join("|",$htmlendings).")+","\n",$content); } else { - $splitregexp="/\s*\n/"; $content0=$data0["content"]; $content=$data["content"]; } - $txt0 = preg_split($splitregexp, trim($content0)); - $txt2 = preg_split($splitregexp, trim($content)); + $txt0 = preg_split("+\s*\n+", trim($content0)); + $txt2 = preg_split("+\s*\n+", trim($content)); + ///print "
\n";
+    ///print "\$data0[content]:\n $data0[content]\n";
+    ///print "\n\n-----------\n\n";
+    ///print "\$data[content]:\n $data[content]\n";
+    ///print "\n\n-----------\n\n";
+    ///print "\$content0:\n $content0\n";
+    ///print "\n\n-----------\n\n";
+    ///print "\$content:\n $content\n";
+    ///print "\n\n-----------\n\n";    
+    ///print "
"; + ///exit; /// Remove empty lines in html if($wiki->htmlmode==2) { @@ -54,14 +66,16 @@ $txt2=array(); for($i=0;$ihtmlmode == 2) { - $o .= "
-$rm
\n"; + $o .= "-$rm
\n"; } else { $o .= "-$rm
\n"; } @@ -84,14 +98,14 @@ if (in_array($line, $diff2)) { if($wiki->htmlmode == 2) { - $o .= "
+$line\n"; + $o .= "+$line
\n"; } else { $o .= "+$line
\n"; } } else { if($wiki->htmlmode == 2) { - $o .= "$line\n"; + $o .= "$line
\n"; } else { $o .= "  $line
\n"; }