[LON-CAPA-cvs] cvs: rat / lonratedt.pm lonratmenu.pm loncom/homework lonhomework.pm structuretags.pm loncom/interface loncommon.pm lonmeta.pm loncom/publisher loncfile.pm loncleanup.pm lonpubdir.pm lonpublisher.pm lonretrieve.pm lonrights.pm lonupload.pm testbankimport.pm loncom/xml londefdef.pm lonxml.pm

raeburn raeburn at source.lon-capa.org
Sun Nov 13 19:20:46 EST 2011


raeburn		Mon Nov 14 00:20:46 2011 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm loncleanup.pm lonpubdir.pm 
                     	lonpublisher.pm lonretrieve.pm lonrights.pm 
                     	lonupload.pm testbankimport.pm 
    /loncom/interface	lonmeta.pm loncommon.pm 
    /loncom/homework	lonhomework.pm structuretags.pm 
    /loncom/xml	londefdef.pm lonxml.pm 
    /rat	lonratedt.pm lonratmenu.pm 
  Log:
  - &authorspace() routine now takes an argument: $uri
    so "Construction Space" breadcrumb points at appropriate author space
    for resource/directory being viewed or acted om.
    - current role could be different or ("no role" - i.e., cm), so is only
      used to determine authorspace when $uri is unavailable. 
  
  
-------------- next part --------------
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.113 loncom/publisher/loncfile.pm:1.114
--- loncom/publisher/loncfile.pm:1.113	Wed Nov  2 19:12:40 2011
+++ loncom/publisher/loncfile.pm	Mon Nov 14 00:20:31 2011
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.113 2011/11/02 19:12:40 raeburn Exp $
+# $Id: loncfile.pm,v 1.114 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1480,7 +1480,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Construction Space',
-        'href'  => &Apache::loncommon::authorspace(),
+        'href'  => &Apache::loncommon::authorspace($fn),
     });
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'File Operation',
Index: loncom/publisher/loncleanup.pm
diff -u loncom/publisher/loncleanup.pm:1.15 loncom/publisher/loncleanup.pm:1.16
--- loncom/publisher/loncleanup.pm:1.15	Thu Nov  3 00:30:32 2011
+++ loncom/publisher/loncleanup.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to cleanup XML files
 #
-# $Id: loncleanup.pm,v 1.15 2011/11/03 00:30:32 raeburn Exp $
+# $Id: loncleanup.pm,v 1.16 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -419,17 +419,17 @@
 	return HTTP_NOT_ACCEPTABLE;
     }
 
-    $fn=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
-
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
 
     # Breadcrumbs
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace($fn),
                    'text' => 'Construction Space'},
                   {'href' => '',
                    'text' => 'Cleanup XML Document'}];
 
+    $fn=~s{^/priv/$LONCAPA::domain_re/$LONCAPA::username_re}{};
+
     $r->print(&Apache::loncommon::start_page('Cleanup XML Document',
                                              undef,
                                              {'bread_crumbs' => $brcrum,}));
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.136 loncom/publisher/lonpubdir.pm:1.137
--- loncom/publisher/lonpubdir.pm:1.136	Mon Nov  7 20:06:02 2011
+++ loncom/publisher/lonpubdir.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.136 2011/11/07 20:06:02 www Exp $
+# $Id: lonpubdir.pm,v 1.137 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -145,7 +145,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Construction Space',
-        'href'  => &Apache::loncommon::authorspace(),
+        'href'  => &Apache::loncommon::authorspace($formaction),
     });
     # breadcrumbs (and tools) will be created 
     # in start_page->bodytag->innerregister
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.276 loncom/publisher/lonpublisher.pm:1.277
--- loncom/publisher/lonpublisher.pm:1.276	Mon Nov  7 18:29:17 2011
+++ loncom/publisher/lonpublisher.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.276 2011/11/07 18:29:17 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.277 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2144,7 +2144,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Construction Space',
-        'href'  => &Apache::loncommon::authorspace(),
+        'href'  => &Apache::loncommon::authorspace($fn),
     });
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Resource Publication',
@@ -2154,6 +2154,7 @@
     my $js='<script type="text/javascript">'.
 	&Apache::loncommon::browser_and_searcher_javascript().
 	'</script>';
