You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2012/03/13 17:43:48 UTC

svn commit: r1300232 [11/14] - in /lucene/dev/branches/lucene3795_lsp_spatial_module: ./ dev-tools/eclipse/ dev-tools/maven/ dev-tools/maven/lucene/contrib/demo/ dev-tools/maven/solr/contrib/clustering/ dev-tools/maven/solr/contrib/dataimporthandler/ d...

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dashboard.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dashboard.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dashboard.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dashboard.js Tue Mar 13 16:43:38 2012
@@ -1,400 +1,417 @@
+/*
+ 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.
+*/
+
 // #/:core
 sammy.get
 (
-    /^#\/([\w\d-]+)$/,
-    function( context )
-    {
-        var core_basepath = this.active_core.attr( 'data-basepath' );
-        var content_element = $( '#content' );
+  /^#\/([\w\d-]+)$/,
+  function( context )
+  {
+    var core_basepath = this.active_core.attr( 'data-basepath' );
+    var content_element = $( '#content' );
         
-        content_element
-            .removeClass( 'single' );
+    content_element
+      .removeClass( 'single' );
         
-        var core_menu = $( 'ul', this.active_core );
-        if( !core_menu.data( 'admin-extra-loaded' ) )
-        {
-            core_menu.data( 'admin-extra-loaded', new Date() );
+    var core_menu = $( 'ul', this.active_core );
+    if( !core_menu.data( 'admin-extra-loaded' ) )
+    {
+      core_menu.data( 'admin-extra-loaded', new Date() );
 
-            $.get
-            (
-                core_basepath + '/admin/file/?file=admin-extra.menu-top.html',
-                function( menu_extra )
-                {
-                    core_menu
-                        .prepend( menu_extra );
-                }
-            );
+      $.get
+      (
+        core_basepath + '/admin/file/?file=admin-extra.menu-top.html',
+        function( menu_extra )
+        {
+          core_menu
+            .prepend( menu_extra );
+        }
+      );
             
-            $.get
-            (
-                core_basepath + '/admin/file/?file=admin-extra.menu-bottom.html',
-                function( menu_extra )
-                {
-                    core_menu
-                        .append( menu_extra );
-                }
-            );
+      $.get
+      (
+        core_basepath + '/admin/file/?file=admin-extra.menu-bottom.html',
+        function( menu_extra )
+        {
+          core_menu
+            .append( menu_extra );
         }
+      );
+    }
         
-        $.get
-        (
-            'tpl/dashboard.html',
-            function( template )
-            {
-                content_element
-                    .html( template );
+    $.get
+    (
+      'tpl/dashboard.html',
+      function( template )
+      {
+        content_element
+          .html( template );
                     
-                var dashboard_element = $( '#dashboard' );
+        var dashboard_element = $( '#dashboard' );
                                      
-                $.ajax
-                (
-                    {
-                        url : core_basepath + '/admin/luke?wt=json&show=index&numTerms=0',
-                        dataType : 'json',
-                        context : $( '#statistics', dashboard_element ),
-                        beforeSend : function( xhr, settings )
-                        {
-                            $( 'h2', this )
-                                .addClass( 'loader' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Loading ...' );
-                            
-                            $( '.content' )
-                                .hide();
-                        },
-                        success : function( response, text_status, xhr )
-                        {
-                            $( '.message', this )
-                                .empty()
-                                .hide();
+        $.ajax
+        (
+          {
+            url : core_basepath + '/admin/luke?wt=json&show=index&numTerms=0',
+            dataType : 'json',
+            context : $( '#statistics', dashboard_element ),
+            beforeSend : function( xhr, settings )
+            {
+              $( 'h2', this )
+                .addClass( 'loader' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Loading ...' );
+                            
+              $( '.content' )
+                .hide();
+            },
+            success : function( response, text_status, xhr )
+            {
+              $( '.message', this )
+                .empty()
+                .hide();
                             
-                            $( '.content', this )
-                                .show();
+              $( '.content', this )
+                .show();
                                 
-                            var data = {
-                                'index_num-docs' : response['index']['numDocs'],
-                                'index_max-doc' : response['index']['maxDoc'],
-                                'index_version' : response['index']['version'],
-                                'index_segmentCount' : response['index']['segmentCount'],
-                                'index_last-modified' : response['index']['lastModified']
-                            };
-                            
-                            for( var key in data )
-                            {
-                                $( '.' + key, this )
-                                    .show();
+              var data = {
+                'index_num-docs' : response['index']['numDocs'],
+                'index_max-doc' : response['index']['maxDoc'],
+                'index_version' : response['index']['version'],
+                'index_segmentCount' : response['index']['segmentCount'],
+                'index_last-modified' : response['index']['lastModified']
+              };
+                            
+              for( var key in data )
+              {
+                $( '.' + key, this )
+                  .show();
                                 
-                                $( '.value.' + key, this )
-                                    .html( data[key] );
-                            }
-
-                            var optimized_element = $( '.value.index_optimized', this );
-                            if( !response['index']['hasDeletions'] )
-                            {
-                                optimized_element
-                                    .addClass( 'ico-1' );
-
-                                $( 'span', optimized_element )
-                                    .html( 'yes' );
-                            }
-                            else
-                            {
-                                optimized_element
-                                    .addClass( 'ico-0' );
-
-                                $( 'span', optimized_element )
-                                    .html( 'no' );
-                            }
-
-                            var current_element = $( '.value.index_current', this );
-                            if( response['index']['current'] )
-                            {
-                                current_element
-                                    .addClass( 'ico-1' );
-
-                                $( 'span', current_element )
-                                    .html( 'yes' );
-                            }
-                            else
-                            {
-                                current_element
-                                    .addClass( 'ico-0' );
-
-                                $( 'span', current_element )
-                                    .html( 'no' );
-                            }
-
-                            $( 'a', optimized_element )
-                                .die( 'click' )
-                                .live
-                                (
-                                    'click',
-                                    function( event )
-                                    {                        
-                                        $.ajax
-                                        (
-                                            {
-                                                url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
-                                                dataType : 'json',
-                                                context : $( this ),
-                                                beforeSend : function( xhr, settings )
-                                                {
-                                                    this
-                                                        .addClass( 'loader' );
-                                                },
-                                                success : function( response, text_status, xhr )
-                                                {
-                                                    this.parents( 'dd' )
-                                                        .removeClass( 'ico-0' )
-                                                        .addClass( 'ico-1' );
-                                                },
-                                                error : function( xhr, text_status, error_thrown)
-                                                {
-                                                    console.warn( 'd0h, optimize broken!' );
-                                                },
-                                                complete : function( xhr, text_status )
-                                                {
-                                                    this
-                                                        .removeClass( 'loader' );
-                                                }
-                                            }
-                                        );
-                                    }
-                                );
+                $( '.value.' + key, this )
+                  .html( data[key] );
+              }
+
+              var optimized_element = $( '.value.index_optimized', this );
+              if( !response['index']['hasDeletions'] )
+              {
+                optimized_element
+                  .addClass( 'ico-1' );
+
+                $( 'span', optimized_element )
+                  .html( 'yes' );
+              }
+              else
+              {
+                optimized_element
+                  .addClass( 'ico-0' );
+
+                $( 'span', optimized_element )
+                  .html( 'no' );
+              }
+
+              var current_element = $( '.value.index_current', this );
+              if( response['index']['current'] )
+              {
+                current_element
+                  .addClass( 'ico-1' );
+
+                $( 'span', current_element )
+                  .html( 'yes' );
+              }
+              else
+              {
+                current_element
+                  .addClass( 'ico-0' );
+
+                $( 'span', current_element )
+                  .html( 'no' );
+              }
+
+              $( 'a', optimized_element )
+                .die( 'click' )
+                .live
+                (
+                  'click',
+                  function( event )
+                  {                        
+                    $.ajax
+                    (
+                      {
+                      url : core_basepath + '/update?optimize=true&waitFlush=true&wt=json',
+                      dataType : 'json',
+                      context : $( this ),
+                      beforeSend : function( xhr, settings )
+                      {
+                        this
+                          .addClass( 'loader' );
+                      },
+                      success : function( response, text_status, xhr )
+                      {
+                        this.parents( 'dd' )
+                          .removeClass( 'ico-0' )
+                          .addClass( 'ico-1' );
+                      },
+                      error : function( xhr, text_status, error_thrown)
+                      {
+                        console.warn( 'd0h, optimize broken!' );
+                      },
+                      complete : function( xhr, text_status )
+                      {
+                        this
+                          .removeClass( 'loader' );
+                      }
+                      }
+                    );
+                  }
+                );
 
-                            $( '.timeago', this )
+              $( '.timeago', this )
                                  .timeago();
-                        },
-                        error : function( xhr, text_status, error_thrown )
-                        {
-                            this
-                                .addClass( 'disabled' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Luke is not configured' );
-                        },
-                        complete : function( xhr, text_status )
-                        {
-                            $( 'h2', this )
-                                .removeClass( 'loader' );
-                        }
-                    }
-                );
+            },
+            error : function( xhr, text_status, error_thrown )
+            {
+              this
+                .addClass( 'disabled' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Luke is not configured' );
+            },
+            complete : function( xhr, text_status )
+            {
+              $( 'h2', this )
+                .removeClass( 'loader' );
+            }
+          }
+        );
                 
-                $.ajax
-                (
-                    {
-                        url : core_basepath + '/replication?command=details&wt=json',
-                        dataType : 'json',
-                        context : $( '#replication', dashboard_element ),
-                        beforeSend : function( xhr, settings )
-                        {
-                            $( 'h2', this )
-                                .addClass( 'loader' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Loading' );
-
-                            $( '.content', this )
-                                .hide();
-                        },
-                        success : function( response, text_status, xhr )
-                        {
-                            $( '.message', this )
-                                .empty()
-                                .hide();
-
-                            $( '.content', this )
-                                .show();
-                            
-                            $( '.replication', context.active_core )
-                                .show();
-                            
-                            var data = response.details;
-                            var is_slave = 'undefined' !== typeof( data.slave );
-                            var headline = $( 'h2 span', this );
-                            var details_element = $( '#details', this );
-                            var current_type_element = $( ( is_slave ? '.slave' : '.master' ), this );
-
-                            if( is_slave )
-                            {
-                                this
-                                    .addClass( 'slave' );
+        $.ajax
+        (
+          {
+            url : core_basepath + '/replication?command=details&wt=json',
+            dataType : 'json',
+            context : $( '#replication', dashboard_element ),
+            beforeSend : function( xhr, settings )
+            {
+              $( 'h2', this )
+                .addClass( 'loader' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Loading' );
+
+              $( '.content', this )
+                .hide();
+            },
+            success : function( response, text_status, xhr )
+            {
+              $( '.message', this )
+                .empty()
+                .hide();
+
+              $( '.content', this )
+                .show();
+                            
+              $( '.replication', context.active_core )
+                .show();
+                            
+              var data = response.details;
+              var is_slave = 'undefined' !== typeof( data.slave );
+              var headline = $( 'h2 span', this );
+              var details_element = $( '#details', this );
+              var current_type_element = $( ( is_slave ? '.slave' : '.master' ), this );
+
+              if( is_slave )
+              {
+                this
+                  .addClass( 'slave' );
                                 
-                                headline
-                                    .html( headline.html() + ' (Slave)' );
-                            }
-                            else
-                            {
-                                this
-                                    .addClass( 'master' );
+                headline
+                  .html( headline.html() + ' (Slave)' );
+              }
+              else
+              {
+                this
+                  .addClass( 'master' );
                                 
-                                headline
-                                    .html( headline.html() + ' (Master)' );
-                            }
-
-                            $( '.version div', current_type_element )
-                                .html( data.indexVersion );
-                            $( '.generation div', current_type_element )
-                                .html( data.generation );
-                            $( '.size div', current_type_element )
-                                .html( data.indexSize );
-                            
-                            if( is_slave )
-                            {
-                                var master_element = $( '.master', details_element );
-                                $( '.version div', master_element )
-                                    .html( data.slave.masterDetails.indexVersion );
-                                $( '.generation div', master_element )
-                                    .html( data.slave.masterDetails.generation );
-                                $( '.size div', master_element )
-                                    .html( data.slave.masterDetails.indexSize );
+                headline
+                  .html( headline.html() + ' (Master)' );
+              }
+
+              $( '.version div', current_type_element )
+                .html( data.indexVersion );
+              $( '.generation div', current_type_element )
+                .html( data.generation );
+              $( '.size div', current_type_element )
+                .html( data.indexSize );
+                            
+              if( is_slave )
+              {
+                var master_element = $( '.master', details_element );
+                $( '.version div', master_element )
+                  .html( data.slave.masterDetails.indexVersion );
+                $( '.generation div', master_element )
+                  .html( data.slave.masterDetails.generation );
+                $( '.size div', master_element )
+                  .html( data.slave.masterDetails.indexSize );
                                 
-                                if( data.indexVersion !== data.slave.masterDetails.indexVersion )
-                                {
-                                    $( '.version', details_element )
-                                        .addClass( 'diff' );
-                                }
-                                else
-                                {
-                                    $( '.version', details_element )
-                                        .removeClass( 'diff' );
-                                }
+                if( data.indexVersion !== data.slave.masterDetails.indexVersion )
+                {
+                  $( '.version', details_element )
+                    .addClass( 'diff' );
+                }
+                else
+                {
+                  $( '.version', details_element )
+                    .removeClass( 'diff' );
+                }
                                 
-                                if( data.generation !== data.slave.masterDetails.generation )
-                                {
-                                    $( '.generation', details_element )
-                                        .addClass( 'diff' );
-                                }
-                                else
-                                {
-                                    $( '.generation', details_element )
-                                        .removeClass( 'diff' );
-                                }
-                            }
-                        },
-                        error : function( xhr, text_status, error_thrown)
-                        {
-                            this
-                                .addClass( 'disabled' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Replication is not configured' );
-                        },
-                        complete : function( xhr, text_status )
-                        {
-                            $( 'h2', this )
-                                .removeClass( 'loader' );
-                        }
-                    }
-                );
+                if( data.generation !== data.slave.masterDetails.generation )
+                {
+                  $( '.generation', details_element )
+                    .addClass( 'diff' );
+                }
+                else
+                {
+                  $( '.generation', details_element )
+                    .removeClass( 'diff' );
+                }
+              }
+            },
+            error : function( xhr, text_status, error_thrown)
+            {
+              this
+                .addClass( 'disabled' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Replication is not configured' );
+            },
+            complete : function( xhr, text_status )
+            {
+              $( 'h2', this )
+                .removeClass( 'loader' );
+            }
+          }
+        );
 
-                $.ajax
-                (
-                    {
-                        url : core_basepath + '/dataimport?command=details&wt=json',
-                        dataType : 'json',
-                        context : $( '#dataimport', dashboard_element ),
-                        beforeSend : function( xhr, settings )
-                        {
-                            $( 'h2', this )
-                                .addClass( 'loader' );
-
-                            $( '.message', this )
-                                .show()
-                                .html( 'Loading' );
-                        },
-                        success : function( response, text_status, xhr )
-                        {
-                            $( '.message', this )
-                                .empty()
-                                .hide();
-                            
-                            $( 'dl', this )
-                                .show();
-                            
-                            var data = {
-                                'status' : response['status'],
-                                'info' : response['statusMessages']['']
-                            };
-                            
-                            for( var key in data )
-                            {
-                                $( '.' + key, this )
-                                    .show();
+        $.ajax
+        (
+          {
+            url : core_basepath + '/dataimport?command=details&wt=json',
+            dataType : 'json',
+            context : $( '#dataimport', dashboard_element ),
+            beforeSend : function( xhr, settings )
+            {
+              $( 'h2', this )
+                .addClass( 'loader' );
+
+              $( '.message', this )
+                .show()
+                .html( 'Loading' );
+            },
+            success : function( response, text_status, xhr )
+            {
+              $( '.message', this )
+                .empty()
+                .hide();
+                            
+              $( 'dl', this )
+                .show();
+                            
+              var data = {
+                'status' : response['status'],
+                'info' : response['statusMessages']['']
+              };
+                            
+              for( var key in data )
+              {
+                $( '.' + key, this )
+                  .show();
                                 
-                                $( '.value.' + key, this )
-                                    .html( data[key] );
-                            }
-                        },
-                        error : function( xhr, text_status, error_thrown)
-                        {
-                            this
-                                .addClass( 'disabled' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Dataimport is not configured' );
-                        },
-                        complete : function( xhr, text_status )
-                        {
-                            $( 'h2', this )
-                                .removeClass( 'loader' );
-                        }
-                    }
-                );
-                
-                $.ajax
-                (
-                    {
-                        url : core_basepath + '/admin/file/?file=admin-extra.html',
-                        dataType : 'html',
-                        context : $( '#admin-extra', dashboard_element ),
-                        beforeSend : function( xhr, settings )
-                        {
-                            $( 'h2', this )
-                                .addClass( 'loader' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'Loading' );
-
-                            $( '.content', this )
-                                .hide();
-                        },
-                        success : function( response, text_status, xhr )
-                        {
-                            $( '.message', this )
-                                .hide()
-                                .empty();
-
-                            $( '.content', this )
-                                .show()
-                                .html( response );
-                        },
-                        error : function( xhr, text_status, error_thrown)
-                        {
-                            this
-                                .addClass( 'disabled' );
-                            
-                            $( '.message', this )
-                                .show()
-                                .html( 'We found no "admin-extra.html" file.' );
-                        },
-                        complete : function( xhr, text_status )
-                        {
-                            $( 'h2', this )
-                                .removeClass( 'loader' );
-                        }
-                    }
-                );
+                $( '.value.' + key, this )
+                  .html( data[key] );
+              }
+            },
+            error : function( xhr, text_status, error_thrown)
+            {
+              this
+                .addClass( 'disabled' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Dataimport is not configured' );
+            },
+            complete : function( xhr, text_status )
+            {
+              $( 'h2', this )
+                .removeClass( 'loader' );
+            }
+          }
+        );
                 
+        $.ajax
+        (
+          {
+            url : core_basepath + '/admin/file/?file=admin-extra.html',
+            dataType : 'html',
+            context : $( '#admin-extra', dashboard_element ),
+            beforeSend : function( xhr, settings )
+            {
+              $( 'h2', this )
+                .addClass( 'loader' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'Loading' );
+
+              $( '.content', this )
+                .hide();
+            },
+            success : function( response, text_status, xhr )
+            {
+              $( '.message', this )
+                .hide()
+                .empty();
+
+              $( '.content', this )
+                .show()
+                .html( response );
+            },
+            error : function( xhr, text_status, error_thrown)
+            {
+              this
+                .addClass( 'disabled' );
+                            
+              $( '.message', this )
+                .show()
+                .html( 'We found no "admin-extra.html" file.' );
+            },
+            complete : function( xhr, text_status )
+            {
+              $( 'h2', this )
+                .removeClass( 'loader' );
             }
+          }
         );
-    }
+                
+      }
+    );
+  }
 );
\ No newline at end of file

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dataimport.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dataimport.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dataimport.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/dataimport.js Tue Mar 13 16:43:38 2012
@@ -1,3 +1,20 @@
+/*
+ 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.
+*/
+
 sammy.bind
 (
     'dataimport_queryhandler_load',
@@ -186,7 +203,7 @@ sammy.get
                             {
                                 var code = $(
                                     '<pre class="syntax language-xml"><code>' +
-                                    xhr.responseText.replace( /\</g, '&lt;' ).replace( /\>/g, '&gt;' ) +
+                                    xhr.responseText.esc() +
                                     '</code></pre>'
                                 );
                                 this.html( code );
@@ -415,38 +432,29 @@ sammy.get
                 // form
 
                 $( 'form', form_element )
-                    .die( 'submit' )
-                    .live
+                    .ajaxForm
                     (
-                        'submit',
-                        function( event )
                         {
-                            $.ajax
-                            (
-                                {
-                                    url : handler_url + '?command=full-import',
-                                    dataType : 'xml',
-                                    beforeSend : function( xhr, settings )
-                                    {
-                                    },
-                                    success : function( response, text_status, xhr )
-                                    {
-                                        console.debug( response );
-                                        dataimport_fetch_status();
-                                    },
-                                    error : function( xhr, text_status, error_thrown )
-                                    {
-                                        console.debug( arguments );
-                                    },
-                                    complete : function( xhr, text_status )
-                                    {
-                                    }
-                                }
-                            );
-                            return false;
+                            url : handler_url,
+                            dataType : 'xml',
+                            beforeSend : function( xhr, settings )
+                            {
+                            },
+                            success : function( response, text_status, xhr )
+                            {
+                                console.debug( response );
+                                dataimport_fetch_status();
+                            },
+                            error : function( xhr, text_status, error_thrown )
+                            {
+                                console.debug( arguments );
+                            },
+                            complete : function( xhr, text_status )
+                            {
+                            }
                         }
                     );
             }
         );
     }
-);
\ No newline at end of file
+);

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/file.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/file.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/file.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/file.js Tue Mar 13 16:43:38 2012
@@ -1,37 +1,54 @@
+/*
+ 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.
+*/
+
 // #/:core/schema, #/:core/config
 sammy.get
 (
-    /^#\/([\w\d-]+)\/(schema|config)$/,
-    function( context )
-    {
-        var core_basepath = this.active_core.attr( 'data-basepath' );
+  /^#\/([\w\d-]+)\/(schema|config)$/,
+  function( context )
+  {
+    var core_basepath = this.active_core.attr( 'data-basepath' );
 
-        $.ajax
-        (
-            {
-                url : core_basepath + app.config[ context.params.splat[1] + '_path' ],
-                dataType : 'xml',
-                context : $( '#content' ),
-                beforeSend : function( xhr, settings )
-                {
-                    this
-                        .html( '<div class="loader">Loading ...</div>' );
-                },
-                complete : function( xhr, text_status )
-                {
-                    var code = $(
-                        '<pre class="syntax language-xml"><code>' +
-                        xhr.responseText.esc() +
-                        '</code></pre>'
-                    );
-                    this.html( code );
+    $.ajax
+    (
+      {
+        url : core_basepath + app.config[ context.params.splat[1] + '_path' ],
+        dataType : 'xml',
+        context : $( '#content' ),
+        beforeSend : function( xhr, settings )
+        {
+          this
+          .html( '<div class="loader">Loading ...</div>' );
+        },
+        complete : function( xhr, text_status )
+        {
+          var code = $(
+            '<pre class="syntax language-xml"><code>' +
+            xhr.responseText.esc() +
+            '</code></pre>'
+          );
+          this.html( code );
 
-                    if( 'success' === text_status )
-                    {
-                        hljs.highlightBlock( code.get(0) );
-                    }
-                }
-            }
-        );
-    }
+          if( 'success' === text_status )
+          {
+            hljs.highlightBlock( code.get(0) );
+          }
+        }
+      }
+    );
+  }
 );
\ No newline at end of file

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/index.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/index.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/index.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/index.js Tue Mar 13 16:43:38 2012
@@ -1,184 +1,344 @@
-// #/
-sammy.get
-(
-    /^#\/$/,
-    function( context )
-    {
-        var content_element = $( '#content' );
+/*
+ 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.
+*/
+
+var parse_memory_value = function( value )
+{
+  if( value !== Number( value ) )
+  {
+    var units = 'BKMGTPEZY';
+    var match = value.match( /^(\d+([,\.]\d+)?) (\w)\w?$/ );
+    var value = parseFloat( match[1] ) * Math.pow( 1024, units.indexOf( match[3].toUpperCase() ) );
+  }
+    
+  return value;
+};
 
-        $( '#index', app.menu_element )
-            .addClass( 'active' );
+var generate_bar = function( bar_container, bar_data, convert_label_values )
+{
+  bar_holder = $( '.bar-holder', bar_container );
+
+  var bar_level = 1;
+  var max_width = Math.round( $( '.bar-max', bar_holder ).width() );
+  $( '.bar-max.val', bar_holder ).text( bar_data['max'] );
+    
+  bar_level++;
+  var total_width = Math.round( ( bar_data['total'] * max_width ) / bar_data['max'] );
+  $( '.bar-total.bar', bar_holder ).width( Math.max( total_width, 1 ) );
+  $( '.bar-total.val', bar_holder ).text( bar_data['total'] );
+
+  if( bar_data['used'] )
+  {
+    bar_level++;
+    var used_width = Math.round( ( bar_data['used'] * max_width ) / bar_data['max'] );
+    $( '.bar-used.bar', bar_holder ).width( Math.min( used_width, total_width - 1 ) );
+    $( '.bar-used.val', bar_holder ).text( bar_data['used'] );
+  }
+
+  bar_holder
+    .addClass( 'bar-lvl-' + bar_level );
+
+  var percentage = ( ( ( bar_data['used'] || bar_data['total'] ) / bar_data['max'] ) * 100 ).toFixed(1);
+        
+  var hl = $( '[data-desc="' + bar_container.attr( 'id' ) + '"]' );
+
+  $( '.bar-desc', hl )
+    .remove();
+
+  hl
+    .append( ' <small class="bar-desc">' + percentage + '%</small>' );
+
+  if( !!convert_label_values )
+  {
+    $( '.val', bar_holder )
+      .each
+      (
+        function()
+        {
+          var self = $( this );
+
+          var unit = null;
+          var byte_value = parseInt( self.html() );
+
+          self
+            .attr( 'title', 'raw: ' + byte_value + ' B' );
+
+          byte_value /= 1024;
+          byte_value /= 1024;
+          unit = 'MB';
+
+          if( 1024 <= byte_value )
+          {
+            byte_value /= 1024;
+            unit = 'GB';
+          }
+
+          byte_value = byte_value.toFixed( 2 ) + ' ' + unit;
+
+          self
+            .text( byte_value );
+        }
+      );
+  }
+};
+
+var system_info = function( element, system_data )
+{
+  // -- usage
+
+  var load_average = system_data['system']['uptime'].match( /load average: (.+)/ );
+  if( load_average && load_average[1] )
+  {
+    var hl = $( '#system h2', element );
+
+    $( '.bar-desc', hl )
+      .remove();
+
+    hl
+      .append( ' <small class="bar-desc">' + load_average[1].split( ', ' ).join( '  ' ).esc() + '</small>' );
+  }
 
-        content_element
-            .html( '<div id="index"></div>' );
+  // -- physical-memory-bar
+    
+  var bar_holder = $( '#physical-memory-bar', element );
+  if( !system_data['system']['totalPhysicalMemorySize'] )
+  {
+    bar_holder.hide();
+  }
+  else
+  {
+    bar_holder.show();
+    
+    var bar_data = {
+      'max' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] ),
+      'total' : parse_memory_value( system_data['system']['totalPhysicalMemorySize'] - system_data['system']['freePhysicalMemorySize'] )
+    };
 
-        $.ajax
-        (
-            {
-                url : 'tpl/index.html',
-                context : $( '#index', content_element ),
-                beforeSend : function( arr, form, options )
-                {
-                },
-                success : function( template )
-                {
-                    this
-                        .html( template );
-
-                    var jvm_memory = $.extend
-                    (
-                        {
-                            'free' : null,
-                            'total' : null,
-                            'max' : null,
-                            'used' : null,
-                            'raw' : {
-                                'free' : null,
-                                'total' : null,
-                                'max' : null,
-                                'used' : null,
-                                'used%' : null
-                            }
-                        },
-                        app.dashboard_values['jvm']['memory']
-                    );
+    generate_bar( bar_holder, bar_data, true );
+  }
 
-                    var parse_memory_value = function( value )
-                    {
-                        if( value !== Number( value ) )
-                        {
-                            var units = 'BKMGTPEZY';
-                            var match = value.match( /^(\d+([,\.]\d+)?) (\w)\w?$/ );
-                            var value = parseFloat( match[1] ) * Math.pow( 1024, units.indexOf( match[3].toUpperCase() ) );
-                        }
-                        
-                        return value;
-                    };
-                    var memory_data = {
-                        'memory-bar-max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
-                        'memory-bar-total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
-                        'memory-bar-used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
-                    };                            
-    
-                    for( var key in memory_data )
-                    {                                                        
-                        $( '.value.' + key, this )
-                            .text( memory_data[key] );
-                    }
+  // -- swap-space-bar
     
-                    var data = {
-                        'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
-                        'host' : app.dashboard_values['core']['host'],
-                        'jvm' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
-                        'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'],
-                        'solr_impl_version' : app.dashboard_values['lucene']['solr-impl-version'],
-                        'lucene_spec_version' : app.dashboard_values['lucene']['lucene-spec-version'],
-                        'lucene_impl_version' : app.dashboard_values['lucene']['lucene-impl-version']
-                    };
+  var bar_holder = $( '#swap-space-bar', element );
+  if( !system_data['system']['totalSwapSpaceSize'] )
+  {
+    bar_holder.hide();
+  }
+  else
+  {
+    bar_holder.show();
+
+    var bar_data = {
+      'max' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] ),
+      'total' : parse_memory_value( system_data['system']['totalSwapSpaceSize'] - system_data['system']['freeSwapSpaceSize'] )
+    };
 
-                    if( app.dashboard_values['core']['directory']['cwd'] )
-                    {
-                        data['cwd'] = app.dashboard_values['core']['directory']['cwd'];
-                    }
+    generate_bar( bar_holder, bar_data, true );
+  }
+
+  // -- swap-space-bar
     
-                    for( var key in data )
-                    {                                                        
-                        var value_element = $( '.' + key + ' dd', this );
+  var bar_holder = $( '#file-descriptor-bar', element );
+  if( !system_data['system']['maxFileDescriptorCount'] )
+  {
+    bar_holder.hide();
+  }
+  else
+  {
+    bar_holder.show();
+
+    var bar_data = {
+      'max' : parse_memory_value( system_data['system']['maxFileDescriptorCount'] ),
+      'total' : parse_memory_value( system_data['system']['openFileDescriptorCount'] )
+    };
+
+    generate_bar( bar_holder, bar_data );
+  }
+
+  0 === $( '#system div[id$="-bar"]:visible', element ).size()
+    ? $( '#system .no-info', element ).show()
+    : $( '#system .no-info', element ).hide();
 
-                        value_element
-                            .text( data[key] );
-                        
-                        value_element.closest( 'li' )
-                            .show();
-                    }
+  // -- memory-bar
 
-                    var commandLineArgs = app.dashboard_values['jvm']['jmx']['commandLineArgs'];
-                    if( 0 !== commandLineArgs.length )
-                    {
-                        var cmd_arg_element = $( '.command_line_args dt', this );
-                        var cmd_arg_key_element = $( '.command_line_args dt', this );
-                        var cmd_arg_element = $( '.command_line_args dd', this );
-
-                        for( var key in commandLineArgs )
-                        {
-                            cmd_arg_element = cmd_arg_element.clone();
-                            cmd_arg_element.text( commandLineArgs[key] );
-
-                            cmd_arg_key_element
-                                .after( cmd_arg_element );
-                        }
+  var jvm_memory = $.extend
+  (
+    {
+      'free' : null,
+      'total' : null,
+      'max' : null,
+      'used' : null,
+      'raw' : {
+        'free' : null,
+        'total' : null,
+        'max' : null,
+        'used' : null,
+        'used%' : null
+      }
+    },
+    system_data['jvm']['memory']
+  );
+    
+  var bar_holder = $( '#jvm-memory-bar', element );
+  var bar_data = {
+    'max' : parse_memory_value( jvm_memory['raw']['max'] || jvm_memory['max'] ),
+    'total' : parse_memory_value( jvm_memory['raw']['total'] || jvm_memory['total'] ),
+    'used' : parse_memory_value( jvm_memory['raw']['used'] || jvm_memory['used'] )
+  };
 
-                        cmd_arg_key_element.closest( 'li' )
-                            .show();
+  generate_bar( bar_holder, bar_data, true );
+}
 
-                        $( '.command_line_args dd:last', this )
-                            .remove();
+// #/
+sammy.get
+(
+  /^#\/$/,
+  function( context )
+  {
+    var content_element = $( '#content' );
+
+    $( '#index', app.menu_element )
+      .addClass( 'active' );
+
+    content_element
+      .html( '<div id="index"></div>' );
+
+    $.ajax
+    (
+      {
+        url : 'tpl/index.html',
+        context : $( '#index', content_element ),
+        beforeSend : function( arr, form, options )
+        {
+        },
+        success : function( template )
+        {
+          var self = this;
 
-                        $( '.command_line_args dd:odd', this )
-                            .addClass( 'odd' );
-                    }
+          this
+            .html( template );
+    
+          var data = {
+            'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
+            'host' : app.dashboard_values['core']['host'],
+            'dir_instance' : app.dashboard_values['core']['directory']['instance'],
+            'dir_data' : app.dashboard_values['core']['directory']['data'],
+            'dir_index' : app.dashboard_values['core']['directory']['index'],
+            'jvm_version' : app.dashboard_values['jvm']['name'] + ' (' + app.dashboard_values['jvm']['version'] + ')',
+            'processors' : app.dashboard_values['jvm']['processors'],
+            'solr_spec_version' : app.dashboard_values['lucene']['solr-spec-version'],
+            'solr_impl_version' : app.dashboard_values['lucene']['solr-impl-version'],
+            'lucene_spec_version' : app.dashboard_values['lucene']['lucene-spec-version'],
+            'lucene_impl_version' : app.dashboard_values['lucene']['lucene-impl-version']
+          };
+
+          if( app.dashboard_values['core']['directory']['cwd'] )
+          {
+            data['dir_cwd'] = app.dashboard_values['core']['directory']['cwd'];
+          }
+    
+          for( var key in data )
+          {                                                        
+            var value_element = $( '.' + key + ' dd', this );
 
-                    $( '.timeago', this )
-                        .timeago();
+            value_element
+              .text( data[key].esc() );
+                        
+            value_element.closest( 'li' )
+              .show();
+          }
+
+          var commandLineArgs = app.dashboard_values['jvm']['jmx']['commandLineArgs'];
+          if( 0 !== commandLineArgs.length )
+          {
+            var cmd_arg_element = $( '.command_line_args dt', this );
+            var cmd_arg_key_element = $( '.command_line_args dt', this );
+            var cmd_arg_element = $( '.command_line_args dd', this );
 
-                    $( 'li:visible:odd', this )
-                        .addClass( 'odd' );
-                    
-                    // -- memory bar
+            for( var key in commandLineArgs )
+            {
+              cmd_arg_element = cmd_arg_element.clone();
+              cmd_arg_element.text( commandLineArgs[key] );
+
+              cmd_arg_key_element
+                .after( cmd_arg_element );
+            }
+
+            cmd_arg_key_element.closest( 'li' )
+              .show();
+
+            $( '.command_line_args dd:last', this )
+              .remove();
 
-                    var max_height = Math.round( $( '#memory-bar-max', this ).height() );
-                    var total_height = Math.round( ( memory_data['memory-bar-total'] * max_height ) / memory_data['memory-bar-max'] );
-                    var used_height = Math.round( ( memory_data['memory-bar-used'] * max_height ) / memory_data['memory-bar-max'] );
+            $( '.command_line_args dd:odd', this )
+              .addClass( 'odd' );
+          }
 
-                    var memory_bar_total_value = $( '#memory-bar-total span', this ).first();
+          $( '.timeago', this )
+            .timeago();
 
-                    $( '#memory-bar-total', this )
-                        .height( total_height );
+          $( '.index-left .block li:visible:odd', this )
+            .addClass( 'odd' );
                     
-                    $( '#memory-bar-used', this )
-                        .height( used_height );
+          // -- system_info
 
-                    if( used_height < total_height + memory_bar_total_value.height() )
+          system_info( this, app.dashboard_values );
+
+          $( '#system a.reload', this )
+            .die( 'click' )
+            .live
+            (
+              'click',
+              function( event )
+              {
+                $.ajax
+                (
+                  {
+                    url : environment_basepath + '/admin/system?wt=json',
+                    dataType : 'json',
+                    context : this,
+                    beforeSend : function( arr, form, options )
+                    {
+                      loader.show( this );
+                    },
+                    success : function( response )
                     {
-                        memory_bar_total_value
-                            .addClass( 'upper' )
-                            .css( 'margin-top', memory_bar_total_value.height() * -1 );
+                      system_info( self, response );
+                    },
+                    error : function()
+                    {
+                    },
+                    complete : function()
+                    {
+                      loader.hide( this );
                     }
+                  }
+                );
 
-                    var memory_percentage = ( ( memory_data['memory-bar-used'] / memory_data['memory-bar-max'] ) * 100 ).toFixed(1);
-                    var headline = $( '#memory h2 span', this );
-                        
-                    headline
-                        .text( headline.html() + ' (' + memory_percentage + '%)' );
-
-                    $( '#memory-bar .value', this )
-                        .each
-                        (
-                            function()
-                            {
-                                var self = $( this );
-
-                                var byte_value = parseInt( self.html() );
-
-                                self
-                                    .attr( 'title', 'raw: ' + byte_value + ' B' );
-
-                                byte_value /= 1024;
-                                byte_value /= 1024;
-                                byte_value = byte_value.toFixed( 2 ) + ' MB';
-
-                                self
-                                    .text( byte_value );
-                            }
-                        );
-                },
-                error : function( xhr, text_status, error_thrown )
-                {
-                },
-                complete : function( xhr, text_status )
-                {
-                }
-            }
-        );
-    }
+                return false;
+              }
+            );
+        },
+        error : function( xhr, text_status, error_thrown )
+        {
+        },
+        complete : function( xhr, text_status )
+        {
+        }
+      }
+    );
+  }
 );
\ No newline at end of file

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/java-properties.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/java-properties.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/java-properties.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/java-properties.js Tue Mar 13 16:43:38 2012
@@ -1,84 +1,101 @@
+/*
+ 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.
+*/
+
 // #/java-properties
 sammy.get
 (
-    /^#\/(java-properties)$/,
-    function( context )
-    {
-        var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
-        var content_element = $( '#content' );
+  /^#\/(java-properties)$/,
+  function( context )
+  {
+    var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+    var content_element = $( '#content' );
+
+    content_element
+      .html( '<div id="java-properties"></div>' );
+
+    $.ajax
+    (
+      {
+        url : core_basepath + '/admin/properties?wt=json',
+        dataType : 'json',
+        context : $( '#java-properties', content_element ),
+        beforeSend : function( xhr, settings )
+        {
+          this
+            .html( '<div class="loader">Loading ...</div>' );
+        },
+        success : function( response, text_status, xhr )
+        {
+          var system_properties = response['system.properties'];
+          var properties_data = {};
+          var properties_content = [];
+          var properties_order = [];
+
+          for( var key in system_properties )
+          {
+            var displayed_key = key.replace( /\./g, '.&#8203;' );
+            var displayed_value = [ system_properties[key] ];
+            var item_class = 'clearfix';
+
+            if( -1 !== key.indexOf( '.path' ) || -1 !== key.indexOf( '.dirs' ) )
+            {
+              displayed_value = system_properties[key].split( system_properties['path.separator'] );
+              if( 1 < displayed_value.length )
+              {
+                item_class += ' multi';
+              }
+            }
 
-        content_element
-            .html( '<div id="java-properties"></div>' );
+            var item_content = '<li><dl class="' + item_class + '">' + "\n"
+                             + '<dt>' + displayed_key.esc() + '</dt>' + "\n";
 
-        $.ajax
-        (
+            for( var i in displayed_value )
             {
-                url : core_basepath + '/admin/properties?wt=json',
-                dataType : 'json',
-                context : $( '#java-properties', content_element ),
-                beforeSend : function( xhr, settings )
-                {
-                    this
-                        .html( '<div class="loader">Loading ...</div>' );
-                },
-                success : function( response, text_status, xhr )
-                {
-                    var system_properties = response['system.properties'];
-                    var properties_data = {};
-                    var properties_content = [];
-                    var properties_order = [];
-
-                    for( var key in system_properties )
-                    {
-                        var displayed_key = key.replace( /\./g, '.&#8203;' );
-                        var displayed_value = [ system_properties[key] ];
-                        var item_class = 'clearfix';
-
-                        if( -1 !== key.indexOf( '.path' ) || -1 !== key.indexOf( '.dirs' ) )
-                        {
-                            displayed_value = system_properties[key].split( system_properties['path.separator'] );
-                            if( 1 < displayed_value.length )
-                            {
-                                item_class += ' multi';
-                            }
-                        }
-
-                        var item_content = '<li><dl class="' + item_class + '">' + "\n" +
-                                           '<dt>' + displayed_key.esc() + '</dt>' + "\n";
-
-                        for( var i in displayed_value )
-                        {
-                            item_content += '<dd>' + displayed_value[i].esc() + '</dd>' + "\n";
-                        }
-
-                        item_content += '</dl></li>';
-
-                        properties_data[key] = item_content;
-                        properties_order.push( key );
-                    }
-
-                    properties_order.sort();
-                    for( var i in properties_order )
-                    {
-                        properties_content.push( properties_data[properties_order[i]] );
-                    }
+              item_content += '<dd>' + displayed_value[i].esc() + '</dd>' + "\n";
+            }
+
+            item_content += '</dl></li>';
 
-                    this
-                        .html( '<ul>' + properties_content.join( "\n" ) + '</ul>' );
+            properties_data[key] = item_content;
+            properties_order.push( key );
+          }
+
+          properties_order.sort();
+          for( var i in properties_order )
+          {
+            properties_content.push( properties_data[properties_order[i]] );
+          }
+
+          this
+            .html( '<ul>' + properties_content.join( "\n" ) + '</ul>' );
                     
-                    $( 'li:odd', this )
-                        .addClass( 'odd' );
+          $( 'li:odd', this )
+            .addClass( 'odd' );
                     
-                    $( '.multi dd:odd', this )
-                        .addClass( 'odd' );
-                },
-                error : function( xhr, text_status, error_thrown)
-                {
-                },
-                complete : function( xhr, text_status )
-                {
-                }
-            }
-        );
-    }
+          $( '.multi dd:odd', this )
+            .addClass( 'odd' );
+        },
+        error : function( xhr, text_status, error_thrown)
+        {
+        },
+        complete : function( xhr, text_status )
+        {
+        }
+      }
+    );
+  }
 );
\ No newline at end of file

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/logging.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/logging.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/logging.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/logging.js Tue Mar 13 16:43:38 2012
@@ -1,166 +1,236 @@
-// #/logging
-sammy.get
-(
-    /^#\/(logging)$/,
-    function( context )
+/*
+ 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.
+*/
+
+var loglevel_path = null;
+var logging_handler = function( response, text_status, xhr )
+{
+  var self = this;
+  var loggers = response.loggers;
+
+  var levels = '<div class="selector-holder"><div class="selector">' + "\n"
+             + '<a class="trigger"><span><em>null</em></span></a>' + "\n"
+             + '<ul>' + "\n";
+
+  for( var key in response.levels )
+  {
+    var level = response.levels[key].esc();
+    levels += '<li><a href="#" data-level="' + level + '">' + level + '</a></li>' + "\n";
+  }
+
+  levels += '<li class="unset"><a href="#" data-level="unset">UNSET</a></li>' + "\n"
+         + '</ul>' + "\n"
+         + '<a class="close"><span>[x]</span></a>' + "\n"
+         + '</div></div>';
+
+  var logger_tree = function( filter )
+  {
+    var logger_content = '';
+    var filter_regex = new RegExp( '^' + filter + '\\.\\w+$' );
+
+    for( var i in loggers )
     {
-        var content_element = $( '#content' );
-        
-        content_element
-            .html( '<div id="logging"></div>' );
+      var logger = loggers[i];
+      var continue_matcher = false;
+
+      if( !filter )
+      {
+        continue_matcher = logger.name.indexOf( '.' ) !== -1;
+      }
+      else
+      {
+        continue_matcher = !logger.name.match( filter_regex );
+      }
+
+      if( continue_matcher )
+      {
+        continue;
+      }
+
+      var logger_class = '';
+
+      if( logger.set )
+      {
+        logger_class = 'set';
+      }
+            
+      if( !logger.level )
+      {
+        logger_class = 'null';
+      }
+
+      var logger_name = logger.name.split( '.' );
+      var display_name = logger_name.pop();
+
+      logger_content += '<li class="jstree-leaf" data-logger="' + logger.name.esc() + '">';
+      logger_content += '<ins class="trigger jstree-icon">&nbsp;</ins>' + "\n";
+      logger_content += '<a href="#" class="trigger '+ logger_class + '"' ;
+
+      if( logger.level )
+      {
+        logger_content += 'rel="' + logger.level.esc() + '" ';
+      }
+            
+      logger_content += 'title="' + logger.name.esc() + '">' + "\n";
+
+      if( 0 !== logger_name.length )
+      {
+        logger_content += '<span class="ns">' + logger_name.join( '.' ).esc() + '.</span>';
+      }
+
+      logger_content += '<span class="name">' + display_name.esc() + '</span>' + "\n";
+      logger_content += '</a>';
+
+      logger_content += levels;
+
+      var child_logger_content = logger_tree( logger.name );
+      if( child_logger_content )
+      {
+        logger_content += '<ul>';
+        logger_content += child_logger_content;
+        logger_content += '</ul>';
+      }
+
+      logger_content += '</li>';
+    }
+
+    return logger_content;
+  };
+
+  var logger_content = logger_tree( null );
+
+  self
+    .html( '<ul class="tree jstree">' + logger_content + '</ul>' );
+
+  $( 'li:last-child', this )
+    .addClass( 'jstree-last' );
+
+  $( 'li.jstree-leaf > a', this )
+    .each
+    (
+      function( index, element )
+      {
+        element = $( element );
+        var level = element.attr( 'rel' );
+
+        if( level )
+        {
+          var selector = $( '.selector-holder', element.closest( 'li' ) );
+
+          $( 'a.trigger', selector )
+            .text( level.esc() );
+
+          $( 'ul a[data-level="' + level + '"]', selector ).first()
+            .addClass( 'level' );
+        }
+      }
+    )
+
+  $( '.trigger, .selector .close', this )
+    .die( 'click' )
+    .live
+    (
+      'click',
+      function( event )
+      {
+        $( '.selector-holder', $( this ).parents( 'li' ).first() ).first()
+          .trigger( 'toggle' );
+
+        return false;
+      }
+    );
+    
+  $( '.selector-holder', this )
+    .die( 'toggle')
+    .live
+    (
+      'toggle',
+      function( event )
+      {
+        var row = $( this ).closest( 'li' );
+
+        $( 'a:first', row )
+          .toggleClass( 'open' );
+
+        $( '.selector-holder:first', row )
+          .toggleClass( 'open' );
+      }
+    );
+
+  $( '.selector ul a', this )
+    .die( 'click' )
+    .live
+    (
+      'click',
+      function( event )
+      {
+        var element = $( this );
 
         $.ajax
         (
+          {
+            url : loglevel_path,
+            dataType : 'json',
+            data : {
+              'wt' : 'json',
+              'set' : $( this ).parents( 'li[data-logger]' ).data( 'logger' ) + ':' + element.data( 'level' )
+            },
+            type : 'POST',
+            context : self,
+            beforeSend : function( xhr, settings )
             {
-                url : 'logging.json',
-                dataType : 'json',
-                context : $( '#logging', content_element ),
-                beforeSend : function( xhr, settings )
-                {
-                    this
-                        .html( '<div class="loader">Loading ...</div>' );
-                },
-                success : function( response, text_status, xhr )
-                {
-                    var logger = response.logger;
-
-                    var loglevel = '<div class="loglevel %class%">' + "\n";
-                    loglevel += '<a class="effective_level trigger"><span>%effective_level%</span></a>' + "\n";
-                    loglevel += '<ul>' + "\n";
-
-                    for( var key in response.levels )
-                    {
-                        var level = response.levels[key].esc();
-                        loglevel += '<li class="' + level + '"><a>' + level + '</a></li>' + "\n";
-                    }
-
-                    loglevel += '<li class="UNSET"><a>UNSET</a></li>' + "\n";
-                    loglevel += '</ul>' + "\n";
-                    loglevel += '</div>';
-
-                    var logger_tree = function( filter )
-                    {
-                        var logger_content = '';
-                        var filter_regex = new RegExp( '^' + filter + '\\.\\w+$' );
-
-                        for( var logger_name in logger )
-                        {
-                            var continue_matcher = false;
-
-                            if( !filter )
-                            {
-                                continue_matcher = logger_name.indexOf( '.' ) !== -1;
-                            }
-                            else
-                            {
-                                continue_matcher = !logger_name.match( filter_regex );
-                            }
-
-                            if( continue_matcher )
-                            {
-                                continue;
-                            }
-
-                            var has_logger_instance = !!logger[logger_name];
-
-                            var classes = [];
-
-                            has_logger_instance
-                                ? classes.push( 'active' )
-                                : classes.push( 'inactive' );
-
-                            logger_content += '<li class="jstree-leaf">';
-                            logger_content += '<ins class="jstree-icon">&nbsp;</ins>';
-                            logger_content += '<a class="trigger ' + classes.join( ' ' ) + '" ' + "\n" +
-                                                 'title="' + logger_name.esc() + '"><span>' + "\n" +
-                                                logger_name.split( '.' ).pop().esc() + "\n" +
-                                              '</span></a>';
-
-                            logger_content += loglevel
-                                                .replace
-                                                (
-                                                    /%class%/g,
-                                                    classes.join( ' ' )
-                                                )
-                                                .replace
-                                                (
-                                                    /%effective_level%/g,
-                                                    has_logger_instance
-                                                        ? logger[logger_name].effective_level
-                                                        : 'null'
-                                                );
-
-                            var child_logger_content = logger_tree( logger_name );
-                            if( child_logger_content )
-                            {
-                                logger_content += '<ul>';
-                                logger_content += child_logger_content;
-                                logger_content += '</ul>';
-                            }
-
-                            logger_content += '</li>';
-                        }
-
-                        return logger_content;
-                    }
-
-                    var logger_content = logger_tree( null );
-                    
-                    var warn = '<div>TODO, this is not yet implemented.  For now, use <a href="logging" style="color:00AA00;">the old logging UI</a></div><br/>'
-
-
-                    this.html( warn + '<ul class="tree jstree">' + logger_content + '</ul>' );
-
-                    $( 'li:last-child', this )
-                        .addClass( 'jstree-last' );
-                    
-                    $( '.loglevel', this )
-                        .each
-                        (
-                            function( index, element )
-                            {
-                                var element = $( element );
-                                var effective_level = $( '.effective_level span', element ).text();
-
-                                element
-                                    .css( 'z-index', 800 - index );
-                                
-                                $( 'ul .' + effective_level, element )
-                                    .addClass( 'selected' );
-                            }
-                        );
-
-                    $( '.trigger', this )
-                        .die( 'click' )
-                        .live
-                        (
-                            'click',
-                            function( event )
-                            {
-                                $( '.loglevel', $( this ).parents( 'li' ).first() ).first()
-                                    .trigger( 'toggle' );
-                            }
-                        );
-                    
-                    $( '.loglevel', this )
-                        .die( 'toggle')
-                        .live
-                        (
-                            'toggle',
-                            function( event )
-                            {
-                                $( this )
-                                    .toggleClass( 'open' );
-                            }
-                        );
-                },
-                error : function( xhr, text_status, error_thrown)
-                {
-                },
-                complete : function( xhr, text_status )
-                {
-                }
-            }
+              element
+                .addClass( 'loader' );
+            },
+            success : logging_handler
+          }
         );
-    }
+
+        return false;
+      }
+    );
+
+};
+
+// #/logging
+sammy.get
+(
+  /^#\/(logging)$/,
+  function( context )
+  {
+    var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
+    loglevel_path = core_basepath + '/admin/loglevel';
+    var content_element = $( '#content' );
+        
+    content_element
+      .html( '<div id="logging"></div>' );
+
+    $.ajax
+    (
+      {
+        url : loglevel_path + '?wt=json',
+        dataType : 'json',
+        context : $( '#logging', content_element ),
+        beforeSend : function( xhr, settings )
+        {
+          this
+            .html( '<div class="loader">Loading ...</div>' );
+        },
+        success : logging_handler
+      }
+    );
+  }
 );
\ No newline at end of file

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/ping.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/ping.js?rev=1300232&r1=1300231&r2=1300232&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/ping.js (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/solr/webapp/web/js/scripts/ping.js Tue Mar 13 16:43:38 2012
@@ -1,58 +1,72 @@
+/*
+ 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.
+*/
+
 $( '.ping a', app.menu_element )
-    .live
-    (
-        'click',
-        function( event )
+  .live
+  (
+    'click',
+    function( event )
+    {
+      $.ajax
+      (
         {
-            $.ajax
-            (
-                {
-                    url : $( this ).attr( 'rel' ) + '?wt=json&ts=' + (new Date).getTime(),
-                    dataType : 'json',
-                    context: this,
-                    beforeSend : function( arr, form, options )
-                    {
-                        loader.show( this );
-                    },
-                    success : function( response, text_status, xhr )
-                    {
-                        $( this )
-                            .removeAttr( 'title' );
+          url : $( this ).attr( 'rel' ) + '?wt=json&ts=' + (new Date).getTime(),
+          dataType : 'json',
+          context: this,
+          beforeSend : function( arr, form, options )
+          {
+            loader.show( this );
+          },
+          success : function( response, text_status, xhr )
+          {
+            $( this )
+              .removeAttr( 'title' );
                         
-                        $( this ).parents( 'li' )
-                            .removeClass( 'error' );
+            $( this ).parents( 'li' )
+              .removeClass( 'error' );
                             
-                        var qtime_element = $( '.qtime', this );
+            var qtime_element = $( '.qtime', this );
                         
-                        if( 0 === qtime_element.size() )
-                        {
-                            qtime_element = $( '<small class="qtime"> (<span></span>)</small>' );
+            if( 0 === qtime_element.size() )
+            {
+              qtime_element = $( '<small class="qtime"> (<span></span>)</small>' );
                             
-                            $( this )
-                                .append
-                                (
-                                    qtime_element
-                                );
-                        }
+              $( this )
+                .append( qtime_element );
+            }
                         
-                        $( 'span', qtime_element )
-                            .html( response.responseHeader.QTime + 'ms' );
-                    },
-                    error : function( xhr, text_status, error_thrown )
-                    {
-                        $( this )
-                            .attr( 'title', '/admin/ping is not configured (' + xhr.status + ': ' + error_thrown + ')' );
+            $( 'span', qtime_element )
+              .html( response.responseHeader.QTime + 'ms' );
+          },
+          error : function( xhr, text_status, error_thrown )
+          {
+            $( this )
+              .attr( 'title', '/admin/ping is not configured (' + xhr.status + ': ' + error_thrown + ')' );
                         
-                        $( this ).parents( 'li' )
-                            .addClass( 'error' );
-                    },
-                    complete : function( xhr, text_status )
-                    {
-                        loader.hide( this );
-                    }
-                }
-            );
-            
-            return false;
+            $( this ).parents( 'li' )
+              .addClass( 'error' );
+          },
+          complete : function( xhr, text_status )
+          {
+            loader.hide( this );
+          }
         }
-    );
\ No newline at end of file
+      );
+            
+      return false;
+    }
+  );
\ No newline at end of file