1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHPPgAdmin 6.1.3 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Controller; |
8
|
|
|
|
9
|
|
|
use PHPPgAdmin\Decorators\Decorator; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Base controller class. |
13
|
|
|
*/ |
14
|
|
|
class FulltextController extends BaseController |
15
|
|
|
{ |
16
|
|
|
public $controller_title = 'strschemas'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Default method to render the controller according to the action parameter. |
20
|
|
|
*/ |
21
|
|
|
public function render() |
22
|
|
|
{ |
23
|
|
|
if ('tree' === $this->action) { |
24
|
|
|
return $this->doTree(); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
if ('subtree' === $this->action) { |
28
|
|
|
return $this->doSubTree($_REQUEST['what']); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
$this->printHeader(); |
32
|
|
|
$this->printBody(); |
33
|
|
|
|
34
|
|
|
if (null !== $this->getPostParam('cancel')) { |
35
|
|
|
if (isset($_POST['prev_action'])) { |
36
|
|
|
$this->action = $_POST['prev_action']; |
37
|
|
|
} else { |
38
|
|
|
$this->action = ''; |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
switch ($this->action) { |
43
|
|
|
case 'createconfig': |
44
|
|
|
if (null !== $this->getPostParam('create')) { |
45
|
|
|
$this->doSaveCreateConfig(); |
46
|
|
|
} else { |
47
|
|
|
$this->doCreateConfig(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
break; |
51
|
|
|
case 'alterconfig': |
52
|
|
|
if (null !== $this->getPostParam('alter')) { |
53
|
|
|
$this->doSaveAlterConfig(); |
54
|
|
|
} else { |
55
|
|
|
$this->doAlterConfig(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
break; |
59
|
|
|
case 'dropconfig': |
60
|
|
|
if (null !== $this->getPostParam('drop')) { |
61
|
|
|
$this->doDropConfig(false); |
62
|
|
|
} else { |
63
|
|
|
$this->doDropConfig(true); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
break; |
67
|
|
|
case 'viewconfig': |
68
|
|
|
$this->doViewConfig($_REQUEST['ftscfg']); |
69
|
|
|
|
70
|
|
|
break; |
71
|
|
|
case 'viewparsers': |
72
|
|
|
$this->doViewParsers(); |
73
|
|
|
|
74
|
|
|
break; |
75
|
|
|
case 'viewdicts': |
76
|
|
|
$this->doViewDicts(); |
77
|
|
|
|
78
|
|
|
break; |
79
|
|
|
case 'createdict': |
80
|
|
|
if (null !== $this->getPostParam('create')) { |
81
|
|
|
$this->doSaveCreateDict(); |
82
|
|
|
} else { |
83
|
|
|
$this->doCreateDict(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
break; |
87
|
|
|
case 'alterdict': |
88
|
|
|
if (null !== $this->getPostParam('alter')) { |
89
|
|
|
$this->doSaveAlterDict(); |
90
|
|
|
} else { |
91
|
|
|
$this->doAlterDict(); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
break; |
95
|
|
|
case 'dropdict': |
96
|
|
|
if (null !== $this->getPostParam('drop')) { |
97
|
|
|
$this->doDropDict(false); |
98
|
|
|
} else { |
99
|
|
|
$this->doDropDict(true); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
break; |
103
|
|
|
case 'dropmapping': |
104
|
|
|
if (null !== $this->getPostParam('drop')) { |
105
|
|
|
$this->doDropMapping(false); |
106
|
|
|
} else { |
107
|
|
|
$this->doDropMapping(true); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
break; |
111
|
|
|
case 'altermapping': |
112
|
|
|
if (null !== $this->getPostParam('alter')) { |
113
|
|
|
$this->doSaveAlterMapping(); |
114
|
|
|
} else { |
115
|
|
|
$this->doAlterMapping(); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
break; |
119
|
|
|
case 'addmapping': |
120
|
|
|
if (isset($_POST['add'])) { |
121
|
|
|
$this->doSaveAddMapping(); |
122
|
|
|
} else { |
123
|
|
|
$this->doAddMapping(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
break; |
127
|
|
|
|
128
|
|
|
default: |
129
|
|
|
$this->doDefault(); |
130
|
|
|
|
131
|
|
|
break; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
return $this->printFooter(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function doDefault($msg = ''): void |
138
|
|
|
{ |
139
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
140
|
|
|
|
141
|
|
|
$this->printTrail('schema'); |
142
|
|
|
$this->printTabs('schema', 'fulltext'); |
143
|
|
|
$this->printTabs('fulltext', 'ftsconfigs'); |
144
|
|
|
$this->printMsg($msg); |
145
|
|
|
|
146
|
|
|
$cfgs = $data->getFtsConfigurations(false); |
147
|
|
|
|
148
|
|
|
$columns = [ |
149
|
|
|
'configuration' => [ |
150
|
|
|
'title' => $this->lang['strftsconfig'], |
151
|
|
|
'field' => Decorator::field('name'), |
152
|
|
|
'url' => "fulltext?action=viewconfig&{$this->misc->href}&", |
153
|
|
|
'vars' => ['ftscfg' => 'name'], |
154
|
|
|
], |
155
|
|
|
'schema' => [ |
156
|
|
|
'title' => $this->lang['strschema'], |
157
|
|
|
'field' => Decorator::field('schema'), |
158
|
|
|
], |
159
|
|
|
'actions' => [ |
160
|
|
|
'title' => $this->lang['stractions'], |
161
|
|
|
], |
162
|
|
|
'comment' => [ |
163
|
|
|
'title' => $this->lang['strcomment'], |
164
|
|
|
'field' => Decorator::field('comment'), |
165
|
|
|
], |
166
|
|
|
]; |
167
|
|
|
|
168
|
|
|
$actions = [ |
169
|
|
|
'drop' => [ |
170
|
|
|
'content' => $this->lang['strdrop'], |
171
|
|
|
'attr' => [ |
172
|
|
|
'href' => [ |
173
|
|
|
'url' => 'fulltext', |
174
|
|
|
'urlvars' => [ |
175
|
|
|
'action' => 'dropconfig', |
176
|
|
|
'ftscfg' => Decorator::field('name'), |
177
|
|
|
], |
178
|
|
|
], |
179
|
|
|
], |
180
|
|
|
], |
181
|
|
|
'alter' => [ |
182
|
|
|
'content' => $this->lang['stralter'], |
183
|
|
|
'attr' => [ |
184
|
|
|
'href' => [ |
185
|
|
|
'url' => 'fulltext', |
186
|
|
|
'urlvars' => [ |
187
|
|
|
'action' => 'alterconfig', |
188
|
|
|
'ftscfg' => Decorator::field('name'), |
189
|
|
|
], |
190
|
|
|
], |
191
|
|
|
], |
192
|
|
|
], |
193
|
|
|
]; |
194
|
|
|
|
195
|
|
|
echo $this->printTable($cfgs, $columns, $actions, 'fulltext-fulltext', $this->lang['strftsnoconfigs']); |
|
|
|
|
196
|
|
|
|
197
|
|
|
$navlinks = [ |
198
|
|
|
'createconf' => [ |
199
|
|
|
'attr' => [ |
200
|
|
|
'href' => [ |
201
|
|
|
'url' => 'fulltext', |
202
|
|
|
'urlvars' => [ |
203
|
|
|
'action' => 'createconfig', |
204
|
|
|
'server' => $_REQUEST['server'], |
205
|
|
|
'database' => $_REQUEST['database'], |
206
|
|
|
'schema' => $_REQUEST['schema'], |
207
|
|
|
], |
208
|
|
|
], |
209
|
|
|
], |
210
|
|
|
'content' => $this->lang['strftscreateconfig'], |
211
|
|
|
], |
212
|
|
|
]; |
213
|
|
|
|
214
|
|
|
$this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars()); |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Generate XML for the browser tree. |
219
|
|
|
*/ |
220
|
|
|
public function doTree() |
221
|
|
|
{ |
222
|
|
|
$tabs = $this->misc->getNavTabs('fulltext'); |
223
|
|
|
$items = $this->adjustTabsForTree($tabs); |
224
|
|
|
|
225
|
|
|
$reqvars = $this->misc->getRequestVars('ftscfg'); |
226
|
|
|
|
227
|
|
|
$attrs = [ |
228
|
|
|
'text' => Decorator::field('title'), |
229
|
|
|
'icon' => Decorator::field('icon'), |
230
|
|
|
'action' => Decorator::actionurl( |
231
|
|
|
'fulltext', |
232
|
|
|
$reqvars, |
233
|
|
|
Decorator::field('urlvars') |
234
|
|
|
), |
235
|
|
|
'branch' => Decorator::url( |
236
|
|
|
'fulltext', |
237
|
|
|
$reqvars, |
238
|
|
|
[ |
239
|
|
|
'action' => 'subtree', |
240
|
|
|
'what' => Decorator::field('icon'), // IZ: yeah, it's ugly, but I do not want to change navigation tabs arrays |
241
|
|
|
] |
242
|
|
|
), |
243
|
|
|
]; |
244
|
|
|
|
245
|
|
|
return $this->printTree($items, $attrs, 'fts'); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
public function doSubTree($what) |
249
|
|
|
{ |
250
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
251
|
|
|
|
252
|
|
|
switch ($what) { |
253
|
|
|
case 'FtsCfg': |
254
|
|
|
$items = $data->getFtsConfigurations(false); |
255
|
|
|
$urlvars = ['action' => 'viewconfig', 'ftscfg' => Decorator::field('name')]; |
256
|
|
|
|
257
|
|
|
break; |
258
|
|
|
case 'FtsDict': |
259
|
|
|
$items = $data->getFtsDictionaries(false); |
260
|
|
|
$urlvars = ['action' => 'viewdicts']; |
261
|
|
|
|
262
|
|
|
break; |
263
|
|
|
case 'FtsParser': |
264
|
|
|
$items = $data->getFtsParsers(false); |
265
|
|
|
$urlvars = ['action' => 'viewparsers']; |
266
|
|
|
|
267
|
|
|
break; |
268
|
|
|
|
269
|
|
|
default: |
270
|
|
|
return; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
$reqvars = $this->misc->getRequestVars('ftscfg'); |
274
|
|
|
|
275
|
|
|
$attrs = [ |
276
|
|
|
'text' => Decorator::field('name'), |
277
|
|
|
'icon' => $what, |
278
|
|
|
'toolTip' => Decorator::field('comment'), |
279
|
|
|
'action' => Decorator::actionurl( |
280
|
|
|
'fulltext', |
281
|
|
|
$reqvars, |
282
|
|
|
$urlvars |
283
|
|
|
), |
284
|
|
|
'branch' => Decorator::ifempty( |
285
|
|
|
Decorator::field('branch'), |
286
|
|
|
'', |
287
|
|
|
Decorator::url( |
288
|
|
|
'fulltext', |
289
|
|
|
$reqvars, |
290
|
|
|
[ |
291
|
|
|
'action' => 'subtree', |
292
|
|
|
'ftscfg' => Decorator::field('name'), |
293
|
|
|
] |
294
|
|
|
) |
295
|
|
|
), |
296
|
|
|
]; |
297
|
|
|
|
298
|
|
|
return $this->printTree($items, $attrs, \mb_strtolower($what)); |
|
|
|
|
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public function doDropConfig(bool $confirm): void |
302
|
|
|
{ |
303
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
304
|
|
|
|
305
|
|
|
if ($confirm) { |
306
|
|
|
$this->printTrail('ftscfg'); |
307
|
|
|
$this->printTitle($this->lang['strdrop'], 'pg.ftscfg.drop'); |
308
|
|
|
|
309
|
|
|
echo '<p>', \sprintf($this->lang['strconfdropftsconfig'], $this->misc->printVal($_REQUEST['ftscfg'])), '</p>' . \PHP_EOL; |
310
|
|
|
|
311
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
312
|
|
|
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>" . \PHP_EOL; |
313
|
|
|
echo '<p><input type="hidden" name="action" value="dropconfig" />' . \PHP_EOL; |
314
|
|
|
echo '<input type="hidden" name="database" value="', \htmlspecialchars($_REQUEST['database']), '" />' . \PHP_EOL; |
315
|
|
|
echo '<input type="hidden" name="ftscfg" value="', \htmlspecialchars($_REQUEST['ftscfg']), '" />' . \PHP_EOL; |
316
|
|
|
echo $this->view->form; |
317
|
|
|
echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />" . \PHP_EOL; |
318
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
319
|
|
|
echo '</form>' . \PHP_EOL; |
320
|
|
|
} else { |
321
|
|
|
$status = $data->dropFtsConfiguration($_POST['ftscfg'], isset($_POST['cascade'])); |
322
|
|
|
|
323
|
|
|
if (0 === $status) { |
324
|
|
|
$this->view->setReloadBrowser(true); |
325
|
|
|
$this->doDefault($this->lang['strftsconfigdropped']); |
326
|
|
|
} else { |
327
|
|
|
$this->doDefault($this->lang['strftsconfigdroppedbad']); |
328
|
|
|
} |
329
|
|
|
} |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
public function doDropDict(bool $confirm): void |
333
|
|
|
{ |
334
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
335
|
|
|
|
336
|
|
|
if ($confirm) { |
337
|
|
|
$this->printTrail('ftscfg'); // TODO: change to smth related to dictionary |
338
|
|
|
$this->printTitle($this->lang['strdrop'], 'pg.ftsdict.drop'); |
339
|
|
|
|
340
|
|
|
echo '<p>', \sprintf($this->lang['strconfdropftsdict'], $this->misc->printVal($_REQUEST['ftsdict'])), '</p>' . \PHP_EOL; |
341
|
|
|
|
342
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
343
|
|
|
echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>" . \PHP_EOL; |
344
|
|
|
echo '<p><input type="hidden" name="action" value="dropdict" />' . \PHP_EOL; |
345
|
|
|
echo '<input type="hidden" name="database" value="', \htmlspecialchars($_REQUEST['database']), '" />' . \PHP_EOL; |
346
|
|
|
echo '<input type="hidden" name="ftsdict" value="', \htmlspecialchars($_REQUEST['ftsdict']), '" />' . \PHP_EOL; |
347
|
|
|
//echo "<input type=\"hidden\" name=\"ftscfg\" value=\"", htmlspecialchars($_REQUEST['ftscfg']), "\" />".PHP_EOL; |
348
|
|
|
echo '<input type="hidden" name="prev_action" value="viewdicts" /></p>' . \PHP_EOL; |
349
|
|
|
echo $this->view->form; |
350
|
|
|
echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />" . \PHP_EOL; |
351
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
352
|
|
|
echo '</form>' . \PHP_EOL; |
353
|
|
|
} else { |
354
|
|
|
$status = $data->dropFtsDictionary($_POST['ftsdict'], isset($_POST['cascade'])); |
355
|
|
|
|
356
|
|
|
if (0 === $status) { |
357
|
|
|
$this->view->setReloadBrowser(true); |
358
|
|
|
$this->doViewDicts($this->lang['strftsdictdropped']); |
359
|
|
|
} else { |
360
|
|
|
$this->doViewDicts($this->lang['strftsdictdroppedbad']); |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* Displays a screen where one can enter a new FTS configuration. |
367
|
|
|
* |
368
|
|
|
* @param mixed $msg |
369
|
|
|
*/ |
370
|
|
|
public function doCreateConfig($msg = ''): void |
371
|
|
|
{ |
372
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
373
|
|
|
|
374
|
|
|
$this->coalesceArr($_POST, 'formName', ''); |
375
|
|
|
|
376
|
|
|
$this->coalesceArr($_POST, 'formParser', ''); |
377
|
|
|
|
378
|
|
|
$this->coalesceArr($_POST, 'formTemplate', ''); |
379
|
|
|
|
380
|
|
|
$this->coalesceArr($_POST, 'formWithMap', ''); |
381
|
|
|
|
382
|
|
|
$this->coalesceArr($_POST, 'formComment', ''); |
383
|
|
|
|
384
|
|
|
// Fetch all FTS configurations from the database |
385
|
|
|
$ftscfgs = $data->getFtsConfigurations(); |
386
|
|
|
// Fetch all FTS parsers from the database |
387
|
|
|
$ftsparsers = $data->getFtsParsers(); |
388
|
|
|
|
389
|
|
|
$this->printTrail('schema'); |
390
|
|
|
$this->printTitle($this->lang['strftscreateconfig'], 'pg.ftscfg.create'); |
391
|
|
|
$this->printMsg($msg); |
392
|
|
|
|
393
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
394
|
|
|
echo '<table>' . \PHP_EOL; |
395
|
|
|
// conf name |
396
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . \PHP_EOL; |
397
|
|
|
echo "\t\t<td class=\"data1\"><input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
398
|
|
|
\htmlspecialchars($_POST['formName']), "\" /></td>\n\t</tr>" . \PHP_EOL; |
399
|
|
|
|
400
|
|
|
// Template |
401
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftstemplate']}</th>" . \PHP_EOL; |
402
|
|
|
echo "\t\t<td class=\"data1\">"; |
403
|
|
|
|
404
|
|
|
$tpls = []; |
405
|
|
|
$tplsel = ''; |
406
|
|
|
|
407
|
|
|
while (!$ftscfgs->EOF) { |
408
|
|
|
$data->fieldClean($ftscfgs->fields['schema']); |
409
|
|
|
$data->fieldClean($ftscfgs->fields['name']); |
410
|
|
|
$tplname = $ftscfgs->fields['schema'] . '.' . $ftscfgs->fields['name']; |
411
|
|
|
$tpls[$tplname] = \serialize([ |
412
|
|
|
'name' => $ftscfgs->fields['name'], |
413
|
|
|
'schema' => $ftscfgs->fields['schema'], |
414
|
|
|
]); |
415
|
|
|
|
416
|
|
|
if ($_POST['formTemplate'] === $tpls[$tplname]) { |
417
|
|
|
$tplsel = \htmlspecialchars($tpls[$tplname]); |
418
|
|
|
} |
419
|
|
|
$ftscfgs->moveNext(); |
420
|
|
|
} |
421
|
|
|
echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tpls, 'formTemplate', true, $tplsel, false); |
422
|
|
|
echo "\n\t\t</td>\n\t</tr>" . \PHP_EOL; |
423
|
|
|
|
424
|
|
|
// Parser |
425
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftsparser']}</th>" . \PHP_EOL; |
426
|
|
|
echo "\t\t<td class=\"data1\">" . \PHP_EOL; |
427
|
|
|
$ftsparsers_ = []; |
428
|
|
|
$ftsparsel = ''; |
429
|
|
|
|
430
|
|
|
while (!$ftsparsers->EOF) { |
431
|
|
|
$data->fieldClean($ftsparsers->fields['schema']); |
432
|
|
|
$data->fieldClean($ftsparsers->fields['name']); |
433
|
|
|
$parsername = $ftsparsers->fields['schema'] . '.' . $ftsparsers->fields['name']; |
434
|
|
|
|
435
|
|
|
$ftsparsers_[$parsername] = \serialize([ |
436
|
|
|
'parser' => $ftsparsers->fields['name'], |
437
|
|
|
'schema' => $ftsparsers->fields['schema'], |
438
|
|
|
]); |
439
|
|
|
|
440
|
|
|
if ($_POST['formParser'] === $ftsparsers_[$parsername]) { |
441
|
|
|
$ftsparsel = \htmlspecialchars($ftsparsers_[$parsername]); |
442
|
|
|
} |
443
|
|
|
$ftsparsers->moveNext(); |
444
|
|
|
} |
445
|
|
|
echo \PHPPgAdmin\XHtml\HTMLController::printCombo($ftsparsers_, 'formParser', true, $ftsparsel, false); |
446
|
|
|
echo "\n\t\t</td>\n\t</tr>" . \PHP_EOL; |
447
|
|
|
|
448
|
|
|
// Comment |
449
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strcomment']}</th>" . \PHP_EOL; |
450
|
|
|
echo "\t\t<td class=\"data1\"><textarea name=\"formComment\" rows=\"3\" cols=\"32\">", |
451
|
|
|
\htmlspecialchars($_POST['formComment']), "</textarea></td>\n\t</tr>" . \PHP_EOL; |
452
|
|
|
|
453
|
|
|
echo '</table>' . \PHP_EOL; |
454
|
|
|
echo '<p>' . \PHP_EOL; |
455
|
|
|
echo '<input type="hidden" name="action" value="createconfig" />' . \PHP_EOL; |
456
|
|
|
echo '<input type="hidden" name="database" value="', \htmlspecialchars($_REQUEST['database']), '" />' . \PHP_EOL; |
457
|
|
|
echo $this->view->form; |
458
|
|
|
echo "<input type=\"submit\" name=\"create\" value=\"{$this->lang['strcreate']}\" />" . \PHP_EOL; |
459
|
|
|
echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . \PHP_EOL; |
460
|
|
|
echo '</p>' . \PHP_EOL; |
461
|
|
|
echo '</form>' . \PHP_EOL; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
/** |
465
|
|
|
* Actually creates the new FTS configuration in the database. |
466
|
|
|
*/ |
467
|
|
|
public function doSaveCreateConfig() |
468
|
|
|
{ |
469
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
470
|
|
|
|
471
|
|
|
$err = ''; |
472
|
|
|
// Check that they've given a name |
473
|
|
|
if ('' === $_POST['formName']) { |
474
|
|
|
$err .= "{$this->lang['strftsconfigneedsname']}<br />"; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
if (('' !== $_POST['formParser']) && ('' !== $_POST['formTemplate'])) { |
478
|
|
|
$err .= "{$this->lang['strftscantparsercopy']}<br />"; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
if ('' !== $err) { |
482
|
|
|
return $this->doCreateConfig($err); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
if ('' !== $_POST['formParser']) { |
486
|
|
|
$formParser = \unserialize($_POST['formParser']); |
487
|
|
|
} else { |
488
|
|
|
$formParser = ''; |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
if ('' !== $_POST['formTemplate']) { |
492
|
|
|
$formTemplate = \unserialize($_POST['formTemplate']); |
493
|
|
|
} else { |
494
|
|
|
$formTemplate = ''; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
$status = $data->createFtsConfiguration($_POST['formName'], $formParser, $formTemplate, $_POST['formComment']); |
498
|
|
|
|
499
|
|
|
if (0 === $status) { |
500
|
|
|
$this->view->setReloadBrowser(true); |
501
|
|
|
$this->doDefault($this->lang['strftsconfigcreated']); |
502
|
|
|
} else { |
503
|
|
|
$this->doCreateConfig($this->lang['strftsconfigcreatedbad']); |
504
|
|
|
} |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Display a form to permit editing FTS configuration properies. |
509
|
|
|
* |
510
|
|
|
* @param mixed $msg |
511
|
|
|
*/ |
512
|
|
|
public function doAlterConfig($msg = ''): void |
513
|
|
|
{ |
514
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
515
|
|
|
|
516
|
|
|
$this->printTrail('ftscfg'); |
517
|
|
|
$this->printTitle($this->lang['stralter'], 'pg.ftscfg.alter'); |
518
|
|
|
$this->printMsg($msg); |
519
|
|
|
|
520
|
|
|
$ftscfg = $data->getFtsConfigurationByName($_REQUEST['ftscfg']); |
521
|
|
|
|
522
|
|
|
if (0 < $ftscfg->recordCount()) { |
523
|
|
|
$this->coalesceArr($_POST, 'formComment', $ftscfg->fields['comment']); |
524
|
|
|
|
525
|
|
|
$this->coalesceArr($_POST, 'ftscfg', $_REQUEST['ftscfg']); |
526
|
|
|
|
527
|
|
|
$this->coalesceArr($_POST, 'formName', $_REQUEST['ftscfg']); |
528
|
|
|
|
529
|
|
|
$this->coalesceArr($_POST, 'formParser', ''); |
530
|
|
|
|
531
|
|
|
// Fetch all FTS parsers from the database |
532
|
|
|
$ftsparsers = $data->getFtsParsers(); |
533
|
|
|
|
534
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
535
|
|
|
echo '<table>' . \PHP_EOL; |
536
|
|
|
|
537
|
|
|
echo "\t<tr>" . \PHP_EOL; |
538
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . \PHP_EOL; |
539
|
|
|
echo "\t\t<td class=\"data1\">"; |
540
|
|
|
echo "\t\t\t<input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
541
|
|
|
\htmlspecialchars($_POST['formName']), '" />' . \PHP_EOL; |
542
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
543
|
|
|
echo "\t</tr>" . \PHP_EOL; |
544
|
|
|
|
545
|
|
|
// Comment |
546
|
|
|
echo "\t<tr>" . \PHP_EOL; |
547
|
|
|
echo "\t\t<th class=\"data\">{$this->lang['strcomment']}</th>" . \PHP_EOL; |
548
|
|
|
echo "\t\t<td class=\"data1\"><textarea cols=\"32\" rows=\"3\"name=\"formComment\">", \htmlspecialchars($_POST['formComment']), '</textarea></td>' . \PHP_EOL; |
549
|
|
|
echo "\t</tr>" . \PHP_EOL; |
550
|
|
|
echo '</table>' . \PHP_EOL; |
551
|
|
|
echo '<p><input type="hidden" name="action" value="alterconfig" />' . \PHP_EOL; |
552
|
|
|
echo '<input type="hidden" name="ftscfg" value="', \htmlspecialchars($_POST['ftscfg']), '" />' . \PHP_EOL; |
553
|
|
|
echo $this->view->form; |
554
|
|
|
echo "<input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />" . \PHP_EOL; |
555
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
556
|
|
|
echo '</form>' . \PHP_EOL; |
557
|
|
|
} else { |
558
|
|
|
echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL; |
559
|
|
|
} |
560
|
|
|
} |
561
|
|
|
|
562
|
|
|
/** |
563
|
|
|
* Save the form submission containing changes to a FTS configuration. |
564
|
|
|
*/ |
565
|
|
|
public function doSaveAlterConfig(): void |
566
|
|
|
{ |
567
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
568
|
|
|
$status = $data->updateFtsConfiguration($_POST['ftscfg'], $_POST['formComment'], $_POST['formName']); |
569
|
|
|
|
570
|
|
|
if (0 === $status) { |
571
|
|
|
$this->doDefault($this->lang['strftsconfigaltered']); |
572
|
|
|
} else { |
573
|
|
|
$this->doAlterConfig($this->lang['strftsconfigalteredbad']); |
574
|
|
|
} |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* View list of FTS parsers. |
579
|
|
|
* |
580
|
|
|
* @param mixed $msg |
581
|
|
|
*/ |
582
|
|
|
public function doViewParsers($msg = ''): void |
583
|
|
|
{ |
584
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
585
|
|
|
|
586
|
|
|
$this->printTrail('schema'); |
587
|
|
|
$this->printTabs('schema', 'fulltext'); |
588
|
|
|
$this->printTabs('fulltext', 'ftsparsers'); |
589
|
|
|
$this->printMsg($msg); |
590
|
|
|
|
591
|
|
|
$parsers = $data->getFtsParsers(false); |
592
|
|
|
|
593
|
|
|
$columns = [ |
594
|
|
|
'schema' => [ |
595
|
|
|
'title' => $this->lang['strschema'], |
596
|
|
|
'field' => Decorator::field('schema'), |
597
|
|
|
], |
598
|
|
|
'name' => [ |
599
|
|
|
'title' => $this->lang['strname'], |
600
|
|
|
'field' => Decorator::field('name'), |
601
|
|
|
], |
602
|
|
|
'comment' => [ |
603
|
|
|
'title' => $this->lang['strcomment'], |
604
|
|
|
'field' => Decorator::field('comment'), |
605
|
|
|
], |
606
|
|
|
]; |
607
|
|
|
|
608
|
|
|
$actions = []; |
609
|
|
|
|
610
|
|
|
echo $this->printTable($parsers, $columns, $actions, 'fulltext-viewparsers', $this->lang['strftsnoparsers']); |
|
|
|
|
611
|
|
|
|
612
|
|
|
//TODO: navlink to "create parser" |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
/** |
616
|
|
|
* View list of FTS dictionaries. |
617
|
|
|
* |
618
|
|
|
* @param mixed $msg |
619
|
|
|
*/ |
620
|
|
|
public function doViewDicts($msg = ''): void |
621
|
|
|
{ |
622
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
623
|
|
|
|
624
|
|
|
$this->printTrail('schema'); |
625
|
|
|
$this->printTabs('schema', 'fulltext'); |
626
|
|
|
$this->printTabs('fulltext', 'ftsdicts'); |
627
|
|
|
$this->printMsg($msg); |
628
|
|
|
|
629
|
|
|
$dicts = $data->getFtsDictionaries(false); |
630
|
|
|
|
631
|
|
|
$columns = [ |
632
|
|
|
'schema' => [ |
633
|
|
|
'title' => $this->lang['strschema'], |
634
|
|
|
'field' => Decorator::field('schema'), |
635
|
|
|
], |
636
|
|
|
'name' => [ |
637
|
|
|
'title' => $this->lang['strname'], |
638
|
|
|
'field' => Decorator::field('name'), |
639
|
|
|
], |
640
|
|
|
'actions' => [ |
641
|
|
|
'title' => $this->lang['stractions'], |
642
|
|
|
], |
643
|
|
|
'comment' => [ |
644
|
|
|
'title' => $this->lang['strcomment'], |
645
|
|
|
'field' => Decorator::field('comment'), |
646
|
|
|
], |
647
|
|
|
]; |
648
|
|
|
|
649
|
|
|
$actions = [ |
650
|
|
|
'drop' => [ |
651
|
|
|
'content' => $this->lang['strdrop'], |
652
|
|
|
'attr' => [ |
653
|
|
|
'href' => [ |
654
|
|
|
'url' => 'fulltext', |
655
|
|
|
'urlvars' => [ |
656
|
|
|
'action' => 'dropdict', |
657
|
|
|
'ftsdict' => Decorator::field('name'), |
658
|
|
|
], |
659
|
|
|
], |
660
|
|
|
], |
661
|
|
|
], |
662
|
|
|
'alter' => [ |
663
|
|
|
'content' => $this->lang['stralter'], |
664
|
|
|
'attr' => [ |
665
|
|
|
'href' => [ |
666
|
|
|
'url' => 'fulltext', |
667
|
|
|
'urlvars' => [ |
668
|
|
|
'action' => 'alterdict', |
669
|
|
|
'ftsdict' => Decorator::field('name'), |
670
|
|
|
], |
671
|
|
|
], |
672
|
|
|
], |
673
|
|
|
], |
674
|
|
|
]; |
675
|
|
|
|
676
|
|
|
echo $this->printTable($dicts, $columns, $actions, 'fulltext-viewdicts', $this->lang['strftsnodicts']); |
|
|
|
|
677
|
|
|
|
678
|
|
|
$navlinks = [ |
679
|
|
|
'createdict' => [ |
680
|
|
|
'attr' => [ |
681
|
|
|
'href' => [ |
682
|
|
|
'url' => 'fulltext', |
683
|
|
|
'urlvars' => [ |
684
|
|
|
'action' => 'createdict', |
685
|
|
|
'server' => $_REQUEST['server'], |
686
|
|
|
'database' => $_REQUEST['database'], |
687
|
|
|
'schema' => $_REQUEST['schema'], |
688
|
|
|
], |
689
|
|
|
], |
690
|
|
|
], |
691
|
|
|
'content' => $this->lang['strftscreatedict'], |
692
|
|
|
], |
693
|
|
|
]; |
694
|
|
|
|
695
|
|
|
$this->printNavLinks($navlinks, 'fulltext-viewdicts', \get_defined_vars()); |
696
|
|
|
} |
697
|
|
|
|
698
|
|
|
/** |
699
|
|
|
* View details of FTS configuration given. |
700
|
|
|
* |
701
|
|
|
* @param mixed $ftscfg |
702
|
|
|
* @param mixed $msg |
703
|
|
|
*/ |
704
|
|
|
public function doViewConfig($ftscfg, $msg = ''): void |
705
|
|
|
{ |
706
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
707
|
|
|
|
708
|
|
|
$this->printTrail('ftscfg'); |
709
|
|
|
$this->printTabs('schema', 'fulltext'); |
710
|
|
|
$this->printTabs('fulltext', 'ftsconfigs'); |
711
|
|
|
$this->printMsg($msg); |
712
|
|
|
|
713
|
|
|
echo "<h3>{$this->lang['strftsconfigmap']}</h3>" . \PHP_EOL; |
714
|
|
|
|
715
|
|
|
$map = $data->getFtsConfigurationMap($ftscfg); |
716
|
|
|
|
717
|
|
|
$columns = [ |
718
|
|
|
'name' => [ |
719
|
|
|
'title' => $this->lang['strftsmapping'], |
720
|
|
|
'field' => Decorator::field('name'), |
721
|
|
|
], |
722
|
|
|
'dictionaries' => [ |
723
|
|
|
'title' => $this->lang['strftsdicts'], |
724
|
|
|
'field' => Decorator::field('dictionaries'), |
725
|
|
|
], |
726
|
|
|
'actions' => [ |
727
|
|
|
'title' => $this->lang['stractions'], |
728
|
|
|
], |
729
|
|
|
'comment' => [ |
730
|
|
|
'title' => $this->lang['strcomment'], |
731
|
|
|
'field' => Decorator::field('description'), |
732
|
|
|
], |
733
|
|
|
]; |
734
|
|
|
|
735
|
|
|
$actions = [ |
736
|
|
|
'drop' => [ |
737
|
|
|
'multiaction' => 'dropmapping', |
738
|
|
|
'content' => $this->lang['strdrop'], |
739
|
|
|
'attr' => [ |
740
|
|
|
'href' => [ |
741
|
|
|
'url' => 'fulltext', |
742
|
|
|
'urlvars' => [ |
743
|
|
|
'action' => 'dropmapping', |
744
|
|
|
'mapping' => Decorator::field('name'), |
745
|
|
|
'ftscfg' => Decorator::field('cfgname'), |
746
|
|
|
], |
747
|
|
|
], |
748
|
|
|
], |
749
|
|
|
], |
750
|
|
|
'alter' => [ |
751
|
|
|
'content' => $this->lang['stralter'], |
752
|
|
|
'attr' => [ |
753
|
|
|
'href' => [ |
754
|
|
|
'url' => 'fulltext', |
755
|
|
|
'urlvars' => [ |
756
|
|
|
'action' => 'altermapping', |
757
|
|
|
'mapping' => Decorator::field('name'), |
758
|
|
|
'ftscfg' => Decorator::field('cfgname'), |
759
|
|
|
], |
760
|
|
|
], |
761
|
|
|
], |
762
|
|
|
], |
763
|
|
|
'multiactions' => [ |
764
|
|
|
'keycols' => ['mapping' => 'name'], |
765
|
|
|
'url' => 'fulltext', |
766
|
|
|
'default' => null, |
767
|
|
|
'vars' => ['ftscfg' => $ftscfg], |
768
|
|
|
], |
769
|
|
|
]; |
770
|
|
|
|
771
|
|
|
echo $this->printTable($map, $columns, $actions, 'fulltext-viewconfig', $this->lang['strftsemptymap']); |
|
|
|
|
772
|
|
|
|
773
|
|
|
$navlinks = [ |
774
|
|
|
'addmapping' => [ |
775
|
|
|
'attr' => [ |
776
|
|
|
'href' => [ |
777
|
|
|
'url' => 'fulltext', |
778
|
|
|
'urlvars' => [ |
779
|
|
|
'action' => 'addmapping', |
780
|
|
|
'server' => $_REQUEST['server'], |
781
|
|
|
'database' => $_REQUEST['database'], |
782
|
|
|
'schema' => $_REQUEST['schema'], |
783
|
|
|
'ftscfg' => $ftscfg, |
784
|
|
|
], |
785
|
|
|
], |
786
|
|
|
], |
787
|
|
|
'content' => $this->lang['strftsaddmapping'], |
788
|
|
|
], |
789
|
|
|
]; |
790
|
|
|
|
791
|
|
|
$this->printNavLinks($navlinks, 'fulltext-viewconfig', \get_defined_vars()); |
792
|
|
|
} |
793
|
|
|
|
794
|
|
|
/** |
795
|
|
|
* Displays a screen where one can enter a details of a new FTS dictionary. |
796
|
|
|
* |
797
|
|
|
* @param mixed $msg |
798
|
|
|
*/ |
799
|
|
|
public function doCreateDict($msg = ''): void |
800
|
|
|
{ |
801
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
802
|
|
|
|
803
|
|
|
$this->coalesceArr($_POST, 'formName', ''); |
804
|
|
|
|
805
|
|
|
$this->coalesceArr($_POST, 'formIsTemplate', false); |
806
|
|
|
|
807
|
|
|
$this->coalesceArr($_POST, 'formTemplate', ''); |
808
|
|
|
|
809
|
|
|
$this->coalesceArr($_POST, 'formLexize', ''); |
810
|
|
|
|
811
|
|
|
$this->coalesceArr($_POST, 'formInit', ''); |
812
|
|
|
|
813
|
|
|
$this->coalesceArr($_POST, 'formOption', ''); |
814
|
|
|
|
815
|
|
|
$this->coalesceArr($_POST, 'formComment', ''); |
816
|
|
|
|
817
|
|
|
// Fetch all FTS dictionaries from the database |
818
|
|
|
$ftstpls = $data->getFtsDictionaryTemplates(); |
819
|
|
|
|
820
|
|
|
$this->printTrail('schema'); |
821
|
|
|
// TODO: create doc links |
822
|
|
|
$this->printTitle($this->lang['strftscreatedict'], 'pg.ftsdict.create'); |
823
|
|
|
$this->printMsg($msg); |
824
|
|
|
|
825
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
826
|
|
|
echo '<table>' . \PHP_EOL; |
827
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . \PHP_EOL; |
828
|
|
|
echo "\t\t<td class=\"data1\"><input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
829
|
|
|
\htmlspecialchars($_POST['formName']), '" /> ', |
830
|
|
|
'<input type="checkbox" name="formIsTemplate" id="formIsTemplate"', $_POST['formIsTemplate'] ? ' checked="checked" ' : '', " />\n", |
831
|
|
|
"<label for=\"formIsTemplate\">{$this->lang['strftscreatedicttemplate']}</label></td>\n\t</tr>" . \PHP_EOL; |
832
|
|
|
|
833
|
|
|
// Template |
834
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftstemplate']}</th>" . \PHP_EOL; |
835
|
|
|
echo "\t\t<td class=\"data1\">"; |
836
|
|
|
$tpls = []; |
837
|
|
|
$tplsel = ''; |
838
|
|
|
|
839
|
|
|
while (!$ftstpls->EOF) { |
840
|
|
|
$data->fieldClean($ftstpls->fields['schema']); |
841
|
|
|
$data->fieldClean($ftstpls->fields['name']); |
842
|
|
|
$tplname = $ftstpls->fields['schema'] . '.' . $ftstpls->fields['name']; |
843
|
|
|
$tpls[$tplname] = \serialize([ |
844
|
|
|
'name' => $ftstpls->fields['name'], |
845
|
|
|
'schema' => $ftstpls->fields['schema'], |
846
|
|
|
]); |
847
|
|
|
|
848
|
|
|
if ($_POST['formTemplate'] === $tpls[$tplname]) { |
849
|
|
|
$tplsel = \htmlspecialchars($tpls[$tplname]); |
850
|
|
|
} |
851
|
|
|
$ftstpls->moveNext(); |
852
|
|
|
} |
853
|
|
|
echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tpls, 'formTemplate', true, $tplsel, false); |
854
|
|
|
echo "\n\t\t</td>\n\t</tr>" . \PHP_EOL; |
855
|
|
|
|
856
|
|
|
// TODO: what about maxlengths? |
857
|
|
|
// Lexize |
858
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftslexize']}</th>" . \PHP_EOL; |
859
|
|
|
echo "\t\t<td class=\"data1\"><input name=\"formLexize\" size=\"32\" maxlength=\"1000\" value=\"", |
860
|
|
|
\htmlspecialchars($_POST['formLexize']), '" ', isset($_POST['formIsTemplate']) ? '' : ' disabled="disabled" ', |
861
|
|
|
"/></td>\n\t</tr>" . \PHP_EOL; |
862
|
|
|
|
863
|
|
|
// Init |
864
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftsinit']}</th>" . \PHP_EOL; |
865
|
|
|
echo "\t\t<td class=\"data1\"><input name=\"formInit\" size=\"32\" maxlength=\"1000\" value=\"", |
866
|
|
|
\htmlspecialchars($_POST['formInit']), '"', $_POST['formIsTemplate'] ? '' : ' disabled="disabled" ', |
867
|
|
|
"/></td>\n\t</tr>" . \PHP_EOL; |
868
|
|
|
|
869
|
|
|
// Option |
870
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strftsoptionsvalues']}</th>" . \PHP_EOL; |
871
|
|
|
echo "\t\t<td class=\"data1\"><input name=\"formOption\" size=\"32\" maxlength=\"1000\" value=\"", |
872
|
|
|
\htmlspecialchars($_POST['formOption']), "\" /></td>\n\t</tr>" . \PHP_EOL; |
873
|
|
|
|
874
|
|
|
// Comment |
875
|
|
|
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strcomment']}</th>" . \PHP_EOL; |
876
|
|
|
echo "\t\t<td class=\"data1\"><textarea name=\"formComment\" rows=\"3\" cols=\"32\">", |
877
|
|
|
\htmlspecialchars($_POST['formComment']), "</textarea></td>\n\t</tr>" . \PHP_EOL; |
878
|
|
|
|
879
|
|
|
echo '</table>' . \PHP_EOL; |
880
|
|
|
echo '<p>' . \PHP_EOL; |
881
|
|
|
echo '<input type="hidden" name="action" value="createdict" />' . \PHP_EOL; |
882
|
|
|
echo '<input type="hidden" name="database" value="', \htmlspecialchars($_REQUEST['database']), '" />' . \PHP_EOL; |
883
|
|
|
echo $this->view->form; |
884
|
|
|
echo "<input type=\"submit\" name=\"create\" value=\"{$this->lang['strcreate']}\" />" . \PHP_EOL; |
885
|
|
|
echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . \PHP_EOL; |
886
|
|
|
echo '</p>' . \PHP_EOL; |
887
|
|
|
echo "</form>\n", |
888
|
|
|
"<script type=\"text/javascript\"> |
889
|
|
|
function templateOpts() { |
890
|
|
|
isTpl = document.getElementsByName('formIsTemplate')[0].checked; |
891
|
|
|
document.getElementsByName('formTemplate')[0].disabled = isTpl; |
892
|
|
|
document.getElementsByName('formOption')[0].disabled = isTpl; |
893
|
|
|
document.getElementsByName('formLexize')[0].disabled = !isTpl; |
894
|
|
|
document.getElementsByName('formInit')[0].disabled = !isTpl; |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
document.getElementsByName('formIsTemplate')[0].onchange = templateOpts; |
898
|
|
|
|
899
|
|
|
templateOpts(); |
900
|
|
|
</script>" . \PHP_EOL; |
901
|
|
|
} |
902
|
|
|
|
903
|
|
|
/** |
904
|
|
|
* Actually creates the new FTS dictionary in the database. |
905
|
|
|
*/ |
906
|
|
|
public function doSaveCreateDict(): void |
907
|
|
|
{ |
908
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
909
|
|
|
|
910
|
|
|
// Check that they've given a name |
911
|
|
|
if ('' === $_POST['formName']) { |
912
|
|
|
$this->doCreateDict($this->lang['strftsdictneedsname']); |
913
|
|
|
} else { |
914
|
|
|
$this->coalesceArr($_POST, 'formIsTemplate', false); |
915
|
|
|
|
916
|
|
|
if (isset($_POST['formTemplate'])) { |
917
|
|
|
$formTemplate = \unserialize($_POST['formTemplate']); |
918
|
|
|
} else { |
919
|
|
|
$formTemplate = ''; |
920
|
|
|
} |
921
|
|
|
|
922
|
|
|
$this->coalesceArr($_POST, 'formLexize', ''); |
923
|
|
|
|
924
|
|
|
$this->coalesceArr($_POST, 'formInit', ''); |
925
|
|
|
|
926
|
|
|
$this->coalesceArr($_POST, 'formOption', ''); |
927
|
|
|
|
928
|
|
|
$status = $data->createFtsDictionary( |
929
|
|
|
$_POST['formName'], |
930
|
|
|
$_POST['formIsTemplate'], |
931
|
|
|
$formTemplate, |
932
|
|
|
$_POST['formLexize'], |
933
|
|
|
$_POST['formInit'], |
934
|
|
|
$_POST['formOption'], |
935
|
|
|
$_POST['formComment'] |
936
|
|
|
); |
937
|
|
|
|
938
|
|
|
if (0 === $status) { |
939
|
|
|
$this->view->setReloadBrowser(true); |
940
|
|
|
$this->doViewDicts($this->lang['strftsdictcreated']); |
941
|
|
|
} else { |
942
|
|
|
$this->doCreateDict($this->lang['strftsdictcreatedbad']); |
943
|
|
|
} |
944
|
|
|
} |
945
|
|
|
} |
946
|
|
|
|
947
|
|
|
/** |
948
|
|
|
* Display a form to permit editing FTS dictionary properies. |
949
|
|
|
* |
950
|
|
|
* @param mixed $msg |
951
|
|
|
*/ |
952
|
|
|
public function doAlterDict($msg = ''): void |
953
|
|
|
{ |
954
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
955
|
|
|
|
956
|
|
|
$this->printTrail('ftscfg'); // TODO: change to smth related to dictionary |
957
|
|
|
$this->printTitle($this->lang['stralter'], 'pg.ftsdict.alter'); |
958
|
|
|
$this->printMsg($msg); |
959
|
|
|
|
960
|
|
|
$ftsdict = $data->getFtsDictionaryByName($_REQUEST['ftsdict']); |
961
|
|
|
|
962
|
|
|
if (0 < $ftsdict->recordCount()) { |
963
|
|
|
$this->coalesceArr($_POST, 'formComment', $ftsdict->fields['comment']); |
964
|
|
|
|
965
|
|
|
$this->coalesceArr($_POST, 'ftsdict', $_REQUEST['ftsdict']); |
966
|
|
|
|
967
|
|
|
$this->coalesceArr($_POST, 'formName', $_REQUEST['ftsdict']); |
968
|
|
|
|
969
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
970
|
|
|
echo '<table>' . \PHP_EOL; |
971
|
|
|
|
972
|
|
|
echo "\t<tr>" . \PHP_EOL; |
973
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . \PHP_EOL; |
974
|
|
|
echo "\t\t<td class=\"data1\">"; |
975
|
|
|
echo "\t\t\t<input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", |
976
|
|
|
\htmlspecialchars($_POST['formName']), '" />' . \PHP_EOL; |
977
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
978
|
|
|
echo "\t</tr>" . \PHP_EOL; |
979
|
|
|
|
980
|
|
|
// Comment |
981
|
|
|
echo "\t<tr>" . \PHP_EOL; |
982
|
|
|
echo "\t\t<th class=\"data\">{$this->lang['strcomment']}</th>" . \PHP_EOL; |
983
|
|
|
echo "\t\t<td class=\"data1\"><textarea cols=\"32\" rows=\"3\"name=\"formComment\">", \htmlspecialchars($_POST['formComment']), '</textarea></td>' . \PHP_EOL; |
984
|
|
|
echo "\t</tr>" . \PHP_EOL; |
985
|
|
|
echo '</table>' . \PHP_EOL; |
986
|
|
|
echo '<p><input type="hidden" name="action" value="alterdict" />' . \PHP_EOL; |
987
|
|
|
echo '<input type="hidden" name="ftsdict" value="', \htmlspecialchars($_POST['ftsdict']), '" />' . \PHP_EOL; |
988
|
|
|
echo '<input type="hidden" name="prev_action" value="viewdicts" /></p>' . \PHP_EOL; |
989
|
|
|
echo $this->view->form; |
990
|
|
|
echo "<input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />" . \PHP_EOL; |
991
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
992
|
|
|
echo '</form>' . \PHP_EOL; |
993
|
|
|
} else { |
994
|
|
|
echo "<p>{$this->lang['strnodata']}</p>" . \PHP_EOL; |
995
|
|
|
} |
996
|
|
|
} |
997
|
|
|
|
998
|
|
|
/** |
999
|
|
|
* Save the form submission containing changes to a FTS dictionary. |
1000
|
|
|
*/ |
1001
|
|
|
public function doSaveAlterDict(): void |
1002
|
|
|
{ |
1003
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1004
|
|
|
|
1005
|
|
|
$status = $data->updateFtsDictionary($_POST['ftsdict'], $_POST['formComment'], $_POST['formName']); |
1006
|
|
|
|
1007
|
|
|
if (0 === $status) { |
1008
|
|
|
$this->doViewDicts($this->lang['strftsdictaltered']); |
1009
|
|
|
} else { |
1010
|
|
|
$this->doAlterDict($this->lang['strftsdictalteredbad']); |
1011
|
|
|
} |
1012
|
|
|
} |
1013
|
|
|
|
1014
|
|
|
/** |
1015
|
|
|
* Show confirmation of drop and perform actual drop of FTS mapping. |
1016
|
|
|
* |
1017
|
|
|
* @param mixed $confirm |
1018
|
|
|
*/ |
1019
|
|
|
public function doDropMapping($confirm): void |
1020
|
|
|
{ |
1021
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1022
|
|
|
|
1023
|
|
|
if (empty($_REQUEST['mapping']) && empty($_REQUEST['ma'])) { |
1024
|
|
|
$this->doDefault($this->lang['strftsspecifymappingtodrop']); |
1025
|
|
|
|
1026
|
|
|
return; |
1027
|
|
|
} |
1028
|
|
|
|
1029
|
|
|
if (empty($_REQUEST['ftscfg'])) { |
1030
|
|
|
$this->doDefault($this->lang['strftsspecifyconfigtoalter']); |
1031
|
|
|
|
1032
|
|
|
return; |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
if ($confirm) { |
1036
|
|
|
$this->printTrail('ftscfg'); // TODO: proper breadcrumbs |
1037
|
|
|
$this->printTitle($this->lang['strdrop'], 'pg.ftscfg.alter'); |
1038
|
|
|
|
1039
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
1040
|
|
|
|
1041
|
|
|
// Case of multiaction drop |
1042
|
|
|
if (isset($_REQUEST['ma'])) { |
1043
|
|
|
foreach ($_REQUEST['ma'] as $v) { |
1044
|
|
|
$a = \unserialize(\htmlspecialchars_decode($v, \ENT_QUOTES)); |
1045
|
|
|
echo '<p>', \sprintf($this->lang['strconfdropftsmapping'], $this->misc->printVal($a['mapping']), $this->misc->printVal($_REQUEST['ftscfg'])), '</p>' . \PHP_EOL; |
1046
|
|
|
\printf('<input type="hidden" name="mapping[]" value="%s" />', \htmlspecialchars($a['mapping'])); |
1047
|
|
|
} |
1048
|
|
|
} else { |
1049
|
|
|
echo '<p>', \sprintf($this->lang['strconfdropftsmapping'], $this->misc->printVal($_REQUEST['mapping']), $this->misc->printVal($_REQUEST['ftscfg'])), '</p>' . \PHP_EOL; |
1050
|
|
|
echo '<input type="hidden" name="mapping" value="', \htmlspecialchars($_REQUEST['mapping']), '" />' . \PHP_EOL; |
1051
|
|
|
} |
1052
|
|
|
|
1053
|
|
|
echo "<input type=\"hidden\" name=\"ftscfg\" value=\"{$_REQUEST['ftscfg']}\" />" . \PHP_EOL; |
1054
|
|
|
echo '<input type="hidden" name="action" value="dropmapping" />' . \PHP_EOL; |
1055
|
|
|
echo '<input type="hidden" name="prev_action" value="viewconfig" /></p>' . \PHP_EOL; |
1056
|
|
|
echo $this->view->form; |
1057
|
|
|
echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />" . \PHP_EOL; |
1058
|
|
|
echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . \PHP_EOL; |
1059
|
|
|
echo '</form>' . \PHP_EOL; |
1060
|
|
|
} else { |
1061
|
|
|
// Case of multiaction drop |
1062
|
|
|
if (\is_array($_REQUEST['mapping'])) { |
1063
|
|
|
$status = $data->changeFtsMapping($_REQUEST['ftscfg'], $_REQUEST['mapping'], 'drop'); |
1064
|
|
|
|
1065
|
|
|
if (0 !== $status) { |
1066
|
|
|
$this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']); |
1067
|
|
|
|
1068
|
|
|
return; |
1069
|
|
|
} |
1070
|
|
|
$this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdropped']); |
1071
|
|
|
} else { |
1072
|
|
|
$status = $data->changeFtsMapping($_REQUEST['ftscfg'], [$_REQUEST['mapping']], 'drop'); |
1073
|
|
|
|
1074
|
|
|
if (0 === $status) { |
1075
|
|
|
$this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdropped']); |
1076
|
|
|
} else { |
1077
|
|
|
$this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']); |
1078
|
|
|
} |
1079
|
|
|
} |
1080
|
|
|
} |
1081
|
|
|
} |
1082
|
|
|
|
1083
|
|
|
public function doAlterMapping($msg = ''): void |
1084
|
|
|
{ |
1085
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1086
|
|
|
$this->printTrail('ftscfg'); |
1087
|
|
|
$this->printTitle($this->lang['stralter'], 'pg.ftscfg.alter'); |
1088
|
|
|
$this->printMsg($msg); |
1089
|
|
|
|
1090
|
|
|
$ftsdicts = $data->getFtsDictionaries(); |
1091
|
|
|
|
1092
|
|
|
if (0 < $ftsdicts->recordCount()) { |
1093
|
|
|
$this->coalesceArr($_POST, 'formMapping', $_REQUEST['mapping']); |
1094
|
|
|
|
1095
|
|
|
$this->coalesceArr($_POST, 'formDictionary', ''); |
1096
|
|
|
|
1097
|
|
|
$this->coalesceArr($_POST, 'ftscfg', $_REQUEST['ftscfg']); |
1098
|
|
|
|
1099
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
1100
|
|
|
|
1101
|
|
|
echo '<table>' . \PHP_EOL; |
1102
|
|
|
echo "\t<tr>" . \PHP_EOL; |
1103
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strftsmapping']}</th>" . \PHP_EOL; |
1104
|
|
|
echo "\t\t<td class=\"data1\">"; |
1105
|
|
|
|
1106
|
|
|
$ma_mappings = []; |
1107
|
|
|
// Case of multiaction drop |
1108
|
|
|
if (isset($_REQUEST['ma'])) { |
1109
|
|
|
$ma_mappings_names = []; |
1110
|
|
|
|
1111
|
|
|
foreach ($_REQUEST['ma'] as $v) { |
1112
|
|
|
$a = \unserialize(\htmlspecialchars_decode($v, \ENT_QUOTES)); |
1113
|
|
|
\printf('<input type="hidden" name="formMapping[]" value="%s" />', \htmlspecialchars($a['mapping'])); |
1114
|
|
|
$ma_mappings[] = $data->getFtsMappingByName($_POST['ftscfg'], $a['mapping']); |
1115
|
|
|
$ma_mappings_names[] = $a['mapping']; |
1116
|
|
|
} |
1117
|
|
|
echo \implode(', ', $ma_mappings_names); |
1118
|
|
|
} else { |
1119
|
|
|
$mapping = $data->getFtsMappingByName($_POST['ftscfg'], $_POST['formMapping']); |
1120
|
|
|
echo $mapping->fields['name']; |
1121
|
|
|
echo '<input type="hidden" name="formMapping" value="', \htmlspecialchars($_POST['formMapping']), '" />' . \PHP_EOL; |
1122
|
|
|
} |
1123
|
|
|
|
1124
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
1125
|
|
|
echo "\t</tr>" . \PHP_EOL; |
1126
|
|
|
|
1127
|
|
|
// Dictionary |
1128
|
|
|
echo "\t<tr>" . \PHP_EOL; |
1129
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strftsdict']}</th>" . \PHP_EOL; |
1130
|
|
|
echo "\t\t<td class=\"data1\">"; |
1131
|
|
|
echo "\t\t\t<select name=\"formDictionary\">" . \PHP_EOL; |
1132
|
|
|
|
1133
|
|
|
while (!$ftsdicts->EOF) { |
1134
|
|
|
$ftsdict = \htmlspecialchars($ftsdicts->fields['name']); |
1135
|
|
|
echo "\t\t\t\t<option value=\"{$ftsdict}\"", |
1136
|
|
|
( |
1137
|
|
|
$ftsdict === $_POST['formDictionary'] |
1138
|
|
|
|| $ftsdict === $mapping->fields['dictionaries'] |
1139
|
|
|
|| $ftsdict === $ma_mappings[0]->fields['dictionaries'] |
1140
|
|
|
) ? ' selected="selected"' : '', ">{$ftsdict}</option>" . \PHP_EOL; |
1141
|
|
|
$ftsdicts->moveNext(); |
1142
|
|
|
} |
1143
|
|
|
|
1144
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
1145
|
|
|
echo "\t</tr>" . \PHP_EOL; |
1146
|
|
|
|
1147
|
|
|
echo '</table>' . \PHP_EOL; |
1148
|
|
|
echo '<p><input type="hidden" name="action" value="altermapping" />' . \PHP_EOL; |
1149
|
|
|
echo '<input type="hidden" name="ftscfg" value="', \htmlspecialchars($_POST['ftscfg']), '" />' . \PHP_EOL; |
1150
|
|
|
echo '<input type="hidden" name="prev_action" value="viewconfig" /></p>' . \PHP_EOL; |
1151
|
|
|
|
1152
|
|
|
echo $this->view->form; |
1153
|
|
|
echo "<input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />" . \PHP_EOL; |
1154
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
1155
|
|
|
echo '</form>' . \PHP_EOL; |
1156
|
|
|
} else { |
1157
|
|
|
echo "<p>{$this->lang['strftsnodictionaries']}</p>" . \PHP_EOL; |
1158
|
|
|
} |
1159
|
|
|
} |
1160
|
|
|
|
1161
|
|
|
/** |
1162
|
|
|
* Save the form submission containing changes to a FTS mapping. |
1163
|
|
|
*/ |
1164
|
|
|
public function doSaveAlterMapping(): void |
1165
|
|
|
{ |
1166
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1167
|
|
|
|
1168
|
|
|
$mappingArray = (\is_array($_POST['formMapping']) ? $_POST['formMapping'] : [$_POST['formMapping']]); |
1169
|
|
|
$status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'alter', $_POST['formDictionary']); |
1170
|
|
|
|
1171
|
|
|
if (0 === $status) { |
1172
|
|
|
$this->doViewConfig($_POST['ftscfg'], $this->lang['strftsmappingaltered']); |
1173
|
|
|
} else { |
1174
|
|
|
$this->doAlterMapping($this->lang['strftsmappingalteredbad']); |
1175
|
|
|
} |
1176
|
|
|
} |
1177
|
|
|
|
1178
|
|
|
/** |
1179
|
|
|
* Show the form to enter parameters of a new FTS mapping. |
1180
|
|
|
* |
1181
|
|
|
* @param mixed $msg |
1182
|
|
|
*/ |
1183
|
|
|
public function doAddMapping($msg = ''): void |
1184
|
|
|
{ |
1185
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1186
|
|
|
|
1187
|
|
|
$this->printTrail('ftscfg'); |
1188
|
|
|
$this->printTitle($this->lang['stralter'], 'pg.ftscfg.alter'); |
1189
|
|
|
$this->printMsg($msg); |
1190
|
|
|
|
1191
|
|
|
$ftsdicts = $data->getFtsDictionaries(); |
1192
|
|
|
|
1193
|
|
|
if (0 < $ftsdicts->recordCount()) { |
1194
|
|
|
$this->coalesceArr($_POST, 'formMapping', ''); |
1195
|
|
|
|
1196
|
|
|
$this->coalesceArr($_POST, 'formDictionary', ''); |
1197
|
|
|
|
1198
|
|
|
$this->coalesceArr($_POST, 'ftscfg', $_REQUEST['ftscfg']); |
1199
|
|
|
|
1200
|
|
|
$mappings = $data->getFtsMappings($_POST['ftscfg']); |
1201
|
|
|
|
1202
|
|
|
echo '<form action="' . \containerInstance()->subFolder . '/src/views/fulltext" method="post">' . \PHP_EOL; |
1203
|
|
|
echo '<table>' . \PHP_EOL; |
1204
|
|
|
echo "\t<tr>" . \PHP_EOL; |
1205
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strftsmapping']}</th>" . \PHP_EOL; |
1206
|
|
|
echo "\t\t<td class=\"data1\">"; |
1207
|
|
|
echo "\t\t\t<select name=\"formMapping\">" . \PHP_EOL; |
1208
|
|
|
|
1209
|
|
|
while (!$mappings->EOF) { |
1210
|
|
|
$mapping = \htmlspecialchars($mappings->fields['name']); |
1211
|
|
|
$mapping_desc = \htmlspecialchars($mappings->fields['description']); |
1212
|
|
|
echo "\t\t\t\t<option value=\"{$mapping}\"", |
1213
|
|
|
$mapping === $_POST['formMapping'] ? ' selected="selected"' : '', ">{$mapping}", $mapping_desc ? " - {$mapping_desc}" : '', '</option>' . \PHP_EOL; |
1214
|
|
|
$mappings->moveNext(); |
1215
|
|
|
} |
1216
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
1217
|
|
|
echo "\t</tr>" . \PHP_EOL; |
1218
|
|
|
|
1219
|
|
|
// Dictionary |
1220
|
|
|
echo "\t<tr>" . \PHP_EOL; |
1221
|
|
|
echo "\t\t<th class=\"data left required\">{$this->lang['strftsdict']}</th>" . \PHP_EOL; |
1222
|
|
|
echo "\t\t<td class=\"data1\">"; |
1223
|
|
|
echo "\t\t\t<select name=\"formDictionary\">" . \PHP_EOL; |
1224
|
|
|
|
1225
|
|
|
while (!$ftsdicts->EOF) { |
1226
|
|
|
$ftsdict = \htmlspecialchars($ftsdicts->fields['name']); |
1227
|
|
|
echo "\t\t\t\t<option value=\"{$ftsdict}\"", |
1228
|
|
|
$ftsdict === $_POST['formDictionary'] ? ' selected="selected"' : '', ">{$ftsdict}</option>" . \PHP_EOL; |
1229
|
|
|
$ftsdicts->moveNext(); |
1230
|
|
|
} |
1231
|
|
|
|
1232
|
|
|
echo "\t\t</td>" . \PHP_EOL; |
1233
|
|
|
echo "\t</tr>" . \PHP_EOL; |
1234
|
|
|
|
1235
|
|
|
echo '</table>' . \PHP_EOL; |
1236
|
|
|
echo '<p><input type="hidden" name="action" value="addmapping" />' . \PHP_EOL; |
1237
|
|
|
echo '<input type="hidden" name="ftscfg" value="', \htmlspecialchars($_POST['ftscfg']), '" />' . \PHP_EOL; |
1238
|
|
|
echo '<input type="hidden" name="prev_action" value="viewconfig" /></p>' . \PHP_EOL; |
1239
|
|
|
echo $this->view->form; |
1240
|
|
|
echo "<input type=\"submit\" name=\"add\" value=\"{$this->lang['stradd']}\" />" . \PHP_EOL; |
1241
|
|
|
echo \sprintf('<input type="submit" name="cancel" value="%s" /></p>%s', $this->lang['strcancel'], \PHP_EOL); |
1242
|
|
|
echo '</form>' . \PHP_EOL; |
1243
|
|
|
} else { |
1244
|
|
|
echo "<p>{$this->lang['strftsnodictionaries']}</p>" . \PHP_EOL; |
1245
|
|
|
} |
1246
|
|
|
} |
1247
|
|
|
|
1248
|
|
|
/** |
1249
|
|
|
* Save the form submission containing parameters of a new FTS mapping. |
1250
|
|
|
*/ |
1251
|
|
|
public function doSaveAddMapping(): void |
1252
|
|
|
{ |
1253
|
|
|
$data = $this->misc->getDatabaseAccessor(); |
1254
|
|
|
|
1255
|
|
|
$mappingArray = (\is_array($_POST['formMapping']) ? $_POST['formMapping'] : [$_POST['formMapping']]); |
1256
|
|
|
$status = $data->changeFtsMapping($_POST['ftscfg'], $mappingArray, 'add', $_POST['formDictionary']); |
1257
|
|
|
|
1258
|
|
|
if (0 === $status) { |
1259
|
|
|
$this->doViewConfig($_POST['ftscfg'], $this->lang['strftsmappingadded']); |
1260
|
|
|
} else { |
1261
|
|
|
$this->doAddMapping($this->lang['strftsmappingaddedbad']); |
1262
|
|
|
} |
1263
|
|
|
} |
1264
|
|
|
} |
1265
|
|
|
|