[Bast-commits] r3587 - in trunk/Net-LDAP-HTMLWidget: . lib/Net/LDAP

omega at dev.catalyst.perl.org omega at dev.catalyst.perl.org
Tue Jul 17 14:21:18 GMT 2007


Author: omega
Date: 2007-07-17 14:21:18 +0100 (Tue, 17 Jul 2007)
New Revision: 3587

Modified:
   trunk/Net-LDAP-HTMLWidget/
   trunk/Net-LDAP-HTMLWidget/Changes
   trunk/Net-LDAP-HTMLWidget/Makefile.PL
   trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm
Log:
 r15671 at andreas-marienborgs-computer:  andreas | 2007-07-17 14:41:30 +0200
 New version 0.02. Fixed to work with later HTML::Widget versions



Property changes on: trunk/Net-LDAP-HTMLWidget
___________________________________________________________________
Name: svk:merge
   + ea49d7f7-7c45-40ca-be27-1349e20c1c07:/local/net-ldap-htmlwidget:15671

Modified: trunk/Net-LDAP-HTMLWidget/Changes
===================================================================
--- trunk/Net-LDAP-HTMLWidget/Changes	2007-07-16 14:46:38 UTC (rev 3586)
+++ trunk/Net-LDAP-HTMLWidget/Changes	2007-07-17 13:21:18 UTC (rev 3587)
@@ -1,5 +1,8 @@
-Revision history for DBIx-Class-HTMLWidget
+Revision history for Net-LDAP-HTMLWidget
 
+0.02    2007-07-17 14:39
+        Tuned in with later releases of HTML::Widget and the new API
+        
 0.01    2006-01-25 15:06
         First version, released on an unsuspecting world.
 

Modified: trunk/Net-LDAP-HTMLWidget/Makefile.PL
===================================================================
--- trunk/Net-LDAP-HTMLWidget/Makefile.PL	2007-07-16 14:46:38 UTC (rev 3586)
+++ trunk/Net-LDAP-HTMLWidget/Makefile.PL	2007-07-17 13:21:18 UTC (rev 3587)
@@ -4,7 +4,7 @@
     'NAME'         => 'Net::LDAP::HTMLWidget',
     'VERSION_FROM' => 'lib/Net/LDAP/HTMLWidget.pm',
     'PREREQ_PM'    => {
-        HTML::Widget        => 1.03,
+        HTML::Widget        => 1.11,
         Net::LDAP	    => 0,
     },
 );

Modified: trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm
===================================================================
--- trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm	2007-07-16 14:46:38 UTC (rev 3586)
+++ trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm	2007-07-17 13:21:18 UTC (rev 3587)
@@ -2,16 +2,17 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 # pod after __END__
 
 sub fill_widget {
     my ($self,$entry,$widget)=@_;
 
-    foreach my $element ( @{ $widget->{_elements} } ) {
+    my @elements = $widget->find_elements;
+    foreach my $element ( @elements ) {
         my $name=$element->name;
         next unless $name && $entry->exists($name) && $element->can('value');
-	$element->value( $entry->get_value($name) );
+	    $element->value( $entry->get_value($name) );
     }
 }
 
@@ -19,13 +20,18 @@
 sub populate_from_widget {
     my ($self,$entry,$result,$ldap)=@_;
 
-    $ldap=$self if ref $self && ($self->isa('Net::LDAP') || $self->isa('Catalyst::Model::LDAP'));
-
-    foreach my $oc ( ref $entry->get_value('objectClass') ? @{$entry->get_value('objectClass')} : ($entry->get_value('objectClass'))) {
-	foreach my $attr ($ldap->schema->must($oc),$ldap->schema->may($oc)) {
-	    $entry->replace($attr->{name}, $result->param($attr->{name})) 
-		if defined $result->param($attr->{name});
-	}
+    $ldap = $self if (ref $self && ($self->isa('Net::LDAP') || $self->isa('Catalyst::Model::LDAP::Connection')));
+    $ldap = $self->_ldap_client if (ref($self) and $self->isa('Catalyst::Model::LDAP::Entry') && $self->_ldap_client);
+    
+    croak "No LDAP connection" unless $ldap;
+    
+    foreach my $oc ( ref $entry->get_value('objectClass') 
+        ? @{$entry->get_value('objectClass')} 
+        : ($entry->get_value('objectClass'))) {
+	        foreach my $attr ($ldap->schema->must($oc),$ldap->schema->may($oc)) {
+	            $entry->replace($attr->{name}, $result->param($attr->{name})) 
+		            if defined $result->param($attr->{name});
+	        }
     }
     return $entry->update($ldap);
 }
@@ -102,27 +108,24 @@
 =head1 DESCRIPTION
 
 Something like Class::DBI::FromForm / Class::DBI::FromCGI but using
-HTML::Widget for form creation and validation and DBIx::Class as a ORM.
+HTML::Widget for form creation and validation and Net::LDAP.
 
 =head2 Methods
 
-=head3 fill_widget
+=head3 fill_widget $item, $widget
 
-   $dbic_object->fill_widget($widget);
+Fill the values of a widgets elements with the values of the LDAP object.
 
-Fill the values of a widgets elements with the values of the DBIC object.
+=head3 populate_from_widget $item, $results, $ldap_connection
 
-=head3 populate_from_widget
-
-   my $obj=$schema->resultset('pet)->new->populate_from_widget($result);
-   my $item->populate_from_widget($result);
-
-Create or update a DBIx::Class row from a HTML::Widget::Result object
+Updates the $item with new values from $result and updated using 
+$ldap_connection.
    
 =head1 AUTHOR
 
 Thomas Klausner, <domm at cpan.org>, http://domm.zsi.at
 Marcus Ramberg, <mramberg at cpan.org>
+Andreas Marienborg, <andremar at cpan.org>
 
 =head1 LICENSE
 




More information about the Bast-commits mailing list