\ No newline at end of file
diff --git a/apps/wiki/templates/wiki/tag_dialog.html b/apps/wiki/templates/wiki/tag_dialog.html
index 7212e36b..66b488cd 100644
--- a/apps/wiki/templates/wiki/tag_dialog.html
+++ b/apps/wiki/templates/wiki/tag_dialog.html
@@ -1,19 +1,18 @@
diff --git a/apps/wiki/urls.py b/apps/wiki/urls.py
index d649ba5a..dd0a0df1 100644
--- a/apps/wiki/urls.py
+++ b/apps/wiki/urls.py
@@ -18,8 +18,7 @@ urlpatterns = patterns('wiki.views',
'document_diff', name="wiki_diff"),
url(r'^(?P[^/]+)/tags$',
'document_add_tag', name="wiki_add_tag"),
- url(r'^(?P[^/]+)/tags$',
- 'document_publish'),
+ url(r'^(?P[^/]+)/publish$', 'document_publish'),
url(r'^(?P[^/]+)$',
'document_detail', name="wiki_details"),
)
diff --git a/apps/wiki/views.py b/apps/wiki/views.py
index e466d6a2..82693393 100644
--- a/apps/wiki/views.py
+++ b/apps/wiki/views.py
@@ -64,7 +64,7 @@ def document_detail(request, name, template_name='wiki/document_details.html'):
'document_meta': document.meta,
'forms': {
"text_save": DocumentTextSaveForm(prefix="textsave"),
- "add_tag": DocumentTagForm(prefix="addtag")
+ "add_tag": DocumentTagForm(prefix="addtag"),
},
})
diff --git a/lib/vstorage.py b/lib/vstorage.py
index 4cfd59aa..f3480744 100644
--- a/lib/vstorage.py
+++ b/lib/vstorage.py
@@ -266,19 +266,6 @@ class VersionedStorage(object):
self.repo.remove([repo_file])
self._commit([repo_file], text, user)
-# @with_working_copy_locked
-# def _open_page(self, title):
-# if title not in self:
-# raise DocumentNotFound()
-#
-# path = self._title_to_file(title)
-# logger.debug("Opening page %s", path)
-# try:
-# return self.repo.wfile(path, 'rb')
-# except IOError:
-# logger.exception("Failed to open page %s", title)
-# raise DocumentNotFound()
-
def page_text(self, title, revision=None):
"""Read unicode text of a page."""
ctx = self._find_filectx(title, revision)
@@ -286,14 +273,14 @@ class VersionedStorage(object):
def page_text_by_tag(self, title, tag):
"""Read unicode text of a taged page."""
- tag = u"{title}#{tag}".format(**locals()).encode('utf-8')
fname = self._title_to_file(title)
+ tag = u"{fname}#{tag}".format(**locals()).encode('utf-8')
try:
ctx = self.repo[tag][fname]
return ctx.data().decode(self.charset, 'replace'), ctx.filerev()
except IndexError:
- raise DocumentNotFound()
+ raise DocumentNotFound(fname)
@with_working_copy_locked
def page_file_meta(self, title):
@@ -309,11 +296,11 @@ class VersionedStorage(object):
def page_meta(self, title):
"""Get page's revision, date, last editor and his edit comment."""
if not title in self:
- raise DocumentNotFound()
+ raise DocumentNotFound(title)
filectx_tip = self._find_filectx(title)
if filectx_tip is None:
- raise DocumentNotFound()
+ raise DocumentNotFound(title)
rev = filectx_tip.filerev()
filectx = filectx_tip.filectx(rev)
date = datetime.datetime.fromtimestamp(filectx.date()[0])
@@ -336,9 +323,7 @@ class VersionedStorage(object):
def _find_filectx(self, title, rev=None):
"""Find the last revision in which the file existed."""
-
repo_file = self._title_to_file(title)
-
changectx = self._changectx() # start with tip
stack = [changectx]
@@ -360,7 +345,7 @@ class VersionedStorage(object):
return fctx
except (IndexError, LookupError) as e:
- raise DocumentNotFound()
+ raise DocumentNotFound(title)
def page_history(self, title):
"""Iterate over the page's history."""
@@ -386,10 +371,12 @@ class VersionedStorage(object):
@with_working_copy_locked
def add_page_tag(self, title, rev, tag, user, doctag=True):
+ ctitle = self._title_to_file(title)
+
if doctag:
- tag = u"{title}#{tag}".format(**locals()).encode('utf-8')
+ tag = u"{ctitle}#{tag}".format(**locals()).encode('utf-8')
- message = u"Assigned tag {tag!r} to version {rev!r} of {title!r}".format(**locals()).encode('utf-8')
+ message = u"Assigned tag {tag!r} to version {rev!r} of {ctitle!r}".format(**locals()).encode('utf-8')
fctx = self._find_filectx(title, rev)
self.repo.tag(
diff --git a/lib/wlapi.py b/lib/wlapi.py
index 0a674c8c..3284211a 100644
--- a/lib/wlapi.py
+++ b/lib/wlapi.py
@@ -38,7 +38,7 @@ def api_call(path, format="json"):
# prepare request
rq = urllib2.Request(self.base_url + path + ".json")
- # will send POST when there is data, GET otherwise
+ # will send POST when there is data, GET otherwise
if data is not None:
rq.add_data(json.dumps(data))
rq.add_header("Content-Type", "application/json")
diff --git a/platforma/compress_settings.py b/platforma/compress_settings.py
index a2870014..ab72329f 100644
--- a/platforma/compress_settings.py
+++ b/platforma/compress_settings.py
@@ -41,6 +41,7 @@ COMPRESS_JS = {
# dialogs
'js/wiki/dialog_save.js',
+ 'js/wiki/dialog_addtag.js',
# views
'js/wiki/view_history.js',
diff --git a/platforma/context_processors.py b/platforma/context_processors.py
index db6c98b4..4492af70 100644
--- a/platforma/context_processors.py
+++ b/platforma/context_processors.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8
-
def settings(request):
from django.conf import settings
- return {'MEDIA_URL': settings.MEDIA_URL,
- 'STATIC_URL': settings.STATIC_URL,
- 'REDMINE_URL': settings.REDMINE_URL}
+ return {
+ 'MEDIA_URL': settings.MEDIA_URL,
+ 'STATIC_URL': settings.STATIC_URL,
+ }
diff --git a/platforma/settings.py b/platforma/settings.py
index 4ec680fb..1f9d5d00 100644
--- a/platforma/settings.py
+++ b/platforma/settings.py
@@ -60,6 +60,7 @@ ADMIN_MEDIA_PREFIX = '/admin-media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ife@x^_lak+x84=lxtr!-ur$5g$+s6xt85gbbm@e_fk6q3r8=+'
+SESSION_COOKIE_NAME = "redakcja_sessionid"
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
@@ -156,7 +157,7 @@ IMAGE_DIR = 'images'
WL_API_CONFIG = {
"URL": "http://localhost:7000/api/",
- "AUTH_REALM": "wlapi",
+ "AUTH_REALM": "WL API",
"AUTH_USER": "platforma",
"AUTH_PASSWD": "platforma",
}
diff --git a/platforma/static/js/wiki/dialog_addtag.js b/platforma/static/js/wiki/dialog_addtag.js
index 42a81483..1a90ccf6 100644
--- a/platforma/static/js/wiki/dialog_addtag.js
+++ b/platforma/static/js/wiki/dialog_addtag.js
@@ -14,8 +14,8 @@
/* fill out hidden fields */
this.$form = $('form', element);
- $("input[name='id']", this.$form).val(CurrentDocument.id);
- $("input[name='revision']", this.$form).val(options.revision);
+ $("input[name='addtag-id']", this.$form).val(CurrentDocument.id);
+ $("input[name='addtag-revision']", this.$form).val(options.revision);
$.wiki.cls.GenericDialog.call(this, element);
};
diff --git a/platforma/static/js/wiki/dialog_save.js b/platforma/static/js/wiki/dialog_save.js
index 12f131fd..916f3260 100644
--- a/platforma/static/js/wiki/dialog_save.js
+++ b/platforma/static/js/wiki/dialog_save.js
@@ -11,8 +11,8 @@
/* fill out hidden fields */
this.$form = $('form', element);
- $("input[name='id']", this.$form).val(CurrentDocument.id);
- $("input[name='parent_revision']", this.$form).val(CurrentDocument.revision);
+ $("input[name='textsave-id']", this.$form).val(CurrentDocument.id);
+ $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision);
$.wiki.cls.GenericDialog.call(this, element);
};
diff --git a/platforma/static/js/wiki/view_history.js b/platforma/static/js/wiki/view_history.js
index b2fe0b00..5a3e8131 100644
--- a/platforma/static/js/wiki/view_history.js
+++ b/platforma/static/js/wiki/view_history.js
@@ -71,7 +71,7 @@
var $stub = $('#history-view .row-stub');
changes_list.html('');
- var tags = $('select#id_addtag_tag option');
+ var tags = $('select#id_addtag-tag option');
$.each(data, function(){
$.wiki.renderStub({
diff --git a/platforma/static/js/wiki/view_summary.js b/platforma/static/js/wiki/view_summary.js
index 736f4e33..811096dd 100644
--- a/platforma/static/js/wiki/view_summary.js
+++ b/platforma/static/js/wiki/view_summary.js
@@ -9,7 +9,7 @@
$.blockUI({message: "Oczekiwanie na odpowiedź serwera..."});
self.doc.publish({
success: function(doc, data) {
- $.blockUI({message: "UdaÅo siÄ", timeout: 2000});
+ $.blockUI({message: "UdaÅo siÄ.", timeout: 2000});
},
failure: function(doc, message) {
$.blockUI({
@@ -17,10 +17,10 @@
timeout: 5000
});
}
-
+
});
});
-
+
old_callback.call(this);
};
diff --git a/platforma/static/js/wiki/wikiapi.js b/platforma/static/js/wiki/wikiapi.js
index a2883979..d0ac5dce 100644
--- a/platforma/static/js/wiki/wikiapi.js
+++ b/platforma/static/js/wiki/wikiapi.js
@@ -16,39 +16,39 @@
function reverse() {
var vname = arguments[0];
var base_path = "/documents";
-
+
if (vname == "ajax_document_text") {
var path = "/" + arguments[1] + "/text";
-
- if (arguments[2] !== undefined)
+
+ if (arguments[2] !== undefined)
path += "/" + arguments[2];
-
+
return base_path + path;
}
-
+
if (vname == "ajax_document_history") {
-
+
return base_path + "/" + arguments[1] + "/history";
}
-
+
if (vname == "ajax_document_gallery") {
-
+
return base_path + "/gallery/" + arguments[1];
}
-
- if (vname == "ajax_document_diff")
+
+ if (vname == "ajax_document_diff")
return base_path + "/" + arguments[1] + "/diff";
-
+
if (vname == "ajax_document_addtag")
return base_path + "/" + arguments[1] + "/tags";
-
+
if (vname == "ajax_publish")
return base_path + "/" + arguments[1] + "/publish";
-
- console.log("Couldn't reverse match:", vname);
+
+ console.log("Couldn't reverse match:", vname);
return "/404.html";
};
-
+
/*
* Document Abstraction
*/
@@ -64,7 +64,7 @@
this._context_lock = -1;
this._lock_count = 0;
};
-
+
WikiDocument.prototype.triggerDocumentChanged = function() {
$(document).trigger('wlapi_document_changed', this);
};
@@ -80,15 +80,15 @@
dataType: 'json',
success: function(data) {
var changed = false;
-
-if (self.text === null || self.revision !== data.revision) {
+
+ if (self.text === null || self.revision !== data.revision) {
self.text = data.text;
self.revision = data.revision;
self.gallery = data.gallery;
changed = true;
self.triggerDocumentChanged();
};
-
+
self.has_local_changes = false;
params['success'](self, changed);
},
@@ -188,23 +188,24 @@ if (self.text === null || self.revision !== data.revision) {
WikiDocument.prototype.save = function(params) {
params = $.extend({}, noops, params);
var self = this;
-
+
if (!self.has_local_changes) {
- console.log("Abort: no changes.");
+ console.log("Abort: no changes.");
return params['success'](self, false, "Nie ma zmian do zapisania.");
};
-
+
// Serialize form to dictionary
var data = {};
$.each(params['form'].serializeArray(), function() {
data[this.name] = this.value;
});
+
var metaComment = '\n'
-
+
data['textsave-text'] = metaComment + self.text;
-
+
$.ajax({
url: reverse("ajax_document_text", self.id),
type: "POST",
@@ -212,7 +213,7 @@ if (self.text === null || self.revision !== data.revision) {
data: data,
success: function(data) {
var changed = false;
-
+
if (data.text) {
self.text = data.text;
self.revision = data.revision;
@@ -220,19 +221,19 @@ if (self.text === null || self.revision !== data.revision) {
changed = true;
self.triggerDocumentChanged();
};
-
+
params['success'](self, changed, ((changed && "UdaÅo siÄ zapisaÄ :)") || "Twoja wersja i serwera jest identyczna"));
},
error: function(xhr) {
try {
params['failure'](self, $.parseJSON(xhr.responseText));
- }
+ }
catch (e) {
params['failure'](self, {
"__message": "