oRange.moveStart("character",p_len);
oRange.moveEnd("character",p_len);
oRange.select();
- } else if (otxb.setSelectionRange) {
+ }
+ else if (otxb.setSelectionRange) {
otxb.setSelectionRange(p_len,p_len);
+ }
}
-}
otxb.focus();
}
}
}
-function findPosX(obj)
-{
+function findPosX(obj) {
if(obj) {
var curleft = 0;
- if (obj.offsetParent)
- {
+ if (obj.offsetParent) {
while (obj.offsetParent)
{
curleft += obj.offsetLeft
}
}
-function findPosY(obj)
-{
+function findPosY(obj) {
if(obj) {
var curtop = 0;
var n = 0;
if (obj.y) {
curtop += obj.y;
}
- else if (obj.offsetParent)
- {
- while (obj.offsetParent)
- {
+ else if (obj.offsetParent) {
+ while (obj.offsetParent) {
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
curopt = 0;
bnsr = false;
otxb.onkeyup = function (oEvent) {
- if (!oEvent) { oEvent = window.event; } hKU(oEvent); };
+ if (!oEvent) { oEvent = window.event; } hKU(oEvent);
+ };
initac(tb,fk,sid,db,v);
} else {
otxb.onkeyup = function() {};
function iA(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
+
var asg = new Array();
var rasg = new Array();
var rasgc = new Array();
<?php
include_once('libraries/lib.inc.php');
- $szSQL = 'SELECT * FROM ' . $data->clean($_REQUEST['tb']) . ' WHERE ' . $data->clean($_REQUEST['fk']) . " LIKE '" . $data->clean($_REQUEST['v']) . "%' LIMIT 11";
+ $data->clean($_REQUEST['tb']);
+ $data->clean($_REQUEST['fk']);
+ $data->clean($_REQUEST['v']);
+
+ $szSQL = 'SELECT * FROM ' . $_REQUEST['tb'] . ' WHERE ' . $_REQUEST['fk']
+ . "::text LIKE '" . $_REQUEST['v'] . "%' ORDER BY ". $_REQUEST['fk'] ." LIMIT 11";
+
$objRes = $data->selectSet($szSQL);
$arrayRes = array();
while (!$objRes->EOF) {
$arrayRes[] = $objRes->fields[$_REQUEST['fk']];
$objRes->moveNext();
}
+
echo implode('PPA_EOF;|', $arrayRes);
?>
/**
* List tables in a database
*
- * $Id: tables.php,v 1.108 2007/12/27 18:28:36 ioguix Exp $
+ * $Id: tables.php,v 1.109 2008/01/14 17:55:01 ioguix Exp $
*/
// Include application functions
global $data, $misc, $conf;
global $lang;
- $bAllowAC = ($conf['autocomplete'] != 'disable') ? TRUE : FALSE;
+ $bAllowAC = (($conf['autocomplete'] != 'disable') ? TRUE : FALSE)
+ && $data->hasConstraintsInfo();
if ($confirm) {
$misc->printTrail('table');
$attrs = $data->getTableAttributes($_REQUEST['table']);
if($bAllowAC) {
- $constraints = $data->getConstraints($_REQUEST['table']);
+ $constraints = $data->getConstraintsWithFields($_REQUEST['table']);
+
$arrayLocals = array();
$arrayRefs = array();
$nC = 0;
while(!$constraints->EOF) {
- // The following RE will match a FK constrain with a single (quoted or not) referencing column. At the moment we don't support multicolumn FKs
- preg_match('/^FOREIGN KEY \(("[^"]*"|[^\s",]*)\) REFERENCES (.*)\((.*)\)/i', $constraints->fields['consrc'], $matches);
- if(!empty($matches)) {
- // Strip possible quotes and save
- $arrayLocals[$nC] = preg_replace('/"(.*)"/', '$1', $matches[1]);
- $arrayRefs[$nC] = array(preg_replace('/"(.*)"/', '$1', $matches[2]), preg_replace('/"(.*)"/', '$1', $matches[3]));
+ // FIXME: add a better support for FKs on multi columns
+ if ($constraints->fields['contype'] == 'f') {
+ $arrayLocals[$nC] = $constraints->fields['p_field'];
+ $arrayRefs[$nC] = array($constraints->fields['f_table'], $constraints->fields['f_field']);
$nC++;
}
$constraints->moveNext();