+    print STDERR "fn is ||$fn||\n";
     $r->print(&Apache::loncommon::start_page('Resource Publication',$js)
              .&Apache::lonhtmlcommon::breadcrumbs()
              .&Apache::loncommon::head_subbox(
Index: loncom/publisher/lonretrieve.pm
diff -u loncom/publisher/lonretrieve.pm:1.46 loncom/publisher/lonretrieve.pm:1.47
--- loncom/publisher/lonretrieve.pm:1.46	Mon Oct 31 17:27:10 2011
+++ loncom/publisher/lonretrieve.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to retrieve an old version of a file
 #
-# $Id: lonretrieve.pm,v 1.46 2011/10/31 17:27:10 raeburn Exp $
+# $Id: lonretrieve.pm,v 1.47 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -202,7 +202,7 @@
 	$r->print('<p class="LC_warning">'.&mt('No previous versions published.').'</p>');
     }
 
-    my $dir =  &Apache::loncommon::authorspace()
+    my $dir =  &Apache::loncommon::authorspace($fn)
               .&File::Basename::dirname($fn)
               .'/';
     $r->print('<br />'
@@ -336,7 +336,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Construction Space',
-        'href'  => &Apache::loncommon::authorspace(),
+        'href'  => &Apache::loncommon::authorspace($fn),
     });
     &Apache::lonhtmlcommon::add_breadcrumb({
         'text'  => 'Retrieve previous version',
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.32 loncom/publisher/lonrights.pm:1.33
--- loncom/publisher/lonrights.pm:1.32	Sun Nov 13 21:11:42 2011
+++ loncom/publisher/lonrights.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to show and edit custom distribution rights
 #
-# $Id: lonrights.pm,v 1.32 2011/11/13 21:11:42 raeburn Exp $
+# $Id: lonrights.pm,v 1.33 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
   &Apache::lonhtmlcommon::clear_breadcrumbs();
   &Apache::lonhtmlcommon::add_breadcrumb({
       'text'  => 'Construction Space',
-      'href'  => &Apache::loncommon::authorspace(),
+      'href'  => &Apache::loncommon::authorspace($r->uri),
       });
   &Apache::lonhtmlcommon::add_breadcrumb({
       'text'  => 'Custom Rights Editor',
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.58 loncom/publisher/lonupload.pm:1.59
--- loncom/publisher/lonupload.pm:1.58	Wed Nov  2 23:19:22 2011
+++ loncom/publisher/lonupload.pm	Mon Nov 14 00:20:31 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.58 2011/11/02 23:19:22 raeburn Exp $
+# $Id: lonupload.pm,v 1.59 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -517,7 +517,7 @@
     $trailfile =~ s{^/(priv/)}{$londocroot/$1};
 
     # Breadcrumbs
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace($fn),
                    'text' => 'Construction Space'},
                   {'href' => '/adm/upload',
                    'text' => 'Upload file to Construction Space'}];
Index: loncom/publisher/testbankimport.pm
diff -u loncom/publisher/testbankimport.pm:1.33 loncom/publisher/testbankimport.pm:1.34
--- loncom/publisher/testbankimport.pm:1.33	Wed Nov  2 23:43:37 2011
+++ loncom/publisher/testbankimport.pm	Mon Nov 14 00:20:31 2011
@@ -1,5 +1,5 @@
 # Handler for parsing text upload problem descriptions into .problems
-# $Id: testbankimport.pm,v 1.33 2011/11/02 23:43:37 raeburn Exp $
+# $Id: testbankimport.pm,v 1.34 2011/11/14 00:20:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1775,7 +1775,7 @@
 sub print_header {
     my ($uname,$udom,$javascript,$loadentries,$title,$current_page,$pagesref,
         $namesref) = @_;
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace("/priv/$udom/$uname/"),
                    'text' => 'Construction Space'}];
     if ($env{'form.phase'} eq 'three') {
         if (ref($pagesref) eq 'ARRAY') {
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.243 loncom/interface/lonmeta.pm:1.244
--- loncom/interface/lonmeta.pm:1.243	Mon Nov  7 20:05:56 2011
+++ loncom/interface/lonmeta.pm	Mon Nov 14 00:20:34 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.243 2011/11/07 20:05:56 www Exp $
+# $Id: lonmeta.pm,v 1.244 2011/11/14 00:20:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -779,7 +779,7 @@
     if ($env{'request.state'} eq 'construct') {
         &Apache::lonhtmlcommon::add_breadcrumb({
             'text'  => 'Construction Space',
-            'href'  => &Apache::loncommon::authorspace(),
+            'href'  => &Apache::loncommon::authorspace($uri),
         });
     }
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1027 loncom/interface/loncommon.pm:1.1028
--- loncom/interface/loncommon.pm:1.1027	Wed Nov  2 23:05:07 2011
+++ loncom/interface/loncommon.pm	Mon Nov 14 00:20:34 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1027 2011/11/02 23:05:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.1028 2011/11/14 00:20:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4532,29 +4532,39 @@
 
 =item * &authorspace()
 
-Inputs: ./.
+Inputs: $url (usually will be undef).
 
-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
+Returns: Path to Construction Space containing the resource or 
+         directory being viewed (or for which action is being taken). 
+         If $url is provided, and begins /priv/<domain>/<uname>
+         the path will be that portion of the $context argument.
+         Otherwise the path will be for the author space of the current
+         user when the current role is author, or for that of the 
+         co-author/assistant co-author space when the current role 
+         is co-author or assistant co-author.
 
 =cut
 
 sub authorspace {
+    my ($url) = @_;
+    if ($url ne '') {
+        if ($url =~ m{^(/priv/$match_domain/$match_username/)}) {
+           return $1;
+        }
+    }
     my $caname = '';
     my $cadom = '';
-    if ($env{'request.role'} =~ /^ca|^aa/) {
+    if ($env{'request.role'} =~ /^(?:ca|aa)/) {
         ($cadom,$caname) =
             ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
-    } else {
+    } elsif ($env{'request.role'} =~ m{^au\./($match_domain)/}) {
         $caname = $env{'user.name'};
         $cadom = $env{'user.domain'};
     }
-    return '/priv/'.$cadom.'/'.$caname.'/';
+    if (($caname ne '') && ($cadom ne '')) {
+        return "/priv/$cadom/$caname/";
+    }
+    return;
 }
 
 ##############################################
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.329 loncom/homework/lonhomework.pm:1.330
--- loncom/homework/lonhomework.pm:1.329	Mon Oct 31 19:35:03 2011
+++ loncom/homework/lonhomework.pm	Mon Nov 14 00:20:39 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.329 2011/10/31 19:35:03 raeburn Exp $
+# $Id: lonhomework.pm,v 1.330 2011/11/14 00:20:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -698,7 +698,7 @@
     my $js = &Apache::structuretags::setmode_javascript();
 
     # Breadcrumbs
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                    'text' => 'Construction Space'},
                   {'href' => '',
                    'text' => 'Problem Testing'},
@@ -936,7 +936,7 @@
             &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");
 
     # Breadcrumbs
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                    'text' => 'Construction Space'},
                   {'href' => '',
                    'text' => 'Problem Editing'}];
@@ -1162,7 +1162,7 @@
 	my $dest = &Apache::lonnet::filelocation("",$request->uri);
 	my $errormsg;
 	my $instructions;
-        my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+        my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                        'text' => 'Construction Space'},
                       {'href' => '',
                        'text' => "Create New $extension"}];
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.496 loncom/homework/structuretags.pm:1.497
--- loncom/homework/structuretags.pm:1.496	Tue Sep 13 15:40:37 2011
+++ loncom/homework/structuretags.pm	Mon Nov 14 00:20:39 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.496 2011/09/13 15:40:37 raeburn Exp $
+# $Id: structuretags.pm,v 1.497 2011/11/14 00:20:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -283,7 +283,7 @@
         &Apache::lonhtmlcommon::clear_breadcrumbs();
         &Apache::lonhtmlcommon::add_breadcrumb({
             'text'  => 'Construction Space',
-            'href'  => &Apache::loncommon::authorspace(),
+            'href'  => &Apache::loncommon::authorspace($env{'request.uri'}),
         });
         # breadcrumbs (and tools) will be created 
         # in start_page->bodytag->innerregister
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.435 loncom/xml/londefdef.pm:1.436
--- loncom/xml/londefdef.pm:1.435	Wed Oct 26 02:09:45 2011
+++ loncom/xml/londefdef.pm	Mon Nov 14 00:20:42 2011
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.435 2011/10/26 02:09:45 www Exp $
+# $Id: londefdef.pm,v 1.436 2011/11/14 00:20:42 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -545,9 +545,10 @@
     # Breadcrumbs
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     if ($env{'request.state'} eq 'construct') {
+        my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'});
         &Apache::lonhtmlcommon::add_breadcrumb({
             'text'  => 'Construction Space',
-            'href'  => &Apache::loncommon::authorspace(),
+            'href'  => &Apache::loncommon::authorspace($url),
         });
         &Apache::lonhtmlcommon::add_breadcrumb({
             'text'  => 'HTML Editor',
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.522 loncom/xml/lonxml.pm:1.523
--- loncom/xml/lonxml.pm:1.522	Fri Nov 11 02:55:37 2011
+++ loncom/xml/lonxml.pm	Mon Nov 14 00:20:42 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.522 2011/11/11 02:55:37 raeburn Exp $
+# $Id: lonxml.pm,v 1.523 2011/11/14 00:20:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1754,7 +1754,7 @@
                 }
                 my $brcrum;
                 if ($env{'request.state'} eq 'construct') {
-                    $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+                    $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
                                 'text' => 'Construction Space'},
                                {'href' => '',
                                 'text' => $breadcrumbtext}];
@@ -1791,7 +1791,7 @@
             my $header;
             if ($env{'request.state'} eq 'construct') {
                 $options{'bread_crumbs'} = [{
-                            'href' => &Apache::loncommon::authorspace(),
+                            'href' => &Apache::loncommon::authorspace($request->uri),
                             'text' => 'Construction Space'},
                            {'href' => '',
                             'text' => $breadcrumbtext}];
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.103 rat/lonratedt.pm:1.104
--- rat/lonratedt.pm:1.103	Mon Oct 31 01:23:26 2011
+++ rat/lonratedt.pm	Mon Nov 14 00:20:46 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.103 2011/10/31 01:23:26 raeburn Exp $
+# $Id: lonratedt.pm,v 1.104 2011/11/14 00:20:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -549,7 +549,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         text  => 'Construction Space',
-        href  => &Apache::loncommon::authorspace(),
+        href  => &Apache::loncommon::authorspace($url),
         faq   => 6,
         bug   => 'RAT',
         help  => 'Sequence_Simple_Editor_Creation',});
