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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 26 Jul 2005 22:30:23 -0000


raeburn		Tue Jul 26 18:30:23 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Add metadata to imsmanifest.xml (required for IMS import in ANGEL and WebCT). Balance <item> and </item> tags used to describe course hierarchy.  LON-CAPA exports can be imported successfully into Reload, ANGEL, and WebCT (who would ever want to do this?).        
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.198 loncom/interface/londocs.pm:1.199
--- loncom/interface/londocs.pm:1.198	Tue Jul 26 12:41:43 2005
+++ loncom/interface/londocs.pm	Tue Jul 26 18:30:20 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.198 2005/07/26 16:41:43 raeburn Exp $
+# $Id: londocs.pm,v 1.199 2005/07/26 22:30:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -490,10 +490,21 @@
 ' identifier="MANIFEST-'.$env{'request.course.id'}.'-'.$now.'"'.
 '  xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1imscp_v1p1.xsd'.
 '  http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p2.xsd">'."\n".
+'  <metadata>
+    <schema></schema>
+    <imsmd:lom>
+      <imsmd:general>
+        <imsmd:identifier>'.$env{'request.course.id'}.'</imsmd:identifier>
+        <imsmd:title>
+          <imsmd:langstring xml:lang="en">'.$env{'course.'.$env{'request.course.id'}.'.description'}.'</imsmd:langstring>
+        </imsmd:title>
+      </imsmd:general>
+    </imsmd:lom>
+  </metadata>'."\n".
 '  <organizations default="ORG-'.$env{'request.course.id'}.'-'.$now.'">'."\n".
 '    <organization identifier="ORG-'.$env{'request.course.id'}.'-'.$now.'"'.
 ' structure="hierarchical">'."\n".
-'      <title>'.$env{'request.'.$env{'request.course.id'}.'.description'}.'</title>'
+'      <title>'.$env{'course.'.$env{'request.course.id'}.'.description'}.'</title>'
     } else {
         $$outcome .= 'An error occurred opening the IMS manifest file.<br />'
 ;
@@ -541,7 +552,6 @@
     $count = 0;
     my $imsresources;
     my $pkgdepth;
-    my $included = 0;
     while ($curRes = $it->next()) {
         if ($curRes == $it->BEGIN_MAP()) {
             $prevdepth = $depth;
@@ -564,10 +574,13 @@
                 unless ($curRes->is_sequence()) {
                     $resourceref = 'identifierref="RES-'.$env{'request.course.id'}.'-'.$count.'"';
                 }
-                if (($depth <= $prevdepth) && ($count > 1) && ($included)) {
-                    print $ims_manifest "\n".'  </item>'."\n";
+                my $step = $prevdepth - $depth;
+                if (($step >= 0) && ($count > 1)) {
+                    while ($step >= 0) {
+                        print $ims_manifest "\n".'  </item>'."\n";
+                        $step --;
+                    }
                 }
-                $included = 1;
                 $prevdepth = $depth;
 
                 my $itementry =
@@ -609,8 +622,6 @@
                     }
                 }
                 $pkgdepth = $depth;
-            } else {
-                $included = 0;
             }
         }
     }