Mercurial > pub > Impl
diff Lib/DOM/Providers/Form.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | 03e58a454b20 |
children |
line wrap: on
line diff
--- a/Lib/DOM/Providers/Form.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/DOM/Providers/Form.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,49 +1,49 @@ -package Configuration; -our $DataDir; -package DOM::Providers::Form; -use strict; -use Form; -use Schema::Form; -use Common; -our @ISA = qw(Object); - -our $Encoding ; -our $CacheDir ||= "${DataDir}Cache/"; -warn "The encoding for the DOM::Provider::Form isn't specified" if not $Encoding; -$Encoding ||= 'utf-8'; - -sub GetProviderInfo { - return { - Name => 'Form', - Host => 'DOM::Site', - Methods => { - LoadForm => \&SiteLoadForm - } - } -} - -BEGIN { - DeclareProperty FormsEncoding => ACCESS_READ; - DeclareProperty DataCacheDir => ACCESS_READ; -} - -sub SiteLoadForm { - my ($this,$site,$file,$form) = @_; - return $site->RegisterObject('Form',$this->LoadForm($file,$form)); -} - -sub LoadForm { - my ($this,$file, $formName) = @_; - - my $formSchema = Schema::Form->LoadForms($file,$this->{$DataCacheDir},$this->{$FormsEncoding})->{$formName} or die new Exception('The form isn\'t found',$formName,$file); - return Form->new($formSchema); -} - -sub construct { - my ($class) = @_; - - return $class->new(FormsEncoding => $Encoding, DataCacheDir => $CacheDir); -} - - -1; +package Configuration; +our $DataDir; +package DOM::Providers::Form; +use strict; +use Form; +use Schema::Form; +use Common; +our @ISA = qw(Object); + +our $Encoding ; +our $CacheDir ||= "${DataDir}Cache/"; +warn "The encoding for the DOM::Provider::Form isn't specified" if not $Encoding; +$Encoding ||= 'utf-8'; + +sub GetProviderInfo { + return { + Name => 'Form', + Host => 'DOM::Site', + Methods => { + LoadForm => \&SiteLoadForm + } + } +} + +BEGIN { + DeclareProperty FormsEncoding => ACCESS_READ; + DeclareProperty DataCacheDir => ACCESS_READ; +} + +sub SiteLoadForm { + my ($this,$site,$file,$form) = @_; + return $site->RegisterObject('Form',$this->LoadForm($file,$form)); +} + +sub LoadForm { + my ($this,$file, $formName) = @_; + + my $formSchema = Schema::Form->LoadForms($file,$this->{$DataCacheDir},$this->{$FormsEncoding})->{$formName} or die new Exception('The form isn\'t found',$formName,$file); + return Form->new($formSchema); +} + +sub construct { + my ($class) = @_; + + return $class->new(FormsEncoding => $Encoding, DataCacheDir => $CacheDir); +} + + +1;