You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/09/20 15:17:49 UTC

svn commit: r448197 - in /lenya/trunk/src: java/org/apache/lenya/cms/cocoon/components/modules/input/ modules/resource/ modules/resource/config/cocoon-xconf/ modules/sitetree/ modules/sitetree/resources/icons/ modules/sitetree/resources/javascript/ mod...

Author: andreas
Date: Wed Sep 20 06:17:49 2006
New Revision: 448197

URL: http://svn.apache.org/viewvc?view=rev&rev=448197
Log:
Show resource-type specific icons in sitetree. Better icon images will come.

Added:
    lenya/trunk/src/modules/sitetree/resources/icons/
    lenya/trunk/src/modules/sitetree/resources/icons/default.gif   (with props)
    lenya/trunk/src/modules/xhtml/resources/icons/
    lenya/trunk/src/modules/xhtml/resources/icons/xhtml.gif   (with props)
Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
    lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf
    lenya/trunk/src/modules/resource/sitemap.xmap
    lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js
    lenya/trunk/src/modules/sitetree/sitemap.xmap
    lenya/trunk/src/modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf
    lenya/trunk/src/modules/xhtml/sitemap.xmap
    lenya/trunk/src/webapp/lenya/resources/css/tabs.css

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java Wed Sep 20 06:17:49 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.lenya.cms.cocoon.components.modules.input;
 
+import java.util.Arrays;
 import java.util.Map;
 import java.util.Date;
 import java.text.SimpleDateFormat;
