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

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



Revision: 2684
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2684&view=rev
Author:   einhverfr
Date:     2009-06-15 18:51:53 +0000 (Mon, 15 Jun 2009)

Log Message:
-----------
Final beautification/UI fixes to user management system

Modified Paths:
--------------
    trunk/LedgerSMB/Setting.pm
    trunk/UI/Admin/edit_user.html
    trunk/scripts/admin.pl
    trunk/sql/modules/Employee.sql

Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm	2009-06-15 05:35:27 UTC (rev 2683)
+++ trunk/LedgerSMB/Setting.pm	2009-06-15 18:51:53 UTC (rev 2684)
@@ -52,8 +52,13 @@
 
 sub get {
     my $self = shift;
+    my ($key) = @_;
+    if ($key){
+        $self->{key} = $key;
+    }
     my ($hashref) = $self->exec_method( funcname => 'setting_get' ) ;
     $self->{value} = $hashref->{setting_get};
+    return $self->{value};
 }
 
 sub increment {

Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html	2009-06-15 05:35:27 UTC (rev 2683)
+++ trunk/UI/Admin/edit_user.html	2009-06-15 18:51:53 UTC (rev 2684)
@@ -1,15 +1,13 @@
-<?lsmb INCLUDE 'ui-header.html' ?>
+<?lsmb INCLUDE 'ui-header.html' stylesheet = stylesheet ?>
 <?lsmb PROCESS 'elements.html' ?>
 <div id="modify_user">
-    <font size="15">
-        <strong>
+	<div class="listtop">
             <?lsmb IF user.user.username ?>
                 Editing User <?lsmb user.user.username ?>
             <?lsmb ELSE?>
                 New User
             <?lsmb END?>
-        </strong>
-    </font>
+        </div>
     
     <form method="POST" action="admin.pl">
         <input type="hidden" name="action" value="<?lsmb IF user.user.username?>edit_user<?lsmb ELSE?>save_user<?lsmb END?>"/>
@@ -50,7 +48,7 @@
             <tr>
                 <td><?lsmb text('Last Name') ?></td>
                 <td>
-                    <input type="textarea" name="last_name" value="<?lsmb user.employee.last_name?>"/>
+                    <input type="text" name="last_name" value="<?lsmb user.employee.last_name?>"/>
                 </td>
             </tr>
             <tr>
@@ -70,37 +68,37 @@
             <?lsmb END?>
             <input type="hidden" name="action" value="save_location"/>
             <input type="hidden" name="user_id" value="<?lsmb user.user.id?>"/>
+                        <hr/>
             <table>
 
-                <tr>
+                <tr class="listtop">
                     <td colspan="8">
-                        <hr/>
-                        Location
+                        <?lsmb text('Location') ?>
                     </td>
                 </tr>
             
-                <tr>
+                <tr class="listheading">
                     <td></td>
                     <td>
-                        Address
+                        <?lsmb text('Address') ?>
                     </td>
                     <td>
-                        City
+                        <?lsmb text('City') ?>
                     </td>
                     <td>
-                        State/Province
+                        <?lsmb text('State/Province') ?>
                     </td>
                     <td>
-                        Zip/Postal Code
+                        <?lsmb text('Zip/Postal Code') ?>
                     </td>
                     <td>
-                        Country
+                        <?lsmb text('Country') ?>
                     </td>
                 </tr>
-                
+                <?lsmb row = 0 ?>    
                 <?lsmb FOR location IN user.locations ?>
-                
-                    <tr>
+                <?lsmb row = (row + 1) % 2; class = "row$row" ?>
+                    <tr class = "<?lsmb class ?>">
                         <td>
                             <a href="admin.pl?action=edit_location&amp;id=<?lsmb location.id?>">Edit</a>
                             <a href="admin.pl?action=delete_location&amp;id=<?lsmb location.id?>">Delete</a>
@@ -126,29 +124,30 @@
                     </tr>
                 
                 <?lsmb END?>
+                
                 <!-- The editable one. -->
                 <tr>
                     <td></td>
                     <td>
-                        <input type="textarea" name="address1" value="<?lsmb location.line_one?>"/>
-                        <input type="textarea" name="address2" value="<?lsmb location.line_two?>"/>
-                        <input type="textarea" name="address3" value="<?lsmb location.line_three?>" />
+                        <input type="text" name="address1" value="<?lsmb edit_location.line_one?>"/>
+                        <input type="text" name="address2" value="<?lsmb edit_location.line_two?>"/>
+                        <input type="text" name="address3" value="<?lsmb edit_location.line_three?>" />
                     </td>
                     <td valign="top">
-                        <input type="textarea" name="city" value="<?lsmb location.city?>"/>
+                        <input type="text" name="city" value="<?lsmb edit_location.city?>"/>
                     </td>
                     <td valign="top">
-                        <input type="textarea" name="state" value="<?lsmb location.state?>"/>
+                        <input type="text" name="state" value="<?lsmb edit_location.state?>"/>
                     </td>
                     <td valign="top"> 
-                        <input type="textarea" name="zipcode" value="<?lsmb location.zipcode?>"/>
+                        <input type="text" name="zipcode" value="<?lsmb edit_location.zipcode?>"/>
                     </td>
                     <td valign="top">
-			<?lsmb IF location.country_id; 
-				country_id = location.country_id;
+			<?lsmb IF edit_location.country; 
+				country_id = edit_location.country_id;
 				ELSE; 
 				country_id = default_country;
-				END  -?>
+				END; -?>
 			<?lsmb PROCESS select element_data = {
 				name = "country"
 				options = countries
@@ -172,23 +171,23 @@
         </table>
 
         
-        
+        <hr/>
         <table>
             <form name="contacts" method="POST" action="admin.pl">
             <input type="hidden" name="action" value="save_contact"/>
             <input type="hidden" name="user_id" value="<?lsmb user.user.id?>"/>
-            <tr>
-                <td colspan="8"><hr/></td>
+            <tr class = "listtop">
+                <td colspan="8"><?lsmb text('Contact Information') ?></td>
             </tr>
             
-            <tr>
+            <tr class="listheading">
                 <td></td>
                 
                 <td>
-                    Contact type
+                    <?lsmb text('Contact Type') ?>
                 </td>
                 <td>
-                    Contact
+                    <?lsmb text('Contact Info') ?>
                 </td>
             </tr>
             
@@ -229,7 +228,7 @@
                 </td>
             </tr>
             </form>
-        </table> 
+        </table> <hr />
         <form name="groups" method="POST" action="admin.pl">
             <?lsmb PROCESS input element_data = {
                type="hidden"

Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl	2009-06-15 05:35:27 UTC (rev 2683)
+++ trunk/scripts/admin.pl	2009-06-15 18:51:53 UTC (rev 2684)
@@ -8,6 +8,7 @@
 use LedgerSMB::DBObject::User;
 use LedgerSMB::DBObject::Location;
 use Data::Dumper;
+use LedgerSMB::Setting;
 
 sub __edit_page {
     
@@ -15,8 +16,9 @@
     my ($request, $otd) = @_;
     
     # otd stands for Other Template Data.
-    
-    my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'user_id');
+    my $dcsetting = LedgerSMB::Setting->new(base=>$request, copy=>'base');
+    my $default_country = $dcsetting->get('default_country'); 
+    my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'list', merge =>['user_id']);
     my $user_obj = LedgerSMB::DBObject::User->new(base=>$request, copy=>'list', merge=>['user_id','company']);
     $user_obj->{company} = $request->{company};
     $user_obj->get($request->{user_id});
@@ -24,7 +26,7 @@
     my @all_roles = $admin->get_roles();
     
     my $template = LedgerSMB::Template->new( 
-        user => $user, 
+        user => $request->{_user}, 
         template => 'Admin/edit_user', 
         language => $user->{language}, 
         format => 'HTML', 
@@ -40,6 +42,9 @@
                 salutations=>$admin->get_salutations(),
                 contact_classes=>$admin->get_contact_classes(),
                 locations=>$location->get_all($user_obj->{entity_id},"person"),
+                stylesheet => $request->{stylesheet},
+                default_country => $dcsetting->{value},
+                admin => $admin,
             };
     
     for my $key (keys(%{$otd})) {
@@ -65,6 +70,7 @@
     my $groups = $admin->get_roles();
     my $entity = $admin->save_user();
     $admin->save_roles();
+    $admin->{stylesheet} = $request->{stylesheet};
     __edit_page($admin);
 }
 
@@ -93,6 +99,7 @@
                 salutations=>$sal,
                 roles=>$groups,
                 countries=>$admin->get_countries(),
+                stylesheet => $request->{stylesheet},
             }
         );
 }
