bug fixes

This commit is contained in:
JT Smith 2009-10-22 10:11:12 -05:00
parent 7f474ed7bc
commit 78024c9907
2 changed files with 13 additions and 13 deletions

View file

@ -23,20 +23,22 @@ You must migrate your asset to use the new WebGUI::Definition::Asset class inste
1) You pass your definition into use WebGUI::Definition::Asset ( def goes here );
2) You no longer have a reference to $session, so you'll need to make sub routine refs to to method calls.
2) You no longer have a reference to $session, so you'll need to make sub routine refs to to method calls. However, you cannot use sub refs on any attributes or the following property elements: tableName, fieldType.
3) You no longer have customDrawMethod. You must make custom form controls.
3) You no longer have the "customDrawMethod" element. You must make custom form controls.
4) You no longer have filters. Instead, each property has a method called propertyName (so a property called 'title' would be title()). You can override that to achieve the same result.
5) Because you don't have a reference to $session, you can't internationalize right in the definition. So property elements like "label" and "hoverHelp" are just i18n identifiers and will automatically be run through internationalization on calling the getProperty() method.
6) Definition's are now rigid. This means that every property needs to be defined in the definition, and it must at least have a "fieldType" element. If the field is to be displayed (ie: it doesn't have a noFormPost=>1 element) then it must also at minimum have label and hoverHelp elements. In addition, you must specify assetName, tableName, and properties attributes at minimum. Anything less is invalid.
6) Definition's are now rigid. This means that every property needs to be defined in the definition, and it must at least have a "fieldType" element. If the field is to be displayed (ie: it doesn't have a noFormPost=>1 element) then it must also at minimum have label elements. In addition, you must specify assetName, tableName, and properties attributes at minimum. Anything less is invalid.
7) The properties attribute must be an array reference of properties. No more Tie::IxHash.
8) The autoGenerateForms has been removed. All edit forms are autogenerated in WebGUI 8.
9) You no longer have the "visible" element. It was a duplicate of "noFormPost", so use "noFormPost" instead.
Here's an example.
use WebGUI::Definition::Asset (

View file

@ -84,10 +84,11 @@ use WebGUI::Definition::Asset (
defaultValue =>0,
},
encryptPage=>{
fieldType =>
fieldType => 'yesNo',
noFormPost =>
sub {
my $self = shift;
return $self->session->config->get("sslEnabled") ? 'yesNo' : 'hidden';
return $self->session->config->get("sslEnabled");
},
tab => "security",
label => ['encrypt page','Asset'],
@ -907,13 +908,9 @@ sub getEditForm {
$params{value} = [$params{value}];
}
if (exists $fieldHash{visible} and not $fieldHash{visible}) {
$params{fieldType} = 'hidden';
}
else {
%params = (%params, %fieldHash);
delete $params{tab};
}
%params = (%params, %fieldHash);
delete $params{tab};
delete $params{tableName};
# if there isnt a tab specified lets define one
my $tab = $fieldHash{tab} || "properties";
@ -1585,10 +1582,11 @@ sub new {
}
my $properties = eval{$session->cache->get(["asset",$assetId,$revisionDate])};
unless (exists $properties->{assetId}) {
unless (exists $properties->{assetId}) { # can we get it from cache?
my $sql = "select * from asset";
my $where = " where asset.assetId=?";
my $placeHolders = [$assetId];
foreach my $definition (@{$class->definition($session)}) {
$sql .= ",".$definition->{tableName};
$where .= " and (asset.assetId=".$definition->{tableName}.".assetId and ".$definition->{tableName}.".revisionDate=".$revisionDate.")";