|
@@ -144,12 +144,18 @@ div#footer {
|
|
}
|
|
}
|
|
|
|
|
|
div#footer p {
|
|
div#footer p {
|
|
- color: #ccc;
|
|
|
|
|
|
+ color: #aaa;
|
|
margin: 0;
|
|
margin: 0;
|
|
font-size: xx-small;
|
|
font-size: xx-small;
|
|
padding: 0.5em
|
|
padding: 0.5em
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+div#footer a {
|
|
|
|
+ color: #225555;
|
|
|
|
+ text-decoration: none
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
div#navigation {
|
|
div#navigation {
|
|
padding: 0;
|
|
padding: 0;
|
|
margin: 0
|
|
margin: 0
|
|
@@ -599,6 +605,7 @@ wiki.display = function() {
|
|
$("#pageTitle").html(this._id);
|
|
$("#pageTitle").html(this._id);
|
|
$("#page-menu").html("");
|
|
$("#page-menu").html("");
|
|
$("<li class='pageSpecific'><a href='Javascript: wiki.edit()'>Edit</a></li>").appendTo("#page-menu");
|
|
$("<li class='pageSpecific'><a href='Javascript: wiki.edit()'>Edit</a></li>").appendTo("#page-menu");
|
|
|
|
+ $("<li class='pageSpecific'><a href='Javascript: wiki.history()'>History</a></li>").appendTo("#page-menu");
|
|
$("<li class='pageSpecific'><a href='Javascript: wiki.remove()'>Delete</a></li>").appendTo("#page-menu");
|
|
$("<li class='pageSpecific'><a href='Javascript: wiki.remove()'>Delete</a></li>").appendTo("#page-menu");
|
|
window.location = "wiki.html#" + this._id;
|
|
window.location = "wiki.html#" + this._id;
|
|
|
|
|
|
@@ -607,12 +614,12 @@ wiki.display = function() {
|
|
wiki.init = function() {
|
|
wiki.init = function() {
|
|
wiki._id = "";
|
|
wiki._id = "";
|
|
delete wiki._rev;
|
|
delete wiki._rev;
|
|
|
|
+ delete wiki._revisions;
|
|
wiki.body = "";
|
|
wiki.body = "";
|
|
wiki.edited_on = "";
|
|
wiki.edited_on = "";
|
|
wiki.edited_by = "";
|
|
wiki.edited_by = "";
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
wiki.remove = function() {
|
|
wiki.remove = function() {
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'delete',
|
|
type: 'delete',
|
|
@@ -625,17 +632,17 @@ wiki.remove = function() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
wiki.open = function(id) {
|
|
wiki.open = function(id) {
|
|
wiki.init();
|
|
wiki.init();
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'get',
|
|
type: 'get',
|
|
- url: '../' + id,
|
|
|
|
|
|
+ url: '../' + id + "?revs=true",
|
|
success: function(data) {
|
|
success: function(data) {
|
|
var page = JSON.parse(data);
|
|
var page = JSON.parse(data);
|
|
wiki._id = page._id;
|
|
wiki._id = page._id;
|
|
wiki._rev = page._rev;
|
|
wiki._rev = page._rev;
|
|
wiki.body = page.body;
|
|
wiki.body = page.body;
|
|
|
|
+ wiki._revisions = page._revisions;
|
|
wiki.edited_on = page.edited_on;
|
|
wiki.edited_on = page.edited_on;
|
|
wiki.edited_by = page.edited_by;
|
|
wiki.edited_by = page.edited_by;
|
|
wiki.display();
|
|
wiki.display();
|
|
@@ -671,7 +678,6 @@ wiki.edit = function() {
|
|
$("#title").val("");
|
|
$("#title").val("");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
var pages;
|
|
var pages;
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'get',
|
|
type: 'get',
|
|
@@ -746,7 +752,6 @@ wiki.applyTemplate = function(id) {
|
|
}
|
|
}
|
|
|
|
|
|
wiki.remove = function() {
|
|
wiki.remove = function() {
|
|
-
|
|
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'delete',
|
|
type: 'delete',
|
|
url: '../' + this._id + '?rev=' + this._rev,
|
|
url: '../' + this._id + '?rev=' + this._rev,
|
|
@@ -758,6 +763,32 @@ wiki.remove = function() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+wiki.history = function() {
|
|
|
|
+//create a holder for the history list
|
|
|
|
+ $('#page-body').html('<h2>Page history</h2><ul id="history"></ul>').hide().fadeIn("slow");
|
|
|
|
+ //get the current rev number
|
|
|
|
+ var rev = this._revisions.start;
|
|
|
|
+ //iterate through the revisions
|
|
|
|
+ for(var x in this._revisions.ids)
|
|
|
|
+ {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'GET',
|
|
|
|
+ url: '../' + this._id + '?rev=' + rev + '-' + this._revisions.ids[x],
|
|
|
|
+ success: function(data) {
|
|
|
|
+ var page = JSON.parse(data);
|
|
|
|
+ $('<li>Edited on ' + page.edited_on + ' by ' + page.edited_by + '<a id="' + page._rev + '"> View</a></li>').appendTo('#history');
|
|
|
|
+ $('#' + page._rev).click(function(){
|
|
|
|
+ wiki.body = page.body;
|
|
|
|
+ wiki.display();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ error: function(data) {
|
|
|
|
+ $('<li>Revision ' + this._revisions.ids[x] + ' is unavailable.').appendTo('#history');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ rev--;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
//Finally, some miscellaneous useful functions
|
|
//Finally, some miscellaneous useful functions
|
|
@@ -902,7 +933,10 @@ $(document).ready(function()
|
|
error: function(xhr, statusText) {
|
|
error: function(xhr, statusText) {
|
|
if(xhr.status == 404) {
|
|
if(xhr.status == 404) {
|
|
//if we get a 404 from the settings, assume this is a first time install. Lets create some objects in the DB for us
|
|
//if we get a 404 from the settings, assume this is a first time install. Lets create some objects in the DB for us
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ //and a place to show progress
|
|
|
|
+ $("#container").html("<h1>Installing TapirWiki</h1><p>Before you use TapirWiki for the first time, a few default pages need to be loaded:</p><ul id='install-log'></ul><div id='install-result'></div>");
|
|
|
|
+
|
|
//design doc - this provides the list of all wiki pages
|
|
//design doc - this provides the list of all wiki pages
|
|
var designDoc = {
|
|
var designDoc = {
|
|
"_id": "_design/allPages",
|
|
"_id": "_design/allPages",
|
|
@@ -995,7 +1029,7 @@ $(document).ready(function()
|
|
pop(HelpOnGettingStartedPage);
|
|
pop(HelpOnGettingStartedPage);
|
|
|
|
|
|
//Finally, let the user know installation is complete
|
|
//Finally, let the user know installation is complete
|
|
- $("#container").html("<h2>Installation complete</h2><p>Congratulations, TapirWiki has been set up correctly. Please refresh this page to access your new wiki</p>");
|
|
|
|
|
|
+ $("#install-result").html("<h2>Installation complete</h2><p>Congratulations, TapirWiki has been set up correctly. Please refresh this page to access your new wiki or click <a href='./wiki.html'>here</a>.</p>");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1006,8 +1040,14 @@ function pop(obj) {
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'put',
|
|
type: 'put',
|
|
url: '../' + obj._id,
|
|
url: '../' + obj._id,
|
|
- data: JSON.stringify(obj)
|
|
|
|
|
|
+ data: JSON.stringify(obj),
|
|
|
|
+ success: function(data) {
|
|
|
|
+ $("#install-log").append("<li>" + obj._id + " loaded...</li>"); },
|
|
|
|
+ error: function(data) {
|
|
|
|
+ $("#install-log").append("<li style='color:#f00'>" + obj._id + " failed. Please delete this database and try again. If the problem persists, please log an issue <a href='http://code.google.com/p/tapirwiki/'>here</a>.</li>");
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
</script>
|
|
</script>
|
|
@@ -1029,7 +1069,7 @@ function pop(obj) {
|
|
<div id="inner-content"><p>Loading...</p></div>
|
|
<div id="inner-content"><p>Loading...</p></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div id="footer"><p>Powered by TapirWiki. Find a tapir and love it!</p></div>
|
|
|
|
|
|
+ <div id="footer"><p>Powered by <a href="http://code.google.com/p/tapirwiki/">TapirWiki</a>. Find a tapir and love it!</p></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|