Author: fmeschbe
Date: Sun May 17 17:14:57 2009
New Revision: 775718

URL: http://svn.apache.org/viewvc?rev=775718&view=rev
Log:
SLING-965 add web console plugin to display known mime type mappings

Added:
    
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
   (with props)
    incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/
    
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
   (with props)
    
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
   (with props)
Modified:
    incubator/sling/trunk/bundles/commons/mime/LICENSE
    incubator/sling/trunk/bundles/commons/mime/NOTICE
    incubator/sling/trunk/bundles/commons/mime/pom.xml
    
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
    
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/LICENSE
    
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/NOTICE

Modified: incubator/sling/trunk/bundles/commons/mime/LICENSE
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/LICENSE?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/commons/mime/LICENSE (original)
+++ incubator/sling/trunk/bundles/commons/mime/LICENSE Sun May 17 17:14:57 2009
@@ -200,3 +200,35 @@
    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.
+
+
+APACHE SLING SUBCOMPONENTS:
+
+Apache Sling includes subcomponents with separate copyright notices and
+license terms. Your use of these subcomponents is subject to the terms
+and conditions of the following licenses.
+
+JQuery TreeTable plugin
+
+    Copyright (c) 2009 Ludo van den Boom
+    
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation
+    files (the "Software"), to deal in the Software without
+    restriction, including without limitation the rights to use,
+    copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following
+    conditions:
+    
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+    OTHER DEALINGS IN THE SOFTWARE.

Modified: incubator/sling/trunk/bundles/commons/mime/NOTICE
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/NOTICE?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/commons/mime/NOTICE (original)
+++ incubator/sling/trunk/bundles/commons/mime/NOTICE Sun May 17 17:14:57 2009
@@ -6,3 +6,7 @@
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed by
+Copyright (c) 2009 Ludo van den Boom (http://blog.cubicphuse.nl/)
+Licensed under the MIT License
\ No newline at end of file

Modified: incubator/sling/trunk/bundles/commons/mime/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/pom.xml?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/commons/mime/pom.xml (original)
+++ incubator/sling/trunk/bundles/commons/mime/pom.xml Sun May 17 17:14:57 2009
@@ -88,6 +88,15 @@
             <artifactId>org.osgi.compendium</artifactId>
         </dependency>
         <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.webconsole</artifactId>
+            <version>1.2.0</version>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>

Modified: 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
 (original)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
 Sun May 17 17:14:57 2009
@@ -23,20 +23,25 @@
 import java.io.PrintStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.felix.webconsole.WebConsoleConstants;
 import org.apache.sling.commons.mime.MimeTypeProvider;
 import org.apache.sling.commons.mime.MimeTypeService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.log.LogService;
 
 /**
- * The <code>MimeTypeServiceImpl</code> TODO
+ * The <code>MimeTypeServiceImpl</code> is the official implementation of the
+ * {...@link MimeTypeService} interface.
  * 
  * @scr.component immediate="false" metatype="no"
  * @scr.property name="service.vendor" value="The Apache Software Foundation"
@@ -63,6 +68,10 @@
 
     private List<MimeTypeProvider> typeProviderList = new 
ArrayList<MimeTypeProvider>();
 
+    private MimeTypeWebConsolePlugin webConsolePlugin;
+
+    private ServiceRegistration webConsolePluginService;
+
     /**
      * @see 
org.apache.sling.commons.mime.MimeTypeService#getMimeType(java.lang.String)
      */
@@ -241,10 +250,35 @@
                 this.registerMimeType(bundles[i].getEntry(MIME_TYPES));
             }
         }
+
+        try {
+            MimeTypeWebConsolePlugin plugin = new 
MimeTypeWebConsolePlugin(this);
+            plugin.activate(context.getBundleContext());
+
+            Dictionary<String, String> props = new Hashtable<String, String>();
+            props.put(WebConsoleConstants.PLUGIN_LABEL, plugin.getLabel());
+
+            webConsolePluginService = 
context.getBundleContext().registerService(
+                WebConsoleConstants.SERVICE_NAME, plugin, props);
+            webConsolePlugin = plugin;
+        } catch (Throwable t) {
+            // don't care, we thus don't have the console plugin
+        }
     }
 
     protected void deactivate(ComponentContext context) {
         context.getBundleContext().removeBundleListener(this);
+
+        if (webConsolePluginService != null) {
+            webConsolePluginService.unregister();
+            webConsolePluginService = null;
+
+        }
+
+        if (webConsolePlugin != null) {
+            webConsolePlugin.deactivate();
+            webConsolePlugin = null;
+        }
     }
 
     protected void bindMimeTypeProvider(MimeTypeProvider mimeTypeProvider) {
@@ -268,4 +302,14 @@
             this.registerMimeType(event.getBundle().getEntry(MIME_TYPES));
         }
     }
