file_contents = repo._get_file(path)
# wczytaj dokument z repozytorium
- document = parser.WLDocument.from_string(file_contents)
-
- rdf_ns = dcparser.BookInfo.RDF
- dc_ns = dcparser.BookInfo.DC
-
- rdf_attrs = {rdf_ns('about'): form.cleaned_data.pop('about')}
- field_dict = {}
-
- for key, value in form.cleaned_data.items():
- field_dict[ dc_ns(key) ] = value if isinstance(value, list) else [value]
-
- print field_dict
-
- new_info = dcparser.BookInfo(rdf_attrs, field_dict)
- document.book_info = new_info
-
+ document = parser.WLDocument.from_string(file_contents)
+ document.book_info.update(form.cleaned_data)
+
print "SAVING DC"
- # zapisz
+ # zapisz
repo._add_file(path, document.serialize())
repo._commit( \
message=(form.cleaned_data['commit_message'] or 'Lokalny zapis platformy.'), \
errors = [e.message]
if errors is None:
- errors = dict( (field[0], field[1].as_text()) for field in form.errors.iteritems() )
+ errors = ["Pole '%s': %s\n" % (field[0], field[1].as_text()) for field in form.errors.iteritems()]
return HttpResponse( json.dumps({'result': errors and 'error' or 'ok', 'errors': errors}) );
return;
var box = $('#message-box > #' + name);
- $('span.data', box).html(text);
+ $('*.data', box).html(text);
box.fadeIn();
self._nextPopup = function() {
var box = $('#message-box > #' + elem[0]);
box.fadeOut(300, function() {
- $('span.data', box).html();
+ $('*.data', box).html();
if( self.popupQueue.length > 0) {
box = $('#message-box > #' + self.popupQueue[0][0]);
- $('span.data', box).html(self.popupQueue[0][1]);
+ $('*.data', box).html(self.popupQueue[0][1]);
box.fadeIn();
setTimeout(self._nextPopup, 5000);
}
{% endblock %}
{% block message-box %}
- <div class="msg-success" id="save-successful">Zapisano :)<span class="data" /></div>
- <div class="msg-error" id="save-error">Błąd przy zapisie. <span class="data" /></div>
- <div class="msg-warning" id="not-implemented">Tej funkcji jeszcze nie ma :(<span class="data" /></div>
+ <div class="msg-success" id="save-successful"><p>Zapisano :)</p><p class="data" /></div>
+ <div class="msg-error" id="save-error"><p>Błąd przy zapisie.</p> <p class="data" /></div>
+ <div class="msg-warning" id="not-implemented"><p>Tej funkcji jeszcze nie ma :(</p><p class="data" /></div>
{% endblock %}
{% block maincontent %}