@@ -646,8 +646,9 @@
 sub nodir {
    my ($r,$dir)=@_;
    my $londocroot = $r->dir_config('lonDocRoot');
+   my ($path) = ($dir =~ m{^\Q$londocroot\E?(/priv/[^/]+/[^/]+/)});
    $dir=~s{^\Q$londocroot/priv/\E[^/]+/[^/]+}{};
-   my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+   my $brcrum = [{'href' => &Apache::loncommon::authorspace($path),
                   'text' => 'Construction Space'}];
 #                 {'href' => '',
 #                  'text' => 'No such directory'}];
@@ -671,7 +672,7 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({
         text  => 'Construction Space',
-        href  => &Apache::loncommon::authorspace(),
+        href  => &Apache::loncommon::authorspace($url),
         faq   => 6,
         bug   => 'RAT',
         help  => 'Sequence_Simple_Editor_Creation',});
Index: rat/lonratmenu.pm
diff -u rat/lonratmenu.pm:1.17 rat/lonratmenu.pm:1.18
--- rat/lonratmenu.pm:1.17	Tue Aug 24 09:11:40 2010
+++ rat/lonratmenu.pm	Mon Nov 14 00:20:46 2011
@@ -2,7 +2,7 @@
 # Build menu bar for Advanced RAT. Uses javascript code originally in
 # static file: rat/client/code.html, now in  rat/client/ratcode.js  
 #
-# $Id: lonratmenu.pm,v 1.17 2010/08/24 09:11:40 wenzelju Exp $
+# $Id: lonratmenu.pm,v 1.18 2011/11/14 00:20:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -47,7 +47,7 @@
     $readfile=~s/\/loadonly\/adveditmenu$//;
 
     # Breadcrumbs
-    my $brcrum = [{'href' => &Apache::loncommon::authorspace(),
+    my $brcrum = [{'href' => &Apache::loncommon::authorspace($r->uri),
                    'text' => 'Construction Space'},
                   {'href' => '',
                    'text' => 'RAT'},


More information about the LON-CAPA-cvs mailing list