for ($i = 0; $i <= count($_GET["where"]); $i++) {
list(, $val) = each($_GET["where"]);
if (!$val || ("$val[col]$val[val]" != "" && in_array($val["op"], $this->operators))) {
- echo "<div>" . select_input(" name='where[$i][col]' onchange='$change_next'", $columns, $val["col"], "(" . lang('anywhere') . ")");
+ echo "<div>" . select_input(" name='where[$i][col]' onchange='$change_next'", $columns, $val["col"], "", "(" . lang('anywhere') . ")");
echo html_select("where[$i][op]", $this->operators, $val["op"], $change_next);
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow.call(this)") . ";' onkeydown='selectSearchKeydown.call(this, event);' onsearch='selectSearchSearch.call(this);'></div>\n";
}
* @param array
* @param string
* @param string
+* @param string
* @return string
*/
-function select_input($attrs, $options, $value = "", $placeholder = "") {
- return ($options
- ? "<select$attrs><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
- : "<input$attrs size='10' value='" . h($value) . "' placeholder='$placeholder'>"
- );
+function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
+ $tag = ($options ? "select" : "input");
+ return "<$tag$attrs" . ($options
+ ? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
+ : " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
+ ) . ($onchange ? "<script>qsl('$tag').onchange = $onchange;</script>" : "");
}
/** Get onclick confirmation
$i = 1;
foreach ($index["columns"] as $key => $column) {
echo "<span>" . select_input(
- " name='indexes[$j][columns][$i]' onchange=\"" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . ".call(this, '" . h(js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_")) . "');\" title='" . lang('Column') . "'",
+ " name='indexes[$j][columns][$i]' title='" . lang('Column') . "'",
($fields ? array_combine($fields, $fields) : $fields),
- $column
+ $column,
+ "partial(" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . ", '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "')"
);
echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "' title='" . lang('Length') . "'>" : "");
echo ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
*/
function indexesAddColumn(prefix) {
var field = this;
- field.onchange = partial(indexesChangeColumn, prefix);
var select = field.form[field.name.replace(/\].*/, '][type]')];
if (!select.selectedIndex) {
while (selectValue(select) != "INDEX" && select.selectedIndex < select.options.length) {
select = selects[i];
select.name = select.name.replace(/\]\[\d+/, '$&1');
select.selectedIndex = 0;
+ if (!i) {
+ select.onchange = field.onchange;
+ }
}
+ field.onchange = partial(indexesChangeColumn, prefix);
var inputs = qsa('input', column);
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];