<commit_before>/*---------------------------------------------------------
  Setup, Layout, and Status Functions
---------------------------------------------------------*/

// Sets paths to connectors based on language selection.
var treeConnector = '/casein/ckeditor/folders';
//var fileConnector = 'connectors/' + lang + '/filemanager.' + lang;
var fileConnector = '/casein/ckeditor/connector';

// Options for alert, prompt, and confirm dialogues.
$.SetImpromptuDefaults({
	overlayspeed: 'fast',
	show: 'fadeIn',
	opacity: 0.4
});

// Forces columns to fill the layout vertically.
// Called on initial page load and on resize.
var setDimensions = function(){
	var newH = $(window).height() - 50;	
	$('#splitter, #filetree, #fileinfo, .vsplitbar').height(newH);
}

// Sets the folder status, upload, and new folder functions 
// to the path specified. Called on initial page load and 
// whenever a new directory is selected.
var setUploader = function(path){
	$('#currentpath').val(path);

	$('#newfolder').unbind().click(function(){
		// var foldername = prompt('Enter the name of the new folder:', 'My Folder');
		var foldername = 'My Folder';
		var msg = 'Enter the name of the new folder: <input id="fname" name="fname" type="text" value="' + foldername + '" />';
		
		var getFolderName = function(v, m){
			if(v != 1) return false;		
			var fname = m.children('#fname').val();		

			if(fname != ''){
				foldername = fname;

				$.getJSON(fileConnector + '?mode=addfolder&path=' + $('#currentpath').val() + '&name=' + foldername, function(result){
					if(result['Code'] == 0){
						addFolder(result['Parent'], result['Name'], result['Folder ID']);
						if(result['Parent'] != '/')
							getFolderInfo(result['Parent']);
					} else {
						$.prompt(result['Error']);
					}				
				});
			} else {
				$.prompt('No folder name was provided.');
			}
		}
		
		$.prompt(msg, {
			callback: getFolderName,
			buttons: { 'Create Folder': 1, 'Cancel': 0 }
		});		
	});	
}<commit_msg>Added functionality to create folders at root level (after clicking around in the filetree)<commit_after>/*---------------------------------------------------------
  Setup, Layout, and Status Functions
---------------------------------------------------------*/

// Sets paths to connectors based on language selection.
var treeConnector = '/casein/ckeditor/folders';
//var fileConnector = 'connectors/' + lang + '/filemanager.' + lang;
var fileConnector = '/casein/ckeditor/connector';

// Options for alert, prompt, and confirm dialogues.
$.SetImpromptuDefaults({
	overlayspeed: 'fast',
	show: 'fadeIn',
	opacity: 0.4
});

// Forces columns to fill the layout vertically.
// Called on initial page load and on resize.
var setDimensions = function(){
	var newH = $(window).height() - 50;	
	$('#splitter, #filetree, #fileinfo, .vsplitbar').height(newH);
}

// Sets the folder status, upload, and new folder functions 
// to the path specified. Called on initial page load and 
// whenever a new directory is selected.
var setUploader = function(path){
	$('#currentpath').val(path);

	$('#newfolder').unbind().click(function(){
		// var foldername = prompt('Enter the name of the new folder:', 'My Folder');
		var foldername = 'My Folder';
		var msg = 'Enter the name of the new folder: <input id="fname" name="fname" type="text" value="' + foldername + '" />';
		
		var getFolderName = function(v, m){
			if(v != 1) return false;		
			var fname = m.children('#fname').val();		

			if(fname != ''){
				foldername = fname;
				
				if($('#filetree li.directory.expanded').length == 0) {
					$('#currentpath').val('/');
				}
				
				$.getJSON(fileConnector + '?mode=addfolder&path=' + $('#currentpath').val() + '&name=' + foldername, function(result){
					if(result['Code'] == 0){
						addFolder(result['Parent'], result['Name'], result['Folder ID']);
						if(result['Parent'] != '/')
							getFolderInfo(result['Parent']);
					} else {
						$.prompt(result['Error']);
					}				
				});
			} else {
				$.prompt('No folder name was provided.');
			}
		}
		
		$.prompt(msg, {
			callback: getFolderName,
			buttons: { 'Create Folder': 1, 'Cancel': 0 }
		});		
	});	
}
{'fraction_non_alphanumeric': 0.22088835534213686, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 2.8220183486238533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5528117', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1226, 'n_words': 359}