/* 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 loader = { show : function( element ) { $( element ) .addClass( 'loader' ); }, hide : function( element ) { $( element ) .removeClass( 'loader' ); } }; Number.prototype.esc = function() { return new String( this ).esc(); } String.prototype.esc = function() { return this.replace( //g, '>' ); } SolrDate = function( date ) { // ["Sat Mar 03 11:00:00 CET 2012", "Sat", "Mar", "03", "11:00:00", "CET", "2012"] var parts = date.match( /^(\w+)\s+(\w+)\s+(\d+)\s+(\d+\:\d+\:\d+)\s+(\w+)\s+(\d+)$/ ); // "Sat Mar 03 2012 10:37:33" return new Date( parts[1] + ' ' + parts[2] + ' ' + parts[3] + ' ' + parts[6] + ' ' + parts[4] ); } var sammy = $.sammy ( function() { this.bind ( 'run', function( event, config ) { if( 0 === config.start_url.length ) { location.href = '#/'; return false; } } ); this.bind ( 'error', function( message, original_error ) { alert( original_error.message ); } ); // activate_core this.before ( {}, function( context ) { var menu_wrapper = $( '#menu-wrapper' ); $( 'li[id].active', menu_wrapper ) .removeClass( 'active' ); $( 'li.active', menu_wrapper ) .removeClass( 'active' ); if( this.params.splat ) { var active_element = $( '#' + this.params.splat[0], menu_wrapper ); if( 0 === active_element.size() ) { this.app.error( 'There exists no core with name "' + this.params.splat[0] + '"' ); return false; } active_element .addClass( 'active' ); if( this.params.splat[1] ) { $( '.' + this.params.splat[1], active_element ) .addClass( 'active' ); } if( !active_element.hasClass( 'global' ) ) { this.active_core = active_element; } } } ); } ); var solr_admin = function( app_config ) { self = this, menu_element = null, is_multicore = null, cores_data = null, active_core = null, environment_basepath = null, config = app_config, params = null, dashboard_values = null, schema_browser_data = null, plugin_data = null, this.menu_element = $( '#menu-selector' ); this.config = config; this.run = function() { $.ajax ( { url : config.solr_path + config.core_admin_path + '?wt=json', dataType : 'json', beforeSend : function( arr, form, options ) { $( '#content' ) .html( '
' +
''.esc() + "\n" +
' '.esc() +
'