@@ -101,35 +108,7 @@
     
     # uses the same page as create_user, only pre-populated.
     my ($request) = @_;
-    my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'user_id');
-    my $user_obj = LedgerSMB::DBObject::User->new(base=>$request, copy=>'list', merge=>['user_id','company']);
-    $user_obj->{company} = $request->{company};
-    $user_obj->get($request->{user_id});
-
-    my @all_roles = $admin->get_roles();
-    
-    my $template = LedgerSMB::Template->new( 
-        user => $user, 
-        template => 'Admin/edit_user', 
-        language => $user->{language}, 
-        format => 'HTML', 
-        path=>'UI'
-    );
-    my $location = LedgerSMB::DBObject::Location->new(base=>$request);
-    my $template_data = 
-            {
-                user=>$user_obj, 
-                roles=>@all_roles,
-                countries=>$admin->get_countries(),
-                user_roles=>$user_obj->{roles},
-                salutations=>$admin->get_salutations(),
-                contact_classes=>$admin->get_contact_classes(),
-                locations=>$location->get_all($user_obj->{entity_id},"person"),
-            };
-    if ($request->{location_id}) {
-        $template_data->{location} = $location->get($request->{location_id});
-    }
-    $template->render($template_data);
+    __edit_page($request);
 }
 
 sub edit_group {

Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql	2009-06-15 05:35:27 UTC (rev 2683)
+++ trunk/sql/modules/Employee.sql	2009-06-15 18:51:53 UTC (rev 2684)
@@ -76,7 +76,9 @@
         ee.*
     FROM person p
     JOIN entity_employee ee USING (entity_id)
-    JOIN salutation s ON (p.salutation_id = s.id);
+    LEFT JOIN salutation s ON (p.salutation_id = s.id);
+
+GRANT select ON employees TO public;
     
 
 CREATE OR REPLACE FUNCTION employee__get


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