[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1635] trunk



Revision: 1635
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1635&view=rev
Author:   aurynn_cmd
Date:     2007-09-19 16:52:32 -0700 (Wed, 19 Sep 2007)

Log Message:
-----------
Modifications to make New User screens under the new Admin work.
Minor documentation update on DBObject.
Creation of get_salutations function in LedgerSMB::DBObject::Admin

Expansion of edit_user html.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Admin.pm
    trunk/LedgerSMB/DBObject.pm
    trunk/UI/Admin/edit_user.html
    trunk/scripts/admin.pl

Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm	2007-09-18 21:16:17 UTC (rev 1634)
+++ trunk/LedgerSMB/DBObject/Admin.pm	2007-09-19 23:52:32 UTC (rev 1635)
@@ -181,4 +181,16 @@
     }
 }
 
+sub get_salutations {
+    
+    my $self = shift;
+    
+    my $sth = $self->{dbh}->prepare("SELECT * FROM salutation ORDER BY id ASC");
+    
+    $sth->execute();
+    
+    # Returns a list of hashrefs
+    return $sth->fetchall_arrayref( {} );
+}
+
 1;
\ No newline at end of file

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2007-09-18 21:16:17 UTC (rev 1634)
+++ trunk/LedgerSMB/DBObject.pm	2007-09-19 23:52:32 UTC (rev 1635)
@@ -27,6 +27,11 @@
 
 copies @attrs from $hashref to $self.
 
+=item set (@attrs)
+
+Copies the given key=>vars to $self. Allows for finer control of 
+merging hashes into self.
+
 =back
 
 =head1 Copyright (C) 2007, The LedgerSMB core team.

Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html	2007-09-18 21:16:17 UTC (rev 1634)
+++ trunk/UI/Admin/edit_user.html	2007-09-19 23:52:32 UTC (rev 1635)
@@ -18,36 +18,48 @@
                     <select name="salutation">
                         <?lsmb FOREACH sal = salutations ?>
                             <option value="<?lsmb sal.id?>"><?lsmb sal.salutation?></option>
-                        <?END?>
+                        <?lsmb END?>
                     </select>
                 </td>
             </tr>
             
             <tr>
+                <td>First Name</td>
                 <td>
-                    First Name :<input type="textarea" name="first_name" value="<?lsmb user.first_name?>"/>
+                    <input type="textarea" name="first_name" value="<?lsmb user.first_name?>"/>
                 </td>
             </tr>
             
             <tr>
+                <td>Last Name</td>
                 <td>
-                    Last Name :<input type="textarea" name="last_name" value="<?lsmb user.last_name?>"/>
+                    <input type="textarea" name="last_name" value="<?lsmb user.last_name?>"/>
                 </td>
             </tr>
             <tr>
+                <td>Employee #</td>
                 <td>
-                    Employee # :<input type="textarea" name="employeenumber" value="<?lsmb user.employeenumber?>"/>
+                    <input type="textarea" name="employeenumber" value="<?lsmb user.employeenumber?>"/>
                 </td>
             </tr>
             <hr/>
             <?lsmb UNLESS user.username?>
             <tr>
+                <td>Username</td>
                 <td>
-                    Username :<input type="textarea" name="username" value="<?lsmb user.last_name?>"/>
+                    <input type="textarea" name="username" value="<?lsmb user.last_name?>"/>
                 </td>
             </tr>
             <?lsmb END?>
+            
             <tr>
+                <td><br/></td>
+                <td>
+                    <hr/>
+                </td>
+            </tr>
+            
+            <tr>
                 <td>Company Name</td>
                 <td>
                     <input type="textarea" name="companyname" value="<?lsmb user.companyname?>"/>
@@ -106,7 +118,7 @@
             </tr>
             
             <tr>
-                <td>Contact Information</td>
+                <td><br/></td>
                 <td><hr/></td>
             </tr>
             

Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl	2007-09-18 21:16:17 UTC (rev 1634)
+++ trunk/scripts/admin.pl	2007-09-19 23:52:32 UTC (rev 1635)
@@ -12,6 +12,8 @@
     my ($class, $request) = @_;
     my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'all');
     
+    my $sal = $admin->get_salutations();
+    
     if ($request->type() == 'POST') {
         
         # do the save stuff
@@ -23,14 +25,23 @@
     	template => 'Admin/edit_user', language => $user->{language}, 
             format => 'HTML', path=>'UI');
     
-        $template->render($entity);
+        $template->render(
+            {   
+                user=>$entity,
+                salutations=> $sal
+            }
+        );
     } else {
     
         my $template = LedgerSMB::Template->new( user => $user, 
     	template => 'Admin/edit_user', language => $user->{language}, 
             format => 'HTML', path=>'UI');
     
-        $template->render();
+        $template->render(
+            {
+                salutations=>$sal  
+            }
+        );
     }
 }
 
@@ -154,7 +165,7 @@
     
     # check for login
     my $template;
-        $template = LedgerSMB::Template->new( user=>$user, 
+    $template = LedgerSMB::Template->new( user=>$user, 
             template=>'Admin/main', language=>$user->{language},
             format=>'HTML', path=>'UI');
     $template->render();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.