small changes

This commit is contained in:
Len Kranendonk 2004-07-23 09:21:22 +00:00
parent 02d24c4e4c
commit c8139d9333
4 changed files with 17 additions and 6 deletions

View file

@ -20,6 +20,7 @@ use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Macro;
use Tie::IxHash;
use WebGUI::ErrorHandler;
=head1 NAME
@ -294,7 +295,7 @@ sub getWobjectByCriteria {
if ($wobjectId) {
$scratchId = "WobjectProxy_" . $wobjectId;
if($session{scratch}{$scratchId}) {
return $session{scratch}{$scratchId};
return $session{scratch}{$scratchId} unless ($session{var}{adminOn});
}
}
@ -360,7 +361,7 @@ sub getWobjectByCriteria {
# No matching wobjects found.
if (scalar(@wids) == 0) {
return undef;
return undef; # fall back to the originally mirrored wobject.
}
my $wid;
# Grab a wid from the results

View file

@ -281,7 +281,7 @@ sub _drawQueryBuilder {
</td>
<td class="qbtd"></td>
<td class="qbtdright">
<input class="qbselect" type=button value=Add onclick="addCriteria('$fieldLabel', this.form.$opFieldName, this.form.$valFieldName)"></td>
<input class="qbButton" type=button value=Add onclick="addCriteria('$fieldLabel', this.form.$opFieldName, this.form.$valFieldName)"></td>
</tr>
|;
}

View file

@ -33,6 +33,13 @@
font-size: 12px;
}
.qbButton {
height: 20px;
font-size: 12px;
border-width: 1px;
-moz-border-radius: 0px;
}
.qbText {
background-color: white;
text-align: left;

View file

@ -4,14 +4,17 @@ function addCriteria ( fieldname, opform, valform ) {
var value = getValue(valform);
var criteria = form.proxyCriteria.value;
var conjunction = "";
var re = /^\s*$/;
if(! re.test(criteria)) {
if(! /^\s*$/.test(criteria)) {
conjunction = " " + getValue(form.conjunction) + " ";
}
//handle quotes
if(/\s+/.test(fieldname)) {
fieldname = '"' + fieldname + '"';
}
var statement = fieldname + " " + operator + " " + '"' + value + '"';
if(/^\D+$/.test(value)) {
value = '"' + value + '"';
}
var statement = fieldname + " " + operator + " " + value;
form.proxyCriteria.value = criteria + conjunction + statement;
}