<commit_before><? defined('C5_EXECUTE') or die("Access Denied."); ?> 
<?
Loader::model('file_set');

$searchFields = array(
	'' => '** ' . t('Fields'),
	'size' => t('Size'),
	'type' => t('Type'),
	'extension' => t('Extension'),
	'date_added' => t('Added Between'),
	'added_to' => t('Added to Page')
);

if ($_REQUEST['fType'] != false) {
	unset($searchFields['type']);
}
if ($_REQUEST['fExtension'] != false) {
	unset($searchFields['extension']);
}

$html = Loader::helper('html');
$text = Loader::helper('text');

Loader::model('file_attributes');
$searchFieldAttributes = FileAttributeKey::getSearchableList();
foreach($searchFieldAttributes as $ak) {
	$searchFields[$ak->getAttributeKeyID()] = tc('AttributeKeyName', $ak->getAttributeKeyName());
}

$ext1 = FileList::getExtensionList();
$extensions = array();
foreach($ext1 as $value) {
	$extensions[$value] = $value;
}

$t1 = FileList::getTypeList();
$types = array();
foreach($t1 as $value) {
	$types[$value] = FileType::getGenericTypeText($value);
}

?>

<? $form = Loader::helper('form'); ?>
	
	<div id="ccm-<?=$searchInstance?>-search-field-base-elements" style="display: none">
	
		<span class="ccm-search-option" search-field="size">
		<?=$form->text('size_from', array('style' => 'width: 30px'))?>
		<?=t('to')?>
		<?=$form->text('size_to', array('style' => 'width: 30px'))?>
		KB
		</span>
	
		<span class="ccm-search-option"  search-field="type">
		<?=$form->select('type', $types)?>
		</span>
	
		<span class="ccm-search-option"  search-field="extension">
		<?=$form->select('extension', $extensions)?>
		</span>

		<span class="ccm-search-option ccm-search-option-type-date_time"  search-field="date_added">
		<?=$form->text('date_from', array('style' => 'width: 86px'))?>
		<?=t('to')?>
		<?=$form->text('date_to', array('style' => 'width: 86px'))?>
		</span>

		<span class="ccm-search-option" search-field="added_to">
		<div style="width: 100px">
		<? $ps = Loader::helper("form/page_selector");
		print $ps->selectPage('ocIDSearchField');
		?>
		</div>
		</span>
		
		<? foreach($searchFieldAttributes as $sfa) { 
			$sfa->render('search'); ?>
		<? } ?>
		
	</div>

	<form method="get" class="form-horizontal" id="ccm-<?=$searchInstance?>-advanced-search" action="<?=REL_DIR_FILES_TOOLS_REQUIRED?>/files/search_results">
	<? if ($_REQUEST['fType'] != false) {
		$showTypes = array();
		if(is_array($_REQUEST['fType'])) {
			foreach($_REQUEST['fType'] as $showTypeId) {
				$showTypes[] = FileType::getGenericTypeText($showTypeId);
			}
		}
		else {
			$showTypes[] = FileType::getGenericTypeText($_REQUEST['fType']);
		}
		?>
		<div class="ccm-file-manager-pre-filter"><?=t('Only displaying %s files.', implode(', ', $showTypes))?></div>
	<? } else if ($_REQUEST['fExtension'] != false) {
		if(is_array($_REQUEST['fExtension'])) {
			$showExtensions = $_REQUEST['fExtension'];
		}
		else {
			$showExtensions = array($_REQUEST['fExtension']);
		}
		?>
		<div class="ccm-file-manager-pre-filter"><?=t('Only displaying files with extension .%s.', implode(', ', $showExtensions))?></div>
	<? } ?>

	<input type="hidden" name="submit_search" value="1" />
	<?
		foreach(array('fType', 'fExtension') as $filterName) {
			$filterValues = '';
			if(is_array($_REQUEST[$filterName])) {
				foreach($_REQUEST[$filterName] as $filterValue) {
					print '<input type="hidden" name="' . $filterName . '[]" value="' . $text->entities($filterValue) . '" />';
				}
			}
			else {
				print $form->hidden($filterName);
			}
		}
		print $form->hidden('searchType', $searchType); 
		print $form->hidden('ccm_order_dir', $searchRequest['ccm_order_dir']); 
		print $form->hidden('ccm_order_by', $searchRequest['ccm_order_by']); 
		print $form->hidden('fileSelector', $fileSelector); 
	?>	
	<input type="hidden" name="searchInstance" value="<?=$searchInstance?>" />
	<div class="ccm-pane-options-permanent-search">

	<?
		$s2 = FileSet::getSavedSearches();
		if (count($s2) > 0) { 
			if ($_REQUEST['fssID'] < 1) {
				$savedSearches = array('' => t('** Select a saved search.'));
			} else {
				$savedSearches = array('' => t('** None (Exit Saved Search)'));
			}
			
			foreach($s2 as $fss) {
				$savedSearches[$fss->getFileSetID()] = $fss->getFileSetName();
			}
		?>
			<div class="control-group">
			<?=$form->label('fssID', t('Saved Search'))?>
			<div class="controls">
				<?=$form->select('fssID', $savedSearches, $fssID, array('class' => 'span3', 'style' => 'vertical-align: middle'))?>
				<? if ($_REQUEST['fssID'] > 0) { ?>
					<a href="<?=REL_DIR_FILES_TOOLS_REQUIRED?>/files/delete_set?fsID=<?=$_REQUEST['fssID']?>&searchInstance=<?=$searchInstance?>" class="ccm-file-set-delete-saved-search" dialog-append-buttons="true" dialog-title="<?=t('Delete File Set')?>" dialog-width="320" dialog-height="110" dialog-modal="false" style="vertical-align: middle"><img src="<?=ASSETS_URL_IMAGES?>/icons/delete_small.png" style="vertical-align: middle" width="16" height="16" border="0" /></a>
				<? } ?>
			</div>
			</div>
			
		<? } ?>

		<div class="span3">
		<?=$form->label('fvKeywords', t('Keywords'))?>
		<div class="controls">
			<?=$form->text('fKeywords', $searchRequest['fKeywords'], array('style'=> 'width: 130px')); ?>
		</div>
		</div>
		
		<div id="ccm-<?=$searchInstance?>-sets-search-wrapper">
		<?<commit_msg>Add some more space to "Keywords" search field<commit_after><? defined('C5_EXECUTE') or die("Access Denied."); ?> 
