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

bisitz bisitz@source.lon-capa.org
Thu, 28 May 2009 16:54:29 -0000


bisitz		Thu May 28 16:54:29 2009 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  Changes related to modification of LON-CAPA screen header.
  Added new function &authorspace()
  Returns path to current author space. See code comments for details.
  This function will be used to create breadcrumbs in Construction Space.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.831 loncom/interface/loncommon.pm:1.832
--- loncom/interface/loncommon.pm:1.831	Thu May 28 15:19:54 2009
+++ loncom/interface/loncommon.pm	Thu May 28 16:54:29 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.831 2009/05/28 15:19:54 bisitz Exp $
+# $Id: loncommon.pm,v 1.832 2009/05/28 16:54:29 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4183,6 +4183,34 @@
 ##############################################
 =pod
 
+=item * &authorspace()
+
+Inputs: ./.
+
+Returns: Path to the Construction Space of the current user's
+         accessed author space
+         The author space will be that of the current user
+         when accessing the own author space
+         and that of the co-author/assistent co-author
+         when accessing the co-author's/assistent co-author's
+         space
+
+=cut
+
+sub authorspace {
+    my $caname = '';
+    if ($env{'request.role'} =~ /^ca|^aa/) {
+        (undef,$caname) =
+            ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
+    } else {
+        $caname = $env{'user.name'};
+    }
+    return '/priv/'.$caname.'/';
+}
+
+##############################################
+=pod
+
 =item * &head_subbox()
 
 Inputs: $content (contains HTML code with page functions, etc.)