1. Added rowColorLens property to set the color of the current row:
# sets the color to red if PRICE is negative, otherwise use normal colors.
$lens->rowColorLens = '= ({PRICE}<0) ? "red" : false ';
There is a default rowColorLens installed now. The source code for the
function it calls (LensRowColor) can be found in phplens.inc.php. Code contributed
by Eric Grau.
Also added dynamic editor setting called (Child Editor) so you can decide
whether to enable record editing in the detail grid.
Also see point 3 for another example, coloring the currently selected row.
2. The following properties support PHP global variables and 1-dimensional global
arrays. Optional curly-brackets are usable:
Triggered by =
powerLens - modify field columns
sql - sql statement
keyTable - table to update
Triggered by % because = is used for text mappings
lookupLens - mappings for popups, checkboxes, and submit & radio buttons
Examples:
$lens->keyTable = '=$table'; # get table name from variable $table
# dynamic table name
$lens->sql = '=select * from {$prefix}table';
# get states from table usa_states, malaysia_states, etc depending on
# the country...
$lens->lookupLens = 'state^%select statecodes from {$country}_states';
# for lookuplens, if {$var} means from PHP globals, if {col} then from database
$lens->powerLens = 'URL^={$HTTP_SERVER_VARS['HTTP_HOST']}://{PATH}'
3. Added _HILITE_RECNO_ and _RECNO_ variables in powerLens and rowColorLens.
Useful for telling phplens to drilldown from grid to detail view from an
<A> tag. Use {_HILITE_RECNO_} == {_RECNO_} to find out if the current
row is selected.
Eg. We have a phpLens with $ID='abc', and we want to drilldown to the detail
view (note: it uses the new global var support with $ID and $PHP_SELF):
$lens->powerLens = 'Column^=<a href=$PHP_SELF?lens_no_$ID={_RECNO_}>{Column}</a>';
#hilite the current row
$lens->rowColorLens = '={_RECNO_} == {_HILITE_RECNO_}? "#FFCCCC": false';
4. Property powerEditLens added. This allows you to modify the value of an field
when editing an existing record. Useful for timestamping modifications. This differs
from defaultLens which only allows you to modify the field when creating a new record.
For example to set the TimeModified and TimeCreated fields:
$lens->readOnlyLens = 'TimeModified;TimeCreated';
$lens->powerEditLens = 'TimeModified^=time()';
$lens->defaultLens = 'TimeModified^=time();TimeCreated^=time()';
This property can be edited from the dynamic editor.
5. Added inputTypeLens property to support checkboxes, radio buttons and
submit buttons. Can be edited in dynamic editor.
# choose 1 gender, and choose multiple hobbies
$lens->inputTypeLens = 'gender^radio;hobbies^checkbox';
6. Property displaySep added to hold the text used to separate checkbox items.
Checkbox items are not stored in a separate child table, but as items in the current
table, separated by this displaySep value (default is ', ').
7. Save/Cancel buttons appear on both top/bottom navigation bars if the number of
fields is greater than constant 'LENS_SHOW_TOP_MIN_ITEMS' in phplens.inc.php.
8. Property showCancel to determine whether cancel button is displayed when
editing records. Default is $lens->showCancel = true;
9. Added == to lookupLens property.
There are 2 uses for lookupLens. First, for remapping (say 'CA' to 'California'),
and the other is for displaying a popup selection. If you were using lookupLens with
text lookup to implement a popup selection, in phpLens 1.0 you use:
$lens->lookupLens = 'sports^==Football/Football/Squash/Squash/Tennis/Tennis';
Now we support a simplified lookupLens for this scenario using ==
$lens->lookupLens = 'sports^=Football/Squash/Tennis';
10. Property textAreaHeader extended to support different textarea rows and cols
for different fields. The old syntax is still supported.
$lens->textAreaHeader = 'field1^rows=10 cols=40;widefield^rows=3 cols=80';
11. The sqlBind property will cause variable binding to occur in SQL statements.
Currently supported by ODBC.
$lens->sqlBind = true;
12. Nested phpLens objects now work properly.
13. Now if properties redirectOnInsert and redirectOnInsertCancel are set, then
no viewing of grid is allowed for security reasons.
14. The beta uses popcalendarxp as a test. This is a neat calendar that is displayed
with date input fields.
To release it in the commercial version, you will have to pay US$100 to the author
of this shareware javascript application (1 time charge). We might not release it
if there is not enough demand for this...
The author is Liming(Victor) Weng Email: popcal@yahoo.com
15. Many template changes to support future phpLens improvements. Your macro input
variables will have to be changed from {COLUMN_INPUT} to {COLUMN}. Also changed
macro {_EDIT_} to {_DYNEDIT_}.
16. Now if the field is mustFill but is set to readOnly then the field can be modified
on record creation, but not editable in the future after the record is created.
17. New errorHandler property. Returns true if error should be shown, false to ignore
the error. The parameters are:
$msg = holds the error message
$severity = one of {LENSERROR_SEVERE=1, LENSERROR=0, LENSWARNING=-1}
$objid = the phpLens object id
function show_error($msg, $severity, $objid)
{
if ($severity >= LENSERROR_SEVERE) {
@mail('admin',"Error $objid",$msg);
die();
}
return true;
}
$lens->errorHandler = 'show_error';
18. PhpLens template skeleton support if you set $lens->debug = -1. Useful for generating
basic Smarty templates quickly which you can then edit in a graphical html editor.
19. Replace details with edit grid. Use with caution as this feature is very new and
has not been tested as thoroughly as the rest of phpLens. Uses new property childLens.
Syntax:
$lens->childLens = '{id of child phplens};editdetail';
The string editdetail is a constant that should not be changed. In the future, additional
constants will be defined to modify the behaviour of the child phpLens object. The id
of the child phpLens should be a unique value that is not used by other phpLens objects.
Example 1: Simple Example
include_once('./phplens.inc.php');
session_start();
$db = &ADONewConnection('mysql');
if (!$db->PConnect('localhost','root','','db')) print 'Error:'.$db->ErrorMsg();
$lens = new PHPLens('editdet',$db,' select * from products order by 1 ');
$lens->childLens = 'editdet2;editdetail';
$lens->canEdit = true;
$lens->canDelete = true;
$lens->canNew = true;
$lens->Render();
$lens->Close();
Example 2: You want to modify the child phplens object so the top border is green.
You will need to extend the Clone() method:
include_once('./phplens.inc.php');
session_start();
class PhpLens2 extends PhpLens {
function &Clone()
{
$lens = PhpLens::Clone();
$lens->colorNavBorder = 'green';
return $lens;
}
}
$db = &ADONewConnection('mysql');
if (!$db->PConnect('localhost','root','','db')) print 'Error:'.$db->ErrorMsg();
$lens = new PHPLens2('editdt',$db,' select * from products order by 1 ');
$lens->childLens = 'editdt2;editdetail';
$lens->canEdit = true;
$lens->canDelete = true;
$lens->canNew = true;
$lens->Render();
$lens->Close();
20. Better support for double-byte characters.
COMPATIBILITY: This might affect older phpLens
as some ampersands (&) will be displayed as &
when editing.
24 August 2001.