-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathseqproperties.php
172 lines (147 loc) · 4.78 KB
/
seqproperties.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/*
* Display the properties of a given sequence
*/
// Include application functions
include_once('./libraries/lib.inc.php');
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
if (!isset($msg)) $msg = '';
// Callback function to dynamicaly add a link to the tables group's description when the group name is suffixed by "###LINK###"
function renderlinktogroup($val) {
global $misc;
if (preg_match("/(.*)###LINK###$/", $val, $matches)) {
$val = $matches[1];
return "<a href=\"emajgroups.php?action=show_group&" . $misc->href . "&group=". urlencode($val) . "\">" . $val . "</a>";
} else {
return $val;
}
}
/**
* Display the properties of a sequence
*/
function doProperties($msg = '') {
global $data, $misc, $lang, $emajdb;
$misc->printHeader('sequence', 'sequence', 'properties');
$misc->printTitle(sprintf($lang['strseqproperties'], $_REQUEST['schema'], $_REQUEST['sequence']));
$misc->printMsg($msg);
// Verify that the user has enough privileges to read the sequence
$privilegeOk = $emajdb->hasSelectPrivilegeOnSequence($_REQUEST['schema'], $_REQUEST['sequence']);
if (! $privilegeOk) {
echo $lang['strnograntonsequence'];
} else {
// Fetch the sequence information
$sequence = $emajdb->getSequenceProperties($_REQUEST['schema'], $_REQUEST['sequence']);
// Show comment if any
if ($sequence->fields['seqcomment'] !== null)
echo "<p>{$lang['strcommentlabel']}<span class=\"comment\">{$misc->printVal($sequence->fields['seqcomment'])}</span></p>\n";
$sequence->moveFirst();
$columns = array(
'lastvalue' => array(
'title' => $lang['strlastvalue'],
'field' => field('last_value'),
'type' => 'numeric',
'params'=> array('class' => 'bold'),
),
'iscalled' => array(
'title' => $lang['striscalled'],
'field' => field('is_called'),
'type' => 'bool',
'params'=> array('true' => $lang['stryes'], 'false' => $lang['strno'], 'class' => 'bold'),
),
'startvalue' => array(
'title' => $lang['strstartvalue'],
'field' => field('start_value'),
'type' => 'numeric',
),
'minvalue' => array(
'title' => $lang['strminvalue'],
'field' => field('min_value'),
'type' => 'numeric',
),
'maxvalue' => array(
'title' => $lang['strmaxvalue'],
'field' => field('max_value'),
'type' => 'numeric',
),
'increment' => array(
'title' => $lang['strincrement'],
'field' => field('increment_by'),
'type' => 'numeric',
),
'cancycle' => array(
'title' => $lang['strcancycle'],
'field' => field('cycle'),
'type' => 'bool',
'params'=> array('true' => $lang['stryes'], 'false' => $lang['strno']),
),
'cachesize' => array(
'title' => $lang['strcachesize'],
'field' => field('cache_size'),
'type' => 'numeric',
),
'logcount' => array(
'title' => $lang['strlogcount'],
'field' => field('log_cnt'),
'type' => 'numeric',
),
);
$actions = array();
$misc->printTable($sequence, $columns, $actions, 'seqproperties-columns', $lang['strnodata']);
}
echo "<hr/>\n";
// Display the E-Maj properties, if any
if ($emajdb->isEnabled() && $emajdb->isAccessible()) {
$misc->printTitle($lang['stremajproperties']);
$type = $emajdb->getEmajTypeTblSeq($_REQUEST['schema'], $_REQUEST['sequence']);
if ($type == 'L') {
echo "<p>{$lang['stremajlogsequence']}</p>\n";
} elseif ($type == 'E') {
echo "<p>{$lang['strinternalsequence']}</p>\n";
} else {
$groups = $emajdb->getTableGroupsTblSeq($_REQUEST['schema'], $_REQUEST['sequence']);
$columns = array(
'group' => array(
'title' => $lang['strgroup'],
'field' => field('rel_group'),
'type' => 'callback',
'params'=> array('function' => 'renderlinktogroup')
),
'starttime' => array(
'title' => $lang['strassigned'],
'field' => field('start_datetime'),
'type' => 'spanned',
'params'=> array(
'dateformat' => $lang['stroldtimestampformat'],
'locale' => $lang['applocale'],
'class' => 'tooltip left-aligned-tooltip',
),
),
'stoptime' => array(
'title' => $lang['strremoved'],
'field' => field('stop_datetime'),
'type' => 'spanned',
'params'=> array(
'dateformat' => $lang['stroldtimestampformat'],
'locale' => $lang['applocale'],
'class' => 'tooltip left-aligned-tooltip',
),
),
);
$misc->printTable($groups, $columns, $actions, 'sequences-groups', $lang['strseqnogroupownership']);
}
}
}
// Print header
$misc->printHtmlHeader($lang['strsequences']);
$misc->printBody();
switch($action) {
case 'properties':
doProperties();
break;
default:
doProperties();
break;
}
// Print footer
$misc->printFooter();
?>