Przeniesienie nazwy utworu na pierwszy tab.
authorzuber <marek@stepniowski.com>
Mon, 21 Dec 2009 09:56:59 +0000 (10:56 +0100)
committerzuber <marek@stepniowski.com>
Mon, 21 Dec 2009 09:56:59 +0000 (10:56 +0100)
platforma/static/css/master.css
platforma/static/js/jquery.blockui.js [new file with mode: 0644]
platforma/static/js/main.js
platforma/templates/wiki/document_details.html

index 286e5c4..26a85cf 100755 (executable)
@@ -14,7 +14,11 @@ body {
     background: #C1C1C1 url(/static/img/gallery.png) no-repeat scroll center center;
     border-left: 1px solid #999;
     border-right: 1px solid #999;
-    cursor: col-resize;
+    cursor: w-resize;
+}
+
+.vsplitbar.active {
+    cursor: e-resize;
 }
 
 #source-editor, #simple-editor {
diff --git a/platforma/static/js/jquery.blockui.js b/platforma/static/js/jquery.blockui.js
new file mode 100644 (file)
index 0000000..d023054
--- /dev/null
@@ -0,0 +1,463 @@
+/*!\r
+ * jQuery blockUI plugin\r
+ * Version 2.28 (02-DEC-2009)\r
+ * @requires jQuery v1.2.3 or later\r
+ *\r
+ * Examples at: http://malsup.com/jquery/block/\r
+ * Copyright (c) 2007-2008 M. Alsup\r
+ * Dual licensed under the MIT and GPL licenses:\r
+ * http://www.opensource.org/licenses/mit-license.php\r
+ * http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!\r
+ */\r
+\r
+;(function($) {\r
+\r
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {\r
+       alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);\r
+       return;\r
+}\r
+\r
+$.fn._fadeIn = $.fn.fadeIn;\r
+\r
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle\r
+// retarded userAgent strings on Vista)\r
+var mode = document.documentMode || 0;\r
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);\r
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;\r
+\r
+// global $ methods for blocking/unblocking the entire page\r
+$.blockUI   = function(opts) { install(window, opts); };\r
+$.unblockUI = function(opts) { remove(window, opts); };\r
+\r
+// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)\r
+$.growlUI = function(title, message, timeout, onClose) {\r
+       var $m = $('<div class="growlUI"></div>');\r
+       if (title) $m.append('<h1>'+title+'</h1>');\r
+       if (message) $m.append('<h2>'+message+'</h2>');\r
+       if (timeout == undefined) timeout = 3000;\r
+       $.blockUI({\r
+               message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,\r
+               timeout: timeout, showOverlay: false,\r
+               onUnblock: onClose, \r
+               css: $.blockUI.defaults.growlCSS\r
+       });\r
+};\r
+\r
+// plugin method for blocking element content\r
+$.fn.block = function(opts) {\r
+       return this.unblock({ fadeOut: 0 }).each(function() {\r
+               if ($.css(this,'position') == 'static')\r
+                       this.style.position = 'relative';\r
+               if ($.browser.msie)\r
+                       this.style.zoom = 1; // force 'hasLayout'\r
+               install(this, opts);\r
+       });\r
+};\r
+\r
+// plugin method for unblocking element content\r
+$.fn.unblock = function(opts) {\r
+       return this.each(function() {\r
+               remove(this, opts);\r
+       });\r
+};\r
+\r
+$.blockUI.version = 2.28; // 2nd generation blocking at no extra cost!\r
+\r
+// override these in your code to change the default behavior and style\r
+$.blockUI.defaults = {\r
+       // message displayed when blocking (use null for no message)\r
+       message:  '<h1>Please wait...</h1>',\r
+\r
+       title: null,      // title string; only used when theme == true\r
+       draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)\r
+       \r
+       theme: false, // set to true to use with jQuery UI themes\r
+       \r
+       // styles for the message when blocking; if you wish to disable\r
+       // these and use an external stylesheet then do this in your code:\r
+       // $.blockUI.defaults.css = {};\r
+       css: {\r
+               padding:        0,\r
+               margin:         0,\r
+               width:          '30%',\r
+               top:            '40%',\r
+               left:           '35%',\r
+               textAlign:      'center',\r
+               color:          '#000',\r
+               border:         '3px solid #aaa',\r
+               backgroundColor:'#fff',\r
+               cursor:         'wait'\r
+       },\r
+       \r
+       // minimal style set used when themes are used\r
+       themedCSS: {\r
+               width:  '30%',\r
+               top:    '40%',\r
+               left:   '35%'\r
+       },\r
+\r
+       // styles for the overlay\r
+       overlayCSS:  {\r
+               backgroundColor: '#000',\r
+               opacity:                 0.6,\r
+               cursor:                  'wait'\r
+       },\r
+\r
+       // styles applied when using $.growlUI\r
+       growlCSS: {\r
+               width:          '350px',\r
+               top:            '10px',\r
+               left:           '',\r
+               right:          '10px',\r
+               border:         'none',\r
+               padding:        '5px',\r
+               opacity:        0.6,\r
+               cursor:         'default',\r
+               color:          '#fff',\r
+               backgroundColor: '#000',\r
+               '-webkit-border-radius': '10px',\r
+               '-moz-border-radius':    '10px'\r
+       },\r
+       \r
+       // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w\r
+       // (hat tip to Jorge H. N. de Vasconcelos)\r
+       iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',\r
+\r
+       // force usage of iframe in non-IE browsers (handy for blocking applets)\r
+       forceIframe: false,\r
+\r
+       // z-index for the blocking overlay\r
+       baseZ: 1000,\r
+\r
+       // set these to true to have the message automatically centered\r
+       centerX: true, // <-- only effects element blocking (page block controlled via css above)\r
+       centerY: true,\r
+\r
+       // allow body element to be stetched in ie6; this makes blocking look better\r
+       // on "short" pages.  disable if you wish to prevent changes to the body height\r
+       allowBodyStretch: true,\r
+\r
+       // enable if you want key and mouse events to be disabled for content that is blocked\r
+       bindEvents: true,\r
+\r
+       // be default blockUI will supress tab navigation from leaving blocking content\r
+       // (if bindEvents is true)\r
+       constrainTabKey: true,\r
+\r
+       // fadeIn time in millis; set to 0 to disable fadeIn on block\r
+       fadeIn:  200,\r
+\r
+       // fadeOut time in millis; set to 0 to disable fadeOut on unblock\r
+       fadeOut:  400,\r
+\r
+       // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock\r
+       timeout: 0,\r
+\r
+       // disable if you don't want to show the overlay\r
+       showOverlay: true,\r
+\r
+       // if true, focus will be placed in the first available input field when\r
+       // page blocking\r
+       focusInput: true,\r
+\r
+       // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)\r
+       applyPlatformOpacityRules: true,\r
+\r
+       // callback method invoked when unblocking has completed; the callback is\r
+       // passed the element that has been unblocked (which is the window object for page\r
+       // blocks) and the options that were passed to the unblock call:\r
+       //       onUnblock(element, options)\r
+       onUnblock: null,\r
+\r
+       // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493\r
+       quirksmodeOffsetHack: 4\r
+};\r
+\r
+// private data and functions follow...\r
+\r
+var pageBlock = null;\r
+var pageBlockEls = [];\r
+\r
+function install(el, opts) {\r
+       var full = (el == window);\r
+       var msg = opts && opts.message !== undefined ? opts.message : undefined;\r
+       opts = $.extend({}, $.blockUI.defaults, opts || {});\r
+       opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});\r
+       var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});\r
+       var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});\r
+       msg = msg === undefined ? opts.message : msg;\r
+\r
+       // remove the current block (if there is one)\r
+       if (full && pageBlock)\r
+               remove(window, {fadeOut:0});\r
+\r
+       // if an existing element is being used as the blocking content then we capture\r
+       // its current place in the DOM (and current display style) so we can restore\r
+       // it when we unblock\r
+       if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {\r
+               var node = msg.jquery ? msg[0] : msg;\r
+               var data = {};\r
+               $(el).data('blockUI.history', data);\r
+               data.el = node;\r
+               data.parent = node.parentNode;\r
+               data.display = node.style.display;\r
+               data.position = node.style.position;\r
+               if (data.parent)\r
+                       data.parent.removeChild(node);\r
+       }\r
+\r
+       var z = opts.baseZ;\r
+\r
+       // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;\r
+       // layer1 is the iframe layer which is used to supress bleed through of underlying content\r
+       // layer2 is the overlay layer which has opacity and a wait cursor (by default)\r
+       // layer3 is the message content that is displayed while blocking\r
+\r
+       var lyr1 = ($.browser.msie || opts.forceIframe) \r
+               ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')\r
+               : $('<div class="blockUI" style="display:none"></div>');\r
+       var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');\r
+       \r
+       var lyr3;\r
+       if (opts.theme && full) {\r
+               var s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +\r
+                                       '<div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(opts.title || '&nbsp;')+'</div>' +\r
+                                       '<div class="ui-widget-content ui-dialog-content"></div>' +\r
+                               '</div>';\r
+               lyr3 = $(s);\r
+       }\r
+       else {\r
+               lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>')\r
+                                       : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');\r
+       }                                                  \r
+\r
+       // if we have a message, style it\r
+       if (msg) {\r
+               if (opts.theme) {\r
+                       lyr3.css(themedCSS);\r
+                       lyr3.addClass('ui-widget-content');\r
+               }\r
+               else \r
+                       lyr3.css(css);\r
+       }\r
+\r
+       // style the overlay\r
+       if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))\r
+               lyr2.css(opts.overlayCSS);\r
+       lyr2.css('position', full ? 'fixed' : 'absolute');\r
+\r
+       // make iframe layer transparent in IE\r
+       if ($.browser.msie || opts.forceIframe)\r
+               lyr1.css('opacity',0.0);\r
+\r
+       $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);\r
+       \r
+       if (opts.theme && opts.draggable && $.fn.draggable) {\r
+               lyr3.draggable({\r
+                       handle: '.ui-dialog-titlebar',\r
+                       cancel: 'li'\r
+               });\r
+       }\r
+\r
+       // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)\r
+       var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);\r
+       if (ie6 || expr) {\r
+               // give body 100% height\r
+               if (full && opts.allowBodyStretch && $.boxModel)\r
+                       $('html,body').css('height','100%');\r
+\r
+               // fix ie6 issue when blocked element has a border width\r
+               if ((ie6 || !$.boxModel) && !full) {\r
+                       var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');\r
+                       var fixT = t ? '(0 - '+t+')' : 0;\r
+                       var fixL = l ? '(0 - '+l+')' : 0;\r
+               }\r
+\r
+               // simulate fixed position\r
+               $.each([lyr1,lyr2,lyr3], function(i,o) {\r
+                       var s = o[0].style;\r
+                       s.position = 'absolute';\r
+                       if (i < 2) {\r
+                               full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')\r
+                                        : s.setExpression('height','this.parentNode.offsetHeight + "px"');\r
+                               full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')\r
+                                        : s.setExpression('width','this.parentNode.offsetWidth + "px"');\r
+                               if (fixL) s.setExpression('left', fixL);\r
+                               if (fixT) s.setExpression('top', fixT);\r
+                       }\r
+                       else if (opts.centerY) {\r
+                               if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');\r
+                               s.marginTop = 0;\r
+                       }\r
+                       else if (!opts.centerY && full) {\r
+                               var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;\r
+                               var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';\r
+                               s.setExpression('top',expression);\r
+                       }\r
+               });\r
+       }\r
+\r
+       // show the message\r
+       if (msg) {\r
+               if (opts.theme)\r
+                       lyr3.find('.ui-widget-content').append(msg);\r
+               else\r
+                       lyr3.append(msg);\r
+               if (msg.jquery || msg.nodeType)\r
+                       $(msg).show();\r
+       }\r
+\r
+       if (($.browser.msie || opts.forceIframe) && opts.showOverlay)\r
+               lyr1.show(); // opacity is zero\r
+       if (opts.fadeIn) {\r
+               if (opts.showOverlay)\r
+                       lyr2._fadeIn(opts.fadeIn);\r
+               if (msg)\r
+                       lyr3.fadeIn(opts.fadeIn);\r
+       }\r
+       else {\r
+               if (opts.showOverlay)\r
+                       lyr2.show();\r
+               if (msg)\r
+                       lyr3.show();\r
+       }\r
+\r
+       // bind key and mouse events\r
+       bind(1, el, opts);\r
+\r
+       if (full) {\r
+               pageBlock = lyr3[0];\r
+               pageBlockEls = $(':input:enabled:visible',pageBlock);\r
+               if (opts.focusInput)\r
+                       setTimeout(focus, 20);\r
+       }\r
+       else\r
+               center(lyr3[0], opts.centerX, opts.centerY);\r
+\r
+       if (opts.timeout) {\r
+               // auto-unblock\r
+               var to = setTimeout(function() {\r
+                       full ? $.unblockUI(opts) : $(el).unblock(opts);\r
+               }, opts.timeout);\r
+               $(el).data('blockUI.timeout', to);\r
+       }\r
+};\r
+\r
+// remove the block\r
+function remove(el, opts) {\r
+       var full = (el == window);\r
+       var $el = $(el);\r
+       var data = $el.data('blockUI.history');\r
+       var to = $el.data('blockUI.timeout');\r
+       if (to) {\r
+               clearTimeout(to);\r
+               $el.removeData('blockUI.timeout');\r
+       }\r
+       opts = $.extend({}, $.blockUI.defaults, opts || {});\r
+       bind(0, el, opts); // unbind events\r
+       \r
+       var els;\r
+       if (full) // crazy selector to handle odd field errors in ie6/7\r
+               els = $('body').children().filter('.blockUI').add('body > .blockUI');\r
+       else\r
+               els = $('.blockUI', el);\r
+\r
+       if (full)\r
+               pageBlock = pageBlockEls = null;\r
+\r
+       if (opts.fadeOut) {\r
+               els.fadeOut(opts.fadeOut);\r
+               setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);\r
+       }\r
+       else\r
+               reset(els, data, opts, el);\r
+};\r
+\r
+// move blocking element back into the DOM where it started\r
+function reset(els,data,opts,el) {\r
+       els.each(function(i,o) {\r
+               // remove via DOM calls so we don't lose event handlers\r
+               if (this.parentNode)\r
+                       this.parentNode.removeChild(this);\r
+       });\r
+\r
+       if (data && data.el) {\r
+               data.el.style.display = data.display;\r
+               data.el.style.position = data.position;\r
+               if (data.parent)\r
+                       data.parent.appendChild(data.el);\r
+               $(el).removeData('blockUI.history');\r
+       }\r
+\r
+       if (typeof opts.onUnblock == 'function')\r
+               opts.onUnblock(el,opts);\r
+};\r
+\r
+// bind/unbind the handler\r
+function bind(b, el, opts) {\r
+       var full = el == window, $el = $(el);\r
+\r
+       // don't bother unbinding if there is nothing to unbind\r
+       if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))\r
+               return;\r
+       if (!full)\r
+               $el.data('blockUI.isBlocked', b);\r
+\r
+       // don't bind events when overlay is not in use or if bindEvents is false\r
+       if (!opts.bindEvents || (b && !opts.showOverlay)) \r
+               return;\r
+\r
+       // bind anchors and inputs for mouse and key events\r
+       var events = 'mousedown mouseup keydown keypress';\r
+       b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);\r
+\r
+// former impl...\r
+//        var $e = $('a,:input');\r
+//        b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);\r
+};\r
+\r
+// event handler to suppress keyboard/mouse events when blocking\r
+function handler(e) {\r
+       // allow tab navigation (conditionally)\r
+       if (e.keyCode && e.keyCode == 9) {\r
+               if (pageBlock && e.data.constrainTabKey) {\r
+                       var els = pageBlockEls;\r
+                       var fwd = !e.shiftKey && e.target == els[els.length-1];\r
+                       var back = e.shiftKey && e.target == els[0];\r
+                       if (fwd || back) {\r
+                               setTimeout(function(){focus(back)},10);\r
+                               return false;\r
+                       }\r
+               }\r
+       }\r
+       // allow events within the message content\r
+       if ($(e.target).parents('div.blockMsg').length > 0)\r
+               return true;\r
+\r
+       // allow events for content that is not being blocked\r
+       return $(e.target).parents().children().filter('div.blockUI').length == 0;\r
+};\r
+\r
+function focus(back) {\r
+       if (!pageBlockEls)\r
+               return;\r
+       var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];\r
+       if (e)\r
+               e.focus();\r
+};\r
+\r
+function center(el, x, y) {\r
+       var p = el.parentNode, s = el.style;\r
+       var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');\r
+       var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');\r
+       if (x) s.left = l > 0 ? (l+'px') : '0';\r
+       if (y) s.top  = t > 0 ? (t+'px') : '0';\r
+};\r
+\r
+function sz(el, p) {\r
+       return parseInt($.css(el,p))||0;\r
+};\r
+\r
+})(jQuery);\r
index 7efcf32..cec5e22 100644 (file)
@@ -48,8 +48,10 @@ function serialize(element) {
         result.push('>');
     }
     
