[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

bisitz bisitz at source.lon-capa.org
Wed Jan 22 13:01:43 EST 2014


bisitz		Wed Jan 22 18:01:43 2014 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Custom roles:
  - Improved and consistent navigation and layout by using confirm_success and actionbox
  - Internationalization
  
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.386 loncom/interface/loncreateuser.pm:1.387
--- loncom/interface/loncreateuser.pm:1.386	Wed Jan 15 18:47:56 2014
+++ loncom/interface/loncreateuser.pm	Wed Jan 22 18:01:43 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.386 2014/01/15 18:47:56 bisitz Exp $
+# $Id: loncreateuser.pm,v 1.387 2014/01/22 18:01:43 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4436,25 +4436,43 @@
 	    $sysrole.=':'.$item;
 	}
     }
-    $r->print('<br />Defining Role: '.
-	   &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole));
+    # Assign role; Compile and show result
+    my $errmsg;
+    my $result =
+        &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole);
+    if ($result ne 'ok') {
+        $errmsg = ': '.$result;
+    }
+    my $message =
+        &Apache::lonhtmlcommon::confirm_success(
+            &mt('Defining Role').$errmsg, ($result eq 'ok' ? 0 : 1));
     if ($env{'request.course.id'}) {
         my $url='/'.$env{'request.course.id'};
         $url=~s/\_/\//g;
-	$r->print('<br />'.&mt('Assigning Role to Self').': '.
-	      &Apache::lonnet::assigncustomrole($env{'user.domain'},
-						$env{'user.name'},
-						$url,
-						$env{'user.domain'},
-						$env{'user.name'},
-						$rolename,undef,undef,undef,$context));
+        $result =
+            &Apache::lonnet::assigncustomrole(
+                $env{'user.domain'},$env{'user.name'},
+                $url,
+                $env{'user.domain'},$env{'user.name'},
+                $rolename,undef,undef,undef,$context);
+        if ($result ne 'ok') {
+            $errmsg = ': '.$result;
+        }
+        $message .=
+            '<br />'
+           .&Apache::lonhtmlcommon::confirm_success(
+                &mt('Assigning Role to Self').$errmsg, ($result eq 'ok' ? 0 : 1));
     }
     $r->print(
-        '<p><a href="javascript:backPage(document.customresult,'."'pickrole'".')">'
-       .&mt('Create or edit another custom role')
-       .'</a></p>'
+        &Apache::loncommon::confirmwrapper($message)
+       .'<br />'
+       .&Apache::lonhtmlcommon::actionbox([
+            '<a href="javascript:backPage(document.customresult,'."'pickrole'".')">'
+           .&mt('Create or edit another custom role')
+           .'</a>'])
        .'<form name="customresult" method="post" action="">'
-       .&Apache::lonhtmlcommon::echo_form_input([]).'</form>'
+       .&Apache::lonhtmlcommon::echo_form_input([])
+       .'</form>'
     );
 }
 




More information about the LON-CAPA-cvs mailing list