Przeksztalcenie odwrotne.
authorLukasz Rekucki <lrekucki@gmail.com>
Tue, 3 Nov 2009 18:46:11 +0000 (19:46 +0100)
committerLukasz Rekucki <lrekucki@gmail.com>
Tue, 3 Nov 2009 18:46:11 +0000 (19:46 +0100)
platforma/static/css/html.css
platforma/static/js/models.js
platforma/static/js/views/gallery.js [changed mode: 0644->0755]
platforma/static/js/views/html.js
platforma/static/js/views/panel_container.js [changed mode: 0644->0755]
platforma/static/js/views/xml.js [changed mode: 0644->0755]
platforma/static/xsl/html2wl_client.xsl [new file with mode: 0755]
platforma/static/xsl/wl2html_client.xsl
platforma/templates/explorer/editor.html

index 8856068..5d4e08c 100755 (executable)
     visibility: hidden;
 }
 
-.htmlview *[x-editable] > .context-menu {
+.context-menu {
     position: absolute;
     top: 0px;
     left: -50px;
     z-index: 3000;
 }
 
-.htmlview *[x-editable] > .context-menu * {
+.context-menu * {
     margin: 0px;
     display: block;
 
     border-bottom: 1px solid black;
 }
 
-.htmlview *[x-editable] > .context-menu *:last-child {
+.context-menu *:last-child {
     cursor: pointer;
     border-bottom: none;
 }
 
-.htmlview *[x-editable] > .context-menu *:hover {
+.context-menu *:hover {
     background-color: orange;
 }
 
 /*
  * VISIBILITY RULES
  */
-.htmlview *[x-editable] > .default-menu {
+.default-menu {
     visibility: inherit;
-    opacity: 0.4;
+    opacity: 0.2;
 }
 
-.htmlview *[x-editable] > .default-menu:hover {
+.default-menu:hover {
     opacity: 1;
 }
 
-.htmlview *[x-annotation-box][x-editable] > .default-menu {
+.htmlview *[x-annotation-box] > .default-menu {
     opacity: 1;
 }
 
 .htmlview *[x-editable][x-open] > .default-menu {
     visibility: hidden;
 }
+.htmlview *[x-editable][x-open] *[x-annotation-box] > .default-menu {
+    visibility: hidden;
+}
 
 .htmlview *[x-editable] > .edit-menu {
     visibility: hidden;
 }
+.htmlview *[x-editable] *[x-annotation-box] > .edit-menu {
+    visibility: hidden;
+}
 
 .htmlview *[x-editable][x-open] > .edit-menu {
     visibility: visible;
 }
+.htmlview *[x-editable][x-open] *[x-annotation-box] > .edit-menu {
+    visibility: visible;
+}
 
 .html-editarea {
-    border: 2px solid black;
+    border: 0px;
     background-color: gray;
     padding: 1px;
 
 
 .html-editarea textarea
 {
-    border: 0px;
+    border: 2px solid black;
+    
     margin: 0px;
     padding: 0px;
 
     z-index: 0;
     font-size: 10pt;
     background-color: ivory;
-}
-
-.html-editarea p.html-editarea-toolbar {
-    position: absolute;
-    background: gray;
-
-    bottom: -26px;
-    height: 24px;
-
-    left: 0px;
-    right: 0px;
-
-    border: 2px solid black;
-
-    margin: 0px;
-    padding: 0px;
-
-    z-index: 100;
-}
-
-
+}
\ No newline at end of file
index 4052594..d2869ed 100755 (executable)
@@ -36,76 +36,174 @@ Editor.ToolbarButtonsModel = Editor.Model.extend({
 });
 
 
-// Stany modelu:
 //
-//                  -> error -> loading
-//                 /
-// empty -> loading -> synced -> unsynced -> loading
-//                           \
-//                            -> dirty -> updating -> updated -> synced
+// HTML Document Model
 //
-Editor.XMLModel = Editor.Model.extend({
-    _className: 'Editor.XMLModel',
-    serverURL: null,
-    data: '',
+Editor.HTMLModel = Editor.Model.extend({
+    _className: 'Editor.HTMLModel',
+    textURL: null,    
     state: 'empty',
-  
-    init: function(document, serverURL) {
+
+    init: function(document, textURL) {
         this._super();
         this.set('state', 'empty');
         this.set('revision', document.get('revision'));
         this.document = document;
-        this.serverURL = serverURL;
-        this.toolbarButtonsModel = new Editor.ToolbarButtonsModel();
+
+        this.textURL = textURL;        
+
+        this.htmlXSL = null;
+        this.wlmlXSL = null;
+        this.rawText = null;
+
+        // create a parser and a serializer
+        this.parser = new DOMParser();
+        this.serializer = new XMLSerializer();
+
         this.addObserver(this, 'data', this.dataChanged.bind(this));
     },
-  
+
     load: function(force) {
         if (force || this.get('state') == 'empty') {
             this.set('state', 'loading');
-            messageCenter.addMessage('info', 'xmlload', 'Wczytuję XML...');
+            messageCenter.addMessage('info', 'xmlload', 'Wczytuję HTML...');
+
+            // request all stylesheets
             $.ajax({
-                url: this.serverURL,
+                url: documentInfo.staticURL + 'xsl/wl2html_client.xsl',
+                dataType: 'xml',                
+                success: this.htmlXSLLoadSuccess.bind(this),
+                error: this.loadingFailed.bind(this)
+            });
+
+            $.ajax({
+                url: documentInfo.staticURL + 'xsl/html2wl_client.xsl',
+                dataType: 'xml',
+                success: this.wlmlXSLLoadSuccess.bind(this),
+                error: this.loadingFailed.bind(this)
+            });
+
+            $.ajax({
+                url: this.textURL,
                 dataType: 'text',
                 data: {
                     revision: this.get('revision'),
                     user: this.document.get('user')
                     },
-                success: this.loadingSucceeded.bind(this),
+                success: this.textLoadSuccess.bind(this),
                 error: this.loadingFailed.bind(this)
             });
             return true;
         }
         return false;
     },
-  
-    loadingSucceeded: function(data) {
+
+    asWLML: function(element) 
+    {        
+        var result = this.wlmlXSL.transformToFragment(element, document);
+
+        if(!result) {
+            console.log(this.wlmlXSL.transformToDocument(element));
+            throw "Failed to transform fragment";
+        }
+        
+        console.log("Transform result:", result);
+        return this.serializer.serializeToString(result);
+    },
+
+    updateWithWLML: function($element, text)
+    {
+        // filter the string
+        text = text.replace(/\/\s+/g, '<br />');
+        var chunk = this.parser.parseFromString("<chunk>"+text+"</chunk>", "text/xml");
+
+        var errors = $('parsererror', chunk);
+
+        // check if chunk is parsable
+        if(errors.length > 0)
+            throw {text: errors.text(), html: errors.html()};
+        
+        var result = this.htmlXSL.transformToFragment(chunk, document);
+
+        console.log("RESULT", this.serializer.serializeToString(result));
+
+        if(!result)
+            throw "WLML->HTML transformation failed.";
+        
+        $element.replaceWith(result);
+    },
+
+    createXSLT: function(xslt_doc) {
+        var p = new XSLTProcessor();
+        p.importStylesheet(xslt_doc);
+        return p;
+    },
+
+    htmlXSLLoadSuccess: function(data) 
+    {
+        try {
+            this.htmlXSL = this.createXSLT(data);
+
+            if(this.wlmlXSL && this.htmlXSL && this.rawText)
+                this.loadSuccess();
+        } catch(e) {
+            this.loadingFailed();
+        }
+    },
+
+    wlmlXSLLoadSuccess: function(data)
+    {
+        try {
+            this.wlmlXSL = this.createXSLT(data);
+
+            if(this.wlmlXSL && this.htmlXSL && this.rawText)
+                this.loadSuccess();
+        } catch(e) {
+            this.loadingFailed();
+        }
+    },
+
+    textLoadSuccess: function(data) {
+        this.rawText = data;
+
+        if(this.wlmlXSL && this.htmlXSL && this.rawText)
+                this.loadSuccess();
+    },
+
+    loadSuccess: function() {
         if (this.get('state') != 'loading') {
             alert('erroneous state:', this.get('state'));
         }
-        this.set('data', data);
+
+        // prepare text
+        var doc = null;
+        doc = this.rawText.replace(/\/\s+/g, '<br />');
+        doc = this.parser.parseFromString(doc, 'text/xml');
+        doc = this.htmlXSL.transformToFragment(doc, document).firstChild;
+
+        this.set('data', doc);
         this.set('state', 'synced');
-        messageCenter.addMessage('success', 'xmlload', 'Wczytałem XML :-)');
+        messageCenter.addMessage('success', 'xmlload', 'Wczytałem HTML :-)');
     },
-  
+
     loadingFailed: function(response)
     {
         if (this.get('state') != 'loading') {
             alert('erroneous state:', this.get('state'));
         }
-        
+
         var message = parseXHRError(response);
-        
+
         this.set('error', '<h2>Błąd przy ładowaniu XML</h2><p>'+message+'</p>');
         this.set('state', 'error');
-        messageCenter.addMessage('error', 'xmlload', 'Nie udało mi się wczytać XML. Spróbuj ponownie :-(');
+        messageCenter.addMessage('error', 'xmlload', 'Nie udało mi się wczytać HTML. Spróbuj ponownie :-(');
     },
-  
+
     save: function(message) {
         if (this.get('state') == 'dirty') {
             this.set('state', 'updating');
             messageCenter.addMessage('info', 'xmlsave', 'Zapisuję XML...');
-      
+
             var payload = {
                 contents: this.get('data'),
                 revision: this.get('revision'),
@@ -114,7 +212,7 @@ Editor.XMLModel = Editor.Model.extend({
             if (message) {
                 payload.message = message;
             }
-      
+
             $.ajax({
                 url: this.serverURL,
                 type: 'post',
@@ -127,7 +225,7 @@ Editor.XMLModel = Editor.Model.extend({
         }
         return false;
     },
-  
+
     saveSucceeded: function(data) {
         if (this.get('state') != 'updating') {
             alert('erroneous state:', this.get('state'));
@@ -136,7 +234,7 @@ Editor.XMLModel = Editor.Model.extend({
         this.set('state', 'updated');
         messageCenter.addMessage('success', 'xmlsave', 'Zapisałem XML :-)');
     },
-  
+
     saveFailed: function() {
         if (this.get('state') != 'updating') {
             alert('erroneous state:', this.get('state'));
@@ -144,7 +242,7 @@ Editor.XMLModel = Editor.Model.extend({
         messageCenter.addMessage('error', 'xmlsave', 'Nie udało mi się zapisać XML. Spróbuj ponownie :-(');
         this.set('state', 'dirty');
     },
-  
+
     // For debbuging
     set: function(property, value) {
         if (property == 'state') {
@@ -152,13 +250,13 @@ Editor.XMLModel = Editor.Model.extend({
         }
         return this._super(property, value);
     },
-  
+
     dataChanged: function(property, value) {
         if (this.get('state') == 'synced') {
             this.set('state', 'dirty');
         }
     },
-  
+
     dispose: function() {
         this.removeObserver(this);
         this._super();
@@ -166,36 +264,36 @@ Editor.XMLModel = Editor.Model.extend({
 });
 
 
-Editor.HTMLModel = Editor.Model.extend({
-    _className: 'Editor.HTMLModel',
-    dataURL: null,
-    htmlURL: null,
-    renderURL: null,
-    displaData: '',
-    xmlParts: {},
+// Stany modelu:
+//
+//                  -> error -> loading
+//                 /
+// empty -> loading -> synced -> unsynced -> loading
+//                           \
+//                            -> dirty -> updating -> updated -> synced
+//
+Editor.XMLModel = Editor.Model.extend({
+    _className: 'Editor.XMLModel',
+    serverURL: null,
+    data: '',
     state: 'empty',
   
-    init: function(document, dataURL, htmlURL) {
+    init: function(document, serverURL) {
         this._super();
         this.set('state', 'empty');
-        this.set('revision', document.get('revision'));        
-        
+        this.set('revision', document.get('revision'));
         this.document = document;
-        this.htmlURL = htmlURL;
-        this.dataURL = dataURL;
-        this.renderURL = documentInfo.renderURL;
-        this.xmlParts = {};
+        this.serverURL = serverURL;
+        this.toolbarButtonsModel = new Editor.ToolbarButtonsModel();
+        this.addObserver(this, 'data', this.dataChanged.bind(this));
     },
   
     load: function(force) {
         if (force || this.get('state') == 'empty') {
             this.set('state', 'loading');
-
-            // load the transformed data
-            // messageCenter.addMessage('info', 'Wczytuję HTML...');
-
+            messageCenter.addMessage('info', 'xmlload', 'Wczytuję XML...');
             $.ajax({
-                url: this.htmlURL,
+                url: this.serverURL,
                 dataType: 'text',
                 data: {
                     revision: this.get('revision'),
@@ -204,8 +302,10 @@ Editor.HTMLModel = Editor.Model.extend({
                 success: this.loadingSucceeded.bind(this),
                 error: this.loadingFailed.bind(this)
             });
+            return true;
         }
-    },    
+        return false;
+    },
   
     loadingSucceeded: function(data) {
         if (this.get('state') != 'loading') {
@@ -213,98 +313,38 @@ Editor.HTMLModel = Editor.Model.extend({
         }
         this.set('data', data);
         this.set('state', 'synced');
+        messageCenter.addMessage('success', 'xmlload', 'Wczytałem XML :-)');
     },
   
-    loadingFailed: function(response) {
+    loadingFailed: function(response)
+    {
         if (this.get('state') != 'loading') {
             alert('erroneous state:', this.get('state'));
         }
         
-        var err = parseXHRError(response);
+        var message = parseXHRError(response);
         
-        this.set('error', '<p>Nie udało się wczytać widoku HTML: </p>' + err.error_message);
-        this.set('state', 'error');        
-    },
-
-    getXMLPart: function(elem, callback)
-    {
-        var path = elem.attr('x-pointer');
-        if(!this.xmlParts[path])
-            this.loadXMLPart(elem, callback);
-        else
-            callback(path, this.xmlParts[path]);
-    },
-
-    loadXMLPart: function(elem, callback)
-    {
-        var path = elem.attr('x-pointer');
-        var self = this;
-
-        $.ajax({
-            url: this.dataURL,
-            dataType: 'text',
-            data: {
-                revision: this.get('revision'),
-                user: this.document.get('user'),
-                chunk: path
-                // format: 'nl'
-            },
-            success: function(data) {
-                self.xmlParts[path] = data;
-                console.log(data);
-                callback(path, data);
-            },
-            // TODO: error handling
-            error: function(data) {
-                console.log('Failed to load fragment');
-                callback(undefined, undefined);
-            }
-        });
-    },
-
-    putXMLPart: function(elem, data, callback) {
-        var self = this;
-      
-        var path = elem.attr('x-pointer');
-        this.xmlParts[path] = data;
-
-        this.set('state', 'dirty');
-
-        /* re-render the changed fragment */
-        $.ajax({
-            url: this.renderURL,
-            type: "POST",
-            dataType: 'text; charset=utf-8',
-            data: {
-                fragment: data,
-                chunk: path
-                // format: 'nl'
-            },
-            success: function(htmldata) {
-                callback(elem, htmldata);
-                self.set('state', 'dirty');
-            }
-        });
+        this.set('error', '<h2>Błąd przy ładowaniu XML</h2><p>'+message+'</p>');
+        this.set('state', 'error');
+        messageCenter.addMessage('error', 'xmlload', 'Nie udało mi się wczytać XML. Spróbuj ponownie :-(');
     },
-
+  
     save: function(message) {
         if (this.get('state') == 'dirty') {
             this.set('state', 'updating');
-
+            messageCenter.addMessage('info', 'xmlsave', 'Zapisuję XML...');
+      
             var payload = {
-                chunks: $.toJSON(this.xmlParts),
+                contents: this.get('data'),
                 revision: this.get('revision'),
                 user: this.document.get('user')
             };
-
             if (message) {
                 payload.message = message;
             }
-
-            console.log(payload)
-
+      
             $.ajax({
-                url: this.dataURL,
+                url: this.serverURL,
                 type: 'post',
                 dataType: 'json',
                 data: payload,
@@ -314,38 +354,45 @@ Editor.HTMLModel = Editor.Model.extend({
             return true;
         }
         return false;
-      
     },
-
+  
     saveSucceeded: function(data) {
         if (this.get('state') != 'updating') {
             alert('erroneous state:', this.get('state'));
         }
-
-        // flush the cache
-        this.xmlParts = {};
-    
         this.set('revision', data.revision);
         this.set('state', 'updated');
+        messageCenter.addMessage('success', 'xmlsave', 'Zapisałem XML :-)');
     },
-
+  
     saveFailed: function() {
         if (this.get('state') != 'updating') {
             alert('erroneous state:', this.get('state'));
-        }        
+        }
+        messageCenter.addMessage('error', 'xmlsave', 'Nie udało mi się zapisać XML. Spróbuj ponownie :-(');
         this.set('state', 'dirty');
     },
-
+  
     // For debbuging
     set: function(property, value) {
         if (property == 'state') {
             console.log(this.description(), ':', property, '=', value);
         }
         return this._super(property, value);
+    },
+  
+    dataChanged: function(property, value) {
+        if (this.get('state') == 'synced') {
+            this.set('state', 'dirty');
+        }
+    },
+  
+    dispose: function() {
+        this.removeObserver(this);
+        this._super();
     }
 });
 
-
 Editor.ImageGalleryModel = Editor.Model.extend({
     _className: 'Editor.ImageGalleryModel',
     serverURL: null,
@@ -449,7 +496,7 @@ Editor.DocumentModel = Editor.Model.extend({
 
         this.contentModels = {
             'xml': new Editor.XMLModel(this, data.text_url),
-            'html': new Editor.HTMLModel(this, data.text_url, data.html_url),
+            'html': new Editor.HTMLModel(this, data.text_url),
             'gallery': new Editor.ImageGalleryModel(this, data.gallery_url)
         };        
 
old mode 100644 (file)
new mode 100755 (executable)
index 176b0ab..31b47ce
@@ -10,7 +10,8 @@ var ImageGalleryView = View.extend({
   init: function(element, model, parent, template) 
   {    
     console.log("init for gallery");
-    this._super(element, model, template);
+    var submodel = model.contentModels['gallery'];
+    this._super(element, submodel, template);
     this.parent = parent;
 
     console.log("gallery model", this.model);
index cefd0d2..8aff5f0 100755 (executable)
@@ -6,14 +6,14 @@ var HTMLView = View.extend({
     template: 'html-view-template',
   
     init: function(element, model, parent, template) {
-        this._super(element, model, template);
-        this.parent = parent;
+        var submodel = model.contentModels['html'];
+        this._super(element, submodel, template);
+        this.parent = parent;                
     
         this.model
-        .addObserver(this, 'data', this.modelDataChanged.bind(this))        
+        .addObserver(this, 'data', this.modelDataChanged.bind(this))
         .addObserver(this, 'state', this.modelStateChanged.bind(this));
-
-        this.$menuTemplate = $(render_template('html-view-frag-menu-template', this));
+        
         this.modelStateChanged('state', this.model.get('state'));
         this.modelDataChanged('data', this.model.get('data'));
                 
@@ -24,18 +24,19 @@ var HTMLView = View.extend({
         this.themeBoxes = [];
     },
 
-    modelDataChanged: function(property, value) {
-        $('.htmlview', this.element).html(value);
+    modelDataChanged: function(property, value)
+    {
+        if(!value) return;
+       
+        // the xml model changed
+        var container = $('.htmlview', this.element);
+        container.empty();
+        container.append(value);
+        
         this.updatePrintLink();
-        var self = this;
-
-        /* upgrade editable elements */
-        $("*[x-editable]", this.$docbase).each(function() {
-            $(this).append( self.$menuTemplate.clone() );
-        });
         
-        /* mark themes */
-        /* $(".theme-ref", this.$docbase).each(function() {
+    /* mark themes */
+    /* $(".theme-ref", this.$docbase).each(function() {
             var id = $(this).attr('x-theme-class');
 
             var end = $("span.theme-end[x-theme-class = " + id+"]");
@@ -69,20 +70,23 @@ var HTMLView = View.extend({
         } else if (value == 'error') {
             this.freeze(this.model.get('error'));
             $('.xml-editor-ref', this.overlay).click(
-            function(event) {
-                console.log("Sending scroll rq.", this);
-                try {
-                    var href = $(this).attr('href').split('-');
-                    var line = parseInt(href[1]);
-                    var column = parseInt(href[2]);
+                function(event) {
+                    console.log("Sending scroll rq.", this);
+                    try {
+                        var href = $(this).attr('href').split('-');
+                        var line = parseInt(href[1]);
+                        var column = parseInt(href[2]);
                     
-                    $(document).trigger('xml-scroll-request', {line:line, column:column});
-                } catch(e) {
-                    console.log(e);
-                }
+                        $(document).trigger('xml-scroll-request', {
+                            line:line,
+                            column:column
+                        });
+                    } catch(e) {
+                        console.log(e);
+                    }
                 
-                return false;
-            });
+                    return false;
+                });
         }
     },
 
@@ -119,7 +123,9 @@ var HTMLView = View.extend({
             if(this.currentFocused && $p[0] == this.currentFocused[0])
             {
                 this.currentFocused = $p;
-                $box.css({'display': 'block'});
+                $box.css({
+                    'display': 'block'
+                });
             }
 
             return;
@@ -176,17 +182,24 @@ var HTMLView = View.extend({
         {
             console.log($e);
             this.selectTheme($e.attr('x-theme-class'));
+            return false;
         }
 
         /* other buttons */
-        if($e.hasClass('edit-button'))
-            this.openForEdit( this.editableFor($e) );
+        try {
+            if($e.hasClass('edit-button'))
+                this.openForEdit( this.editableFor($e) );
 
-        if($e.hasClass('accept-button'))
-            this.closeWithSave( this.editableFor($e) );
+            if($e.hasClass('accept-button'))
+                this.closeWithSave( this.editableFor($e) );
 
-        if($e.hasClass('reject-button'))
-            this.closeWithoutSave( this.editableFor($e) );        
+            if($e.hasClass('reject-button'))
+                this.closeWithoutSave( this.editableFor($e) );
+        } catch(e) {
+            messageCenter.addMessage('error', "wlsave", 'Błąd:' + e.text);
+        }
+        
+        return false;
     },
 
     unfocusAnnotation: function()
@@ -198,15 +211,17 @@ var HTMLView = View.extend({
         }
 
         if(this.currentOpen 
-          && this.currentOpen.is("*[x-annotation-box]")
-          && this.currentOpen.parent()[0] == this.currentFocused[0])
-        {
+            && this.currentOpen.is("*[x-annotation-box]")
+            && this.currentOpen.parent()[0] == this.currentFocused[0])
+            {
             console.log("Can't unfocus open box");
             return false;
         }
 
         var $box = $("*[x-annotation-box]", this.currentFocused);
-        $box.css({'display': 'none'});
+        $box.css({
+            'display': 'none'
+        });
         // this.currentFocused.removeAttr('x-focused');
         // this.currentFocused.hide();
         this.currentFocused = null;
@@ -215,21 +230,20 @@ var HTMLView = View.extend({
     focusAnnotation: function($e) {
         this.currentFocused = $e;
         var $box = $("*[x-annotation-box]", $e);
-        $box.css({'display': 'block'});
+        $box.css({
+            'display': 'block'
+        });
         
-        // $e.attr('x-focused', 'focused');        
+    // $e.attr('x-focused', 'focused');
     },
 
     closeWithSave: function($e) {
         var $edit = $e.data('edit-overlay');
         var newText = $('textarea', $edit).val();
 
-        this.model.putXMLPart($e, newText, function($e, html) {
-            this.renderPart($e, html);
-            $edit.remove();
-            $e.removeAttr('x-open');            
-        }.bind(this) );
-        this.currentOpen = null;
+        this.model.updateWithWLML($e, newText);
+        $edit.remove();
+        this.currentOpen = null;        
     },
 
     closeWithoutSave: function($e) {
@@ -264,54 +278,74 @@ var HTMLView = View.extend({
             this.closeWithSave(this.currentOpen);    
         }
         
-        var x = $origin[0].offsetLeft;
-        var y = $origin[0].offsetTop;
-        var w = $origin.outerWidth();
-        var h = $origin.innerHeight();
+        var $box = null
+
+        // annotations overlay their sub box - not their own box //
+        if($origin.is(".annotation-inline-box"))
+            $box = $("*[x-annotation-box]", $origin);
+        else
+            $box = $origin;
+        
+        var x = $box[0].offsetLeft;
+        var y = $box[0].offsetTop;
+        var w = $box.outerWidth();
+        var h = $box.innerHeight();
 
-        console.log("Editable:", $origin, " offsetParent:", $origin[0].offsetParent);
+        console.log("Edit origin:", $origin, " box:", $box);
+        console.log("offsetParent:", $box[0].offsetParent);
         console.log("Dimensions: ", x, y, w , h);
 
         // start edition on this node
         var $overlay = $('<div class="html-editarea"><textarea></textarea></div>');
         
-        $overlay.css({position: 'absolute', height: h, left: x, top: y, width: '95%'});        
-        $($origin[0].offsetParent).append($overlay);
-        $origin.data('edit-overlay', $overlay);
-
-        this.model.getXMLPart($origin, function(path, data) {
-            $('textarea', $overlay).val(data);
-        });      
-
-        if($origin.is("*[x-annotation-box]"))
-        {
-            var $b =  $origin.parent();
-            if(this.currentFocused) {
-                // if some other is focused
-                if($b[0] != this.currentFocused[0]) {
-                    this.unfocusAnnotation();
-                    this.focusAnnotation($b);
-                }
+        $overlay.css({
+            position: 'absolute',
+            height: h,
+            left: x,
+            top: y,
+            width: '95%'
+        });
+        
+        try {
+            $('textarea', $overlay).val( this.model.asWLML($origin[0]) );
+
+            if($origin.is(".annotation-inline-box"))
+            {                
+                if(this.currentFocused) {
+                    // if some other is focused
+                    if($origin[0] != this.currentFocused[0]) {
+                        this.unfocusAnnotation();
+                        this.focusAnnotation($origin);
+                    }
                 // already focues
+                }
+                else { // nothing was focused
+                    this.focusAnnotation($origin);
+                }
             }
-            else { // nothing was focused
-                this.focusAnnotation($b);
+            else { // this item is not focusable
+                if(this.currentFocused) this.unfocusAnnotation();
             }
+
+            $($box[0].offsetParent).append($overlay);
+            $origin.data('edit-overlay', $overlay);
+        
+            this.currentOpen = $origin;
+            $origin.attr('x-open', 'open');
         }
-        else { // this item is not focusable
-            if(this.currentFocused) this.unfocusAnnotation();
+        catch(e) {
+            console.log("Can't open", e);
         }
-
-        this.currentOpen = $origin;
-        $origin.attr('x-open', 'open');
                 
         return false;
     },
 
     addTheme: function() 
     {
-        var selection = document.getSelection();
+        var selection = window.getSelection();
         var n = selection.rangeCount;
+
+        console.log("Range count:", n);
         
         if(n == 0)
             window.alert("Nie zaznaczono żadnego obszaru");
@@ -320,34 +354,39 @@ var HTMLView = View.extend({
         if(n > 1)
             window.alert("Zaznacz jeden obszar");
 
+
         // from this point, we will assume that the ranges are disjoint
-        for(var i=0; i < n; i++) {
+        for(var i=0; i < n; i++) 
+        {
             var range = selection.getRangeAt(i);
             console.log(i, range.startContainer, range.endContainer);
             var date = Date.now();
             var random = Math.floor(4000000000*Math.random());
             var id = (''+date) + '-' + (''+random);
 
-            var ipoint = document.createRange();            
-            
-            // Firefox alters the later node when inserting, so
-            // insert from end
-            ipoint.setStart(range.endContainer, range.endOffset);
-            elem = $('<span class="theme-end" x-theme-class="'+id+'" id="e'+id+'"></span>')[0];
-            ipoint.insertNode(elem);
+            var spoint = document.createRange();
+            var epoint = document.createRange();
+
+            spoint.setStart(range.startContainer, range.startOffset);
+            epoint.setStart(range.endContainer, range.endOffset);
 
             // insert theme-ref
-            ipoint.setStart(range.startContainer, range.startOffset);
-            var elem = $('<span class="theme-ref" x-theme-class="'+id+'" id="m'+id+'">Nowy motyw</span>')[0];
-            ipoint.insertNode(elem);
-            ipoint.setStartBefore(elem);
+            
+            var elem = $('<span x-node="motyw" class="theme-ref">Nowy motyw</span>');
+            elem.attr('x-attrib-id', 'm'+id);
+            spoint.insertNode(elem[0]);
 
             // insert theme-begin
-            elem = $('<span class="theme-begin" x-theme-class="'+id+'" id="b'+id+'"></span>')[0];
-            ipoint.insertNode(elem);            
+            elem = $('<span x-node="begin"></span>');
+            elem.attr('x-attrib-id', 'b'+id);
+            spoint.insertNode(elem[0]);
+            
+            elem = $('<span x-node="end" class="theme-end"></span>');
+            elem.attr('x-attrib-id', 'e'+id);
+            epoint.insertNode(elem[0]);
         }
 
-        selection.removeAllRanges();
+    //selection.removeAllRanges();
     },
 
     selectTheme: function(themeId)
old mode 100644 (file)
new mode 100755 (executable)
index 6dbddd9..f4bdc89
@@ -26,9 +26,8 @@ var PanelContainerView = View.extend({
     }
 
     if( value != 'empty') {
-    this.contentView = new klass($('.content-view', 
-      this.element.get(0)), this.model.contentModels[value], this);
-    $('.panel-main-toolbar .refresh', this.element.get(0)).attr('disabled', null);    
+        this.contentView = new klass($('.content-view', this.element.get(0)), this.model, this);
+        $('.panel-main-toolbar .refresh', this.element.get(0)).attr('disabled', null);    
     }
   },
   
old mode 100644 (file)
new mode 100755 (executable)
index 6f0b6fa..0dd5453
@@ -8,8 +8,11 @@ var XMLView = View.extend({
     buttonToolbar: null,
   
     init: function(element, model, parent, template) {
-        this._super(element, model, template);
+        var submodel = model.contentModels['xml'];
+        this._super(element, submodel, template);
+
         this.parent = parent;
+
         this.buttonToolbar = new ButtonToolbarView(
             $('.xmlview-toolbar', this.element),
             this.model.toolbarButtonsModel, parent);
diff --git a/platforma/static/xsl/html2wl_client.xsl b/platforma/static/xsl/html2wl_client.xsl
new file mode 100755 (executable)
index 0000000..d92a4d3
--- /dev/null
@@ -0,0 +1,56 @@
+<xsl:stylesheet \r
+    version="1.0"\r
+    xmlns:html="http://www.w3.org/1999/xhtml"\r
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\r
+\r
+    <xsl:output method="xml" encoding="utf-8" omit-xml-declaration = "yes" />\r
+    <!--\r
+        Ten dokument definiuję przekształcenie odwrotne do wl2html\r
+    -->   \r
+\r
+    <!-- Specjalne reguły dla przypisów -->\r
+    <xsl:template match="*[@x-annotation-box]|*[@X-ANNOTATION-BOX]">\r
+        <xsl:apply-templates select="node()" />\r
+    </xsl:template>\r
+   \r
+    <xsl:template match="*[@x-node]">\r
+        <xsl:element name="{@x-node}">            \r
+            <xsl:apply-templates select="@*|node()" />\r
+        </xsl:element>\r
+    </xsl:template>\r
+\r
+    <xsl:template match="*[@X-NODE]">\r
+        <xsl:element name="{@X-NODE}">\r
+            <xsl:apply-templates select="@*|node()" />\r
+        </xsl:element>\r
+    </xsl:template>\r
+\r
+    <!-- Specjalne reguły dla wersów -->\r
+    <xsl:template match="*[@x-node = 'wers' or @X-NODE = 'wers']">\r
+        <xsl:apply-templates select="node()" />\r
+        <xsl:if test="position() != last()"><xsl:text>/&#x000a;</xsl:text></xsl:if>\r
+    </xsl:template>\r
+\r
+    <xsl:template match="*[starts-with(@x-node, 'wers_')]">\r
+        <xsl:element name="{@x-node}">            \r
+            <xsl:apply-templates select="@*|node()" />\r
+        </xsl:element>\r
+        <xsl:if test="position() != last()"><xsl:text>/&#x000a;</xsl:text></xsl:if>\r
+    </xsl:template>\r
+\r
+    <xsl:template match="*[starts-with(@X-NODE, 'wers_')]">\r
+        <xsl:element name="{@X-NODE}">\r
+            <xsl:apply-templates select="@*|node()" />\r
+        </xsl:element>\r
+        <xsl:if test="position() != last()"><xsl:text>/&#x000a;</xsl:text></xsl:if>\r
+    </xsl:template>\r
+\r
+    <!-- Użycie zmiennych jako argumenty dla translate, psuję Chrome/Safari :( -->\r
+    <xsl:template match="@*[starts-with(translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'x-attrib-')]">\r
+        <xsl:attribute name="{substring-after(translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'x-attrib-')}"><xsl:value-of select="." /></xsl:attribute>\r
+    </xsl:template>\r
+\r
+    <xsl:template match="@*" /><!--[A:<xsl:value-of select="name()" />]</xsl:template> -->\r
+    \r
+    <xsl:template match="*" />\r
+</xsl:stylesheet>
\ No newline at end of file
index 85ff4a3..7a7da8c 100755 (executable)
         Base tag for rendering the whole text 
     -->
 
-    <!-- TODO -->
-
-    
+    <xsl:template match="utwor">
+        <xsl:apply-templates select="child::*[name() = local-name()]">
+            <xsl:with-param name="mixed" select="false()" />
+        </xsl:apply-templates>
+    </xsl:template>    
     
     <!-- 
         Przekształcenia poszczególnych elementów zgodnie z:            
         Tagi rozpoczynające i kończące tekst utworu lirycznego o standardowej szerokości łamu:
     -->
 
-    <xsl:template match="liryka_l">
+    <xsl:template match="opowiadanie|powiesc">
+        <xsl:param name="mixed" />
+        <div class="{name()}" x-node="{name()}">
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="false()" />
+            </xsl:apply-templates>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="liryka_l|liryka_lp">
+        <xsl:param name="mixed" />
+        <div class="{name()}" x-node="{name()}">
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="false()" />
+            </xsl:apply-templates>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny">
+        <xsl:param name="mixed" />
+        <div class="{name()}" x-node="{name()}">
+            <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="false()" />
+            </xsl:apply-templates>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="wywiad">
         <xsl:param name="mixed" />
         <div class="{name()}" x-node="{name()}">
             <xsl:apply-templates select="child::node()">
@@ -64,6 +93,7 @@
     <xsl:template match="autor_utworu">
         <xsl:param name="mixed" />
         <h2 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="nazwa_utworu">
         <xsl:param name="mixed" />
         <h1 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="dzielo_nadrzedne">
         <xsl:param name="mixed" />
         <h2 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="podtytul">
         <xsl:param name="mixed" />
         <h3 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="motto_podpis">
         <xsl:param name="mixed" />
         <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     -->
     <xsl:template match="lista_osob">
         <xsl:param name="mixed" />
-        <div class="{name()}" x-editable="true" x-node="{name()}">
+        <div class="{name()}" x-node="{name()}">
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="false()" />
             </xsl:apply-templates>
 
     <xsl:template match="naglowek_listy">
         <xsl:param name="mixed" />
-        <p class="{name()}" x-node="{name()}">
+        <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="lista_osoba">
         <xsl:param name="mixed" />
         <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_czesc">
         <xsl:param name="mixed" />
         <h2 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_rozdzial">
         <xsl:param name="mixed" />
         <h3 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_podrozdzial">
         <xsl:param name="mixed" />
         <h4 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="srodtytul">
         <xsl:param name="mixed" />
         <h2 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_akt">
         <xsl:param name="mixed" />
         <h2 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_scena">
         <xsl:param name="mixed" />
         <h3 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="naglowek_osoba">
         <xsl:param name="mixed" />
         <h4 class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="akap">
         <xsl:param name="mixed" />
         <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="akap_cd">
         <xsl:param name="mixed" />
         <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     <xsl:template match="akap_dialog">
         <xsl:param name="mixed" />
         <p class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
     -->
     <xsl:template match="strofa">
         <div class="{name()}" x-editable="true" x-node="{name()}">
+            <xsl:call-template name="context-menu" />
             <xsl:choose>
                 <xsl:when test="count(br) > 0">
+                    <xsl:variable name="first-verse" select="br[1]/preceding-sibling::node()" />                    
                     <xsl:call-template name="verse">
-                        <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::node()" />
-                        <xsl:with-param name="verse-type" select="name(br[1]/preceding-sibling::*[starts-with(name(current()),'wers')])" />
+                        <xsl:with-param name="verse-content" select="$first-verse" />                        
                     </xsl:call-template>
                     <xsl:for-each select="br">
-                       <!-- Each BR tag "consumes" text after it -->
                         <xsl:variable name="lnum" select="count(preceding-sibling::br)" />
+                        <!-- select all nodes up to the next br or end of stanza -->
+                        <xsl:variable name="current-verse"
+                            select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />                        
                         <xsl:call-template name="verse">
-                            <xsl:with-param name="verse-content"
-                                select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" />
-                            <xsl:with-param name="verse-type"
-                                select="name(following-sibling::*[count(preceding-sibling::br) = $lnum+1 and starts-with(name(current()), 'wers')][1])" />
+                            <xsl:with-param name="verse-content" select="$current-verse" />                            
                         </xsl:call-template>
                     </xsl:for-each>
                 </xsl:when>
                 <xsl:otherwise>
                     <xsl:call-template name="verse">
-                        <xsl:with-param name="verse-content" select="child::node()" />
-                        <xsl:with-param name="verse-type" select="name(child::*[starts-with(name(current()),'wers')])" />
+                        <xsl:with-param name="verse-content" select="child::node()" />                        
                     </xsl:call-template>
                 </xsl:otherwise>
             </xsl:choose>
     </xsl:template>
 
     <xsl:template name="verse">
+        <!-- the verse contents including the last br (if any) -->
         <xsl:param name="verse-content" />
-        <xsl:param name="verse-type" />
+        
+        <xsl:variable name="first-tag-name" select="name($verse-content/self::*)" />
+        <!-- name of text nodes is '' == false -->
 
         <xsl:choose>
-            <xsl:when test="$verse-type = ''">
-                <p class="wers" x-node="wers">
+            <xsl:when test="starts-with($first-tag-name, 'wers')">
+                <p class="{$first-tag-name}" x-node="{$first-tag-name}">
                 <xsl:for-each select="$verse-content[name(.) != 'br']">
-                    <xsl:apply-templates select=".">
+                <xsl:apply-templates select=".">
                     <xsl:with-param name="mixed" select="true()" />
-                    </xsl:apply-templates>
+                </xsl:apply-templates>
                 </xsl:for-each>
-                </p>                
+                </p>
             </xsl:when>
+
             <xsl:otherwise>
-                <p class="{$verse-type}" x-node="{$verse-type}">
+                <p class="wers" x-node="wers">
                 <xsl:for-each select="$verse-content[name(.) != 'br']">
-                <xsl:apply-templates select=".">
+                    <xsl:apply-templates select=".">
                     <xsl:with-param name="mixed" select="true()" />
-                </xsl:apply-templates>
+                    </xsl:apply-templates>
                 </xsl:for-each>
-                </p>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-        
+                </p>                
+            </xsl:otherwise>          
+            
+        </xsl:choose>       
+    </xsl:template>
+
+    <xsl:template match="wers_cd|wers_akap|wers_wciety">
+        <xsl:param name="mixed" />
+        <xsl:call-template name="copy-attributes" />
+        <xsl:apply-templates select="child::node()">
+                <xsl:with-param name="mixed" select="true()" />
+            </xsl:apply-templates>
     </xsl:template>
     
 
     -->
     <xsl:template match="tytul_dziela">
         <xsl:param name="mixed" />
-        <span class="{name()}" x-editable="true" x-node="{name()}">
+        <em class="{name()}" x-node="{name()}">
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </span>
+        </em>
     </xsl:template>
 
     <xsl:template match="wyroznienie|slowo_obce|mat|didask_tekst|osoba|wyp_osoba|www">
         <br class="{name()}" x-node="{name()}" />
     </xsl:template>
 
-    <xsl:template match="sekcja_asteryks">
+    <xsl:template match="sekcja_asterysk">
         <xsl:param name="mixed" />
         <hr class="{name()}" x-node="{name()}" />
     </xsl:template>
         Przypisy i motywy
     -->
     <xsl:template match="pr|pa|pe|pt">       
-        <span class="annotation-inline-box" x-node="{name()}">
+        <span class="annotation-inline-box" x-node="{name()}" x-editable="true">
             <a name="anchor-{generate-id(.)}" />
             <!-- the link to the non-inline version -->
             <a href="#annotation-{generate-id(.)}" class="annotation"></a>
             <!-- inline contents -->
             <span x-annotation-box="true">
+                <xsl:call-template name="context-menu" />
                 <xsl:apply-templates select="node()">
                     <xsl:with-param name="mixed" select="true()" />
                 </xsl:apply-templates>
             </span>
         </span>
-
     </xsl:template>
 
-    <xsl:template match="begin">
-        <xsl:variable name="id" select="substring-after(@id, 'b')" />
-        <span class="theme-begin" x-node="begin" x-theme-class="{$id}" id="{@id}"></span>
-        <xsl:apply-templates select="following-sibling::motyw[@id = concat('m', $id)]" mode="theme-begin" />
+    <xsl:template match="begin">        
+        <span class="theme-begin" x-node="begin">
+            <xsl:call-template name="copy-attributes" />
+        </span>
     </xsl:template>
 
     <xsl:template match="motyw">
-        <span class="theme-ref" x-node="motyw" x-theme-class="{substring-after(@id, 'm')}" id="{@id}">
+        <span class="theme-ref" x-node="motyw">
+            <xsl:call-template name="copy-attributes" />
             <xsl:value-of select="." />
         </span>
     </xsl:template>
 
-
     <xsl:template match="end">
-        <span class="theme-end" x-node="end" x-theme-class="{substring-after(@id, 'e')}" id="{@id}">
+        <span class="theme-end" x-node="end">
+            <xsl:call-template name="copy-attributes" />
         </span>
     </xsl:template>
 
     <xsl:template match="*">
         <div x-node="error" x-content="{name()}" />
     </xsl:template>
+
+    <xsl:template name="context-menu">
+        <span class="default-menu context-menu">
+            <span class="edit-button">Edit</span>
+        </span>
+        <span class="edit-menu context-menu">
+            <span class="accept-button">OK</span>
+            <span class="reject-button">Cancel</span>
+        </span>
+    </xsl:template>
+
+    <xsl:template name="copy-attributes">
+        <xsl:for-each select="@*">
+            <xsl:attribute name="x-attrib-{name(.)}"><xsl:value-of select="."/></xsl:attribute>
+        </xsl:for-each>
+    </xsl:template>
     
 </xsl:stylesheet>
\ No newline at end of file
index 7db4f44..247f59c 100755 (executable)
@@ -12,9 +12,8 @@
                 docID: '{{ fileid }}',
                 userID: '{{ euser }}',
                 docURL: '{% url document_view fileid %}{% if euser %}?user={{ euser|urlencode }}{% endif %}',
-                toolbarURL: '{% url toolbar_buttons %}',
-                renderURL: '{% url api.views.render %}',
-                               staticURL: '{{ STATIC_URL }}'
+                toolbarURL: '{% url toolbar_buttons %}',                
+               staticURL: '{{ STATIC_URL }}'
             }          
                 
        </script>
                <div class="htmlview">
                </div>
        </script>       
-        
-        <script type="text/html" charset="utf-8" id="html-view-frag-menu-template">
-            <span class="default-menu context-menu">
-                <span class="edit-button">Edytuj</span>                
-            </span>
-            <span class="edit-menu context-menu">
-                <span class="accept-button">OK</span>
-                <span class="reject-button">Anuluj</span>
-            </span>
-        </script>
-
-
 
        <script type="text/html" charset="utf-8" id="flash-view-template">
                <div class="flashview">