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

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



Revision: 3408
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3408&view=rev
Author:   ehuelsmann
Date:     2011-07-01 20:25:43 +0000 (Fri, 01 Jul 2011)

Log Message:
-----------
Present little nicer labels for role names in user management admin.pl.

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

Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm	2011-07-01 12:42:22 UTC (rev 3407)
+++ trunk/LedgerSMB/DBObject/Admin.pm	2011-07-01 20:25:43 UTC (rev 3408)
@@ -249,14 +249,23 @@
 sub get_roles {
     
     my $self = shift @_;
+    my $company = shift; # optional
     my @s_rows = $self->call_procedure(procname=>'admin__get_roles');
     my @rows;
-    my $company = $self->{company};
+
+    $company = $self->{company} if ! defined $company;
     $logger->debug("get_roles: company = $company");
     $logger->debug("get_roles: self = " . Data::Dumper::Dumper($self));
     for my $role (@s_rows) {
         my $rolname = $role->{'rolname'};
-        push @rows, $rolname;
+	my $description = $rolname;
+	$description =~ s/lsmb_//;
+	$description =~ s/${company}__//
+	    if defined $company;
+	$description =~ s/_/ /g;
+        push @rows, { name => $rolname, description => #"lsmb_$company\_"  #
+			  $description
+	};
     }
     return ..hidden..;
 }

Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html	2011-07-01 12:42:22 UTC (rev 3407)
+++ trunk/UI/Admin/edit_user.html	2011-07-01 20:25:43 UTC (rev 3408)
@@ -264,14 +264,14 @@
                 <?lsmb END?>
                     <td>
                         <?lsmb rolcheck = undef; 
-                           IF user.roles.grep(role).size;
+                           IF user.roles.grep(role.name).size;
                               rolcheck = "checked";
                            END ?>
                         <?lsmb PROCESS input element_data = {
                                type = "checkbox"
-                               label = role
+                               label = role.description
                                value = 1
-                               name = role
+                               name = role.name
                                checked = rolcheck
                          }, label_pos = 1 ?>
                     </td>

Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl	2011-07-01 12:42:22 UTC (rev 3407)
+++ trunk/scripts/admin.pl	2011-07-01 20:25:43 UTC (rev 3408)
@@ -22,7 +22,7 @@
     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 @all_roles = $admin->get_roles();
+    my @all_roles = $admin->get_roles($request->{company});
     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});


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