📄 window.js
字号:
/****************************************************************************
* Compiere (c) Jorg Janke - All rights reseverd
* $Id: window.js,v 1.1.1.1 2002/10/12 01:06:56 jjanke Exp $
*
* Web Window Utilities
***************************************************************************/
/****************************************************************************
* Text constants
*/
var deleteText = "ConfirmDelete";
/****************************************************************************
* Dynamic Display
* - for form: WForm
* - changing field should have onChange="dynDisplay" to trigger evaluation
* - changed field should have document.WForm.field.displayLogic='expression'
*/
function dynDisplay()
{
var el = document.WForm.elements;
// for all fields
for (var i = 0; i < el.length; i++)
{
// do we have displayLogic ?
var dLogic = el[i].displayLogic;
if (typeof dLogic == "string" && dLogic.length > 0)
{
if (evaluate(dLogic))
show(el[i].id);
else
hide(el[i].id);
} // we have displayLogic
} // for all fields
} // dynDisplay
/**
* Evaluate Display Logic
* >> |& <<
*/
function evaluate (dLogic)
{
var pos1 = dLogic.indexOf('&');
var pos2 = dLogic.indexOf('|');
// only a tuple
if (pos1 == pos2)
{
return evaluateTuple(dLogic);
}
// and: &
else if (pos1 > pos2)
{
tuples = dLogic.split('&');
return evaluateTuple(tuples[0]) && evaluate(dLogic.substring(pos1+1));
}
// or: |
else
{
tuples = dLogic.split('|');
return evaluateTuple(tuples[0]) || evaluate(dLogic.substring(pos2+1));
}
} // evaluate
/**
* evaluate tuple 'x = y' or x ^ y or x ! y
* >> =!^ <<
*/
function evaluateTuple(myValue)
{
// Equals
var tuples = myValue.split('=');
if (tuples.length == 2)
return getRealValue(tuples[0]) == getRealValue(tuples[1]);
// Not Equals
tuples = myValue.split('^');
if (tuples.length == 2)
return getRealValue(tuples[0]) != getRealValue(tuples[1]);
tuples = myValue.split('!');
if (tuples.length == 2)
return getRealValue(tuples[0]) != getRealValue(tuples[1]);
//
alert ('Error: evaluateTuple="' + myValue + '" invalid.');
return false;
} // evaluateTuple
/**
* get (variable) value
*/
function getRealValue (myValue)
{
var pos1 = myValue.indexOf('@');
var pos2 = myValue.indexOf('@', pos1+1);
// Constant - remove blanks an '"
if (pos1 == pos2)
return myValue.replace(/['" ]/g, "");
// Variable
var variable = myValue.substring(pos1+1, pos2);
for (var i = 0; i < document.WForm.elements.length; i++)
{
if (document.WForm.elements[i].name == variable)
return document.WForm.elements[i].value;
}
// Nothing found
return "";
} // getRealValue
/****************************************************************************
* Lookup - get FormName and ColumnName and submit to WLookup
*/
function startLookup (columnName)
{
var url = "/compiere/WLookup?FormName=" + escape (columnName.form.name)
+ "&ColumnName=" + escape (columnName.name);
// alert (url);
var w = window.open(url, "lookup",
"dependent=yes,scrollbars=yes,resizable=yes,width=600,height=300");
w.focus();
return false; // do not submit page
} // startLookup
/****************************************************************************
* Account - get FormName and ColumnName and submit to WAccount
*/
function startAccount (columnName)
{
var url = "/compiere/WAccount?FormName=" + escape (columnName.form.name)
+ "&ColumnName=" + escape (columnName.name);
// alert (url);
var w = window.open(url, "account",
"dependent=yes,scrollbars=yes,resizable=yes,width=600,height=300");
w.focus();
return false; // do not submit page
} // startAccount
/****************************************************************************
* Location - get FormName and ColumnName and submit to WLocation
*/
function startLocation (columnName)
{
var url = "/compiere/WLocation?FormName=" + escape (columnName.form.name)
+ "&ColumnName=" + escape (columnName.name);
// alert (url);
var w = window.open(url, "location",
"dependent=yes,scrollbars=yes,resizable=yes,width=600,height=300");
w.focus();
return false; // do not sublit page
} // startLocation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -