/* * 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 tableEntryTemplate = false; var tableBody = false; function unescapeXML(str){ return str.replace(/&/g,"&").replace(/>/g,">").replace( /</g,"<").replace(/"/g,"\"").replace(/'/g,"'"); } function renderFilter(filterString) { $('.servicesFilter').val(unescapeXML(filterString)); } function renderData(eventData) { $('.statline').empty().append(i18n.statline.msgFormat(eventData.serviceCount)); $('#plugin_table > tbody > tr').remove(); for ( var idx in eventData.data) { entry(eventData.data[idx]); } if (drawDetails) { renderDetails(eventData); } } function entry( /* Object */dataEntry) { var id = dataEntry.id; var name = dataEntry.id; var _ = tableEntryTemplate.clone().attr('id', 'entry' + id).appendTo(tableBody); _.find('.bIcon').attr('id', 'img' + id).click(function() { showDetails(id); }).after(drawDetails ? name : ('' + name + '')); _.find('td:eq(1)').text(dataEntry.types); _.find('td:eq(2)').html('' + dataEntry.bundleSymbolicName + ' (' + dataEntry.bundleId + ')' ); _.find('td:eq(3)').text(dataEntry.ranking); } function showDetails(id) { $.get(pluginRoot + '/' + id + '.json', null, function(data) { renderDetails(data); }, 'json'); } function hideDetails(id) { $('#img' + id).each(function() { $('#pluginInlineDetails' + id).remove(); $(this). removeClass('ui-icon-triangle-1-w').//left removeClass('ui-icon-triangle-1-s').//down addClass('ui-icon-triangle-1-e').//right unbind('click').click(function() {showDetails(id)}); }); } function renderDetails(data) { data = data.data[0]; $('#entry' + data.id + ' > td').eq(1).append('
'); $('#img' + data.id).each(function() { if (drawDetails) { var ref = window.location.pathname; ref = ref.substring(0, ref.lastIndexOf('/')); $(this). removeClass('ui-icon-triangle-1-e').//right removeClass('ui-icon-triangle-1-s').//down addClass('ui-icon-triangle-1-w').//left attr('title', i18n.back). unbind('click').click(function() {window.location = ref;}); } else { $(this). removeClass('ui-icon-triangle-1-w').//left removeClass('ui-icon-triangle-1-e').//right addClass('ui-icon-triangle-1-s').//down attr('title', i18n.detailsHide). unbind('click').click(function() {hideDetails(data.id)}); } }); var details = ""; if (data.props) { details += renderObjectAsTable(data.props); } if (data.usingBundles) { details += renderUsingBundlesAsTable(data.usingBundles); } if (details) { details = '