+
+    // ---------- plugin support 
-----------------------------------------------
+
+    Map<String, String> getMimeMap() {
+        return mimeTab;
+    }
+
+    Map<String, String> getExtensionMap() {
+        return extensionMap;
+    }
 }

Added: 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java?rev=775718&view=auto
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
 (added)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
 Sun May 17 17:14:57 2009
@@ -0,0 +1,193 @@
+/*
+ * Copyright 1997-2009 Day Management AG
+ * Barfuesserplatz 6, 4001 Basel, Switzerland
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Day Management AG, ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with Day.
+ */
+package org.apache.sling.commons.mime.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Map.Entry;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.webconsole.AbstractWebConsolePlugin;
+
+class MimeTypeWebConsolePlugin extends AbstractWebConsolePlugin {
+
+    /** Serial Version */
+    private static final long serialVersionUID = -2025952303202431607L;
+
+    private static final String LABEL = "mimetypes";
+
+    private static final String TITLE = "MIME Types";
+
+    private final MimeTypeServiceImpl mimeTypeService;
+
+    MimeTypeWebConsolePlugin(MimeTypeServiceImpl mimeTypeService) {
+        this.mimeTypeService = mimeTypeService;
+    }
+
+    @Override
+    public String getLabel() {
+        return LABEL;
+    }
+
+    @Override
+    public String getTitle() {
+        return TITLE;
+    }
+
+    @Override
+    protected void doGet(HttpServletRequest request,
+            HttpServletResponse response) throws ServletException, IOException 
{
+
+        if (!spoolResource(request, response)) {
+            super.doGet(request, response);
+        }
+    }
+
+    @Override
+    protected void renderContent(HttpServletRequest req, HttpServletResponse 
res)
+            throws IOException {
+
+        Map<String, Set<String>> mimetab = new TreeMap<String, Set<String>>();
+
+        Map<String, String> extMap = mimeTypeService.getExtensionMap();
+
+        int numExt = 0;
+        for (Entry<String, String> entry : 
mimeTypeService.getMimeMap().entrySet()) {
+            String ext = entry.getKey();
+            String mime = entry.getValue();
+
+            Set<String> extList = mimetab.get(mime);
+            if (extList == null) {
+                extList = new HashSet<String>();
+                mimetab.put(mime, extList);
+            }
+
+            if (ext.equals(extMap.get(mime))) {
+                ext = "*" + ext + "*";
+            }
+
+            extList.add(ext);
+
+            numExt++;
+        }
+
+        PrintWriter pw = res.getWriter();
+
+        String resLoc = getLabel() + "/res";
+        pw.println("<link href='" + resLoc
+            + "/jquery.treeTable.css' rel='stylesheet' type='text/css' />");
+        pw.println("<script type='text/javascript' src='" + resLoc
+            + "/jquery.treeTable.min.js'></script>");
+        pw.println("<script type='text/javascript'>");
+        pw.println("  $(document).ready(function()  {");
+        pw.println("    $('#mimetabtable').treeTable({ treeColumn: 1 });");
+        pw.println("  });");
+        pw.println("</script>");
+
+        pw.println("<div id='plugin_content'>");
+        pw.println("<div class='fullwidth'>");
+        pw.println("<div class='statusline'>Statistic: " + mimetab.size()
+            + " MIME Types, " + numExt + " Extensions</div>");
+        pw.println("</div>");
+
+        pw.println("<div class='table'>");
+        pw.println("<table id='mimetabtable' class='tablelayout'>");
+
+        pw.println("<colgroup>");
+        pw.println("<col width='20px'>");
+        pw.println("<col width='50%'>");
+        pw.println("<col width='50%'>");
+        pw.println("</colgroup>");
+
+        pw.println("<thead>");
+        pw.println("<tr>");
+        pw.println("<th colspan='2'>Mime Type</th>");
+        pw.println("<th'>Extensions</th>");
+        pw.println("</tr>");
+        pw.println("</thead>");
+
+        pw.println("<tbody>");
+
+        String currentMajor = null;
+
+        for (Entry<String, Set<String>> entry : mimetab.entrySet()) {
+            String major = getMajorType(entry.getKey());
+
+            if (!major.equals(currentMajor)) {
+                currentMajor = major;
+                pw.println("<tr id='" + currentMajor + "'>");
+                pw.println("<td>&nbsp;</td>");
+                pw.println("<td>" + currentMajor + "</td>");
+                pw.println("<td>--</td>");
+                pw.println("</tr>");
+            }
+
+            pw.println("<tr id='" + entry.getKey().replace('/', '-')
+                + "' class='child-of-" + currentMajor + "'>");
+            pw.println("<td>&nbsp;</td>");
+            pw.println("<td>" + entry.getKey() + "</td>");
+            pw.println("<td>" + entry.getValue() + "</td>");
+            pw.println("</tr>");
+        }
+
+        pw.println("</tbody>");
+        pw.println("</table>");
+        pw.println("</div>");
+        pw.println("</div>");
+    }
+
+    private String getMajorType(String type) {
+        int slash = type.indexOf('/');
+        return (slash > 0) ? type.substring(0, slash) : type;
+    }
+    
+    private boolean spoolResource(HttpServletRequest request,
+            HttpServletResponse response) throws IOException {
+
+        String pi = request.getPathInfo();
+        int rPi = pi.indexOf("/res/");
+        if (rPi >= 0) {
+            pi = pi.substring(rPi);
+            InputStream ins = getClass().getResourceAsStream(pi);
+            if (ins != null) {
+                try {
+                    
response.setContentType(getServletContext().getMimeType(pi));
+                    OutputStream out = response.getOutputStream();
+                    byte[] buf = new byte[2048];
+                    int rd;
+                    while ((rd = ins.read(buf)) >= 0) {
+                        out.write(buf, 0, rd);
+                    }
+                    return true;
+                } finally {
+                    try {
+                        ins.close();
+                    } catch (IOException ignore) {
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+}

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/LICENSE
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/LICENSE?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/LICENSE 
(original)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/LICENSE 
Sun May 17 17:14:57 2009
@@ -200,3 +200,35 @@
    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.
+
+
+APACHE SLING SUBCOMPONENTS:
+
+Apache Sling includes subcomponents with separate copyright notices and
+license terms. Your use of these subcomponents is subject to the terms
+and conditions of the following licenses.
+
+JQuery TreeTable plugin
+
+    Copyright (c) 2009 Ludo van den Boom
+    
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation
+    files (the "Software"), to deal in the Software without
+    restriction, including without limitation the rights to use,
+    copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following
+    conditions:
+    
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+    OTHER DEALINGS IN THE SOFTWARE.

Modified: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/NOTICE
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/NOTICE?rev=775718&r1=775717&r2=775718&view=diff
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/NOTICE 
(original)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/META-INF/NOTICE 
Sun May 17 17:14:57 2009
@@ -6,3 +6,7 @@
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed by
+Copyright (c) 2009 Ludo van den Boom (http://blog.cubicphuse.nl/)
+Licensed under the MIT License
\ No newline at end of file

Added: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css?rev=775718&view=auto
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
 (added)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
 Sun May 17 17:14:57 2009
@@ -0,0 +1,43 @@
+/* jQuery TreeTable Core 2.0 stylesheet
+ *
+ * This file contains styles that are used to display the tree table. Each tree
+ * table is assigned the +treeTable+ class.
+ * ========================================================================= */
+
+/* jquery.treeTable.collapsible
+ * ------------------------------------------------------------------------- */
+.treeTable tr td .expander {
+  background-position: left center;
+  background-repeat: no-repeat;
+  cursor: pointer;
+  padding: 0;
+  zoom: 1; /* IE7 Hack */
+}
+
+.treeTable tr.collapsed td .expander {
+  background-image: url(../../res/imgs/arrow_right.png);
+}
+
+.treeTable tr.expanded td .expander {
+  background-image: url(../../res/imgs/arrow_down.png);
+}
+
+/* jquery.treeTable.sortable
+ * ------------------------------------------------------------------------- */
+.treeTable tr.selected, .treeTable tr.accept {
+  background-color: #3875d7;
+  color: #fff;
+}
+
+.treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept 
td .expander {
+  background-image: url(../../res/imgs/arrow_right.png);
+}
+
+.treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td 
.expander {
+  background-image: url(../../res/imgs/arrow_down.png);
+}
+
+.treeTable .ui-draggable-dragging {
+  color: #000;
+  z-index: 1;
+}
\ No newline at end of file

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.css
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js?rev=775718&view=auto
==============================================================================
--- 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
 (added)
+++ 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
 Sun May 17 17:14:57 2009
@@ -0,0 +1,10 @@
+/* jQuery treeTable Plugin 2.2.1 - 
http://ludo.cubicphuse.nl/jquery-plugins/treeTable/ */
+(function($){var 
options;$.fn.treeTable=function(opts){options=$.extend({},$.fn.treeTable.defaults,opts);return
 this.each(function(){$(this).addClass("treeTable").find("tbody 
tr").each(function(){if(!options.expandable||$(this)[0].className.search("child-of-")==-1){initialize($(this));}});});};$.fn.treeTable.defaults={childPrefix:"child-of-",expandable:true,indent:19,initialState:"collapsed",treeColumn:0};$.fn.collapse=function(){$(this).addClass("collapsed");childrenOf($(this)).each(function(){initialize($(this));if(!$(this).hasClass("collapsed")){$(this).collapse();}
+$(this).hide();});return 
this;};$.fn.expand=function(){$(this).removeClass("collapsed").addClass("expanded");childrenOf($(this)).each(function(){initialize($(this));if($(this).is(".expanded.parent")){$(this).expand();}
+$(this).show();});return this;};$.fn.appendBranchTo=function(destination){var 
node=$(this);var parent=parentOf(node);var 
ancestorNames=$.map(ancestorsOf($(destination)),function(a){return 
a.id;});if($.inArray(node[0].id,ancestorNames)==-1&&(!parent||(destination.id!=parent[0].id))&&destination.id!=node[0].id){indent(node,ancestorsOf(node).length*options.indent*-1);if(parent){node.removeClass(options.childPrefix+parent[0].id);}
+node.addClass(options.childPrefix+destination.id);move(node,destination);indent(node,ancestorsOf(node).length*options.indent);}
+return this;};$.fn.reverse=function(){return 
this.pushStack(this.get().reverse(),arguments);};$.fn.toggleBranch=function(){if($(this).hasClass("collapsed")){$(this).expand();}else{$(this).removeClass("expanded").collapse();}
+return this;};function ancestorsOf(node){var 
ancestors=[];while(node=parentOf(node)){ancestors[ancestors.length]=node[0];}
+return ancestors;};function childrenOf(node){return $("table.treeTable tbody 
tr."+options.childPrefix+node[0].id);};function indent(node,value){var 
cell=$(node.children("td")[options.treeColumn]);var 
padding=parseInt(cell.css("padding-left"),10)+value;cell.css("padding-left",+padding+"px");childrenOf(node).each(function(){indent($(this),value);});};function
 
initialize(node){if(!node.hasClass("initialized")){node.addClass("initialized");var
 
childNodes=childrenOf(node);if(!node.hasClass("parent")&&childNodes.length>0){node.addClass("parent");}
+if(node.hasClass("parent")){var 
cell=$(node.children("td")[options.treeColumn]);var 
padding=parseInt(cell.css("padding-left"),10)+options.indent;childNodes.each(function(){$($(this).children("td")[options.treeColumn]).css("padding-left",padding+"px");});if(options.expandable){cell.prepend('<span
 style="margin-left: -'+options.indent+'px; padding-left: '+options.indent+'px" 
class="expander"></span>');$(cell[0].firstChild).click(function(){node.toggleBranch();});if(!(node.hasClass("expanded")||node.hasClass("collapsed"))){node.addClass(options.initialState);}
+if(node.hasClass("collapsed")){node.collapse();}else 
if(node.hasClass("expanded")){node.expand();}}}}};function 
move(node,destination){node.insertAfter(destination);childrenOf(node).reverse().each(function(){move($(this),node[0]);});};function
 parentOf(node){var classNames=node[0].className.split(' ');for(key in 
classNames){if(classNames[key].match("child-of-")){return 
$("#"+classNames[key].substring(9));}}};})(jQuery);
\ No newline at end of file

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/sling/trunk/bundles/commons/mime/src/main/resources/res/jquery.treeTable.min.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url


Reply via email to