clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject git commit: CLEREZZA-829: Removed create.js based editor attempt
Date Sun, 01 Jun 2014 10:28:45 GMT
Repository: clerezza
Updated Branches:
  refs/heads/master 251e2a9f0 -> b2bd675d9


CLEREZZA-829: Removed create.js based editor attempt

Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/b2bd675d
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/b2bd675d
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/b2bd675d

Branch: refs/heads/master
Commit: b2bd675d9c6d06186933b59a21b240e015a87eda
Parents: 251e2a9
Author: reto <reto@apache.org>
Authored: Sun Jun 1 12:28:22 2014 +0200
Committer: reto <reto@apache.org>
Committed: Sun Jun 1 12:28:22 2014 +0200

----------------------------------------------------------------------
 platform.editor/pom.xml                         |  45 ----
 .../renderlets/DiscobitsContentEtch.scala       | 239 +++++++++++++++++++
 .../editor/renderlets/TitledContentCreate.scala |  98 --------
 .../editor/renderlets/TitledContentEtch.scala   | 239 -------------------
 4 files changed, 239 insertions(+), 382 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/b2bd675d/platform.editor/pom.xml
----------------------------------------------------------------------
diff --git a/platform.editor/pom.xml b/platform.editor/pom.xml
index 65826fa..ba148c4 100644
--- a/platform.editor/pom.xml
+++ b/platform.editor/pom.xml
@@ -46,18 +46,6 @@
             <version>0.14-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.wymiwyg.js</groupId>
-            <artifactId>createjs</artifactId>
-            <version>1.0.0alpha1</version>
-            <type>js</type>
-        </dependency>
-        <dependency>
-            <groupId>org.wymiwyg.js</groupId>
-            <artifactId>createjs-theme</artifactId>
-            <version>1.0.0alpha1</version>
-            <type>jar</type>
-        </dependency>
-        <dependency>
             <groupId>org.apache.clerezza</groupId>
             <artifactId>platform.typehandlerspace</artifactId>
             <version>0.9-SNAPSHOT</version>
@@ -168,39 +156,6 @@
 				<artifactId>maven-scala-plugin</artifactId>
 			</plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <version>2.7</version>
-                <executions>
-                    <execution>
-                        <id>copy-js-deps</id>
-                        <phase>generate-resources</phase> 
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <includeTypes>js</includeTypes>
-                            <outputDirectory>
-                                ${project.build.directory}/generated-resources/META-INF/resources/tools/create
-                            </outputDirectory>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>copy-jar-deps</id>
-                        <phase>generate-resources</phase> 
-                        <goals>
-                            <goal>unpack-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <includeArtifactIds>createjs-theme</includeArtifactIds>
-                            <outputDirectory>
-                                ${project.build.directory}/generated-resources/META-INF/resources/tools/create
-                            </outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
           <groupId>org.apache.felix</groupId>
           <artifactId>maven-bundle-plugin</artifactId>
           <version>2.4.0</version>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/b2bd675d/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/DiscobitsContentEtch.scala
