MDL-31985 remove LOB sizes from code and UI

This commit is contained in:
Petr Skoda
2012-03-11 13:42:37 +01:00
parent 05aae0a571
commit f13489df50
7 changed files with 24 additions and 93 deletions
@@ -75,20 +75,24 @@ function transformForm(event) {
switch (typeField.value) {
case '1': // XMLDB_TYPE_INTEGER
lengthTip.innerHTML = ' 1...20';
lengthField.disabled = false;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
break;
case '2': // XMLDB_TYPE_NUMBER
lengthTip.innerHTML = ' 1...20';
lengthField.disabled = false;
decimalsTip.innerHTML = ' 0...length or empty';
break;
case '3': // XMLDB_TYPE_FLOAT
lengthTip.innerHTML = ' 1...20 or empty';
lengthField.disabled = false;
decimalsTip.innerHTML = ' 0...length or empty';
break;
case '4': // XMLDB_TYPE_CHAR
lengthTip.innerHTML = ' 1...1333'; // Hardcoded, yes!
lengthField.disabled = false;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
@@ -96,7 +100,8 @@ function transformForm(event) {
sequenceField.value = '0';
break;
case '5': // XMLDB_TYPE_TEXT
lengthTip.innerHTML = ' small, medium, big';
lengthTip.innerHTML = '';
lengthField.disabled = true;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
@@ -106,7 +111,8 @@ function transformForm(event) {
defaultField.value = '';
break;
case '6': // XMLDB_TYPE_BINARY
lengthTip.innerHTML = ' small, medium, big';
lengthTip.innerHTML = '';
lengthField.disabled = true;
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
@@ -49,8 +49,6 @@ class edit_field_save extends XMLDBAction {
'numberincorrectlength' => 'tool_xmldb',
'floatincorrectlength' => 'tool_xmldb',
'charincorrectlength' => 'tool_xmldb',
'textincorrectlength' => 'tool_xmldb',
'binaryincorrectlength' => 'tool_xmldb',
'numberincorrectdecimals' => 'tool_xmldb',
'floatincorrectdecimals' => 'tool_xmldb',
'defaultincorrect' => 'tool_xmldb',
@@ -201,28 +199,8 @@ class edit_field_save extends XMLDBAction {
}
}
}
// Text checks
if ($type == XMLDB_TYPE_TEXT) {
if ($length != 'small' &&
$length != 'medium' &&
$length != 'big') {
$errors[] = $this->str['textincorrectlength'];
}
if ($default !== NULL && $default !== '') {
if (substr($default, 0, 1) == "'" ||
substr($default, -1, 1) == "'") {
$errors[] = $this->str['defaultincorrect'];
}
}
}
// Binary checks
if ($type == XMLDB_TYPE_BINARY) {
if ($length != 'small' &&
$length != 'medium' &&
$length != 'big') {
$errors[] = $this->str['binaryincorrectlength'];
}
}
// No text checks
// No binary checks
if (!empty($errors)) {
$tempfield = new xmldb_field($name);
-2
View File
@@ -27,7 +27,6 @@ $string['actual'] = 'Actual';
$string['aftertable'] = 'After table:';
$string['back'] = 'Back';
$string['backtomainview'] = 'Back to main';
$string['binaryincorrectlength'] = 'Incorrect length for binary field';
$string['cannotuseidfield'] = 'Cannot insert the "id" field. It is an autonumeric column';
$string['completelogbelow'] = '(see the complete log of the search below)';
$string['confirmdeletefield'] = 'Are you absolutely sure that you want to delete the field:';
@@ -159,7 +158,6 @@ $string['selecttable'] = 'Select table:';
$string['table'] = 'Table';
$string['tablenameempty'] = 'The table name cannot be empty';
$string['tables'] = 'Tables';
$string['textincorrectlength'] = 'Incorrect length for text field';
$string['unload'] = 'Unload';
$string['up'] = 'Up';
$string['view'] = 'View';