2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * display selection for relational field values
10 * Gets a core script and starts output buffering work
12 require_once './libraries/common.inc.php';
14 PMA_checkParameters(array('db', 'table', 'field'));
16 require_once './libraries/ob.lib.php';
19 require_once './libraries/header_http.inc.php';
24 require_once './libraries/transformations.lib.php'; // Transformations
25 $cfgRelation = PMA_getRelationsParam();
26 $foreigners = ($cfgRelation['relwork'] ?
PMA_getForeigners($db, $table) : FALSE);
28 $override_total = TRUE;
34 $foreign_limit = 'LIMIT ' . $pos . ', ' . $GLOBALS['cfg']['MaxRows'] . ' ';
35 if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
36 unset($foreign_limit);
39 $foreignData = PMA_getForeignData($foreigners, $field, $override_total, isset($foreign_filter) ?
$foreign_filter : '', $foreign_limit);
41 if (isset($rownumber)) {
42 $rownumber_param = '&rownumber=' . urlencode($rownumber);
44 $rownumber_param = '';
50 if (is_array($foreignData['disp_row'])) {
52 if ($cfg['ShowAll'] && ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows'])) {
53 $showall = '<input type="submit" name="foreign_navig" value="' . __('Show all') . '" />';
56 $session_max_rows = $GLOBALS['cfg']['MaxRows'];
57 $pageNow = @floor
($pos / $session_max_rows) +
1;
58 $nbTotalPage = @ceil
($foreignData['the_total'] / $session_max_rows);
60 if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) {
61 $gotopage = PMA_pageselector(
62 'browse_foreigners.php?field=' . urlencode($field) .
63 '&' . PMA_generate_common_url($db, $table)
65 '&fieldkey=' . (isset($fieldkey) ?
urlencode($fieldkey) : '') .
66 '&foreign_filter=' . (isset($foreign_filter) ?
urlencode($foreign_filter) : '') .
81 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
82 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
83 <html xmlns
="http://www.w3.org/1999/xhtml"
84 xml
:lang
="<?php echo $available_languages[$lang][1]; ?>"
85 lang
="<?php echo $available_languages[$lang][1]; ?>"
86 dir
="<?php echo $text_dir; ?>">
89 <title
>phpMyAdmin
</title
>
90 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
91 <link rel
="stylesheet" type
="text/css"
92 href
="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=right&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
94 // includes everything asked for by libraries/common.inc.php
95 require_once './libraries/header_scripts.inc.php';
97 <script type
="text/javascript">
100 function formupdate(fieldmd5
, key
) {
101 if (opener
&& opener
.document
&& opener
.document
.insertForm
) {
102 var field
= 'fields';
104 <?php
if (isset($rownumber)) { ?
>
105 var element_name
= field +
'[multi_edit][<?php echo htmlspecialchars($rownumber); ?>][' + fieldmd5 +
']';
107 var element_name
= field +
'[]';
110 <?php
if (isset($fieldkey) && is_numeric($fieldkey)) { ?
>
111 var element_name_alt
= field +
'[<?php echo $fieldkey; ?>]';
113 var element_name_alt
= field +
'[0]';
116 if (opener
.document
.insertForm
.elements
[element_name
]) {
118 opener
.document
.insertForm
.elements
[element_name
].value
= key
;
121 } else if (opener
.document
.insertForm
.elements
[element_name_alt
]) {
123 opener
.document
.insertForm
.elements
[element_name_alt
].value
= key
;
129 alert('<?php echo PMA_jsFormat(__('The target browser window could not be updated
. Maybe you have closed the parent window
, or your browser\'s security settings are configured to block cross
-window updates
.')); ?>');
135 <body id
="body_browse_foreigners">
137 <form action
="browse_foreigners.php" method
="post">
139 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
140 <input type
="hidden" name
="field" value
="<?php echo htmlspecialchars($field); ?>" />
141 <input type
="hidden" name
="fieldkey"
142 value
="<?php echo isset($fieldkey) ? htmlspecialchars($fieldkey) : ''; ?>" />
143 <?php
if (isset($rownumber)) { ?
>
144 <input type
="hidden" name
="rownumber" value
="<?php echo htmlspecialchars($rownumber); ?>" />
146 <span
class="formelement">
147 <label
for="input_foreign_filter"><?php
echo __('Search') . ':'; ?
></label
>
148 <input type
="text" name
="foreign_filter" id
="input_foreign_filter"
149 value
="<?php echo isset($foreign_filter) ? htmlspecialchars($foreign_filter) : ''; ?>" />
150 <input type
="submit" name
="submit_foreign_filter" value
="<?php echo __('Go');?>" />
152 <span
class="formelement">
153 <?php
echo $gotopage; ?
>
155 <span
class="formelement">
156 <?php
echo $showall; ?
>
163 if (is_array($foreignData['disp_row'])) {
165 <th>' . __('Keyname') . '</th>
166 <th>' . __('Description') . '</th>
167 <td width="20%"></td>
168 <th>' . __('Description') . '</th>
169 <th>' . __('Keyname') . '</th>
172 echo '<thead>' . $header . '</thead>' . "\n"
173 .'<tfoot>' . $header . '</tfoot>' . "\n"
178 foreach ($foreignData['disp_row'] as $relrow) {
179 if ($foreignData['foreign_display'] != FALSE) {
180 $values[] = $relrow[$foreignData['foreign_display']];
185 $keys[] = $relrow[$foreignData['foreign_field']];
192 $val_ordered_current_row = 0;
193 $val_ordered_current_equals_data = false;
194 $key_ordered_current_equals_data = false;
195 foreach ($keys as $key_ordered_current_row => $value) {
196 //for ($i = 0; $i < $count; $i++) {
199 if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
205 $key_ordered_current_key = $keys[$key_ordered_current_row];
206 $key_ordered_current_val = $values[$key_ordered_current_row];
208 $val_ordered_current_key = $keys[$val_ordered_current_row];
209 $val_ordered_current_val = $values[$val_ordered_current_row];
211 $val_ordered_current_row++
;
213 if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
214 $val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
215 $val_ordered_current_val_title = '';
217 $val_ordered_current_val_title =
218 htmlspecialchars($val_ordered_current_val);
219 $val_ordered_current_val =
220 htmlspecialchars(PMA_substr($val_ordered_current_val, 0,
221 $cfg['LimitChars']) . '...');
223 if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
224 $key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
225 $key_ordered_current_val_title = '';
227 $key_ordered_current_val_title =
228 htmlspecialchars($key_ordered_current_val);
229 $key_ordered_current_val =
230 htmlspecialchars(PMA_substr($key_ordered_current_val, 0,
231 $cfg['LimitChars']) . '...');
234 if (! empty($data)) {
235 $val_ordered_current_equals_data = $val_ordered_current_key == $data;
236 $key_ordered_current_equals_data = $key_ordered_current_key == $data;
240 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
243 echo ($key_ordered_current_equals_data ?
'<strong>' : '')
244 .'<a href="#" title="' . __('Use this value')
245 . ($key_ordered_current_val_title != '' ?
': ' . $key_ordered_current_val_title : '') . '"'
246 .' onclick="formupdate(\'' . md5($field) . '\', \''
247 . PMA_jsFormat($key_ordered_current_key, false) . '\'); return false;">'
248 .htmlspecialchars($key_ordered_current_key) . '</a>' . ($key_ordered_current_equals_data ?
'</strong>' : '');
252 echo ($key_ordered_current_equals_data ?
'<strong>' : '')
253 . '<a href="#" title="' . __('Use this value') . ($key_ordered_current_val_title != '' ?
': '
254 . $key_ordered_current_val_title : '') . '" onclick="formupdate(\''
255 . md5($field) . '\', \'' . PMA_jsFormat($key_ordered_current_key, false) . '\'); return false;">'
256 . $key_ordered_current_val . '</a>' . ($key_ordered_current_equals_data ?
'</strong>' : '');
259 <img src
="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>"
260 alt
="" width
="1" height
="1" /></td
>
264 echo ($val_ordered_current_equals_data ?
'<strong>' : '')
265 . '<a href="#" title="' . __('Use this value') . ($val_ordered_current_val_title != '' ?
': '
266 . $val_ordered_current_val_title : '') . '" onclick="formupdate(\'' . md5($field)
267 . '\', \'' . PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">'
268 . $val_ordered_current_val . '</a>' . ($val_ordered_current_equals_data ?
'</strong>' : '');
272 echo ($val_ordered_current_equals_data ?
'<strong>' : '') . '<a href="#" title="'
273 . __('Use this value') . ($val_ordered_current_val_title != '' ?
': ' . $val_ordered_current_val_title : '')
274 . '" onclick="formupdate(\'' . md5($field) . '\', \''
275 . PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">' . htmlspecialchars($val_ordered_current_key)
276 . '</a>' . ($val_ordered_current_equals_data ?
'</strong>' : '');