<?
Loader::model('file_set');

$searchFields = array(
	'' => '** ' . t('Fields'),
	'size' => t('Size'),
	'type' => t('Type'),
	'extension' => t('Extension'),
	'date_added' => t('Added Between'),
	'added_to' => t('Added to Page')
);

if ($_REQUEST['fType'] != false) {
	unset($searchFields['type']);
}
if ($_REQUEST['fExtension'] != false) {
	unset($searchFields['extension']);
}

$html = Loader::helper('html');
$text = Loader::helper('text');

Loader::model('file_attributes');
$searchFieldAttributes = FileAttributeKey::getSearchableList();
foreach($searchFieldAttributes as $ak) {
	$searchFields[$ak->getAttributeKeyID()] = tc('AttributeKeyName', $ak->getAttributeKeyName());
}

$ext1 = FileList::getExtensionList();
$extensions = array();
foreach($ext1 as $value) {
	$extensions[$value] = $value;
}

$t1 = FileList::getTypeList();
$types = array();
foreach($t1 as $value) {
	$types[$value] = FileType::getGenericTypeText($value);
}

?>

<? $form = Loader::helper('form'); ?>
	
	<div id="ccm-<?=$searchInstance?>-search-field-base-elements" style="display: none">
	
		<span class="ccm-search-option" search-field="size">
		<?=$form->text('size_from', array('style' => 'width: 30px'))?>
		<?=t('to')?>
		<?=$form->text('size_to', array('style' => 'width: 30px'))?>
		KB
		</span>
	
		<span class="ccm-search-option"  search-field="type">
		<?=$form->select('type', $types)?>
		</span>
	
		<span class="ccm-search-option"  search-field="extension">
		<?=$form->select('extension', $extensions)?>
		</span>

		<span class="ccm-search-option ccm-search-option-type-date_time"  search-field="date_added">
		<?=$form->text('date_from', array('style' => 'width: 86px'))?>
		<?=t('to')?>
		<?=$form->text('date_to', array('style' => 'width: 86px'))?>
		</span>

		<span class="ccm-search-option" search-field="added_to">
		<div style="width: 100px">
		<? $ps = Loader::helper("form/page_selector");
		print $ps->selectPage('ocIDSearchField');
		?>
		</div>
		</span>
		
		<? foreach($searchFieldAttributes as $sfa) { 
			$sfa->render('search'); ?>
		<? } ?>
		
	</div>

	<form method="get" class="form-horizontal" id="ccm-<?=$searchInstance?>-advanced-search" action="<?=REL_DIR_FILES_TOOLS_REQUIRED?>/files/search_results">
	<? if ($_REQUEST['fType'] != false) {
		$showTypes = array();
		if(is_array($_REQUEST['fType'])) {
			foreach($_REQUEST['fType'] as $showTypeId) {
				$showTypes[] = FileType::getGenericTypeText($showTypeId);
			}
		}
		else {
			$showTypes[] = FileType::getGenericTypeText($_REQUEST['fType']);
		}
		?>
		<div class="ccm-file-manager-pre-filter"><?=t('Only displaying %s files.', implode(', ', $showTypes))?></div>
	<? } else if ($_REQUEST['fExtension'] != false) {
		if(is_array($_REQUEST['fExtension'])) {
			$showExtensions = $_REQUEST['fExtension'];
		}
		else {
			$showExtensions = array($_REQUEST['fExtension']);
		}
		?>
		<div class="ccm-file-manager-pre-filter"><?=t('Only displaying files with extension .%s.', implode(', ', $showExtensions))?></div>
	<? } ?>

	<input type="hidden" name="submit_search" value="1" />
	<?
		foreach(array('fType', 'fExtension') as $filterName) {
			$filterValues = '';
			if(is_array($_REQUEST[$filterName])) {
				foreach($_REQUEST[$filterName] as $filterValue) {
					print '<input type="hidden" name="' . $filterName . '[]" value="' . $text->entities($filterValue) . '" />';
				}
			}
			else {
				print $form->hidden($filterName);
			}
		}
		print $form->hidden('searchType', $searchType); 
		print $form->hidden('ccm_order_dir', $searchRequest['ccm_order_dir']); 
		print $form->hidden('ccm_order_by', $searchRequest['ccm_order_by']); 
		print $form->hidden('fileSelector', $fileSelector); 
	?>	
	<input type="hidden" name="searchInstance" value="<?=$searchInstance?>" />
	<br/>
	<div class="ccm-pane-options-permanent-search">

	<?
		$s2 = FileSet::getSavedSearches();
		if (count($s2) > 0) { 
			if ($_REQUEST['fssID'] < 1) {
				$savedSearches = array('' => t('** Select a saved search.'));
			} else {
				$savedSearches = array('' => t('** None (Exit Saved Search)'));
			}
			
			foreach($s2 as $fss) {
				$savedSearches[$fss->getFileSetID()] = $fss->getFileSetName();
			}
		?>
			<div class="control-group">
			<?=$form->label('fssID', t('Saved Search'))?>
			<div class="controls">
				<?=$form->select('fssID', $savedSearches, $fssID, array('class' => 'span3', 'style' => 'vertical-align: middle'))?>
				<? if ($_REQUEST['fssID'] > 0) { ?>
					<a href="<?=REL_DIR_FILES_TOOLS_REQUIRED?>/files/delete_set?fsID=<?=$_REQUEST['fssID']?>&searchInstance=<?=$searchInstance?>" class="ccm-file-set-delete-saved-search" dialog-append-buttons="true" dialog-title="<?=t('Delete File Set')?>" dialog-width="320" dialog-height="110" dialog-modal="false" style="vertical-align: middle"><img src="<?=ASSETS_URL_IMAGES?>/icons/delete_small.png" style="vertical-align: middle" width="16" height="16" border="0" /></a>
				<? } ?>
			</div>
			</div>
			
		<? } ?>

		<div class="span4">
		<?=$form->label('fvKeywords', t('Keywords'))?>
		<div class="controls">
			<?=$form->text('fKeywords', $searchRequest['fKeywords'], array('style'=> 'width: 130px')); ?>
		</div>
		</div>
		
		<div id="ccm-<?=$searchInstance?>-sets-search-wrapper">
		<?
{'fraction_non_alphanumeric': 0.24123303167420815, 'fraction_numerical': 0.007352941176470588, 'mean_word_length': 5.251620506776665, 'pattern_counts': {'":': 0, '<': 154, '<?xml version=': 0, '>': 228, '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': '931065', 'n_tokens_mistral': 4144, 'n_tokens_neox': 3781, 'n_words': 592}