- old versions may be reviewed and restored

- removed explicit replacement of '<' and '>', fix for first bug in: http://www.yacy-forum.de/viewtopic.php?t=3485

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3329 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
karlchenofhell 18 years ago
parent bf8f120340
commit 6667930352

@ -23,7 +23,10 @@
<a href="Wiki.html">Start Page</a> -
<a href="Wiki.html?index=Index">Index</a> -
<a href="Wiki.html?page=#[pagename]#&amp;diff=">Versions</a> -
#(access)#<a href="Wiki.html?access=all">Grant Write Access to Everybody</a>::<a href="Wiki.html?access=admin">Grant Write Access to Admin only</a>#(/access)#
<form method="post" action="Wiki.html">
<label for="access">Grant Write Access to</label>
#(access)#<input type="submit" name="access" value="all" />::<input type="submit" name="access" value="admin" />#(/access)#
</form>
</p>
::
<!-- 1: edit -->
@ -117,12 +120,14 @@
<form method="get" action="Wiki.html">
<fieldset><legend>Select versions of page '#[page]#</legend>
<input type="hidden" name="page" value="#[page]#" />
<input type="hidden" name="diff" value="" />
<dl>
<dt><label for="old">Compare version from</label>:</dt>
<dd>
<select id="old" name="old">#{versions}#
<option value="#[date]#"#(oldselected)#:: selected="selected"#(/oldselected)#>#[fdate]#</option>#{/versions}#
</select>
<input type="submit" name="viewold" value="Show" />
</dd>
<dt><label for="new">with version from</label>:</dt>
<dd>
@ -131,7 +136,7 @@
<option value="#[date]#"#(newselected)#:: selected="selected"#(/newselected)#>#[fdate]#</option>#{/versions}#
</select>
</dd>
<dt><input type="submit" name="diff" value="Compare" /></dt>
<dt><input type="submit" name="compare" value="Compare" /></dt>
</dl>
</fieldset>
</form>
@ -139,7 +144,50 @@
<p class="error">IO Error reading wiki database: #[message]#</p>
::<!-- no entries available for #[name]# -->
#(/error)#
#(versioning)#
::<!-- 1: View diff -->
#[diff]#
::<!-- 2: View selected version -->
<h2>Preview</h2>
<p>No changes have been submitted so far!</p>
<div class="Post">
<h2 class="PostSubject">YaCyWiki page: #[pagename]#</h2>
<div class="PostBody">
#[page]#
</div>
<p class="PostInfo">
last edited by #[author]# | change date #[date]#
</p>
</div>
<form action="Wiki.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="view" value="Discard" />
</fieldset>
<h2>Edit</h2>
<fieldset>
<dl>
<dt><label for="author">Author:</label></dt>
<dd>
<input name="author" id="author" type="text" size="80" maxlength="80" value="#[author]#" />
</dd>
<dt><label for="content">Text:</label></dt>
<dd>
<textarea name="content" id="content" cols="80" rows="24">#[page-code]#</textarea>
</dd>
</dl>
<p class="help">
You can use
<a href="WikiHelp.html" onclick="window.open('WikiHelp.html','WikiHelp','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');return false;">Wiki Code</a> here.
</p>
<input type="hidden" name="page" value="#[pagename]#" />
<input type="hidden" name="reason" value="edit" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
#(/versioning)#
<p class="Navigation">
<a href="Wiki.html">Start Page</a> -
<a href="Wiki.html?page=#[page]#">Return to #[page]#</a>

@ -143,7 +143,7 @@ public class Wiki {
try {
prop.put("mode", 1); //edit
prop.put("mode_author", author);
prop.put("mode_page-code", new String(page.page(), "UTF-8").replaceAll("<","&lt;").replaceAll(">","&gt;"));
prop.put("mode_page-code", new String(page.page(), "UTF-8"));
prop.put("mode_pagename", pagename);
} catch (UnsupportedEncodingException e) {}
}
@ -186,6 +186,7 @@ public class Wiki {
}
else if (post.containsKey("diff")) {
// Diff
prop.put("mode", 4);
prop.put("mode_page", pagename);
prop.put("mode_error_page", pagename);
@ -232,14 +233,20 @@ public class Wiki {
}
if (nentry == null) nentry = entry;
if (post.get("diff", "").length() > 0 && oentry != null && nentry != null) {
if (post.containsKey("compare") && oentry != null && nentry != null) {
// TODO: split into paragraphs and compare them with the same diff-algo
Diff diff = new Diff(
new String(oentry.page(), "UTF-8"),
new String(nentry.page(), "UTF-8"), 5);
prop.putASIS("mode_diff", Diff.toHTML(new Diff[] { diff }));
} else {
prop.put("mode_diff", "");
new String(nentry.page(), "UTF-8"), 3);
prop.putASIS("mode_versioning_diff", Diff.toHTML(new Diff[] { diff }));
prop.put("mode_versioning", 1);
} else if (post.containsKey("viewold") && oentry != null) {
prop.put("mode_versioning", 2);
prop.put("mode_versioning_pagename", pagename);
prop.put("mode_versioning_author", oentry.author());
prop.put("mode_versioning_date", dateString(oentry.date()));
prop.putWiki("mode_versioning_page", oentry.page());
prop.put("mode_versioning_page-code", new String(oentry.page(), "UTF-8"));
}
} catch (IOException e) {
prop.put("mode_error", 1); //IO Error reading Wiki

Loading…
Cancel
Save