Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-08-17 14:40:12 +02:00
commit e3903233f8
10 changed files with 1154 additions and 502 deletions

View File

@ -150,13 +150,15 @@ function PMA_addDatepicker($this_element, options)
showOn: 'button',
buttonImage: themeCalendarImage, // defined in js/messages.php
buttonImageOnly: true,
duration: '',
time24h: true,
stepMinutes: 1,
stepHours: 1,
showTime: showTimeOption,
showSecond: true,
showTimepicker: showTimeOption,
showButtonPanel: false,
dateFormat: 'yy-mm-dd', // yy means year with four digits
altTimeField: '',
timeFormat: 'hh:mm:ss',
altFieldTimeOnly: false,
showAnim: '',
beforeShow: function(input, inst) {
// Remember that we came from the datepicker; this is used
// in tbl_change.js by verificationsAfterFieldChange()
@ -166,11 +168,10 @@ function PMA_addDatepicker($this_element, options)
setTimeout(function() {
$('#ui-timepicker-div').css('z-index',$('#ui-datepicker-div').css('z-index'))
},0);
},
constrainInput: false
}
};
$this_element.datepicker($.extend(defaultOptions, options));
$this_element.datetimepicker($.extend(defaultOptions, options));
}
/**
@ -611,7 +612,7 @@ $(document).ready(function() {
var $tr = $(this);
// make the table unselectable (to prevent default highlighting when shift+click)
$tr.parents('table').noSelect();
//$tr.parents('table').noSelect();
if (!e.shiftKey || last_clicked_row == -1) {
// usual click
@ -642,6 +643,7 @@ $(document).ready(function() {
last_shift_clicked_row = -1;
} else {
// handle the shift click
PMA_clearSelection();
var start, end;
// clear last shift click result
@ -3205,3 +3207,16 @@ $(document).ready(function() {
return true;
});
});
/**
* Clear text selection
*/
function PMA_clearSelection() {
if(document.selection && document.selection.empty) {
document.selection.empty();
} else if(window.getSelection) {
var sel = window.getSelection();
if(sel.empty) sel.empty();
if(sel.removeAllRanges) sel.removeAllRanges();
}
}

