scorm2004-manifest 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +94 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/lib/scorm2004/manifest/adlseq_map_info.rb +17 -0
- data/lib/scorm2004/manifest/adlseq_objective.rb +14 -0
- data/lib/scorm2004/manifest/adlseq_objectives.rb +11 -0
- data/lib/scorm2004/manifest/attributes.rb +147 -0
- data/lib/scorm2004/manifest/children.rb +83 -0
- data/lib/scorm2004/manifest/completion_threshold.rb +13 -0
- data/lib/scorm2004/manifest/condition_rule.rb +12 -0
- data/lib/scorm2004/manifest/constrained_choice_considerations.rb +12 -0
- data/lib/scorm2004/manifest/control_mode.rb +16 -0
- data/lib/scorm2004/manifest/custom_error.rb +15 -0
- data/lib/scorm2004/manifest/data.rb +11 -0
- data/lib/scorm2004/manifest/data_from_lms.rb +21 -0
- data/lib/scorm2004/manifest/delivery_controls.rb +13 -0
- data/lib/scorm2004/manifest/dependency.rb +21 -0
- data/lib/scorm2004/manifest/error.rb +5 -0
- data/lib/scorm2004/manifest/file.rb +16 -0
- data/lib/scorm2004/manifest/hide_lmsui.rb +21 -0
- data/lib/scorm2004/manifest/href.rb +24 -0
- data/lib/scorm2004/manifest/item.rb +36 -0
- data/lib/scorm2004/manifest/limit_conditions.rb +12 -0
- data/lib/scorm2004/manifest/manifest.rb +26 -0
- data/lib/scorm2004/manifest/map.rb +13 -0
- data/lib/scorm2004/manifest/map_info.rb +15 -0
- data/lib/scorm2004/manifest/min_normalized_measure.rb +18 -0
- data/lib/scorm2004/manifest/navigation_interface.rb +10 -0
- data/lib/scorm2004/manifest/objective.rb +16 -0
- data/lib/scorm2004/manifest/objectives.rb +12 -0
- data/lib/scorm2004/manifest/organization.rb +20 -0
- data/lib/scorm2004/manifest/organizations.rb +24 -0
- data/lib/scorm2004/manifest/presentation.rb +10 -0
- data/lib/scorm2004/manifest/primary_objective.rb +24 -0
- data/lib/scorm2004/manifest/randomization_controls.rb +16 -0
- data/lib/scorm2004/manifest/resource.rb +18 -0
- data/lib/scorm2004/manifest/resources.rb +12 -0
- data/lib/scorm2004/manifest/rollup_action.rb +13 -0
- data/lib/scorm2004/manifest/rollup_condition.rb +24 -0
- data/lib/scorm2004/manifest/rollup_conditions.rb +14 -0
- data/lib/scorm2004/manifest/rollup_considerations.rb +17 -0
- data/lib/scorm2004/manifest/rollup_rule.rb +19 -0
- data/lib/scorm2004/manifest/rollup_rules.rb +16 -0
- data/lib/scorm2004/manifest/rule_action.rb +31 -0
- data/lib/scorm2004/manifest/rule_condition.rb +41 -0
- data/lib/scorm2004/manifest/rule_conditions.rb +14 -0
- data/lib/scorm2004/manifest/schema.rb +18 -0
- data/lib/scorm2004/manifest/schemaversion.rb +18 -0
- data/lib/scorm2004/manifest/sequencing.rb +24 -0
- data/lib/scorm2004/manifest/sequencing_collection.rb +11 -0
- data/lib/scorm2004/manifest/sequencing_rules.rb +13 -0
- data/lib/scorm2004/manifest/text_node.rb +11 -0
- data/lib/scorm2004/manifest/time_limit_action.rb +24 -0
- data/lib/scorm2004/manifest/title.rb +16 -0
- data/lib/scorm2004/manifest/visitor_pattern.rb +31 -0
- data/lib/scorm2004/manifest/xml_base.rb +38 -0
- data/lib/scorm2004/manifest.rb +76 -0
- data/lib/scorm2004-manifest.rb +1 -0
- data/test/functional_test.rb +45 -0
- data/test/helper.rb +18 -0
- data/test/mbce_test.rb +66 -0
- data/test/msce_test.rb +55 -0
- data/test/scorm2004/manifest/adlseq_map_info_test.rb +47 -0
- data/test/scorm2004/manifest/adlseq_objective_test.rb +44 -0
- data/test/scorm2004/manifest/adlseq_objectives_test.rb +29 -0
- data/test/scorm2004/manifest/any_uri_token_test.rb +40 -0
- data/test/scorm2004/manifest/attributes_test.rb +224 -0
- data/test/scorm2004/manifest/children_test.rb +330 -0
- data/test/scorm2004/manifest/completion_threshold_test.rb +80 -0
- data/test/scorm2004/manifest/condition_rule_test.rb +40 -0
- data/test/scorm2004/manifest/constrained_choice_considerations_test.rb +25 -0
- data/test/scorm2004/manifest/control_mode_test.rb +41 -0
- data/test/scorm2004/manifest/custom_error_test.rb +43 -0
- data/test/scorm2004/manifest/data_from_lms_test.rb +47 -0
- data/test/scorm2004/manifest/data_test.rb +31 -0
- data/test/scorm2004/manifest/delivery_controls_test.rb +27 -0
- data/test/scorm2004/manifest/dependency_test.rb +53 -0
- data/test/scorm2004/manifest/duration_attribute_test.rb +59 -0
- data/test/scorm2004/manifest/file_test.rb +40 -0
- data/test/scorm2004/manifest/hide_lmsui_test.rb +40 -0
- data/test/scorm2004/manifest/href_test.rb +43 -0
- data/test/scorm2004/manifest/item_test.rb +86 -0
- data/test/scorm2004/manifest/limit_conditions_test.rb +34 -0
- data/test/scorm2004/manifest/manifest_test.rb +152 -0
- data/test/scorm2004/manifest/map_info_test.rb +41 -0
- data/test/scorm2004/manifest/map_test.rb +32 -0
- data/test/scorm2004/manifest/min_normalized_measure_test.rb +28 -0
- data/test/scorm2004/manifest/navigation_interface_test.rb +29 -0
- data/test/scorm2004/manifest/non_negative_integer_attribute_test.rb +64 -0
- data/test/scorm2004/manifest/objective_test.rb +45 -0
- data/test/scorm2004/manifest/objectives_test.rb +37 -0
- data/test/scorm2004/manifest/organization_test.rb +115 -0
- data/test/scorm2004/manifest/organizations_test.rb +68 -0
- data/test/scorm2004/manifest/partial_manifest.rb +23 -0
- data/test/scorm2004/manifest/partial_manifest_test.rb +44 -0
- data/test/scorm2004/manifest/presentation_test.rb +26 -0
- data/test/scorm2004/manifest/primary_objective_test.rb +65 -0
- data/test/scorm2004/manifest/randomization_controls_test.rb +71 -0
- data/test/scorm2004/manifest/resource_test.rb +96 -0
- data/test/scorm2004/manifest/resources_test.rb +41 -0
- data/test/scorm2004/manifest/rollup_action_test.rb +33 -0
- data/test/scorm2004/manifest/rollup_condition_test.rb +42 -0
- data/test/scorm2004/manifest/rollup_conditions_test.rb +53 -0
- data/test/scorm2004/manifest/rollup_considerations_test.rb +42 -0
- data/test/scorm2004/manifest/rollup_rule_test.rb +87 -0
- data/test/scorm2004/manifest/rollup_rules_test.rb +60 -0
- data/test/scorm2004/manifest/rule_action_test.rb +79 -0
- data/test/scorm2004/manifest/rule_condition_test.rb +70 -0
- data/test/scorm2004/manifest/rule_conditions_test.rb +37 -0
- data/test/scorm2004/manifest/schema_test.rb +29 -0
- data/test/scorm2004/manifest/schemaversion_test.rb +29 -0
- data/test/scorm2004/manifest/sequencing_collection_test.rb +31 -0
- data/test/scorm2004/manifest/sequencing_rules_test.rb +36 -0
- data/test/scorm2004/manifest/sequencing_test.rb +42 -0
- data/test/scorm2004/manifest/string_attribute_test.rb +68 -0
- data/test/scorm2004/manifest/text_node_test.rb +37 -0
- data/test/scorm2004/manifest/time_limit_action_test.rb +51 -0
- data/test/scorm2004/manifest/title_test.rb +59 -0
- data/test/scorm2004/manifest/token_attribute_test.rb +53 -0
- data/test/scorm2004/manifest/visitor_pattern_test.rb +85 -0
- data/test/scorm2004/manifest/xml_base_test.rb +125 -0
- data/test/scorm2004/manifest_test.rb +33 -0
- data/test/scorm2004_test.rb +9 -0
- data/test/sece_test.rb +53 -0
- metadata +260 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class HideLmsui
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include TextNode
|
7
|
+
|
8
|
+
def self.vocabulary
|
9
|
+
%w( previous continue exit exitAll abandon abandonAll suspendAll )
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def do_visit
|
15
|
+
unless self.class.vocabulary.include?(content)
|
16
|
+
error("Invalid <adlnav:hideLMSUI> token: #{content}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
module Href
|
4
|
+
def href
|
5
|
+
(base ? resolve_href : relative_href).try(:to_s)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def relative_href
|
11
|
+
value = el.at('./@href', NS)
|
12
|
+
return unless value
|
13
|
+
uri = URI(value)
|
14
|
+
uri.absolute? ? uri : Pathname(uri.path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def resolve_href
|
18
|
+
return nil unless relative_href
|
19
|
+
return relative_href if relative_href.is_a?(URI)
|
20
|
+
base + relative_href.to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Item
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :id, 'identifier'
|
10
|
+
attribute :string, 'identifierref', allow_nil: true
|
11
|
+
attribute :boolean, 'isvisible', default: true
|
12
|
+
attribute :string, 'parameters', allow_nil: true
|
13
|
+
|
14
|
+
has_one_and_only_one 'imscp:title'
|
15
|
+
has_zero_or_more 'imscp:item'
|
16
|
+
has_zero_or_one 'adlcp:timeLimitAction'
|
17
|
+
has_zero_or_one 'adlcp:dataFromLMS'
|
18
|
+
has_zero_or_one 'adlcp:completionThreshold'
|
19
|
+
has_zero_or_one 'imsss:sequencing'
|
20
|
+
has_zero_or_one 'adlnav:presentation'
|
21
|
+
has_zero_or_one 'adlcp:data'
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def do_visit
|
26
|
+
if identifierref && resource.nil?
|
27
|
+
error("A <resource> element whose identifier is #{identifierref} not found:")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def resource
|
32
|
+
el.at("/imscp:manifest/imscp:resources/imscp:resource[@identifier='#{identifierref}']", NS)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class LimitConditions
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
attribute :non_negative_integer, 'attemptLimit', allow_nil: true
|
9
|
+
attribute :duration, 'attemptAbsoluteDurationLimit', allow_nil: true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Manifest
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
include XmlBase
|
9
|
+
|
10
|
+
has_one_and_only_one './imscp:metadata/imscp:schema'
|
11
|
+
has_one_and_only_one './imscp:metadata/imscp:schemaversion'
|
12
|
+
has_one_and_only_one 'imscp:resources'
|
13
|
+
has_one_and_only_one 'imscp:organizations'
|
14
|
+
has_zero_or_one 'imsss:sequencingCollection'
|
15
|
+
|
16
|
+
attribute :id, 'identifier'
|
17
|
+
attribute :string, 'version', spm: 20
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def do_visit
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Map
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
attribute :any_uri, 'targetID'
|
9
|
+
attribute :boolean, 'readSharedData', default: true
|
10
|
+
attribute :boolean, 'writeSharedData', default: true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class MapInfo
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
attribute :any_uri, 'targetObjectiveID'
|
9
|
+
attribute :boolean, 'readSatisfiedStatus', default: true
|
10
|
+
attribute :boolean, 'readNormalizedMeasure', default: true
|
11
|
+
attribute :boolean, 'writeSatisfiedStatus', default: false
|
12
|
+
attribute :boolean, 'writeNormalizedMeasure', default: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class MinNormalizedMeasure
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
|
7
|
+
def to_f
|
8
|
+
Float(el.content)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def do_visit
|
14
|
+
error("#{el} should be between -1 and 1.") unless (-1.0..1.0).include?(to_f)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Objective
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :boolean, 'satisfiedByMeasure', default: false
|
10
|
+
attribute :any_uri, 'objectiveID'
|
11
|
+
|
12
|
+
has_zero_or_one 'imsss:minNormalizedMeasure'
|
13
|
+
has_zero_or_more 'imsss:mapInfo'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Organization
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
include XmlBase
|
9
|
+
|
10
|
+
has_one_or_more 'imscp:item'
|
11
|
+
has_one_and_only_one 'imscp:title'
|
12
|
+
has_zero_or_one 'adlcp:completionThreshold'
|
13
|
+
has_zero_or_one 'imsss:sequencing'
|
14
|
+
|
15
|
+
attribute :id, 'identifier'
|
16
|
+
attribute :boolean, 'adlseq:objectivesGlobalToSystem', default: false
|
17
|
+
attribute :boolean, 'adlcp:sharedDataGlobalToSystem', default: false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Organizations
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
include XmlBase
|
9
|
+
|
10
|
+
attribute :idref, 'default'
|
11
|
+
has_one_or_more 'imscp:organization'
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def do_visit
|
16
|
+
error('Default <resource> not foulnd: ' + default) unless default_resource
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_resource
|
20
|
+
el.at("/imscp:manifest/imscp:organizations/imscp:organization[@identifier='#{default}']", NS)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class PrimaryObjective
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :boolean, 'satisfiedByMeasure', default: false
|
10
|
+
attribute :any_uri, 'objectiveID', allow_nil: true
|
11
|
+
|
12
|
+
has_zero_or_one 'imsss:minNormalizedMeasure'
|
13
|
+
has_zero_or_more 'imsss:mapInfo'
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def do_visit
|
18
|
+
error(<<EOS) if el.at('./imsss:mapInfo', NS) && objective_id.nil?
|
19
|
+
If a <primaryObjective> contains an objective map (<mapInfo>), then the objectiveID attribute is required.
|
20
|
+
EOS
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RandomizationControls
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
TIMINGS = %w( never once onEachNewAttempt )
|
9
|
+
|
10
|
+
attribute :token, 'randomizationTiming', vocabulary: TIMINGS, default: 'never'
|
11
|
+
attribute :non_negative_integer, 'selectCount', allow_nil: true
|
12
|
+
attribute :boolean, 'reorderChildren', default: false
|
13
|
+
attribute :token, 'selectionTiming', vocabulary: TIMINGS, default: 'never'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Resource
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
include XmlBase
|
9
|
+
include Href
|
10
|
+
|
11
|
+
attribute :id, 'identifier'
|
12
|
+
attribute :token, 'adlcp:scormType', vocabulary: %w( sco asset )
|
13
|
+
|
14
|
+
has_zero_or_more 'imscp:file'
|
15
|
+
has_zero_or_more 'imscp:dependency'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupAction
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
ACTIONS = %w( satisfied notSatisfied completed incomplete )
|
9
|
+
|
10
|
+
attribute :token, 'action', vocabulary: ACTIONS
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupCondition
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
CONDITIONS = [
|
9
|
+
'satisfied',
|
10
|
+
'objectiveStatusKnown',
|
11
|
+
'objectiveMeasureKnown',
|
12
|
+
'completed',
|
13
|
+
'activityProgressKnown',
|
14
|
+
'attempted',
|
15
|
+
'attemptLimitExceeded',
|
16
|
+
'timeLimitExceeded',
|
17
|
+
'outsideAvailableTimeRange'
|
18
|
+
]
|
19
|
+
|
20
|
+
attribute :token, 'operator', vocabulary: %w( not noOp ), default: 'noOp'
|
21
|
+
attribute :token, 'condition', vocabulary: CONDITIONS
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupConditions
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :token, 'conditionCombination', vocabulary: %w( any all ), default: 'any'
|
10
|
+
|
11
|
+
has_one_or_more 'imsss:rollupCondition'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupConsiderations
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
CONDITIONS = %w( always ifAttempted ifNotSkipped ifNotSuspended )
|
9
|
+
|
10
|
+
%w( requiredForSatisfied requireForNotSatisfied requiredForCompleted requireForIncomplete ).each do |attr|
|
11
|
+
attribute :token, attr, vocabulary: CONDITIONS, default: CONDITIONS.first
|
12
|
+
end
|
13
|
+
|
14
|
+
attribute :boolean, 'measureSatisfactionIfActive', default: true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupRule
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
CONDITIONS = %w( all any none atLeastCount atLeastPercent )
|
10
|
+
|
11
|
+
attribute :token, 'childActivitySet', vocabulary: CONDITIONS, default: CONDITIONS.first
|
12
|
+
attribute :non_negative_integer, 'minimumCount', default: 0
|
13
|
+
attribute :decimal, 'minimumPercent', range: 0.0..1.0, default: 0.0
|
14
|
+
|
15
|
+
has_one_and_only_one 'imsss:rollupConditions'
|
16
|
+
has_one_and_only_one 'imsss:rollupAction'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RollupRules
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :boolean, 'rollupObjectiveSatisfied', default: true
|
10
|
+
attribute :boolean, 'rollupProgressCompletion', default: true
|
11
|
+
attribute :decimal, 'objectiveMeasureWeight', range: 0.0..1.0, default: 1.0
|
12
|
+
|
13
|
+
has_zero_or_more 'imsss:rollupRule'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RuleAction
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
PRE = %w( skip disabled hiddenFromChoice stopForwardTraversal )
|
9
|
+
POST = %w( exitParent exitAll retry retryAll continue previous )
|
10
|
+
EXIT = %w( exit )
|
11
|
+
|
12
|
+
attribute :token, 'action', vocabulary: PRE + POST + EXIT
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def do_visit
|
17
|
+
parent_name = el.at('..').name
|
18
|
+
case parent_name
|
19
|
+
when 'preConditionRule'
|
20
|
+
error("Invalid rule action in <preConditionRule>: #{action}") unless PRE.include?(action)
|
21
|
+
when 'postConditionRule'
|
22
|
+
error("Invalid rule action in <postConditionRule>: #{action}") unless POST.include?(action)
|
23
|
+
when 'exitConditionRule'
|
24
|
+
error("Invalid rule action in <exitConditionRuel>: #{action}") unless EXIT.include?(action)
|
25
|
+
else
|
26
|
+
error("Invalid parent element for <ruleAction>: <#{parent_name}>")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RuleCondition
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Attributes
|
7
|
+
|
8
|
+
CONDITIONS = [
|
9
|
+
'satisfied',
|
10
|
+
'objectiveStatusKnown',
|
11
|
+
'objectiveMeasureKnown',
|
12
|
+
'objectiveMeasureGreaterThan',
|
13
|
+
'objectiveMeasureLessThan',
|
14
|
+
'completed',
|
15
|
+
'activityProgressKnown',
|
16
|
+
'attempted',
|
17
|
+
'attemptLimitExceeded',
|
18
|
+
'timeLimitExceeded',
|
19
|
+
'outsideAvailableTimeRange',
|
20
|
+
'always'
|
21
|
+
]
|
22
|
+
|
23
|
+
attribute :token, 'operator', vocabulary: %w( not noOp ), default: 'noOp'
|
24
|
+
attribute :string, 'referencedObjective', allow_nil: true
|
25
|
+
attribute :decimal, 'measureThreshold', range: -1.0..1.0, allow_nil: true
|
26
|
+
attribute :token, 'condition', vocabulary: CONDITIONS
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def do_visit
|
31
|
+
return unless referenced_objective
|
32
|
+
if '' == referenced_objective
|
33
|
+
error('The referencedObjective attribute cannot be an empty string.')
|
34
|
+
end
|
35
|
+
if /\s/ =~ referenced_objective
|
36
|
+
error('The referencedObjective attribute cannot contain any whitespace characters.')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class RuleConditions
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :token, 'conditionCombination', vocabulary: %w( all any ), default: 'all'
|
10
|
+
|
11
|
+
has_one_or_more 'imsss:ruleCondition'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Schema
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def do_visit
|
10
|
+
error("Invalid schema: #{el.content}") unless valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
def valid?
|
14
|
+
'ADL SCORM' == el.content
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Schemaversion
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def do_visit
|
10
|
+
error("Invalid schemaversion: #{el.content}") unless valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
def valid?
|
14
|
+
'2004 4th Edition' == el.content
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class Sequencing
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
include Attributes
|
8
|
+
|
9
|
+
attribute :id, 'ID', allow_nil: true
|
10
|
+
attribute :idref, 'IDRef', allow_nil: true
|
11
|
+
|
12
|
+
has_zero_or_one 'imsss:controlMode'
|
13
|
+
has_zero_or_one 'imsss:sequencingRules'
|
14
|
+
has_zero_or_one 'imsss:limitConditions'
|
15
|
+
has_zero_or_one 'imsss:rollupRules'
|
16
|
+
has_zero_or_one 'imsss:objectives'
|
17
|
+
has_zero_or_one 'imsss:randomizationControls'
|
18
|
+
has_zero_or_one 'imsss:deliveryControls'
|
19
|
+
has_zero_or_one 'adlseq:constrainedChoiceConsiderations'
|
20
|
+
has_zero_or_one 'adlseq:rollupConsiderations'
|
21
|
+
has_zero_or_one 'adlseq:objectives', name: 'adlseq_objectives', visitor: :adlseq_objectives
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Scorm2004
|
2
|
+
module Manifest
|
3
|
+
class SequencingRules
|
4
|
+
include VisitorPattern
|
5
|
+
include CustomError
|
6
|
+
include Children
|
7
|
+
|
8
|
+
has_zero_or_more 'imsss:preConditionRule', visitor: :condition_rule
|
9
|
+
has_zero_or_more 'imsss:postConditionRule', visitor: :condition_rule
|
10
|
+
has_zero_or_more 'imsss:exitConditionRule', visitor: :condition_rule
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|