<commit_before><!DOCTYPE html>
<html>
    <head>
        <link href="previewer/previewer.css" type="text/css" rel="stylesheet"/>
        <link href="previewer/dataTables/css/demo_table_jui.css" type="text/css" rel="stylesheet"/>
	<link type="text/css" href="previewer/css/custom-theme/jquery-ui-1.8rc3.custom.css" rel="stylesheet" />	
	<link type="text/css" href="previewer/fg-menu/fg.menu.css" rel="stylesheet" />	

        <script type="text/javascript" src="previewer/jquery.js"></script>
	<script type="text/javascript" src="previewer/js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="previewer/js/jquery-ui-1.8rc3.custom.min.js"></script>
        <script type="text/javascript" src="previewer/js/jquery.i18n.properties.js"></script>

        <script type="text/javascript" src="previewer/dataTables/js/jquery.dataTables.js"></script>
        <script type="text/javascript" src="previewer/fg-menu/fg.menu.js"></script>
	<style type="text/css">
	body { font-size:62.5%; margin:0; padding:0; min-height: 500px}

	</style> 

        <script language="javascript">
var lastQuery;
var tableController;

// Init jQuery i18n plugin
loadMessageBundles = function(lang) {

			jQuery.i18n.properties({
			    name:'Messages',
			    path:'previewer/languages/',
			    mode:'both',
			    language:(lang == 'browser' ? jQuery.i18n.browserLang() : lang),
                callback: function() {
                    $('#button').html(jQuery.i18n.prop('label.refresh'));
                    $('#pleaseselect').html(jQuery.i18n.prop('label.selectDataAccessID'));    
                }
			});
		}

loadData = function() {
var fileName =$("#filename").val();
fileName = fileName == undefined || fileName == "" ? $("#staticfile").val() : fileName;
$.get("doQuery",{path:fileName},
function(data) {
bespin.setContent(data)
})
}

saveFile = function() {
var fileName =$("#filename").val();
fileName = fileName == undefined || fileName == "" ? $("#staticfile").val() : fileName;
$('#notifications').html('Saving...');
$('#notifications').fadeIn().delay(2000).fadeOut('slow');
$.get("writeCdaFile",{path: fileName,data:bespin.getContent()},function(data){
$('#notifications').html(data);
$('#notifications').fadeIn().delay(2000).fadeOut('slow');
});
}


/*
 *  pageParams: get the request variables passed in the url 
 */
pageParams = function() {
    var url = document.location.href;
    var output = {};

    // The parameters are in the section between '?' and '#' (if any)
    var startIndex = url.indexOf('?');
    var endIndex = url.indexOf('#');
    var params = (endIndex > 0) ? url.slice(startIndex+1,endIndex).split('&'):url.slice(startIndex+1).split('&');
    for (param in params){
        var p = params[param].split('=');
        output[p[0]] = p[1];
    }
    return output;
}
        </script>
    </head>
<body style='background-color: #4c4a41'>
<input type="hidden" id="staticfile" value="">
<div class='ui-widget-content'>
<!--
HEADER
-->
<div class='header branding'>

    <img  style='position: absolute; left: 10px; top: 15px; width: 100px' src='previewer/img/cda.png'>
    <div style='margin-left: 125px'>
    <div id='fileid'></div>
    <div id="controller">
    <a tabindex="0" href="#dataAccessIds" class="fg-button ui-widget ui-state-default ui-corner-all" id="flat"><span id='selectorText'>Data Access</span><span style='float: right' class="ui-icon ui-icon-triangle-1-s"></span></a></span>
    <div id='dataAccessIds' class="hidden"><ul id='queries'></ul></div> 
<span  id='params'class='params'>&nbsp;</span><button id='button' onclick='refreshTable(lastQuery)'>Refresh</button></div>
    </div>
</div>
<div id='previewerTable' style="padding:10px"><span id='pleaseselect'>Please select a Data Access ID</span></div>
</div>
<div class='ui-widget-content'><img src='previewer/img/webdetails.png' style='padding:5px'></div>
</body>
<script>
$(document).ready(function(){
    // Initialize jquery.i18n plugin - load message files
    var userLocale = '#{LANGUAGE_CODE}';
    loadMessageBundles(userLocale);
    $('#button').button();
    var params = pageParams();
    $('#notifications').hide();

    	// BUTTONS
    	$('.fg-button').hover(
    		function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
    		function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
    	);
    	
    	// MENUS
                $('.fg-button').button();    	
list = $('ul#queries');
list.empty();
$.getJSON("listQueries",{path: filename},function(queries){
var defaultQuery;
var defaultDescription;
for (query in queries.resultset) {
    var name = queries.resultset[query][1] != null && queries.resultset[query][1] != ""? queries.resultset[query][1]: "DataAccess ID: " + queries.resultset[query][0];
    var value = queries.resultset[query][0];
    defaultDescription = name;
    defaultQuery = value;
    list.append('<li><a href="#"><span class="hidden" id="value">'+value+'</span><span id="name">'+ name + '</span></a></li>');
};

		$('#flat').menu({ 
			content: list.parent().html(),
 			showSpeed: 400,
                        callback: function(result) {
                            $('#selectorText').text(result.parent().find('span#name').text())
                            refreshTable(result.parent().find('span#value').text());
                        }
		});

$('#fileid').text(filename);
/* Commented out defaults to test an empty starting state*/
//$('#selectorText').text(defaultDescription)
//refreshTable(defaultQuery);
});
 });