@@ -55,8 +56,11 @@
  * <ul>
  * <li><strong><code>expires</code></strong> - the expiration date in RFC 822/1123 format, see
  * {@link org.apache.lenya.cms.publication.ResourceType#getExpires()}</li>
- * <li><strong><code>schemaUri</code></strong> - see {@link org.apache.lenya.xml.Schema#getURI()}</li>
+ * <li><strong><code>schemaUri</code></strong> - see
+ * {@link org.apache.lenya.xml.Schema#getURI()}</li>
  * <li><strong><code>httpSchemaUri</code></strong> - the URI to request the schema over HTTP</li>
+ * <li><strong><code>supportsFormat:{format}</code></strong> - true if the resource type
+ * supports this format, false otherwise</li>
  * </ul>
  */
 public class ResourceTypeModule extends AbstractInputModule implements Serviceable {
@@ -64,6 +68,7 @@
     protected static final String SCHEMA_URI = "schemaUri";
     protected static final String HTTP_SCHEMA_URI = "httpSchemaUri";
     protected static final String EXPIRES = "expires";
+    protected static final String SUPPORTS_FORMAT = "supportsFormat";
 
     public Object getAttribute(String name, Configuration modeConf, Map objectModel)
             throws ConfigurationException {
@@ -115,6 +120,10 @@
                 Date expires = resourceType.getExpires();
                 SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss zzz");
                 value = sdf.format(expires);
+            } else if (attribute.equals(SUPPORTS_FORMAT)) {
+                String format = steps[steps.length - 1];
+                String[] formats = resourceType.getFormats();
+                return Boolean.toString(Arrays.asList(formats).contains(format));
             } else {
                 throw new ConfigurationException("Attribute [" + name + "] not supported!");
             }

Modified: lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf (original)
+++ lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf Wed Sep 20 06:17:49 2006
@@ -25,6 +25,7 @@
     <schema src="fallback://lenya/modules/resource/resources/schemas/resource.rng" language="http://relaxng.org/ns/structure/0.9"/>
     <sample-name>fallback://lenya/modules/resource/samples/resource.xml</sample-name>
     <format name="xhtml" uri="cocoon://modules/resource/xhtml.xml"/>
+    <format name="icon" uri="cocoon://modules/resource/icon"/>
   </component-instance>
 
 </xconf>

Modified: lenya/trunk/src/modules/resource/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/resource/sitemap.xmap?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/resource/sitemap.xmap (original)
+++ lenya/trunk/src/modules/resource/sitemap.xmap Wed Sep 20 06:17:49 2006
@@ -91,6 +91,11 @@
         </map:transform>
         <map:serialize type="xml"/>
       </map:match>
+      
+      <map:match pattern="icon/*/*/*/*">
+        <map:read src="fallback://lenya/modules/resource/resources/icons/default.gif"/>
+      </map:match>
+      
       <map:match pattern="**icons/**.*">
         <map:act type="resource-exists-enhanced">
           <map:parameter name="url"
@@ -102,6 +107,7 @@
         <map:read
           src="fallback://lenya/modules/resource/resources/icons/default_med.gif"/>
       </map:match>
+      
     </map:pipeline>
     
   </map:pipelines>

Added: lenya/trunk/src/modules/sitetree/resources/icons/default.gif
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/resources/icons/default.gif?view=auto&rev=448197
==============================================================================
Binary file - no diff available.

Propchange: lenya/trunk/src/modules/sitetree/resources/icons/default.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js (original)
+++ lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js Wed Sep 20 06:17:49 2006
@@ -231,7 +231,14 @@
 
 /* return an img object that represents the file type */
 LenyaTree.prototype.getIcon = function(item) {
+/*
     return this.doc.createTextNode('');
+*/
+    var img = this.doc.createElement('img');
+    var language = CHOSEN_LANGUAGE;
+    img.setAttribute('src', CONTEXT_PREFIX + item.getPath() + '_' + language + '.gif?lenya.module=sitetree');
+    img.setAttribute('alt', '');
+    return img;
 };
 
 /* creates the item name and any icons and such */

Modified: lenya/trunk/src/modules/sitetree/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/sitemap.xmap?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/sitetree/sitemap.xmap (original)
+++ lenya/trunk/src/modules/sitetree/sitemap.xmap Wed Sep 20 06:17:49 2006
@@ -153,6 +153,22 @@
       </map:match>
     </map:pipeline>
     
+    <!-- Resource type icons -->
+    <map:pipeline>
+      <map:match pattern="*/*/**_*.gif">
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test"
+            value="{resource-type:{doc-info:{1}:{2}:{page-envelope:document-uuid}:{4}:resourceType}:supportsFormat:icon}"/>
+          <map:when test="true">
+            <map:read src="site://{1}/{2}/{4}/{3}?format=icon"/>
+          </map:when>
+          <map:otherwise>
+            <map:read src="fallback://lenya/modules/sitetree/resources/icons/default.gif"/>
+          </map:otherwise>
+        </map:select>
+      </map:match>
+    </map:pipeline>
+    
   </map:pipelines>
 
 </map:sitemap>

Modified: lenya/trunk/src/modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf (original)
+++ lenya/trunk/src/modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf Wed Sep 20 06:17:49 2006
@@ -35,6 +35,7 @@
     <format name="xhtml" uri="cocoon://modules/xhtml/xhtml.xml"/>
     <format name="webdavGET" uri="cocoon://modules/xhtml/davget.xml"/>
     <format name="luceneIndex" uri="cocoon://modules/xhtml/lucene-index"/>
+    <format name="icon" uri="cocoon://modules/xhtml/icon"/>
   </component-instance>
   
 </xconf>

Added: lenya/trunk/src/modules/xhtml/resources/icons/xhtml.gif
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/xhtml/resources/icons/xhtml.gif?view=auto&rev=448197
==============================================================================
Binary file - no diff available.

Propchange: lenya/trunk/src/modules/xhtml/resources/icons/xhtml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: lenya/trunk/src/modules/xhtml/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/xhtml/sitemap.xmap?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/modules/xhtml/sitemap.xmap (original)
+++ lenya/trunk/src/modules/xhtml/sitemap.xmap Wed Sep 20 06:17:49 2006
@@ -101,6 +101,10 @@
         <map:serialize type="xml"/>
       </map:match>
 
+      <map:match pattern="icon/*/*/*/*">
+        <map:read src="fallback://lenya/modules/xhtml/resources/icons/xhtml.gif"/>
+      </map:match>
+      
     </map:pipeline>
     
   </map:pipelines>

Modified: lenya/trunk/src/webapp/lenya/resources/css/tabs.css
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/resources/css/tabs.css?view=diff&rev=448197&r1=448196&r2=448197
==============================================================================
--- lenya/trunk/src/webapp/lenya/resources/css/tabs.css (original)
+++ lenya/trunk/src/webapp/lenya/resources/css/tabs.css Wed Sep 20 06:17:49 2006
@@ -135,7 +135,7 @@
   padding: 0px 0px 0px 2px; 
 }
 
-#lenya-info-treecanvas .treenode_icon { padding-left: 2px; padding-right: 1px; }
+#lenya-info-treecanvas .treenode_icon { padding-left: 2px; padding-right: 5px; vertical-align: middle; }
 #lenya-info-treecanvas .selected_node span { background-color: rgb(221, 220, 207); }
 #lenya-info-treecanvas .treenode_sign { vertical-align: top; padding: 0px; }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org