# 'dc_url': reverse('docdc_view', args=[doc.id]),
'gallery_url': reverse('docgallery_view', args=[doc.id]),
'merge_url': reverse('docmerge_view', args=[doc.id]),
- 'user_revision': doc.revision,
- 'user_timestamp': doc.revision.timestamp,
+ 'revision': doc.revision,
+ 'timestamp': doc.revision.timestamp,
# 'public_revision': doc.revision,
# 'public_timestamp': doc.revision.timestamp,
}
return response.SuccessAllOk().django_response({
"name": user_doc_new.id,
"user": user_doc_new.owner,
- "parent_revision": user_doc_new.revision,
- "parent_shared_revision": doc.revision,
+
"revision": user_doc_new.revision,
- "shared_revision": doc_new.revision,
'timestamp': user_doc_new.revision.timestamp,
+
+ "parent_revision": user_doc_new.revision,
+ "parent_timestamp": user_doc_new.revision.timestamp,
+
+ "shared_revision": doc_new.revision,
+ "shared_timestamp": doc_new.revision.timestamp,
+
+ "shared_parent_revision": doc.revision,
+ "shared_parent_timestamp": doc.revision.timestamp,
})
\ No newline at end of file
Editor.DocumentModel = Editor.Model.extend({
_className: 'Editor.DocumentModel',
- data: null, // name, text_url, user_revision, latest_shared_rev, parts_url, dc_url, size, merge_url
+ data: null, // name, text_url, revision, latest_shared_rev, parts_url, dc_url, size, merge_url
contentModels: {},
state: 'empty',
errors: '',
this.set('data', data);
this.set('state', 'synced');
- this.set('revision', data.user_revision);
+ this.set('revision', data.revision);
this.set('user', data.user);
this.contentModels = {
for (key in this.contentModels) {
if (this.contentModels[key].guid() == contentModel.guid()) {
this.contentModels[key].set('state', 'synced');
- this.data.user_revision = this.contentModels[key].get('revision');
+ this.revision = this.contentModels[key].get('revision');
+
}
}
for (key in this.contentModels) {
if (this.contentModels[key].guid() != contentModel.guid()) {
- this.contentModels[key].set('revision', this.data.user_revision);
+ this.contentModels[key].set('revision', this.revision);
this.contentModels[key].set('state', 'empty');
}
}
update: function() {
this.set('state', 'loading');
- messageCenter.addMessage('info', 'Uaktualniam dokument...');
+
+ messageCenter.addMessage('info', 'doc_update',
+ 'Uaktualniam dokument...');
+
$.ajax({
url: this.data.merge_url,
dataType: 'json',
type: 'post',
data: {
type: 'update',
- revision: this.revision,
- user: this.user
+ revision: this.get('revision'),
+ user: this.get('user')
},
complete: this.updateCompleted.bind(this),
success: function(data) {
this.set('updateData', data);
+ console.log("new data:", data)
}.bind(this)
});
},
updateCompleted: function(xhr, textStatus) {
console.log(xhr.status, textStatus);
- if (xhr.status == 200) { // Sukces
- this.data = this.get('updateData');
- this.revision = this.data.user_revision;
- this.user = this.data.user;
-
- messageCenter.addMessage('info', null, 'Uaktualnienie dokumentu do wersji ' + this.get('updateData').revision,
- 'Uaktualnienie dokumentu do wersji ' + this.get('updateData').revision);
- for (var key in this.contentModels) {
- this.contentModels[key].set('revision', this.data.user_revision);
- this.contentModels[key].set('state', 'empty');
+
+ if (xhr.status == 200)
+ {
+ var udata = this.get('updateData');
+ if(udata.timestamp == udata.parent_timestamp)
+ {
+ // no change
+ messageCenter.addMessage('info', 'doc_update',
+ 'Nic się nie zmieniło od ostatniej aktualizacji. Po co mam uaktualniać?');
+
}
- messageCenter.addMessage('success', null, 'Uaktualniłem dokument do najnowszej wersji :-)');
- } else if (xhr.status == 202) { // Wygenerowano PullRequest (tutaj?)
- } else if (xhr.status == 204) { // Nic nie zmieniono
- messageCenter.addMessage('info', null, 'Nic się nie zmieniło od ostatniej aktualizacji. Po co mam uaktualniać?');
+ else {
+ this.set('revision', udata.revision);
+ this.set('user', udata.user);
+ messageCenter.addMessage('info', 'doc_update',
+ 'Uaktualnienie dokumentu do wersji ' + udata.revision);
+
+ for (var key in this.contentModels) {
+ this.contentModels[key].set('revision', this.get('revision') );
+ this.contentModels[key].set('state', 'empty');
+ }
+ }
} else if (xhr.status == 409) { // Konflikt podczas operacji
- messageCenter.addMessage('error', null, 'Wystąpił konflikt podczas aktualizacji. Pędź po programistów! :-(');
- } else if (xhr.status == 500) {
- messageCenter.addMessage('critical', null, 'Błąd serwera. Pędź po programistów! :-(');
+ messageCenter.addMessage('error', 'doc_update',
+ 'Wystąpił konflikt podczas aktualizacji. Pędź po programistów! :-(');
+ } else {
+ messageCenter.addMessage('critical', 'doc_update',
+ 'Nieoczekiwany błąd. Pędź po programistów! :-(');
}
+
this.set('state', 'synced');
this.set('updateData', null);
},
merge: function(message) {
this.set('state', 'loading');
- messageCenter.addMessage('info', null, 'Scalam dokument z głównym repozytorium...');
+ messageCenter.addMessage('info', null,
+ 'Scalam dokument z głównym repozytorium...');
+
$.ajax({
url: this.data.merge_url,
type: 'post',
dataType: 'json',
data: {
type: 'share',
- revision: this.revision,
- user: this.user,
+ revision: this.get('revision'),
+ user: this.get('user'),
message: message
},
complete: this.mergeCompleted.bind(this),
mergeCompleted: function(xhr, textStatus) {
console.log(xhr.status, textStatus);
if (xhr.status == 200) { // Sukces
- this.data = this.get('updateData');
- this.revision = this.data.user_revision;
- this.user = this.data.user;
+ this.set('revision', this.get('updateData').revision);
+ this.set('user', this.get('updateData').user);
for (var key in this.contentModels) {
- this.contentModels[key].set('revision', this.revision);
+ this.contentModels[key].set('revision', this.get('revision'));
this.contentModels[key].set('state', 'empty');
}
{% extends "base.html" %}
+{% load i18n %}
{% block extrahead %}
<link rel="stylesheet" href="{{STATIC_URL}}css/jquery.modal.css" type="text/css" media="screen" charset="utf-8">
<% for (panel in panels) { %>
<option value="<%= panel %>"><%= panel %></option>
<% }; %>
- </select> <button class="refresh">Odśwież panel</button></p>
+ </select> <button class="refresh">{% trans "Refresh panel" noop %}</button></p>
</div>
<div class="content-view"></div>
</script>
<script type="text/html" charset="utf-8" id="html-view-template">
<div class="htmlview-toolbar">
- <a class="html-print-link" href="print" ui:baseref="{% url file_print fileid %}" target="_new">Wersja do druku</a>
+ <a class="html-print-link" href="print" ui:baseref="{% url file_print fileid %}" target="_new">{% trans "Print version" noop %}</a>
</div>
<div class="htmlview">
<button type="button" class="image-gallery-next-button">
- <img alt="Next" src="{{STATIC_URL}}/icons/go-next.png" width="16" height="16" />
+ <img alt="{% trans 'Next page' noop %}" src="{{STATIC_URL}}/icons/go-next.png" width="16" height="16" />
</button>
<button type="button" class="image-gallery-zoom-in">
- <img alt="Zoom in" src="{{STATIC_URL}}/icons/zoom_in.png" width="16" height="16" />
+ <img alt="{% trans 'Zoom in' noop %}" src="{{STATIC_URL}}/icons/zoom_in.png" width="16" height="16" />
</button>
<button type="button" class="image-gallery-zoom-out">
- <img alt="Zoom out" src="{{STATIC_URL}}/icons/zoom_out.png" width="16" height="16" />
+ <img alt="{% trans 'Zoom out' noop %}" src="{{STATIC_URL}}/icons/zoom_out.png" width="16" height="16" />
</button>
<button type="button" class="image-gallery-zoom-reset">
- <img alt="Zoom reset" src="{{STATIC_URL}}/icons/zoom.png" width="16" height="16" />
+ <img alt="{% trans 'Reset zoom' noop %}" src="{{STATIC_URL}}/icons/zoom.png" width="16" height="16" />
</button>
</p>
</div>
{% block breadcrumbs %}<a href="{% url file_list %}">Platforma</a> > {{euser}} > {{ fileid }}{% endblock breadcrumbs %}
{% block header-toolbar %}
- <a href="http://stigma.nowoczesnapolska.org.pl/platforma-hg/ksiazki/log/tip/{{ fileid }}.xml" target="_new" >Historia</a>
- <button id="action-merge">Merge</button>
- <button id="action-update">Update</button>
- <button id="action-commit">Commit</button>
- <button id="action-quick-save">Quick Save</button>
+ <a href="http://stigma.nowoczesnapolska.org.pl/platforma-hg/ksiazki/log/tip/{{ fileid }}.xml" target="_new" >{% trans 'History' noop %}</a>
+ <button id="action-merge">{% trans 'Push' noop %}</button>
+ <button id="action-update">{% trans 'Pull' noop %}</button>
+ <button id="action-commit">{% trans 'Save' noop %}</button>
+ <button id="action-quick-save">{% trans 'Quick save' noop %}</button>
{% endblock %}
{% block maincontent %}