diff --git a/js/makegrid.js b/js/makegrid.js index 70e9b9adb1..e7f2d32f5a 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -654,7 +654,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.isCellEditActive = false; g.currentEditCell = null; // destroy datepicker in edit area, if exist - $(g.cEdit).find('.hasDatepicker').datepicker('destroy'); + var $dp = $(g.cEdit).find('.hasDatepicker'); + if ($dp.length > 0) { + $dp.datepicker('destroy'); + // change the cursor in edit box back to normal + // (the cursor become a hand pointer when we add datepicker) + $(g.cEdit).find('.edit_box').css('cursor', 'inherit'); + } }, /** @@ -785,11 +791,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.lastXHR = $.post('sql.php', post_params, function(data) { g.lastXHR = null; $editArea.removeClass('edit_area_loading'); - // save original_data - var value = $(data.dropdown).val(); - $td.data('original_data', value); - // update the text input field, in case where the "Relational display column" is checked - $(g.cEdit).find('.edit_box').val(value); + if ($(data.dropdown).is('select')) { + // save original_data + var value = $(data.dropdown).val(); + $td.data('original_data', value); + // update the text input field, in case where the "Relational display column" is checked + $(g.cEdit).find('.edit_box').val(value); + } $editArea.append(data.dropdown); $editArea.append('
' + g.cellEditHint + '
'); @@ -942,6 +950,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi } }); + // cancel any click on the datepicker element + $editArea.find('> *').click(function(e) { + e.stopPropagation(); + }); + // force to restore modified $input_field value after adding datepicker // (after adding a datepicker, the input field doesn't display the time anymore, only the date) if (!is_null) { @@ -1572,9 +1585,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi e.preventDefault(); } }); - $(g.cEdit).find('.edit_area').click(function(e) { - e.stopPropagation(); - }); $('html').click(function(e) { // hide edit cell if the click is not from g.cEdit if ($(e.target).parents().index(g.cEdit) == -1) { diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 4b286d3b71..833dd20fbc 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -97,11 +97,11 @@ function PMA_getIcon($icon, $alternate = '', $force_text = false, $noSprite = fa if ($include_icon) { if ($noSprite) { $button .= ''; + . ' class="icon" width="16" height="16" />'; } else { - $button .= '' . $alternate . ''; + $button .= '' . $alternate . ''; } } @@ -386,15 +386,21 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju if (defined('PMA_MYSQL_INT_VERSION')) { if (PMA_MYSQL_INT_VERSION >= 50500) { $mysql = '5.5'; - /* l10n: Language to use for MySQL 5.5 documentation, please use only languages which do exist in official documentation. */ + /* l10n: Language to use for MySQL 5.5 documentation, please + * use only languages which do exist in official documentation. + */ $lang = _pgettext('MySQL 5.5 documentation language', 'en'); } else if (PMA_MYSQL_INT_VERSION >= 50100) { $mysql = '5.1'; - /* l10n: Language to use for MySQL 5.1 documentation, please use only languages which do exist in official documentation. */ + /* l10n: Language to use for MySQL 5.1 documentation, please + * use only languages which do exist in official documentation. + */ $lang = _pgettext('MySQL 5.1 documentation language', 'en'); } else { $mysql = '5.0'; - /* l10n: Language to use for MySQL 5.0 documentation, please use only languages which do exist in official documentation. */ + /* l10n: Language to use for MySQL 5.0 documentation, please use + * only languages which do exist in official documentation. + */ $lang = _pgettext('MySQL 5.0 documentation language', 'en'); } } @@ -409,9 +415,11 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju if ($just_open) { return $open_link; } elseif ($big_icon) { - return $open_link . '' . __('Documentation') . ''; + return $open_link . ''
+            . __('Documentation') . ''; } elseif ($GLOBALS['cfg']['ReplaceHelpImg']) { - return $open_link . '' . __('Documentation') . ''; + return $open_link . ''
+            . __('Documentation') . ''; } else { return '[' . $open_link . __('Documentation') . ']'; } @@ -430,9 +438,12 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju function PMA_showDocu($anchor) { if ($GLOBALS['cfg']['ReplaceHelpImg']) { - return '' . __('Documentation') . ''; + return '' + . ''
+            . __('Documentation') . ''; } else { - return '[' . __('Documentation') . ']'; + return '[' + . __('Documentation') . ']'; } } // end of the 'PMA_showDocu()' function @@ -450,7 +461,9 @@ function PMA_showPHPDocu($target) $url = PMA_getPHPDocLink($target); if ($GLOBALS['cfg']['ReplaceHelpImg']) { - return '' . __('Documentation') . ''; + return '' + . ''
+            . __('Documentation') . ''; } else { return '[' . __('Documentation') . ']'; } @@ -559,7 +572,8 @@ $is_modify_link = true, $back_url = '', $exit = true) // --- // modified to show the help on sql errors $error_msg_output .= '

