forked from gsoules/AvantSearch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_form.php
140 lines (115 loc) · 5.92 KB
/
config_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
$view = get_view();
$storageEngine = AvantSearch::getStorageEngineForSearchTextsTable();
$titlesOnlySupported = SearchConfig::getOptionsSupportedTitlesOnly();
$addressSortingSupported = SearchConfig::getOptionSupportedAddressSorting();
$elasticsearchSupported = SearchConfig::getOptionSupportedElasticsearch();
$columnsOption = SearchConfig::getOptionTextForColumns();
$columnsOptionRows = max(2, count(explode(PHP_EOL, $columnsOption)));
$layoutsOption = SearchConfig::getOptionTextForLayouts();
$layoutsOptionRows = max(2, count(explode(PHP_EOL, $layoutsOption)));
$detailLayoutOption = SearchConfig::getOptionTextForDetailLayout();
$detailLayoutRows = max(2, count(explode(PHP_EOL, $detailLayoutOption)));
$integerSortingOption = SearchConfig::getOptionTextForIntegerSorting();
$integerSortingOptionRows = max(2, count(explode(PHP_EOL, $integerSortingOption)));
$pdfOptionAttributes = array('checked' => AvantSearch::usePdfSearch());
if (AvantSearch::useElasticsearch())
$pdfOptionAttributes['disabled'] = true;
$elasticsearchOptionAttributes = array('checked' => AvantSearch::useElasticsearch());
if (AvantSearch::usePdfSearch())
$elasticsearchOptionAttributes['disabled'] = true;
?>
<style>
.error{color:red;font-size:16px;}
.storage-engine {color:#9D5B41;margin-bottom:24px;font-weight:bold;}
</style>
<div class="plugin-help learn-more">
<a href="https://digitalarchive.us/plugins/avantsearch/" target="_blank">Learn about the configuration options on this page</a>
</div>
<?php if ($storageEngine != 'InnoDB'): ?>
<?php SearchConfig::emitInnoDbMessage($storageEngine) ?>
<?php endif; ?>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_TITLES_ONLY ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($titlesOnlySupported): ?>
<p class="explanation"><?php echo __('Show the option to limit keyword searching to Title text.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_TITLES_ONLY, true, array('checked' => (boolean)get_option(SearchConfig::OPTION_TITLES_ONLY))); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'titles-only'); ?>
<?php endif; ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_COLUMNS; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Customization of columns in Table View search results."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_COLUMNS, $columnsOption, array('rows' => $columnsOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_LAYOUTS; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Layout definitions."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_LAYOUTS, $layoutsOption, array('rows' => $layoutsOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_DETAIL_LAYOUT; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Detail layout elements."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_DETAIL_LAYOUT, $detailLayoutOption, array('rows' => $detailLayoutRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_INTEGER_SORTING; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Columns that should be sorted as integers. Can be used with mixed values (integer and text). Requires Elasticsearch reindex."); ?></p>
<?php echo $view->formTextarea(SearchConfig::OPTION_INTEGER_SORTING, $integerSortingOption, array('rows' => $integerSortingOptionRows)); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_ADDRESS_SORTING; ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($addressSortingSupported): ?>
<p class="explanation"><?php echo __('Sort street addresses by street name, then by street number.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_ADDRESS_SORTING, true, array('checked' => (boolean)get_option(SearchConfig::OPTION_ADDRESS_SORTING))); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'address-sorting-option'); ?>
<?php endif; ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_PDFSEARCH; ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __('Use PDF search. Turning this option on will add PDF texts to the search table which can take a very long time so be patient. Turning it off will not remove the PDF text. To remove it, run <b>Index Records</b> on the Omeka Settings > Search page. Do not enable the option more than once without running Index Records in between or else you will end up with duplicate PDF text in the search table.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_PDFSEARCH, true, $pdfOptionAttributes); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo CONFIG_LABEL_ELASTICSEARCH; ?></label>
</div>
<div class="inputs five columns omega">
<?php if ($elasticsearchSupported): ?>
<p class="explanation"><?php echo __('Use Elasticsearch.'); ?></p>
<?php echo $view->formCheckbox(SearchConfig::OPTION_ELASTICSEARCH, true, $elasticsearchOptionAttributes); ?>
<?php else: ?>
<?php SearchConfig::emitOptionNotSupported('AvantSearch', 'elasticsearch'); ?>
<?php endif; ?>
</div>
</div>