refreshTable = function(id){
    refreshParams(id);
    $.getJSON("doQuery",{path:filename, dataAccessId: id},function(data){
        var tableContents = data.resultset;
        var columnNames = [];
        for (column in data.metadata) {
            columnNames.push({"sTitle": data.metadata[column].colName});
        }
        $('#previewerTable').empty();
        $('#previewerTable').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="contents"></table>' );
        tableController = $('#contents').dataTable({"aaData": tableContents, "aoColumns": columnNames,"bJQueryUI": true});
    });
};

refreshParams = function(id) {
    $.getJSON("listParameters",{path:filename, dataAccessId: id},function(data){
        var placeholder = $('#params');
        placeholder.empty();
        for (param in data.resultset) {
            placeholder.append('<span class="param">'+data.resultset[param][0]+':&nbsp;<input id="'+data.resultset[param][0]+'" value="'+data.resultset[param][2]+'"></span>')
}
});

};

getParams = function() {
    var params = {};
    $('#params input').each(function(index,param){
        params['param' +$(param).attr('id')] = $(param).val()
    });
    return params;<commit_msg>Finished previewer strings localization.<commit_after><!DOCTYPE html>
<html>
    <head>
        <link href="previewer/previewer.css" type="text/css" rel="stylesheet"/>
        <link href="previewer/dataTables/css/demo_table_jui.css" type="text/css" rel="stylesheet"/>
	<link type="text/css" href="previewer/css/custom-theme/jquery-ui-1.8rc3.custom.css" rel="stylesheet" />	
	<link type="text/css" href="previewer/fg-menu/fg.menu.css" rel="stylesheet" />	

        <script type="text/javascript" src="previewer/jquery.js"></script>
	<script type="text/javascript" src="previewer/js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="previewer/js/jquery-ui-1.8rc3.custom.min.js"></script>
        <script type="text/javascript" src="previewer/js/jquery.i18n.properties.js"></script>

        <script type="text/javascript" src="previewer/dataTables/js/jquery.dataTables.js"></script>
        <script type="text/javascript" src="previewer/fg-menu/fg.menu.js"></script>
	<style type="text/css">
	body { font-size:62.5%; margin:0; padding:0; min-height: 500px}

	</style> 

        <script language="javascript">
var lastQuery;
var tableController;

// Init jQuery i18n plugin
loadMessageBundles = function(lang) {

			jQuery.i18n.properties({
			    name:'Messages',
			    path:'previewer/languages/',
			    mode:'both',
			    language:(lang == 'browser' ? jQuery.i18n.browserLang() : lang),
                callback: function() {
                    $('#button').html(jQuery.i18n.prop('label.refresh'));
                    $('#pleaseselect').html(jQuery.i18n.prop('label.selectDataAccessID'));    
                }
			});
		}

loadData = function() {
var fileName =$("#filename").val();
fileName = fileName == undefined || fileName == "" ? $("#staticfile").val() : fileName;
$.get("doQuery",{path:fileName},
function(data) {
bespin.setContent(data)
})
}

saveFile = function() {
var fileName =$("#filename").val();
fileName = fileName == undefined || fileName == "" ? $("#staticfile").val() : fileName;
$('#notifications').html('Saving...');
$('#notifications').fadeIn().delay(2000).fadeOut('slow');
$.get("writeCdaFile",{path: fileName,data:bespin.getContent()},function(data){
$('#notifications').html(data);
$('#notifications').fadeIn().delay(2000).fadeOut('slow');
});
}


/*
 *  pageParams: get the request variables passed in the url 
 */
pageParams = function() {
    var url = document.location.href;
    var output = {};

    // The parameters are in the section between '?' and '#' (if any)
    var startIndex = url.indexOf('?');
    var endIndex = url.indexOf('#');
    var params = (endIndex > 0) ? url.slice(startIndex+1,endIndex).split('&'):url.slice(startIndex+1).split('&');
    for (param in params){
        var p = params[param].split('=');
        output[p[0]] = p[1];
    }
    return output;
}
        </script>
    </head>
<body style='background-color: #4c4a41'>
<input type="hidden" id="staticfile" value="">
<div class='ui-widget-content'>
<!--
HEADER
-->
<div class='header branding'>

    <img  style='position: absolute; left: 10px; top: 15px; width: 100px' src='previewer/img/cda.png'>
    <div style='margin-left: 125px'>
    <div id='fileid'></div>
    <div id="controller">
    <a tabindex="0" href="#dataAccessIds" class="fg-button ui-widget ui-state-default ui-corner-all" id="flat"><span id='selectorText'>Data Access</span><span style='float: right' class="ui-icon ui-icon-triangle-1-s"></span></a></span>
    <div id='dataAccessIds' class="hidden"><ul id='queries'></ul></div> 
<span  id='params'class='params'>&nbsp;</span><button id='button' onclick='refreshTable(lastQuery)'>Refresh</button></div>
    </div>
</div>
<div id='previewerTable' style="padding:10px"><span id='pleaseselect'>Please select a Data Access ID</span></div>
</div>
<div class='ui-widget-content'><img src='previewer/img/webdetails.png' style='padding:5px'></div>
</body>
<script>
var oLanguage;
$(document).ready(function(){
    // Initialize jquery.i18n plugin - load message files
		var userLocale = '#{LANGUAGE_CODE}';
    loadMessageBundles(userLocale);
    // Initialize language support for jQuery dataTables
    $.getJSON( "previewer/dataTables/languages/Messages_" + userLocale + ".txt", function( json ) { 
							oLanguage = json; 
		} );
    $('#button').button();
    var params = pageParams();
    $('#notifications').hide();

    	// BUTTONS
    	$('.fg-button').hover(
    		function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
    		function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
    	);
    	
    	// MENUS
                $('.fg-button').button();    	
list = $('ul#queries');
list.empty();
$.getJSON("listQueries",{path: filename},function(queries){
var defaultQuery;
var defaultDescription;
for (query in queries.resultset) {
    var name = queries.resultset[query][1] != null && queries.resultset[query][1] != ""? queries.resultset[query][1]: "DataAccess ID: " + queries.resultset[query][0];
    var value = queries.resultset[query][0];
    defaultDescription = name;
    defaultQuery = value;
    list.append('<li><a href="#"><span class="hidden" id="value">'+value+'</span><span id="name">'+ name + '</span></a></li>');
};

		$('#flat').menu({ 
			content: list.parent().html(),
 			showSpeed: 400,
                        callback: function(result) {
                            $('#selectorText').text(result.parent().find('span#name').text())
                            refreshTable(result.parent().find('span#value').text());
                        }
		});

$('#fileid').text(filename);
/* Commented out defaults to test an empty starting state*/
//$('#selectorText').text(defaultDescription)
//refreshTable(defaultQuery);
});
 });

refreshTable = function(id){
    refreshParams(id);
    $.getJSON("doQuery",{path:filename, dataAccessId: id},function(data){
        var tableContents = data.resultset;
        var columnNames = [];
        for (column in data.metadata) {
            columnNames.push({"sTitle": data.metadata[column].colName});
        }
        $('#previewerTable').empty();
        $('#previewerTable').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="contents"></table>' );
       	if (oLanguage == 'undefined')
	        tableController = $('#contents').dataTable({"aaData": tableContents, "aoColumns": columnNames,"bJQueryUI": true});
       	else
	        tableController = $('#contents').dataTable({"aaData": tableContents, "aoColumns": columnNames,"bJQueryUI": true,"oLanguage":oLanguage});
    });
};

refreshParams = function(id) {
    $.getJSON("listParameters",{path:filename, dataAccessId: id},function(data){
        var placeholder = $('#params');
        placeholder.empty();
        for (param in data.resultset) {
            placeholder.append('<span class="param">'+data.resultset[param][0]+':&nbsp;<input id="'+data.resultset[param][0]+'" value="'+data.resultset[param][2]+'"></span>')
}
});

};

getParams = function() {
    var params = {};
    $('#params input').each(function(index,param){
        params['param' +$(param).attr('id')] = $(param).val()
    });
    return params;
{'fraction_non_alphanumeric': 0.20561821969969107, 'fraction_numerical': 0.01106401321934047, 'mean_word_length': 3.856943475226797, 'pattern_counts': {'":': 12, '<': 153, '<?xml version=': 0, '>': 155, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2995896', 'n_tokens_mistral': 4457, 'n_tokens_neox': 4322, 'n_words': 752}