' . __('SQL query') . ':' . "\n"; - if (strstr(strtolower($formatted_sql), 'select')) { // please show me help to the error on select + if (strstr(strtolower($formatted_sql), 'select')) { + // please show me help to the error on select $error_msg_output .= PMA_showMySQLDocu('SQL-Syntax', 'SELECT'); } if ($is_modify_link) { @@ -588,8 +602,12 @@ $is_modify_link = true, $back_url = '', $exit = true) .'

' . "\n"; } // end if - if (!empty($error_message)) { - $error_message = preg_replace("@((\015\012)|(\015)|(\012)){3,}@", "\n\n", $error_message); + if (! empty($error_message)) { + $error_message = preg_replace( + "@((\015\012)|(\015)|(\012)){3,}@", + "\n\n", + $error_message + ); } // modified to show the help on error-returns // (now error-messages-server) @@ -600,7 +618,8 @@ $is_modify_link = true, $back_url = '', $exit = true) . '

' . "\n"; // The error message will be displayed within a CODE segment. - // To preserve original formatting, but allow wordwrapping, we do a couple of replacements + // To preserve original formatting, but allow wordwrapping, + // we do a couple of replacements // Replace all non-single blanks with their HTML-counterpart $error_message = str_replace(' ', '  ', $error_message); @@ -928,7 +947,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view echo "\n"; echo '' . "\n"; } // end if ... elseif @@ -947,7 +967,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence, // check for it's presence before using it - echo '
' . "\n"; + echo '
' . "\n"; if ($message instanceof PMA_Message) { if (isset($GLOBALS['special_message'])) { @@ -986,7 +1008,11 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // when the query is large (for example an INSERT of binary // data), the parser chokes; so avoid parsing the query $query_too_big = true; - $shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]')); + $shortened_query_base = nl2br( + htmlspecialchars( + substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]' + ) + ); } elseif (! empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) { // (here, use "! empty" because when deleting a bookmark, @@ -1109,7 +1135,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // to edit it (unless it's enormous, see PMA_linkOrButton() ) if (! empty($cfg['SQLQuery']['Edit'])) { if ($cfg['EditInWindow'] == true) { - $onclick = 'window.parent.focus_querywindow(\'' . PMA_jsFormat($sql_query, false) . '\'); return false;'; + $onclick = 'window.parent.focus_querywindow(\'' + . PMA_jsFormat($sql_query, false) . '\'); return false;'; } else { $onclick = ''; } @@ -1205,14 +1232,18 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view if (empty($refresh_link) || ! PMA_profilingSupported()) { echo '
'; echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); - echo ''; + echo ''; echo '
'; } // in the tools div, only display the Inline link when not in ajax // mode because 1) it currently does not work and 2) we would // have two similar mechanisms on the page for the same goal - if ($is_select || $GLOBALS['is_ajax_request'] === false && ! $query_too_big) { + if ($is_select + || $GLOBALS['is_ajax_request'] === false + && ! $query_too_big + ) { // see in js/functions.js the jQuery code attached to id inline_edit // document.write conflicts with jQuery, hence used $().append() echo "