----------------------------------------------------------------------
diff --git a/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/DiscobitsContentEtch.scala
b/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/DiscobitsContentEtch.scala
new file mode 100644
index 0000000..302834d
--- /dev/null
+++ b/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/DiscobitsContentEtch.scala
@@ -0,0 +1,239 @@
+package org.apache.clerezza.platform.editor
+
+import org.apache.clerezza.rdf.core._
+import org.apache.clerezza.rdf.scala.utils.Preamble._
+import javax.ws.rs.core.MediaType
+import org.apache.clerezza.platform.typerendering.TypeRenderlet
+import org.apache.clerezza.platform.typerendering.scala._
+import org.apache.clerezza.rdf.ontologies.DISCOBITS
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;import scala.xml.Unparsed
+import scala.xml._
+import scala.xml.transform._
+
+
+
+abstract class DiscobitsContentEtch extends SRenderlet {
+    
+  override val getMediaType = MediaType.TEXT_HTML_TYPE
+
+  override def getModePattern = "edit"
+
+  override def renderedPage(arguments: XmlResult.Arguments) = {
+    new XmlResult(arguments) {
+      override def content = {
+        val initScript = """
+                       var discoBitsCollection = new Backbone.Collection();
+            $(function() {
+              
+                var gp = new GraphRDFaProcessor();
+                gp.target.graph = new RDFaGraph();
+                gp.process(document);
+                var origTurtle = gp.target.graph.toString();
+                //alert(origTurtle);
+                function saveAllModified() {
+                    /*var modifiedModels = discoBitsCollection.filter(function(model) {return
model.hasChanged()})
+                    var modified = new Backbone.Collection(modifiedModels);
+                    alert("could save: " +modifiedModels+" models "+ JSON.stringify(modified.toJSON()))
+                    var gp = new GraphRDFaProcessor();*/
+                    gp.target.graph = new RDFaGraph();
+                    gp.process(document);
+                    var newTurtle = gp.target.graph.toString()
+                    $.post( "/tools/editor/post", { assert: newTurtle, revoke: origTurtle,
rdfFormat: 'text/turtle' }, function( data ) {
+                      alert("saved");
+                      origTurtle = newTurtle;
+                    }) .fail(function( data) {
+                      errdata = data
+                      alert( "error: " + data.statusText);
+                    });
+                }
+                
+                var InfoBit = Backbone.Model.extend({
+                    defaults: {
+                        "@type": 'disco:XHTMLInfoDiscoBit',
+                        "disco:infoBit": 'Some content'
+                    },
+                    initialize: function() {
+                        console.log('This model has been initialized.');
+                        var m = this;
+                        this.on('change', function(msg) {
+                            console.log('A value for this model has changed: ');
+                            console.log(m.changed);
+                            console.log(m.get("@id"));
+                            console.log('A value for this model has changed: '+m.hasChanged(null));
+                            m.foo = "bar"
+                        });
+                    }
+                });
+
+                var InfoBitView = Backbone.View.extend({
+                    initialize: function() {
+                        _.bindAll(this, 'save')
+                        this.model.bind('save', this.save);
+                        var infoBit = $(this.el).find('[property="disco:infoBit"]').html()
+                        console.log(this.model.hasChanged(null))
+                        //this.model.set("disco:infoBit", infoBit)
+                        console.log(this.model.hasChanged(null))
+                        this.stickit();
+                    },
+                    events: {
+                        'mousedown .editable': 'editableClick'
+                    },
+                    bindings: {
+                        '[property="disco:infoBit"]': 'disco:infoBit'
+                    },
+                    editableClick: etch.editableInit,
+                    save: function() {
+
+                        // normally you would call model.save() here but this is a demo
+                        // $(this.el).find('.editable').effect('highlight', {color: 'yellow'});
+                        // $('.save-event').fadeIn('fast', function() {
+                        //     setTimeout($(this).fadeOut('slow'), 10000);
+                        // });
+                        console.log("this modified: ");
+                        console.log(this.model.get("@id"));
+                        console.log(this.model.changed);
+                        console.log("this is modified: "+this.model.hasChanged(null));
+                        saveAllModified();
+                    }
+
+                });
+
+                //$article = $('[property="disco:infoBit"]');
+                $('[property="disco:infoBit"]').addClass("editable")
+                $('[property="disco:infoBit"]').attr("data-button-class", "all")
+                //this ensure two way binding with stickit
+                $('[property="disco:infoBit"]').attr("contenteditable", "true")
+                $article = $('[typeof="disco:XHTMLInfoDiscoBit"]');
+                _.forEach($article, function(art) {
+                    console.log(art);
+                    var infoBit = $(art).find('[property="disco:infoBit"]').html()
+                    var about = $(art).attr('about')
+                    var model = new InfoBit({
+                        "@id": about,
+                        "disco:infoBit": infoBit
+                    });
+                    new InfoBitView({model: model, el: art, tagName: art.tagName});
+                    discoBitsCollection.add(model)
+                });
+                //var view = new articleView({model: model, el: $article[0], tagName: $article[0].tagName});
+
+            });
+
+            Backbone.on('all', function(s) {
+                console.log('Handling all: ' + s);
+            });
+        
+            
+        
+            /*document.addEventListener(
+              "rdfa.loaded",
+              function() {
+                 _.forEach(document.getElementsByType("http://discobits.org/ontology#Entry"),
function(e) {
+                  $(e).css('background-color', 'blue');
+                });
+                console.log('all colored');
+                //console.log('activating: '+RDFaProcessor);
+                CallbackProcessor.prototype = new RDFaProcessor();
+                CallbackProcessor.prototype.constructor=RDFaProcessor;
+                function CallbackProcessor() {
+                   RDFaProcessor.call(this);
+                }
+
+                CallbackProcessor.prototype.newSubjectOrigin = function(origin,subject) {
+                   console.log("New origin for "+subject);
+                }
+
+                CallbackProcessor.prototype.addTriple = function(origin,subject,predicate,object)
{
+                   console.log("New triple: "+subject+", predicate "+predicate+
+                               ", object "+object.value+", "+object.language+", "+object.type);
+                }
+                console.log('activated: '+CallbackProcessor);
+                processor = new CallbackProcessor();
+                processor.finishedHandlers.push(
+                    function(node) {
+                       alert("Done!");
+                    }
+                 );
+                 processor.process(document);
+                 console.log('done');
+              },
+              false
+            );*/
+            """
+        val html = <html xmlns:disco="http://discobits.org/ontology#"> 
+          
+            <head>
+                <link type="text/css" href="/style/style.css" rel="stylesheet" />
+                <link rel="stylesheet" href="/tools/editor/styles/etch.css" />
+                {for (part <- res/DISCOBITS.contains;  if ((part/DISCOBITS.pos*) == "0"))
yield
+                <title>Editing: {part/DISCOBITS.holds/DISCOBITS.infoBit*}</title>
}
+                <script src="/tools/editor/scripts/RDFaProcessor.1.3.0.js"></script>
+                <script src="/tools/editor/scripts/RDFa.1.3.0.js"></script>
+            </head>
+          <body>
+            {render(res, "rdfa-naked")}
+            <script src="/tools/editor/scripts/jquery.min.js"></script>
+            <script src="/tools/editor/scripts/underscore-min.js"></script>
+            <script src="/tools/editor/scripts/backbone-min.js"></script>
+            <script src="/tools/editor/scripts/etch.js"></script>
+            <script src="/tools/editor/scripts/backbone.stickit.js"></script>
+            <script>
+              {Unparsed(initScript)}
+            </script>
+          </body>
+        </html>
+        
+        //From: http://www.w3.org/TR/html5/syntax.html#syntax     
+        //"A single newline may be placed immediately after the start tag of pre 
+        //and textarea elements. If the element's contents are intended to 
+        //start with a newline, two consecutive newlines thus need to be 
+        //included by the author."
+        object preRule extends RewriteRule {
+          override def transform(n: Node): Seq[Node] = n match {
+            case e:Elem
+            	if(e.label == "pre") => e.child(0) match   {
+            		case t : Text =>
+            		  if (t.text(0) == '\n') {
+             				val newText = Text("\n"+t.text)
+     					    	e.copy(child = newText ++ e.child.tail)
+     					    } else {
+     					    	e
+     					    }
+     					  case _ => e
+     					}
+            case other => other
+          }
+        }
+        
+        object htmlLineBreaks extends RuleTransformer(preRule)
+
+        htmlLineBreaks(html)
+      }
+    }
+  }
+
+}
+
+@Component
+@Service(Array(classOf[TypeRenderlet]))
+class TitledContentEtch extends DiscobitsContentEtch {
+
+  val getRdfType = DISCOBITS.TitledContent 
+}
+            
+@Component
+@Service(Array(classOf[TypeRenderlet]))
+class HtmlInfoDiscobitEtch extends DiscobitsContentEtch {
+
+  override val getRdfType = DISCOBITS.XHTMLInfoDiscoBit 
+    
+}
+
+@Component
+@Service(Array(classOf[TypeRenderlet]))
+class OrderedContentDiscobitEtch extends DiscobitsContentEtch {
+
+  override val getRdfType = DISCOBITS.OrderedContent
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/b2bd675d/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentCreate.scala
----------------------------------------------------------------------
diff --git a/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentCreate.scala
b/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentCreate.scala
deleted file mode 100644
index 120d1f0..0000000
--- a/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentCreate.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.apache.clerezza.platform.editor
-
-import org.apache.clerezza.rdf.core._
-import impl.util.W3CDateFormat
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import javax.ws.rs.core.MediaType
-import org.apache.clerezza.platform.typerendering.TypeRenderlet
-import org.apache.clerezza.platform.typerendering.scala._
-import org.apache.clerezza.rdf.ontologies.DISCOBITS
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;import scala.xml.Unparsed
-
-
-
-/**
- * A Renderlet for rss:items
- */
-@Component
-@Service(Array(classOf[TypeRenderlet]))
-class TitledContentCreate extends SRenderlet {
-
-  val getRdfType = DISCOBITS.TitledContent 
-    
-  override val getMediaType = MediaType.TEXT_HTML_TYPE
-
-  override def getModePattern = "create"
-
-  override def renderedPage(arguments: XmlResult.Arguments) = {
-    new XmlResult(arguments) {
-      override def content = {
-        val initScript = """
-                        var id_counter = 1;
-                        
-                        jQuery(document).ready(function() {
-                        // Prepare VIE
-                        //global for debuging
-                        v = new VIE();
-                        v.use(new v.RdfaService());
-
-                        // Load Create.js with your VIE instance
-                        jQuery("body").midgardCreate({
-                          vie: v,
-                          url: function() {
-                              return "/tools/editor/create/"; },
-                          stanbolUrl: "/"
-                        });
-                        Backbone.sync = function(method, model) {
-                          console.log("I've been passed " + method + " with " + JSON.stringify(model));
-                          if(method === 'create'){ model.set('id', id_counter++); }
-                          console.log("method: "+method);
-                          console.log(id_counter);
-                          console.log(this.ajaxSettings.contentType);
-                        };
-                        /*jQuery('body').midgardStorage({
-                          vie: new VIE(),
-                          url: function (item) { return '/some32/url'; }, 
-                          saveRemote: {"contentType": "application/ld+json"}
-                        });*/
-                      });"""
-        <html xmlns:disco="http://discobits.org/ontology#"> 
-          {for (part <- res/DISCOBITS.contains;  if ((part/DISCOBITS.pos*) == "0")) yield
-            <head>
-                <link type="text/css" href="/style/style.css" rel="stylesheet" />
-                <title>Editing: {part/DISCOBITS.holds/DISCOBITS.infoBit*}</title>
-
-                <link rel="stylesheet" href="/tools/create/font-awesome/css/font-awesome.css"
/>
-
-                <link rel="stylesheet" href="/tools/create/themes/create-ui/css/create-ui.css"
/>
-
-                <link rel="stylesheet" href="/tools/create/themes/midgard-notifications/midgardnotif.css"
/>
-
-                <style>
-                  body {{
-                  padding-left: 20%;
-                  padding-right: 20%;
-                  padding-top: 90px;
-                  background-color: #eeeeec;
-                  }}
-                </style>
-                <script src="/tools/create/almond-0.0.2-alpha-1.js" > </script>
-                <script src="/tools/create/jquery-amd-1.7.1-alpha-1.js" > </script>
-                <script src="/tools/create/jquery-ui-amd-1.8.16-alpha-1.js" > </script>
-                <!-- maybe less broken -->
-                <script src="https://rdfquery.googlecode.com/files/jquery.rdfquery.rules.min-1.0.js"></script>
-                <script src="/tools/create/createjs-1.0.0alpha1.js" > </script>
-                <script>{Unparsed(initScript)}
-                </script>
-            </head>
-          }
-          <body>
-            {render(res, "rdfa-naked")}
-          </body>
-        </html>
-      }
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/clerezza/blob/b2bd675d/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentEtch.scala
----------------------------------------------------------------------
diff --git a/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentEtch.scala
b/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentEtch.scala
deleted file mode 100644
index 4f3e031..0000000
--- a/platform.editor/src/main/scala/org/apache/clerezza/platform/editor/renderlets/TitledContentEtch.scala
+++ /dev/null
@@ -1,239 +0,0 @@
-package org.apache.clerezza.platform.editor
-
-import org.apache.clerezza.rdf.core._
-import impl.util.W3CDateFormat
-import org.apache.clerezza.rdf.scala.utils.Preamble._
-import javax.ws.rs.core.MediaType
-import org.apache.clerezza.platform.typerendering.TypeRenderlet
-import org.apache.clerezza.platform.typerendering.scala._
-import org.apache.clerezza.rdf.ontologies.DISCOBITS
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;import scala.xml.Unparsed
-import scala.xml._
-import scala.xml.transform._
-
-
-/**
- * A Renderlet for rss:items
- */
-@Component
-@Service(Array(classOf[TypeRenderlet]))
-class TitledContentEtch extends SRenderlet {
-
-  val getRdfType = DISCOBITS.TitledContent 
-    
-  override val getMediaType = MediaType.TEXT_HTML_TYPE
-
-  override def getModePattern = "edit"
-
-  override def renderedPage(arguments: XmlResult.Arguments) = {
-    new XmlResult(arguments) {
-      override def content = {
-        val initScript = """
-                       var discoBitsCollection = new Backbone.Collection();
-            $(function() {
-              
-                var gp = new GraphRDFaProcessor();
-                gp.target.graph = new RDFaGraph();
-                gp.process(document);
-                var origTurtle = gp.target.graph.toString();
-                //alert(origTurtle);
-                function saveAllModified() {
-                    /*var modifiedModels = discoBitsCollection.filter(function(model) {return
model.hasChanged()})
-                    var modified = new Backbone.Collection(modifiedModels);
-                    alert("could save: " +modifiedModels+" models "+ JSON.stringify(modified.toJSON()))
-                    var gp = new GraphRDFaProcessor();*/
-                    gp.target.graph = new RDFaGraph();
-                    gp.process(document);
-                    var newTurtle = gp.target.graph.toString()
-                    $.post( "/tools/editor/post", { assert: newTurtle, revoke: origTurtle,
rdfFormat: 'text/turtle' }, function( data ) {
-                      alert("saved");
-                      origTurtle = newTurtle;
-                    }) .fail(function( data) {
-                      errdata = data
-                      alert( "error: " + data.statusText);
-                    });
-                }
-                
-                var InfoBit = Backbone.Model.extend({
-                    defaults: {
-                        "@type": 'disco:XHTMLInfoDiscoBit',
-                        "disco:infoBit": 'Some content'
-                    },
-                    initialize: function() {
-                        console.log('This model has been initialized.');
-                        var m = this;
-                        this.on('change', function(msg) {
-                            console.log('A value for this model has changed: ');
-                            console.log(m.changed);
-                            console.log(m.get("@id"));
-                            console.log('A value for this model has changed: '+m.hasChanged(null));
-                            m.foo = "bar"
-                        });
-                    }
-                });
-
-                var InfoBitView = Backbone.View.extend({
-                    initialize: function() {
-                        _.bindAll(this, 'save')
-                        this.model.bind('save', this.save);
-                        var infoBit = $(this.el).find('[property="disco:infoBit"]').html()
-                        console.log(this.model.hasChanged(null))
-                        //this.model.set("disco:infoBit", infoBit)
-                        console.log(this.model.hasChanged(null))
-                        this.stickit();
-                    },
-                    events: {
-                        'mousedown .editable': 'editableClick'
-                    },
-                    bindings: {
-                        '[property="disco:infoBit"]': 'disco:infoBit'
-                    },
-                    editableClick: etch.editableInit,
-                    save: function() {
-
-                        // normally you would call model.save() here but this is a demo
-                        // $(this.el).find('.editable').effect('highlight', {color: 'yellow'});
-                        // $('.save-event').fadeIn('fast', function() {
-                        //     setTimeout($(this).fadeOut('slow'), 10000);
-                        // });
-                        console.log("this modified: ");
-                        console.log(this.model.get("@id"));
-                        console.log(this.model.changed);
-                        console.log("this is modified: "+this.model.hasChanged(null));
-                        saveAllModified();
-                    }
-
-                });
-
-                //$article = $('[property="disco:infoBit"]');
-                $('[property="disco:infoBit"]').addClass("editable")
-                $('[property="disco:infoBit"]').attr("data-button-class", "all")
-                //this ensure two way binding with stickit
-                $('[property="disco:infoBit"]').attr("contenteditable", "true")
-                $article = $('[typeof="disco:XHTMLInfoDiscoBit"]');
-                _.forEach($article, function(art) {
-                    console.log(art);
-                    var infoBit = $(art).find('[property="disco:infoBit"]').html()
-                    var about = $(art).attr('about')
-                    var model = new InfoBit({
-                        "@id": about,
-                        "disco:infoBit": infoBit
-                    });
-                    new InfoBitView({model: model, el: art, tagName: art.tagName});
-                    discoBitsCollection.add(model)
-                });
-                //var view = new articleView({model: model, el: $article[0], tagName: $article[0].tagName});
-
-            });
-
-            Backbone.on('all', function(s) {
-                console.log('Handling all: ' + s);
-            });
-        
-            
-        
-            /*document.addEventListener(
-              "rdfa.loaded",
-              function() {
-                 _.forEach(document.getElementsByType("http://discobits.org/ontology#Entry"),
function(e) {
-                  $(e).css('background-color', 'blue');
-                });
-                console.log('all colored');
-                //console.log('activating: '+RDFaProcessor);
-                CallbackProcessor.prototype = new RDFaProcessor();
-                CallbackProcessor.prototype.constructor=RDFaProcessor;
-                function CallbackProcessor() {
-                   RDFaProcessor.call(this);
-                }
-
-                CallbackProcessor.prototype.newSubjectOrigin = function(origin,subject) {
-                   console.log("New origin for "+subject);
-                }
-
-                CallbackProcessor.prototype.addTriple = function(origin,subject,predicate,object)
{
-                   console.log("New triple: "+subject+", predicate "+predicate+
-                               ", object "+object.value+", "+object.language+", "+object.type);
-                }
-                console.log('activated: '+CallbackProcessor);
-                processor = new CallbackProcessor();
-                processor.finishedHandlers.push(
-                    function(node) {
-                       alert("Done!");
-                    }
-                 );
-                 processor.process(document);
-                 console.log('done');
-              },
-              false
-            );*/
-            """
-        val html = <html xmlns:disco="http://discobits.org/ontology#"> 
-          
-            <head>
-                <link type="text/css" href="/style/style.css" rel="stylesheet" />
-                <link rel="stylesheet" href="/tools/editor/styles/etch.css" />
-                {for (part <- res/DISCOBITS.contains;  if ((part/DISCOBITS.pos*) == "0"))
yield
-                <title>Editing: {part/DISCOBITS.holds/DISCOBITS.infoBit*}</title>
}
-                <script src="/tools/editor/scripts/RDFaProcessor.1.3.0.js"></script>
-                <script src="/tools/editor/scripts/RDFa.1.3.0.js"></script>
-            </head>
-          <body>
-            {render(res, "rdfa-naked")}
-            <script src="/tools/editor/scripts/jquery.min.js"></script>
-            <script src="/tools/editor/scripts/underscore-min.js"></script>
-            <script src="/tools/editor/scripts/backbone-min.js"></script>
-            <script src="/tools/editor/scripts/etch.js"></script>
-            <script src="/tools/editor/scripts/backbone.stickit.js"></script>
-            <script>
-              {Unparsed(initScript)}
-            </script>
-          </body>
-        </html>
-        
-        //From: http://www.w3.org/TR/html5/syntax.html#syntax     
-        //"A single newline may be placed immediately after the start tag of pre 
-        //and textarea elements. If the element's contents are intended to 
-        //start with a newline, two consecutive newlines thus need to be 
-        //included by the author."
-        object preRule extends RewriteRule {
-          override def transform(n: Node): Seq[Node] = n match {
-            case e:Elem
-            	if(e.label == "pre") => e.child(0) match   {
-            		case t : Text =>
-            		  if (t.text(0) == '\n') {
-             				val newText = Text("\n"+t.text)
-     					    	e.copy(child = newText ++ e.child.tail)
-     					    } else {
-     					    	e
-     					    }
-     					  case _ => e
-     					}
-            case other => other
-          }
-        }
-        
-        object htmlLineBreaks extends RuleTransformer(preRule)
-
-        htmlLineBreaks(html)
-      }
-    }
-  }
-
-}
-
-@Component
-@Service(Array(classOf[TypeRenderlet]))
-class HtmlInfoDiscobitEtch extends TitledContentEtch {
-
-  override val getRdfType = DISCOBITS.XHTMLInfoDiscoBit 
-    
-}
-
-@Component
-@Service(Array(classOf[TypeRenderlet]))
-class OrderedContentDiscobitEtch extends TitledContentEtch {
-
-  override val getRdfType = DISCOBITS.OrderedContent
-    
-}
\ No newline at end of file


Mime
View raw message