1540
js/jquery/timepicker.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -660,6 +660,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(g.cEdit).find('input[type=text]').blur();
g.isCellEditActive = false;
g.currentEditCell = null;
// destroy datepicker in edit area, if exist
$(g.cEdit).find('.hasDatepicker').datepicker('destroy');
},
/**
@ -727,7 +729,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$checkbox.attr('checked', false);
})
} else {
$(g.cEdit).find('input[type=text]').live('change', function(e) {
$(g.cEdit).find('input[type=text]').live('keypress change', function(e) {
$checkbox.attr('checked', false);
})
$editArea.find('textarea').live('keydown', function(e) {
@ -914,6 +916,33 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
}
g.isEditCellTextEditable = true;
} else if ($td.is('.datefield, .datetimefield, .timestampfield')) {
var $input_field = $(g.cEdit).find('input[type=text]');
// remember current datetime value in $input_field, if it is not null
var is_null = $td.is('.null');
var current_datetime_value = !is_null ? $input_field.val() : '';
var showTimeOption = true;
if ($td.is('.datefield')) {
showTimeOption = false;
}
PMA_addDatepicker($editArea, {
altField: $input_field,
showTimepicker: showTimeOption,
onSelect: function(dateText, inst) {
// remove null checkbox if it exists
$(g.cEdit).find('.null_div input[type=checkbox]').attr('checked', false);
}
});
// 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) {
$editArea.datetimepicker('setDate', current_datetime_value);
} else {
$input_field.val('');
}
} else {
$editArea.append('<textarea>' + PMA_getCellValue(g.currentEditCell) + '</textarea>');
$editArea.find('textarea').live('keyup', function(e) {
@ -1225,16 +1254,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
need_to_post = true;
}
} else {
if($this_field.is(":not(.relation, .enum, .set, .bit)")) {
this_field_params[field_name] = $(g.cEdit).find('textarea').val();
} else if ($this_field.is('.bit')) {
if ($this_field.is('.bit')) {
this_field_params[field_name] = '0b' + $(g.cEdit).find('textarea').val();
} else if ($this_field.is('.set')) {
$test_element = $(g.cEdit).find('select');
this_field_params[field_name] = $test_element.map(function(){
return $(this).val();
}).get().join(",");
} else {
} else if ($this_field.is('.relation, .enum')) {
// results from a drop-down
$test_element = $(g.cEdit).find('select');
if ($test_element.length != 0) {
@ -1246,6 +1273,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($test_element.length != 0) {
this_field_params[field_name] = $test_element.text();
}
} else if ($this_field.is('.datefield, .datetimefield, .timestampfield')) {
this_field_params[field_name] = $(g.cEdit).find('input[type=text]').val();
} else {
this_field_params[field_name] = $(g.cEdit).find('textarea').val();
}
if (g.wasEditedCellNull || this_field_params[field_name] != PMA_getCellValue(g.currentEditCell)) {
need_to_post = true;
@ -1545,6 +1576,9 @@ 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) {

View File

@ -235,9 +235,11 @@ class PMA_Theme_Manager
if ($handleThemes = opendir($this->getThemesPath())) {
// check for themes directory
while (false !== ($PMA_Theme = readdir($handleThemes))) {
// Skip non dirs, . and ..
if ($PMA_Theme == '.' || $PMA_Theme == '..' || ! is_dir($this->getThemesPath() . '/' . $PMA_Theme)) {
continue;
}
if (array_key_exists($PMA_Theme, $this->themes)) {
// this does nothing!
//$this->themes[$PMA_Theme] = $this->themes[$PMA_Theme];
continue;
}
$new_theme = PMA_Theme::load($this->getThemesPath() . '/' . $PMA_Theme);
@ -323,8 +325,8 @@ class PMA_Theme_Manager
/**
* load layout file if exists
*/
if (@file_exists($GLOBALS['pmaThemePath'] . 'layout.inc.php')) {
include $GLOBALS['pmaThemePath'] . 'layout.inc.php';
if (file_exists($this->theme->getLayoutFile())) {
include $this->theme->getLayoutFile();
}

View File

@ -1411,11 +1411,19 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
$hide_class = ($col_visib && !$col_visib[$j] &&
// hide per <td> only if the display direction is not vertical
$_SESSION['tmp_user_values']['disp_direction'] != 'vertical') ? 'hide' : '';
// handle datetime-related class, for grid editing
if (substr($meta->type, 0, 9) == 'timestamp' || $meta->type == 'datetime') {
$field_type_class = 'datetimefield';
} else if ($meta->type == 'date') {
$field_type_class = 'datefield';
} else {
$field_type_class = '';
}
$pointer = $i;
$is_field_truncated = false;
//If the previous column had blob data, we need to reset the class
// to $inline_edit_class
$class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' ' . $relation_class . ' ' . $hide_class; //' ' . $alternating_color_class .
$class = 'data ' . $grid_edit_class . ' ' . $not_null_class . ' ' . $relation_class . ' ' . $hide_class . ' ' . $field_type_class; //' ' . $alternating_color_class .
// See if this column should get highlight because it's used in the
// where-query.

View File

@ -15,6 +15,7 @@ require_once './libraries/check_user_privileges.lib.php';
require_once './libraries/bookmark.lib.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
$GLOBALS['js_include'][] = 'jquery/timepicker.js';
$GLOBALS['js_include'][] = 'tbl_change.js';
if (isset($_SESSION['profiling'])) {

View File

@ -96,7 +96,7 @@ class Advisor_test extends PHPUnit_Framework_TestCase
array(
array('justification' => 'foo | fsafdsa', 'name' => 'Failure', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array(),
'Failed formattingstring for rule \'Failure\'. PHP threw following error: Use of undefined constant fsafdsa - assumed \'fsafdsa\'',
'Failed formatting string for rule \'Failure\'. PHP threw following error: Use of undefined constant fsafdsa - assumed \'fsafdsa\'',
),
);
}

View File

@ -16,9 +16,9 @@ SET time_zone = "+00:00";
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
DROP DATABASE `"><script>alert(200);</script>`;
DROP DATABASE `'><script>alert(201);</script>`;
DROP DATABASE `exploit_test`;
DROP DATABASE IF EXISTS `"><script>alert(200);</script>`;
DROP DATABASE IF EXISTS `'><script>alert(201);</script>`;
DROP DATABASE IF EXISTS `exploit_test`;
--
-- Database: `"><script>alert(200);</script>`

View File

@ -2533,3 +2533,9 @@ span.cm-number {
padding-left: 20px;
}
/* css for timepicker */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { height: 25px; }
.ui-timepicker-div dl dd { margin: -25px 0 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }

View File

@ -2974,3 +2974,9 @@ span.cm-number {
padding-left: 20px;
}
/* css for timepicker */
.ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
.ui-timepicker-div dl{ text-align: left; }
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }