3 // vim: expandtab sw=4 ts=4 sts=4:
5 * display selection for relational field values
9 * Gets a core script and starts output buffering work
11 require_once('./libraries/common.lib.php');
13 PMA_checkParameters(array('db', 'table', 'field'));
15 require_once('./libraries/ob.lib.php');
17 $ob_mode = PMA_outBufferModeGet();
19 PMA_outBufferPre($ob_mode);
22 require_once('./libraries/header_http.inc.php');
23 $field = urldecode($field);
29 require_once('./libraries/relation.lib.php'); // foreign keys
30 require_once('./libraries/transformations.lib.php'); // Transformations
31 $cfgRelation = PMA_getRelationsParam();
32 $foreigners = ($cfgRelation['relwork'] ?
PMA_getForeigners($db, $table) : FALSE);
34 $override_total = TRUE;
40 $foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' ';
41 if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
42 unset($foreign_limit);
45 require('./libraries/get_foreign.lib.php');
48 $pk_uri = '&pk=' . urlencode($pk);
50 <input type
="hidden" name
="pk" value
="<?php echo urlencode($pk); ?>" />
58 // $the_total comes from get_foreign.lib.php
60 if (isset($disp_row) && is_array($disp_row)) {
62 if ( $cfg['ShowAll'] && ($the_total > $per_page) ) {
63 $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
66 $session_max_rows = $per_page;
67 $pageNow = @floor
($pos / $session_max_rows) +
1;
68 $nbTotalPage = @ceil
($the_total / $session_max_rows);
70 if ( $the_total > $per_page ) {
71 $gotopage = PMA_pageselector(
72 'browse_foreigners.php?field=' . urlencode($field) .
73 '&' . PMA_generate_common_url($db, $table)
75 '&fieldkey=' . (isset($fieldkey) ?
$fieldkey : '') .
76 '&foreign_filter=' . (isset($foreign_filter) ?
htmlspecialchars($foreign_filter) : '') .
85 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
86 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
87 <html xmlns
="http://www.w3.org/1999/xhtml"
88 xml
:lang
="<?php echo $available_languages[$lang][2]; ?>"
89 lang
="<?php echo $available_languages[$lang][2]; ?>"
90 dir
="<?php echo $text_dir; ?>">
93 <title
>phpMyAdmin
</title
>
94 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset; ?>" />
95 <link rel
="stylesheet" type
="text/css"
96 href
="./css/phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&js_frame=right" />
97 <script src
="./js/functions.js" type
="text/javascript" language
="javascript"></script
>
98 <script type
="text/javascript" language
="javascript">
101 function formupdate( field
, key
) {
102 if (opener
&& opener
.document
&& opener
.document
.insertForm
) {
103 var field
= 'field_' + field
;
105 <?php
if ( isset( $pk ) ) { ?
>
106 var element_name
= field +
'[multi_edit][<?php echo urlencode( $pk ); ?>][]';
108 var element_name
= field +
'[]';
111 <?php
if ( isset( $fieldkey ) ) { ?
>
112 var element_name_alt
= field +
'[<?php echo $fieldkey; ?>]';
114 var element_name_alt
= field +
'[0]';
117 if (opener
.document
.insertForm
.elements
[element_name
]) {
119 opener
.document
.insertForm
.elements
[element_name
].value
= key
;
122 } else if (opener
.document
.insertForm
.elements
[element_name_alt
]) {
124 opener
.document
.insertForm
.elements
[element_name_alt
].value
= key
;
130 alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
136 <body id
="body_browse_foreigners">
138 <form action
="browse_foreigners.php" method
="post">
140 <?php
echo PMA_generate_common_hidden_inputs( $db, $table ); ?
>
141 <input type
="hidden" name
="field" value
="<?php echo urlencode($field); ?>" />
142 <input type
="hidden" name
="fieldkey"
143 value
="<?php echo isset($fieldkey) ? $fieldkey : ''; ?>" />
144 <?php
if ( isset( $pk ) ) { ?
>
145 <input type
="hidden" name
="pk" value
="<?php echo urlencode($pk); ?>" />
147 <span
class="formelement">
148 <label
for="input_foreign_filter"><?php
echo $strSearch . ':'; ?
></label
>
149 <input type
="text" name
="foreign_filter" id
="input_foreign_filter"
150 value
="<?php echo isset($foreign_filter) ? htmlspecialchars($foreign_filter) : ''; ?>" />
151 <input type
="submit" name
="submit_foreign_filter" value
="<?php echo $strGo;?>" />
153 <span
class="formelement">
154 <?php
echo $gotopage; ?
>
156 <span
class="formelement">
157 <?php
echo $showall; ?
>
164 if (isset($disp_row) && is_array($disp_row)) {
166 <th>' . $strKeyname . '</th>
167 <th>' . $strDescription . '</th>
168 <td width="20%"></td>
169 <th>' . $strDescription . '</th>
170 <th>' . $strKeyname . '</th>
173 echo '<thead>' . $header . '</thead>' . "\n"
174 .'<tfoot>' . $header . '</tfoot>' . "\n"
179 foreach ( $disp_row as $relrow ) {
180 if ($foreign_display != FALSE) {
181 $values[] = $relrow[$foreign_display];
186 $keys[] = $relrow[$foreign_field];
193 $val_ordered_current_row = 0;
194 $val_ordered_current_equals_data = false;
195 $key_ordered_current_equals_data = false;
196 foreach ( $keys as $key_ordered_current_row => $value ) {
197 //for ( $i = 0; $i < $count; $i++ ) {
200 if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
206 $key_ordered_current_key = $keys[$key_ordered_current_row];
207 $key_ordered_current_val = $values[$key_ordered_current_row];
209 $val_ordered_current_key = $keys[$val_ordered_current_row];
210 $val_ordered_current_val = $values[$val_ordered_current_row];
212 $val_ordered_current_row++
;
214 if (PMA_strlen( $val_ordered_current_val ) <= $cfg['LimitChars']) {
215 $val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
216 $val_ordered_current_val_title = '';
218 $val_ordered_current_val_title =
219 htmlspecialchars( $val_ordered_current_val );
220 $val_ordered_current_val =
221 htmlspecialchars( PMA_substr( $val_ordered_current_val, 0,
222 $cfg['LimitChars'] ) . '...' );
224 if (PMA_strlen( $key_ordered_current_val ) <= $cfg['LimitChars']) {
225 $key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
226 $key_ordered_current_val_title = '';
228 $key_ordered_current_val_title =
229 htmlspecialchars( $key_ordered_current_val );
230 $key_ordered_current_val =
231 htmlspecialchars( PMA_substr( $key_ordered_current_val, 0,
232 $cfg['LimitChars'] ) . '...' );
235 if ( ! empty( $data ) ) {
236 $val_ordered_current_equals_data = $val_ordered_current_key == $data;
237 $key_ordered_current_equals_data = $key_ordered_current_key == $data;
241 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
244 echo ($key_ordered_current_equals_data ?
'<b>' : '')
245 .'<a href="#" title="' . $strUseThisValue
246 . ($key_ordered_current_val_title != '' ?
': ' . $key_ordered_current_val_title : '') . '"'
247 .' onclick="formupdate(\'' . md5($field) . '\', \''
248 . htmlspecialchars($key_ordered_current_key) . '\'); return false;">'
249 .htmlspecialchars($key_ordered_current_key) . '</a>' . ($key_ordered_current_equals_data ?
'</b>' : '');
253 echo ($key_ordered_current_equals_data ?
'<b>' : '')
254 . '<a href="#" title="' . $strUseThisValue . ($key_ordered_current_val_title != '' ?
': '
255 . $key_ordered_current_val_title : '') . '" onclick="formupdate(\''
256 . md5($field) . '\', \'' . htmlspecialchars($key_ordered_current_key) . '\'); return false;">'
257 . $key_ordered_current_val . '</a>' . ($key_ordered_current_equals_data ?
'</b>' : '');
260 <img src
="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>"
261 alt
="" width
="1" height
="1"></td
>
265 echo ($val_ordered_current_equals_data ?
'<b>' : '')
266 . '<a href="#" title="' . $strUseThisValue . ($val_ordered_current_val_title != '' ?
': '
267 . $val_ordered_current_val_title : '') . '" onclick="formupdate(\'' . md5($field)
268 . '\', \'' . htmlspecialchars($val_ordered_current_key) . '\'); return false;">'
269 . $val_ordered_current_val . '</a>' . ($val_ordered_current_equals_data ?
'</b>' : '');
273 echo ($val_ordered_current_equals_data ?
'<b>' : '') . '<a href="#" title="'
274 . $strUseThisValue . ($val_ordered_current_val_title != '' ?
': ' . $val_ordered_current_val_title : '')
275 . '" onclick="formupdate(\'' . md5($field) . '\', \''
276 . htmlspecialchars($val_ordered_current_key) . '\'); return false;">' . htmlspecialchars($val_ordered_current_key)
277 . '</a>' . ($val_ordered_current_equals_data ?
'</b>' : '');
292 * Close MySql connections
294 if (isset($controllink) && $controllink) {
295 @PMA_DBI_close
($controllink);
297 if (isset($userlink) && $userlink) {
298 @PMA_DBI_close
($userlink);
303 * Sends bufferized data
305 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
306 && isset($ob_mode) && $ob_mode) {
307 PMA_outBufferPost($ob_mode);