svn commit: r761247 - in /lenya/contributions/2_0_X/modules/firedocs/src: ./ extension/ extension/chrome/ extension/chrome/content/ extension/chrome/content/browser/ extension/chrome/locale/ extension/chrome/skin/ extension/chrome/skin/icons/ extension...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Apr  2 11:03:12 2009
New Revision: 761247

URL: http://svn.apache.org/viewvc?rev=761247&view=rev
Log:
Adding firedocs module. Thanks to Thomas Comiotto of Wired Inference for implementing the add-on and to the Universitaetsklinikum Freiburg and the University of Zurich for sponsoring.

Added:
    lenya/contributions/2_0_X/modules/firedocs/src/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest   (with props)
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaDocumentUriResolver.js
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaOverlayManager.js
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/LenyaEditorButtonPopupShowingListener.js
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/browserOverlay.xul
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/lenyaOverlay.xul
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/locale/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/skin/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/skin/icons/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/defaults/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/defaults/preferences/
    lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf   (with props)

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest Thu Apr  2 11:03:12 2009
@@ -0,0 +1,30 @@
+#
+#  Copyright 2008-2011 Wired Inference GmbH Zuerich
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Chrome Manifest file (for Firefox 1.1+)
+#
+
+
+content    firedocs-lenya chrome/content/
+
+overlay    chrome://browser/content/browser.xul   chrome://firedocs-lenya/content/browser/browserOverlay.xul
+overlay    chrome://firedocs/content/workspace/workspace.xul   chrome://firedocs-lenya/content/lenyaOverlay.xul
+
+
+skin       firedocs-lenya  classic/1.0  chrome/skin/

