--- loncom/xml/lonxml.pm	2012/12/13 22:28:15	1.531.2.5
+++ loncom/xml/lonxml.pm	2013/08/08 12:47:13	1.531.2.10
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.531.2.5 2012/12/13 22:28:15 raeburn Exp $
+# $Id: lonxml.pm,v 1.531.2.10 2013/08/08 12:47:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1629,12 +1629,32 @@ sub inserteditinfo {
 // ]]>
 </script>
 FULLPAGE
+      my $textareaclass;
       if ($filetype eq 'html') {
-          if ($symb || $folderpath) {
-              $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
-              $initialize .= 
-                  &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
-                                                             undef,$folderpath,$uri)."\n";
+          my $context;
+          if ($env{'request.course.id'}) {
+              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+              if ($uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E}) {
+                  $context = 'syllabus';
+                  $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+                  $initialize .=
+                      &Apache::lonhtmlcommon::dependencycheck_js(undef,&mt('Syllabus'),
+                                                                 $uri,undef,
+                                                                 "/public/$cdom/$cnum/syllabus").
+                      "\n";
+                  if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+                      $textareaclass = 'class="LC_richDefaultOn"';
+                  }
+              }
+          }
+          unless ($context eq 'syllabus') {
+              if ($symb || $folderpath) {
+                  $deps_button = &Apache::lonhtmlcommon::dependencies_button()."\n";
+                  $initialize .=
+                      &Apache::lonhtmlcommon::dependencycheck_js($symb,$itemtitle,
+                                                                 undef,$folderpath,$uri)."\n";
+              }
           }
           $dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>';
           $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');
@@ -1647,7 +1667,6 @@ FULLPAGE
       }
 
       my $titledisplay=&display_title();
-      my $textareaclass;
       my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
 					 'vi' => 'Save and View',
 					 'dv' => 'Discard Edits and View',
@@ -1663,13 +1682,15 @@ FULLPAGE
               $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';
           }
           if (&Apache::lonhtmlcommon::htmlareabrowser()) {
-              $textareaclass = 'class="LC_richDefaultOff"';
+              unless ($textareaclass) {
+                  $textareaclass = 'class="LC_richDefaultOff"';
+              }
           }
       }
       my $editfooter=(<<ENDFOOTER);
 $initialize
 <a name="editsection" />
-<form $form_events method="post" name="xmledit">
+<form $form_events method="post" name="xmledit" action="">
   <div class="LC_edit_problem_editxml_header">
     <table class="LC_edit_problem_header_title"><tr><td>
         $filename
@@ -1769,6 +1790,19 @@ sub handler {
         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                                 ['todocs']);
     }
+    my ($cdom,$cnum);
+    if ($env{'request.course.id'}) {
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        if ($filetype eq 'html') {
+            if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E.+$}) {
+                if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+                    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+                                                            ['editmode']);
+                }
+            }
+        }
+    }
     if ($filetype eq 'sty') {
         $breadcrumbtext = 'Style File Editor';
     } elsif ($filetype eq 'js') {
@@ -1871,7 +1905,7 @@ ENDNOTFOUND
                 my $brcrum;
                 if ($env{'request.state'} eq 'construct') {
                     $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
-                                'text' => 'Construction Space'},
+                                'text' => 'Authoring Space'},
                                {'href' => '',
                                 'text' => $breadcrumbtext}];
                 } else {
@@ -1898,17 +1932,25 @@ ENDNOTFOUND
 	    $displayfile=$request->uri;
             if ($request->uri =~ m{^/uploaded/}) {
                 if ($env{'request.course.id'}) {
-                    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-                    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-                    if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/\Esupplemental/}) {
+                    if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/supplemental/\E}) {
                         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                                                 ['folderpath','title']);
+                    } elsif ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) {
+                        my $filename = $1;
+                        if ($1 eq 'loncapa.html') {
+                            $displayfile = &mt('Syllabus (minimal template)');
+                        } else {
+                            $displayfile = &mt('Syllabus file: [_1]',$1);
+                        }
+                        $itemtitle = &mt('Syllabus');
                     }
                 }
-
-                ($symb,$itemtitle,$displayfile) = 
-                    &get_courseupload_hierarchy($request->uri,
-                                                $env{'form.folderpath'},$env{'form.title'});
+                unless ($itemtitle) {
+                    ($symb,$itemtitle,$displayfile) = 
+                        &get_courseupload_hierarchy($request->uri,
+                                                    $env{'form.folderpath'},
+                                                    $env{'form.title'});
+                }
             } else {
 	        $displayfile=~s/^\/[^\/]*//;
             }
@@ -1925,7 +1967,7 @@ ENDNOTFOUND
             if ($env{'request.state'} eq 'construct') {
                 $options{'bread_crumbs'} = [{
                             'href' => &Apache::loncommon::authorspace($request->uri),
-                            'text' => 'Construction Space'},
+                            'text' => 'Authoring Space'},
                            {'href' => '',
                             'text' => $breadcrumbtext}];
                 $header = &Apache::loncommon::head_subbox(
@@ -1960,7 +2002,7 @@ sub display_title {
 	    $title = substr($title, rindex($title, '/') + 1);
 	}
         $result = "<script type='text/javascript'>top.document.title = '$title - LON-CAPA "
-                  .&mt('Construction Space')."';</script>";
+                  .&mt('Authoring Space')."';</script>";
     }
     return $result;
 }
@@ -1975,6 +2017,7 @@ sub get_courseupload_hierarchy {
             while (@folders) {
                 my $folder=shift(@folders);
                 my $foldername=shift(@folders);
+                $foldername =~ s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//;
                 push(@pathitems,&unescape($foldername));
             }
             if ($title) {