2012-03-07 11:30:20 -05:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2012-03-21 05:36:59 -04:00
|
|
|
// #/~java-properties
|
2012-02-23 14:23:10 -05:00
|
|
|
sammy.get
|
|
|
|
(
|
2012-05-07 15:39:22 -04:00
|
|
|
/^#\/(~java-properties)$/,
|
2012-03-07 11:30:20 -05:00
|
|
|
function( context )
|
|
|
|
{
|
|
|
|
var core_basepath = $( 'li[data-basepath]', app.menu_element ).attr( 'data-basepath' );
|
|
|
|
var content_element = $( '#content' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
content_element
|
|
|
|
.html( '<div id="java-properties"></div>' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$.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 = [];
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-21 05:36:59 -04:00
|
|
|
var workaround = xhr.responseText.match( /"(line\.separator)"\s*:\s*"(.+?)"/ );
|
|
|
|
if( workaround && workaround[2] )
|
|
|
|
{
|
|
|
|
system_properties[workaround[1]] = workaround[2];
|
|
|
|
}
|
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
for( var key in system_properties )
|
|
|
|
{
|
|
|
|
var displayed_key = key.replace( /\./g, '.​' );
|
|
|
|
var displayed_value = [ system_properties[key] ];
|
|
|
|
var item_class = 'clearfix';
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
var item_content = '<li><dl class="' + item_class + '">' + "\n"
|
|
|
|
+ '<dt>' + displayed_key.esc() + '</dt>' + "\n";
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
for( var i in displayed_value )
|
|
|
|
{
|
|
|
|
item_content += '<dd>' + displayed_value[i].esc() + '</dd>' + "\n";
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
item_content += '</dl></li>';
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
properties_data[key] = item_content;
|
|
|
|
properties_order.push( key );
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
properties_order.sort();
|
|
|
|
for( var i in properties_order )
|
|
|
|
{
|
|
|
|
properties_content.push( properties_data[properties_order[i]] );
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
this
|
|
|
|
.html( '<ul>' + properties_content.join( "\n" ) + '</ul>' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( 'li:odd', this )
|
|
|
|
.addClass( 'odd' );
|
2012-02-23 14:23:10 -05:00
|
|
|
|
2012-03-07 11:30:20 -05:00
|
|
|
$( '.multi dd:odd', this )
|
|
|
|
.addClass( 'odd' );
|
|
|
|
},
|
|
|
|
error : function( xhr, text_status, error_thrown)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
complete : function( xhr, text_status )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2012-02-23 14:23:10 -05:00
|
|
|
);
|