### Eclipse Workspace Patch 1.0
#P CVS
Index: mod/resource/type/ims/repository_deploy.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/resource/type/ims/repository_deploy.php,v
retrieving revision 1.7.2.2
diff -u -r1.7.2.2 repository_deploy.php
--- mod/resource/type/ims/repository_deploy.php	2 May 2008 04:07:33 -0000	1.7.2.2
+++ mod/resource/type/ims/repository_deploy.php	21 Aug 2008 01:11:42 -0000
@@ -147,7 +147,11 @@
     /// but this is supposed to be
     
     /// Detect if all the manifest share a common xml:base tag
-        $manifest_base = $data['manifest']['@']['xml:base'];
+        if (isset($data['manifest']['@']['xml:base'])) {
+            $manifest_base = $data['manifest']['@']['xml:base'];
+        } else {
+            $manifest_base = '';
+        }
 
     /// Parse XML-metadata
         /// Skip this for now (until a proper METADATA container was created in Moodle).
@@ -160,7 +164,11 @@
         }
     
     /// Detect if all the resources share a common xml:base tag
-        $resources_base = $data['manifest']['#']['resources']['0']['@']['xml:base'];
+        if (isset($data['manifest']['#']['resources']['0']['@']['xml:base'])) {
+            $resources_base = $data['manifest']['#']['resources']['0']['@']['xml:base'];
+        } else {
+            $resources_base = '';
+        }
       
     /// Now, we load all the resources available (keys are identifiers)
         if (!$resources = ims_load_resources($data['manifest']['#']['resources']['0']['#']['resource'], $manifest_base, $resources_base)) {
@@ -331,17 +339,19 @@
             /// Counters go up
                 $id++;
             /// Check for subitems recursively
-                $subitems = $item['#']['item'];
-                if (count($subitems)) {
-                /// Recursive call
-                    $subitemmap = ims_process_items($subitems, $level+1, $id, $obj_item->id);
-                /// Add at the end and counters if necessary
-                    if ($count_subitems = count($subitemmap)) {
-                        foreach ($subitemmap as $subitem) {
-                        /// Add the subitem to the main items array
-                            $itemmap[$subitem->id] = $subitem;
-                        /// Counters go up
-                            $id++;
+                if (isset($item['#']['item'])) {
+                    $subitems = $item['#']['item'];
+                    if (count($subitems)) {
+                    /// Recursive call
+                        $subitemmap = ims_process_items($subitems, $level+1, $id, $obj_item->id);
+                    /// Add at the end and counters if necessary
+                        if ($count_subitems = count($subitemmap)) {
+                            foreach ($subitemmap as $subitem) {
+                            /// Add the subitem to the main items array
+                                $itemmap[$subitem->id] = $subitem;
+                            /// Counters go up
+                                $id++;
+                            }
                         }
                     }
                 }
@@ -373,8 +383,16 @@
         /// Create a new object resource
             $obj_resource = new stdClass;
             $obj_resource->identifier = $resource['@']['identifier'];
-            $obj_resource->resource_base = $resource['@']['xml:base'];
-            $obj_resource->href = $resource['@']['href'];
+            if (isset($resource['@']['xml:base'])) {
+                $obj_resource->resource_base = $resource['@']['xml:base'];
+            } else { 
+                $obj_resource->resource_base = '';
+            }
+            if (isset($resource['@']['href'])) {
+                $obj_resource->href = $resource['@']['href'];
+            } else {
+                $obj_resource->href = '';
+            }
             if (empty($obj_resource->href)) {
                 $obj_resource->href = $resource['#']['file']['0']['@']['href'];
             }

