-
Notifications
You must be signed in to change notification settings - Fork 3
/
groupcontent.php
157 lines (137 loc) · 5.02 KB
/
groupcontent.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
/*
* Manage the tables groups history
*/
// Include application functions
include_once('./libraries/lib.inc.php');
/********************************************************************************************************
* Callback functions
*******************************************************************************************************/
// Callback function to dynamicaly modify the Table/Sequence columns content
// It replaces the database value by an icon representing either a table or a sequence
function renderTblSeq($val) {
global $misc, $lang;
if ($val == 'r+') { // regular table
$icon = $misc->icon('Table');
$alt = $lang['strtable'];
} elseif ($val == 'S+') { // sequence
$icon = $misc->icon('Sequence');
$alt = $lang['strsequence'];
} elseif ($val == '!') { // object declared in the emaj_group_def table but unknown in the catalog
$icon = $misc->icon('ObjectNotFound');
$alt = $lang['strunknownobject'];
} else { // unsupported type
$icon = $misc->icon('ObjectNotFound');
$alt = $lang['strunsupportedobject'];
}
return "<img src=\"{$icon}\" alt=\"{$alt}\" title=\"{$alt}\"/>";
}
/********************************************************************************************************
* Main functions displaying pages
*******************************************************************************************************/
/**
* Displays the list of tables and sequences owned by a group
*/
function show_content_group() {
global $misc, $lang, $emajdb, $_reload_browser;
if (! $emajdb->existsGroup($_REQUEST['group'])) {
show_groups('', sprintf($lang['strgroupmissing'], htmlspecialchars($_REQUEST['group'])));
$_reload_browser = true;
return;
}
$misc->printHeader('emaj', 'emajgroup', 'emajcontent');
$misc->printTitle(sprintf($lang['strgroupcontent'],htmlspecialchars($_REQUEST['group'])));
$groupContent = $emajdb->getContentGroup($_REQUEST['group']);
if ($groupContent->recordCount() < 1) {
// The group is empty
echo "<p>" . sprintf($lang['stremptygroup'], htmlspecialchars($_REQUEST['group'])) . "</p>\n";
} else {
$columns = array(
'type' => array(
'title' => $lang['strtype'],
'field' => field('relkind'),
'type' => 'callback',
'params'=> array('function' => 'renderTblSeq','align' => 'center'),
'sorter_text_extraction' => 'img_alt',
'filter'=> false,
),
'schema' => array(
'title' => $lang['strschema'],
'field' => field('rel_schema'),
'url' => "schemas.php?action=list_schemas&{$misc->href}&",
'vars' => array('schema' => 'rel_schema'),
),
'tblseq' => array(
'title' => $lang['strname'],
'field' => field('rel_tblseq'),
'url' => "redirect.php?{$misc->href}&",
'vars' => array('subject' => 'rel_type' , 'schema' => 'rel_schema', 'table' => 'rel_tblseq', 'sequence' => 'rel_tblseq'),
));
if ($emajdb->getNumEmajVersion() >= 20200) { // version >= 2.2.0
$columns = array_merge($columns, array(
'starttime' => array(
'title' => $lang['strsince'],
'field' => field('start_time'),
'type' => 'spanned',
'params'=> array(
'dateformat' => $lang['stroldtimestampformat'],
'locale' => $lang['applocale'],
'class' => 'tooltip left-aligned-tooltip',
),
'sorter_text_extraction' => 'span_text',
'filter'=> false,
)));
}
$columns = array_merge($columns, array(
'priority' => array(
'title' => $lang['strpriority'],
'field' => field('rel_priority'),
'params'=> array('align' => 'center'),
),
'log_dat_tsp' => array(
'upper_title' => $lang['strtablespace'],
'upper_title_colspan' => 2,
'title' => $lang['strlogtables'],
'field' => field('rel_log_dat_tsp'),
),
'log_idx_tsp' => array(
'title' => $lang['strlogindexes'],
'field' => field('rel_log_idx_tsp'),
),
'log_table' => array(
'title' => $lang['strcurrentlogtable'],
'field' => field('full_log_table'),
),
'logsize' => array(
'title' => $lang['strlogsize'],
'field' => field('log_size'),
'type' => 'spanned',
'params'=> array(
'spanseparator' => '|',
'class' => 'tooltip right-aligned-tooltip',
),
'sorter_text_extraction' => 'span_text',
'filter'=> false,
),
));
$actions = array ();
echo "<p></p>";
$misc->printTable($groupContent, $columns, $actions, 'groupContent', null, null, array('sorter' => true, 'filter' => true));
}
}
/********************************************************************************************************
* Main piece of code
*******************************************************************************************************/
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
if (!isset($msg)) $msg = '';
$misc->printHtmlHeader($lang['strgroupsmanagement']);
$misc->printBody();
switch ($action) {
case 'show_content_group':
show_content_group();
break;
default:
show_content_group();
}
$misc->printFooter();
?>