1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* PHPPgAdmin v6.0.0-beta.43 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\Traits; |
8
|
|
|
|
9
|
|
|
use PHPPgAdmin\Decorators\Decorator; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @file |
13
|
|
|
* A trait to deal with nav tabs |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* A trait to deal with nav tabs |
18
|
|
|
* |
19
|
|
|
* @package PHPPgAdmin |
20
|
|
|
*/ |
21
|
|
|
trait MiscTrait |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
public function getSubjectParams($subject) |
25
|
|
|
{ |
26
|
|
|
$plugin_manager = $this->plugin_manager; |
27
|
|
|
|
28
|
|
|
$vars = []; |
29
|
|
|
|
30
|
|
|
switch ($subject) { |
31
|
|
|
case 'root': |
32
|
|
|
$vars = [ |
33
|
|
|
'params' => [ |
34
|
|
|
'subject' => 'root', |
35
|
|
|
], |
36
|
|
|
]; |
37
|
|
|
|
38
|
|
|
break; |
39
|
|
|
case 'server': |
40
|
|
|
$vars = ['params' => [ |
41
|
|
|
'server' => $_REQUEST['server'], |
42
|
|
|
'subject' => 'server', |
43
|
|
|
]]; |
44
|
|
|
|
45
|
|
|
break; |
46
|
|
|
case 'role': |
47
|
|
|
$vars = ['params' => [ |
48
|
|
|
'server' => $_REQUEST['server'], |
49
|
|
|
'subject' => 'role', |
50
|
|
|
'action' => 'properties', |
51
|
|
|
'rolename' => $_REQUEST['rolename'], |
52
|
|
|
]]; |
53
|
|
|
|
54
|
|
|
break; |
55
|
|
|
case 'database': |
56
|
|
|
$vars = ['params' => [ |
57
|
|
|
'server' => $_REQUEST['server'], |
58
|
|
|
'subject' => 'database', |
59
|
|
|
'database' => $_REQUEST['database'], |
60
|
|
|
]]; |
61
|
|
|
|
62
|
|
|
break; |
63
|
|
|
case 'schema': |
64
|
|
|
$vars = ['params' => [ |
65
|
|
|
'server' => $_REQUEST['server'], |
66
|
|
|
'subject' => 'schema', |
67
|
|
|
'database' => $_REQUEST['database'], |
68
|
|
|
'schema' => $_REQUEST['schema'], |
69
|
|
|
]]; |
70
|
|
|
|
71
|
|
|
break; |
72
|
|
|
case 'table': |
73
|
|
|
$vars = ['params' => [ |
74
|
|
|
'server' => $_REQUEST['server'], |
75
|
|
|
'subject' => 'table', |
76
|
|
|
'database' => $_REQUEST['database'], |
77
|
|
|
'schema' => $_REQUEST['schema'], |
78
|
|
|
'table' => $_REQUEST['table'], |
79
|
|
|
]]; |
80
|
|
|
|
81
|
|
|
break; |
82
|
|
|
case 'selectrows': |
83
|
|
|
$vars = [ |
84
|
|
|
'url' => 'tables', |
85
|
|
|
'params' => [ |
86
|
|
|
'server' => $_REQUEST['server'], |
87
|
|
|
'subject' => 'table', |
88
|
|
|
'database' => $_REQUEST['database'], |
89
|
|
|
'schema' => $_REQUEST['schema'], |
90
|
|
|
'table' => $_REQUEST['table'], |
91
|
|
|
'action' => 'confselectrows', |
92
|
|
|
]]; |
93
|
|
|
|
94
|
|
|
break; |
95
|
|
|
case 'view': |
96
|
|
|
$vars = ['params' => [ |
97
|
|
|
'server' => $_REQUEST['server'], |
98
|
|
|
'subject' => 'view', |
99
|
|
|
'database' => $_REQUEST['database'], |
100
|
|
|
'schema' => $_REQUEST['schema'], |
101
|
|
|
'view' => $_REQUEST['view'], |
102
|
|
|
]]; |
103
|
|
|
|
104
|
|
|
break; |
105
|
|
|
case 'matview': |
106
|
|
|
$vars = ['params' => [ |
107
|
|
|
'server' => $_REQUEST['server'], |
108
|
|
|
'subject' => 'matview', |
109
|
|
|
'database' => $_REQUEST['database'], |
110
|
|
|
'schema' => $_REQUEST['schema'], |
111
|
|
|
'matview' => $_REQUEST['matview'], |
112
|
|
|
]]; |
113
|
|
|
|
114
|
|
|
break; |
115
|
|
|
case 'fulltext': |
116
|
|
|
case 'ftscfg': |
117
|
|
|
$vars = ['params' => [ |
118
|
|
|
'server' => $_REQUEST['server'], |
119
|
|
|
'subject' => 'fulltext', |
120
|
|
|
'database' => $_REQUEST['database'], |
121
|
|
|
'schema' => $_REQUEST['schema'], |
122
|
|
|
'action' => 'viewconfig', |
123
|
|
|
'ftscfg' => $_REQUEST['ftscfg'], |
124
|
|
|
]]; |
125
|
|
|
|
126
|
|
|
break; |
127
|
|
|
case 'function': |
128
|
|
|
$vars = ['params' => [ |
129
|
|
|
'server' => $_REQUEST['server'], |
130
|
|
|
'subject' => 'function', |
131
|
|
|
'database' => $_REQUEST['database'], |
132
|
|
|
'schema' => $_REQUEST['schema'], |
133
|
|
|
'function' => $_REQUEST['function'], |
134
|
|
|
'function_oid' => $_REQUEST['function_oid'], |
135
|
|
|
]]; |
136
|
|
|
|
137
|
|
|
break; |
138
|
|
|
case 'aggregate': |
139
|
|
|
$vars = ['params' => [ |
140
|
|
|
'server' => $_REQUEST['server'], |
141
|
|
|
'subject' => 'aggregate', |
142
|
|
|
'action' => 'properties', |
143
|
|
|
'database' => $_REQUEST['database'], |
144
|
|
|
'schema' => $_REQUEST['schema'], |
145
|
|
|
'aggrname' => $_REQUEST['aggrname'], |
146
|
|
|
'aggrtype' => $_REQUEST['aggrtype'], |
147
|
|
|
]]; |
148
|
|
|
|
149
|
|
|
break; |
150
|
|
|
case 'column': |
151
|
|
|
if (isset($_REQUEST['table'])) { |
152
|
|
|
$vars = ['params' => [ |
153
|
|
|
'server' => $_REQUEST['server'], |
154
|
|
|
'subject' => 'column', |
155
|
|
|
'database' => $_REQUEST['database'], |
156
|
|
|
'schema' => $_REQUEST['schema'], |
157
|
|
|
'table' => $_REQUEST['table'], |
158
|
|
|
'column' => $_REQUEST['column'], |
159
|
|
|
]]; |
160
|
|
|
} else { |
161
|
|
|
$vars = ['params' => [ |
162
|
|
|
'server' => $_REQUEST['server'], |
163
|
|
|
'subject' => 'column', |
164
|
|
|
'database' => $_REQUEST['database'], |
165
|
|
|
'schema' => $_REQUEST['schema'], |
166
|
|
|
'view' => $_REQUEST['view'], |
167
|
|
|
'column' => $_REQUEST['column'], |
168
|
|
|
]]; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
break; |
172
|
|
|
case 'plugin': |
173
|
|
|
$vars = [ |
174
|
|
|
'url' => 'plugin', |
175
|
|
|
'params' => [ |
176
|
|
|
'server' => $_REQUEST['server'], |
177
|
|
|
'subject' => 'plugin', |
178
|
|
|
'plugin' => $_REQUEST['plugin'], |
179
|
|
|
]]; |
180
|
|
|
|
181
|
|
|
if (!is_null($plugin_manager->getPlugin($_REQUEST['plugin']))) { |
182
|
|
|
$vars['params'] = array_merge($vars['params'], $plugin_manager->getPlugin($_REQUEST['plugin'])->get_subject_params()); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
break; |
186
|
|
|
default: |
187
|
|
|
return false; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
if (!isset($vars['url'])) { |
191
|
|
|
$vars['url'] = SUBFOLDER . '/redirect'; |
192
|
|
|
} |
193
|
|
|
if ($vars['url'] == SUBFOLDER . '/redirect' && isset($vars['params']['subject'])) { |
194
|
|
|
$vars['url'] = SUBFOLDER . '/redirect/' . $vars['params']['subject']; |
195
|
|
|
unset($vars['params']['subject']); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
return $vars; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Render a value into HTML using formatting rules specified |
203
|
|
|
* by a type name and parameters. |
204
|
|
|
* |
205
|
|
|
* @param string $str The string to change |
206
|
|
|
* @param string $type Field type (optional), this may be an internal PostgreSQL type, or: |
207
|
|
|
* yesno - same as bool, but renders as 'Yes' or 'No'. |
208
|
|
|
* pre - render in a <pre> block. |
209
|
|
|
* nbsp - replace all spaces with 's |
210
|
|
|
* verbatim - render exactly as supplied, no escaping what-so-ever. |
211
|
|
|
* callback - render using a callback function supplied in the 'function' param. |
212
|
|
|
* @param array $params Type parameters (optional), known parameters: |
213
|
|
|
* null - string to display if $str is null, or set to TRUE to use a default 'NULL' string, |
214
|
|
|
* otherwise nothing is rendered. |
215
|
|
|
* clip - if true, clip the value to a fixed length, and append an ellipsis... |
216
|
|
|
* cliplen - the maximum length when clip is enabled (defaults to $conf['max_chars']) |
217
|
|
|
* ellipsis - the string to append to a clipped value (defaults to $lang['strellipsis']) |
218
|
|
|
* tag - an HTML element name to surround the value. |
219
|
|
|
* class - a class attribute to apply to any surrounding HTML element. |
220
|
|
|
* align - an align attribute ('left','right','center' etc.) |
221
|
|
|
* true - (type='bool') the representation of true. |
222
|
|
|
* false - (type='bool') the representation of false. |
223
|
|
|
* function - (type='callback') a function name, accepts args ($str, $params) and returns a rendering. |
224
|
|
|
* lineno - prefix each line with a line number. |
225
|
|
|
* map - an associative array. |
226
|
|
|
* |
227
|
|
|
* @return string The HTML rendered value |
228
|
|
|
*/ |
229
|
|
|
public function printVal($str, $type = null, $params = []) |
230
|
|
|
{ |
231
|
|
|
$lang = $this->lang; |
232
|
|
|
$data = $this->getDatabaseAccessor(); |
|
|
|
|
233
|
|
|
|
234
|
|
|
// Shortcircuit for a NULL value |
235
|
|
|
if (!$str) { |
236
|
|
|
return isset($params['null']) |
237
|
|
|
? ($params['null'] === true ? '<i>NULL</i>' : $params['null']) |
238
|
|
|
: ''; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
if (isset($params['map'], $params['map'][$str])) { |
242
|
|
|
$str = $params['map'][$str]; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
// Clip the value if the 'clip' parameter is true. |
246
|
|
|
if (isset($params['clip']) && $params['clip'] === true) { |
247
|
|
|
$maxlen = isset($params['cliplen']) && is_integer($params['cliplen']) ? $params['cliplen'] : $this->conf['max_chars']; |
248
|
|
|
$ellipsis = isset($params['ellipsis']) ? $params['ellipsis'] : $lang['strellipsis']; |
249
|
|
|
if (strlen($str) > $maxlen) { |
250
|
|
|
$str = substr($str, 0, $maxlen - 1) . $ellipsis; |
251
|
|
|
} |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
$out = ''; |
255
|
|
|
$class = ''; |
256
|
|
|
|
257
|
|
|
switch ($type) { |
258
|
|
|
case 'int2': |
259
|
|
|
case 'int4': |
260
|
|
|
case 'int8': |
261
|
|
|
case 'float4': |
262
|
|
|
case 'float8': |
263
|
|
|
case 'money': |
264
|
|
|
case 'numeric': |
265
|
|
|
case 'oid': |
266
|
|
|
case 'xid': |
267
|
|
|
case 'cid': |
268
|
|
|
case 'tid': |
269
|
|
|
$align = 'right'; |
270
|
|
|
$out = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
271
|
|
|
|
272
|
|
|
break; |
273
|
|
|
case 'yesno': |
274
|
|
|
if (!isset($params['true'])) { |
275
|
|
|
$params['true'] = $lang['stryes']; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
if (!isset($params['false'])) { |
279
|
|
|
$params['false'] = $lang['strno']; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
// no break - fall through to boolean case. |
283
|
|
|
case 'bool': |
284
|
|
|
case 'boolean': |
285
|
|
|
if (is_bool($str)) { |
286
|
|
|
$str = $str ? 't' : 'f'; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
switch ($str) { |
290
|
|
|
case 't': |
291
|
|
|
$out = (isset($params['true']) ? $params['true'] : $lang['strtrue']); |
292
|
|
|
$align = 'center'; |
293
|
|
|
|
294
|
|
|
break; |
295
|
|
|
case 'f': |
296
|
|
|
$out = (isset($params['false']) ? $params['false'] : $lang['strfalse']); |
297
|
|
|
$align = 'center'; |
298
|
|
|
|
299
|
|
|
break; |
300
|
|
|
default: |
301
|
|
|
$out = htmlspecialchars($str); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
break; |
305
|
|
|
case 'bytea': |
306
|
|
|
$tag = 'div'; |
307
|
|
|
$class = 'pre'; |
308
|
|
|
$out = $data->escapeBytea($str); |
309
|
|
|
|
310
|
|
|
break; |
311
|
|
|
case 'errormsg': |
312
|
|
|
$tag = 'pre'; |
313
|
|
|
$class = 'error'; |
314
|
|
|
$out = htmlspecialchars($str); |
315
|
|
|
|
316
|
|
|
break; |
317
|
|
|
case 'pre': |
318
|
|
|
$tag = 'pre'; |
319
|
|
|
$out = htmlspecialchars($str); |
320
|
|
|
|
321
|
|
|
break; |
322
|
|
|
case 'prenoescape': |
323
|
|
|
$tag = 'pre'; |
324
|
|
|
$out = $str; |
325
|
|
|
|
326
|
|
|
break; |
327
|
|
|
case 'nbsp': |
328
|
|
|
$out = nl2br(str_replace(' ', ' ', \PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
329
|
|
|
|
330
|
|
|
break; |
331
|
|
|
case 'verbatim': |
332
|
|
|
$out = $str; |
333
|
|
|
|
334
|
|
|
break; |
335
|
|
|
case 'callback': |
336
|
|
|
$out = $params['function']($str, $params); |
337
|
|
|
|
338
|
|
|
break; |
339
|
|
|
case 'prettysize': |
340
|
|
|
if ($str == -1) { |
341
|
|
|
$out = $lang['strnoaccess']; |
342
|
|
|
} else { |
343
|
|
|
$out = \PHPPgAdmin\Traits\HelperTrait::formatSizeUnits($str, $lang); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
break; |
347
|
|
|
default: |
348
|
|
|
// If the string contains at least one instance of >1 space in a row, a tab |
349
|
|
|
// character, a space at the start of a line, or a space at the start of |
350
|
|
|
// the whole string then render within a pre-formatted element (<pre>). |
351
|
|
|
if (preg_match('/(^ | |\t|\n )/m', $str)) { |
352
|
|
|
$tag = 'pre'; |
353
|
|
|
$class = 'data'; |
354
|
|
|
$out = htmlspecialchars($str); |
355
|
|
|
} else { |
356
|
|
|
$tag = 'span'; |
357
|
|
|
$out = nl2br(htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($str))); |
358
|
|
|
} |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
if (isset($params['class'])) { |
362
|
|
|
$class = $params['class']; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
if (isset($params['align'])) { |
366
|
|
|
$align = $params['align']; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
if (!isset($tag) && (!empty($class) || isset($align))) { |
370
|
|
|
$tag = 'div'; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
if (isset($tag)) { |
374
|
|
|
$alignattr = isset($align) ? " style=\"text-align: {$align}\"" : ''; |
375
|
|
|
$classattr = !empty($class) ? " class=\"{$class}\"" : ''; |
376
|
|
|
$out = "<{$tag}{$alignattr}{$classattr}>{$out}</{$tag}>"; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
// Add line numbers if 'lineno' param is true |
380
|
|
|
if (isset($params['lineno']) && $params['lineno'] === true) { |
381
|
|
|
$lines = explode("\n", $str); |
382
|
|
|
$num = count($lines); |
383
|
|
|
if ($num > 0) { |
384
|
|
|
$temp = "<table>\n<tr><td class=\"{$class}\" style=\"vertical-align: top; padding-right: 10px;\"><pre class=\"{$class}\">"; |
385
|
|
|
for ($i = 1; $i <= $num; ++$i) { |
386
|
|
|
$temp .= $i . "\n"; |
387
|
|
|
} |
388
|
|
|
$temp .= "</pre></td><td class=\"{$class}\" style=\"vertical-align: top;\">{$out}</td></tr></table>\n"; |
389
|
|
|
$out = $temp; |
390
|
|
|
} |
391
|
|
|
unset($lines); |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
return $out; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* Retrieve the tab info for a specific tab bar. |
399
|
|
|
* |
400
|
|
|
* @param string $section the name of the tab bar |
401
|
|
|
* |
402
|
|
|
* @return array array of tabs |
403
|
|
|
*/ |
404
|
|
|
public function getNavTabs($section) |
405
|
|
|
{ |
406
|
|
|
$data = $this->getDatabaseAccessor(); |
407
|
|
|
$lang = $this->lang; |
408
|
|
|
$plugin_manager = $this->plugin_manager; |
409
|
|
|
|
410
|
|
|
$hide_advanced = ($this->conf['show_advanced'] === false); |
411
|
|
|
$tabs = []; |
412
|
|
|
|
413
|
|
|
switch ($section) { |
414
|
|
|
case 'root': |
415
|
|
|
$tabs = [ |
416
|
|
|
'intro' => [ |
417
|
|
|
'title' => $lang['strintroduction'], |
418
|
|
|
'url' => 'intro', |
419
|
|
|
'icon' => 'Introduction', |
420
|
|
|
], |
421
|
|
|
'servers' => [ |
422
|
|
|
'title' => $lang['strservers'], |
423
|
|
|
'url' => 'servers', |
424
|
|
|
'icon' => 'Servers', |
425
|
|
|
], |
426
|
|
|
]; |
427
|
|
|
|
428
|
|
|
break; |
429
|
|
|
case 'server': |
430
|
|
|
$hide_users = true; |
431
|
|
|
$hide_roles = false; |
432
|
|
|
if ($data) { |
433
|
|
|
$hide_users = !$data->isSuperUser(); |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
$tabs = [ |
437
|
|
|
'databases' => [ |
438
|
|
|
'title' => $lang['strdatabases'], |
439
|
|
|
'url' => 'alldb', |
440
|
|
|
'urlvars' => ['subject' => 'server'], |
441
|
|
|
'help' => 'pg.database', |
442
|
|
|
'icon' => 'Databases', |
443
|
|
|
], |
444
|
|
|
]; |
445
|
|
|
if ($data && $data->hasRoles()) { |
446
|
|
|
$tabs = array_merge($tabs, [ |
447
|
|
|
'users' => [ |
448
|
|
|
'title' => $lang['strusers'], |
449
|
|
|
'url' => 'users', |
450
|
|
|
'urlvars' => ['subject' => 'server'], |
451
|
|
|
'hide' => $hide_roles, |
452
|
|
|
'help' => 'pg.user', |
453
|
|
|
'icon' => 'Users', |
454
|
|
|
], |
455
|
|
|
'roles' => [ |
456
|
|
|
'title' => $lang['strroles'], |
457
|
|
|
'url' => 'roles', |
458
|
|
|
'urlvars' => ['subject' => 'server'], |
459
|
|
|
'hide' => $hide_roles, |
460
|
|
|
'help' => 'pg.role', |
461
|
|
|
'icon' => 'Roles', |
462
|
|
|
], |
463
|
|
|
]); |
464
|
|
|
} else { |
465
|
|
|
$tabs = array_merge($tabs, [ |
466
|
|
|
'users' => [ |
467
|
|
|
'title' => $lang['strusers'], |
468
|
|
|
'url' => 'users', |
469
|
|
|
'urlvars' => ['subject' => 'server'], |
470
|
|
|
'hide' => $hide_users, |
471
|
|
|
'help' => 'pg.user', |
472
|
|
|
'icon' => 'Users', |
473
|
|
|
], |
474
|
|
|
'groups' => [ |
475
|
|
|
'title' => $lang['strgroups'], |
476
|
|
|
'url' => 'groups', |
477
|
|
|
'urlvars' => ['subject' => 'server'], |
478
|
|
|
'hide' => $hide_users, |
479
|
|
|
'help' => 'pg.group', |
480
|
|
|
'icon' => 'UserGroups', |
481
|
|
|
], |
482
|
|
|
]); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
$tabs = array_merge($tabs, [ |
486
|
|
|
'account' => [ |
487
|
|
|
'title' => $lang['straccount'], |
488
|
|
|
'url' => ($data && $data->hasRoles()) ? 'roles' : 'users', |
489
|
|
|
'urlvars' => ['subject' => 'server', 'action' => 'account'], |
490
|
|
|
'hide' => !$hide_users, |
491
|
|
|
'help' => 'pg.role', |
492
|
|
|
'icon' => 'User', |
493
|
|
|
], |
494
|
|
|
'tablespaces' => [ |
495
|
|
|
'title' => $lang['strtablespaces'], |
496
|
|
|
'url' => 'tablespaces', |
497
|
|
|
'urlvars' => ['subject' => 'server'], |
498
|
|
|
'hide' => !$data || !$data->hasTablespaces(), |
499
|
|
|
'help' => 'pg.tablespace', |
500
|
|
|
'icon' => 'Tablespaces', |
501
|
|
|
], |
502
|
|
|
'export' => [ |
503
|
|
|
'title' => $lang['strexport'], |
504
|
|
|
'url' => 'alldb', |
505
|
|
|
'urlvars' => ['subject' => 'server', 'action' => 'export'], |
506
|
|
|
'hide' => !$this->isDumpEnabled(), |
|
|
|
|
507
|
|
|
'icon' => 'Export', |
508
|
|
|
], |
509
|
|
|
]); |
510
|
|
|
|
511
|
|
|
break; |
512
|
|
|
case 'database': |
513
|
|
|
$tabs = [ |
514
|
|
|
'schemas' => [ |
515
|
|
|
'title' => $lang['strschemas'], |
516
|
|
|
'url' => 'schemas', |
517
|
|
|
'urlvars' => ['subject' => 'database'], |
518
|
|
|
'help' => 'pg.schema', |
519
|
|
|
'icon' => 'Schemas', |
520
|
|
|
], |
521
|
|
|
'sql' => [ |
522
|
|
|
'title' => $lang['strsql'], |
523
|
|
|
'url' => 'database', |
524
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1], |
525
|
|
|
'help' => 'pg.sql', |
526
|
|
|
'tree' => false, |
527
|
|
|
'icon' => 'SqlEditor', |
528
|
|
|
], |
529
|
|
|
'find' => [ |
530
|
|
|
'title' => $lang['strfind'], |
531
|
|
|
'url' => 'database', |
532
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'find'], |
533
|
|
|
'tree' => false, |
534
|
|
|
'icon' => 'Search', |
535
|
|
|
], |
536
|
|
|
'variables' => [ |
537
|
|
|
'title' => $lang['strvariables'], |
538
|
|
|
'url' => 'database', |
539
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'variables'], |
540
|
|
|
'help' => 'pg.variable', |
541
|
|
|
'tree' => false, |
542
|
|
|
'icon' => 'Variables', |
543
|
|
|
], |
544
|
|
|
'processes' => [ |
545
|
|
|
'title' => $lang['strprocesses'], |
546
|
|
|
'url' => 'database', |
547
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'processes'], |
548
|
|
|
'help' => 'pg.process', |
549
|
|
|
'tree' => false, |
550
|
|
|
'icon' => 'Processes', |
551
|
|
|
], |
552
|
|
|
'locks' => [ |
553
|
|
|
'title' => $lang['strlocks'], |
554
|
|
|
'url' => 'database', |
555
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'locks'], |
556
|
|
|
'help' => 'pg.locks', |
557
|
|
|
'tree' => false, |
558
|
|
|
'icon' => 'Key', |
559
|
|
|
], |
560
|
|
|
'admin' => [ |
561
|
|
|
'title' => $lang['stradmin'], |
562
|
|
|
'url' => 'database', |
563
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'admin'], |
564
|
|
|
'tree' => false, |
565
|
|
|
'icon' => 'Admin', |
566
|
|
|
], |
567
|
|
|
'privileges' => [ |
568
|
|
|
'title' => $lang['strprivileges'], |
569
|
|
|
'url' => 'privileges', |
570
|
|
|
'urlvars' => ['subject' => 'database'], |
571
|
|
|
'hide' => !isset($data->privlist['database']), |
572
|
|
|
'help' => 'pg.privilege', |
573
|
|
|
'tree' => false, |
574
|
|
|
'icon' => 'Privileges', |
575
|
|
|
], |
576
|
|
|
'languages' => [ |
577
|
|
|
'title' => $lang['strlanguages'], |
578
|
|
|
'url' => 'languages', |
579
|
|
|
'urlvars' => ['subject' => 'database'], |
580
|
|
|
'hide' => $hide_advanced, |
581
|
|
|
'help' => 'pg.language', |
582
|
|
|
'icon' => 'Languages', |
583
|
|
|
], |
584
|
|
|
'casts' => [ |
585
|
|
|
'title' => $lang['strcasts'], |
586
|
|
|
'url' => 'casts', |
587
|
|
|
'urlvars' => ['subject' => 'database'], |
588
|
|
|
'hide' => $hide_advanced, |
589
|
|
|
'help' => 'pg.cast', |
590
|
|
|
'icon' => 'Casts', |
591
|
|
|
], |
592
|
|
|
'export' => [ |
593
|
|
|
'title' => $lang['strexport'], |
594
|
|
|
'url' => 'database', |
595
|
|
|
'urlvars' => ['subject' => 'database', 'action' => 'export'], |
596
|
|
|
'hide' => !$this->isDumpEnabled(), |
597
|
|
|
'tree' => false, |
598
|
|
|
'icon' => 'Export', |
599
|
|
|
], |
600
|
|
|
]; |
601
|
|
|
|
602
|
|
|
break; |
603
|
|
|
case 'schema': |
604
|
|
|
$tabs = [ |
605
|
|
|
'tables' => [ |
606
|
|
|
'title' => $lang['strtables'], |
607
|
|
|
'url' => 'tables', |
608
|
|
|
'urlvars' => ['subject' => 'schema'], |
609
|
|
|
'help' => 'pg.table', |
610
|
|
|
'icon' => 'Tables', |
611
|
|
|
], |
612
|
|
|
'views' => [ |
613
|
|
|
'title' => $lang['strviews'], |
614
|
|
|
'url' => 'views', |
615
|
|
|
'urlvars' => ['subject' => 'schema'], |
616
|
|
|
'help' => 'pg.view', |
617
|
|
|
'icon' => 'Views', |
618
|
|
|
], |
619
|
|
|
'matviews' => [ |
620
|
|
|
'title' => 'M ' . $lang['strviews'], |
621
|
|
|
'url' => 'materializedviews', |
622
|
|
|
'urlvars' => ['subject' => 'schema'], |
623
|
|
|
'help' => 'pg.matview', |
624
|
|
|
'icon' => 'MViews', |
625
|
|
|
], |
626
|
|
|
'sequences' => [ |
627
|
|
|
'title' => $lang['strsequences'], |
628
|
|
|
'url' => 'sequences', |
629
|
|
|
'urlvars' => ['subject' => 'schema'], |
630
|
|
|
'help' => 'pg.sequence', |
631
|
|
|
'icon' => 'Sequences', |
632
|
|
|
], |
633
|
|
|
'functions' => [ |
634
|
|
|
'title' => $lang['strfunctions'], |
635
|
|
|
'url' => 'functions', |
636
|
|
|
'urlvars' => ['subject' => 'schema'], |
637
|
|
|
'help' => 'pg.function', |
638
|
|
|
'icon' => 'Functions', |
639
|
|
|
], |
640
|
|
|
'fulltext' => [ |
641
|
|
|
'title' => $lang['strfulltext'], |
642
|
|
|
'url' => 'fulltext', |
643
|
|
|
'urlvars' => ['subject' => 'schema'], |
644
|
|
|
'help' => 'pg.fts', |
645
|
|
|
'tree' => true, |
646
|
|
|
'icon' => 'Fts', |
647
|
|
|
], |
648
|
|
|
'domains' => [ |
649
|
|
|
'title' => $lang['strdomains'], |
650
|
|
|
'url' => 'domains', |
651
|
|
|
'urlvars' => ['subject' => 'schema'], |
652
|
|
|
'help' => 'pg.domain', |
653
|
|
|
'icon' => 'Domains', |
654
|
|
|
], |
655
|
|
|
'aggregates' => [ |
656
|
|
|
'title' => $lang['straggregates'], |
657
|
|
|
'url' => 'aggregates', |
658
|
|
|
'urlvars' => ['subject' => 'schema'], |
659
|
|
|
'hide' => $hide_advanced, |
660
|
|
|
'help' => 'pg.aggregate', |
661
|
|
|
'icon' => 'Aggregates', |
662
|
|
|
], |
663
|
|
|
'types' => [ |
664
|
|
|
'title' => $lang['strtypes'], |
665
|
|
|
'url' => 'types', |
666
|
|
|
'urlvars' => ['subject' => 'schema'], |
667
|
|
|
'hide' => $hide_advanced, |
668
|
|
|
'help' => 'pg.type', |
669
|
|
|
'icon' => 'Types', |
670
|
|
|
], |
671
|
|
|
'operators' => [ |
672
|
|
|
'title' => $lang['stroperators'], |
673
|
|
|
'url' => 'operators', |
674
|
|
|
'urlvars' => ['subject' => 'schema'], |
675
|
|
|
'hide' => $hide_advanced, |
676
|
|
|
'help' => 'pg.operator', |
677
|
|
|
'icon' => 'Operators', |
678
|
|
|
], |
679
|
|
|
'opclasses' => [ |
680
|
|
|
'title' => $lang['stropclasses'], |
681
|
|
|
'url' => 'opclasses', |
682
|
|
|
'urlvars' => ['subject' => 'schema'], |
683
|
|
|
'hide' => $hide_advanced, |
684
|
|
|
'help' => 'pg.opclass', |
685
|
|
|
'icon' => 'OperatorClasses', |
686
|
|
|
], |
687
|
|
|
'conversions' => [ |
688
|
|
|
'title' => $lang['strconversions'], |
689
|
|
|
'url' => 'conversions', |
690
|
|
|
'urlvars' => ['subject' => 'schema'], |
691
|
|
|
'hide' => $hide_advanced, |
692
|
|
|
'help' => 'pg.conversion', |
693
|
|
|
'icon' => 'Conversions', |
694
|
|
|
], |
695
|
|
|
'privileges' => [ |
696
|
|
|
'title' => $lang['strprivileges'], |
697
|
|
|
'url' => 'privileges', |
698
|
|
|
'urlvars' => ['subject' => 'schema'], |
699
|
|
|
'help' => 'pg.privilege', |
700
|
|
|
'tree' => false, |
701
|
|
|
'icon' => 'Privileges', |
702
|
|
|
], |
703
|
|
|
'export' => [ |
704
|
|
|
'title' => $lang['strexport'], |
705
|
|
|
'url' => 'schemas', |
706
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'export'], |
707
|
|
|
'hide' => !$this->isDumpEnabled(), |
708
|
|
|
'tree' => false, |
709
|
|
|
'icon' => 'Export', |
710
|
|
|
], |
711
|
|
|
]; |
712
|
|
|
if (!$data->hasFTS()) { |
713
|
|
|
unset($tabs['fulltext']); |
714
|
|
|
} |
715
|
|
|
|
716
|
|
|
break; |
717
|
|
|
case 'table': |
718
|
|
|
$tabs = [ |
719
|
|
|
'columns' => [ |
720
|
|
|
'title' => $lang['strcolumns'], |
721
|
|
|
'url' => 'tblproperties', |
722
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
723
|
|
|
'icon' => 'Columns', |
724
|
|
|
'branch' => true, |
725
|
|
|
], |
726
|
|
|
'browse' => [ |
727
|
|
|
'title' => $lang['strbrowse'], |
728
|
|
|
'icon' => 'Columns', |
729
|
|
|
'url' => 'display', |
730
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
731
|
|
|
'return' => 'table', |
732
|
|
|
'branch' => true, |
733
|
|
|
], |
734
|
|
|
'select' => [ |
735
|
|
|
'title' => $lang['strselect'], |
736
|
|
|
'icon' => 'Search', |
737
|
|
|
'url' => 'tables', |
738
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'], |
739
|
|
|
'help' => 'pg.sql.select', |
740
|
|
|
], |
741
|
|
|
'insert' => [ |
742
|
|
|
'title' => $lang['strinsert'], |
743
|
|
|
'url' => 'tables', |
744
|
|
|
'urlvars' => [ |
745
|
|
|
'action' => 'confinsertrow', |
746
|
|
|
'table' => Decorator::field('table'), |
747
|
|
|
], |
748
|
|
|
'help' => 'pg.sql.insert', |
749
|
|
|
'icon' => 'Operator', |
750
|
|
|
], |
751
|
|
|
'indexes' => [ |
752
|
|
|
'title' => $lang['strindexes'], |
753
|
|
|
'url' => 'indexes', |
754
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
755
|
|
|
'help' => 'pg.index', |
756
|
|
|
'icon' => 'Indexes', |
757
|
|
|
'branch' => true, |
758
|
|
|
], |
759
|
|
|
'constraints' => [ |
760
|
|
|
'title' => $lang['strconstraints'], |
761
|
|
|
'url' => 'constraints', |
762
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
763
|
|
|
'help' => 'pg.constraint', |
764
|
|
|
'icon' => 'Constraints', |
765
|
|
|
'branch' => true, |
766
|
|
|
], |
767
|
|
|
'triggers' => [ |
768
|
|
|
'title' => $lang['strtriggers'], |
769
|
|
|
'url' => 'triggers', |
770
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
771
|
|
|
'help' => 'pg.trigger', |
772
|
|
|
'icon' => 'Triggers', |
773
|
|
|
'branch' => true, |
774
|
|
|
], |
775
|
|
|
'rules' => [ |
776
|
|
|
'title' => $lang['strrules'], |
777
|
|
|
'url' => 'rules', |
778
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
779
|
|
|
'help' => 'pg.rule', |
780
|
|
|
'icon' => 'Rules', |
781
|
|
|
'branch' => true, |
782
|
|
|
], |
783
|
|
|
'admin' => [ |
784
|
|
|
'title' => $lang['stradmin'], |
785
|
|
|
'url' => 'tables', |
786
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'], |
787
|
|
|
'icon' => 'Admin', |
788
|
|
|
], |
789
|
|
|
'info' => [ |
790
|
|
|
'title' => $lang['strinfo'], |
791
|
|
|
'url' => 'info', |
792
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
793
|
|
|
'icon' => 'Statistics', |
794
|
|
|
], |
795
|
|
|
'privileges' => [ |
796
|
|
|
'title' => $lang['strprivileges'], |
797
|
|
|
'url' => 'privileges', |
798
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], |
799
|
|
|
'help' => 'pg.privilege', |
800
|
|
|
'icon' => 'Privileges', |
801
|
|
|
], |
802
|
|
|
'import' => [ |
803
|
|
|
'title' => $lang['strimport'], |
804
|
|
|
'url' => 'tblproperties', |
805
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'], |
806
|
|
|
'icon' => 'Import', |
807
|
|
|
'hide' => false, |
808
|
|
|
], |
809
|
|
|
'export' => [ |
810
|
|
|
'title' => $lang['strexport'], |
811
|
|
|
'url' => 'tblproperties', |
812
|
|
|
'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'], |
813
|
|
|
'icon' => 'Export', |
814
|
|
|
'hide' => false, |
815
|
|
|
], |
816
|
|
|
]; |
817
|
|
|
|
818
|
|
|
break; |
819
|
|
|
case 'view': |
820
|
|
|
$tabs = [ |
821
|
|
|
'columns' => [ |
822
|
|
|
'title' => $lang['strcolumns'], |
823
|
|
|
'url' => 'viewproperties', |
824
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
825
|
|
|
'icon' => 'Columns', |
826
|
|
|
'branch' => true, |
827
|
|
|
], |
828
|
|
|
'browse' => [ |
829
|
|
|
'title' => $lang['strbrowse'], |
830
|
|
|
'icon' => 'Columns', |
831
|
|
|
'url' => 'display', |
832
|
|
|
'urlvars' => [ |
833
|
|
|
'action' => 'confselectrows', |
834
|
|
|
'return' => 'schema', |
835
|
|
|
'subject' => 'view', |
836
|
|
|
'view' => Decorator::field('view'), |
837
|
|
|
], |
838
|
|
|
'branch' => true, |
839
|
|
|
], |
840
|
|
|
'select' => [ |
841
|
|
|
'title' => $lang['strselect'], |
842
|
|
|
'icon' => 'Search', |
843
|
|
|
'url' => 'views', |
844
|
|
|
'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')], |
845
|
|
|
'help' => 'pg.sql.select', |
846
|
|
|
], |
847
|
|
|
'definition' => [ |
848
|
|
|
'title' => $lang['strdefinition'], |
849
|
|
|
'url' => 'viewproperties', |
850
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'], |
851
|
|
|
'icon' => 'Definition', |
852
|
|
|
], |
853
|
|
|
'rules' => [ |
854
|
|
|
'title' => $lang['strrules'], |
855
|
|
|
'url' => 'rules', |
856
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
857
|
|
|
'help' => 'pg.rule', |
858
|
|
|
'icon' => 'Rules', |
859
|
|
|
'branch' => true, |
860
|
|
|
], |
861
|
|
|
'privileges' => [ |
862
|
|
|
'title' => $lang['strprivileges'], |
863
|
|
|
'url' => 'privileges', |
864
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], |
865
|
|
|
'help' => 'pg.privilege', |
866
|
|
|
'icon' => 'Privileges', |
867
|
|
|
], |
868
|
|
|
'export' => [ |
869
|
|
|
'title' => $lang['strexport'], |
870
|
|
|
'url' => 'viewproperties', |
871
|
|
|
'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'], |
872
|
|
|
'icon' => 'Export', |
873
|
|
|
'hide' => false, |
874
|
|
|
], |
875
|
|
|
]; |
876
|
|
|
|
877
|
|
|
break; |
878
|
|
|
case 'matview': |
879
|
|
|
$tabs = [ |
880
|
|
|
'columns' => [ |
881
|
|
|
'title' => $lang['strcolumns'], |
882
|
|
|
'url' => 'materializedviewproperties', |
883
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
884
|
|
|
'icon' => 'Columns', |
885
|
|
|
'branch' => true, |
886
|
|
|
], |
887
|
|
|
'browse' => [ |
888
|
|
|
'title' => $lang['strbrowse'], |
889
|
|
|
'icon' => 'Columns', |
890
|
|
|
'url' => 'display', |
891
|
|
|
'urlvars' => [ |
892
|
|
|
'action' => 'confselectrows', |
893
|
|
|
'return' => 'schema', |
894
|
|
|
'subject' => 'matview', |
895
|
|
|
'matview' => Decorator::field('matview'), |
896
|
|
|
], |
897
|
|
|
'branch' => true, |
898
|
|
|
], |
899
|
|
|
'select' => [ |
900
|
|
|
'title' => $lang['strselect'], |
901
|
|
|
'icon' => 'Search', |
902
|
|
|
'url' => 'materializedviews', |
903
|
|
|
'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')], |
904
|
|
|
'help' => 'pg.sql.select', |
905
|
|
|
], |
906
|
|
|
'definition' => [ |
907
|
|
|
'title' => $lang['strdefinition'], |
908
|
|
|
'url' => 'materializedviewproperties', |
909
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'], |
910
|
|
|
'icon' => 'Definition', |
911
|
|
|
], |
912
|
|
|
'indexes' => [ |
913
|
|
|
'title' => $lang['strindexes'], |
914
|
|
|
'url' => 'indexes', |
915
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
916
|
|
|
'help' => 'pg.index', |
917
|
|
|
'icon' => 'Indexes', |
918
|
|
|
'branch' => true, |
919
|
|
|
], |
920
|
|
|
/*'constraints' => [ |
921
|
|
|
'title' => $lang['strconstraints'], |
922
|
|
|
'url' => 'constraints', |
923
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
924
|
|
|
'help' => 'pg.constraint', |
925
|
|
|
'icon' => 'Constraints', |
926
|
|
|
'branch' => true, |
927
|
|
|
*/ |
928
|
|
|
|
929
|
|
|
'rules' => [ |
930
|
|
|
'title' => $lang['strrules'], |
931
|
|
|
'url' => 'rules', |
932
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
933
|
|
|
'help' => 'pg.rule', |
934
|
|
|
'icon' => 'Rules', |
935
|
|
|
'branch' => true, |
936
|
|
|
], |
937
|
|
|
'privileges' => [ |
938
|
|
|
'title' => $lang['strprivileges'], |
939
|
|
|
'url' => 'privileges', |
940
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], |
941
|
|
|
'help' => 'pg.privilege', |
942
|
|
|
'icon' => 'Privileges', |
943
|
|
|
], |
944
|
|
|
'export' => [ |
945
|
|
|
'title' => $lang['strexport'], |
946
|
|
|
'url' => 'materializedviewproperties', |
947
|
|
|
'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'], |
948
|
|
|
'icon' => 'Export', |
949
|
|
|
'hide' => false, |
950
|
|
|
], |
951
|
|
|
]; |
952
|
|
|
|
953
|
|
|
break; |
954
|
|
|
case 'function': |
955
|
|
|
$tabs = [ |
956
|
|
|
'definition' => [ |
957
|
|
|
'title' => $lang['strdefinition'], |
958
|
|
|
'url' => 'functions', |
959
|
|
|
'urlvars' => [ |
960
|
|
|
'subject' => 'function', |
961
|
|
|
'function' => Decorator::field('function'), |
962
|
|
|
'function_oid' => Decorator::field('function_oid'), |
963
|
|
|
'action' => 'properties', |
964
|
|
|
], |
965
|
|
|
'icon' => 'Definition', |
966
|
|
|
], |
967
|
|
|
'privileges' => [ |
968
|
|
|
'title' => $lang['strprivileges'], |
969
|
|
|
'url' => 'privileges', |
970
|
|
|
'urlvars' => [ |
971
|
|
|
'subject' => 'function', |
972
|
|
|
'function' => Decorator::field('function'), |
973
|
|
|
'function_oid' => Decorator::field('function_oid'), |
974
|
|
|
], |
975
|
|
|
'icon' => 'Privileges', |
976
|
|
|
], |
977
|
|
|
]; |
978
|
|
|
|
979
|
|
|
break; |
980
|
|
|
case 'aggregate': |
981
|
|
|
$tabs = [ |
982
|
|
|
'definition' => [ |
983
|
|
|
'title' => $lang['strdefinition'], |
984
|
|
|
'url' => 'aggregates', |
985
|
|
|
'urlvars' => [ |
986
|
|
|
'subject' => 'aggregate', |
987
|
|
|
'aggrname' => Decorator::field('aggrname'), |
988
|
|
|
'aggrtype' => Decorator::field('aggrtype'), |
989
|
|
|
'action' => 'properties', |
990
|
|
|
], |
991
|
|
|
'icon' => 'Definition', |
992
|
|
|
], |
993
|
|
|
]; |
994
|
|
|
|
995
|
|
|
break; |
996
|
|
|
case 'role': |
997
|
|
|
$tabs = [ |
998
|
|
|
'definition' => [ |
999
|
|
|
'title' => $lang['strdefinition'], |
1000
|
|
|
'url' => 'roles', |
1001
|
|
|
'urlvars' => [ |
1002
|
|
|
'subject' => 'role', |
1003
|
|
|
'rolename' => Decorator::field('rolename'), |
1004
|
|
|
'action' => 'properties', |
1005
|
|
|
], |
1006
|
|
|
'icon' => 'Definition', |
1007
|
|
|
], |
1008
|
|
|
]; |
1009
|
|
|
|
1010
|
|
|
break; |
1011
|
|
|
case 'popup': |
1012
|
|
|
$tabs = [ |
1013
|
|
|
'sql' => [ |
1014
|
|
|
'title' => $lang['strsql'], |
1015
|
|
|
'url' => \SUBFOLDER . '/src/views/sqledit', |
1016
|
|
|
'urlvars' => ['action' => 'sql', 'subject' => 'schema'], |
1017
|
|
|
'help' => 'pg.sql', |
1018
|
|
|
'icon' => 'SqlEditor', |
1019
|
|
|
], |
1020
|
|
|
'find' => [ |
1021
|
|
|
'title' => $lang['strfind'], |
1022
|
|
|
'url' => \SUBFOLDER . '/src/views/sqledit', |
1023
|
|
|
'urlvars' => ['action' => 'find', 'subject' => 'schema'], |
1024
|
|
|
'icon' => 'Search', |
1025
|
|
|
], |
1026
|
|
|
]; |
1027
|
|
|
|
1028
|
|
|
break; |
1029
|
|
|
case 'column': |
1030
|
|
|
$tabs = [ |
1031
|
|
|
'properties' => [ |
1032
|
|
|
'title' => $lang['strcolprop'], |
1033
|
|
|
'url' => 'colproperties', |
1034
|
|
|
'urlvars' => [ |
1035
|
|
|
'subject' => 'column', |
1036
|
|
|
'table' => Decorator::field('table'), |
1037
|
|
|
'column' => Decorator::field('column'), |
1038
|
|
|
], |
1039
|
|
|
'icon' => 'Column', |
1040
|
|
|
], |
1041
|
|
|
'privileges' => [ |
1042
|
|
|
'title' => $lang['strprivileges'], |
1043
|
|
|
'url' => 'privileges', |
1044
|
|
|
'urlvars' => [ |
1045
|
|
|
'subject' => 'column', |
1046
|
|
|
'table' => Decorator::field('table'), |
1047
|
|
|
'column' => Decorator::field('column'), |
1048
|
|
|
], |
1049
|
|
|
'help' => 'pg.privilege', |
1050
|
|
|
'icon' => 'Privileges', |
1051
|
|
|
], |
1052
|
|
|
]; |
1053
|
|
|
|
1054
|
|
|
break; |
1055
|
|
|
case 'fulltext': |
1056
|
|
|
$tabs = [ |
1057
|
|
|
'ftsconfigs' => [ |
1058
|
|
|
'title' => $lang['strftstabconfigs'], |
1059
|
|
|
'url' => 'fulltext', |
1060
|
|
|
'urlvars' => ['subject' => 'schema'], |
1061
|
|
|
'hide' => !$data->hasFTS(), |
1062
|
|
|
'help' => 'pg.ftscfg', |
1063
|
|
|
'tree' => true, |
1064
|
|
|
'icon' => 'FtsCfg', |
1065
|
|
|
], |
1066
|
|
|
'ftsdicts' => [ |
1067
|
|
|
'title' => $lang['strftstabdicts'], |
1068
|
|
|
'url' => 'fulltext', |
1069
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'], |
1070
|
|
|
'hide' => !$data->hasFTS(), |
1071
|
|
|
'help' => 'pg.ftsdict', |
1072
|
|
|
'tree' => true, |
1073
|
|
|
'icon' => 'FtsDict', |
1074
|
|
|
], |
1075
|
|
|
'ftsparsers' => [ |
1076
|
|
|
'title' => $lang['strftstabparsers'], |
1077
|
|
|
'url' => 'fulltext', |
1078
|
|
|
'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'], |
1079
|
|
|
'hide' => !$data->hasFTS(), |
1080
|
|
|
'help' => 'pg.ftsparser', |
1081
|
|
|
'tree' => true, |
1082
|
|
|
'icon' => 'FtsParser', |
1083
|
|
|
], |
1084
|
|
|
]; |
1085
|
|
|
|
1086
|
|
|
break; |
1087
|
|
|
} |
1088
|
|
|
|
1089
|
|
|
// Tabs hook's place |
1090
|
|
|
$plugin_functions_parameters = [ |
1091
|
|
|
'tabs' => &$tabs, |
1092
|
|
|
'section' => $section, |
1093
|
|
|
]; |
1094
|
|
|
$plugin_manager->doHook('tabs', $plugin_functions_parameters); |
1095
|
|
|
|
1096
|
|
|
return $tabs; |
1097
|
|
|
} |
1098
|
|
|
|
1099
|
|
|
/** |
1100
|
|
|
* Get the URL for the last active tab of a particular tab bar. |
1101
|
|
|
* |
1102
|
|
|
* @param string $section |
1103
|
|
|
* |
1104
|
|
|
* @return null|mixed |
1105
|
|
|
*/ |
1106
|
|
|
public function getLastTabURL($section) |
1107
|
|
|
{ |
1108
|
|
|
//$data = $this->getDatabaseAccessor(); |
1109
|
|
|
|
1110
|
|
|
$tabs = $this->getNavTabs($section); |
1111
|
|
|
if (isset($_SESSION['webdbLastTab'][$section])) { |
1112
|
|
|
$tab = $tabs[$_SESSION['webdbLastTab'][$section]]; |
1113
|
|
|
} else { |
1114
|
|
|
$tab = reset($tabs); |
1115
|
|
|
} |
1116
|
|
|
//$this->prtrace(['section' => $section, 'tabs' => $tabs, 'tab' => $tab]); |
1117
|
|
|
return isset($tab['url']) ? $tab : null; |
1118
|
|
|
} |
1119
|
|
|
} |
1120
|
|
|
|