Propchange: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome.manifest
------------------------------------------------------------------------------
    svn:executable = *

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaDocumentUriResolver.js
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy%20of%20LenyaDocumentUriResolver.js?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaDocumentUriResolver.js (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaDocumentUriResolver.js Thu Apr  2 11:03:12 2009
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2008-2011 Wired Inference GmbH Zuerich
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+function LenyaDocumentUriResolver(aServiceUri) {
+
+  this.logger = new Logger("LenyaDocumentUriResolver"); 
+
+  this.networkService = new NetworkService(); 
+  this.ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                          .getService(Components.interfaces.nsIIOService);
+
+  this.serviceUri = aServiceUri; 
+  this.uriMap = new Object(); 
+
+}
+
+LenyaDocumentUriResolver.prototype = {
+
+  serviceUri: null, 
+  uriMap: null, 
+
+
+  resolve: function(aUriString) {
+
+    var log = this.logger; 
+    log.entry("resolve()"); 
+
+    var uri = this.uriMap[aUriString]; 
+
+    if (!uri) {
+
+      var query = this.serviceUri.spec + aUriString; 
+      var queryUri = this.ioService.newURI(query, null, null); 
+      var response = this.networkService.httpGet(queryUri);
+
+      try {
+        uri = this.ioService.newURI(response.body, null, this.serviceUri); 
+        this.uriMap[aUriString] = uri; 
+      } catch (e) {
+        log.errorException(e)
+      }   
+    }
+
+    if (uri)
+      log.debug("Uri: " + uri.spec); 
+
+    log.exit("resolve()"); 
+    return uri; 
+
+  }, 
+
+
+  canResolve: function(aUriString) {
+
+    var log = this.logger; 
+    log.entry("canResolve()"); 
+
+    log.debug("aUriString: " + aUriString); 
+
+    if (aUriString.indexOf("lenya-document:") == 0)
+      return true; 
+
+    log.exit("canResolve()"); 
+    return false; 
+
+  }, 
+
+
+  invalidate: function() {
+    this.uriMap = new Object(); 
+  }
+
+
+}; 
+

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaOverlayManager.js
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy%20of%20LenyaOverlayManager.js?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaOverlayManager.js (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/Copy of LenyaOverlayManager.js Thu Apr  2 11:03:12 2009
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2008-2011 Wired Inference GmbH Zuerich
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+function LenyaOverlayManager() {
+
+  this.logger = new Logger("LenyaOverlayManager"); 
+
+  this.ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                          .getService(Components.interfaces.nsIIOService);
+
+
+  var workspace = getWorkspace(); 
+
+  workspace.addWorkspaceObserver(this);
+
+  this.workspace = workspace;
+
+}
+
+LenyaOverlayManager.prototype = {
+
+  workspace: null,
+  editor: null,  
+  overlayEnabled: false, 
+
+
+  /* Workspace Observer */
+
+  didOpenDocument: function (aURI, aData, aContentType) {
+
+    var log = this.logger; 
+    log.entry("didOpenDocument()"); 
+
+    log.debug(aURI.spec + ", " + aContentType); 
+
+    var workspace = this.workspace; 
+    var contentType = aContentType; 
+
+    this.addUriResolverToWorkspace();
+
+    switch(aContentType) {
+
+      case "application/lenya-links+xml": 
+
+        this.addEditorToWorkspace(); 
+
+        this.overlayEnabled = true;
+        break; 
+
+    } 
+
+    log.exit("didOpenDocument()"); 
+
+  },
+
+
+  didSaveDocument: function(aURI, aData) {}, 
+
+  addEditorToWorkspace: function() {
+
+    var log = this.logger; 
+    log.entry("addEditorToWorkspace()"); 
+
+    var ioService = this.ioService;
+    var workspace = this.workspace;
+
+    var serviceEditUri = workspace.atomPubServiceEditUri;
+
+    if (serviceEditUri) {
+
+      // remote configuration 
+
+      var atomPubService = new AtomPubService();
+      var helper = new FiredocsAtomPubHelper();
+  
+      var entry = atomPubService.getEntry(serviceEditUri); 
+
+      if (entry) {
+
+        // create editor
+
+        var schemaUri = helper.getSchemaUri(entry); 
+        var stylesheetUri = helper.getStylesheetUri(entry); 
+        var stylesheetParameters = helper.getStylesheetParameters(entry); 
+        var insertsUri = helper.getInsertsUri(entry);
+        var pageContextUri = helper.getPageContextUri(entry); 
+ 
+        var sitemaps = new Array();
+
+        if (schemaUri && stylesheetUri) {
+
+          var editor = new WysiwygXmlEditor(workspace, schemaUri, stylesheetUri, stylesheetParameters, pageContextUri, sitemaps);
+          editor.setEnableTransformPageContext(false);
+          editor.setLabel("UniCMS Editor - WYSIWYG");
+          workspace.addEditor(editor);
+
+        }
+
+      }
+    } 
+
+    log.exit("addEditorToWorkspace()"); 
+
+  },
+
+
+  addUriResolverToWorkspace: function() {
+
+    var log = this.logger; 
+    log.entry("addUriResolverToWorkspace()"); 
+
+    var ioService = this.ioService;
+    var workspace = this.workspace;
+
+    var resolver = null;
+    var serviceEditUri = workspace.atomPubServiceEditUri;
+
+    if (serviceEditUri) {
+
+      var atomPubService = new AtomPubService();
+
+      var entry = atomPubService.getEntry(serviceEditUri);
+      
+
+      if (entry) {
+
+        var entryDocument = entry.ownerDocument;
+
+        try {
+          var result = entryDocument.evaluate("//firedocs:url-resolver/@href", entry, this.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+
+          if (!result.singleNodeValue)
+            result = entryDocument.evaluate("//edit:uri-resolver/@href", entry, this.nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
+
+
+          log.debug("Resolver uri: " + result.singleNodeValue); 
+
+          if (result.singleNodeValue) {
+            var uriString = result.singleNodeValue.textContent;
+            var baseUri = ioService.newURI(entryDocument.baseURI, null, null);
+            uri = ioService.newURI(uriString, null, baseUri);
+            resolver = new LenyaDocumentUriResolver(uri);
+          }
+        } catch(e) {
+          log.errorException(e);
+        }
+
+        log.debug("Resolver: " + resolver);
+
+      }
+
+      if (resolver) 
+        workspace.addUriResolver(resolver); 
+
+    }
+
+    log.exit("addUriResolverToWorkspace()"); 
+
+  }, 
+
+
+  didOpenEditor: function(aEditor) {}, 
+
+
+  nsResolver: function(prefix) {
+    var ns = {
+      'atom' : 'http://www.w3.org/2005/Atom',
+      'firedocs': 'www.firedocs.org/config/1.0',
+      'edit': 'http://apache.org/lenya/editing'
+    };
+    return ns[prefix] || null;
+  }
+
+
+};
+
+
+function createLenyaOverlayManager() {
+  new LenyaOverlayManager();
+}
+
+window.addEventListener("DOMContentLoaded", createLenyaOverlayManager, false);
+

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/LenyaEditorButtonPopupShowingListener.js
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/LenyaEditorButtonPopupShowingListener.js?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/LenyaEditorButtonPopupShowingListener.js (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/LenyaEditorButtonPopupShowingListener.js Thu Apr  2 11:03:12 2009
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008-2011 Wired Inference GmbH Zuerich
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+function LenyaEditorButtonPopupShowingListener() {
+
+
+
+}
+
+
+LenyaEditorButtonPopupShowingListener.prototype = {
+
+  handleEvent: function(aEvent) {
+
+    // auto-discovery
+
+    if (window.gFiredocsAutoDiscoveryService) {
+
+      var atomServiceDocument = gFiredocsAutoDiscoveryService.getAtomPubServiceEditDocument(); 
+
+      if (atomServiceDocument) {
+
+        var helper = new FiredocsAtomPubHelper(); 
+        var mimeType = helper.getEditMediaMimeType(atomServiceDocument.documentElement); 
+
+        if (mimeType == "application/lenya-links+xml") {
+          goSetCommandEnabled("cmd_firedocsEditCurrentPage", true);
+        }
+      } 
+    }
+  }
+
+}; 
+
+
+function addLenyaEditorButtonPopupShowingListener (aEvent) {
+
+  if (aEvent.target instanceof XULDocument) {
+    document.getElementById("firedocsToolbarButtonMenuPopup").addEventListener("popupshowing", new LenyaEditorButtonPopupShowingListener(), false); 
+  }
+}
+
+
+window.addEventListener("DOMContentLoaded", addLenyaEditorButtonPopupShowingListener, false);

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/browserOverlay.xul
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/browserOverlay.xul?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/browserOverlay.xul (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/browser/browserOverlay.xul Thu Apr  2 11:03:12 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2008-2011 Wired Inference GmbH Zuerich
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<overlay id="lenyaBrowserOverlay" 
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+   <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
+   <script type="application/x-javascript" src="chrome://firedocs-lenya/content/browser/LenyaEditorButtonPopupShowingListener.js"/> 
+ 
+</overlay>

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/lenyaOverlay.xul
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/lenyaOverlay.xul?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/lenyaOverlay.xul (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/chrome/content/lenyaOverlay.xul Thu Apr  2 11:03:12 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2008-2011 Wired Inference GmbH Zuerich
+  
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+
+<overlay id="lenyaOverlay"  
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <script type="application/x-javascript" src="chrome://firedocs-lenya/content/LenyaOverlayManager.js"/> 
+  <script type="application/x-javascript" src="chrome://firedocs-lenya/content/LenyaDocumentUriResolver.js"/>
+
+</overlay>

Added: lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf?rev=761247&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf (added)
+++ lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf Thu Apr  2 11:03:12 2009
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Copyright 2008-2011 Wired Inference GmbH Zuerich
+  
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<rdf:RDF 
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <rdf:Description rdf:about="urn:mozilla:install-manifest">
+
+    <em:name>Firedocs Lenya 2 Support</em:name>
+    <em:id>[email protected]</em:id>
+    <em:version>0.9</em:version>
+    <em:type>2</em:type>
+    <em:creator>Thomas Comiotto</em:creator>
+    <em:description>Firedocs Lenya Addons (Default Publication)</em:description>
+    <em:contributor>Thomas Comiotto</em:contributor>
+    <!-- <em:updateURL>{uri}/update.rdf</em:updateURL> -->  
+
+ 
+    <!-- 
+    	Target application is Firefox. You can try specifying other Mozilla
+    	applications such as Thunderbird and see.
+    -->
+
+   <em:requires>
+     <rdf:Description>
+       <em:id>[email protected]</em:id>
+       <em:minVersion>1.2.2</em:minVersion>
+       <em:maxVersion>1.*</em:maxVersion>
+     </rdf:Description>
+   </em:requires>
+
+    <em:targetApplication>
+      <rdf:Description>
+        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+        <em:minVersion>2.0</em:minVersion>
+        <em:maxVersion>3.*</em:maxVersion>
+      </rdf:Description>
+    </em:targetApplication> 
+
+  </rdf:Description>
+
+</rdf:RDF>

Propchange: lenya/contributions/2_0_X/modules/firedocs/src/extension/install.rdf
------------------------------------------------------------------------------
    svn:executable = *
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.