0

我需要使用scorm 2004的选择控制模式,所以我做了这个非常基本的测试:

这是我的清单:

<?xml version="1.0" encoding="UTF-8"?>

<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://ltsc.ieee.org/xsd/LOM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_v1p3" xmlns:imsss="http://www.imsglobal.org/xsd/imsss" xmlns:adlseq="http://www.adlnet.org/xsd/adlseq_v1p3" xmlns:adlnav="http://www.adlnet.org/xsd/adlnav_v1p3" identifier="MANIFEST-2F10A7A25FC691A6212BD9CB0B505D44" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://ltsc.ieee.org/xsd/LOM lom.xsd http://www.adlnet.org/xsd/adlcp_v1p3 adlcp_v1p3.xsd http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd http://www.adlnet.org/xsd/adlseq_v1p3 adlseq_v1p3.xsd http://www.adlnet.org/xsd/adlnav_v1p3 adlnav_v1p3.xsd http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd">
    <metadata>
        <schema>ADL SCORM</schema>
        <schemaversion>2004 3rd Edition</schemaversion>
    </metadata>
    <organizations default="ORG">
        <organization identifier="ORG" structure="hierarchical">
            <title>06 Navigation</title>
            <item identifier="page1" isvisible="true" identifierref="RES-page1">
                <title>page1</title>
                <item identifier="page2" isvisible="true" identifierref="RES-page2">
                    <title>page2</title>
                </item>
                <item identifier="page3" isvisible="true" identifierref="RES-page3">
                    <title>page3</title>
                </item>
                <imsss:sequencing>
                    <imsss:controlMode choice="true" choiceExit="false" flow="false" useCurrentAttemptObjectiveInfo="false" useCurrentAttemptProgressInfo="false"/>         
                </imsss:sequencing>
            </item>         
        </organization>
    </organizations>
    <resources>
        <resource identifier="RES-page1" adlcp:scormType="sco" type="webcontent" href="page1.html">
          <file href="page1.html" />
          <file href="js/jquery-1.8.3.min.js" />
          <file href="js/SCORM_API_wrapper.js" />
          <file href="js/lmsCommunication.js" />
        </resource>
        <resource identifier="RES-page2" adlcp:scormType="sco" type="webcontent" href="page2.html">
          <file href="page2.html" />
          <file href="js/jquery-1.8.3.min.js" />
          <file href="js/SCORM_API_wrapper.js" />
          <file href="js/lmsCommunication.js" />
        </resource>
        <resource identifier="RES-page3" adlcp:scormType="sco" type="webcontent" href="page3.html">
          <file href="page3.html" />
          <file href="js/jquery-1.8.3.min.js" />
          <file href="js/SCORM_API_wrapper.js" />
          <file href="js/lmsCommunication.js" />
        </resource>
    </resources>
</manifest>

在第 1 页,我连接到 API 并成功获取用户名。

单击时,我尝试使用此 js 代码转到第 2 页:

var scorm = pipwerks.SCORM;

$( document ).ready( init );

function init()
{
    scorm.version = "2004";

    connect();

    var learnerName = getValue( "cmi.learner_name" );

    $( "#Name" ).html( "Bonjour " + learnerName + " !!!" );

    $( "#goto2" ).click( goto2 );

    $( window ).unload( disconnect );
}

function goto2()
{
    if( getValue( "adl.nav.request_valid.choice.{target=page2}" ) == "true" )
    {
        setValue( 'adl.nav.request', '{target=page2}choice' );
        disconnect();
    }

    /* if( getValue( "adl.nav.request_valid.continue" ) == "true" )
    {
        setValue( 'adl.nav.request', 'continue' );
        disconnect();
    } */
}

function connect()
{
    if( !scorm.connection.isActive )
    {
        var isSuccess = scorm.init();               
        var msg = "Connexion : " + ( ( isSuccess )? "succès" : "échec" );
        log( msg, isSuccess );
    }
}

function disconnect()
{
    if( scorm.connection.isActive )
    {
        var isSuccess = scorm.quit();               
        var msg = "Déconnexion : " + ( ( isSuccess )? "succès" : "échec" );
        log( msg, isSuccess );
    }
}

function save()
{
    if( scorm.connection.isActive )
    {
        var isSuccess = scorm.save();               
        var msg = "Sauvegarde : " + ( ( isSuccess )? "succès" : "échec" );
        log( msg, isSuccess );
    }
}

function getValue( parameter )
{
    var value = null;

    if( scorm.connection.isActive )
    {
        value = scorm.get( parameter );
        var msg = "Get " + parameter + " : " + ( ( value )? value : "échec" );
        var isSuccess = ( value )? true : false;
        log( msg, isSuccess );
    }

    return value;
}

function setValue( parameter, value )
{
    if( scorm.connection.isActive )
    {
        var isSuccess = scorm.set( parameter, value );
        var msg = "Set " + parameter + " = " + value + " : " + ( ( isSuccess )? "succès" : "échec" );
        log( msg, isSuccess );
    }
}

function log( msg, isSuccess )
{
    $( "#console" ).append( "<div style=\"color:" + ( ( isSuccess )? "blue" : "orangered" ) + ";\">" + msg + "</div>" );
}

scorm.set( 'adl.nav.request', '{target=page2}choice' ) 不起作用,它返回一个空字符串。

为什么它不工作?也许是 js 中的错误或清单中的坏树?

我没有成功找到好的语法,我也不确定我探索了什么方式......

4

1 回答 1

0

以下行返回什么?

getValue("adl.nav.request_valid.choice.{target=page2}")
于 2012-11-22T09:48:34.337 回答