-    if (element.tagName == 'akap' || element.tagName == 'akap_dialog' || element.tagName == 'akap_cd') {
+    if (element.tagName == 'akap' || element.tagName == 'akap_dialog' || element.tagName == 'akap_cd' || element.tagName == 'strofa') {
         result.push('\n\n\n');
+    } else if (element.tagName == 'naglowek_rozdzial') {
+        result.push('\n\n');
     } else if (element.tagName == 'rdf:RDF') {
         result.push('\n\n\n\n\n');
     } else if (element.tagName.indexOf('dc:') != -1) {
@@ -322,57 +324,94 @@ $(function() {
             }
 
             function transform() {
-                $.ajax({
-                    url: '/static/xsl/wl2html_client.xsl',
-                    dataType: 'xml',
-                    success: function(data) {
-                        var doc = null;
-                        var parser = new DOMParser();
-                        var serializer = new XMLSerializer();
-                        var htmlXSL = createXSLT(data);
+                $('#simple-editor').block({message: 'Ładowanie...'});
+                setTimeout(function() {
+                    $.ajax({
+                        url: '/static/xsl/wl2html_client.xsl',
+                        dataType: 'xml',
+                        success: function(data) {
+                            var doc = null;
+                            var parser = new DOMParser();
+                            var serializer = new XMLSerializer();
+                            var htmlXSL = createXSLT(data);
 
-                        doc = editor.getCode().replace(/\/\s+/g, '<br />');
-                        doc = parser.parseFromString(doc, 'text/xml');
-                        console.log('xml', doc);
-                        doc = htmlXSL.transformToFragment(doc, document);
-                        console.log('after transform', doc);
-                        $('#html-view').html(doc.firstChild);
-                    },
-                    error: function() {alert('Error loading XSL!')}
-                });        
+                            doc = editor.getCode().replace(/\/\s+/g, '<br />');
+                            doc = parser.parseFromString(doc, 'text/xml');
+                            console.log('xml', doc);
+                            doc = htmlXSL.transformToFragment(doc, document);
+                            console.log('after transform', doc);
+                            $('#html-view').html(doc.firstChild);
+                            $('#simple-editor').unblock();
+                        },
+                        error: function() {alert('Error loading XSL!')}
+                    });
+                }, 200);
             };
 
             function reverseTransform () {
-                $.ajax({
-                    url: '/static/xsl/html2wl_client.xsl',
-                    dataType: 'xml',
-                    success: function(data) {
-                        var doc = null;
-                        var parser = new DOMParser();
-                        var serializer = new XMLSerializer();
-                        var xsl = createXSLT(data);
+                $('#source-editor').block({message: 'Ładowanie...'});
+                setTimeout(function() {
+                    $.ajax({
+                        url: '/static/xsl/html2wl_client.xsl',
+                        dataType: 'xml',
+                        success: function(data) {
+                            var doc = null;
+                            var parser = new DOMParser();
+                            var serializer = new XMLSerializer();
+                            var xsl = createXSLT(data);
 
-                        doc = serializer.serializeToString($('#html-view div').get(0))
-                        doc = parser.parseFromString(doc, 'text/xml');
-                        console.log('xml',doc, doc.documentElement);
-                        // TODO: Sprawdzenie błędów
-                        doc = xsl.transformToDocument(doc);
-                        console.log('after transform', doc, doc.documentElement);
-                        doc = serialize(doc.documentElement).join('');
-                        // doc = serializer.serializeToString(doc.documentElement)
-                        editor.setCode(doc);
-                    },
-                    error: function() {alert('Error loading XSL!')}
-                });
+                            doc = serializer.serializeToString($('#html-view div').get(0))
+                            doc = parser.parseFromString(doc, 'text/xml');
+                            console.log('xml',doc, doc.documentElement);
+                            // TODO: Sprawdzenie błędów
+                            doc = xsl.transformToDocument(doc);
+                            console.log('after transform', doc, doc.documentElement);
+                            doc = serialize(doc.documentElement).join('');
+                            // doc = serializer.serializeToString(doc.documentElement)
+                            editor.setCode(doc);
+                            $('#source-editor').unblock();
+                        },
+                        error: function() {alert('Error loading XSL!')}
+                    });                    
+                }, 200);
             };
 
             $('#save-button').click(function(event) {
                 event.preventDefault();
-                console.log(editor.getCode(), $('form input[name=text]').get(0));
-                $('form textarea[name=text]').val(editor.getCode());
-                $('form').ajaxSubmit(function() {
-                    alert('Udało się!');
-                });
+                $.blockUI({message: $('#save-dialog')});
+                
+                // console.log(editor.getCode(), $('form input[name=text]').get(0));
+                //                 $('form textarea[name=text]').val(editor.getCode());
+                //                 $('form').ajaxSubmit(function() {
+                //                     alert('Udało się!');
+                //                 });
+            });
+            
+            $('#save-ok').click(function() {
+                $.blockUI({message: 'Zapisywanie...'});
+                
+                var data = {
+                    name: $('#document-name').html(),
+                    text: editor.getCode(),
+                    revision: $('#document-revision').html(),
+                    author: 'annonymous',
+                    comment: $('#komentarz').val()
+                };
+                
+                console.log(data);
+                
+                $.ajax({
+                    url: document.location.href,
+                    type: "POST",
+                    dataType: "html",
+                    data: data,                
+                    success: function() {
+                        $.unblockUI();
+                    },
+                    error: function(xhr, textStatus, errorThrown) {
+                        alert('error: ' + textStatus + ' ' + errorThrown);
+                    },
+                })
             });
 
             $('#simple-view-tab').click(function() {
@@ -427,12 +466,12 @@ $(function() {
         if ($('#sidebar').width() == 0) {
             $('#sidebar').width(480).css({right: 0}).show();
             $('#source-editor, #simple-editor').css({right: 495});
-            $('.vsplitbar').css({right: 480})
+            $('.vsplitbar').css({right: 480}).addClass('active');
             // $('#splitter').trigger('resize', [$(window).width() - 480]);
         } else {
             $('#sidebar').width(0).hide();
             $('#source-editor, #simple-editor').css({right: 15});
-            $('.vsplitbar').css({right: 0});
+            $('.vsplitbar').css({right: 0}).removeClass('active');
             // $('#splitter').trigger('resize', [$(window).width()]);
         }
         $(window).resize();
index b9a48eb..2c8030e 100644 (file)
@@ -5,19 +5,18 @@
     <link rel="stylesheet" href="{{STATIC_URL}}css/master.css" type="text/css" media="screen" charset="utf-8" />
     <link rel="stylesheet" href="{{STATIC_URL}}css/html.css" type="text/css" media="screen" charset="utf-8" />
     <script src="{{STATIC_URL}}js/lib/codemirror/codemirror.js" type="text/javascript" charset="utf-8"></script>
-    <script src="{{STATIC_URL}}js/lib/jquery.form.js" type="text/javascript" charset="utf-8"></script>
+    <script src="{{STATIC_URL}}js/jquery.blockui.js" type="text/javascript" charset="utf-8"></script>
     <script src="{{STATIC_URL}}js/button_scripts.js" type="text/javascript" charset="utf-8"></script>
     <script src="{{STATIC_URL}}js/main.js" type="text/javascript" charset="utf-8"></script>
 {% endblock %}
 
 {% block maincontent %}
-    {# <form action="{% url wiki.views.document_detail document.name|urlencode %}" method="post" accept-charset="utf-8"> #}
         <div id="header">
-            <div id="tools" style="float: right;">Wersja: {{ document.revision }}<button style="margin-left: 6px" id="save-button">Zapisz</button></div>
-            <h1>{{ document.name }}</h1>
+            <div id="tools" style="float: right;">Wersja: <span id="document-revision">{{ document.revision }}</span> <button style="margin-left: 6px" id="save-button">Zapisz</button></div>
+            <h1>Platforma</h1>
             <ol id="tabs">
-                <li id="simple-view-tab">Widok prosty</li>
-                <li id="source-view-tab" class="active">Widok zaawansowany</li>
+                <li id="simple-view-tab"><span id="document-name">{{ document.name }}</span></li>
+                <li id="source-view-tab" class="active">Kod źródłowy</li>
             </ol>
             <div style="clear: both"></div>
         </div>
@@ -55,5 +54,9 @@
                 </div>
             </div>
         </div>
-    {# </form> #}
+        <div id="save-dialog" style="display: none">
+            <p>Zapisywanie</p>
+            <label for="komentarz">Komentarz</label><input type="text" name="komentarz" value="" id="komentarz" />
+            <button id="save-ok">Ok</button>
+        </div>
 {% endblock %}
\ No newline at end of file