<%
ref_require($helper)
## 
## Create outter tab-navigation
##
otTabContainer = @otrunk.root_object_service.createObject(org.concord.otrunk.ui.OTTabContainer.java_class)
otTabContainer.name = "Project"
otTabContainer.height = 700
otTabContainer.width = 750
activityTabs = otTabContainer.tabs

##
## Include the student_progress sub-view
## 
child_view = @otrunk.root_object_service.createObject(org.concord.otrunk.view.OTViewChild.java_class)
child_view.object=$model
child_view.viewid=$student_progress
child_view.use_scroll_pane = true
activityTabs.putObject('Student progress', child_view)

activities = get_activities();
activities.keys.sort {|a,b| [activities[a]["index"], a.name] <=> [activities[b]["index"], b.name] }.each do |activity_key|
  activity = activities[activity_key]
  activityTabContainer = @otrunk.root_object_service.createObject(org.concord.otrunk.ui.OTTabContainer.java_class)
  i = 1
  while activityTabs.object_keys.contains(activity_key.name)
    activity_key.name = activity_key.name.sub(/( \d+)?$/, " #{i += 1}")
  end
  activityTabContainer.name = "#{activity["index"]} - #{activity_key.name}" 
  activityTabs.putObject("#{activity["index"]} - #{activity_key.name}", activityTabContainer)

  stepTabs = activityTabContainer.tabs
  activity.delete("index")
  activity.keys.sort.each do |step_key|
    step = activity[step_key]
    tabTitle = "Step #{step_key.join(".")}"
    stepTabContainer = @otrunk.root_object_service.createObject(org.concord.otrunk.ui.OTTabContainer.java_class)
    stepTabContainer.name = tabTitle
    stepTabContainer.contents_may_scroll = false
    stepTabContainer.height = 500
    stepTabContainer.width = 700
    substepTabs = stepTabContainer.tabs
    stepTabs.putObject(tabTitle, stepTabContainer)
    i = 0
    step.each do |obj|
      i += 1
      tabTitle = "#{getClassString(obj.get_class)}"
      if step.size > 1
        tabTitle << " (#{i})"
      end
      substepTabs.putObject(tabTitle, obj)
    end
  end
end
%>

<div style="width: 100%; height: 100%; text-align: center;">
  <h3>
    <%= teacher_name() %> : <%= class_name() %>
  </h3>
  <hr/>
  <%= embedObject(otTabContainer) %>
</div>








