diff --git a/.gitignore b/.gitignore index 6bda23f3..e0b494ea 100644 --- a/.gitignore +++ b/.gitignore @@ -249,7 +249,8 @@ bh_unicode_properties.cache # Sublime-github package stores a github token in this file # https://packagecontrol.io/packages/sublime-github GitHub.sublime-settings - +.direnv +.idea ### Vim template # Swap diff --git a/README.md b/README.md index 81d7559d..544ed13b 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,7 @@ npm run dev * In the .idea/vbv_lernwelt.iml file change the module type to "PYTHON_MODULE". * Add django facet in "Project Structure". * Run configuration with "Python -> server.py" to have async debugging support. +### Optional +* Install the EnvFile Plugin +* Install the tailwind css Plugin from Jetbrains + diff --git a/env_secrets/local_lorenz.env b/env_secrets/local_lorenz.env new file mode 100644 index 00000000..01cac659 Binary files /dev/null and b/env_secrets/local_lorenz.env differ diff --git a/git-crypt-encrypted-files.txt b/git-crypt-encrypted-files.txt index 279b8b0e..dd4c2af7 100644 --- a/git-crypt-encrypted-files.txt +++ b/git-crypt-encrypted-files.txt @@ -1,2 +1,3 @@ encrypted: env_secrets/caprover.env encrypted: env_secrets/production.env + encrypted: env_secrets/local_lorenz.env diff --git a/local-setup-for-tests.sh b/local-setup-for-tests.sh new file mode 100755 index 00000000..f861cfe5 --- /dev/null +++ b/local-setup-for-tests.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +#export DATABASE_HOST=postgres +#export DATABASE_PORT=5432 +#export DATABASE_URL=postgres://$DATABASE_USER:$PG_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME +# +#echo $DATABASE_URL +#DJANGO_SETTINGS_MODULE=config.settings.base +#DATABASE_NAME=vbv_lernwelt +SKIP_SETUP=false +## + +echo "Setting up VBV Project for Local usage" +if [ "$SKIP_SETUP" = false ]; then + if [ -z "$PG_PORT" ]; then # if the port is set in the env, use iterg + DB_PORT=""; + else + DB_PORT="-p $PG_PORT"; + fi + if [ -z "$PG_USER" ]; then # if the user is set in the env, use it + DB_USER=""; + else + DB_USER="-U $PG_USER"; + fi + echo "psql -h localhost --port=$DB_PORT --username=$DB_USER -c 'drop database if exists' $DATABASE_NAME;" + + echo "Drop all connections to the database" + psql -h localhost --port=$DB_PORT --username=$DB_USER -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$DATABASE_NAME' AND pid <> pg_backend_pid();" + + echo "Drop database: $DATABASE_NAME" + psql -h localhost --port=$DB_PORT --username=$DB_USER -c "drop database if exists $DATABASE_NAME;" + + echo "Create database: $DATABASE_NAME" + psql -h localhost --port=$DB_PORT --username=$DB_USER -c "create database $DATABASE_NAME;" + + # reset data + python3 server/manage.py createcachetable --settings="$DJANGO_SETTINGS_MODULE" + python3 server/manage.py migrate --settings="$DJANGO_SETTINGS_MODULE" + python3 server/manage.py create_default_users --settings="$DJANGO_SETTINGS_MODULE" + python3 server/manage.py create_default_learningpath --settings="$DJANGO_SETTINGS_MODULE" +# +# # make django translations + (cd server && python3 manage.py compilemessages --settings="$DJANGO_SETTINGS_MODULE") +fi + diff --git a/package.json b/package.json index 3f5ec7aa..c358f6b8 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,8 @@ }, "devDependencies": { "cypress": "^9.4.1" + }, + "dependencies": { + "tailwindcss": "^3.0.24" } } diff --git a/prepare_server_cypress.sh b/prepare_server_cypress.sh index 49612f88..8ef42ba9 100755 --- a/prepare_server_cypress.sh +++ b/prepare_server_cypress.sh @@ -43,7 +43,7 @@ DJANGO_SETTINGS_MODULE=config.settings.test_cypress CYPRESS_DB=vbv_lernwelt_cypress if [ "$SKIP_SETUP" = false ]; then - if [ -z "$PG_PORT" ]; then # if the port is set in the env, use it + if [ -z "$PG_PORT" ]; then # if the port is set in the env, use iterg DB_PORT=""; else DB_PORT="-p $PG_PORT"; @@ -66,12 +66,7 @@ if [ "$SKIP_SETUP" = false ]; then # make django translations (cd server && python3 manage.py compilemessages --settings="$DJANGO_SETTINGS_MODULE") -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set API_WFM_BACKEND_ENABLED true -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set TIBCO_SOAP_CUSTOMER_INTERACTION_CLIENT_ENABLED true -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set API_EMAIL_MESSAGING_ENABLED true -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set C4_NOTIFICATIONS_ENABLED true -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set SFTP_POSTFINANCE_ENABLED true -# python3 src/manage.py constance --settings="$DJANGO_SETTINGS_MODULE" set EASY_INSURANCE_AGENT_CAN_CREATE true + else echo "else" # python3 src/manage.py recreate_customer_data_for_integration_tests --settings="$DJANGO_SETTINGS_MODULE" diff --git a/server/config/settings/base.py b/server/config/settings/base.py index bb1ae595..bc29a5aa 100644 --- a/server/config/settings/base.py +++ b/server/config/settings/base.py @@ -31,7 +31,7 @@ DEBUG = env.bool("VBV_DJANGO_DEBUG", False) # In Windows, this must be set to your system time zone. TIME_ZONE = "Europe/Zurich" # https://docs.djangoproject.com/en/dev/ref/settings/#language-code -LANGUAGE_CODE = "en-us" +LANGUAGE_CODE = "de-CH" # https://docs.djangoproject.com/en/dev/ref/settings/#site-id SITE_ID = 1 # https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n @@ -83,13 +83,32 @@ THIRD_PARTY_APPS = [ "corsheaders", "drf_spectacular", "django_htmx", + + "grapple", + "graphene_django", + + 'wagtail.contrib.forms', + 'wagtail.contrib.redirects', + 'wagtail.embeds', + 'wagtail.sites', + 'wagtail.users', + 'wagtail.snippets', + 'wagtail.documents', + 'wagtail.images', + 'wagtail.search', + 'wagtail.admin', + 'wagtail.core', + 'wagtail.locales', + + 'modelcluster', + 'taggit', ] LOCAL_APPS = [ "vbv_lernwelt.core", "vbv_lernwelt.simpletodo", "vbv_lernwelt.sso", - # Your stuff: custom apps go here + "vbv_lernwelt.learnpath", ] # https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS @@ -153,6 +172,7 @@ MIDDLEWARE = [ "django_htmx.middleware.HtmxMiddleware", "vbv_lernwelt.core.middleware.auth.AuthenticationRequiredMiddleware", "vbv_lernwelt.core.middleware.security.SecurityRequestResponseLoggingMiddleware", + "wagtail.contrib.redirects.middleware.RedirectMiddleware", "vbv_lernwelt.core.middleware.auth.UserLoggedInCookieMiddleWare", ] @@ -177,6 +197,41 @@ MEDIA_ROOT = str(APPS_DIR / "media") # https://docs.djangoproject.com/en/dev/ref/settings/#media-url MEDIA_URL = "/media/" + +# WAGTAIL +# ------------------------------------------------------------------------------ +WAGTAIL_SITE_NAME = 'VBV Lernwelt' +WAGTAIL_I18N_ENABLED = True + +LANGUAGES = [ + ('en-US', "English (American)"), + ('fr-CH', "Swiss French"), + ('de-CH', "Swiss German"), + ('it-CH', "Swiss Italian") +] + + +WAGTAIL_CONTENT_LANGUAGES = [ + ('fr-CH', "Swiss French"), + ('de-CH', "Swiss German"), + ('it-CH', "Swiss Italian") +] + +WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.search.backends.database', + } +} + +# Wagtails Grapple Config: +GRAPHENE = {"SCHEMA": "grapple.schema.schema"} +GRAPPLE = { + "APPS": ["learnpath"], +"EXPOSE_GRAPHIQL" : True + +} + + # TEMPLATES # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#templates @@ -476,14 +531,14 @@ if DJANGO_DEV_MODE == "development": # django-debug-toolbar # ------------------------------------------------------------------------------ # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#prerequisites - INSTALLED_APPS += ["debug_toolbar"] # noqa F405 + #INSTALLED_APPS += ["debug_toolbar"] # noqa F405 # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#middleware - MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"] # noqa F405 + # MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"] # noqa F405 # https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html#debug-toolbar-config - DEBUG_TOOLBAR_CONFIG = { - "DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"], - "SHOW_TEMPLATE_CONTEXT": True, - } + # DEBUG_TOOLBAR_CONFIG = { + # "DISABLE_PANELS": ["debug_toolbar.panels.redirects.RedirectsPanel"], + # "SHOW_TEMPLATE_CONTEXT": True, + # } # https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#internal-ips INTERNAL_IPS = ["127.0.0.1", "10.0.2.2"] if env.bool("VBV_DJANGO_LOCAL_DOCKER", False): diff --git a/server/config/settings/local.py b/server/config/settings/local.py new file mode 100644 index 00000000..e0af5343 --- /dev/null +++ b/server/config/settings/local.py @@ -0,0 +1,42 @@ +# pylint: disable=unused-wildcard-import,wildcard-import,wrong-import-position +import getpass +import os + +from .base import * # noqa +from .base import env + +# GENERAL +# ------------------------------------------------------------------------------ +# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key +SECRET_KEY = env( + "VBV_DJANGO_SECRET_KEY", + default="1NpUCSvAKLpDZL9e3tqDaUesdfsadfasdfasdfMD3UjB72ZS", +) +# https://docs.djangoproject.com/en/dev/ref/settings/#test-runner +TEST_RUNNER = "django.test.runner.DiscoverRunner" + +# PASSWORDS +# ------------------------------------------------------------------------------ +# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers +PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] + +# EMAIL +# ------------------------------------------------------------------------------ +# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend +EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" + + +class DisableMigrations(dict): + def __contains__(self, item): + return True + + def __getitem__(self, item): + return None + +#MIGRATION_MODULES = DisableMigrations() + + + + +# Your stuff... +# ------------------------------------------------------------------------------ diff --git a/server/config/settings/test.py b/server/config/settings/test.py index ed59a58d..90c4b66c 100644 --- a/server/config/settings/test.py +++ b/server/config/settings/test.py @@ -39,7 +39,7 @@ MIGRATION_MODULES = DisableMigrations() DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", - "NAME": "vbv_lernwelt", + "NAME": "vbv_lernwelt_test", "USER": os.environ.get("PG_USER", getpass.getuser()), "PASSWORD": os.environ.get("PG_PASSWORD"), "HOST": "localhost", @@ -47,5 +47,6 @@ DATABASES = { } } + # Your stuff... # ------------------------------------------------------------------------------ diff --git a/server/config/urls.py b/server/config/urls.py index 85f51a68..d9f489b5 100644 --- a/server/config/urls.py +++ b/server/config/urls.py @@ -1,3 +1,4 @@ + from django.conf import settings from django.conf.urls.static import static from django.contrib import admin @@ -10,13 +11,16 @@ from django.views.generic import TemplateView from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView from ratelimit.exceptions import Ratelimited from rest_framework.authtoken.views import obtain_auth_token - from vbv_lernwelt.core.middleware.auth import django_view_authentication_exempt from vbv_lernwelt.core.views import ( rate_limit_exceeded_view, permission_denied_view, check_rate_limit, ) +from wagtail.admin import urls as wagtailadmin_urls +from wagtail.core import urls as wagtail_urls +from wagtail.documents import urls as wagtaildocs_urls +from grapple import urls as grapple_urls def raise_example_error(request): @@ -36,6 +40,9 @@ urlpatterns = [ path("checkratelimit/", check_rate_limit), path("todo/", include("vbv_lernwelt.simpletodo.urls")), path("sso/", include("vbv_lernwelt.sso.urls")), + path('cms/', include(wagtailadmin_urls)), + path('documents/', include(wagtaildocs_urls)), + path('pages/', include(wagtail_urls)), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG: # Static file serving when using Gunicorn + Uvicorn for local web socket development @@ -54,6 +61,7 @@ urlpatterns += [ path("auth-token/", obtain_auth_token), path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"), path("api/docs/", SpectacularSwaggerView.as_view(url_name="api-schema"), name="api-docs",), + path("", include(grapple_urls)), ] # fmt: on diff --git a/server/local.env b/server/local.env new file mode 100644 index 00000000..e69de29b diff --git a/server/requirements/requirements.in b/server/requirements/requirements.in index 292a80b4..0f2aa542 100644 --- a/server/requirements/requirements.in +++ b/server/requirements/requirements.in @@ -32,3 +32,9 @@ sentry-sdk structlog python-json-logger concurrent-log-handler + +wagtail<3 +wagtail-factories +wagtail-grapple==0.14.1 + + diff --git a/server/setup_test_data.sh b/server/setup_test_data.sh new file mode 100644 index 00000000..7a1dd173 --- /dev/null +++ b/server/setup_test_data.sh @@ -0,0 +1,5 @@ +python manage.py migrate +python manage.py createcachetable +python manage.py create_default_users +#python manage.py create_default_learingpath + diff --git a/server/vbv_lernwelt/core/create_default_users.py b/server/vbv_lernwelt/core/create_default_users.py new file mode 100644 index 00000000..82960734 --- /dev/null +++ b/server/vbv_lernwelt/core/create_default_users.py @@ -0,0 +1,34 @@ +from django.contrib.auth.hashers import make_password +from django.contrib.auth.models import Group + +from vbv_lernwelt.core.models import User + + +def create_default_users(user_model=User, group_model=Group): + admin_group, created = group_model.objects.get_or_create(name='admin_group') + content_creator_grop, created = group_model.objects.get_or_create(name='content_creator_grop') + student_group, created = group_model.objects.get_or_create(name='student_group') + + admin_user, created = _get_or_create_user(user_model=user_model, + username='admin', + password='admin') + admin_user.is_superuser=True + admin_user.groups.add(admin_group) + + admin_user.save() + student_user, created = _get_or_create_user(user_model=user_model, username='student', password='student') + student_user.groups.add(student_group) + student_user.save() + + +def _get_or_create_user(user_model, *args, **kwargs): + username = kwargs.get('username', None) + password = kwargs.get('password', None) + created = False + + user = user_model.objects.filter(username=username).first() + + if not user: + user = user_model.objects.create(username=username, password=make_password(password)) + created = True + return user, created diff --git a/server/vbv_lernwelt/core/management/commands/create_default_users.py b/server/vbv_lernwelt/core/management/commands/create_default_users.py new file mode 100644 index 00000000..2d7c365d --- /dev/null +++ b/server/vbv_lernwelt/core/management/commands/create_default_users.py @@ -0,0 +1,10 @@ +from vbv_lernwelt.core.create_default_users import create_default_users + + +import djclick as click + + +@click.command() +def command(): + print("Creating default users.") + create_default_users() diff --git a/server/vbv_lernwelt/core/management/commands/migrate_locales.py b/server/vbv_lernwelt/core/management/commands/migrate_locales.py new file mode 100644 index 00000000..4bc583e4 --- /dev/null +++ b/server/vbv_lernwelt/core/management/commands/migrate_locales.py @@ -0,0 +1,9 @@ +import djclick as click +from django.conf import settings +from wagtail.core.models import Locale + + +@click.command() +def command(): + for language in settings.WAGTAIL_CONTENT_LANGUAGES: + Locale.objects.create(language_code=language[0]) diff --git a/server/vbv_lernwelt/core/tests/test_user.py b/server/vbv_lernwelt/core/tests/test_user.py new file mode 100644 index 00000000..442d7b34 --- /dev/null +++ b/server/vbv_lernwelt/core/tests/test_user.py @@ -0,0 +1,16 @@ +from django.test import TestCase + +from vbv_lernwelt.core.models import User +from vbv_lernwelt.core.tests.factories import UserFactory +from vbv_lernwelt.simpletodo.models import SimpleList + + +class TestUserCreation(TestCase): + def test_create_user(self): + User(last_name='Sepp').save() + + def test_simple(self): + # create_default_learning_path() + self.user = UserFactory() + SimpleList.objects.get_or_create(title='Default', user=self.user) + self.assertTrue(True) diff --git a/server/vbv_lernwelt/core/utils.py b/server/vbv_lernwelt/core/utils.py index e8137755..af7f5938 100644 --- a/server/vbv_lernwelt/core/utils.py +++ b/server/vbv_lernwelt/core/utils.py @@ -4,7 +4,7 @@ import structlog from django.conf import settings from rest_framework.throttling import UserRateThrottle from structlog.types import EventDict - +#from .models import User def structlog_add_app_info( logger: logging.Logger, method_name: str, event_dict: EventDict diff --git a/server/vbv_lernwelt/learnpath/__init__.py b/server/vbv_lernwelt/learnpath/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/server/vbv_lernwelt/learnpath/admin.py b/server/vbv_lernwelt/learnpath/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/server/vbv_lernwelt/learnpath/apps.py b/server/vbv_lernwelt/learnpath/apps.py new file mode 100644 index 00000000..384ba36a --- /dev/null +++ b/server/vbv_lernwelt/learnpath/apps.py @@ -0,0 +1,13 @@ +from django.apps import AppConfig + + +class LearnpathConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'vbv_lernwelt.learnpath' + + def ready(self): + try: + # pylint: disable=unused-import,import-outside-toplevel + import vbv_lernwelt.learnpath.signals # noqa F401 + except ImportError: + pass diff --git a/server/vbv_lernwelt/learnpath/management/__init__.py b/server/vbv_lernwelt/learnpath/management/__init__.py new file mode 100644 index 00000000..536f0e29 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/management/__init__.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# +# Iterativ GmbH +# http://www.iterativ.ch/ +# +# Copyright (c) 2015 Iterativ GmbH. All rights reserved. +# +# Created on 2022-03-31 +# @author: lorenz.padberg@iterativ.ch diff --git a/server/vbv_lernwelt/learnpath/management/commands/__init__.py b/server/vbv_lernwelt/learnpath/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/server/vbv_lernwelt/learnpath/management/commands/create_default_learningpath.py b/server/vbv_lernwelt/learnpath/management/commands/create_default_learningpath.py new file mode 100644 index 00000000..5faf3e59 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/management/commands/create_default_learningpath.py @@ -0,0 +1,11 @@ +# pylint: disable=import-outside-toplevel + +import djclick as click +from django.contrib.auth import get_user_model + +from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path + + +@click.command() +def command(): + create_default_learning_path() diff --git a/server/vbv_lernwelt/learnpath/management/commands/delete_default_learningpath.py b/server/vbv_lernwelt/learnpath/management/commands/delete_default_learningpath.py new file mode 100644 index 00000000..2da68a66 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/management/commands/delete_default_learningpath.py @@ -0,0 +1,14 @@ +# pylint: disable=import-outside-toplevel + +import djclick as click +from django.contrib.auth import get_user_model + +from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path, \ + delete_default_learning_path + +import djclick as click + + +@click.command() +def command(): + delete_default_learning_path() diff --git a/server/vbv_lernwelt/learnpath/migrations/0001_initial.py b/server/vbv_lernwelt/learnpath/migrations/0001_initial.py new file mode 100644 index 00000000..6b3a574a --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0001_initial.py @@ -0,0 +1,124 @@ +# Generated by Django 3.2.12 on 2022-05-04 15:52 + +from django.db import migrations, models +import django.db.models.deletion +import modelcluster.fields +import wagtail.core.blocks +import wagtail.core.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('wagtailcore', '0066_collection_management_permissions'), + ] + + operations = [ + migrations.CreateModel( + name='Circle', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('description', models.TextField(blank=True, default='')), + ('goals', models.TextField(blank=True, default='')), + ], + options={ + 'verbose_name': 'Circle', + }, + bases=('wagtailcore.page', models.Model), + ), + migrations.CreateModel( + name='Competence', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('category_short', models.CharField(default='', max_length=3)), + ('name', models.CharField(max_length=2048)), + ], + options={ + 'verbose_name': 'Competence', + }, + ), + migrations.CreateModel( + name='CompetencePage', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ], + options={ + 'verbose_name': 'Learning Path', + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='LearningPath', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ], + options={ + 'verbose_name': 'Learning Path', + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='LearningSequence', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('title', models.CharField(default='', max_length=256)), + ('category', models.CharField(choices=[('INCIRCLE', 'In Circle'), ('START', 'Start'), ('END', 'End')], default='INCIRCLE', max_length=16)), + ('circle', modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='learning_sequences', to='learnpath.circle')), + ], + options={ + 'verbose_name': 'Learning Sequence', + }, + ), + migrations.CreateModel( + name='Topic', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('title', models.TextField(default='')), + ('is_visible', models.BooleanField(default=True)), + ('learning_path', modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='topics', to='learnpath.learningpath')), + ], + options={ + 'verbose_name': 'Topic', + }, + ), + migrations.CreateModel( + name='LearningUnit', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('contents', wagtail.core.fields.StreamField([('web_based_training', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock())])), ('video', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock())]))], blank=True, null=True)), + ('learning_sequence', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='learning_units', to='learnpath.learningsequence')), + ], + options={ + 'verbose_name': 'Learning Unit', + }, + bases=('wagtailcore.page', models.Model), + ), + migrations.CreateModel( + name='FullfillmentCriteria', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=2048)), + ('competence', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='learnpath.competence')), + ], + options={ + 'verbose_name': 'Fullfillment Criteria', + }, + ), + migrations.AddField( + model_name='competence', + name='competence_page', + field=modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='competences', to='learnpath.competencepage'), + ), + migrations.AddField( + model_name='circle', + name='topic', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='circles', to='learnpath.topic'), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0002_fullfillmentcriteria_sort_order.py b/server/vbv_lernwelt/learnpath/migrations/0002_fullfillmentcriteria_sort_order.py new file mode 100644 index 00000000..5fe74a62 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0002_fullfillmentcriteria_sort_order.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2022-05-04 16:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='fullfillmentcriteria', + name='sort_order', + field=models.IntegerField(blank=True, editable=False, null=True), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0003_auto_20220512_1456.py b/server/vbv_lernwelt/learnpath/migrations/0003_auto_20220512_1456.py new file mode 100644 index 00000000..6e3dd602 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0003_auto_20220512_1456.py @@ -0,0 +1,36 @@ +# Generated by Django 3.2.12 on 2022-05-12 12:56 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0002_fullfillmentcriteria_sort_order'), + ] + + operations = [ + migrations.RemoveField( + model_name='learningunit', + name='learning_sequence', + ), + migrations.CreateModel( + name='LearningPackage', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('title', models.CharField(default='', max_length=256)), + ('learning_sequence', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='learning_packages', to='learnpath.learningsequence')), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + migrations.AddField( + model_name='learningunit', + name='learning_package', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='learning_units', to='learnpath.learningpackage'), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0004_alter_learningpackage_learning_sequence.py b/server/vbv_lernwelt/learnpath/migrations/0004_alter_learningpackage_learning_sequence.py new file mode 100644 index 00000000..fd4b51c7 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0004_alter_learningpackage_learning_sequence.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.12 on 2022-05-12 12:56 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0003_auto_20220512_1456'), + ] + + operations = [ + migrations.AlterField( + model_name='learningpackage', + name='learning_sequence', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='learning_packages', to='learnpath.learningsequence'), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0005_alter_learningunit_learning_package.py b/server/vbv_lernwelt/learnpath/migrations/0005_alter_learningunit_learning_package.py new file mode 100644 index 00000000..6a1128a7 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0005_alter_learningunit_learning_package.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.12 on 2022-05-12 12:56 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0004_alter_learningpackage_learning_sequence'), + ] + + operations = [ + migrations.AlterField( + model_name='learningunit', + name='learning_package', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='learning_units', to='learnpath.learningpackage'), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/__init__.py b/server/vbv_lernwelt/learnpath/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py new file mode 100644 index 00000000..179f72c2 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/models.py @@ -0,0 +1,264 @@ +# Create your models here. + +from django.utils.text import slugify +from wagtail.core.blocks import StreamBlock +from wagtail.core.fields import StreamField +from wagtail.core.models import Page, Orderable + +from vbv_lernwelt.learnpath.models_competences import * +from vbv_lernwelt.learnpath.models_learning_unit_content import WebBasedTrainingBlock, VideoBlock +from grapple.helpers import register_query_field +import graphene + +from grapple.models import ( + GraphQLString, GraphQLPage, + GraphQLStreamfield, GraphQLBoolean, GraphQLInt, GraphQLForeignKey, GraphQLField +) + + +@register_query_field("learning_path") +class LearningPath(Page): + # PageChooserPanel('related_page', 'demo.PublisherPage'), + + content_panels = Page.content_panels + [ + InlinePanel('topics', label="Topics"), + ] + + subpage_types = ['learnpath.Circle'] + + graphql_fields = [ + GraphQLString("title", required=True), + ] + + class Meta: + verbose_name = "Learning Path" + + def __str__(self): + return f"{self.title}" + + +class Topic(Orderable): + title = models.TextField(default='') + is_visible = models.BooleanField(default=True) + + learning_path = ParentalKey('learnpath.LearningPath', + null=True, + blank=True, + on_delete=models.CASCADE, + related_name='topics', + ) + + panels = [FieldPanel('title'), + FieldPanel('is_visible'), + ] + + graphql_fields = [ + GraphQLString("title"), + GraphQLBoolean("is_visible"), + ] + + # content_panels = Page.content_panels + [ + # FieldPanel('is_visible', classname="full"), + # PageChooserPanel('learning_path', 'learnpath.LearningPath'), + # ] + + # parent_page_types = ['learnpath.LearningPath'] + # subpage_types = ['learnpath.Circle'] + def full_clean(self, *args, **kwargs): + self.slug = find_available_slug(Topic, slugify(self.title, allow_unicode=True)) + super(Topic, self).full_clean(*args, **kwargs) + + class Meta: + verbose_name = "Topic" + + def __str__(self): + return f"{self.title}" + + +class Circle(Page, Orderable): + description = models.TextField(default="", blank=True) + goals = models.TextField(default="", blank=True) + topic = models.ForeignKey( + 'learnpath.Topic', + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name='circles' + ) + + parent_page_types = ['learnpath.Learningpath'] + subpage_types = ['learnpath.LearningUnit'] + + content_panels = Page.content_panels + [ + FieldPanel('description'), + FieldPanel('topic'), + FieldPanel('goals'), + InlinePanel('learning_sequences', label="Learning Sequences"), + ] + # + graphql_fields = [ + GraphQLString("title", required=True), + GraphQLString("description"), + GraphQLString("goals"), + ] + + + def full_clean(self, *args, **kwargs): + self.slug = find_available_slug(Circle, slugify(self.title, allow_unicode=True)) + super(Circle, self).full_clean(*args, **kwargs) + + class Meta: + verbose_name = "Circle" + + def __str__(self): + return f"{self.title}" + + +IN_CIRCLE = 'INCIRCLE' +START = 'START' +END = 'END' + +LEARNING_SEQUENCE_CATEGORIES = [ + (IN_CIRCLE, 'In Circle'), + (START, 'Start'), + (END, 'End') +] + + +class LearningSequence(Orderable): + # TODO: How to do a icon choice field? + title = models.CharField(max_length=256, default='') + category = models.CharField(max_length=16, choices=LEARNING_SEQUENCE_CATEGORIES, default=IN_CIRCLE) + + circle = ParentalKey( + 'learnpath.Circle', + null=True, + blank=True, + on_delete=models.CASCADE, + related_name='learning_sequences', + ) + + panels = [FieldPanel('title'), FieldPanel('category'), FieldPanel('circle')] + + + + graphql_fields = [ + GraphQLString("title", required=True), + GraphQLBoolean("category"), + ] + + + class Meta: + verbose_name = "Learning Sequence" + + def __str__(self): + return f"{self.title}" + + def full_clean(self, *args, **kwargs): + self.slug = find_available_slug(LearningSequence, slugify(self.title, allow_unicode=True)) + super(LearningSequence, self).full_clean(*args, **kwargs) + + + +class LearningPackage(Orderable): + title = models.CharField(max_length=256, default='') + + learning_sequence = models.ForeignKey( + 'learnpath.LearningSequence', + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name='learning_packages', + ) + panels = [FieldPanel('title')] + + graphql_fields = [ + GraphQLString("title", required=False), + ] + + + def full_clean(self, *args, **kwargs): + self.slug = find_available_slug(LearningPackage, slugify(self.title, allow_unicode=True)) + super(LearningPackage, self).full_clean(*args, **kwargs) + + +class LearningUnit(Page, Orderable): + """ + This is a group of contents, with the übung and test it is one unit. ... more of a structural charactacter. + + """ + # TODO: Review model architecture, is the stream field the right thing here? + parent_page_types = ['learnpath.Circle'] + learning_package = models.ForeignKey( + 'learnpath.LearningPackage', + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name='learning_units', + ) + + content_blocks = [ + ('web_based_training', WebBasedTrainingBlock()), + ('video', VideoBlock()), + ] + + contents = StreamField(StreamBlock(content_blocks), + null=True, blank=True, min_num=1, max_num=1) + + content_panels = [ + FieldPanel('title', classname="full title"), + FieldPanel('learning_package'), + StreamFieldPanel('contents'), + ] + + graphql_fields = [ + GraphQLString("title", required=True), + GraphQLStreamfield('contents') + ] + + subpage_types = [] + + class Meta: + verbose_name = "Learning Unit" + + def full_clean(self, *args, **kwargs): + self.slug = find_available_slug(LearningUnit, slugify(self.title, allow_unicode=True)) + super(LearningUnit, self).full_clean(*args, **kwargs) + + def __str__(self): + return f"{self.title}" + + + +def find_available_slug(model, requested_slug, ignore_page_id=None): + """ + Finds an available slug within the specified parent. + + If the requested slug is not available, this adds a number on the end, for example: + + - 'requested-slug' + - 'requested-slug-1' + - 'requested-slug-2' + + And so on, until an available slug is found. + + The `ignore_page_id` keyword argument is useful for when you are updating a page, + you can pass the page being updated here so the page's current slug is not + treated as in use by another page. + """ + + # TODO: In comparison ot wagtails own function, I look for the same model instead of the parent + pages = model.objects.filter(slug__startswith=requested_slug) + + if ignore_page_id: + pages = pages.exclude(id=ignore_page_id) + + existing_slugs = set(pages.values_list("slug", flat=True)) + slug = requested_slug + number = 1 + + while slug in existing_slugs: + slug = requested_slug + "-" + str(number) + number += 1 + + return slug diff --git a/server/vbv_lernwelt/learnpath/models_competences.py b/server/vbv_lernwelt/learnpath/models_competences.py new file mode 100644 index 00000000..f7d70107 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/models_competences.py @@ -0,0 +1,66 @@ +from django.db import models +from wagtail.core.models import Page, Orderable +from modelcluster.fields import ParentalKey +from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel + + +class CompetencePage(Page): + """This is the page where the competences and Fullfillment criterias are manged + For one Learning Path""" + + + content_panels = Page.content_panels + [ + InlinePanel('competences', label="Competences"), + ] + + subpage_types = ['learnpath.Circle'] + + parent_page_types = ['learnpath.LearningPath'] + + + class Meta: + verbose_name = "Learning Path" + + def __str__(self): + return f"{self.title}" + + +class Competence(Orderable): + """ In VBV Terms this is a "Handlungskompetenz""" + category_short = models.CharField(max_length=3, default='') + name = models.CharField(max_length=2048) + + + competence_page = ParentalKey('learnpath.CompetencePage', + null=True, + blank=True, + on_delete=models.CASCADE, + related_name='competences', + ) + + + + def get_short_info(self): + return f"{self.category_short}{self.sort_order}" + + def __str__(self): + return f"{self.get_short_info()}: {self.name}" + + + class Meta: + verbose_name = "Competence" + + +class FullfillmentCriteria(Orderable): + """ VBV Term Leistungskriterium""" + name = models.CharField(max_length=2048) + competence = models.ForeignKey(Competence, on_delete=models.CASCADE, null=True) + + def get_short_info(self): + return f"{self.competence.get_short_info()}.{self.sort_order}" + + def __str__(self): + return f"{self.get_short_info()}: {self.name}" + + class Meta: + verbose_name = "Fullfillment Criteria" diff --git a/server/vbv_lernwelt/learnpath/models_learning_unit_content.py b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py new file mode 100644 index 00000000..9a1277e7 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py @@ -0,0 +1,41 @@ +from django.db import models +from wagtail.core import blocks + + +# 'video_block' +class VideoBlock(blocks.StructBlock): + # TODO: Possible video Types for the user, upload file, add URL + title = models.CharField(max_length=128, default="") + description = models.TextField(default="") + url = blocks.URLBlock() + + class Meta: + icon = 'media' + + + +# 'Web based training Block' +class WebBasedTrainingBlock(blocks.StructBlock): + RISE = 'rise' + + WBT_TYPE_CHOICES = ( + (RISE, 'Rise'), + ) + + url = blocks.URLBlock() + type = models.CharField( + max_length=100, + choices=WBT_TYPE_CHOICES, + default=RISE + ) + + class Meta: + icon = 'media' + +# 'Transver Task' +class TranverTaskBlock(blocks.StructBlock): + title = models.CharField(max_length=128, default="") + description = models.TextField(default="") + + class Meta: + icon = 'media' diff --git a/server/vbv_lernwelt/learnpath/tests/__init__.py b/server/vbv_lernwelt/learnpath/tests/__init__.py new file mode 100644 index 00000000..33212a11 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/__init__.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# +# Iterativ GmbH +# http://www.iterativ.ch/ +# +# Copyright (c) 2015 Iterativ GmbH. All rights reserved. +# +# Created on 2022-03-29 +# @author: lorenz.padberg@iterativ.ch diff --git a/server/vbv_lernwelt/learnpath/tests/competences.json b/server/vbv_lernwelt/learnpath/tests/competences.json new file mode 100644 index 00000000..b50e04e5 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/competences.json @@ -0,0 +1,78 @@ +{ + "competences": [ + { + "name": "Weiterempfehlung für Neukunden generieren", + "category_short": "A", + "fullfillment_criteria": [ + { + "name": "bestehende Kunden so zu beraten, dass sie von diesen weiterempfohlen werden" + }, + { + "name": "geeignete Personen wie z.B. Garagisten, Architekten, Treuhänder auf die Vermittlung/Zusammenarbeit anzusprechen" + }, + { + "name": "verschiedene Datenquellen wie Internet, Telefonbuch, Handelszeitung, Baugesuche etc. gezielt für die Gewinnung von Neukunden zu benützen" + }, + { + "name": "ein beliebiges Gespräch resp. einen bestehenden Kontakt in die Richtung «Versicherung» zu lenken" + }, + { + "name": "das Thema Risiko und Sicherheit in einem Gespräch gezielt und auf die Situation des jeweiligen Gesprächspartners bezogen einfliessen zu lassen" + }, + { + "name": "im täglichen Kontakt potentielle Kundinnen und Kunden zu erkennen" + } + ] + }, + { + "name": "Kundengespräche vereinbaren", + "category_short": "A", + "fullfillment_criteria": [ + { + "name": "je nach (Neu-) Kunde Form und Ort für das Gespräch festzulegen" + }, + { + "name": "sich intern und extern die nötigen Informationen über den (Neu-) Kunde zu beschaffen" + }, + { + "name": "die Terminierung auf ein bestimmtes Thema wie z.B. Rechtsschutz, Vorsorge, Krankenversicherung etc. auszurichten" + }, + { + "name": "für das zu führende Gespräch eine Agenda zu erstellen" + }, + { + "name": "für das zu führende Gespräch geeignete Hilfsmittel und Unterlagen zusammenzustellen" + }, { + "name": "eine Kaltakquise durchzuführen und auf mögliche Einwände reagieren zu können" + } +] + + }, + { + "name": "Auftritt in den sozialen Medien zeitgemäss halten", + "category_short": "A", + "fullfillment_criteria": [ { + "name": "in Zusammenarbeit mit den IT-Spezialisten und der Marketingabteilung die Inhalte für den zu realisierenden Medienauftritt zielgruppengerecht festzulegen" + }, + { + "name": "für die verschiedenen Kundensegmente die passenden sozialen Medien zu definieren" + }, + { + "name": "die Inhalte compliant zu halten" + } + ] + }, + { + "name": "Kundendaten erfassen", + "category_short": "A", + "fullfillment_criteria": [] + }, + { + "name": "Wünsche, Ziele und Bedürfnisse der Kunden im Gespräch ermitteln", + "category_short": "B", + "fullfillment_criteria": [] + } + ] +} + + diff --git a/server/vbv_lernwelt/learnpath/tests/competences_factories.py b/server/vbv_lernwelt/learnpath/tests/competences_factories.py new file mode 100644 index 00000000..6a043add --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/competences_factories.py @@ -0,0 +1,30 @@ +import factory +import wagtail_factories + +from vbv_lernwelt.learnpath.models_competences import Competence, FullfillmentCriteria, CompetencePage +from vbv_lernwelt.learnpath.tests.learningpath_factories import LearningPathFactory + + +class CompetencePageFactory(wagtail_factories.PageFactory): + # learning_path = factory.SubFactory(LearningPathFactory) + + class Meta: + model = CompetencePage + + +class CompetenceFactory(factory.django.DjangoModelFactory): + category_short = 'A' + name = "Weiterempfehung für neukunden generieren" + competence_page = factory.SubFactory(CompetencePageFactory) + + class Meta: + model = Competence + + +class FullfilmentCriteriaFactory(factory.django.DjangoModelFactory): + name = 'Bestehende Kunden so zu beraten, dass sie von diesen weiterempfohlen werden' + competence = factory.SubFactory(CompetenceFactory) + + class Meta: + model = FullfillmentCriteria + diff --git a/server/vbv_lernwelt/learnpath/tests/create_default_competences.py b/server/vbv_lernwelt/learnpath/tests/create_default_competences.py new file mode 100644 index 00000000..9a8716ae --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/create_default_competences.py @@ -0,0 +1,23 @@ +import json + + +import os.path + +from vbv_lernwelt.learnpath.tests.competences_factories import CompetenceFactory, FullfilmentCriteriaFactory + +competences_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'competences.json') + + +def create_default_competences(competences_json=competences_file): + with open(competences_json) as f: + competences_json = json.load(f) + + for index, compentence in enumerate(competences_json['competences']): + + competence_model = CompetenceFactory(name=compentence['name'], category_short=compentence['category_short'], sort_order=index) + print(competence_model) + + for criteria_index, criteria in enumerate(compentence['fullfillment_criteria']): + criteria_model = FullfilmentCriteriaFactory(name=criteria['name'], competence=competence_model, sort_order=criteria_index) + print(criteria_model) + diff --git a/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py new file mode 100644 index 00000000..f9e84e86 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py @@ -0,0 +1,167 @@ +import wagtail_factories +from wagtail.core.models import Site + +from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit +from vbv_lernwelt.learnpath.tests.create_default_competences import create_default_competences +from vbv_lernwelt.learnpath.tests.learningpath_factories import LearningPathFactory, TopicFactory, CircleFactory, \ + LearningSequenceFactory, LearningUnitFactory, VideoBlockFactory, WebBasedTrainingBlockFactory, LearningPackageFactory + + +def create_default_learning_path(): + site = Site.objects.filter(is_default_site=True).first() + + if not site: + site = wagtail_factories.SiteFactory(is_default_site=True) + + create_default_competences() + + lp = LearningPathFactory(title="Versicherungsvermittler/in", parent=site.root_page) + + tp = TopicFactory(title="Basis", is_visible=False, learning_path=lp) + + circle_1 = CircleFactory(title="Basis", parent=lp, topic=tp, description="""In diesem Circle erklären wir dir, wie der Lehrgang + Versicherungsvermittler / in " aufgebaut ist. Zudem vermitteln wir dir die wichtigsten Grundlagen, + damit erfolgreich mit deinem Lernpfad starten kannst.""") + + ls_1 = LearningSequenceFactory(title='Einleitung', circle=circle_1) + + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=ls_1) + + lu_1 = LearningUnitFactory(title="Herzlich Willkommmen", parent=circle_1, learning_package=lpck_1) + lu_1 = LearningUnitFactory(title="Herzlich Willkommmen 1", parent=circle_1, learning_package=lpck_1) + lu_1 = LearningUnitFactory(title="Herzlich Willkommmen 2", parent=circle_1, learning_package=lpck_1) + + ls_2 = LearningSequenceFactory(title='Grundlagen', circle=circle_1) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=ls_2) + + lu_1 = LearningUnitFactory(title="Aber jetzt, Butter bei die Fische", parent=circle_1, learning_package=lpck_1) + + tp = TopicFactory(title="Gewinnen von Kunden", learning_path=lp) + + circle_2 = CircleFactory(title="Gewinnen", parent=lp, description="""Versicherungsvermittlerinnen und -vermittler verfügen über +ein starkes Netzwerk, das sie gezielt pflegen und ausbauen. Sie beraten und betreuen ihre bestehenden Kundinnen und Kunden professionell und gewinnen so ihr Vertrauen. Dadurch schaffen sie die Basis für das Gewinnen +von neuen Kundinnen und Kunden. Versicherungsvermittlerinnen und -vermittler sprechen ihre bestehenden Kundinnen +und Kunden auf Weiterempfehlung an. So nutzen sie ihre +bestehenden Kontakte geschickt für das Anwerben von +Neukundinnen und -kunden. + """, goals="""— Bestehende Kunden so zu beraten, dass +sie von diesen weiterempfohlen werden +— Geeignete Personen wie z.B. Garagisten, Architekten, Treuhänder auf die +Vermittlung/Zusammenarbeit anzusprechen +— Verschiedene Datenquellen wie Internet, Telefonbuch, Handelszeitung, Baugesuche etc. Gezielt für die Gewinnung +von Neukunden zu benützen +— Ein beliebiges Gespräch resp. Einen bestehenden Kontakt in die Richtung +«Versicherung» zu lenken +— Das Thema Risiko und Sicherheit in einem Gespräch gezielt und auf die Situation des jeweiligen Gesprächspartners bezogen einfliessen zu lassen +— Im täglichen Kontakt potenzielle Kundinnen und Kunden zu erkennen""") + + tp = TopicFactory(title="Beraten der Kunden", learning_path=lp) + circle_3 = CircleFactory(title="Einstieg", parent=lp, topic=tp) + circle_4 = CircleFactory(title="Analyse", parent=lp, topic=tp, + description="""Nach dem Gespräch werten sie die Analyse aus und erstellen mit den + zur Verfügung stehenden Systemen formal korrekte Lösungsvorschläge bzw. + Ausschreibungen. Je nach Komplexität der Situation ziehen sie die nötigen + Fachspezialisten bei.""", + goals=""" + — Aus dem IST-Zustand (aus der durchgeführten Analyse) individuelle, risikogewichtete und finanzierbare Lösungsvorschläge zu erarbeiten + — Eine Unterversicherung, eine Doppeloder Überversicherung oder einen fehlenden Versicherungsschutz festzustellen + — Mögliches Optimierungspotential unter Berücksichtigung der finanziellen + Situation des Kunden zu erkennen + — Lösungsvorschläge zu skizzieren und + zu visualisieren""") + + sequence_1 = LearningSequenceFactory(title="Starten", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_1) + + learning_unit = LearningUnitFactory(title='Einleitung Circle "Anlayse"', parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title='** Einstieg Video"', parent=circle_4, learning_package=lpck_1) + video_url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4" + video_title = "Ausbildung ist pflicht" + video_description = "Erfahren Sie, was für Janos Mischler die positiven Aspekte von ständiger Weiterbildung sind – aus fachlicher und aus persönlicher Sicht." + video_block = VideoBlockFactory(type="video", url=video_url, title=video_title, description=video_description) + learning_unit.contents.append(('video', video_block)) + learning_unit.save() + + learning_unit = LearningUnitFactory.create(title='** Web Based Training"', parent=circle_4, learning_package=lpck_1) + wbt_url = "web_based_trainings/rise_cmi5_test_export/scormcontent/index.html" + wbt_block = WebBasedTrainingBlockFactory(type="web_based_training", url=wbt_url) + learning_unit.contents.append(('web_based_training', wbt_block)) + learning_unit.save() + + learning_unit = LearningUnitFactory.create(title="Selbsteinschätzung", parent=circle_4, learning_package=lpck_1) + + sequence_2 = LearningSequenceFactory.create(title="Beobachten", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_2) + + learning_unit = LearningUnitFactory.create(title="Mein Motorfahrzeug kaufen", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="Sich selbständig machen", parent=circle_4, learning_package=lpck_1) + + sequence_3 = LearningSequenceFactory.create(title="Anwenden", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_3) + + learning_unit = LearningUnitFactory.create(title="Nora kauft sich ein neues Auto", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="Manuel träumt von einem neuen Tesla", parent=circle_4, learning_package=lpck_1) + + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_3) + + learning_unit = LearningUnitFactory.create(title="Deine Erkenntnisse und Learnings", parent=circle_4, learning_package=lpck_1) + + sequence_4 = LearningSequenceFactory.create(title="Üben", circle=circle_4) + + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_4) + learning_unit = LearningUnitFactory.create(title="Ermittlung des Kundenbedarfs", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="Aktives Zuhören", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="In Bildern Sprechen", parent=circle_4, learning_package=lpck_1) + + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_4) + learning_unit = LearningUnitFactory.create(title="Priorisieren des Bedarfs", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="Zusammenfassung des Bedarfs", parent=circle_4, learning_package=lpck_1) + + sequence_5 = LearningSequenceFactory.create(title="Testen", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_5) + + learning_unit = LearningUnitFactory.create(title="Bedarfsfragen", parent=circle_4, learning_package=lpck_1) + learning_unit = LearningUnitFactory.create(title="Andwendung der Fragetechniken", parent=circle_4, learning_package=lpck_1) + + sequence_5 = LearningSequenceFactory.create(title="Vernetzen", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_5) + + learning_unit = LearningUnitFactory.create(title="Online Training", parent=circle_4, learning_package=lpck_1) + + sequence_6 = LearningSequenceFactory.create(title="Beenden", circle=circle_4) + lpck_1 = LearningPackageFactory(title="Wunderbar !", learning_sequence=sequence_6) + + learning_unit = LearningUnitFactory.create(title="Selbsteinschätzung", parent=circle_4, learning_package=lpck_1) + + circle_5 = CircleFactory.create(title="Lösung", + parent=lp, + topic=tp, + goals="""— Die Daten des Kunden korrekt in die notwendigen Systeme einzutragen + — Fachspezialisten beizuziehen, falls dies angezeigt ist + — Mit den zur Verfügung stehenden Systemen korrekte Lösungsvorschläge + (z.B. Offerten oder Ausschreibungen) zu verfassen + — Falls nötig die Lösungsvorschläge dem Underwriting weiterzuleiten und + Unklarheiten zu bereinigen """) + + circle_6 = CircleFactory.create(title="Abschluss", + parent=lp, + topic=tp, + goals="""— Je nach Komplexität der Lösungsvorschläge (z.B. Offerten oder Offertvergleich) einen Fachspezialisten aufzubieten + — Sich kundenorientiert auf das Gespräch vorzubereiten und sich passend zu präsentieren""") + + tp = TopicFactory.create(title="Betreuen und Ausbauen des Kundenstamms", learning_path=lp) + circle_7 = CircleFactory.create(title="Betreuen", parent=lp, topic=tp) + + tp = TopicFactory.create(title="Prüfung", is_visible=False, learning_path=lp) + circle_7 = CircleFactory.create(title="Prüfungsvorbereitung", parent=lp, topic=tp) + + + + + +def delete_default_learning_path(): + LearningUnit.objects.all().delete() + LearningSequence.objects.all().delete() + Circle.objects.all().delete() + Topic.objects.all().delete() + LearningPath.objects.all().delete() diff --git a/server/vbv_lernwelt/learnpath/tests/grapple_test.http b/server/vbv_lernwelt/learnpath/tests/grapple_test.http new file mode 100644 index 00000000..883b9d03 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/grapple_test.http @@ -0,0 +1,20 @@ +GET http://localhost:8000/graphql/ +Accept: application/json + +### +{ + page(id: 8) { + + children { + __typename + id + title + children { + __typename + + id + title + } + } + } +} diff --git a/server/vbv_lernwelt/learnpath/tests/grapple_test.txt b/server/vbv_lernwelt/learnpath/tests/grapple_test.txt new file mode 100644 index 00000000..51917e32 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/grapple_test.txt @@ -0,0 +1,17 @@ +{ + page(id: 8) { + + children { + __typename + id + title + children { + __typename + + id + title + } + } + } +} + diff --git a/server/vbv_lernwelt/learnpath/tests/learningpath_factories.py b/server/vbv_lernwelt/learnpath/tests/learningpath_factories.py new file mode 100644 index 00000000..3e9ff9c8 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/learningpath_factories.py @@ -0,0 +1,62 @@ +import wagtail_factories +import factory +from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit, LearningPackage +from vbv_lernwelt.learnpath.models_learning_unit_content import VideoBlock, WebBasedTrainingBlock + + +class LearningPathFactory(wagtail_factories.PageFactory): + title = "Versicherungsvermittler/in" + + class Meta: + model = LearningPath + + +class TopicFactory(factory.django.DjangoModelFactory): + title = "Gewinnen von Kunden" + is_visible = True + + class Meta: + model = Topic + + +class CircleFactory(wagtail_factories.PageFactory): + title = "Gewinnen" + + class Meta: + model = Circle + + +class LearningSequenceFactory(factory.django.DjangoModelFactory): + title = "Grundlagen" + + class Meta: + model = LearningSequence + +class LearningPackageFactory(factory.django.DjangoModelFactory): + title = "Whatever" + + class Meta: + model = LearningPackage + + +class LearningUnitFactory(wagtail_factories.PageFactory): + title = "Herzlich Willkommen" + + class Meta: + model = LearningUnit + + +class VideoBlockFactory(wagtail_factories.StructBlockFactory): + title = "Ausbildung ist Pflicht" + url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4" + + class Meta: + model = VideoBlock + +class WebBasedTrainingBlockFactory(wagtail_factories.StructBlockFactory): + title = "Beispiel Rise Modul" + url = "https://docs.wagtail.org/en/stable/topics/streamfield.html" + + class Meta: + model = WebBasedTrainingBlock + diff --git a/server/vbv_lernwelt/learnpath/tests/test_competences_factories.py b/server/vbv_lernwelt/learnpath/tests/test_competences_factories.py new file mode 100644 index 00000000..baf72c70 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/test_competences_factories.py @@ -0,0 +1,18 @@ +from django.test import TestCase + +from vbv_lernwelt.learnpath.models_competences import Competence, FullfillmentCriteria +from vbv_lernwelt.learnpath.tests.competences_factories import CompetencePageFactory, CompetenceFactory, \ + FullfilmentCriteriaFactory + + +class TestCompetencesFactories(TestCase): + def test_create_competences_page(self): + CompetencePageFactory() + + def test_create_competence(self): + CompetenceFactory(name='Boogie Woogie') + self.assertEqual(Competence.objects.filter(name='Boogie Woogie').count(), 1) + + def test_create_fullfillment_criteria(self): + FullfilmentCriteriaFactory(name='shuffle like ...') + self.assertEqual(FullfillmentCriteria.objects.filter(name='shuffle like ...').count(), 1) diff --git a/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py b/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py new file mode 100644 index 00000000..714dc179 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py @@ -0,0 +1,13 @@ +from django.conf import settings +from django.test import TestCase +from wagtail.core.models import Locale + +from vbv_lernwelt.learnpath.models import LearningPath +from vbv_lernwelt.learnpath.tests.create_default_competences import create_default_competences +from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path + + +class TestCreateDefaultCompetences(TestCase): + def test_create_default_competeneces(self): + create_default_competences() + diff --git a/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py b/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py new file mode 100644 index 00000000..bbe0be8f --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py @@ -0,0 +1,21 @@ +from django.conf import settings +from django.test import TestCase +from wagtail.core.models import Locale + +from vbv_lernwelt.learnpath.models import LearningPath +from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path + + +class TestCreateDefaultLearningPaths(TestCase): + def setUp(self) -> None: + create_locales_for_wagtail() + + def test_create_learning_path(self): + create_default_learning_path() + qs = LearningPath.objects.filter(title="Versicherungsvermittler/in") + self.assertTrue(qs.exists()) + + +def create_locales_for_wagtail(): + for language in settings.WAGTAIL_CONTENT_LANGUAGES: + Locale.objects.get_or_create(language_code=language[0]) diff --git a/server/vbv_lernwelt/learnpath/tests/test_factories.py b/server/vbv_lernwelt/learnpath/tests/test_factories.py new file mode 100644 index 00000000..33212a11 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/tests/test_factories.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# +# Iterativ GmbH +# http://www.iterativ.ch/ +# +# Copyright (c) 2015 Iterativ GmbH. All rights reserved. +# +# Created on 2022-03-29 +# @author: lorenz.padberg@iterativ.ch diff --git a/server/vbv_lernwelt/learnpath/views.py b/server/vbv_lernwelt/learnpath/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/cmi5.xml b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/cmi5.xml new file mode 100644 index 00000000..3ef0b6cd --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/cmi5.xml @@ -0,0 +1,108 @@ + + + + + <langstring lang="en-US">Export - Testmodul</langstring> + + + <strong><span style="color: rgb(0, 0, 0);">Herzlich willkommen!&nbsp;</span></strong><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 0);">In dieser Lernsequenz zeigt dir ein Fachexperte anhand von Kundensituationen, wie du erfolgreich den <strong>Kundenbedarf&nbsp;</strong><strong>ermitteln</strong>, <strong>analysieren, priorisieren&nbsp;</strong>und anschliessend<strong>&nbsp;zusammenfassen&nbsp;</strong>kannst.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">Zudem erh&auml;ltst du wertvolle <strong>Werkzeuge&nbsp;</strong>und<strong>&nbsp;Hilfsmittel</strong>, die du im Gespr&auml;ch einsetzen kannst.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">In den einzelnen Lektionen findest du ferner Hinweise und Empfehlungen, welches <strong>Versicherungsfachwissen&nbsp;</strong>du in diesen<strong>&nbsp;Kundensituationen</strong> ben&ouml;tigst.</span><br><span style="color: rgb(0, 0, 0);">Die Bearbeitungszeit dieser Lernsequenz dauert&nbsp;</span><span style="color: rgb(228, 79, 59);">xy&nbsp;</span><span style="color: rgb(0, 0, 0);">min.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">Die Lektionen k&ouml;nnen auch einzelnen bearbeitet werden.</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 0);"><strong>Viel Erfolg!</strong></span><span style="color: rgb(228, 79, 59);"><strong>&nbsp;</strong></span><br> + + + + + + <langstring lang="en-US"> + Einstieg + </langstring> + + + + + + + + + + <langstring lang="en-US"> + Bei Kunden auf Besuch + </langstring> + + + + + + + + + + <langstring lang="en-US"> + Bedarfsbogen einsetzen + </langstring> + + + + + + + + + + <langstring lang="en-US"> + Bedarfsbogen auswerten + </langstring> + + + + + + + + + + <langstring lang="en-US"> + Deine Erkenntnisse und Learnings + </langstring> + + + + + + + + + + <langstring lang="en-US"> + Quizz - zum Testen + </langstring> + + + + Hallo ,dies ist nur ein kurzer Test zum ausprobieren. + + + + + + + + <langstring lang="en"> + Export - Testmodul + </langstring> + + + + <strong><span style="color: rgb(0, 0, 0);">Herzlich willkommen!&nbsp;</span></strong><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 0);">In dieser Lernsequenz zeigt dir ein Fachexperte anhand von Kundensituationen, wie du erfolgreich den <strong>Kundenbedarf&nbsp;</strong><strong>ermitteln</strong>, <strong>analysieren, priorisieren&nbsp;</strong>und anschliessend<strong>&nbsp;zusammenfassen&nbsp;</strong>kannst.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">Zudem erh&auml;ltst du wertvolle <strong>Werkzeuge&nbsp;</strong>und<strong>&nbsp;Hilfsmittel</strong>, die du im Gespr&auml;ch einsetzen kannst.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">In den einzelnen Lektionen findest du ferner Hinweise und Empfehlungen, welches <strong>Versicherungsfachwissen&nbsp;</strong>du in diesen<strong>&nbsp;Kundensituationen</strong> ben&ouml;tigst.</span><br><span style="color: rgb(0, 0, 0);">Die Bearbeitungszeit dieser Lernsequenz dauert&nbsp;</span><span style="color: rgb(228, 79, 59);">xy&nbsp;</span><span style="color: rgb(0, 0, 0);">min.&nbsp;</span><br><span style="color: rgb(0, 0, 0);">Die Lektionen k&ouml;nnen auch einzelnen bearbeitet werden.</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 0, 0);"><strong>Viel Erfolg!</strong></span><span style="color: rgb(228, 79, 59);"><strong>&nbsp;</strong></span><br> + + + + + + + + + + + scormdriver/indexAPI.html + eyJjcHYiOiJndktDa0RlayIsInJsZCI6ZmFsc2V9 + + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/-FobIzQRznpsuBDj_G6VHy59HMsko0_jY.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/-FobIzQRznpsuBDj_G6VHy59HMsko0_jY.jpg new file mode 100644 index 00000000..c8b8d4c7 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/-FobIzQRznpsuBDj_G6VHy59HMsko0_jY.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/38WeyOn4aXeeMTsF_uhPnEnvkA7vtN-ku-Fragekatalog Bedarfsanalyse.docx b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/38WeyOn4aXeeMTsF_uhPnEnvkA7vtN-ku-Fragekatalog Bedarfsanalyse.docx new file mode 100644 index 00000000..682c09ad Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/38WeyOn4aXeeMTsF_uhPnEnvkA7vtN-ku-Fragekatalog Bedarfsanalyse.docx differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/5r70KfY_uIErb71U_7jwPYmCyXj8yPvoA.png b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/5r70KfY_uIErb71U_7jwPYmCyXj8yPvoA.png new file mode 100644 index 00000000..d12aaff9 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/5r70KfY_uIErb71U_7jwPYmCyXj8yPvoA.png differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/6rUTAHdZDQnQmkTS_vaP9klcmmXWStt2G.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/6rUTAHdZDQnQmkTS_vaP9klcmmXWStt2G.jpg new file mode 100644 index 00000000..55196b1d Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/6rUTAHdZDQnQmkTS_vaP9klcmmXWStt2G.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/AYpR2qpIrJu6De_w_iK2yl5xnsyxptqeX.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/AYpR2qpIrJu6De_w_iK2yl5xnsyxptqeX.jpg new file mode 100644 index 00000000..53bbcfa0 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/AYpR2qpIrJu6De_w_iK2yl5xnsyxptqeX.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/D3hY9adLT-lxWjiM_coastline_poster.png b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/D3hY9adLT-lxWjiM_coastline_poster.png new file mode 100644 index 00000000..8a264abb Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/D3hY9adLT-lxWjiM_coastline_poster.png differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Gsbz3VDtAbEjZKX2_aBgrHYRD-pjnnRcf-Bedarfsbogen Privatpersonen.docx b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Gsbz3VDtAbEjZKX2_aBgrHYRD-pjnnRcf-Bedarfsbogen Privatpersonen.docx new file mode 100644 index 00000000..7fc35081 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Gsbz3VDtAbEjZKX2_aBgrHYRD-pjnnRcf-Bedarfsbogen Privatpersonen.docx differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/IjYQHJpLjRfozN2W_VVS5SZadhglX1Fax.png b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/IjYQHJpLjRfozN2W_VVS5SZadhglX1Fax.png new file mode 100644 index 00000000..2b03b759 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/IjYQHJpLjRfozN2W_VVS5SZadhglX1Fax.png differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/LkqfmG0x6I8XDu-j_qcTLe2e05W3UPFtv.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/LkqfmG0x6I8XDu-j_qcTLe2e05W3UPFtv.jpg new file mode 100644 index 00000000..2e26d8aa Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/LkqfmG0x6I8XDu-j_qcTLe2e05W3UPFtv.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/MkjaZCncYtzflvCV_6OWUEFt6AIEIXtTt.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/MkjaZCncYtzflvCV_6OWUEFt6AIEIXtTt.jpg new file mode 100644 index 00000000..4ea61535 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/MkjaZCncYtzflvCV_6OWUEFt6AIEIXtTt.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Os9FrKsN3bJ2rUWn__XtO5Yf8z2_sPghS.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Os9FrKsN3bJ2rUWn__XtO5Yf8z2_sPghS.jpg new file mode 100644 index 00000000..050bdc37 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Os9FrKsN3bJ2rUWn__XtO5Yf8z2_sPghS.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/QggmAkqZY05lwfYN_MdERDiVl_t7FOAAJ.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/QggmAkqZY05lwfYN_MdERDiVl_t7FOAAJ.jpg new file mode 100644 index 00000000..050bdc37 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/QggmAkqZY05lwfYN_MdERDiVl_t7FOAAJ.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/R8ZJrjASd6FFvjKk_coastline.mp4 b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/R8ZJrjASd6FFvjKk_coastline.mp4 new file mode 100644 index 00000000..41b3e44d Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/R8ZJrjASd6FFvjKk_coastline.mp4 differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/RCwqmOjrKOAczSnv_k34pX6vBsnI8iosm.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/RCwqmOjrKOAczSnv_k34pX6vBsnI8iosm.jpg new file mode 100644 index 00000000..5c0ee046 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/RCwqmOjrKOAczSnv_k34pX6vBsnI8iosm.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/T9Pfh1ie9ztxhOzJ_DFtRcOBsv4EoXYO2.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/T9Pfh1ie9ztxhOzJ_DFtRcOBsv4EoXYO2.jpg new file mode 100644 index 00000000..cc7728d2 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/T9Pfh1ie9ztxhOzJ_DFtRcOBsv4EoXYO2.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/XqNGoIoHFgML1LG2_quote_background.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/XqNGoIoHFgML1LG2_quote_background.jpg new file mode 100644 index 00000000..4c96b23a Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/XqNGoIoHFgML1LG2_quote_background.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Y9P9XXiQacKpxPTk_IYKBEa7NIkt3vobK.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Y9P9XXiQacKpxPTk_IYKBEa7NIkt3vobK.jpg new file mode 100644 index 00000000..9d1230c1 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Y9P9XXiQacKpxPTk_IYKBEa7NIkt3vobK.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Yo8zkAymUmuzQcv1_gyK4kJSzNR3VP4_w.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Yo8zkAymUmuzQcv1_gyK4kJSzNR3VP4_w.jpg new file mode 100644 index 00000000..ca6e3238 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/Yo8zkAymUmuzQcv1_gyK4kJSzNR3VP4_w.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/aFadEOSHb4kUzwRB_avatar.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/aFadEOSHb4kUzwRB_avatar.jpg new file mode 100644 index 00000000..909e4071 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/aFadEOSHb4kUzwRB_avatar.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/adDGDt-xxT74ecOj_orUSC5P395F9bKh8.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/adDGDt-xxT74ecOj_orUSC5P395F9bKh8.jpg new file mode 100644 index 00000000..81245357 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/adDGDt-xxT74ecOj_orUSC5P395F9bKh8.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/bOvf3AVdlrXaSG5e_XhOSbsLTDZTtxwrw.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/bOvf3AVdlrXaSG5e_XhOSbsLTDZTtxwrw.jpg new file mode 100644 index 00000000..17f9b4bc Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/bOvf3AVdlrXaSG5e_XhOSbsLTDZTtxwrw.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c5yl1IiL_U9wZ764_vDuFrUktsYzUnJd1.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c5yl1IiL_U9wZ764_vDuFrUktsYzUnJd1.jpg new file mode 100644 index 00000000..ff925268 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c5yl1IiL_U9wZ764_vDuFrUktsYzUnJd1.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c66UaOwUsQBDVmK7_W2GZFQ3gsLU1RaUB-Beobachtungsbogen Kundenberater.docx b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c66UaOwUsQBDVmK7_W2GZFQ3gsLU1RaUB-Beobachtungsbogen Kundenberater.docx new file mode 100644 index 00000000..ac668cf6 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/c66UaOwUsQBDVmK7_W2GZFQ3gsLU1RaUB-Beobachtungsbogen Kundenberater.docx differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cGNFqMiQcrMfbX6N_SuhjGYNNVBasvaWa.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cGNFqMiQcrMfbX6N_SuhjGYNNVBasvaWa.jpg new file mode 100644 index 00000000..81245357 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cGNFqMiQcrMfbX6N_SuhjGYNNVBasvaWa.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cmVkqykEL340AfN8_OywKVWsqNrf0fVHd.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cmVkqykEL340AfN8_OywKVWsqNrf0fVHd.jpg new file mode 100644 index 00000000..55ce6b04 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/cmVkqykEL340AfN8_OywKVWsqNrf0fVHd.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/etcIZ0UoFc9Th-sK_KfcWBV6VfwhUJLwX.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/etcIZ0UoFc9Th-sK_KfcWBV6VfwhUJLwX.jpg new file mode 100644 index 00000000..3861d2b9 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/etcIZ0UoFc9Th-sK_KfcWBV6VfwhUJLwX.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/kbASqOm3P5yHRtNf_mountains.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/kbASqOm3P5yHRtNf_mountains.jpg new file mode 100644 index 00000000..96eb7461 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/kbASqOm3P5yHRtNf_mountains.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/lKjp2uugHyRLfDRn_gT3-6dI1LEkIvbJJ.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/lKjp2uugHyRLfDRn_gT3-6dI1LEkIvbJJ.jpg new file mode 100644 index 00000000..a2abac2a Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/lKjp2uugHyRLfDRn_gT3-6dI1LEkIvbJJ.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/ph1r2WsusfVv4jNQ_XQfB-dx2gs7rkya4-B2 Gesprächsablauf.docx b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/ph1r2WsusfVv4jNQ_XQfB-dx2gs7rkya4-B2 Gesprächsablauf.docx new file mode 100644 index 00000000..1c6166d9 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/ph1r2WsusfVv4jNQ_XQfB-dx2gs7rkya4-B2 Gesprächsablauf.docx differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qf4_2lhKrNfaWXdF_RYcYLM3WxeaehVQk.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qf4_2lhKrNfaWXdF_RYcYLM3WxeaehVQk.jpg new file mode 100644 index 00000000..8703a3a0 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qf4_2lhKrNfaWXdF_RYcYLM3WxeaehVQk.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qtzQle2O3twefjO1_clQya6MLgjKR2I5y.jpg b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qtzQle2O3twefjO1_clQya6MLgjKR2I5y.jpg new file mode 100644 index 00000000..2e26d8aa Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/qtzQle2O3twefjO1_clQya6MLgjKR2I5y.jpg differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/sq9USXe8r1poioIp_e3KUJ4wINPFtieCt.png b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/sq9USXe8r1poioIp_e3KUJ4wINPFtieCt.png new file mode 100644 index 00000000..e5d20cb7 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/sq9USXe8r1poioIp_e3KUJ4wINPFtieCt.png differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/vJx8t9QVKB4emzCJ_small.png b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/vJx8t9QVKB4emzCJ_small.png new file mode 100644 index 00000000..48667b07 Binary files /dev/null and b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/assets/vJx8t9QVKB4emzCJ_small.png differ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/index.html b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/index.html new file mode 100644 index 00000000..c6fd648e --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormcontent/index.html @@ -0,0 +1,578 @@ + + + + + + + + Export - Testmodul + + + + + + + + + + + + + +
+ + + + + + + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/AICCComm.html b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/AICCComm.html new file mode 100644 index 00000000..52f14764 --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/AICCComm.html @@ -0,0 +1,1010 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoBookmark.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoBookmark.js new file mode 100644 index 00000000..b7843583 --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoBookmark.js @@ -0,0 +1,14 @@ +function SetBookmark() { + var SD = window.parent, + loc = window.location.href + ; + + SD.SetBookmark( + loc.substring(loc.toLowerCase().lastIndexOf("/scormcontent/") + 14, loc.length), + document.title + ); + SD.CommitData(); +} + +//Automatically set a bookmark for this page. +SetBookmark(); diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoCompleteSCO.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoCompleteSCO.js new file mode 100644 index 00000000..18fabb54 --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/AutoCompleteSCO.js @@ -0,0 +1,11 @@ +function SetSCOComplete() +{ + var SD = window.parent; + + //This is the last page so set it complete + SD.SetReachedEnd(); + SD.CommitData(); +} + +//Automatically set the SCO complete. +SetSCOComplete(); diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/CourseExit.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/CourseExit.js new file mode 100644 index 00000000..50ad1ecf --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/auto-scripts/CourseExit.js @@ -0,0 +1,11 @@ +function niExit() +{ + var SD = window.parent; + + var answer = confirm("Are You Sure You Wish To Exit This Course?"); + + if(answer) + { + SD.ConcedeControl(); + } +} \ No newline at end of file diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/blank.html b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/blank.html new file mode 100644 index 00000000..0f989d50 --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/blank.html @@ -0,0 +1,46 @@ + + + + + + +  + + + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/browsersniff.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/browsersniff.js new file mode 100644 index 00000000..9c613f73 --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/browsersniff.js @@ -0,0 +1,206 @@ + +// end hide JavaScript diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/driverOptions.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/driverOptions.js new file mode 100644 index 00000000..a97d6b7a --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/driverOptions.js @@ -0,0 +1,8 @@ +function loadDriverOptions (scope) { + scope.APPID = "WQBM2ARBZR"; + scope.CLOUDURL = null; + scope.USE_STRICT_SUSPEND_DATA_LIMITS = false; + scope.FORCED_COMMIT_TIME = 60000; + scope.strLMSStandard = "CMI5"; + scope.REVIEW_MODE_IS_READ_ONLY = true; +} diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/goodbye.html b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/goodbye.html new file mode 100644 index 00000000..51f086ae --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/goodbye.html @@ -0,0 +1,6 @@ + +
+




+Thank you for exiting the content. You may now navigate away from this content. +
+ diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/indexAPI.html b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/indexAPI.html new file mode 100644 index 00000000..ae739b1a --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/indexAPI.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/preloadIntegrity.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/preloadIntegrity.js new file mode 100644 index 00000000..8ab9f80e --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/preloadIntegrity.js @@ -0,0 +1,76 @@ +function isTrue(val) { + return val && String(val).toLowerCase() === 'true'; +} + +function verifySuspendDataVersion(maxAttempts) { + var commitDataAndBook; + var launchData; + var manifestCPV; + var resetFlag; + var sentBookCheck; + var sentDataCheck; + var suspendData = GetDataChunk(); + var suspendDataCPV; + + if (!suspendData) { + return; + } + + if (maxAttempts === 0) { + WriteToDebug('WARNING: ERROR WITH CLEARING SUSPEND OR BOOKMARKING DATA!'); + WriteToDebug('NO MORE ATTEMPTS LEFT. COURSE BEHAVIOR MAY BE NEGATIVELY IMPACTED.'); + return; + } + + try { + launchData = JSON.parse(atob(GetLaunchData())); + } catch (e) { + WriteToDebug('WARNING: Issue with obtaining manifest launch data. Version reset behavior disabled.'); + return; + } + + try { + suspendData = JSON.parse(suspendData); + } catch (e) { + WriteToDebug('WARNING: Unable to parse suspend data. Version reset behavior disabled.'); + return; + } + + manifestCPV = launchData.cpv; + resetFlag = launchData.rld; + suspendDataCPV = suspendData.cpv; + + if (suspendDataCPV !== manifestCPV) { + WriteToDebug('WARNING: Suspend data version mismatch against manifest version.'); + if (resetFlag) { + + if (REVIEW_MODE_IS_READ_ONLY && GetLessonMode() === 3) { + WriteToDebug('WARNING: Course is in review mode. Unable to clear suspend and bookmarking data!'); + WriteToDebug('Resetting of learner data will not occur. Course behavior may be negatively impacted.'); + return; + } + + WriteToDebug('Okay to clear data. Now clearing suspend and bookmarking data...'); + + sentDataCheck = SetDataChunk(""); + WriteToDebug('Suspend Data Cleared: ' + sentDataCheck ); + + sentBookCheck = SetBookmark(""); + WriteToDebug('Bookmark Data Cleared: ' + sentBookCheck ); + + commitDataAndBook = CommitData(); + WriteToDebug('Data Commited: ' + commitDataAndBook ); + + if (isTrue(sentDataCheck) && isTrue(sentBookCheck) && isTrue(commitDataAndBook)) { + WriteToDebug('Verified that all bookmarking and suspend data have been cleared. Data commited successfully.'); + } else { + WriteToDebug('WARNING: ERROR WITH CLEARING SUSPEND OR BOOKMARKING DATA! RETRY ATTEMPTS LEFT: ' + (maxAttempts-1)); + verifySuspendDataVersion(maxAttempts-1); + } + } else { + WriteToDebug('WARNING: Course reset flag not turned on. Resetting of learner data will not occur.'); + WriteToDebug('Course behavior may be negatively impacted.'); + } + } +} + diff --git a/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/scormdriver.js b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/scormdriver.js new file mode 100644 index 00000000..e0ffa4de --- /dev/null +++ b/server/vbv_lernwelt/media/web_based_trainings/rise_cmi5_test_export/scormdriver/scormdriver.js @@ -0,0 +1,1336 @@ +/* Copyright © 2003-2018 Rustici Software, LLC All Rights Reserved. www.rusticisoftware.com */ +var VERSION="7.7.0.a1.1";var PREFERENCE_DEFAULT=0;var PREFERENCE_OFF=-1;var PREFERENCE_ON=1;var LESSON_STATUS_PASSED=1;var LESSON_STATUS_COMPLETED=2;var LESSON_STATUS_FAILED=3;var LESSON_STATUS_INCOMPLETE=4;var LESSON_STATUS_BROWSED=5;var LESSON_STATUS_NOT_ATTEMPTED=6;var ENTRY_REVIEW=1;var ENTRY_FIRST_TIME=2;var ENTRY_RESUME=3;var MODE_NORMAL=1;var MODE_BROWSE=2;var MODE_REVIEW=3;var MAX_CMI_TIME=36002439990;var NO_ERROR=0;var ERROR_LMS=1;var ERROR_INVALID_PREFERENCE=2;var ERROR_INVALID_NUMBER=3;var ERROR_INVALID_ID=4;var ERROR_INVALID_STATUS=5;var ERROR_INVALID_RESPONSE=6;var ERROR_NOT_LOADED=7;var ERROR_INVALID_INTERACTION_RESPONSE=8;var EXIT_TYPE_SUSPEND="SUSPEND";var EXIT_TYPE_FINISH="FINISH";var EXIT_TYPE_TIMEOUT="TIMEOUT";var EXIT_TYPE_UNLOAD="UNLOAD";var INTERACTION_RESULT_CORRECT="CORRECT";var INTERACTION_RESULT_WRONG="WRONG";var INTERACTION_RESULT_UNANTICIPATED="UNANTICIPATED";var INTERACTION_RESULT_NEUTRAL="NEUTRAL";var INTERACTION_TYPE_TRUE_FALSE="true-false";var INTERACTION_TYPE_CHOICE="choice";var INTERACTION_TYPE_FILL_IN="fill-in";var INTERACTION_TYPE_LONG_FILL_IN="long-fill-in";var INTERACTION_TYPE_MATCHING="matching";var INTERACTION_TYPE_PERFORMANCE="performance";var INTERACTION_TYPE_SEQUENCING="sequencing";var INTERACTION_TYPE_LIKERT="likert";var INTERACTION_TYPE_NUMERIC="numeric";var DATA_CHUNK_PAIR_SEPARATOR='###';var DATA_CHUNK_VALUE_SEPARATOR='$$';var APPID="__APPID__";var CLOUDURL="__CLOUDURL__";var blnDebug=true;var strLMSStandard="AUTO";var DEFAULT_EXIT_TYPE=EXIT_TYPE_SUSPEND;var AICC_LESSON_ID="1";var EXIT_BEHAVIOR="SCORM_RECOMMENDED";var EXIT_TARGET="goodbye.html";var AICC_COMM_DISABLE_XMLHTTP=false;var AICC_COMM_DISABLE_IFRAME=false;var AICC_COMM_PREPEND_HTTP_IF_MISSING=true;var AICC_REPORT_MIN_MAX_SCORE=true;var SHOW_DEBUG_ON_LAUNCH=false;var DO_NOT_REPORT_INTERACTIONS=false;var SCORE_CAN_ONLY_IMPROVE=false;var REVIEW_MODE_IS_READ_ONLY=true;var TCAPI_DONT_USE_BROKEN_URN_IDS=true;var AICC_RE_CHECK_LOADED_INTERVAL=250;var AICC_RE_CHECK_ATTEMPTS_BEFORE_TIMEOUT=240;var USE_AICC_KILL_TIME=true;var AICC_ENTRY_FLAG_DEFAULT=ENTRY_REVIEW;var AICC_USE_CUSTOM_COMMS=false;var FORCED_COMMIT_TIME="0";var ALLOW_NONE_STANDARD=true;var USE_2004_SUSPENDALL_NAVREQ=false;var USE_STRICT_SUSPEND_DATA_LIMITS=true;var EXIT_SUSPEND_IF_COMPLETED=false;var EXIT_NORMAL_IF_PASSED=false;var AICC_ENCODE_PARAMETER_VALUES=true;var PASS_FAIL_SETS_COMPLETION_FOR_2004=true;var ALLOW_INTERACTION_NULL_LEARNER_RESPONSE=false;var PREVENT_STATUS_CHANGE_DURING_INIT=false;var USE_LEGACY_IDENTIFIERS_FOR_2004=false;var URI_IDENTIFIER_PREFIX="urn:scormdriver:"; +var noop=Function.prototype; loadDriverOptions(window); +function GetQueryStringValue(strElement,strQueryString){var aryPairs;var foundValue;strQueryString=strQueryString.substring(1);aryPairs=strQueryString.split("&");foundValue=SearchQueryStringPairs(aryPairs,strElement);if(foundValue===null){aryPairs=strQueryString.split(/[\?&]/);foundValue=SearchQueryStringPairs(aryPairs,strElement)}if(foundValue===null){WriteToDebug("GetQueryStringValue Element '"+strElement+"' Not Found, Returning: empty string");return""}else{WriteToDebug("GetQueryStringValue for '"+ +strElement+"' Returning: "+foundValue);return foundValue}} +function SearchQueryStringPairs(aryPairs,strElement){var i;var intEqualPos;var strArg="";var strValue="";strElement=strElement.toLowerCase();for(i=0;i +0)if((""+tzoffset).indexOf(".")!=-1){var fraction="0"+(""+tzoffset).substr((""+tzoffset).indexOf("."),(""+tzoffset).length);var base=(""+tzoffset).substr(0,(""+tzoffset).indexOf("."));fraction=fraction*60;strTimeStamp+="+"+ZeroPad(base+"."+fraction,2)}else strTimeStamp+="+"+ZeroPad(tzoffset,2);else strTimeStamp+=ZeroPad(tzoffset,2)}return strTimeStamp} +function ConvertIso8601TimeStampToDate(strTimeStamp){strTimeStamp=new String(strTimeStamp);var ary=new Array;ary=strTimeStamp.split(/[:T+-]/);var Year=ary[0];var Month=ary[1]-1;var Day=ary[2];var Hour=ary[3];var Minute=ary[4];var Second=ary[5];return new Date(Year,Month,Day,Hour,Minute,Second,0)} +function ConvertDateToCMIDate(dtmDate){WriteToDebug("In ConvertDateToCMIDate");var strYear;var strMonth;var strDay;var strReturn;dtmDate=new Date(dtmDate);strYear=dtmDate.getFullYear();strMonth=dtmDate.getMonth()+1;strDay=dtmDate.getDate();strReturn=ZeroPad(strYear,4)+"/"+ZeroPad(strMonth,2)+"/"+ZeroPad(strDay,2);return strReturn} +function ConvertDateToCMITime(dtmDate){var strHours;var strMinutes;var strSeconds;var strReturn;dtmDate=new Date(dtmDate);strHours=dtmDate.getHours();strMinutes=dtmDate.getMinutes();strSeconds=dtmDate.getSeconds();strReturn=ZeroPad(strHours,2)+":"+ZeroPad(strMinutes,2)+":"+ZeroPad(strSeconds,2);return strReturn} +function ConvertCMITimeSpanToMS(strTime){WriteToDebug("In ConvertCMITimeSpanToMS, strTime="+strTime);var aryParts;var intHours;var intMinutes;var intSeconds;var intTotalMilliSeconds;aryParts=strTime.split(":");if(!IsValidCMITimeSpan(strTime)){WriteToDebug("ERROR - Invalid TimeSpan");SetErrorInfo(SCORM_ERROR_GENERAL,"LMS ERROR - Invalid time span passed to ConvertCMITimeSpanToMS, please contact technical support");return 0}intHours=aryParts[0];intMinutes=aryParts[1];intSeconds=aryParts[2];WriteToDebug("intHours="+ +intHours+" intMinutes="+intMinutes+" intSeconds="+intSeconds);intTotalMilliSeconds=intHours*36E5+intMinutes*6E4+intSeconds*1E3;intTotalMilliSeconds=Math.round(intTotalMilliSeconds);WriteToDebug("Returning "+intTotalMilliSeconds);return intTotalMilliSeconds} +function ConvertScorm2004TimeToMS(strIso8601Time){WriteToDebug("In ConvertScorm2004TimeToMS, strIso8601Time="+strIso8601Time);var intTotalMs=0;var strNumberBuilder;var strCurrentCharacter;var blnInTimeSection;var Seconds=0;var Minutes=0;var Hours=0;var Days=0;var Months=0;var Years=0;var MILLISECONDS_PER_SECOND=1E3;var MILLISECONDS_PER_MINUTE=MILLISECONDS_PER_SECOND*60;var MILLISECONDS_PER_HOUR=MILLISECONDS_PER_MINUTE*60;var MILLISECONDS_PER_DAY=MILLISECONDS_PER_HOUR*24;var MILLISECONDS_PER_MONTH= +MILLISECONDS_PER_DAY*((365*4+1)/48);var MILLISECONDS_PER_YEAR=MILLISECONDS_PER_MONTH*12;strIso8601Time=new String(strIso8601Time);strNumberBuilder="";strCurrentCharacter="";blnInTimeSection=false;for(var i=1;i=0)return true;else return false} +function IsValidCMITimeSpan(strValue){WriteToDebug("In IsValidCMITimeSpan strValue="+strValue);var regValid=/^\d?\d?\d?\d:\d?\d:\d?\d(.\d\d?)?$/;if(strValue.search(regValid)>-1){WriteToDebug("Returning True");return true}else{WriteToDebug("Returning False");return false}} +function IsValidIso8601TimeSpan(strValue){WriteToDebug("In IsValidIso8601TimeSpan strValue="+strValue);var regValid=/^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(.\d\d?)?S)?)?$/;if(strValue.search(regValid)>-1){WriteToDebug("Returning True");return true}else{WriteToDebug("Returning False");return false}} +function ConvertMilliSecondsToTCAPITime(intTotalMilliseconds,blnIncludeFraction){var intHours;var intMinutes;var intSeconds;var intMilliseconds;var intHundredths;var strCMITimeSpan;WriteToDebug("In ConvertMilliSecondsToTCAPITime, intTotalMilliseconds = "+intTotalMilliseconds+", blnIncludeFraction = "+blnIncludeFraction);if(blnIncludeFraction==null||blnIncludeFraction==undefined)blnIncludeFraction=true;intMilliseconds=intTotalMilliseconds%1E3;intSeconds=(intTotalMilliseconds-intMilliseconds)/1E3%60; +intMinutes=(intTotalMilliseconds-intMilliseconds-intSeconds*1E3)/6E4%60;intHours=(intTotalMilliseconds-intMilliseconds-intSeconds*1E3-intMinutes*6E4)/36E5;WriteToDebug("Separated Parts, intHours="+intHours+", intMinutes="+intMinutes+", intSeconds="+intSeconds+", intMilliseconds="+intMilliseconds);if(intHours==1E4){WriteToDebug("Max intHours detected");intHours=9999;intMinutes=(intTotalMilliseconds-intHours*36E5)/6E4;if(intMinutes==100)intMinutes=99;intMinutes=Math.floor(intMinutes);intSeconds=(intTotalMilliseconds- +intHours*36E5-intMinutes*6E4)/1E3;if(intSeconds==100)intSeconds=99;intSeconds=Math.floor(intSeconds);intMilliseconds=intTotalMilliseconds-intHours*36E5-intMinutes*6E4-intSeconds*1E3;WriteToDebug("Separated Parts, intHours="+intHours+", intMinutes="+intMinutes+", intSeconds="+intSeconds+", intMilliseconds="+intMilliseconds)}intHundredths=Math.floor(intMilliseconds/10);strCMITimeSpan=ZeroPad(intHours,4)+":"+ZeroPad(intMinutes,2)+":"+ZeroPad(intSeconds,2);if(blnIncludeFraction)strCMITimeSpan+="."+intHundredths; +WriteToDebug("strCMITimeSpan="+strCMITimeSpan);if(intHours>9999){strCMITimeSpan="9999:99:99";if(blnIncludeFraction)strCMITimeSpan+=".99"}WriteToDebug("returning "+strCMITimeSpan);return strCMITimeSpan} +function ConvertMilliSecondsToSCORMTime(intTotalMilliseconds,blnIncludeFraction){var intHours;var intMinutes;var intSeconds;var intMilliseconds;var intHundredths;var strCMITimeSpan;WriteToDebug("In ConvertMilliSecondsToSCORMTime, intTotalMilliseconds = "+intTotalMilliseconds+", blnIncludeFraction = "+blnIncludeFraction);if(blnIncludeFraction==null||blnIncludeFraction==undefined)blnIncludeFraction=true;intMilliseconds=intTotalMilliseconds%1E3;intSeconds=(intTotalMilliseconds-intMilliseconds)/1E3%60; +intMinutes=(intTotalMilliseconds-intMilliseconds-intSeconds*1E3)/6E4%60;intHours=(intTotalMilliseconds-intMilliseconds-intSeconds*1E3-intMinutes*6E4)/36E5;WriteToDebug("Separated Parts, intHours="+intHours+", intMinutes="+intMinutes+", intSeconds="+intSeconds+", intMilliseconds="+intMilliseconds);if(intHours==1E4){WriteToDebug("Max intHours detected");intHours=9999;intMinutes=(intTotalMilliseconds-intHours*36E5)/6E4;if(intMinutes==100)intMinutes=99;intMinutes=Math.floor(intMinutes);intSeconds=(intTotalMilliseconds- +intHours*36E5-intMinutes*6E4)/1E3;if(intSeconds==100)intSeconds=99;intSeconds=Math.floor(intSeconds);intMilliseconds=intTotalMilliseconds-intHours*36E5-intMinutes*6E4-intSeconds*1E3;WriteToDebug("Separated Parts, intHours="+intHours+", intMinutes="+intMinutes+", intSeconds="+intSeconds+", intMilliseconds="+intMilliseconds)}intHundredths=Math.floor(intMilliseconds/10);strCMITimeSpan=ZeroPad(intHours,4)+":"+ZeroPad(intMinutes,2)+":"+ZeroPad(intSeconds,2);if(blnIncludeFraction)strCMITimeSpan+="."+intHundredths; +WriteToDebug("strCMITimeSpan="+strCMITimeSpan);if(intHours>9999){strCMITimeSpan="9999:99:99";if(blnIncludeFraction)strCMITimeSpan+=".99"}WriteToDebug("returning "+strCMITimeSpan);return strCMITimeSpan} +function ConvertMilliSecondsIntoSCORM2004Time(intTotalMilliseconds){WriteToDebug("In ConvertMilliSecondsIntoSCORM2004Time intTotalMilliseconds="+intTotalMilliseconds);var ScormTime="";var HundredthsOfASecond;var Seconds;var Minutes;var Hours;var Days;var Months;var Years;var HUNDREDTHS_PER_SECOND=100;var HUNDREDTHS_PER_MINUTE=HUNDREDTHS_PER_SECOND*60;var HUNDREDTHS_PER_HOUR=HUNDREDTHS_PER_MINUTE*60;var HUNDREDTHS_PER_DAY=HUNDREDTHS_PER_HOUR*24;var HUNDREDTHS_PER_MONTH=HUNDREDTHS_PER_DAY*((365*4+1)/ +48);var HUNDREDTHS_PER_YEAR=HUNDREDTHS_PER_MONTH*12;HundredthsOfASecond=Math.floor(intTotalMilliseconds/10);Years=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_YEAR);HundredthsOfASecond-=Years*HUNDREDTHS_PER_YEAR;Months=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_MONTH);HundredthsOfASecond-=Months*HUNDREDTHS_PER_MONTH;Days=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_DAY);HundredthsOfASecond-=Days*HUNDREDTHS_PER_DAY;Hours=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_HOUR);HundredthsOfASecond-= +Hours*HUNDREDTHS_PER_HOUR;Minutes=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_MINUTE);HundredthsOfASecond-=Minutes*HUNDREDTHS_PER_MINUTE;Seconds=Math.floor(HundredthsOfASecond/HUNDREDTHS_PER_SECOND);HundredthsOfASecond-=Seconds*HUNDREDTHS_PER_SECOND;if(Years>0)ScormTime+=Years+"Y";if(Months>0)ScormTime+=Months+"M";if(Days>0)ScormTime+=Days+"D";if(HundredthsOfASecond+Seconds+Minutes+Hours>0){ScormTime+="T";if(Hours>0)ScormTime+=Hours+"H";if(Minutes>0)ScormTime+=Minutes+"M";if(HundredthsOfASecond+ +Seconds>0){ScormTime+=Seconds;if(HundredthsOfASecond>0)ScormTime+="."+HundredthsOfASecond;ScormTime+="S"}}if(ScormTime=="")ScormTime="T0S";ScormTime="P"+ScormTime;WriteToDebug("Returning-"+ScormTime);return ScormTime} +function ZeroPad(intNum,intNumDigits){WriteToDebug("In ZeroPad intNum="+intNum+" intNumDigits="+intNumDigits);var strTemp;var intLen;var decimalToPad;var i;var isNeg=false;strTemp=new String(intNum);if(strTemp.indexOf("-")!=-1){isNeg=true;strTemp=strTemp.substr(1,strTemp.length)}if(strTemp.indexOf(".")!=-1){strTemp.replace(".","");decimalToPad=strTemp.substr(strTemp.indexOf(".")+1,strTemp.length);strTemp=strTemp.substr(0,strTemp.indexOf("."))}intLen=strTemp.length;if(intLen>intNumDigits){WriteToDebug("Length of string is greater than num digits, trimming string"); +strTemp=strTemp.substr(0,intNumDigits)}else for(i=intLen;i0&&!IsValidDecimal(strMin)){WriteToDebug("Returning False - min value supplied range is not a valid decimal, min="+strMin);return false}if(strMax.length> +0&&!IsValidDecimal(strMax)){WriteToDebug("Returning False - max value supplied for range is not a valid decimal, max="+strMax);return false}if(strMin.length>0&&strMax.length>0&&parseFloat(strMin)>parseFloat(strMax)){WriteToDebug("Returning False - min value supplied for range is greater than the max, min="+strMin+", max="+strMax);return false}return true}WriteToDebug("Returning false - string supplied for range has incorrect number of parts, parts="+aryNumericRangeSplit.length+", strValue="+strValue); +return false} +function ConvertDecimalRangeToDecimalBasedOnLearnerResponse(strValue,strLearnerResponse,blnCorrect){WriteToDebug("In ConvertDecimalRangeToDecimalBasedOnLearnerResponse strValue="+strValue+",strLearnerResponse="+strLearnerResponse+",blnCorrect="+blnCorrect);var REG_EX_REAL_DELIMITER="[:]",aryNumericRangeSplit,strMin,strMax;if(blnCorrect){WriteToDebug("Returning strLearnerResponse");return strLearnerResponse}strValue=new String(strValue);aryNumericRangeSplit=strValue.split(REG_EX_REAL_DELIMITER);if(aryNumericRangeSplit.length=== +2){strMin=Trim(aryNumericRangeSplit[0]);strMax=Trim(aryNumericRangeSplit[1]);if(strMin.length>0){WriteToDebug("Returning strMin");return strMin}else if(strMax.length>0){WriteToDebug("Returning strMax");return strMax}}WriteToDebug("Returning null");return null} +function IsValidDecimal(strValue){WriteToDebug("In IsValidDecimal, strValue="+strValue);strValue=new String(strValue);if(strValue.search(/[^.\d-]/)>-1){WriteToDebug("Returning False - character other than a digit, dash or period found");return false}if(strValue.search("-")>-1)if(strValue.indexOf("-",1)>-1){WriteToDebug("Returning False - dash found in the middle of the string");return false}if(strValue.indexOf(".")!=strValue.lastIndexOf(".")){WriteToDebug("Returning False - more than one decimal point found"); +return false}if(strValue.search(/\d/)<0){WriteToDebug("Returning False - no digits found");return false}WriteToDebug("Returning True");return true}function IsAlphaNumeric(strValue){WriteToDebug("In IsAlphaNumeric");if(strValue.search(/\w/)<0){WriteToDebug("Returning false");return false}else{WriteToDebug("Returning true");return true}} +function ReverseNameSequence(strName){var strFirstName;var strLastName;var intCommaLoc;if(strName=="")strName="Not Found, Learner Name";intCommaLoc=strName.indexOf(",");strFirstName=strName.slice(intCommaLoc+1);strLastName=strName.slice(0,intCommaLoc);strFirstName=Trim(strFirstName);strLastName=Trim(strLastName);return strFirstName+" "+strLastName}function LTrim(str){str=new String(str);return str.replace(/^\s+/,"")}function RTrim(str){str=new String(str);return str.replace(/\s+$/,"")} +function Trim(strToTrim){var str=LTrim(RTrim(strToTrim));return str.replace(/\s{2,}/g," ")}function GetValueFromDataChunk(strID){var strChunk=new String(GetDataChunk());var aryPairs=new Array;var aryValues=new Array;var i;aryPairs=strChunk.split(parent.DATA_CHUNK_PAIR_SEPARATOR);for(i=0;i4E3){WriteToDebug("SCORM2004_SetDataChunk - suspend_data too large for SCORM 2004 2nd ed (4000 character limit) but will try to persist anyway.");if(strData.length>64E3){WriteToDebug("SCORM2004_SetDataChunk - suspend_data too large for SCORM 2004 3rd & 4th ed (64000 character limit) so failing to persist.");return false}else return SCORM2004_CallSetValue("cmi.suspend_data", +strData)}else return SCORM2004_CallSetValue("cmi.suspend_data",strData);else return SCORM2004_CallSetValue("cmi.suspend_data",strData)}function SCORM2004_GetLaunchData(){WriteToDebug("In SCORM2004_GetLaunchData");SCORM2004_ClearErrorInfo();return SCORM2004_CallGetValue("cmi.launch_data")} +function SCORM2004_GetComments(){WriteToDebug("In SCORM2004_GetComments");SCORM2004_ClearErrorInfo();var intCommentCount;var strComments="";intCommentCount=SCORM2004_CallGetValue("cmi.comments_from_learner._count");for(var i=0;i0)strComments+=" | ";strComments+=SCORM2004_CallGetValue("cmi.comments_from_learner."+i+".comment")}return strComments} +function SCORM2004_WriteComment(strComment){WriteToDebug("In SCORM2004_WriteComment strComment="+strComment);var intCurrentIndex;var blnResult;SCORM2004_ClearErrorInfo();if(strComment.search(/ \| /)==0)strComment=strComment.substr(3);strComment.replace(/\|\|/g,"|");intCurrentIndex=SCORM2004_CallGetValue("cmi.comments_from_learner._count");blnResult=SCORM2004_CallSetValue("cmi.comments_from_learner."+intCurrentIndex+".comment",strComment);blnResult=SCORM2004_CallSetValue("cmi.comments_from_learner."+ +intCurrentIndex+".timestamp",ConvertDateToIso8601TimeStamp(new Date))&&blnResult;return blnResult}function SCORM2004_GetLMSComments(){WriteToDebug("In SCORM2004_GetLMSComments");SCORM2004_ClearErrorInfo();var intCommentCount;var strComments="";intCommentCount=SCORM2004_CallGetValue("cmi.comments_from_lms._count");for(var i=0;i0)strComments+=" \r\n";strComments+=SCORM2004_CallGetValue("cmi.comments_from_lms."+i+".comment")}return strComments} +function SCORM2004_GetAudioPlayPreference(){var intTempPreference;WriteToDebug("In SCORM2004_GetAudioPlayPreference");SCORM2004_ClearErrorInfo();intTempPreference=SCORM2004_CallGetValue("cmi.learner_preference.audio_level");if(intTempPreference=="")intTempPreference=0;intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference<=0){WriteToDebug("Returning Off"); +return PREFERENCE_OFF}else{WriteToDebug("Error: Invalid preference");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null}} +function SCORM2004_GetAudioVolumePreference(){var intTempPreference;WriteToDebug("In SCORM2004_GetAudioVollumePreference");SCORM2004_ClearErrorInfo();intTempPreference=SCORM2004_CallGetValue("cmi.learner_preference.audio_level");WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference=="")intTempPreference=100;intTempPreference=parseInt(intTempPreference,10);if(intTempPreference<=0){WriteToDebug("Setting to 100");intTempPreference=100}if(!(intTempPreference>0&&intTempPreference<= +100)){WriteToDebug("ERROR: invalid preference");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null}WriteToDebug("Returning "+intTempPreference);return intTempPreference} +function SCORM2004_SetAudioPreference(PlayPreference,intPercentOfMaxVolume){WriteToDebug("In SCORM2004_SetAudioPreference PlayPreference="+PlayPreference+", intPercentOfMaxVolume="+intPercentOfMaxVolume);SCORM2004_ClearErrorInfo();if(PlayPreference==PREFERENCE_OFF){WriteToDebug("Setting percent to 0");intPercentOfMaxVolume=0}return SCORM2004_CallSetValue("cmi.learner_preference.audio_level",intPercentOfMaxVolume)} +function SCORM2004_SetLanguagePreference(strLanguage){WriteToDebug("In SCORM2004_SetLanguagePreference strLanguage="+strLanguage);SCORM2004_ClearErrorInfo();return SCORM2004_CallSetValue("cmi.learner_preference.language",strLanguage)}function SCORM2004_GetLanguagePreference(){WriteToDebug("In SCORM2004_GetLanguagePreference");SCORM2004_ClearErrorInfo();return SCORM2004_CallGetValue("cmi.learner_preference.language")} +function SCORM2004_SetSpeedPreference(intPercentOfMax){WriteToDebug("In SCORM2004_SetSpeedPreference intPercentOfMax="+intPercentOfMax);SCORM2004_ClearErrorInfo();return SCORM2004_CallSetValue("cmi.learner_preference.delivery_speed",intPercentOfMax)} +function SCORM2004_GetSpeedPreference(){var intSCORMSpeed;var intPercentOfMax;WriteToDebug("In SCORM2004_GetSpeedPreference");SCORM2004_ClearErrorInfo();intSCORMSpeed=SCORM2004_CallGetValue("cmi.learner_preference.delivery_speed");WriteToDebug("intSCORMSpeed="+intSCORMSpeed);if(intSCORMSpeed==""){WriteToDebug("Detected empty string, defaulting to 100");intSCORMSpeed=100}intSCORMSpeed=parseInt(intSCORMSpeed,10);if(intSCORMSpeed<0){WriteToDebug("ERROR - out of range");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_SPEED, +"Invalid speed preference received from LMS - out of range","intSCORMSpeed="+intSCORMSpeed);return null}WriteToDebug("intSCORMSpeed "+intSCORMSpeed);return intSCORMSpeed}function SCORM2004_SetTextPreference(intPreference){WriteToDebug("In SCORM2004_SetTextPreference intPreference="+intPreference);SCORM2004_ClearErrorInfo();return SCORM2004_CallSetValue("cmi.learner_preference.audio_captioning",intPreference)} +function SCORM2004_GetTextPreference(){var intTempPreference;WriteToDebug("In SCORM2004_GetTextPreference");SCORM2004_ClearErrorInfo();intTempPreference=SCORM2004_CallGetValue("cmi.learner_preference.audio_captioning");intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference==0||intTempPreference==""){WriteToDebug("Returning Default");return PREFERENCE_DEFAULT}else if(intTempPreference< +0){WriteToDebug("Returning Off");return PREFERENCE_OFF}else{WriteToDebug("Error: Invalid preference");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+intTempPreference);return null}} +function SCORM2004_GetPreviouslyAccumulatedTime(){var strIso8601Time;var intMilliseconds;WriteToDebug("In SCORM2004_GetPreviouslyAccumulatedTime");SCORM2004_ClearErrorInfo();strIso8601Time=SCORM2004_CallGetValue("cmi.total_time");WriteToDebug("strIso8601Time="+strIso8601Time);if(!IsValidIso8601TimeSpan(strIso8601Time)){WriteToDebug("ERROR - Invalid Iso8601Time");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+strIso8601Time);return null}intMilliseconds= +ConvertScorm2004TimeToMS(strIso8601Time);WriteToDebug("Returning "+intMilliseconds);return intMilliseconds}function SCORM2004_SaveTime(intMilliSeconds){var strISO8601Time;WriteToDebug("In SCORM2004_SaveTime intMilliSeconds="+intMilliSeconds);SCORM2004_ClearErrorInfo();strISO8601Time=ConvertMilliSecondsIntoSCORM2004Time(intMilliSeconds);WriteToDebug("strISO8601Time="+strISO8601Time);return SCORM2004_CallSetValue("cmi.session_time",strISO8601Time)} +function SCORM2004_GetMaxTimeAllowed(){var strIso8601Time;var intMilliseconds;WriteToDebug("In SCORM2004_GetMaxTimeAllowed");SCORM2004_ClearErrorInfo();strIso8601Time=SCORM2004_CallGetValue("cmi.max_time_allowed");WriteToDebug("strIso8601Time="+strIso8601Time);if(strIso8601Time=="")strIso8601Time="20Y";if(!IsValidIso8601TimeSpan(strIso8601Time)){WriteToDebug("ERROR - Invalid Iso8601Time");SCORM2004_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strIso8601Time="+ +strIso8601Time);return null}intMilliseconds=ConvertScorm2004TimeToMS(ConvertScorm2004TimeToMS);WriteToDebug("intMilliseconds="+intMilliseconds);return intMilliseconds} +function SCORM2004_DisplayMessageOnTimeout(){var strTLA;WriteToDebug("In SCORM2004_DisplayMessageOnTimeout");SCORM2004_ClearErrorInfo();strTLA=SCORM2004_CallGetValue("cmi.time_limit_action");WriteToDebug("strTLA="+strTLA);if(strTLA==SCORM2004_TLA_EXIT_MESSAGE||strTLA==SCORM2004_TLA_CONTINUE_MESSAGE){WriteToDebug("returning true");return true}else if(strTLA==SCORM2004_TLA_EXIT_NO_MESSAGE||strTLA==SCORM2004_TLA_CONTINUE_NO_MESSAGE||strTLA==""){WriteToDebug("returning false");return false}else{WriteToDebug("Error invalid TLA"); +SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+strTLA);return null}} +function SCORM2004_ExitOnTimeout(){var strTLA;WriteToDebug("In SCORM2004_ExitOnTimeout");SCORM2004_ClearErrorInfo();strTLA=SCORM2004_CallGetValue("cmi.time_limit_action");WriteToDebug("strTLA="+strTLA);if(strTLA==SCORM2004_TLA_EXIT_MESSAGE||strTLA==SCORM2004_TLA_EXIT_NO_MESSAGE){WriteToDebug("returning true");return true}else if(strTLA==SCORM2004_TLA_CONTINUE_MESSAGE||strTLA==SCORM2004_TLA_CONTINUE_NO_MESSAGE||strTLA==""){WriteToDebug("returning false");return false}else{WriteToDebug("ERROR invalid TLA"); +SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+strTLA);return null}} +function SCORM2004_GetPassingScore(){var fltScore;WriteToDebug("In SCORM2004_GetPassingScore");SCORM2004_ClearErrorInfo();fltScore=SCORM2004_CallGetValue("cmi.scaled_passing_score");WriteToDebug("fltScore="+fltScore);if(fltScore=="")fltScore=0;if(!IsValidDecimal(fltScore)){WriteToDebug("Error - score is not a valid decimal");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_DECIMAL,"Invalid mastery score received from LMS","fltScore="+fltScore);return null}fltScore=parseFloat(fltScore);fltScore= +fltScore*100;WriteToDebug("returning fltScore-"+fltScore);return fltScore} +function SCORM2004_SetScore(intScore,intMaxScore,intMinScore){var blnResult;var fltNormalizedScore;intScore=RoundToPrecision(intScore,7);intMaxScore=RoundToPrecision(intMaxScore,7);intMinScore=RoundToPrecision(intMinScore,7);WriteToDebug("In SCORM2004_SetScore intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);SCORM2004_ClearErrorInfo();fltNormalizedScore=RoundToPrecision(intScore/100,7);blnResult=SCORM2004_CallSetValue("cmi.score.raw",intScore);blnResult=SCORM2004_CallSetValue("cmi.score.max", +intMaxScore)&&blnResult;blnResult=SCORM2004_CallSetValue("cmi.score.min",intMinScore)&&blnResult;blnResult=SCORM2004_CallSetValue("cmi.score.scaled",fltNormalizedScore)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult}function SCORM2004_GetScore(){WriteToDebug("In SCORM2004_GetScore");SCORM2004_ClearErrorInfo();return SCORM2004_CallGetValue("cmi.score.raw")} +function SCORM2004_GetScaledScore(){WriteToDebug("In SCORM2004_GetScaledScore");SCORM2004_ClearErrorInfo();return SCORM2004_CallGetValue("cmi.score.scaled")} +function SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004InteractionType){var blnResult;var intInteractionIndex;var strResult;if(!IsNumeric(blnCorrect))blnCorrect=new String(blnCorrect);SCORM2004_ClearErrorInfo();intInteractionIndex=SCORM2004_CallGetValue("cmi.interactions._count");WriteToDebug("intInteractionIndex="+intInteractionIndex);if(intInteractionIndex==""){WriteToDebug("Setting Interaction Index to 0"); +intInteractionIndex=0}if(blnCorrect==true||blnCorrect=="true"||blnCorrect==INTERACTION_RESULT_CORRECT)strResult=SCORM2004_RESULT_CORRECT;else if(String(blnCorrect)=="false"||blnCorrect==INTERACTION_RESULT_WRONG)strResult=SCORM2004_RESULT_WRONG;else if(blnCorrect==INTERACTION_RESULT_UNANTICIPATED)strResult=SCORM2004_RESULT_UNANTICIPATED;else if(blnCorrect==INTERACTION_RESULT_NEUTRAL)strResult=SCORM2004_RESULT_NEUTRAL;else if(IsNumeric(blnCorrect))strResult=blnCorrect;else strResult="";WriteToDebug("strResult="+ +strResult);strID=CreateValidIdentifier(strID);blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".id",strID);blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".type",SCORM2004InteractionType)&&blnResult;if(strResponse!==null)blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".learner_response",strResponse)&&blnResult;if(strResult!=undefined&&strResult!=null&&strResult!="")blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+ +".result",strResult)&&blnResult;if(strCorrectResponse!=undefined&&strCorrectResponse!=null&&strCorrectResponse!="")blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".correct_responses.0.pattern",strCorrectResponse)&&blnResult;if(strDescription!=undefined&&strDescription!=null&&strDescription!="")blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".description",strDescription)&&blnResult;if(intWeighting!=undefined&&intWeighting!=null&&intWeighting!="")blnResult= +SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".weighting",intWeighting)&&blnResult;if(intLatency!=undefined&&intLatency!=null&&intLatency!="")blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".latency",ConvertMilliSecondsIntoSCORM2004Time(intLatency))&&blnResult;if(strLearningObjectiveID!=undefined&&strLearningObjectiveID!=null&&strLearningObjectiveID!="")blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".objectives.0.id",strLearningObjectiveID)&& +blnResult;blnResult=SCORM2004_CallSetValue("cmi.interactions."+intInteractionIndex+".timestamp",ConvertDateToIso8601TimeStamp(dtmTime))&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM2004_RecordTrueFalseInteraction(strID,blnResponse,blnCorrect,blnCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordTrueFalseInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strCorrectResponse=null;if(blnResponse)strResponse="true";else if(blnResponse!==null)strResponse="false";if(blnCorrectResponse==true)strCorrectResponse="true";else if(blnCorrectResponse==false)strCorrectResponse="false";return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_TRUE_FALSE)} +function SCORM2004_RecordMultipleChoiceInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordMultipleChoiceInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime); +var strResponse=null;var strCorrectResponse="";if(aryResponse!==null){strResponse="";for(var i=0;i0)strResponse+="[,]";strResponse+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=aryCorrectResponse[i].Long}return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime, +SCORM2004_INTERACTION_TYPE_CHOICE)} +function SCORM2004_RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var interactionType; +if(strCorrectResponse==null)strCorrectResponse="";strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>250||strResponse.length>250)interactionType=SCORM2004_INTERACTION_TYPE_LONG_FILL_IN;else interactionType=SCORM2004_INTERACTION_TYPE_FILL_IN;if(strCorrectResponse.length>4E3)strCorrectResponse=strCorrectResponse.substr(0,4E3);return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime, +interactionType)} +function SCORM2004_RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordMatchingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strCorrectResponse="";if(aryResponse!==null){strResponse="";for(var i=0;i0)strResponse+="[,]";strResponse+=aryResponse[i].Source.Long+"[.]"+aryResponse[i].Target.Long}}for(var i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=aryCorrectResponse[i].Source.Long+"[.]"+aryCorrectResponse[i].Target.Long}return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse, +strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_MATCHING)} +function SCORM2004_RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime); +if(strResponse!==null){strResponse=new String(strResponse);if(strResponse.length>250)strResponse=strResponse.substr(0,250);strResponse="[.]"+strResponse}if(strCorrectResponse==null)strCorrectResponse="";strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>250)strCorrectResponse=strCorrectResponse.substr(0,250);strCorrectResponse="[.]"+strCorrectResponse;return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency, +strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_PERFORMANCE)} +function SCORM2004_RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordSequencingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strCorrectResponse="";if(aryResponse!==null){strResponse="";for(var i=0;i0)strResponse+="[,]";strResponse+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=aryCorrectResponse[i].Long}return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_SEQUENCING)} +function SCORM2004_RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse=null;var strCorrectResponse= +"";if(response!==null)strResponse=response.Long;if(correctResponse!=null)strCorrectResponse=correctResponse.Long;return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_LIKERT)} +function SCORM2004_RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM2004_RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strCorrectResponse!= +undefined&&strCorrectResponse!=null){if(IsValidDecimal(strCorrectResponse)){strCorrectResponse=strCorrectResponse+"[:]"+strCorrectResponse;WriteToDebug("SCORM2004_RecordNumericInteraction received decimal correct response and converted to range, strCorrectResponse="+strCorrectResponse)}if(!IsValidDecimalRange(strCorrectResponse)){WriteToDebug("Returning False - SCORM2004_RecordNumericInteraction received invalid correct response decimal range, strCorrectResponse="+strCorrectResponse);return false}if(ConvertDecimalRangeToDecimalBasedOnLearnerResponse(strCorrectResponse, +strResponse,blnCorrect)===null){WriteToDebug("Returning False - SCORM2004_RecordNumericInteraction received invalid correct response decimal range, response and correct indicator, strCorrectResponse="+strCorrectResponse+", strResponse="+strResponse+", blnCorrect="+blnCorrect);return false}}return SCORM2004_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM2004_INTERACTION_TYPE_NUMERIC)} +function SCORM2004_GetEntryMode(){var strEntry;WriteToDebug("In SCORM2004_GetEntryMode");SCORM2004_ClearErrorInfo();strEntry=SCORM2004_CallGetValue("cmi.entry");WriteToDebug("strEntry="+strEntry);if(strEntry==SCORM2004_ENTRY_ABINITIO){WriteToDebug("Returning first time");return ENTRY_FIRST_TIME}else if(strEntry==SCORM2004_ENTRY_RESUME){WriteToDebug("Returning resume");return ENTRY_RESUME}else if(strEntry==SCORM2004_ENTRY_NORMAL){WriteToDebug("returning normal");return ENTRY_REVIEW}else{WriteToDebug("ERROR - invalid entry mode"); +SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_ENTRY,"Invalid entry vocab received from LMS","strEntry="+strEntry);return null}} +function SCORM2004_GetLessonMode(){var strLessonMode;WriteToDebug("In SCORM2004_GetLessonMode");SCORM2004_ClearErrorInfo();strLessonMode=SCORM2004_CallGetValue("cmi.mode");WriteToDebug("strLessonMode="+strLessonMode);if(strLessonMode==SCORM2004_BROWSE){WriteToDebug("Returning browse");return MODE_BROWSE}else if(strLessonMode==SCORM2004_NORMAL){WriteToDebug("returning normal");return MODE_NORMAL}else if(strLessonMode==SCORM2004_REVIEW){WriteToDebug("Returning Review");return MODE_REVIEW}else{WriteToDebug("ERROR - invalid lesson mode"); +SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_LESSON_MODE,"Invalid lesson_mode vocab received from LMS","strLessonMode="+strLessonMode);return null}} +function SCORM2004_GetTakingForCredit(){var strCredit;WriteToDebug("In SCORM2004_GetTakingForCredit");SCORM2004_ClearErrorInfo();strCredit=SCORM2004_CallGetValue("cmi.credit");WriteToDebug("strCredit="+strCredit);if(strCredit=="credit"){WriteToDebug("Returning true");return true}else if(strCredit=="no-credit"){WriteToDebug("Returning false");return false}else{WriteToDebug("ERROR - invalid credit");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_CREDIT,"Invalid credit vocab received from LMS", +"strCredit="+strCredit);return null}} +function SCORM2004_SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore){var intObjectiveIndex;var blnResult;var fltNormalizedScore;intScore=RoundToPrecision(intScore,7);intMaxScore=RoundToPrecision(intMaxScore,7);intMinScore=RoundToPrecision(intMinScore,7);WriteToDebug("In SCORM2004_SetObjectiveScore, strObejctiveID="+strObjectiveID+", intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID); +WriteToDebug("intObjectiveIndex="+intObjectiveIndex);fltNormalizedScore=RoundToPrecision(intScore/100,7);blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".id",strObjectiveID);blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".score.raw",intScore)&&blnResult;blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".score.max",intMaxScore)&&blnResult;blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".score.min",intMinScore)&& +blnResult;blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".score.scaled",fltNormalizedScore)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM2004_SetObjectiveStatus(strObjectiveID,Lesson_Status){var intObjectiveIndex;var blnResult;var strSCORMSuccessStatus="";var strSCORMCompletionStatus="";WriteToDebug("In SCORM2004_SetObjectiveStatus strObjectiveID="+strObjectiveID+", Lesson_Status="+Lesson_Status);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);if(Lesson_Status==LESSON_STATUS_PASSED){strSCORMSuccessStatus=SCORM2004_PASSED; +strSCORMCompletionStatus=SCORM2004_COMPLETED}else if(Lesson_Status==LESSON_STATUS_FAILED){strSCORMSuccessStatus=SCORM2004_FAILED;strSCORMCompletionStatus=SCORM2004_COMPLETED}else if(Lesson_Status==LESSON_STATUS_COMPLETED){strSCORMSuccessStatus=SCORM2004_UNKNOWN;strSCORMCompletionStatus=SCORM2004_COMPLETED}else if(Lesson_Status==LESSON_STATUS_BROWSED){strSCORMSuccessStatus=SCORM2004_UNKNOWN;strSCORMCompletionStatus=SCORM2004_COMPLETED}else if(Lesson_Status==LESSON_STATUS_INCOMPLETE){strSCORMSuccessStatus= +SCORM2004_UNKNOWN;strSCORMCompletionStatus=SCORM2004_INCOMPLETE}else if(Lesson_Status==LESSON_STATUS_NOT_ATTEMPTED){strSCORMSuccessStatus=SCORM2004_UNKNOWN;strSCORMCompletionStatus=SCORM2004_NOT_ATTEMPTED}WriteToDebug("strSCORMSuccessStatus="+strSCORMSuccessStatus);WriteToDebug("strSCORMCompletionStatus="+strSCORMCompletionStatus);blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".id",strObjectiveID);blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".success_status", +strSCORMSuccessStatus)&&blnResult;blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".completion_status",strSCORMCompletionStatus)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM2004_SetObjectiveDescription(strObjectiveID,strObjectiveDescription){var intObjectiveIndex;WriteToDebug("In SCORM2004_SetObjectiveDescription strObjectiveID="+strObjectiveID+", strObjectiveDescription="+strObjectiveDescription);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);blnResult=SCORM2004_CallSetValue("cmi.objectives."+intObjectiveIndex+".id",strObjectiveID);blnResult=SCORM2004_CallSetValue("cmi.objectives."+ +intObjectiveIndex+".description",strObjectiveDescription)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM2004_GetObjectiveScore(strObjectiveID){var intObjectiveIndex;WriteToDebug("In SCORM2004_GetObjectiveScore, strObejctiveID="+strObjectiveID);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);return SCORM2004_CallGetValue("cmi.objectives."+intObjectiveIndex+".score.raw")} +function SCORM2004_GetObjectiveStatus(strObjectiveID){var intObjectiveIndex;var strSuccessStatus;var strCompletionStatus;WriteToDebug("In SCORM2004_GetObjectiveStatus, strObejctiveID="+strObjectiveID);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);strSuccessStatus=SCORM2004_CallGetValue("cmi.objectives."+intObjectiveIndex+".success_status");strCompletionStatus=SCORM2004_CallGetValue("cmi.objectives."+ +intObjectiveIndex+".completion_status");if(strSuccessStatus==SCORM2004_PASSED){WriteToDebug("returning Passed");return LESSON_STATUS_PASSED}else if(strSuccessStatus==SCORM2004_FAILED){WriteToDebug("Returning Failed");return LESSON_STATUS_FAILED}else if(strCompletionStatus==SCORM2004_COMPLETED){WriteToDebug("Returning Completed");return LESSON_STATUS_COMPLETED}else if(strCompletionStatus==SCORM2004_INCOMPLETE){WriteToDebug("Returning Incomplete");return LESSON_STATUS_INCOMPLETE}else if(strCompletionStatus== +SCORM2004_NOT_ATTEMPTED||strCompletionStatus==SCORM2004_UNKNOWN||strCompletionStatus==""){WriteToDebug("Returning Not Attempted");return LESSON_STATUS_NOT_ATTEMPTED}else{WriteToDebug("ERROR - status not found");SCORM2004_SetErrorInfoManually(SCORM2004_ERROR_INVALID_STATUS,"Invalid objective status received from LMS or initial status not yet recorded for objective","strCompletionStatus="+strCompletionStatus);return null}} +function SCORM2004_GetObjectiveProgressMeasure(strObjectiveID){var strProgressMeasure=SCORM2004_CallGetValue("cmi.objectives."+strObjectiveID+".progress_measure");return strProgressMeasure} +function SCORM2004_GetObjectiveDescription(strObjectiveID){var intObjectiveIndex;var strSuccessStatus;var strCompletionStatus;WriteToDebug("In SCORM2004_GetObjectiveDescription, strObejctiveID="+strObjectiveID);SCORM2004_ClearErrorInfo();intObjectiveIndex=SCORM2004_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);strDescription=SCORM2004_CallGetValue("cmi.objectives."+intObjectiveIndex+".description");return strDescription} +function SCORM2004_FindObjectiveIndexFromID(strObjectiveID){var intCount;var i;var strTempID;WriteToDebug("In SCORM2004_FindObjectiveIndexFromID");intCount=SCORM2004_CallGetValue("cmi.objectives._count");if(intCount==""){WriteToDebug("Setting intCount=0");return 0}intCount=parseInt(intCount,10);WriteToDebug("intCount="+intCount);for(i=0;icurrentIndexTimestamp){index=i;currentIndexTimestamp=dtmTempDate}}}if(index>=0)return index;WriteToDebug("Did not find match, returning null");return null} +function SCORM2004_GetInteractionType(strInteractionID){var intInteractionIndex;WriteToDebug("In SCORM2004_GetInteractionType, strInteractionID="+strInteractionID);SCORM2004_ClearErrorInfo();intInteractionIndex=SCORM2004_FindInteractionIndexFromID(strInteractionID);if(intInteractionIndex==undefined||intInteractionIndex==null)return null;WriteToDebug("intInteractionIndex="+intInteractionIndex);var type=SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".type");switch(type){case SCORM2004_INTERACTION_TYPE_FILL_IN:return INTERACTION_TYPE_FILL_IN; +case SCORM2004_INTERACTION_TYPE_LONG_FILL_IN:return INTERACTION_TYPE_LONG_FILL_IN;case SCORM2004_INTERACTION_TYPE_CHOICE:return INTERACTION_TYPE_CHOICE;case SCORM2004_INTERACTION_TYPE_LIKERT:return INTERACTION_TYPE_LIKERT;case SCORM2004_INTERACTION_TYPE_MATCHING:return INTERACTION_TYPE_MATCHING;case SCORM2004_INTERACTION_TYPE_NUMERIC:return INTERACTION_TYPE_NUMERIC;case SCORM2004_INTERACTION_TYPE_PERFORMANCE:return INTERACTION_TYPE_PERFORMANCE;case SCORM2004_INTERACTION_TYPE_SEQUENCING:return INTERACTION_TYPE_SEQUENCING; +case SCORM2004_INTERACTION_TYPE_TRUE_FALSE:return INTERACTION_TYPE_TRUE_FALSE;default:return""}} +function SCORM2004_GetInteractionTimestamp(strInteractionID){WriteToDebug("In SCORM2004_GetInteractionTimestamp, strInteractionID="+strInteractionID);var intInteractionIndex=SCORM2004_FindInteractionIndexFromID(strInteractionID);WriteToDebug("intInteractionIndex="+intInteractionIndex);SCORM2004_ClearErrorInfo();if(intInteractionIndex==undefined||intInteractionIndex==null)return null;return SCORM2004_CallGetValue(ConvertIso8601TimeStampToDate("cmi.interactions."+intInteractionIndex+".timestamp"))} +function SCORM2004_GetInteractionCorrectResponses(strInteractionID){WriteToDebug("In SCORM2004_GetInteractionCorrectResponses, strInteractionID="+strInteractionID);var intInteractionIndex=SCORM2004_FindInteractionIndexFromID(strInteractionID);WriteToDebug("intInteractionIndex="+intInteractionIndex);SCORM2004_ClearErrorInfo();if(intInteractionIndex==undefined||intInteractionIndex==null)return null;var strType=SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".type");var intCorrectResponseCount= +SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".correct_responses._count");if(intCorrectResponseCount==""){WriteToDebug("Setting intCorrectResponseCount=0");return 0}intCorrectResponseCount=parseInt(intCorrectResponseCount,10);WriteToDebug("intCorrectResponseCount="+intCorrectResponseCount);if(intCorrectResponseCount==0)return new Array;if(intCorrectResponseCount>1)WriteToDebug("SCORM Driver is not currently implemented to support multiple correct response combinations and will only return the first"); +var strResponse=new String(SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".correct_responses.0.pattern"));var aryResponse=strResponse.split("[,]");WriteToDebug("aryResponse.length = "+aryResponse.length);aryResponse=SCORM2004_ProcessResponseArray(strType,aryResponse);WriteToDebug("aryResponse.length = "+aryResponse.length);return aryResponse} +function SCORM2004_GetInteractionWeighting(strInteractionID){WriteToDebug("In SCORM2004_GetInteractionWeighting, strInteractionID="+strInteractionID);var intInteractionIndex=SCORM2004_FindInteractionIndexFromID(strInteractionID);WriteToDebug("intInteractionIndex="+intInteractionIndex);SCORM2004_ClearErrorInfo();if(intInteractionIndex==undefined||intInteractionIndex==null)return null;return SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".weighting")} +function SCORM2004_GetInteractionLearnerResponses(strInteractionID){WriteToDebug("In SCORM2004_GetInteractionLearnerResponses, strInteractionID="+strInteractionID);var intInteractionIndex=SCORM2004_FindInteractionIndexFromID(strInteractionID);WriteToDebug("intInteractionIndex="+intInteractionIndex);SCORM2004_ClearErrorInfo();if(intInteractionIndex==undefined||intInteractionIndex==null)return null;var strType=SCORM2004_CallGetValue("cmi.interactions."+intInteractionIndex+".type");var strResponse=new String(SCORM2004_CallGetValue("cmi.interactions."+ +intInteractionIndex+".learner_response"));var aryResponses=strResponse.split("[,]");WriteToDebug("aryResponses.length = "+aryResponses.length);aryResponses=SCORM2004_ProcessResponseArray(strType,aryResponses);return aryResponses} +function SCORM2004_ProcessResponseArray(strInteractionType,aryResponses){WriteToDebug("Processing Response Array with "+aryResponses.length+" pieces");for(var i=0;i4096){WriteToDebug("SCORM_SetDataChunk - suspend_data too large (4096 character limit for SCORM 1.2)");return false}else return SCORM_CallLMSSetValue("cmi.suspend_data",strData);else return SCORM_CallLMSSetValue("cmi.suspend_data",strData)} +function SCORM_GetLaunchData(){WriteToDebug("In SCORM_GetLaunchData");SCORM_ClearErrorInfo();return SCORM_CallLMSGetValue("cmi.launch_data")}function SCORM_GetComments(){WriteToDebug("In SCORM_GetComments");SCORM_ClearErrorInfo();return SCORM_CallLMSGetValue("cmi.comments")}function SCORM_WriteComment(strComment){WriteToDebug("In SCORM_WriteComment strComment="+strComment);SCORM_ClearErrorInfo();return SCORM_CallLMSSetValue("cmi.comments",strComment)} +function SCORM_GetLMSComments(){WriteToDebug("In SCORM_GetLMSComments");SCORM_ClearErrorInfo();return SCORM_CallLMSGetValue("cmi.comments_from_lms")} +function SCORM_GetAudioPlayPreference(){var intTempPreference;WriteToDebug("In SCORM_GetAudioPlayPreference");SCORM_ClearErrorInfo();intTempPreference=SCORM_CallLMSGetValue("cmi.student_preference.audio");if(intTempPreference=="")intTempPreference=0;intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference==0){WriteToDebug("Returning Default");return PREFERENCE_DEFAULT}else if(intTempPreference< +0){WriteToDebug("returning Off");return PREFERENCE_OFF}else{WriteToDebug("Error: Invalid preference");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null}} +function SCORM_GetAudioVolumePreference(){var intTempPreference;WriteToDebug("In SCORM_GetAudioVollumePreference");SCORM_ClearErrorInfo();intTempPreference=SCORM_CallLMSGetValue("cmi.student_preference.audio");WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference=="")intTempPreference=100;intTempPreference=parseInt(intTempPreference,10);if(intTempPreference<=0){WriteToDebug("Setting to 100");intTempPreference=100}if(!(intTempPreference>0&&intTempPreference<=100)){WriteToDebug("ERROR: invalid preference"); +SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null}WriteToDebug("Returning "+intTempPreference);return intTempPreference} +function SCORM_SetAudioPreference(PlayPreference,intPercentOfMaxVolume){WriteToDebug("In SCORM_SetAudioPreference PlayPreference="+PlayPreference+", intPercentOfMaxVolume="+intPercentOfMaxVolume);SCORM_ClearErrorInfo();if(PlayPreference==PREFERENCE_OFF){WriteToDebug("Setting percent to -1 - OFF");intPercentOfMaxVolume=-1}return SCORM_CallLMSSetValue("cmi.student_preference.audio",intPercentOfMaxVolume)} +function SCORM_SetLanguagePreference(strLanguage){WriteToDebug("In SCORM_SetLanguagePreference strLanguage="+strLanguage);SCORM_ClearErrorInfo();return SCORM_CallLMSSetValue("cmi.student_preference.language",strLanguage)}function SCORM_GetLanguagePreference(){WriteToDebug("In SCORM_GetLanguagePreference");SCORM_ClearErrorInfo();return SCORM_CallLMSGetValue("cmi.student_preference.language")} +function SCORM_SetSpeedPreference(intPercentOfMax){var intSCORMSpeed;WriteToDebug("In SCORM_SetSpeedPreference intPercentOfMax="+intPercentOfMax);SCORM_ClearErrorInfo();intSCORMSpeed=intPercentOfMax*2-100;WriteToDebug("intSCORMSpeed="+intSCORMSpeed);return SCORM_CallLMSSetValue("cmi.student_preference.speed",intSCORMSpeed)} +function SCORM_GetSpeedPreference(){var intSCORMSpeed;var intPercentOfMax;WriteToDebug("In SCORM_GetSpeedPreference");SCORM_ClearErrorInfo();intSCORMSpeed=SCORM_CallLMSGetValue("cmi.student_preference.speed");WriteToDebug("intSCORMSpeed="+intSCORMSpeed);if(intSCORMSpeed==""){WriteToDebug("Detected empty string, defaulting to 100");intSCORMSpeed=100}if(!ValidInteger(intSCORMSpeed)){WriteToDebug("ERROR - invalid integer");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer", +"intSCORMSpeed="+intSCORMSpeed);return null}intSCORMSpeed=parseInt(intSCORMSpeed,10);if(intSCORMSpeed<-100||intSCORMSpeed>100){WriteToDebug("ERROR - out of range");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range","intSCORMSpeed="+intSCORMSpeed);return null}intPercentOfMax=(intSCORMSpeed+100)/2;intPercentOfMax=parseInt(intPercentOfMax,10);WriteToDebug("Returning "+intPercentOfMax);return intPercentOfMax} +function SCORM_SetTextPreference(intPreference){WriteToDebug("In SCORM_SetTextPreference intPreference="+intPreference);SCORM_ClearErrorInfo();return SCORM_CallLMSSetValue("cmi.student_preference.text",intPreference)} +function SCORM_GetTextPreference(){var intTempPreference;WriteToDebug("In SCORM_GetTextPreference");SCORM_ClearErrorInfo();intTempPreference=SCORM_CallLMSGetValue("cmi.student_preference.text");intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference==0||intTempPreference==""){WriteToDebug("Returning Default");return PREFERENCE_DEFAULT}else if(intTempPreference< +0){WriteToDebug("returning Off");return PREFERENCE_OFF}else{WriteToDebug("Error: Invalid preference");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+intTempPreference);return null}} +function SCORM_GetPreviouslyAccumulatedTime(){var strCMITime;var intMilliseconds;WriteToDebug("In SCORM_GetPreviouslyAccumulatedTime");SCORM_ClearErrorInfo();strCMITime=SCORM_CallLMSGetValue("cmi.core.total_time");WriteToDebug("strCMITime="+strCMITime);if(!IsValidCMITimeSpan(strCMITime)){WriteToDebug("ERROR - Invalid CMITimeSpan");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+strCMITime);return null}intMilliseconds=ConvertCMITimeSpanToMS(strCMITime); +WriteToDebug("Returning "+intMilliseconds);return intMilliseconds}function SCORM_SaveTime(intMilliSeconds){var strCMITime;WriteToDebug("In SCORM_SaveTime intMilliSeconds="+intMilliSeconds);SCORM_ClearErrorInfo();strCMITime=ConvertMilliSecondsToSCORMTime(intMilliSeconds,true);WriteToDebug("strCMITime="+strCMITime);return SCORM_CallLMSSetValue("cmi.core.session_time",strCMITime)} +function SCORM_GetMaxTimeAllowed(){var strCMITime;var intMilliseconds;WriteToDebug("In SCORM_GetMaxTimeAllowed");SCORM_ClearErrorInfo();strCMITime=SCORM_CallLMSGetValue("cmi.student_data.max_time_allowed");WriteToDebug("strCMITime="+strCMITime);if(strCMITime=="")strCMITime="9999:99:99.99";if(!IsValidCMITimeSpan(strCMITime)){WriteToDebug("ERROR - Invalid CMITimeSpan");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,"Invalid timespan received from LMS","strTime="+strCMITime);return null}intMilliseconds= +ConvertCMITimeSpanToMS(strCMITime);WriteToDebug("intMilliseconds="+intMilliseconds);return intMilliseconds} +function SCORM_DisplayMessageOnTimeout(){var strTLA;SCORM_ClearErrorInfo();WriteToDebug("In SCORM_DisplayMessageOnTimeout");strTLA=SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");WriteToDebug("strTLA="+strTLA);if(strTLA==SCORM_TLA_EXIT_MESSAGE||strTLA==SCORM_TLA_CONTINUE_MESSAGE){WriteToDebug("returning true");return true}else if(strTLA==SCORM_TLA_EXIT_NO_MESSAGE||strTLA==SCORM_TLA_CONTINUE_NO_MESSAGE||strTLA==""){WriteToDebug("returning false");return false}else{WriteToDebug("Error invalid TLA"); +SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS","strTLA="+strTLA);return null}} +function SCORM_ExitOnTimeout(){var strTLA;WriteToDebug("In SCORM_ExitOnTimeout");SCORM_ClearErrorInfo();strTLA=SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");WriteToDebug("strTLA="+strTLA);if(strTLA==SCORM_TLA_EXIT_MESSAGE||strTLA==SCORM_TLA_EXIT_NO_MESSAGE){WriteToDebug("returning true");return true}else if(strTLA==SCORM_TLA_CONTINUE_MESSAGE||strTLA==SCORM_TLA_CONTINUE_NO_MESSAGE||strTLA==""){WriteToDebug("returning false");return false}else{WriteToDebug("ERROR invalid TLA");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION, +"Invalid time limit action received from LMS","strTLA="+strTLA);return null}} +function SCORM_GetPassingScore(){var fltScore;WriteToDebug("In SCORM_GetPassingScore");SCORM_ClearErrorInfo();fltScore=SCORM_CallLMSGetValue("cmi.student_data.mastery_score");WriteToDebug("fltScore="+fltScore);if(fltScore=="")fltScore=0;if(!IsValidDecimal(fltScore)){WriteToDebug("Error - score is not a valid decimal");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_DECIMAL,"Invalid mastery score received from LMS","fltScore="+fltScore);return null}fltScore=parseFloat(fltScore);WriteToDebug("returning fltScore"); +return fltScore} +function SCORM_SetScore(intScore,intMaxScore,intMinScore){var blnResult;intScore=RoundToPrecision(intScore,7);intMaxScore=RoundToPrecision(intMaxScore,7);intMinScore=RoundToPrecision(intMinScore,7);WriteToDebug("In SCORM_SetScore intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);SCORM_ClearErrorInfo();blnResult=SCORM_CallLMSSetValue("cmi.core.score.raw",intScore);blnResult=SCORM_CallLMSSetValue("cmi.core.score.max",intMaxScore)&&blnResult;blnResult=SCORM_CallLMSSetValue("cmi.core.score.min",intMinScore)&& +blnResult;WriteToDebug("Returning "+blnResult);return blnResult}function SCORM_GetScore(){WriteToDebug("In SCORM_GetScore");SCORM_ClearErrorInfo();return SCORM_CallLMSGetValue("cmi.core.score.raw")}function SCORM_SetPointBasedScore(intScore,intMaxScore,intMinScore){WriteToDebug("SCORM_SetPointBasedScore - SCORM 1.1 and 1.2 do not support SetPointBasedScore, falling back to SetScore");return SCORM_SetScore(intScore,intMaxScore,intMinScore)} +function SCORM_GetScaledScore(intScore,intMaxScore,intMinScore){WriteToDebug("SCORM_GetScaledScore - SCORM 1.1 and 1.2 do not support GetScaledScore, returning false");return false} +function SCORM_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,scormInteractionType,strAlternateResponse,strAlternateCorrectResponse){var blnResult;var blnTempResult;var intInteractionIndex;var strResult;SCORM_ClearErrorInfo();intInteractionIndex=SCORM_CallLMSGetValue("cmi.interactions._count");WriteToDebug("intInteractionIndex="+intInteractionIndex);if(intInteractionIndex==""){WriteToDebug("Setting Interaction Index to 0"); +intInteractionIndex=0}if(IsNumeric(blnCorrect))strResult=blnCorrect;else if(blnCorrect==true||blnCorrect==INTERACTION_RESULT_CORRECT)strResult=SCORM_RESULT_CORRECT;else if(blnCorrect==""||blnCorrect=="false"||blnCorrect==INTERACTION_RESULT_WRONG)strResult=SCORM_RESULT_WRONG;else if(blnCorrect==INTERACTION_RESULT_UNANTICIPATED)strResult=SCORM_RESULT_UNANTICIPATED;else if(blnCorrect==INTERACTION_RESULT_NEUTRAL)strResult=SCORM_RESULT_NEUTRAL;WriteToDebug("strResult="+strResult);blnResult=SCORM_CallLMSSetValue("cmi.interactions."+ +intInteractionIndex+".id",strID);blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".type",scormInteractionType)&&blnResult;if(strResponse!==null){blnTempResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".student_response",strResponse);if(blnTempResult==false&&strAlternateResponse!==null)blnTempResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".student_response",strAlternateResponse)}blnResult=blnResult&&blnTempResult;if(strCorrectResponse!= +undefined&&strCorrectResponse!=null&&strCorrectResponse!=""){blnTempResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".correct_responses.0.pattern",strCorrectResponse);if(blnTempResult==false)blnTempResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".correct_responses.0.pattern",strAlternateCorrectResponse);blnResult=blnResult&&blnTempResult}if(strResult!=undefined&&strResult!=null&&strResult!="")blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+ +".result",strResult)&&blnResult;if(intWeighting!=undefined&&intWeighting!=null&&intWeighting!="")blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".weighting",intWeighting)&&blnResult;if(intLatency!=undefined&&intLatency!=null&&intLatency!="")blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".latency",ConvertMilliSecondsToSCORMTime(intLatency,true))&&blnResult;if(strLearningObjectiveID!=undefined&&strLearningObjectiveID!=null&&strLearningObjectiveID!= +"")blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".objectives.0.id",strLearningObjectiveID)&&blnResult;blnResult=SCORM_CallLMSSetValue("cmi.interactions."+intInteractionIndex+".time",ConvertDateToCMITime(dtmTime))&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM_RecordTrueFalseInteraction(strID,blnResponse,blnCorrect,blnCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordTrueFalseInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strCorrectResponse=null;if(blnResponse==true)strResponse="t";else if(blnResponse!==null)strResponse="f";if(blnCorrectResponse==true)strCorrectResponse="t";else if(blnCorrectResponse==false)strCorrectResponse="f";return SCORM_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_TRUE_FALSE,strResponse,strCorrectResponse)} +function SCORM_RecordMultipleChoiceInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordMultipleChoiceInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strResponseLong=null;var strCorrectResponse="";var strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+=aryResponse[i].Short;strResponseLong+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+=",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+= +",";strCorrectResponse+=aryCorrectResponse[i].Short;strCorrectResponseLong+=aryCorrectResponse[i].Long}var blnSuccessfullySaved;blnSuccessfullySaved=SCORM_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_CHOICE,strResponse,strCorrectResponse);return blnSuccessfullySaved} +function SCORM_RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);strResponse=new String(strResponse); +if(strResponse.length>255)strResponse=strResponse.substr(0,255);if(strCorrectResponse==null)strCorrectResponse="";strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255);return SCORM_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_FILL_IN,strResponse,strCorrectResponse)} +function SCORM_RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordMatchingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strResponseLong=null;var strCorrectResponse="";var strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+=aryResponse[i].Source.Short+"."+aryResponse[i].Target.Short;strResponseLong+=aryResponse[i].Source.Long+"."+aryResponse[i].Target.Long}}for(var i=0;i0)strCorrectResponse+= +",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+=",";strCorrectResponse+=aryCorrectResponse[i].Source.Short+"."+aryCorrectResponse[i].Target.Short;strCorrectResponseLong+=aryCorrectResponse[i].Source.Long+"."+aryCorrectResponse[i].Target.Long}var blnSuccessfullySaved;blnSuccessfullySaved=SCORM_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_MATCHING,strResponse,strCorrectResponse); +return blnSuccessfullySaved} +function SCORM_RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strResponse!== +null){strResponse=new String(strResponse);if(strResponse.length>255)strResponse=strResponse.substr(0,255)}if(strCorrectResponse==null)strCorrectResponse="";strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255);return SCORM_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_PERFORMANCE,strResponse,strCorrectResponse)} +function SCORM_RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordSequencingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null;var strResponseLong=null;var strCorrectResponse="";var strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+=aryResponse[i].Short;strResponseLong+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+=",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+= +",";strCorrectResponse+=aryCorrectResponse[i].Short;strCorrectResponseLong+=aryCorrectResponse[i].Long}var blnSuccessfullySaved;blnSuccessfullySaved=SCORM_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_SEQUENCING,strResponse,strCorrectResponse);return blnSuccessfullySaved} +function SCORM_RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse=null;var strResponseLong= +null;var strCorrectResponse="";var strCorrectResponseLong="";if(response!==null){strResponse=response.Short;strResponseLong=response.Long}if(correctResponse!=null){strCorrectResponse=correctResponse.Short;strCorrectResponseLong=correctResponse.Long}var blnSuccessfullySaved;blnSuccessfullySaved=SCORM_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_LIKERT,strResponse,strCorrectResponse); +return blnSuccessfullySaved} +function SCORM_RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In SCORM_RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strCorrectResponse!= +undefined&&strCorrectResponse!=null){if(IsValidDecimalRange(strCorrectResponse))strCorrectResponse=ConvertDecimalRangeToDecimalBasedOnLearnerResponse(strCorrectResponse,strResponse,blnCorrect);if(!IsValidDecimal(strCorrectResponse)){WriteToDebug("Returning False - SCORM_RecordNumericInteraction received invalid correct response (not a decimal), strCorrectResponse="+strCorrectResponse);return false}}return SCORM_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting, +intLatency,strLearningObjectiveID,dtmTime,SCORM_INTERACTION_TYPE_NUMERIC,strResponse,strCorrectResponse)} +function SCORM_GetEntryMode(){var strEntry;WriteToDebug("In SCORM_GetEntryMode");SCORM_ClearErrorInfo();strEntry=SCORM_CallLMSGetValue("cmi.core.entry");WriteToDebug("strEntry="+strEntry);if(strEntry==SCORM_ENTRY_ABINITIO){WriteToDebug("Returning first time");return ENTRY_FIRST_TIME}else if(strEntry==SCORM_ENTRY_RESUME){WriteToDebug("Returning resume");return ENTRY_RESUME}else if(strEntry==SCORM_ENTRY_NORMAL){WriteToDebug("returning normal");return ENTRY_REVIEW}else{WriteToDebug("ERROR - invalide entry mode"); +SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_ENTRY,"Invalid entry vocab received from LMS","strEntry="+strEntry);return null}} +function SCORM_GetLessonMode(){var strLessonMode;WriteToDebug("In SCORM_GetLessonMode");SCORM_ClearErrorInfo();strLessonMode=SCORM_CallLMSGetValue("cmi.core.lesson_mode");WriteToDebug("strLessonMode="+strLessonMode);if(strLessonMode==SCORM_BROWSE){WriteToDebug("Returning browse");return MODE_BROWSE}else if(strLessonMode==SCORM_NORMAL){WriteToDebug("returning normal");return MODE_NORMAL}else if(strLessonMode==SCORM_REVIEW){WriteToDebug("Returning Review");return MODE_REVIEW}else{WriteToDebug("ERROR - invalid lesson mode"); +SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_LESSON_MODE,"Invalid lesson_mode vocab received from LMS","strLessonMode="+strLessonMode);return null}} +function SCORM_GetTakingForCredit(){var strCredit;WriteToDebug("In SCORM_GetTakingForCredit");SCORM_ClearErrorInfo();strCredit=SCORM_CallLMSGetValue("cmi.core.credit");WriteToDebug("strCredit="+strCredit);if(strCredit=="credit"){WriteToDebug("Returning true");return true}else if(strCredit=="no-credit"){WriteToDebug("Returning false");return false}else{WriteToDebug("ERROR - invalid credit");SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_CREDIT,"Invalid credit vocab received from LMS","strCredit="+ +strCredit);return null}} +function SCORM_SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore){var intObjectiveIndex;var blnResult;intScore=RoundToPrecision(intScore,7);intMaxScore=RoundToPrecision(intMaxScore,7);intMinScore=RoundToPrecision(intMinScore,7);WriteToDebug("In SCORM_SetObjectiveScore, strObejctiveID="+strObjectiveID+", intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);SCORM_ClearErrorInfo();intObjectiveIndex=SCORM_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+ +intObjectiveIndex);blnResult=SCORM_CallLMSSetValue("cmi.objectives."+intObjectiveIndex+".id",strObjectiveID);blnResult=SCORM_CallLMSSetValue("cmi.objectives."+intObjectiveIndex+".score.raw",intScore)&&blnResult;blnResult=SCORM_CallLMSSetValue("cmi.objectives."+intObjectiveIndex+".score.max",intMaxScore)&&blnResult;blnResult=SCORM_CallLMSSetValue("cmi.objectives."+intObjectiveIndex+".score.min",intMinScore)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM_SetObjectiveDescription(strObjectiveID,strObjectiveDescription){var intObjectiveIndex;var blnResult;WriteToDebug("In SCORM_SetObjectiveDescription, strObjectiveDescription="+strObjectiveDescription);WriteToDebug("Objective Descriptions are not supported prior to SCORM 2004");SCORM_ClearErrorInfo();blnResult=SCORM_TRUE;WriteToDebug("Returning "+blnResult);return blnResult} +function SCORM_SetObjectiveStatus(strObjectiveID,Lesson_Status){var intObjectiveIndex;var blnResult;var strSCORMStatus="";WriteToDebug("In SCORM_SetObjectiveStatus strObjectiveID="+strObjectiveID+", Lesson_Status="+Lesson_Status);SCORM_ClearErrorInfo();intObjectiveIndex=SCORM_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);if(Lesson_Status==LESSON_STATUS_PASSED)strSCORMStatus=SCORM_PASSED;else if(Lesson_Status==LESSON_STATUS_FAILED)strSCORMStatus=SCORM_FAILED; +else if(Lesson_Status==LESSON_STATUS_COMPLETED)strSCORMStatus=SCORM_COMPLETED;else if(Lesson_Status==LESSON_STATUS_BROWSED)strSCORMStatus=SCORM_BROWSED;else if(Lesson_Status==LESSON_STATUS_INCOMPLETE)strSCORMStatus=SCORM_INCOMPLETE;else if(Lesson_Status==LESSON_STATUS_NOT_ATTEMPTED)strSCORMStatus=SCORM_NOT_ATTEMPTED;WriteToDebug("strSCORMStatus="+strSCORMStatus);blnResult=SCORM_CallLMSSetValue("cmi.objectives."+intObjectiveIndex+".id",strObjectiveID);blnResult=SCORM_CallLMSSetValue("cmi.objectives."+ +intObjectiveIndex+".status",strSCORMStatus)&&blnResult;WriteToDebug("Returning "+blnResult);return blnResult}function SCORM_GetObjectiveScore(strObjectiveID){var intObjectiveIndex;WriteToDebug("In SCORM_GetObjectiveScore, strObejctiveID="+strObjectiveID);SCORM_ClearErrorInfo();intObjectiveIndex=SCORM_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);return SCORM_CallLMSGetValue("cmi.objectives."+intObjectiveIndex+".score.raw")} +function SCORM_GetObjectiveDescription(strObjectiveID){WriteToDebug("In SCORM_GetObjectiveDescription, strObejctiveID="+strObjectiveID);WriteToDebug("ObjectiveDescription is not supported prior to SCORM 2004");return""} +function SCORM_GetObjectiveStatus(strObjectiveID){var intObjectiveIndex;var strStatus;WriteToDebug("In SCORM_GetObjectiveStatus, strObejctiveID="+strObjectiveID);SCORM_ClearErrorInfo();intObjectiveIndex=SCORM_FindObjectiveIndexFromID(strObjectiveID);WriteToDebug("intObjectiveIndex="+intObjectiveIndex);strStatus=SCORM_CallLMSGetValue("cmi.objectives."+intObjectiveIndex+".status");if(strStatus==SCORM_PASSED){WriteToDebug("returning Passed");return LESSON_STATUS_PASSED}else if(strStatus==SCORM_FAILED){WriteToDebug("Returning Failed"); +return LESSON_STATUS_FAILED}else if(strStatus==SCORM_COMPLETED){WriteToDebug("Returning Completed");return LESSON_STATUS_COMPLETED}else if(strStatus==SCORM_BROWSED){WriteToDebug("Returning Browsed");return LESSON_STATUS_BROWSED}else if(strStatus==SCORM_INCOMPLETE){WriteToDebug("Returning Incomplete");return LESSON_STATUS_INCOMPLETE}else if(strStatus==SCORM_NOT_ATTEMPTED||strStatus==""){WriteToDebug("Returning Not Attempted");return LESSON_STATUS_NOT_ATTEMPTED}else{WriteToDebug("ERROR - status not found"); +SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_STATUS,"Invalid objective status received from LMS or initial status not yet recorded for objective","strStatus="+strStatus);return null}} +function SCORM_FindObjectiveIndexFromID(strObjectiveID){var intCount;var i;var strTempID;WriteToDebug("In SCORM_FindObjectiveIndexFromID");intCount=SCORM_CallLMSGetValue("cmi.objectives._count");if(intCount==""){WriteToDebug("Setting intCount=0");return 0}intCount=parseInt(intCount,10);WriteToDebug("intCount="+intCount);for(i=0;i0){WriteToDebug("Saving Interactions");KillTime();AICC_SendInteractions()}ClearDirtyAICCData()}return true} +function KillTime(){WriteToDebug("In KillTime");if(USE_AICC_KILL_TIME===false){WriteToDebug("Configuration disallows use of KillTime, exiting");return}var start=new Date;if(window.AICCComm.blnCanUseXMLHTTP==false)if(window.AICCComm.blnXMLHTTPIsAvailable==true){var numBlankRequests=3;for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+= +aryResponse[i].Short.replace(",","");strResponseLong+=aryResponse[i].Long.replace(",","")}for(var i=0;i0)strCorrectResponse+=",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+=",";strCorrectResponse+=aryCorrectResponse[i].Short.replace(",","");strCorrectResponseLong+=aryCorrectResponse[i].Long.replace(",","")}aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]= +blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_CHOICE;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]=strResponseLong;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponseLong;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+ +intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In AICC_RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions; +var aryData=new Array(10);intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";if(strResponse===null)strResponse="";if(strCorrectResponse==null||strCorrectResponse==undefined)strCorrectResponse="";strResponse=new String(strResponse);if(strResponse.length>255)strResponse=strResponse.substr(0,255);strCorrectResponse=new String(strCorrectResponse); +if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255);aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]=blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_FILL_IN;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]= +strResponse;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponse;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In AICC_RecordMatchingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions; +var aryData=new Array(10);intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";var strResponse="";var strResponseLong="";var strCorrectResponse="";var strCorrectResponseLong="";if(aryResponse!==null)for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+= +aryResponse[i].Source.Short.replace(",","").replace(".","")+"."+aryResponse[i].Target.Short.replace(",","").replace(".","");strResponseLong+=aryResponse[i].Source.Long.replace(",","").replace(".","")+"."+aryResponse[i].Target.Long.replace(",","").replace(".","")}for(var i=0;i0)strCorrectResponse+=",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+=",";if(aryCorrectResponse[i].Source.Short!=""&&aryCorrectResponse[i].Source.Long!= +""){strCorrectResponse+=aryCorrectResponse[i].Source.Short.replace(",","").replace(".","")+"."+aryCorrectResponse[i].Target.Short.replace(",","").replace(".","");strCorrectResponseLong+=aryCorrectResponse[i].Source.Long.replace(",","").replace(".","")+"."+aryCorrectResponse[i].Target.Long.replace(",","").replace(".","")}}aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]=blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse; +aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_MATCHING;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]=strResponseLong;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponseLong;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In AICC_RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions; +var aryData=new Array(10);intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";if(strResponse===null)strResponse="";if(strCorrectResponse==null||strCorrectResponse==undefined)strCorrectResponse="";strResponse=new String(strResponse);if(strResponse.length>255)strResponse=strResponse.substr(0,255);strCorrectResponse=new String(strCorrectResponse); +if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255);aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]=blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_PERFORMANCE;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]= +strResponse;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponse;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In AICC_RecordSequencingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions; +var aryData=new Array(10);intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";var strResponse="";var strResponseLong="";var strCorrectResponse="";var strCorrectResponseLong="";if(aryResponse!==null)for(var i=0;i0)strResponse+=",";if(strResponseLong.length>0)strResponseLong+=",";strResponse+= +aryResponse[i].Short.replace(",","");strResponseLong+=aryResponse[i].Long.replace(",","")}for(var i=0;i0)strCorrectResponse+=",";if(strCorrectResponseLong.length>0)strCorrectResponseLong+=",";strCorrectResponse+=aryCorrectResponse[i].Short.replace(",","");strCorrectResponseLong+=aryCorrectResponse[i].Long.replace(",","")}aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]= +blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_SEQUENCING;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]=strResponseLong;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponseLong;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+ +intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions;var aryData=new Array(10); +intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";var strResponse="";var strResponseLong="";if(response!==null){strResponse=response.Short;strResponseLong=response.Long}var strCorrectResponse="";var strCorrectResponseLong="";if(correctResponse!=null){strCorrectResponse=correctResponse.Short;strCorrectResponseLong=correctResponse.Long}aryData[AICC_INTERACTIONS_ID]= +strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]=blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]=AICC_INTERACTION_TYPE_LIKERT;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]=strResponseLong;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponseLong;AICC_aryInteractions[intTotalInteractions]= +aryData;WriteToDebug("Added to interactions array, index="+intTotalInteractions);SetDirtyAICCData();return true} +function AICC_RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In AICC_RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var intTotalInteractions; +var aryData=new Array(10);intTotalInteractions=AICC_aryInteractions.length;if(intWeighting==null||intWeighting==undefined)intWeighting="";if(intLatency==null||intLatency==undefined)intLatency="";if(blnCorrect==null||blnCorrect==undefined)blnCorrect="";if(strResponse===null)strResponse="";if(strCorrectResponse!=undefined&&strCorrectResponse!=null){if(IsValidDecimalRange(strCorrectResponse))strCorrectResponse=ConvertDecimalRangeToDecimalBasedOnLearnerResponse(strCorrectResponse,strResponse,blnCorrect); +if(!IsValidDecimal(strCorrectResponse)){WriteToDebug("Returning False - AICC_RecordNumericInteraction received invalid correct response (not a decimal), strCorrectResponse="+strCorrectResponse);return false}}else strCorrectResponse="";aryData[AICC_INTERACTIONS_ID]=strID;aryData[AICC_INTERACTIONS_RESPONSE]=strResponse;aryData[AICC_INTERACTIONS_CORRECT]=blnCorrect;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE]=strCorrectResponse;aryData[AICC_INTERACTIONS_TIME_STAMP]=dtmTime;aryData[AICC_INTERACTIONS_TYPE]= +AICC_INTERACTION_TYPE_NUMERIC;aryData[AICC_INTERACTIONS_WEIGHTING]=intWeighting;aryData[AICC_INTERACTIONS_LATENCY]=intLatency;aryData[AICC_INTERACTIONS_RESPONSE_LONG]=strResponse;aryData[AICC_INTERACTIONS_CORRECT_RESPONSE_LONG]=strCorrectResponse;AICC_aryInteractions[intTotalInteractions]=aryData;WriteToDebug("Added to interactions array, index="+intTotalInteractions);SetDirtyAICCData();return true} +function AICC_GetEntryMode(){WriteToDebug("In AICC_GetEntryMode, Returning "+AICC_Entry);return AICC_Entry}function AICC_GetLessonMode(){WriteToDebug("In AICC_GetLessonMode, Returning "+AICC_strLessonMode);return AICC_strLessonMode}function AICC_GetTakingForCredit(){WriteToDebug("In AICC_GetTakingForCredit, Returning "+AICC_blnCredit);return AICC_blnCredit} +function AICC_SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore){WriteToDebug("In AICC_SetObjectiveScore, strObjectiveID="+strObjectiveID+", intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);var intNextID;var intObjIndex;var strAICCScore="";intObjIndex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesRead);if(intObjIndex!=null){WriteToDebug("Found read objective");AICC_aryObjectivesRead[intObjIndex][AICC_OBJ_ARRAY_SCORE]=intScore}else{WriteToDebug("Adding new read objective"); +intNextID=AICC_aryObjectivesRead.length;AICC_aryObjectivesRead[parseInt(intNextID,10)]=new Array(3);AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_ID]=strObjectiveID;AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_SCORE]=intScore;AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_STATUS]=""}intObjIndex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesWrite);if(intObjIndex!=null){WriteToDebug("Found write objective");AICC_aryObjectivesWrite[intObjIndex][AICC_OBJ_ARRAY_SCORE]= +intScore}else{WriteToDebug("Adding new write objective");intNextID=AICC_aryObjectivesWrite.length;AICC_aryObjectivesWrite[parseInt(intNextID,10)]=new Array(3);strAICCScore=intScore;if(AICC_LMS_Version<3&&strAICCScore!="")strAICCScore=parseInt(strAICCScore,10);if((AICC_REPORT_MIN_MAX_SCORE===undefined||AICC_REPORT_MIN_MAX_SCORE===null||AICC_REPORT_MIN_MAX_SCORE===true)&&AICC_LMS_Version>=3)if(intMaxScore!=""||intMinScore!=""){WriteToDebug("Appending Max and Min scores");strAICCScore+=","+intMaxScore+ +","+intMinScore}AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_ID]=strObjectiveID;AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_SCORE]=strAICCScore;AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_STATUS]=""}SetDirtyAICCData();return true} +function AICC_SetObjectiveStatus(strObjectiveID,Lesson_Status){WriteToDebug("In AICC_SetObjectiveStatus, strObjectiveID="+strObjectiveID+", Lesson_Status="+Lesson_Status);var intNextID;var intObjIdex;intObjIdex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesRead);if(intObjIdex!=null){WriteToDebug("Found read objective");AICC_aryObjectivesRead[intObjIdex][AICC_OBJ_ARRAY_STATUS]=Lesson_Status}else{WriteToDebug("Adding new read objective");intNextID=AICC_aryObjectivesRead.length;AICC_aryObjectivesRead[parseInt(intNextID, +10)]=new Array(3);AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_ID]=strObjectiveID;AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_STATUS]=Lesson_Status;AICC_aryObjectivesRead[parseInt(intNextID,10)][AICC_OBJ_ARRAY_SCORE]=""}intObjIdex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesWrite);if(intObjIdex!=null){WriteToDebug("Found write objective");AICC_aryObjectivesWrite[intObjIdex][AICC_OBJ_ARRAY_STATUS]=Lesson_Status}else{WriteToDebug("Adding new write objective"); +intNextID=AICC_aryObjectivesWrite.length;AICC_aryObjectivesWrite[parseInt(intNextID,10)]=new Array(3);AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_ID]=strObjectiveID;AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_STATUS]=Lesson_Status;AICC_aryObjectivesWrite[parseInt(intNextID,10)][AICC_OBJ_ARRAY_SCORE]=""}SetDirtyAICCData();return true} +function AICC_SetObjectiveDescription(strObjectiveID,strObjectiveDescription){WriteToDebug("In AICC_SetObjectiveDescription, strObjectiveID="+strObjectiveID+", strObjectiveDescription="+strObjectiveDescription);WriteToDebug("Objective descriptions are not supported prior to SCORM 2004");return true} +function AICC_GetObjectiveScore(strObjectiveID){WriteToDebug("In AICC_SetObjectiveScore, strObjectiveID="+strObjectiveID);var intObjIndex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesRead);if(intObjIndex!=null){WriteToDebug("Found objective, returning "+AICC_aryObjectivesRead[intObjIndex][AICC_OBJ_ARRAY_SCORE]);return AICC_aryObjectivesRead[intObjIndex][AICC_OBJ_ARRAY_SCORE]}else{WriteToDebug("Did not find objective, returning ''");return""}} +function AICC_GetObjectiveDescription(strObjectiveID){WriteToDebug("In AICC_GetObjectiveDescription, strObjectiveID="+strObjectiveID);WriteToDebug("Objective descriptions are not supported prior to SCORM 2004");return""} +function AICC_GetObjectiveStatus(strObjectiveID){WriteToDebug("In AICC_SetObjectiveStatus, strObjectiveID="+strObjectiveID);var intObjIndex=FindObjectiveById(strObjectiveID,AICC_aryObjectivesRead);if(intObjIndex!=null){WriteToDebug("Found objective, returning "+AICC_aryObjectivesRead[intObjIndex][AICC_OBJ_ARRAY_STATUS]);return AICC_aryObjectivesRead[intObjIndex][AICC_OBJ_ARRAY_STATUS]}else{WriteToDebug("Did not find objective, returning "+LESSON_STATUS_NOT_ATTEMPTED);return LESSON_STATUS_NOT_ATTEMPTED}} +function AICC_SetFailed(){WriteToDebug("In AICC_SetFailed, Returning true");AICC_Status=LESSON_STATUS_FAILED;SetDirtyAICCData();return true}function AICC_SetPassed(){WriteToDebug("In AICC_SetPassed, Returning true");AICC_Status=LESSON_STATUS_PASSED;SetDirtyAICCData();return true}function AICC_SetCompleted(){WriteToDebug("In AICC_SetCompleted, Returning true");AICC_Status=LESSON_STATUS_COMPLETED;SetDirtyAICCData();return true} +function AICC_ResetStatus(){WriteToDebug("In AICC_ResetStatus, Returning true");AICC_Status=LESSON_STATUS_INCOMPLETE;SetDirtyAICCData();return true}function AICC_GetStatus(){WriteToDebug("In AICC_GetStatus, Returning "+AICC_Status);return AICC_Status}function AICC_GetProgressMeasure(){WriteToDebug("AICC_GetProgressMeasure - AICC does not support progress_measure, returning false");return false} +function AICC_SetProgressMeasure(){WriteToDebug("AICC_SetProgressMeasure - AICC does not support progress_measure, returning false");return false}function AICC_GetObjectiveProgressMeasure(){WriteToDebug("AICC_GetObjectiveProgressMeasure - AICC does not support progress_measure, returning false");return false}function AICC_SetObjectiveProgressMeasure(){WriteToDebug("AICC_SetObjectiveProgressMeasure - AICC does not support progress_measure, returning false");return false} +function AICC_SetPointBasedScore(intScore,intMaxScore,intMinScore){WriteToDebug("AICC_SetPointBasedScore - AICC does not support SetPointBasedScore, falling back to SetScore");return AICC_SetScore(intScore,intMaxScore,intMinScore)}function AICC_GetScaledScore(intScore,intMaxScore,intMinScore){WriteToDebug("AICC_GetScaledScore - AICC does not support GetScaledScore, returning false");return false} +function AICC_GetLastError(){WriteToDebug("In AICC_GetLastError, Returning "+intAICCErrorNum);return intAICCErrorNum}function AICC_GetLastErrorDesc(){WriteToDebug("In AICC_GetLastErrorDesc, Returning '"+strAICCErrorDesc+"'");return strAICCErrorDesc}function AICC_PutParamFailed(){WriteToDebug("ERROR: In AICC_PutParamFailed");SetDirtyAICCData();return} +function AICC_PutInteractionsFailed(){WriteToDebug("ERROR: In AICC_PutInteractionsFailed");SetDirtyAICCData();if(parent.blnUseLongInteractionResultValues==true){parent.blnUseLongInteractionResultValues=false;parent.AICC_CommitData()}return} +function AICC_SetErrorInfo(strErrorNumLine,strErrorDescLine){WriteToDebug("ERROR: In AICC_SetErrorInfo, strErrorNumLine="+strErrorNumLine+", strErrorDescLine="+strErrorDescLine);if(strErrorNumLine.toLowerCase().search(/error\s*=\s*0/)==-1){WriteToDebug("Detected No Error");intAICCErrorNum=NO_ERROR;strAICCErrorDesc=""}else{WriteToDebug("Setting Error Info");AICC_SetError(GetValueFromAICCLine(strAICCErrorLine),GetValueFromAICCLine(strAICCErrorDesc))}} +function AICC_SetError(intErrorNum,strErrorDesc){WriteToDebug("ERROR: In AICC_SetError, intErrorNum="+intErrorNum+", strErrorDesc="+strErrorDesc);intAICCErrorNum=intErrorNum;strAICCErrorDesc=strAICCErrorDesc}function SetDirtyAICCData(){WriteToDebug("In SetDirtyAICCData");blnDirtyAICCData=true}function ClearDirtyAICCData(){WriteToDebug("In ClearDirtyAICCData");blnDirtyAICCData=false} +function IsThereDirtyAICCData(){WriteToDebug("In IsThereDirtyAICCData, returning "+blnDirtyAICCData);return blnDirtyAICCData} +function GetValueFromAICCLine(strLine){WriteToDebug("In GetValueFromAICCLine, strLine="+strLine);var intPos;var strValue="";var strTemp;strLine=new String(strLine);intPos=strLine.indexOf("=");WriteToDebug("intPos="+intPos);if(intPos>-1&&intPos+1-1&&intPos-1){WriteToDebug("Replacing []");strTemp=strLine.replace(/[\[|\]]/g,"");WriteToDebug("strTemp="+strTemp);strTemp=strTemp.replace(/^\s*/,"");strTemp=strTemp.replace(/\s*$/,"");strName=strTemp}}WriteToDebug("returning "+strName);return strName} +function GetIndexFromAICCName(strLineName){WriteToDebug("In GetIndexFromAICCName, strLineName="+strLineName);var intPos;var strIndex="";var strTemp="";strLine=new String(strLineName);intPos=strLine.indexOf(".");WriteToDebug("intPos="+intPos);if(intPos>-1&&intPos+1-1&&intPos0){WriteToDebug("Found non-zero length string"); +if(strLine.charAt(0)=="\r"){WriteToDebug("Detected leading \\r");strLine=strLine.substr(1)}if(strLine.charAt(strLine.length-1)=="\r"){WriteToDebug("Detected trailing \\r");strLine=strLine.substr(0,strLine.length-1)}if(strLine.charAt(0)!=";"){WriteToDebug("Found non-comment line");strLineName=GetNameFromAICCLine(strLine);strLineValue=GetValueFromAICCLine(strLine);WriteToDebug("strLineName="+strLineName+", strLineValue="+strLineValue)}}strLineName=strLineName.toLowerCase();if(!AICC_HasItemBeenFound(strLineName)){WriteToDebug("Detected an un-found item"); +AICC_FoundItem(strLineName);switch(strLineName){case "version":WriteToDebug("Item is version");var tempVersion=parseFloat(strLineValue);if(isNaN(tempVersion))tempVersion=0;AICC_LMS_Version=tempVersion;break;case "student_id":WriteToDebug("Item is student_id");AICC_Student_ID=strLineValue;break;case "student_name":WriteToDebug("Item is student_name");AICC_Student_Name=strLineValue;break;case "lesson_location":WriteToDebug("Item is lesson_location");AICC_Lesson_Location=strLineValue;break;case "score":WriteToDebug("Item is score"); +AICC_Score=strLineValue;AICC_SeperateScoreValues(AICC_Score);break;case "credit":WriteToDebug("Item is credit");AICC_Credit=strLineValue;AICC_TranslateCredit(AICC_Credit);break;case "lesson_status":WriteToDebug("Item is lesson_status");AICC_Lesson_Status=strLineValue;AICC_TranslateLessonStatus(AICC_Lesson_Status);break;case "time":WriteToDebug("Item is time");AICC_Time=strLineValue;AICC_TranslateTimeToMilliseconds(AICC_Time);break;case "mastery_score":WriteToDebug("Item is mastery_score");AICC_Mastery_Score= +strLineValue;AICC_ValidateMasteryScore(AICC_Mastery_Score);break;case "lesson_mode":WriteToDebug("Item is lesson_mode");AICC_Lesson_Mode=strLineValue;AICC_TranslateLessonMode(AICC_Lesson_Mode);break;case "max_time_allowed":WriteToDebug("Item is max_time_allowed");AICC_Max_Time_Allowed=strLineValue;AICC_TranslateMaxTimeToMilliseconds(AICC_Max_Time_Allowed);break;case "time_limit_action":WriteToDebug("Item is time_limit_action");AICC_Time_Limit_Action=strLineValue;AICC_TranslateTimeLimitAction(AICC_Time_Limit_Action); +break;case "audio":WriteToDebug("Item is audio");AICC_Audio=strLineValue;AICC_TranslateAudio(AICC_Audio);break;case "speed":WriteToDebug("Item is speed");AICC_Speed=strLineValue;AICC_TranslateSpeed(AICC_Speed);break;case "language":WriteToDebug("Item is language");AICC_Language=strLineValue;break;case "text":WriteToDebug("Item is text");AICC_Text=strLineValue;AICC_TranslateTextPreference(AICC_Text);break;case "course_id":WriteToDebug("Item is course id");AICC_CourseID=strLineValue;break;case "core_vendor":WriteToDebug("Item is core_vendor"); +AICC_Launch_Data="";strLine="";j=1;if(i+j1){WriteToDebug("Max score found"); +AICC_fltScoreMax=aryScore[1];if(IsValidDecimal(AICC_fltScoreMax)){WriteToDebug("Found a valid decimal");AICC_fltScoreMax=parseFloat(AICC_fltScoreMax)}else{WriteToDebug("ERROR - max score from LMS is not a valid decimal");AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"max score is not a valid decimal")}}if(aryScore.length>2){WriteToDebug("Max score found");AICC_fltScoreMin=aryScore[2];if(IsValidDecimal(AICC_fltScoreMin)){WriteToDebug("Found a valid decimal");AICC_fltScoreMin=parseFloat(AICC_fltScoreMin)}else{WriteToDebug("ERROR - min score from LMS is not a valid decimal"); +AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"min score is not a valid decimal")}}}function AICC_ValidateMasteryScore(strScore){WriteToDebug("In AICC_ValidateMasteryScore, strScore="+strScore);if(IsValidDecimal(strScore))AICC_Mastery_Score=parseFloat(strScore);else{WriteToDebug("ERROR - mastery score from LMS is not a valid decimal");AICC_SetError(AICC_ERROR_INVALID_DECIMAL,"mastery score is not a valid decimal")}} +function AICC_TranslateCredit(strCredit){WriteToDebug("In AICC_TranslateCredit, strCredit="+strCredit);var strFirstChar;strFirstChar=strCredit.toLowerCase().charAt(0);if(strFirstChar=="c"){WriteToDebug("Credit = true");AICC_blnCredit=true}else if(strFirstChar=="n"){WriteToDebug("Credit = false");AICC_blnCredit=false}else{WriteToDebug("ERROR - credit value from LMS is not a valid");AICC_SetError(AICC_ERROR_INVALID_CREDIT,"credit value from LMS is not a valid")}} +function AICC_TranslateLessonMode(strMode){WriteToDebug("In AICC_TranslateLessonMode, strMode="+strMode);var strFirstChar;strFirstChar=strMode.toLowerCase().charAt(0);if(strFirstChar=="b"){WriteToDebug("Lesson Mode = Browse");AICC_strLessonMode=MODE_BROWSE}else if(strFirstChar=="n"){WriteToDebug("Lesson Mode = normal");AICC_strLessonMode=MODE_NORMAL}else if(strFirstChar=="r"){WriteToDebug("Lesson Mode = review");AICC_strLessonMode=MODE_REVIEW;if(!(typeof REVIEW_MODE_IS_READ_ONLY=="undefined")&&REVIEW_MODE_IS_READ_ONLY=== +true)blnReviewModeSoReadOnly=true}else{WriteToDebug("ERROR - lesson_mode value from LMS is not a valid");AICC_SetError(AICC_ERROR_INVALID_LESSON_MODE,"lesson_mode value from LMS is not a valid")}} +function AICC_TranslateTimeToMilliseconds(strCMITime){WriteToDebug("In AICC_TranslateTimeToMilliseconds, strCMITime="+strCMITime);if(IsValidCMITimeSpan(strCMITime))AICC_intPreviouslyAccumulatedMilliseconds=ConvertCMITimeSpanToMS(strCMITime);else{WriteToDebug("ERROR - Invalid CMITimeSpan");AICC_SetError(AICC_ERROR_INVALID_TIMESPAN,"Invalid timespan (previously accumulated time) received from LMS")}} +function AICC_TranslateMaxTimeToMilliseconds(strCMITime){WriteToDebug("In AICC_TranslateMaxTimeToMilliseconds, strCMITime="+strCMITime);if(IsValidCMITimeSpan(strCMITime))AICC_intMaxTimeAllowedMilliseconds=ConvertCMITimeSpanToMS(strCMITime);else{WriteToDebug("ERROR - Invalid CMITimeSpan");AICC_SetError(AICC_ERROR_INVALID_TIMESPAN,"Invalid timespan (max time allowed) received from LMS")}} +function AICC_TranslateTimeLimitAction(strTimeLimitAction){WriteToDebug("In AICC_TranslateTimeLimitAction, strTimeLimitAction="+strTimeLimitAction);var arySplit;var blnError=false;var strChar1="";var strChar2="";arySplit=strTimeLimitAction.split(",");if(arySplit.length==2){WriteToDebug("Found 2 elements");strChar1=arySplit[0].charAt(0).toLowerCase();strChar2=arySplit[1].charAt(0).toLowerCase();WriteToDebug("Got characters, strChar1="+strChar1+", strChar2="+strChar2);if(strChar1!="e"&&strChar1!="c"&& +strChar1!="m"&&strChar1!="n"||strChar2!="e"&&strChar2!="c"&&strChar2!="m"&&strChar2!="n"||strChar1==strChar2){blnError=true;WriteToDebug("Found an invalid character, or 2 identical characters")}if(strChar1=="e"||strChar2=="e")AICC_blnExitOnTimeout=true;if(strChar1=="c"||strChar2=="c")AICC_blnExitOnTimeout=false;if(strChar1=="n"||strChar2=="n")AICC_blnShowMessageOnTimeout=false;if(strChar1=="m"||strChar2=="m")AICC_blnShowMessageOnTimeout=true;WriteToDebug("AICC_blnExitOnTimeout="+AICC_blnExitOnTimeout+ +", AICC_blnShowMessageOnTimeout"+AICC_blnShowMessageOnTimeout)}else{WriteToDebug("Line does not contain two comma-delimited elements");blnError=true}if(blnError){WriteToDebug("ERROR - Invalid Time Limit Action");AICC_SetError(AICC_ERROR_INVALID_TIME_LIMIT_ACTION,"Invalid time limit action received from LMS")}} +function AICC_TranslateTextPreference(strPreference){WriteToDebug("In AICC_TranslateTextPreference, strPreference="+strPreference);if(strPreference==-1){WriteToDebug("Text Preference = off");AICC_TextPreference=PREFERENCE_OFF}else if(strPreference==0){WriteToDebug("Text Preference = default");AICC_TextPreference=PREFERENCE_DEFAULT}else if(strPreference==1){WriteToDebug("Text Preference = on");AICC_TextPreference=PREFERENCE_ON}else{WriteToDebug("ERROR - Invalid Text Preference");AICC_SetError(AICC_ERROR_INVALID_PREFERENCE, +"Invalid Text Preference received from LMS")}} +function AICC_TranslateLessonStatus(strStatus){WriteToDebug("In AICC_TranslateLessonStatus, strStatus="+strStatus);var strFirstChar;var intPos;var strEntry;strFirstChar=strStatus.charAt(0).toLowerCase();AICC_Status=AICC_ConvertAICCStatusIntoLocalStatus(strFirstChar);WriteToDebug("AICC_Status="+AICC_Status);intPos=strStatus.indexOf(",");if(intPos>0){strEntry=strStatus.substr(intPos);strEntry=strEntry.replace(/,/,"");strFirstChar=strEntry.charAt(0).toLowerCase();if(strFirstChar=="a"){WriteToDebug("Entry is Ab initio"); +AICC_Entry=ENTRY_FIRST_TIME}else if(strFirstChar=="r"){WriteToDebug("Entry is Resume");AICC_Entry=ENTRY_RESUME}else{WriteToDebug("ERROR - entry not found");AICC_SetError(AICC_ERROR_INVALID_ENTRY,"Invalid lesson status received from LMS")}}} +function AICC_ConvertAICCStatusIntoLocalStatus(strFirstCharOfAICCStatus){WriteToDebug("In AICC_ConvertAICCStatusIntoLocalStatus, strFirstCharOfAICCStatus="+strFirstCharOfAICCStatus);if(strFirstCharOfAICCStatus=="p"){WriteToDebug("Status is Passed");return LESSON_STATUS_PASSED}else if(strFirstCharOfAICCStatus=="f"){WriteToDebug("Status is Failed");return LESSON_STATUS_FAILED}else if(strFirstCharOfAICCStatus=="c"){WriteToDebug("Status is Completed");return LESSON_STATUS_COMPLETED}else if(strFirstCharOfAICCStatus== +"b"){WriteToDebug("Status is Browsed");return LESSON_STATUS_BROWSED}else if(strFirstCharOfAICCStatus=="i"){WriteToDebug("Status is Incomplete");return LESSON_STATUS_INCOMPLETE}else if(strFirstCharOfAICCStatus=="n"){WriteToDebug("Status is Not Attempted");return LESSON_STATUS_NOT_ATTEMPTED}else{WriteToDebug("ERROR - status not found");AICC_SetError(SCORM_ERROR_INVALID_STATUS,"Invalid status");return LESSON_STATUS_NOT_ATTEMPTED}} +function AICC_TranslateAudio(strAudio){WriteToDebug("In AICC_TranslateAudio, strAudio="+strAudio);var intTempPreference=parseInt(strAudio,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0&&intTempPreference<=100){WriteToDebug("Returning On");AICC_AudioPlayPreference=PREFERENCE_ON;AICC_intAudioVolume=intTempPreference}else if(intTempPreference==0){WriteToDebug("Returning Default");AICC_AudioPlayPreference=PREFERENCE_DEFAULT}else if(intTempPreference<0){WriteToDebug("returning Off"); +AICC_AudioPlayPreference=PREFERENCE_OFF}else{WriteToDebug("Error: Invalid preference");AICC_SetError(AICC_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS")}} +function AICC_TranslateSpeed(intAICCSpeed){WriteToDebug("In AICC_TranslateSpeed, intAICCSpeed="+intAICCSpeed);var intPercentOfMax;if(!ValidInteger(intAICCSpeed)){WriteToDebug("ERROR - invalid integer");AICC_SetError(AICC_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer");return}intAICCSpeed=parseInt(intAICCSpeed,10);if(intAICCSpeed<-100||intAICCSpeed>100){WriteToDebug("ERROR - out of range");AICC_SetError(AICC_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range"); +return}AICC_Speed=intAICCSpeed;intPercentOfMax=(intAICCSpeed+100)/2;intPercentOfMax=parseInt(intPercentOfMax,10);WriteToDebug("Returning "+intPercentOfMax);AICC_intPercentOfMaxSpeed=intPercentOfMax} +function AICC_FormatObjectives(strObjectivesFromLMS){WriteToDebug("In AICC_FormatObjectives, strObjectivesFromLMS="+strObjectivesFromLMS);var aryLines;var i;var strLineName;var strLineValue;var strLineType;var strIndex;aryLines=strObjectivesFromLMS.split("\n");for(i=0;i=3){WriteToDebug("Using max and min values if available.");if(AICC_fltScoreMax!=""||AICC_fltScoreMin!=""){WriteToDebug("Appending Max and Min scores");AICC_Score+=","+AICC_fltScoreMax+ +","+AICC_fltScoreMin}}WriteToDebug("AICC_Score="+AICC_Score);return AICC_Score}function AICC_TranslateTimeToAICC(){WriteToDebug("In AICC_TranslateTimeToAICC");var strTime;strTime=ConvertMilliSecondsToSCORMTime(AICC_intSessionTimeMilliseconds,false);return strTime} +function AICC_TranslateCommentsToAICC(){WriteToDebug("In AICC_TranslateCommentsToAICC");var strComments="";for(var i=0;i"+AICC_aryCommentsFromLearner[i]+"";return strComments} +function AICC_TranslateObjectivesToAICC(){WriteToDebug("In AICC_TranslateObjectivesToAICC");var strObjectives="";for(var i=0;i>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< +32-8*(c%4);a.length=e.ceil(c/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(d%4)&255;b.push((f>>>4).toString(16));b.push((f&15).toString(16))}return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d>>3]|=parseInt(a.substr(d, +2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d>>2]>>>24-8*(d%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new n.init(b,c)}},r=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}}, +k=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,d=c.sigBytes,f=this.blockSize,h=d/(4*f),h=a?e.ceil(h):e.max((h|0)-this._minBufferSize,0);a=h*f;d=e.min(4*a,d);if(a){for(var g=0;ga;a++){if(16>a)l[a]=f[n+a]|0;else{var c=l[a-3]^l[a-8]^l[a-14]^l[a-16];l[a]=c<<1|c>>>31}c=(h<<5|h>>>27)+j+l[a];c=20>a?c+((g&e|~g&k)+1518500249):40>a?c+((g^e^k)+1859775393):60>a?c+((g&e|g&k|e&k)-1894007588):c+((g^e^ +k)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(h+64>>>9<<4)+15]=b;f.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=j.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=j._createHelper(m);e.HmacSHA1=j._createHmacHelper(m)})(); +var CryptoJS=CryptoJS||function(h,s){var f={},t=f.lib={},g=function(){},j=t.Base={extend:function(a){g.prototype=this;var c=new g;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, +q=t.WordArray=j.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||u).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< +32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=j.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b, +2),16)<<24-4*(b%8);return new q.init(d,c/2)}},k=v.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},l=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}}, +x=t.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=l.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var m=0;mk;){var l;a:{l=u;for(var x=h.sqrt(l),w=2;w<=x;w++)if(!(l%w)){l=!1;break a}l=!0}l&&(8>k&&(j[k]=v(h.pow(u,.5))),q[k]=v(h.pow(u,1/3)),k++);u++}var a=[],f=f.SHA256=g.extend({_doReset:function(){this._hash=new t.init(j.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],m=b[2],h=b[3],p=b[4],j=b[5],k=b[6],l=b[7],n=0;64>n;n++){if(16>n)a[n]= +c[d+n]|0;else{var r=a[n-15],g=a[n-2];a[n]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+a[n-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+a[n-16]}r=l+((p<<26|p>>>6)^(p<<21|p>>>11)^(p<<7|p>>>25))+(p&j^~p&k)+q[n]+a[n];g=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&m^f&m);l=k;k=j;j=p;p=h+r|0;h=m;m=f;f=e;e=r+g|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+m|0;b[3]=b[3]+h|0;b[4]=b[4]+p|0;b[5]=b[5]+j|0;b[6]=b[6]+k|0;b[7]=b[7]+l|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; +d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=g.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=g._createHelper(f);s.HmacSHA256=g._createHmacHelper(f)})(Math); +(function(){var C=CryptoJS;var C_lib=C.lib;var WordArray=C_lib.WordArray;var C_enc=C.enc;var Base64=C_enc.Base64={stringify:function(wordArray){var words=wordArray.words;var sigBytes=wordArray.sigBytes;var map=this._map;wordArray.clamp();var base64Chars=[];for(var i=0;i>>2]>>>24-i%4*8&255;var byte2=words[i+1>>>2]>>>24-(i+1)%4*8&255;var byte3=words[i+2>>>2]>>>24-(i+2)%4*8&255;var triplet=byte1<<16|byte2<<8|byte3;for(var j=0;j<4&&i+j*.75>> +6*(3-j)&63))}var paddingChar=map.charAt(64);if(paddingChar)while(base64Chars.length%4)base64Chars.push(paddingChar);return base64Chars.join("")},parse:function(base64Str){var base64StrLength=base64Str.length;var map=this._map;var paddingChar=map.charAt(64);if(paddingChar){var paddingIndex=base64Str.indexOf(paddingChar);if(paddingIndex!=-1)base64StrLength=paddingIndex}var words=[];var nBytes=0;for(var i=0;i>> +6-i%4*2;words[nBytes>>>2]|=(bits1|bits2)<<24-nBytes%4*8;nBytes++}return WordArray.create(words,nBytes)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); +(function(){if(typeof ArrayBuffer!="function")return;var C=CryptoJS;var C_lib=C.lib;var WordArray=C_lib.WordArray;var superInit=WordArray.init;var subInit=WordArray.init=function(typedArray){if(typedArray instanceof ArrayBuffer)typedArray=new Uint8Array(typedArray);if(typedArray instanceof Int8Array||typedArray instanceof Uint8ClampedArray||typedArray instanceof Int16Array||typedArray instanceof Uint16Array||typedArray instanceof Int32Array||typedArray instanceof Uint32Array||typedArray instanceof +Float32Array||typedArray instanceof Float64Array)typedArray=new Uint8Array(typedArray.buffer,typedArray.byteOffset,typedArray.byteLength);if(typedArray instanceof Uint8Array){var typedArrayByteLength=typedArray.byteLength;var words=[];for(var i=0;i>>2]|=typedArray[i]<<24-i%4*8;superInit.call(this,words,typedArrayByteLength)}else superInit.apply(this,arguments)};subInit.prototype=WordArray})();var TinCan; +(function(){var _reservedQSParams={statementId:true,voidedStatementId:true,verb:true,object:true,registration:true,context:true,actor:true,since:true,until:true,limit:true,authoritative:true,sparse:true,instructor:true,ascending:true,continueToken:true,agent:true,activityId:true,stateId:true,profileId:true,activity_platform:true,grouping:true,"Accept-Language":true};TinCan=function(cfg){this.log("constructor");this.recordStores=[];this.actor=null;this.activity=null;this.registration=null;this.context= +null;this.init(cfg)};TinCan.prototype={LOG_SRC:"TinCan",log:function(msg,src){if(TinCan.DEBUG&&typeof console!=="undefined"&&console.log){src=src||this.LOG_SRC||"TinCan";console.log("TinCan."+src+": "+msg)}},init:function(cfg){this.log("init");var i;cfg=cfg||{};if(cfg.hasOwnProperty("url")&&cfg.url!=="")this._initFromQueryString(cfg.url);if(cfg.hasOwnProperty("recordStores")&&cfg.recordStores!==undefined)for(i=0;i0){if(typeof callback==="function")callbackWrapper= +function(err,xhr){var args;self.log("sendStatement - callbackWrapper: "+rsCount);if(rsCount>1){rsCount-=1;callbackResults.push({err:err,xhr:xhr})}else if(rsCount===1){callbackResults.push({err:err,xhr:xhr});args=[callbackResults,statement];callback.apply(this,args)}else self.log("sendStatement - unexpected record store count: "+rsCount)};for(i=0;i0){lrs=this.recordStores[0];return lrs.retrieveStatement(stmtId,{callback:callback,params:cfg.params})}this.log("[warning] getStatement: No LRSs added yet (statement not retrieved)")},voidStatement:function(stmt,callback,options){this.log("voidStatement"); +var self=this,lrs,actor,voidingStatement,rsCount=this.recordStores.length,i,results=[],callbackWrapper,callbackResults=[];if(stmt instanceof TinCan.Statement)stmt=stmt.id;if(typeof options.actor!=="undefined")actor=options.actor;else if(this.actor!==null)actor=this.actor;voidingStatement=new TinCan.Statement({actor:actor,verb:{id:"http://adlnet.gov/expapi/verbs/voided"},target:{objectType:"StatementRef",id:stmt}});if(rsCount>0){if(typeof callback==="function")callbackWrapper=function(err,xhr){var args; +self.log("voidStatement - callbackWrapper: "+rsCount);if(rsCount>1){rsCount-=1;callbackResults.push({err:err,xhr:xhr})}else if(rsCount===1){callbackResults.push({err:err,xhr:xhr});args=[callbackResults,voidingStatement];callback.apply(this,args)}else self.log("voidStatement - unexpected record store count: "+rsCount)};for(i=0;i0){lrs=this.recordStores[0];return lrs.retrieveVoidedStatement(stmtId,{callback:callback})}this.log("[warning] getVoidedStatement: No LRSs added yet (statement not retrieved)")},sendStatements:function(stmts,callback){this.log("sendStatements");var self=this,lrs, +statements=[],rsCount=this.recordStores.length,i,results=[],callbackWrapper,callbackResults=[];if(stmts.length===0){if(typeof callback==="function")callback.apply(this,[null,statements])}else{for(i=0;i0){if(typeof callback==="function")callbackWrapper=function(err,xhr){var args;self.log("sendStatements - callbackWrapper: "+rsCount);if(rsCount>1){rsCount-=1;callbackResults.push({err:err,xhr:xhr})}else if(rsCount===1){callbackResults.push({err:err, +xhr:xhr});args=[callbackResults,statements];callback.apply(this,args)}else self.log("sendStatements - unexpected record store count: "+rsCount)};for(i=0;i0){lrs=this.recordStores[0];cfg=cfg||{};params=cfg.params||{};if(cfg.sendActor&&this.actor!==null)if(lrs.version==="0.9"||lrs.version==="0.95")params.actor=this.actor;else params.agent=this.actor;if(cfg.sendActivity&&this.activity!==null)if(lrs.version==="0.9"||lrs.version==="0.95")params.target=this.activity;else params.activity=this.activity;if(typeof params.registration==="undefined"&&this.registration!==null)params.registration=this.registration; +queryCfg={params:params};if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.queryStatements(queryCfg)}this.log("[warning] getStatements: No LRSs added yet (statements not read)")},getState:function(key,cfg){this.log("getState");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!=="undefined"?cfg.agent:this.actor,activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.registration!== +"undefined")queryCfg.registration=cfg.registration;else if(this.registration!==null)queryCfg.registration=this.registration;if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.retrieveState(key,queryCfg)}this.log("[warning] getState: No LRSs added yet (state not retrieved)")},setState:function(key,val,cfg){this.log("setState");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!=="undefined"?cfg.agent:this.actor, +activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.registration!=="undefined")queryCfg.registration=cfg.registration;else if(this.registration!==null)queryCfg.registration=this.registration;if(typeof cfg.lastSHA1!=="undefined")queryCfg.lastSHA1=cfg.lastSHA1;if(typeof cfg.contentType!=="undefined"){queryCfg.contentType=cfg.contentType;if(typeof cfg.overwriteJSON!=="undefined"&&!cfg.overwriteJSON&&TinCan.Utils.isApplicationJSON(cfg.contentType))queryCfg.method="POST"}if(typeof cfg.callback!== +"undefined")queryCfg.callback=cfg.callback;return lrs.saveState(key,val,queryCfg)}this.log("[warning] setState: No LRSs added yet (state not saved)")},deleteState:function(key,cfg){this.log("deleteState");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!=="undefined"?cfg.agent:this.actor,activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.registration!=="undefined")queryCfg.registration=cfg.registration; +else if(this.registration!==null)queryCfg.registration=this.registration;if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.dropState(key,queryCfg)}this.log("[warning] deleteState: No LRSs added yet (state not deleted)")},getActivityProfile:function(key,cfg){this.log("getActivityProfile");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.callback!== +"undefined")queryCfg.callback=cfg.callback;return lrs.retrieveActivityProfile(key,queryCfg)}this.log("[warning] getActivityProfile: No LRSs added yet (activity profile not retrieved)")},setActivityProfile:function(key,val,cfg){this.log("setActivityProfile");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;if(typeof cfg.lastSHA1!== +"undefined")queryCfg.lastSHA1=cfg.lastSHA1;if(typeof cfg.contentType!=="undefined"){queryCfg.contentType=cfg.contentType;if(typeof cfg.overwriteJSON!=="undefined"&&!cfg.overwriteJSON&&TinCan.Utils.isApplicationJSON(cfg.contentType))queryCfg.method="POST"}return lrs.saveActivityProfile(key,val,queryCfg)}this.log("[warning] setActivityProfile: No LRSs added yet (activity profile not saved)")},deleteActivityProfile:function(key,cfg){this.log("deleteActivityProfile");var queryCfg,lrs;if(this.recordStores.length> +0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={activity:typeof cfg.activity!=="undefined"?cfg.activity:this.activity};if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.dropActivityProfile(key,queryCfg)}this.log("[warning] deleteActivityProfile: No LRSs added yet (activity profile not deleted)")},getAgentProfile:function(key,cfg){this.log("getAgentProfile");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!== +"undefined"?cfg.agent:this.actor};if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.retrieveAgentProfile(key,queryCfg)}this.log("[warning] getAgentProfile: No LRSs added yet (agent profile not retrieved)")},setAgentProfile:function(key,val,cfg){this.log("setAgentProfile");var queryCfg,lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!=="undefined"?cfg.agent:this.actor};if(typeof cfg.callback!=="undefined")queryCfg.callback= +cfg.callback;if(typeof cfg.lastSHA1!=="undefined")queryCfg.lastSHA1=cfg.lastSHA1;if(typeof cfg.contentType!=="undefined"){queryCfg.contentType=cfg.contentType;if(typeof cfg.overwriteJSON!=="undefined"&&!cfg.overwriteJSON&&TinCan.Utils.isApplicationJSON(cfg.contentType))queryCfg.method="POST"}return lrs.saveAgentProfile(key,val,queryCfg)}this.log("[warning] setAgentProfile: No LRSs added yet (agent profile not saved)")},deleteAgentProfile:function(key,cfg){this.log("deleteAgentProfile");var queryCfg, +lrs;if(this.recordStores.length>0){lrs=this.recordStores[0];cfg=cfg||{};queryCfg={agent:typeof cfg.agent!=="undefined"?cfg.agent:this.actor};if(typeof cfg.callback!=="undefined")queryCfg.callback=cfg.callback;return lrs.dropAgentProfile(key,queryCfg)}this.log("[warning] deleteAgentProfile: No LRSs added yet (agent profile not deleted)")}};TinCan.DEBUG=false;TinCan.enableDebug=function(){TinCan.DEBUG=true};TinCan.disableDebug=function(){TinCan.DEBUG=false};TinCan.versions=function(){return["1.0.2", +"1.0.1","1.0.0","0.95","0.9"]};if(typeof module==="object")module.exports=TinCan})(); +(function(){TinCan.Utils={defaultEncoding:"utf8",getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&3|8;return v.toString(16)})},getISODateString:function(d){function pad(val,n){var padder,tempVal;if(typeof val==="undefined"||val===null)val=0;if(typeof n==="undefined"||n===null)n=2;padder=Math.pow(10,n-1);tempVal=val.toString();while(val1){tempVal="0"+tempVal;padder=padder/10}return tempVal}return d.getUTCFullYear()+ +"-"+pad(d.getUTCMonth()+1)+"-"+pad(d.getUTCDate())+"T"+pad(d.getUTCHours())+":"+pad(d.getUTCMinutes())+":"+pad(d.getUTCSeconds())+"."+pad(d.getUTCMilliseconds(),3)+"Z"},convertISO8601DurationToMilliseconds:function(ISO8601Duration){var isValueNegative=ISO8601Duration.indexOf("-")>=0,indexOfT=ISO8601Duration.indexOf("T"),indexOfH=ISO8601Duration.indexOf("H"),indexOfM=ISO8601Duration.indexOf("M"),indexOfS=ISO8601Duration.indexOf("S"),hours,minutes,seconds,durationInMilliseconds;if(indexOfT===-1||indexOfM!== +-1&&indexOfM0)rtnStr+=hours+"H";if(minutes>0)rtnStr+=minutes+"M";rtnStr+=seconds+"S";return rtnStr},getSHA1String:function(str){return CryptoJS.SHA1(str).toString(CryptoJS.enc.Hex)},getSHA256String:function(content){if(Object.prototype.toString.call(content)==="[object ArrayBuffer]")content=CryptoJS.lib.WordArray.create(content); +return CryptoJS.SHA256(content).toString(CryptoJS.enc.Hex)},getBase64String:function(str){return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(str))},getLangDictionaryValue:function(prop,lang){var langDict=this[prop],key;if(typeof lang!=="undefined"&&typeof langDict[lang]!=="undefined")return langDict[lang];if(typeof langDict.und!=="undefined")return langDict.und;if(typeof langDict["en-US"]!=="undefined")return langDict["en-US"];for(key in langDict)if(langDict.hasOwnProperty(key))return langDict[key]; +return""},parseURL:function(url,cfg){var isRelative=url.charAt(0)==="/",_reURLInformation=["(/[^?#]*)","(\\?[^#]*|)","(#.*|)$"],reURLInformation,match,result,paramMatch,pl=/\+/g,search=/([^&=]+)=?([^&]*)/g,decode=function(s){return decodeURIComponent(s.replace(pl," "))};cfg=cfg||{};if(!isRelative){_reURLInformation.unshift("^(https?:)//","(([^:/?#]*)(?::([0-9]+))?)");if(url.indexOf("/",8)===-1)url=url+"/"}else if(typeof cfg.allowRelative==="undefined"||!cfg.allowRelative)throw new Error("Refusing to parse relative URL without 'allowRelative' option"); +reURLInformation=new RegExp(_reURLInformation.join(""));match=url.match(reURLInformation);if(match===null)throw new Error("Unable to parse URL regular expression did not match: '"+url+"'");if(isRelative){result={protocol:null,host:null,hostname:null,port:null,path:null,pathname:match[1],search:match[2],hash:match[3],params:{}};result.path=result.pathname}else{result={protocol:match[1],host:match[2],hostname:match[3],port:match[4],pathname:match[5],search:match[6],hash:match[7],params:{}};result.path= +result.protocol+"//"+result.host+result.pathname}if(result.search!=="")while(paramMatch=search.exec(result.search.substring(1)))result.params[decode(paramMatch[1])]=decode(paramMatch[2]);return result},getServerRoot:function(absoluteUrl){var urlParts=absoluteUrl.split("/");return urlParts[0]+"//"+urlParts[2]},getContentTypeFromHeader:function(header){return String(header).split(";")[0]},isApplicationJSON:function(header){return TinCan.Utils.getContentTypeFromHeader(header).toLowerCase().indexOf("application/json")=== +0},stringToArrayBuffer:function(){TinCan.prototype.log("stringToArrayBuffer not overloaded - no environment loaded?")},stringFromArrayBuffer:function(){TinCan.prototype.log("stringFromArrayBuffer not overloaded - no environment loaded?")}}})(); +(function(){var LRS=TinCan.LRS=function(cfg){this.log("constructor");this.endpoint=null;this.version=null;this.auth=null;this.allowFail=true;this.extended=null;this.init(cfg)};LRS.prototype={LOG_SRC:"LRS",log:TinCan.prototype.log,init:function(cfg){this.log("init");var versions=TinCan.versions(),versionMatch=false,i;cfg=cfg||{};if(cfg.hasOwnProperty("alertOnRequestFailure"))this.log("'alertOnRequestFailure' is deprecated (alerts have been removed) no need to set it now");if(!cfg.hasOwnProperty("endpoint")|| +cfg.endpoint===null||cfg.endpoint===""){this.log("[error] LRS invalid: no endpoint");throw{code:3,mesg:"LRS invalid: no endpoint"};}this.endpoint=String(cfg.endpoint);if(this.endpoint.slice(-1)!=="/"){this.log("adding trailing slash to endpoint");this.endpoint+="/"}if(cfg.hasOwnProperty("allowFail"))this.allowFail=cfg.allowFail;if(cfg.hasOwnProperty("auth"))this.auth=cfg.auth;else if(cfg.hasOwnProperty("username")&&cfg.hasOwnProperty("password"))this.auth="Basic "+TinCan.Utils.getBase64String(cfg.username+ +":"+cfg.password);if(cfg.hasOwnProperty("extended"))this.extended=cfg.extended;this._initByEnvironment(cfg);if(typeof cfg.version!=="undefined"){this.log("version: "+cfg.version);for(i=0;i0){cfg.name=cfg.firstName[0];if(cfg.firstName.length>1)this.degraded=true}if(cfg.name!=="")cfg.name+=" ";if(typeof cfg.lastName!=="undefined"&&cfg.lastName.length>0){cfg.name+=cfg.lastName[0];if(cfg.lastName.length>1)this.degraded=true}}else if(typeof cfg.familyName!=="undefined"||typeof cfg.givenName!=="undefined"){cfg.name="";if(typeof cfg.givenName!=="undefined"&&cfg.givenName.length>0){cfg.name=cfg.givenName[0];if(cfg.givenName.length>1)this.degraded=true}if(cfg.name!=="")cfg.name+= +" ";if(typeof cfg.familyName!=="undefined"&&cfg.familyName.length>0){cfg.name+=cfg.familyName[0];if(cfg.familyName.length>1)this.degraded=true}}if(typeof cfg.name==="object"&&cfg.name!==null){if(cfg.name.length>1)this.degraded=true;cfg.name=cfg.name[0]}if(typeof cfg.mbox==="object"&&cfg.mbox!==null){if(cfg.mbox.length>1)this.degraded=true;cfg.mbox=cfg.mbox[0]}if(typeof cfg.mbox_sha1sum==="object"&&cfg.mbox_sha1sum!==null){if(cfg.mbox_sha1sum.length>1)this.degraded=true;cfg.mbox_sha1sum=cfg.mbox_sha1sum[0]}if(typeof cfg.openid=== +"object"&&cfg.openid!==null){if(cfg.openid.length>1)this.degraded=true;cfg.openid=cfg.openid[0]}if(typeof cfg.account==="object"&&cfg.account!==null&&typeof cfg.account.homePage==="undefined"&&typeof cfg.account.name==="undefined")if(cfg.account.length===0)delete cfg.account;else{if(cfg.account.length>1)this.degraded=true;cfg.account=cfg.account[0]}if(cfg.hasOwnProperty("account"))if(cfg.account instanceof TinCan.AgentAccount)this.account=cfg.account;else this.account=new TinCan.AgentAccount(cfg.account); +for(i=0;i0){result.member=[];for(i=0;i0)for(i=0;i0)if(version==="0.9"||version==="0.95"){if(this[optionalObjProps[i]].length>1)this.log("[warning] version does not support multiple values in: "+optionalObjProps[i]);result[optionalObjProps[i]]=this[optionalObjProps[i]][0].asVersion(version)}else{result[optionalObjProps[i]]=[];for(j=0;j0)if(version==="0.9"||version==="0.95"){this.log("[error] version does not support the 'category' property: "+version);throw new Error(version+" does not support the 'category' property");}else{result.category=[];for(i=0;i>>0;if(typeof fun!=="function")throw new TypeError;var thisp=arguments[1],i;for(i=0;i=200&&httpStatus<400||notFoundOk)if(cfg.callback)cfg.callback(null,xhr);else{requestCompleteResult={err:null,xhr:xhr}; +return requestCompleteResult}else{requestCompleteResult={err:httpStatus,xhr:xhr};if(httpStatus===0)log("[warning] There was a problem communicating with the Learning Record Store. Aborted, offline, or invalid CORS endpoint ("+httpStatus+")",LOG_SRC);else log("[warning] There was a problem communicating with the Learning Record Store. ("+httpStatus+" | "+xhr.responseText+")",LOG_SRC);if(cfg.callback)cfg.callback(httpStatus,xhr);return requestCompleteResult}}else return requestCompleteResult};__IEModeConversion= +function(fullUrl,headers,pairs,cfg){var prop;for(prop in headers)if(headers.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(headers[prop]));if(typeof cfg.data!=="undefined")pairs.push("content="+encodeURIComponent(cfg.data));headers["Content-Type"]="application/x-www-form-urlencoded";fullUrl+="?method="+cfg.method;cfg.method="POST";cfg.params={};if(pairs.length>0)cfg.data=pairs.join("&");return fullUrl};nativeRequest=function(fullUrl,headers,cfg){log("sendRequest using XMLHttpRequest", +LOG_SRC);var self=this,xhr,prop,pairs=[],data,control={finished:false,fakeStatus:null},async=typeof cfg.callback!=="undefined",fullRequest=fullUrl,err,MAX_REQUEST_LENGTH=2048;log("sendRequest using XMLHttpRequest - async: "+async,LOG_SRC);for(prop in cfg.params)if(cfg.params.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(cfg.params[prop]));if(pairs.length>0)fullRequest+="?"+pairs.join("&");if(fullRequest.length>=MAX_REQUEST_LENGTH){if(typeof cfg.method==="undefined"){err=new Error("method must not be undefined for an IE Mode Request conversion"); +if(typeof cfg.callback!=="undefined")cfg.callback(err,null);return{err:err,xhr:null}}fullUrl=__IEModeConversion(fullUrl,headers,pairs,cfg)}else fullUrl=fullRequest;if(typeof XMLHttpRequest!=="undefined")xhr=new XMLHttpRequest;else{xhr=new ActiveXObject("Microsoft.XMLHTTP");if(cfg.expectMultipart){err=new Error("Attachment support not available");if(typeof cfg.callback!=="undefined")cfg.callback(err,null);return{err:err,xhr:null}}}xhr.open(cfg.method,fullUrl,async);if(cfg.expectMultipart)xhr.responseType= +"arraybuffer";for(prop in headers)if(headers.hasOwnProperty(prop))xhr.setRequestHeader(prop,headers[prop]);data=cfg.data;if(async)xhr.onreadystatechange=function(){log("xhr.onreadystatechange - xhr.readyState: "+xhr.readyState,LOG_SRC);if(xhr.readyState===4)requestComplete.call(self,xhr,cfg,control)};try{xhr.send(data)}catch(ex){log("sendRequest caught send exception: "+ex,LOG_SRC)}if(async)return xhr;return requestComplete.call(this,xhr,cfg,control)};xdrRequest=function(fullUrl,headers,cfg){log("sendRequest using XDomainRequest", +LOG_SRC);var self=this,xhr,pairs=[],data,prop,until,control={finished:false,fakeStatus:null},err;if(cfg.expectMultipart){err=new Error("Attachment support not available");if(typeof cfg.callback!=="undefined")cfg.callback(err,null);return{err:err,xhr:null}}fullUrl+="?method="+cfg.method;for(prop in cfg.params)if(cfg.params.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(cfg.params[prop]));for(prop in headers)if(headers.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(headers[prop])); +if(typeof cfg.data!=="undefined")pairs.push("content="+encodeURIComponent(cfg.data));data=pairs.join("&");xhr=new XDomainRequest;xhr.open("POST",fullUrl);if(!cfg.callback){xhr.onload=function(){control.fakeStatus=200};xhr.onerror=function(){control.fakeStatus=400};xhr.ontimeout=function(){control.fakeStatus=0}}else{xhr.onload=function(){control.fakeStatus=200;requestComplete.call(self,xhr,cfg,control)};xhr.onerror=function(){control.fakeStatus=400;requestComplete.call(self,xhr,cfg,control)};xhr.ontimeout= +function(){control.fakeStatus=0;requestComplete.call(self,xhr,cfg,control)}}xhr.onprogress=function(){};xhr.timeout=0;try{xhr.send(data)}catch(ex){log("sendRequest caught send exception: "+ex,LOG_SRC)}if(!cfg.callback){until=1E4+Date.now();log("sendRequest - until: "+until+", finished: "+control.finished,LOG_SRC);while(Date.now()> +0}function ToUint32(v){return v>>>0}var LN2=Math.LN2,abs=Math.abs,floor=Math.floor,log=Math.log,max=Math.max,min=Math.min,pow=Math.pow,round=Math.round;(function(){var orig=Object.defineProperty;var dom_only=!function(){try{return Object.defineProperty({},"x",{})}catch(_){return false}}();if(!orig||dom_only)Object.defineProperty=function(o,prop,desc){if(orig)try{return orig(o,prop,desc)}catch(_){}if(o!==Object(o))throw TypeError("Object.defineProperty called on non-object");if(Object.prototype.__defineGetter__&& +"get"in desc)Object.prototype.__defineGetter__.call(o,prop,desc.get);if(Object.prototype.__defineSetter__&&"set"in desc)Object.prototype.__defineSetter__.call(o,prop,desc.set);if("value"in desc)o[prop]=desc.value;return o}})();function makeArrayAccessors(obj){if("TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS"in global)return;if(obj.length>MAX_ARRAY_LENGTH)throw RangeError("Array too large for polyfill");function makeArrayAccessor(index){Object.defineProperty(obj,index,{"get":function(){return obj._getter(index)}, +"set":function(v){obj._setter(index,v)},enumerable:true,configurable:false})}var i;for(i=0;i>s}function as_unsigned(value,bits){var s=32-bits;return value<>>s}function packI8(n){return[n&255]}function unpackI8(bytes){return as_signed(bytes[0],8)}function packU8(n){return[n&255]}function unpackU8(bytes){return as_unsigned(bytes[0],8)}function packU8Clamped(n){n=round(Number(n));return[n<0?0:n>255? +255:n&255]}function packI16(n){return[n&255,n>>8&255]}function unpackI16(bytes){return as_signed(bytes[1]<<8|bytes[0],16)}function packU16(n){return[n&255,n>>8&255]}function unpackU16(bytes){return as_unsigned(bytes[1]<<8|bytes[0],16)}function packI32(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]}function unpackI32(bytes){return as_signed(bytes[3]<<24|bytes[2]<<16|bytes[1]<<8|bytes[0],32)}function packU32(n){return[n&255,n>>8&255,n>>16&255,n>>24&255]}function unpackU32(bytes){return as_unsigned(bytes[3]<< +24|bytes[2]<<16|bytes[1]<<8|bytes[0],32)}function packIEEE754(v,ebits,fbits){var bias=(1<.5)return w+1;return w%2?w+1:w}var s,e,f;if(v!==v){e=(1<=pow(2,1-bias)){e=min(floor(log(v)/LN2),1023);var significand=v/pow(2,e);if(significand<1){e-=1;significand*=2}if(significand>= +2){e+=1;significand/=2}var d=pow(2,fbits);f=roundToEven(significand*d)-d;e+=bias;if(f/d>=1){e+=1;f=0}if(e>2*bias){e=(1<>1}}bits.reverse();str=bits.join("");bias=(1<0)return s*pow(2,e-bias)*(1+f/pow(2,fbits));else if(f!==0)return s*pow(2,-(bias-1))*(f/pow(2,fbits));else return s<0?-0:0}function unpackF64(b){return unpackIEEE754(b,11, +52)}function packF64(v){return packIEEE754(v,11,52)}function unpackF32(b){return unpackIEEE754(b,8,23)}function packF32(v){return packIEEE754(v,8,23)}(function(){function ArrayBuffer(length){length=ToInt32(length);if(length<0)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:length});Object.defineProperty(this,"_bytes",{value:Array(length)});for(var i=0;i= +1&&Type(arguments[0])==="object"&&arguments[0]instanceof $TypedArray$)return function(typedArray){if(this.constructor!==typedArray.constructor)throw TypeError();var byteLength=typedArray.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,"byteLength",{value:byteLength});Object.defineProperty(this,"byteOffset",{value:0});Object.defineProperty(this,"length",{value:typedArray.length});for(var i=0;i=1&&Type(arguments[0])==="object"&&!(arguments[0]instanceof $TypedArray$)&&!(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==="ArrayBuffer"))return function(array){var byteLength=array.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new ArrayBuffer(byteLength)});Object.defineProperty(this,"byteLength",{value:byteLength});Object.defineProperty(this,"byteOffset",{value:0});Object.defineProperty(this, +"length",{value:array.length});for(var i=0;i=1&&Type(arguments[0])==="object"&&(arguments[0]instanceof ArrayBuffer||Class(arguments[0])==="ArrayBuffer"))return function(buffer,byteOffset,length){byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)throw RangeError("byteOffset out of range");if(byteOffset%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size."); +if(length===undefined){var byteLength=buffer.byteLength-byteOffset;if(byteLength%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");length=byteLength/this.BYTES_PER_ELEMENT}else{length=ToUint32(length);byteLength=length*this.BYTES_PER_ELEMENT}if(byteOffset+byteLength>buffer.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:buffer});Object.defineProperty(this, +"byteLength",{value:byteLength});Object.defineProperty(this,"byteOffset",{value:byteOffset});Object.defineProperty(this,"length",{value:length})}.apply(this,arguments);throw TypeError();}Object.defineProperty($TypedArray$,"from",{value:function(iterable){return new this(iterable)}});Object.defineProperty($TypedArray$,"of",{value:function(){return new this(arguments)}});var $TypedArrayPrototype$={};$TypedArray$.prototype=$TypedArrayPrototype$;Object.defineProperty($TypedArray$.prototype,"_getter", +{value:function(index){if(arguments.length<1)throw SyntaxError("Not enough arguments");index=ToUint32(index);if(index>=this.length)return undefined;var bytes=[],i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i=this.length)return;var bytes=this._pack(value),i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i0){o._setter(to,o._getter(from));from=from+direction;to=to+direction;count=count-1}return o}});Object.defineProperty($TypedArray$.prototype,"every",{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var thisArg=arguments[1];for(var i=0;i1?arguments[1]:undefined;var k=0;while(k +1?arguments[1]:undefined;var k=0;while(k0){n=Number(arguments[1]);if(n!==n)n=0;else if(n!==0&&n!==1/0&&n!==-(1/0))n=(n>0||-1)*floor(abs(n))}if(n>=len)return-1;var k=n>=0?n:max(len-abs(n),0);for(;k1){n=Number(arguments[1]);if(n!==n)n=0;else if(n!==0&&n!==1/0&&n!==-(1/ +0))n=(n>0||-1)*floor(abs(n))}var k=n>=0?min(n,len-1):len-abs(n);for(;k>=0;k--)if(t._getter(k)===searchElement)return k;return-1}});Object.defineProperty($TypedArray$.prototype,"map",{value:function(callbackfn){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);if(!IsCallable(callbackfn))throw TypeError();var res=[];res.length=len;var thisp=arguments[1];for(var i=0;i=2)accumulator=arguments[1];else accumulator=t._getter(k++);while(k=2)accumulator=arguments[1];else accumulator=t._getter(k--);while(k>=0){accumulator=callbackfn.call(undefined,accumulator,t._getter(k),k,t);k--}return accumulator}});Object.defineProperty($TypedArray$.prototype,"reverse", +{value:function(){if(this===undefined||this===null)throw TypeError();var t=Object(this);var len=ToUint32(t.length);var half=floor(len/2);for(var i=0,j=len-1;ithis.length)throw RangeError("Offset plus length of array is out of range");byteOffset=this.byteOffset+offset*this.BYTES_PER_ELEMENT;byteLength=array.length*this.BYTES_PER_ELEMENT;if(array.buffer===this.buffer){tmp=[];for(i=0,s=array.byteOffset;ithis.length)throw RangeError("Offset plus length of array is out of range");for(i=0;imax?max:v}start=ToInt32(start);end=ToInt32(end);if(arguments.length<1)start=0;if(arguments.length<2)end=this.length;if(start<0)start=this.length+start;if(end<0)end=this.length+end;start=clamp(start,0,this.length);end=clamp(end,0,this.length);var len= +end-start;if(len<0)len=0;return new this.constructor(this.buffer,this.byteOffset+start*this.BYTES_PER_ELEMENT,len)}});function makeTypedArray(elementSize,pack,unpack){var TypedArray=function(){Object.defineProperty(this,"constructor",{value:TypedArray});$TypedArray$.apply(this,arguments);makeArrayAccessors(this)};if("__proto__"in TypedArray)TypedArray.__proto__=$TypedArray$;else{TypedArray.from=$TypedArray$.from;TypedArray.of=$TypedArray$.of}TypedArray.BYTES_PER_ELEMENT=elementSize;var TypedArrayPrototype= +function(){};TypedArrayPrototype.prototype=$TypedArrayPrototype$;TypedArray.prototype=new TypedArrayPrototype;Object.defineProperty(TypedArray.prototype,"BYTES_PER_ELEMENT",{value:elementSize});Object.defineProperty(TypedArray.prototype,"_pack",{value:pack});Object.defineProperty(TypedArray.prototype,"_unpack",{value:unpack});return TypedArray}var Int8Array=makeTypedArray(1,packI8,unpackI8);var Uint8Array=makeTypedArray(1,packU8,unpackU8);var Uint8ClampedArray=makeTypedArray(1,packU8Clamped,unpackU8); +var Int16Array=makeTypedArray(2,packI16,unpackI16);var Uint16Array=makeTypedArray(2,packU16,unpackU16);var Int32Array=makeTypedArray(4,packI32,unpackI32);var Uint32Array=makeTypedArray(4,packU32,unpackU32);var Float32Array=makeTypedArray(4,packF32,unpackF32);var Float64Array=makeTypedArray(8,packF64,unpackF64);global.Int8Array=global.Int8Array||Int8Array;global.Uint8Array=global.Uint8Array||Uint8Array;global.Uint8ClampedArray=global.Uint8ClampedArray||Uint8ClampedArray;global.Int16Array=global.Int16Array|| +Int16Array;global.Uint16Array=global.Uint16Array||Uint16Array;global.Int32Array=global.Int32Array||Int32Array;global.Uint32Array=global.Uint32Array||Uint32Array;global.Float32Array=global.Float32Array||Float32Array;global.Float64Array=global.Float64Array||Float64Array})();(function(){function r(array,index){return IsCallable(array.get)?array.get(index):array[index]}var IS_BIG_ENDIAN=function(){var u16array=new Uint16Array([4660]),u8array=new Uint8Array(u16array.buffer);return r(u8array,0)===18}(); +function DataView(buffer,byteOffset,byteLength){if(!(buffer instanceof ArrayBuffer||Class(buffer)==="ArrayBuffer"))throw TypeError();byteOffset=ToUint32(byteOffset);if(byteOffset>buffer.byteLength)throw RangeError("byteOffset out of range");if(byteLength===undefined)byteLength=buffer.byteLength-byteOffset;else byteLength=ToUint32(byteLength);if(byteOffset+byteLength>buffer.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this, +"buffer",{value:buffer});Object.defineProperty(this,"byteLength",{value:byteLength});Object.defineProperty(this,"byteOffset",{value:byteOffset})}function makeGetter(arrayType){return function GetViewValue(byteOffset,littleEndian){byteOffset=ToUint32(byteOffset);if(byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");byteOffset+=this.byteOffset;var uint8Array=new Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),bytes=[];for(var i=0;ithis.byteLength)throw RangeError("Array index out of range"); +var typeArray=new arrayType([value]),byteArray=new Uint8Array(typeArray.buffer),bytes=[],i,byteView;for(i=0;iend)return new ArrayBuffer(0);var num=end-begin;var target=new ArrayBuffer(num);var targetArray=new Uint8Array(target);var sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray); +return target}})();if(typeof module!=="undefined"&&module.exports)this["encoding-indexes"]=require("./encoding-indexes.js")["encoding-indexes"]; +(function(global){function inRange(a,min,max){return min<=a&&a<=max}function includes(array,item){return array.indexOf(item)!==-1}var floor=Math.floor;function ToDictionary(o){if(o===undefined)return{};if(o===Object(o))return o;throw TypeError("Could not convert argument to dictionary");}function stringToCodePoints(string){var s=String(string);var n=s.length;var i=0;var u=[];while(i57343)u.push(c);else if(56320<=c&&c<=57343)u.push(65533);else if(55296<=c&&c<= +56319)if(i===n-1)u.push(65533);else{var d=string.charCodeAt(i+1);if(56320<=d&&d<=57343){var a=c&1023;var b=d&1023;u.push(65536+(a<<10)+b);i+=1}else u.push(65533)}i+=1}return u}function codePointsToString(code_points){var s="";for(var i=0;i>10)+55296,(cp&1023)+56320)}}return s}function isASCIIByte(a){return 0<=a&&a<=127}var isASCIICodePoint=isASCIIByte;var end_of_stream= +-1;function Stream(tokens){this.tokens=[].slice.call(tokens);this.tokens.reverse()}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){if(!this.tokens.length)return end_of_stream;return this.tokens.pop()},prepend:function(token){if(Array.isArray(token)){var tokens=token;while(tokens.length)this.tokens.push(tokens.pop())}else this.tokens.push(token)},push:function(token){if(Array.isArray(token)){var tokens=token;while(tokens.length)this.tokens.unshift(tokens.shift())}else this.tokens.unshift(token)}}; +var finished=-1;function decoderError(fatal,opt_code_point){if(fatal)throw TypeError("Decoder error");return opt_code_point||65533}function encoderError(code_point){throw TypeError("The code point "+code_point+" could not be encoded.");}function Decoder(){}Decoder.prototype={handler:function(stream,bite){}};function Encoder(){}Encoder.prototype={handler:function(stream,code_point){}};function getEncoding(label){label=String(label).trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(label_to_encoding, +label))return label_to_encoding[label];return null}var encodings=[{"encodings":[{"labels":["unicode-1-1-utf-8","utf-8","utf8"],"name":"UTF-8"}],"heading":"The Encoding"},{"encodings":[{"labels":["866","cp866","csibm866","ibm866"],"name":"IBM866"},{"labels":["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],"name":"ISO-8859-2"},{"labels":["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"], +"name":"ISO-8859-3"},{"labels":["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],"name":"ISO-8859-4"},{"labels":["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],"name":"ISO-8859-5"},{"labels":["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"], +"name":"ISO-8859-6"},{"labels":["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],"name":"ISO-8859-7"},{"labels":["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],"name":"ISO-8859-8"},{"labels":["csiso88598i","iso-8859-8-i","logical"],"name":"ISO-8859-8-I"},{"labels":["csisolatin6","iso-8859-10","iso-ir-157", +"iso8859-10","iso885910","l6","latin6"],"name":"ISO-8859-10"},{"labels":["iso-8859-13","iso8859-13","iso885913"],"name":"ISO-8859-13"},{"labels":["iso-8859-14","iso8859-14","iso885914"],"name":"ISO-8859-14"},{"labels":["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],"name":"ISO-8859-15"},{"labels":["iso-8859-16"],"name":"ISO-8859-16"},{"labels":["cskoi8r","koi","koi8","koi8-r","koi8_r"],"name":"KOI8-R"},{"labels":["koi8-ru","koi8-u"],"name":"KOI8-U"},{"labels":["csmacintosh", +"mac","macintosh","x-mac-roman"],"name":"macintosh"},{"labels":["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],"name":"windows-874"},{"labels":["cp1250","windows-1250","x-cp1250"],"name":"windows-1250"},{"labels":["cp1251","windows-1251","x-cp1251"],"name":"windows-1251"},{"labels":["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"], +"name":"windows-1252"},{"labels":["cp1253","windows-1253","x-cp1253"],"name":"windows-1253"},{"labels":["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],"name":"windows-1254"},{"labels":["cp1255","windows-1255","x-cp1255"],"name":"windows-1255"},{"labels":["cp1256","windows-1256","x-cp1256"],"name":"windows-1256"},{"labels":["cp1257","windows-1257","x-cp1257"],"name":"windows-1257"},{"labels":["cp1258", +"windows-1258","x-cp1258"],"name":"windows-1258"},{"labels":["x-mac-cyrillic","x-mac-ukrainian"],"name":"x-mac-cyrillic"}],"heading":"Legacy single-byte encodings"},{"encodings":[{"labels":["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],"name":"GBK"},{"labels":["gb18030"],"name":"gb18030"}],"heading":"Legacy multi-byte Chinese (simplified) encodings"},{"encodings":[{"labels":["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],"name":"Big5"}],"heading":"Legacy multi-byte Chinese (traditional) encodings"}, +{"encodings":[{"labels":["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],"name":"EUC-JP"},{"labels":["csiso2022jp","iso-2022-jp"],"name":"ISO-2022-JP"},{"labels":["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],"name":"Shift_JIS"}],"heading":"Legacy multi-byte Japanese encodings"},{"encodings":[{"labels":["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],"name":"EUC-KR"}],"heading":"Legacy multi-byte Korean encodings"}, +{"encodings":[{"labels":["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],"name":"replacement"},{"labels":["utf-16be"],"name":"UTF-16BE"},{"labels":["utf-16","utf-16le"],"name":"UTF-16LE"},{"labels":["x-user-defined"],"name":"x-user-defined"}],"heading":"Legacy miscellaneous encodings"}];var label_to_encoding={};encodings.forEach(function(category){category.encodings.forEach(function(encoding){encoding.labels.forEach(function(label){label_to_encoding[label]=encoding})})}); +var encoders={};var decoders={};function indexCodePointFor(pointer,index){if(!index)return null;return index[pointer]||null}function indexPointerFor(code_point,index){var pointer=index.indexOf(code_point);return pointer===-1?null:pointer}function index(name){if(!("encoding-indexes"in global))throw Error("Indexes missing."+" Did you forget to include encoding-indexes.js?");return global["encoding-indexes"][name]}function indexGB18030RangesCodePointFor(pointer){if(pointer>39419&&pointer<189E3||pointer> +1237575)return null;if(pointer===7457)return 59335;var offset=0;var code_point_offset=0;var idx=index("gb18030");var i;for(i=0;i0&&stream[0]===65279){this._BOMseen=true; +stream.shift()}else if(stream.length>0)this._BOMseen=true;else;return codePointsToString(stream)}return serializeStream.call(this,output)};function TextEncoder(label,options){if(!(this instanceof TextEncoder))throw TypeError("Called as a function. Did you forget 'new'?");options=ToDictionary(options);this._encoding=null;this._encoder=null;this._do_not_flush=false;this._fatal=Boolean(options["fatal"])?"fatal":"replacement";var enc=this;if(Boolean(options["NONSTANDARD_allowLegacyEncoding"])){label= +label!==undefined?String(label):DEFAULT_ENCODING;var encoding=getEncoding(label);if(encoding===null||encoding.name==="replacement")throw RangeError("Unknown encoding: "+label);if(!encoders[encoding.name])throw Error("Encoder not present."+" Did you forget to include encoding-indexes.js?");enc._encoding=encoding}else{enc._encoding=getEncoding("utf-8");if(label!==undefined&&"console"in global)console.warn("TextEncoder constructor called with encoding label, "+"which is ignored.")}if(!Object.defineProperty)this.encoding= +enc._encoding.name.toLowerCase();return enc}if(Object.defineProperty)Object.defineProperty(TextEncoder.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});TextEncoder.prototype.encode=function encode(opt_string,options){opt_string=opt_string?String(opt_string):"";options=ToDictionary(options);if(!this._do_not_flush)this._encoder=encoders[this._encoding.name]({fatal:this._fatal==="fatal"});this._do_not_flush=Boolean(options["stream"]);var input=new Stream(stringToCodePoints(opt_string)); +var output=[];var result;while(true){var token=input.read();if(token===end_of_stream)break;result=this._encoder.handler(input,token);if(result===finished)break;if(Array.isArray(result))output.push.apply(output,result);else output.push(result)}if(!this._do_not_flush){while(true){result=this._encoder.handler(input,input.read());if(result===finished)break;if(Array.isArray(result))output.push.apply(output,result);else output.push(result)}this._encoder=null}return new Uint8Array(output)};function UTF8Decoder(options){var fatal= +options.fatal;var utf8_code_point=0,utf8_bytes_seen=0,utf8_bytes_needed=0,utf8_lower_boundary=128,utf8_upper_boundary=191;this.handler=function(stream,bite){if(bite===end_of_stream&&utf8_bytes_needed!==0){utf8_bytes_needed=0;return decoderError(fatal)}if(bite===end_of_stream)return finished;if(utf8_bytes_needed===0){if(inRange(bite,0,127))return bite;if(inRange(bite,194,223)){utf8_bytes_needed=1;utf8_code_point=bite-192}else if(inRange(bite,224,239)){if(bite===224)utf8_lower_boundary=160;if(bite=== +237)utf8_upper_boundary=159;utf8_bytes_needed=2;utf8_code_point=bite-224}else if(inRange(bite,240,244)){if(bite===240)utf8_lower_boundary=144;if(bite===244)utf8_upper_boundary=143;utf8_bytes_needed=3;utf8_code_point=bite-240}else return decoderError(fatal);utf8_code_point=utf8_code_point<<6*utf8_bytes_needed;return null}if(!inRange(bite,utf8_lower_boundary,utf8_upper_boundary)){utf8_code_point=utf8_bytes_needed=utf8_bytes_seen=0;utf8_lower_boundary=128;utf8_upper_boundary=191;stream.prepend(bite); +return decoderError(fatal)}utf8_lower_boundary=128;utf8_upper_boundary=191;utf8_bytes_seen+=1;utf8_code_point+=bite-128<<6*(utf8_bytes_needed-utf8_bytes_seen);if(utf8_bytes_seen!==utf8_bytes_needed)return null;var code_point=utf8_code_point;utf8_code_point=utf8_bytes_needed=utf8_bytes_seen=0;return code_point}}function UTF8Encoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(inRange(code_point,0,127))return code_point;var count, +offset;if(inRange(code_point,128,2047)){count=1;offset=192}else if(inRange(code_point,2048,65535)){count=2;offset=224}else if(inRange(code_point,65536,1114111)){count=3;offset=240}var bytes=[(code_point>>6*count)+offset];while(count>0){var temp=code_point>>6*(count-1);bytes.push(128|temp&63);count-=1}return bytes}}encoders["UTF-8"]=function(options){return new UTF8Encoder(options)};decoders["UTF-8"]=function(options){return new UTF8Decoder(options)};function SingleByteDecoder(index,options){var fatal= +options.fatal;this.handler=function(stream,bite){if(bite===end_of_stream)return finished;if(isASCIIByte(bite))return bite;var code_point=index[bite-128];if(code_point===null)return decoderError(fatal);return code_point}}function SingleByteEncoder(index,options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point;var pointer=indexPointerFor(code_point,index);if(pointer===null)encoderError(code_point); +return pointer+128}}(function(){if(!("encoding-indexes"in global))return;encodings.forEach(function(category){if(category.heading!=="Legacy single-byte encodings")return;category.encodings.forEach(function(encoding){var name=encoding.name;var idx=index(name.toLowerCase());decoders[name]=function(options){return new SingleByteDecoder(idx,options)};encoders[name]=function(options){return new SingleByteEncoder(idx,options)}})})})();decoders["GBK"]=function(options){return new GB18030Decoder(options)}; +encoders["GBK"]=function(options){return new GB18030Encoder(options,true)};function GB18030Decoder(options){var fatal=options.fatal;var gb18030_first=0,gb18030_second=0,gb18030_third=0;this.handler=function(stream,bite){if(bite===end_of_stream&&gb18030_first===0&&gb18030_second===0&&gb18030_third===0)return finished;if(bite===end_of_stream&&(gb18030_first!==0||gb18030_second!==0||gb18030_third!==0)){gb18030_first=0;gb18030_second=0;gb18030_third=0;decoderError(fatal)}var code_point;if(gb18030_third!== +0){code_point=null;if(inRange(bite,48,57))code_point=indexGB18030RangesCodePointFor((((gb18030_first-129)*10+(gb18030_second-48))*126+(gb18030_third-129))*10+bite-48);var buffer=[gb18030_second,gb18030_third,bite];gb18030_first=0;gb18030_second=0;gb18030_third=0;if(code_point===null){stream.prepend(buffer);return decoderError(fatal)}return code_point}if(gb18030_second!==0){if(inRange(bite,129,254)){gb18030_third=bite;return null}stream.prepend([gb18030_second,bite]);gb18030_first=0;gb18030_second= +0;return decoderError(fatal)}if(gb18030_first!==0){if(inRange(bite,48,57)){gb18030_second=bite;return null}var lead=gb18030_first;var pointer=null;gb18030_first=0;var offset=bite<127?64:65;if(inRange(bite,64,126)||inRange(bite,128,254))pointer=(lead-129)*190+(bite-offset);code_point=pointer===null?null:indexCodePointFor(pointer,index("gb18030"));if(code_point===null&&isASCIIByte(bite))stream.prepend(bite);if(code_point===null)return decoderError(fatal);return code_point}if(isASCIIByte(bite))return bite; +if(bite===128)return 8364;if(inRange(bite,129,254)){gb18030_first=bite;return null}return decoderError(fatal)}}function GB18030Encoder(options,gbk_flag){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point;if(code_point===58853)return encoderError(code_point);if(gbk_flag&&code_point===8364)return 128;var pointer=indexPointerFor(code_point,index("gb18030"));if(pointer!==null){var lead=floor(pointer/ +190)+129;var trail=pointer%190;var offset=trail<63?64:65;return[lead,trail+offset]}if(gbk_flag)return encoderError(code_point);pointer=indexGB18030RangesPointerFor(code_point);var byte1=floor(pointer/10/126/10);pointer=pointer-byte1*10*126*10;var byte2=floor(pointer/10/126);pointer=pointer-byte2*10*126;var byte3=floor(pointer/10);var byte4=pointer-byte3*10;return[byte1+129,byte2+48,byte3+129,byte4+48]}}encoders["gb18030"]=function(options){return new GB18030Encoder(options)};decoders["gb18030"]=function(options){return new GB18030Decoder(options)}; +function Big5Decoder(options){var fatal=options.fatal;var big5_lead=0;this.handler=function(stream,bite){if(bite===end_of_stream&&big5_lead!==0){big5_lead=0;return decoderError(fatal)}if(bite===end_of_stream&&big5_lead===0)return finished;if(big5_lead!==0){var lead=big5_lead;var pointer=null;big5_lead=0;var offset=bite<127?64:98;if(inRange(bite,64,126)||inRange(bite,161,254))pointer=(lead-129)*157+(bite-offset);switch(pointer){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234, +772];case 1166:return[234,780]}var code_point=pointer===null?null:indexCodePointFor(pointer,index("big5"));if(code_point===null&&isASCIIByte(bite))stream.prepend(bite);if(code_point===null)return decoderError(fatal);return code_point}if(isASCIIByte(bite))return bite;if(inRange(bite,129,254)){big5_lead=bite;return null}return decoderError(fatal)}}function Big5Encoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point; +var pointer=indexBig5PointerFor(code_point);if(pointer===null)return encoderError(code_point);var lead=floor(pointer/157)+129;if(lead<161)return encoderError(code_point);var trail=pointer%157;var offset=trail<63?64:98;return[lead,trail+offset]}}encoders["Big5"]=function(options){return new Big5Encoder(options)};decoders["Big5"]=function(options){return new Big5Decoder(options)};function EUCJPDecoder(options){var fatal=options.fatal;var eucjp_jis0212_flag=false,eucjp_lead=0;this.handler=function(stream, +bite){if(bite===end_of_stream&&eucjp_lead!==0){eucjp_lead=0;return decoderError(fatal)}if(bite===end_of_stream&&eucjp_lead===0)return finished;if(eucjp_lead===142&&inRange(bite,161,223)){eucjp_lead=0;return 65377+bite-161}if(eucjp_lead===143&&inRange(bite,161,254)){eucjp_jis0212_flag=true;eucjp_lead=bite;return null}if(eucjp_lead!==0){var lead=eucjp_lead;eucjp_lead=0;var code_point=null;if(inRange(lead,161,254)&&inRange(bite,161,254))code_point=indexCodePointFor((lead-161)*94+(bite-161),index(!eucjp_jis0212_flag? +"jis0208":"jis0212"));eucjp_jis0212_flag=false;if(!inRange(bite,161,254))stream.prepend(bite);if(code_point===null)return decoderError(fatal);return code_point}if(isASCIIByte(bite))return bite;if(bite===142||bite===143||inRange(bite,161,254)){eucjp_lead=bite;return null}return decoderError(fatal)}}function EUCJPEncoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point;if(code_point=== +165)return 92;if(code_point===8254)return 126;if(inRange(code_point,65377,65439))return[142,code_point-65377+161];if(code_point===8722)code_point=65293;var pointer=indexPointerFor(code_point,index("jis0208"));if(pointer===null)return encoderError(code_point);var lead=floor(pointer/94)+161;var trail=pointer%94+161;return[lead,trail]}}encoders["EUC-JP"]=function(options){return new EUCJPEncoder(options)};decoders["EUC-JP"]=function(options){return new EUCJPDecoder(options)};function ISO2022JPDecoder(options){var fatal= +options.fatal;var states={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6};var iso2022jp_decoder_state=states.ASCII,iso2022jp_decoder_output_state=states.ASCII,iso2022jp_lead=0,iso2022jp_output_flag=false;this.handler=function(stream,bite){switch(iso2022jp_decoder_state){default:case states.ASCII:if(bite===27){iso2022jp_decoder_state=states.EscapeStart;return null}if(inRange(bite,0,127)&&bite!==14&&bite!==15&&bite!==27){iso2022jp_output_flag=false;return bite}if(bite===end_of_stream)return finished; +iso2022jp_output_flag=false;return decoderError(fatal);case states.Roman:if(bite===27){iso2022jp_decoder_state=states.EscapeStart;return null}if(bite===92){iso2022jp_output_flag=false;return 165}if(bite===126){iso2022jp_output_flag=false;return 8254}if(inRange(bite,0,127)&&bite!==14&&bite!==15&&bite!==27&&bite!==92&&bite!==126){iso2022jp_output_flag=false;return bite}if(bite===end_of_stream)return finished;iso2022jp_output_flag=false;return decoderError(fatal);case states.Katakana:if(bite===27){iso2022jp_decoder_state= +states.EscapeStart;return null}if(inRange(bite,33,95)){iso2022jp_output_flag=false;return 65377+bite-33}if(bite===end_of_stream)return finished;iso2022jp_output_flag=false;return decoderError(fatal);case states.LeadByte:if(bite===27){iso2022jp_decoder_state=states.EscapeStart;return null}if(inRange(bite,33,126)){iso2022jp_output_flag=false;iso2022jp_lead=bite;iso2022jp_decoder_state=states.TrailByte;return null}if(bite===end_of_stream)return finished;iso2022jp_output_flag=false;return decoderError(fatal); +case states.TrailByte:if(bite===27){iso2022jp_decoder_state=states.EscapeStart;return decoderError(fatal)}if(inRange(bite,33,126)){iso2022jp_decoder_state=states.LeadByte;var pointer=(iso2022jp_lead-33)*94+bite-33;var code_point=indexCodePointFor(pointer,index("jis0208"));if(code_point===null)return decoderError(fatal);return code_point}if(bite===end_of_stream){iso2022jp_decoder_state=states.LeadByte;stream.prepend(bite);return decoderError(fatal)}iso2022jp_decoder_state=states.LeadByte;return decoderError(fatal); +case states.EscapeStart:if(bite===36||bite===40){iso2022jp_lead=bite;iso2022jp_decoder_state=states.Escape;return null}stream.prepend(bite);iso2022jp_output_flag=false;iso2022jp_decoder_state=iso2022jp_decoder_output_state;return decoderError(fatal);case states.Escape:var lead=iso2022jp_lead;iso2022jp_lead=0;var state=null;if(lead===40&&bite===66)state=states.ASCII;if(lead===40&&bite===74)state=states.Roman;if(lead===40&&bite===73)state=states.Katakana;if(lead===36&&(bite===64||bite===66))state=states.LeadByte; +if(state!==null){iso2022jp_decoder_state=iso2022jp_decoder_state=state;var output_flag=iso2022jp_output_flag;iso2022jp_output_flag=true;return!output_flag?null:decoderError(fatal)}stream.prepend([lead,bite]);iso2022jp_output_flag=false;iso2022jp_decoder_state=iso2022jp_decoder_output_state;return decoderError(fatal)}}}function ISO2022JPEncoder(options){var fatal=options.fatal;var states={ASCII:0,Roman:1,jis0208:2};var iso2022jp_state=states.ASCII;this.handler=function(stream,code_point){if(code_point=== +end_of_stream&&iso2022jp_state!==states.ASCII){stream.prepend(code_point);iso2022jp_state=states.ASCII;return[27,40,66]}if(code_point===end_of_stream&&iso2022jp_state===states.ASCII)return finished;if((iso2022jp_state===states.ASCII||iso2022jp_state===states.Roman)&&(code_point===14||code_point===15||code_point===27))return encoderError(65533);if(iso2022jp_state===states.ASCII&&isASCIICodePoint(code_point))return code_point;if(iso2022jp_state===states.Roman&&(isASCIICodePoint(code_point)&&code_point!== +92&&code_point!==126||(code_point==165||code_point==8254))){if(isASCIICodePoint(code_point))return code_point;if(code_point===165)return 92;if(code_point===8254)return 126}if(isASCIICodePoint(code_point)&&iso2022jp_state!==states.ASCII){stream.prepend(code_point);iso2022jp_state=states.ASCII;return[27,40,66]}if((code_point===165||code_point===8254)&&iso2022jp_state!==states.Roman){stream.prepend(code_point);iso2022jp_state=states.Roman;return[27,40,74]}if(code_point===8722)code_point=65293;var pointer= +indexPointerFor(code_point,index("jis0208"));if(pointer===null)return encoderError(code_point);if(iso2022jp_state!==states.jis0208){stream.prepend(code_point);iso2022jp_state=states.jis0208;return[27,36,66]}var lead=floor(pointer/94)+33;var trail=pointer%94+33;return[lead,trail]}}encoders["ISO-2022-JP"]=function(options){return new ISO2022JPEncoder(options)};decoders["ISO-2022-JP"]=function(options){return new ISO2022JPDecoder(options)};function ShiftJISDecoder(options){var fatal=options.fatal;var shiftjis_lead= +0;this.handler=function(stream,bite){if(bite===end_of_stream&&shiftjis_lead!==0){shiftjis_lead=0;return decoderError(fatal)}if(bite===end_of_stream&&shiftjis_lead===0)return finished;if(shiftjis_lead!==0){var lead=shiftjis_lead;var pointer=null;shiftjis_lead=0;var offset=bite<127?64:65;var lead_offset=lead<160?129:193;if(inRange(bite,64,126)||inRange(bite,128,252))pointer=(lead-lead_offset)*188+bite-offset;var code_point=pointer===null?null:indexCodePointFor(pointer,index("jis0208"));if(code_point=== +null&&pointer!==null&&inRange(pointer,8836,10528))return 57344+pointer-8836;if(code_point===null&&isASCIIByte(bite))stream.prepend(bite);if(code_point===null)return decoderError(fatal);return code_point}if(isASCIIByte(bite)||bite===128)return bite;if(inRange(bite,161,223))return 65377+bite-161;if(inRange(bite,129,159)||inRange(bite,224,252)){shiftjis_lead=bite;return null}return decoderError(fatal)}}function ShiftJISEncoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point=== +end_of_stream)return finished;if(isASCIICodePoint(code_point)||code_point===128)return code_point;if(code_point===165)return 92;if(code_point===8254)return 126;if(inRange(code_point,65377,65439))return code_point-65377+161;if(code_point===8722)code_point=65293;var pointer=indexShiftJISPointerFor(code_point);if(pointer===null)return encoderError(code_point);var lead=floor(pointer/188);var lead_offset=lead<31?129:193;var trail=pointer%188;var offset=trail<63?64:65;return[lead+lead_offset,trail+offset]}} +encoders["Shift_JIS"]=function(options){return new ShiftJISEncoder(options)};decoders["Shift_JIS"]=function(options){return new ShiftJISDecoder(options)};function EUCKRDecoder(options){var fatal=options.fatal;var euckr_lead=0;this.handler=function(stream,bite){if(bite===end_of_stream&&euckr_lead!==0){euckr_lead=0;return decoderError(fatal)}if(bite===end_of_stream&&euckr_lead===0)return finished;if(euckr_lead!==0){var lead=euckr_lead;var pointer=null;euckr_lead=0;if(inRange(bite,65,254))pointer=(lead- +129)*190+(bite-65);var code_point=pointer===null?null:indexCodePointFor(pointer,index("euc-kr"));if(pointer===null&&isASCIIByte(bite))stream.prepend(bite);if(code_point===null)return decoderError(fatal);return code_point}if(isASCIIByte(bite))return bite;if(inRange(bite,129,254)){euckr_lead=bite;return null}return decoderError(fatal)}}function EUCKREncoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point; +var pointer=indexPointerFor(code_point,index("euc-kr"));if(pointer===null)return encoderError(code_point);var lead=floor(pointer/190)+129;var trail=pointer%190+65;return[lead,trail]}}encoders["EUC-KR"]=function(options){return new EUCKREncoder(options)};decoders["EUC-KR"]=function(options){return new EUCKRDecoder(options)};function convertCodeUnitToBytes(code_unit,utf16be){var byte1=code_unit>>8;var byte2=code_unit&255;if(utf16be)return[byte1,byte2];return[byte2,byte1]}function UTF16Decoder(utf16_be, +options){var fatal=options.fatal;var utf16_lead_byte=null,utf16_lead_surrogate=null;this.handler=function(stream,bite){if(bite===end_of_stream&&(utf16_lead_byte!==null||utf16_lead_surrogate!==null))return decoderError(fatal);if(bite===end_of_stream&&utf16_lead_byte===null&&utf16_lead_surrogate===null)return finished;if(utf16_lead_byte===null){utf16_lead_byte=bite;return null}var code_unit;if(utf16_be)code_unit=(utf16_lead_byte<<8)+bite;else code_unit=(bite<<8)+utf16_lead_byte;utf16_lead_byte=null; +if(utf16_lead_surrogate!==null){var lead_surrogate=utf16_lead_surrogate;utf16_lead_surrogate=null;if(inRange(code_unit,56320,57343))return 65536+(lead_surrogate-55296)*1024+(code_unit-56320);stream.prepend(convertCodeUnitToBytes(code_unit,utf16_be));return decoderError(fatal)}if(inRange(code_unit,55296,56319)){utf16_lead_surrogate=code_unit;return null}if(inRange(code_unit,56320,57343))return decoderError(fatal);return code_unit}}function UTF16Encoder(utf16_be,options){var fatal=options.fatal;this.handler= +function(stream,code_point){if(code_point===end_of_stream)return finished;if(inRange(code_point,0,65535))return convertCodeUnitToBytes(code_point,utf16_be);var lead=convertCodeUnitToBytes((code_point-65536>>10)+55296,utf16_be);var trail=convertCodeUnitToBytes((code_point-65536&1023)+56320,utf16_be);return lead.concat(trail)}}encoders["UTF-16BE"]=function(options){return new UTF16Encoder(true,options)};decoders["UTF-16BE"]=function(options){return new UTF16Decoder(true,options)};encoders["UTF-16LE"]= +function(options){return new UTF16Encoder(false,options)};decoders["UTF-16LE"]=function(options){return new UTF16Decoder(false,options)};function XUserDefinedDecoder(options){var fatal=options.fatal;this.handler=function(stream,bite){if(bite===end_of_stream)return finished;if(isASCIIByte(bite))return bite;return 63360+bite-128}}function XUserDefinedEncoder(options){var fatal=options.fatal;this.handler=function(stream,code_point){if(code_point===end_of_stream)return finished;if(isASCIICodePoint(code_point))return code_point; +if(inRange(code_point,63360,63487))return code_point-63360+128;return encoderError(code_point)}}encoders["x-user-defined"]=function(options){return new XUserDefinedEncoder(options)};decoders["x-user-defined"]=function(options){return new XUserDefinedDecoder(options)};if(!global["TextEncoder"])global["TextEncoder"]=TextEncoder;if(!global["TextDecoder"])global["TextDecoder"]=TextDecoder;if(typeof module!=="undefined"&&module.exports)module.exports={TextEncoder:global["TextEncoder"],TextDecoder:global["TextDecoder"], +EncodingIndexes:global["encoding-indexes"]}})(this); +(function(){var origInitByEnvironment;if(typeof fetch!=="function"||!("keepalive"in new Request("")))return;origInitByEnvironment=TinCan.LRS.prototype._initByEnvironment;TinCan.LRS.prototype._initByEnvironment=function(cfg){var lrs=this,origMakeRequest;origInitByEnvironment.call(this,cfg);origMakeRequest=this._makeRequest;this._makeRequest=function(_fullUrl,headers,cfg){var origResult=origMakeRequest.apply(lrs,arguments),pairs=[],fullUrl=_fullUrl,fetchRequestCfg;if(typeof cfg.callback!=="undefined")return origResult; +if(typeof origResult.err==="undefined"||origResult.err===null||origResult.err!==0)return origResult;for(prop in cfg.params)if(cfg.params.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(cfg.params[prop]));fullUrl=lrs._IEModeConversion(fullUrl,headers,pairs,cfg);fetchRequestCfg={mode:"cors",cache:"no-cache",credentials:"include",keepalive:true,method:cfg.method,headers:{"Content-Type":headers["Content-Type"]},body:cfg.data};try{fetch(fullUrl,fetchRequestCfg).then(function(response){lrs.log("Overridden request Fetch with KeepAlive finished with status "+ +response.status+":"+response.statusText)})["catch"](function(e){lrs.log("Overridden request Fetch with KeepAlive returned error: "+e.message)});return{err:null}}catch(e){lrs.log("Overridden request Fetch with KeepAlive threw error: "+e.message);return{err:e.message,xhr:null}}}}})(); +(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)root=freeGlobal;var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^ -~]/,regexSeparators=/\x2E|\u3002|\uFF0E|\uFF61/g,errors={"overflow":"Overflow: input needs wider integers to process", +"not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw RangeError(errors[type]);}function map(array,fn){var length=array.length;while(length--)array[length]=fn(array[length]);return array}function mapDomain(string,fn){return map(string.split(regexSeparators),fn).join(".")}function ucs2decode(string){var output=[],counter=0,length=string.length,value, +extra;while(counter=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value); +return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10)return codePoint-22;if(codePoint-65<26)return codePoint-65;if(codePoint-97<26)return codePoint-97;return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/ +(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,length,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0)basic=0;for(j=0;j=128)error("not-basic");output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index=inputLength)error("invalid-input");digit=basicToDigit(input.charCodeAt(index++));if(digit>=base|| +digit>floor((maxInt-i)/w))error("overflow");i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digitfloor(maxInt/baseMinusT))error("overflow");w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n)error("overflow");n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT, +qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j=n&¤tValuefloor((maxInt-delta)/handledCPCountPlusOne))error("overflow"); +delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;jmaxInt)error("overflow");if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb]))/ig;URI.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb]+$/};URI.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"};URI.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/;URI.domAttributes= +{"a":"href","blockquote":"cite","link":"href","base":"href","script":"src","form":"action","img":"src","area":"href","iframe":"src","embed":"src","source":"src","track":"src","input":"src","audio":"src","video":"src"};URI.getDomAttribute=function(node){if(!node||!node.nodeName)return undefined;var nodeName=node.nodeName.toLowerCase();if(nodeName==="input"&&node.type!=="image")return undefined;return URI.domAttributes[nodeName]};function escapeForDumbFirefox36(value){return escape(value)}function strictEncodeURIComponent(string){return encodeURIComponent(string).replace(/[!'()*]/g, +escapeForDumbFirefox36).replace(/\*/g,"%2A")}function _isIriCodePoint(point){return point===45||point===46||point===95||point===126||point>=48&&point<64||point>=65&&point<91||point>=97&&point<123||point>=160&&point<55296||point>=57344&&point<63743||point>=63744&&point<64976||point>=65008&&point<65520||point>=65536&&point<131070||point>=131072&&point<196606||point>=196608&&point<262142||point>=262144&&point<327678||point>=327680&&point<393214||point>=393216&&point<458750||point>=458752&&point<524286|| +point>=524288&&point<589822||point>=589824&&point<655358||point>=655360&&point<720894||point>=720896&&point<786430||point>=786432&&point<851966||point>=851968&&point<917502||point>=917504&&point<983038||point>=983040&&point<1048574||point>=1048576&&point<1114110}function encodeIRIComponent(string){var inputCodePoints=punycode.ucs2.decode(string);var output="";for(var i=0;i-1){parts.fragment=string.substring(pos+1)||null;string=string.substring(0,pos)}pos=string.indexOf("?");if(pos>-1){parts.query=string.substring(pos+1)||null;string=string.substring(0,pos)}if(string.substring(0,2)==="//"){parts.protocol=null;string=string.substring(2);string=URI.parseAuthority(string,parts)}else{pos=string.indexOf(":"); +if(pos>-1){parts.protocol=string.substring(0,pos)||null;if(parts.protocol&&!parts.protocol.match(URI.protocol_expression))parts.protocol=undefined;else if(string.substring(pos+1,pos+3)==="//"){string=string.substring(pos+3);string=URI.parseAuthority(string,parts)}else{string=string.substring(pos+1);parts.urn=true}}}parts.path=string;return parts};URI.parseHost=function(string,parts){var pos=string.indexOf("/");var bracketPos;var t;if(pos===-1)pos=string.length;if(string.charAt(0)==="["){bracketPos= +string.indexOf("]");parts.hostname=string.substring(1,bracketPos)||null;parts.port=string.substring(bracketPos+2,pos)||null;if(parts.port==="/")parts.port=null}else{var firstColon=string.indexOf(":");var firstSlash=string.indexOf("/");var nextColon=string.indexOf(":",firstColon+1);if(nextColon!==-1&&(firstSlash===-1||nextColon-1?firstSlash:string.length-1);var t;if(pos>-1&&(firstSlash===-1||pos",NAME:"<%= pkg.name %>",DESCRIPTION:"<%= pkg.description %>"},nativeRequest,xdrRequest,requestComplete,__delay,env={},STATE_LMS_LAUNCHDATA="LMS.LaunchData",LAUNCH_MODE_NORMAL="Normal",AGENT_PROFILE_LEARNER_PREFS="cmi5LearnerPreferences",CATEGORY_ACTIVITY_CMI5=new TinCan.Activity({id:"https://w3id.org/xapi/cmi5/context/categories/cmi5"}),CATEGORY_ACTIVITY_MOVEON=new TinCan.Activity({id:"https://w3id.org/xapi/cmi5/context/categories/moveon"}),OTHER_ACTIVITY_CMI5JS= +new TinCan.Activity({id:"http://id.tincanapi.com/activity/software/"+THIS_LIBRARY.NAME+"/"+THIS_LIBRARY.VERSION,definition:{name:{und:THIS_LIBRARY.NAME+" ("+THIS_LIBRARY.VERSION+")"},description:{"en":THIS_LIBRARY.DESCRIPTION},type:"http://id.tincanapi.com/activitytype/source"}}),EXTENSION_SESSION_ID="https://w3id.org/xapi/cmi5/context/extensions/sessionid",EXTENSION_MASTERY_SCORE="https://w3id.org/xapi/cmi5/context/extensions/masteryscore",VERB_INITIALIZED_ID="http://adlnet.gov/expapi/verbs/initialized", +VERB_TERMINATED_ID="http://adlnet.gov/expapi/verbs/terminated",VERB_COMPLETED_ID="http://adlnet.gov/expapi/verbs/completed",VERB_PASSED_ID="http://adlnet.gov/expapi/verbs/passed",VERB_FAILED_ID="http://adlnet.gov/expapi/verbs/failed",verbDisplay={},launchParameters=["endpoint","fetch","actor","activityId","registration"],isInteger;isInteger=function(value){return typeof value==="number"&&isFinite(value)&&Math.floor(value)===value};verbDisplay[VERB_INITIALIZED_ID]={"en":"initialized"};verbDisplay[VERB_TERMINATED_ID]= +{"en":"terminated"};env.hasCORS=false;env.useXDR=false;if(typeof XMLHttpRequest!=="undefined"&&typeof(new XMLHttpRequest).withCredentials!=="undefined")env.hasCORS=true;else if(typeof XDomainRequest!=="undefined"){env.hasCORS=true;env.useXDR=true}Cmi5=function(launchString){this.log("constructor",launchString);var url,cfg,i;if(typeof launchString!=="undefined"){url=new URI(launchString);cfg=url.search(true);for(i=0;i100)throw new Error("Invalid progress measure must be greater than or equal to 0 and less than or equal to 100: "+progress);}this._progress=progress},getProgress:function(){this.log("getProgress");return this._progress},setFetch:function(fetchURL){this.log("setFetch: ", +fetchURL);var urlParts,schemeMatches,locationPort,isXD;this._fetch=fetchURL;this._fetchRequest=nativeRequest;urlParts=fetchURL.toLowerCase().match(/([A-Za-z]+:)\/\/([^:\/]+):?(\d+)?(\/.*)?$/);if(urlParts===null)throw new Error("URL invalid: failed to divide URL parts");locationPort=location.port;schemeMatches=location.protocol.toLowerCase()===urlParts[1];if(locationPort==="")locationPort=location.protocol.toLowerCase()==="http:"?"80":location.protocol.toLowerCase()==="https:"?"443":"";isXD=!schemeMatches|| +location.hostname.toLowerCase()!==urlParts[2]||locationPort!==(urlParts[3]!==null&&typeof urlParts[3]!=="undefined"&&urlParts[3]!==""?urlParts[3]:urlParts[1]==="http:"?"80":urlParts[1]==="https:"?"443":"");if(isXD)if(env.hasCORS)if(env.useXDR&&schemeMatches)this._fetchRequest=xdrRequest;else{if(env.useXDR&&!schemeMatches){this.log("[error] URL invalid: cross domain request for differing scheme in IE with XDR");throw new Error("URL invalid: cross domain request for differing scheme in IE with XDR"); +}}else{this.log("[error] URL invalid: cross domain requests not supported in this browser");throw new Error("URL invalid: cross domain requests not supported in this browser");}},getFetch:function(){return this._fetch},setLRS:function(endpoint,auth){this.log("setLRS: ",endpoint,auth);if(this._lrs!==null){if(typeof auth==="undefined"&&endpoint===null||endpoint!==null)this._endpoint=this._lrs.endpoint=endpoint;if(typeof auth!=="undefined"&&auth!==null)this._lrs.auth=auth}else this._lrs=new TinCan.LRS({endpoint:endpoint, +auth:auth,allowFail:false})},getLRS:function(){return this._lrs},setActor:function(agent){if(!(agent instanceof TinCan.Agent))agent=TinCan.Agent.fromJSON(agent);if(agent.account===null||!(agent.account instanceof TinCan.AgentAccount))throw new Error("Invalid actor: missing or invalid account");else if(agent.account.name===null)throw new Error("Invalid actor: name is null");else if(agent.account.name==="")throw new Error("Invalid actor: name is empty");else if(agent.account.homePage===null)throw new Error("Invalid actor: homePage is null"); +else if(agent.account.homePage==="")throw new Error("Invalid actor: homePage is empty");this._actor=agent},getActor:function(){return this._actor},setActivity:function(activity){if(!(activity instanceof TinCan.Activity))activity=new TinCan.Activity({id:activity});if(activity.id===null)throw new Error("Invalid activity: id is null");else if(activity.id==="")throw new Error("Invalid activity: id is empty");this._activity=activity},getActivity:function(){return this._activity},setRegistration:function(registration){if(registration=== +null)throw new Error("Invalid registration: null");else if(registration==="")throw new Error("Invalid registration: empty");this._registration=registration},getRegistration:function(){return this._registration},validateScore:function(score){if(typeof score==="undefined"||score===null)throw new Error("cannot validate score (score not provided): "+score);if(typeof score.min!=="undefined")if(!isInteger(score.min))throw new Error("score.min is not an integer");if(typeof score.max!=="undefined")if(!isInteger(score.max))throw new Error("score.max is not an integer"); +if(typeof score.scaled!=="undefined"){if(!/^(\-|\+)?[01]+(\.[0-9]+)?$/.test(score.scaled))throw new Error("scaled score not a recognized number: "+score.scaled);if(score.scaled<0)throw new Error("scaled score must be greater than or equal to 0");if(score.scaled>1)throw new Error("scaled score must be less than or equal to 1");}if(typeof score.raw!=="undefined"){if(!isInteger(score.raw))throw new Error("score.raw is not an integer");if(typeof score.min==="undefined")throw new Error("minimum score must be provided when including a raw score"); +if(typeof score.max==="undefined")throw new Error("maximum score must be provided when including a raw score");if(score.rawscore.max)throw new Error("raw score must be less than or equal to maximum score");}return true},prepareStatement:function(verbId){var stCfg={actor:this._actor,verb:{id:verbId},target:this._activity,context:this._prepareContext()},progress=this.getProgress();if(typeof verbDisplay[verbId]!== +"undefined")stCfg.verb.display=verbDisplay[verbId];if(verbId!==VERB_COMPLETED_ID&&progress!==null)stCfg.result={extensions:{"https://w3id.org/xapi/cmi5/result/extensions/progress":progress}};return new TinCan.Statement(stCfg)},sendStatement:function(st,callback){var cbWrapper,result;if(callback)cbWrapper=function(err,result){if(err!==null){callback(new Error(err),result);return}callback(err,result,st)};result=this._lrs.saveStatement(st,{callback:cbWrapper});if(!callback)return{response:result,statement:st}}, +initializedStatement:function(){this.log("initializedStatement");return this._prepareStatement(VERB_INITIALIZED_ID)},terminatedStatement:function(){this.log("terminatedStatement");var st=this._prepareStatement(VERB_TERMINATED_ID);st.result=st.result||new TinCan.Result;st.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration());return st},passedStatement:function(score){this.log("passedStatement");var st=this._prepareStatement(VERB_PASSED_ID),masteryScore;st.result=st.result|| +new TinCan.Result;st.result.success=true;st.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration());if(score){try{this.validateScore(score)}catch(ex){throw new Error("Invalid score - "+ex);}masteryScore=this.getMasteryScore();if(masteryScore!==null&&typeof score.scaled!=="undefined"){if(score.scaled=masteryScore)throw new Error("Invalid score - scaled score exceeds mastery score ("+score.scaled+" >= "+masteryScore+")");st.context.extensions=st.context.extensions||{};st.context.extensions[EXTENSION_MASTERY_SCORE]=masteryScore}st.result.score=new TinCan.Score(score)}st.context.contextActivities.category.push(CATEGORY_ACTIVITY_MOVEON);return st},completedStatement:function(){this.log("completedStatement"); +var st=this._prepareStatement(VERB_COMPLETED_ID);st.result=st.result||new TinCan.Result;st.result.completion=true;st.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(this.getDuration());st.context.contextActivities.category.push(CATEGORY_ACTIVITY_MOVEON);return st},_prepareContext:function(){var context=JSON.parse(this._contextTemplate);context.registration=this._registration;if(this._includeSourceActivity){context.contextActivities=context.contextActivities||new TinCan.ContextActivities; +context.contextActivities.other=context.contextActivities.other||[];context.contextActivities.other.push(OTHER_ACTIVITY_CMI5JS)}return context},_prepareStatement:function(verbId){var st=this.prepareStatement(verbId);st.context.contextActivities=st.context.contextActivities||new TinCan.ContextActivities;st.context.contextActivities.category=st.context.contextActivities.category||[];st.context.contextActivities.category.push(CATEGORY_ACTIVITY_CMI5);return st}};Cmi5.enableDebug=function(includeTinCan){Cmi5.DEBUG= +true;if(includeTinCan)TinCan.enableDebug()};Cmi5.disableDebug=function(includeTinCan){Cmi5.DEBUG=false;if(includeTinCan)TinCan.disableDebug()};requestComplete=function(xhr,cfg,control,callback){this.log("requestComplete: "+control.finished+", xhr.status: "+xhr.status);var requestCompleteResult,notFoundOk,httpStatus;if(typeof xhr.status==="undefined")httpStatus=control.fakeStatus;else httpStatus=xhr.status===1223?204:xhr.status;if(!control.finished){control.finished=true;notFoundOk=cfg.ignore404&& +httpStatus===404;if(httpStatus>=200&&httpStatus<400||notFoundOk)if(callback)callback(null,xhr);else{requestCompleteResult={err:null,xhr:xhr};return requestCompleteResult}else{requestCompleteResult={err:httpStatus,xhr:xhr};if(httpStatus===0)this.log("[warning] There was a problem communicating with the server. Aborted, offline, or invalid CORS endpoint ("+httpStatus+")");else this.log("[warning] There was a problem communicating with the server. ("+httpStatus+" | "+xhr.responseText+")");if(callback)callback(httpStatus, +xhr);return requestCompleteResult}}else return requestCompleteResult};nativeRequest=function(fullUrl,cfg,callback){this.log("sendRequest using XMLHttpRequest");var self=this,xhr,prop,pairs=[],data,control={finished:false,fakeStatus:null},async,fullRequest=fullUrl;this.log("sendRequest using XMLHttpRequest - async: "+async);cfg=cfg||{};cfg.params=cfg.params||{};cfg.headers=cfg.headers||{};async=typeof callback!=="undefined";for(prop in cfg.params)if(cfg.params.hasOwnProperty(prop))pairs.push(prop+ +"="+encodeURIComponent(cfg.params[prop]));if(pairs.length>0)fullRequest+="?"+pairs.join("&");xhr=new XMLHttpRequest;xhr.open(cfg.method,fullRequest,async);for(prop in cfg.headers)if(cfg.headers.hasOwnProperty(prop))xhr.setRequestHeader(prop,cfg.headers[prop]);if(typeof cfg.data!=="undefined")cfg.data+="";data=cfg.data;if(async)xhr.onreadystatechange=function(){self.log("xhr.onreadystatechange - xhr.readyState: "+xhr.readyState);if(xhr.readyState===4)requestComplete.call(self,xhr,cfg,control,callback)}; +try{xhr.send(data)}catch(ex){this.log("sendRequest caught send exception: "+ex)}if(async)return;return requestComplete.call(this,xhr,cfg,control)};xdrRequest=function(fullUrl,cfg,callback){this.log("sendRequest using XDomainRequest");var self=this,xhr,pairs=[],data,prop,until,control={finished:false,fakeStatus:null},err;cfg=cfg||{};cfg.params=cfg.params||{};cfg.headers=cfg.headers||{};if(typeof cfg.headers["Content-Type"]!=="undefined"&&cfg.headers["Content-Type"]!=="application/json"){err=new Error("Unsupported content type for IE Mode request"); +if(callback){callback(err,null);return null}return{err:err,xhr:null}}for(prop in cfg.params)if(cfg.params.hasOwnProperty(prop))pairs.push(prop+"="+encodeURIComponent(cfg.params[prop]));if(pairs.length>0)fullUrl+="?"+pairs.join("&");xhr=new XDomainRequest;xhr.open("POST",fullUrl);if(!callback){xhr.onload=function(){control.fakeStatus=200};xhr.onerror=function(){control.fakeStatus=400};xhr.ontimeout=function(){control.fakeStatus=0}}else{xhr.onload=function(){control.fakeStatus=200;requestComplete.call(self, +xhr,cfg,control,callback)};xhr.onerror=function(){control.fakeStatus=400;requestComplete.call(self,xhr,cfg,control,callback)};xhr.ontimeout=function(){control.fakeStatus=0;requestComplete.call(self,xhr,cfg,control,callback)}}xhr.onprogress=function(){};xhr.timeout=0;try{xhr.send(data)}catch(ex){this.log("sendRequest caught send exception: "+ex)}if(!callback){until=1E4+Date.now();this.log("sendRequest - until: "+until+", finished: "+control.finished);while(Date.now()0){requestResults=tincan.sendStatements(tcapi_cache.statementQueue);if(typeof requestResults.results!=="undefined"&&requestResults.results.length>0){result=requestResults.results[0]; +if(result.err!==null){errMesg="Failed to commit data: statements";if(/^\d+$/.test(result.err)){errCode=result.err;if(result.err===0)errDiag="Aborted, offline, or invalid CORS endpoint";else errDiag=result.xhr.responseText}else{errCode=TCAPI_DEP_ERROR;errDiag=result.err}if(statementAdded){tcapi_cache.statementQueue.pop();TCAPI_UPDATES_PENDING=true}TCAPI_SetErrorInfoManually(errCode,errMesg,errDiag);return false}}tcapi_cache.statementQueue=[]}return true} +function TCAPI_Finish(exitType,statusWasSet){WriteToDebug("In TCAPI_Finish - exitType: "+exitType);if(exitType===EXIT_TYPE_SUSPEND){_TCAPI_SetStateSafe(TCAPI_STATE_TOTAL_TIME,TCAPI_GetPreviouslyAccumulatedTime()+GetSessionAccumulatedTime());TCAPI_SetSuspended()}TCAPI_CommitData();return true} +function TCAPI_GetAudioPlayPreference(){WriteToDebug("In TCAPI_GetAudioPlayPreference");var intTempPreference=0,getStateResult;TCAPI_ClearErrorInfo();getStateResult=tincan.getState("cmi.student_preference.audio");if(getStateResult.state!==null)intTempPreference=getStateResult.state.contents;intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference==0){WriteToDebug("Returning Default"); +return PREFERENCE_DEFAULT}else if(intTempPreference<0){WriteToDebug("returning Off");return PREFERENCE_OFF}WriteToDebug("Error: Invalid preference");TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null} +function TCAPI_GetAudioVolumePreference(){WriteToDebug("In TCAPI_GetAudioVollumePreference");var intTempPreference=100,getStateResult;TCAPI_ClearErrorInfo();getStateResult=tincan.getState("cmi.student_preference.audio");if(getStateResult.state!==null)intTempPreference=getStateResult.state.contents;WriteToDebug("intTempPreference="+intTempPreference);intTempPreference=parseInt(intTempPreference,10);if(intTempPreference<=0){WriteToDebug("Setting to 100");intTempPreference=100}if(intTempPreference>100){WriteToDebug("ERROR: invalid preference"); +TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid audio preference received from LMS","intTempPreference="+intTempPreference);return null}WriteToDebug("Returning "+intTempPreference);return intTempPreference} +function TCAPI_SetAudioPreference(PlayPreference,intPercentOfMaxVolume){WriteToDebug("In TCAPI_SetAudioPreference PlayPreference="+PlayPreference+", intPercentOfMaxVolume="+intPercentOfMaxVolume);TCAPI_ClearErrorInfo();if(PlayPreference==PREFERENCE_OFF){WriteToDebug("Setting percent to -1 - OFF");intPercentOfMaxVolume=-1}_TCAPI_SetStateSafe("cmi.student_preference.audio",intPercentOfMaxVolume)} +function TCAPI_SetLanguagePreference(strLanguage){WriteToDebug("In TCAPI_SetLanguagePreference strLanguage="+strLanguage);TCAPI_ClearErrorInfo();_TCAPI_SetStateSafe("cmi.student_preference.language",strLanguage)}function TCAPI_GetLanguagePreference(){WriteToDebug("In TCAPI_GetLanguagePreference");var pref,getStateResult;TCAPI_ClearErrorInfo();getStateResult=tincan.getState("cmi.student_preference.language");if(getStateResult.state!==null)pref=getStateResult.state.contents;return pref} +function TCAPI_SetSpeedPreference(intPercentOfMax){WriteToDebug("In TCAPI_SetSpeedPreference intPercentOfMax="+intPercentOfMax);var intTCAPISpeed;TCAPI_ClearErrorInfo();intTCAPISpeed=intPercentOfMax*2-100;WriteToDebug("intTCAPISpeed="+intTCAPISpeed);_TCAPI_SetStateSafe("cmi.student_preference.speed",intTCAPISpeed)} +function TCAPI_GetSpeedPreference(){WriteToDebug("In TCAPI_GetSpeedPreference");var intTCAPISpeed=100,intPercentOfMax,getStateResult;TCAPI_ClearErrorInfo();getStateResult=tincan.getState("cmi.student_preference.speed");if(getStateResult.state!==null)intTCAPISpeed=getStateResult.state.contents;WriteToDebug("intTCAPISpeed="+intTCAPISpeed);if(!ValidInteger(intTCAPISpeed)){WriteToDebug("ERROR - invalid integer");TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - not an integer", +"intTCAPISpeed="+intTCAPISpeed);return null}intTCAPISpeed=parseInt(intTCAPISpeed,10);if(intTCAPISpeed<-100||intTCAPISpeed>100){WriteToDebug("ERROR - out of range");TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_SPEED,"Invalid speed preference received from LMS - out of range","intTCAPISpeed="+intTCAPISpeed);return null}intPercentOfMax=(intTCAPISpeed+100)/2;intPercentOfMax=parseInt(intPercentOfMax,10);WriteToDebug("Returning "+intPercentOfMax);return intPercentOfMax} +function TCAPI_SetTextPreference(intPreference){WriteToDebug("In TCAPI_SetTextPreference intPreference="+intPreference);TCAPI_ClearErrorInfo();_TCAPI_SetStateSafe("cmi.student_preference.text",intPreference)} +function TCAPI_GetTextPreference(){WriteToDebug("In TCAPI_GetTextPreference");var intTempPreference=0,getStateResult;TCAPI_ClearErrorInfo();getStateResult=tincan.getState("cmi.student_preference.text");if(getStateResult.state!==null)intTempPreference=getStateResult.state.contents;intTempPreference=parseInt(intTempPreference,10);WriteToDebug("intTempPreference="+intTempPreference);if(intTempPreference>0){WriteToDebug("Returning On");return PREFERENCE_ON}else if(intTempPreference==0||intTempPreference== +""){WriteToDebug("Returning Default");return PREFERENCE_DEFAULT}else if(intTempPreference<0){WriteToDebug("returning Off");return PREFERENCE_OFF}WriteToDebug("Error: Invalid preference");TCAPI_SetErrorInfoManually(TCAPI_ERROR_INVALID_PREFERENCE,"Invalid text preference received from LMS","intTempPreference="+intTempPreference);return null} +function TCAPI_GetPreviouslyAccumulatedTime(){WriteToDebug("In TCAPI_GetPreviouslyAccumulatedTime");var data=0,getStateResult;WriteToDebug("In TCAPI_GetPreviouslyAccumulatedTime - cached: "+tcapi_cache.totalPrevDuration);if(tcapi_cache.totalPrevDuration===null){getStateResult=tincan.getState(TCAPI_STATE_TOTAL_TIME);if(getStateResult.state!==null)data=Number(getStateResult.state.contents);tcapi_cache.totalPrevDuration=data===NaN?0:data}return tcapi_cache.totalPrevDuration} +function TCAPI_SaveTime(intMilliSeconds){WriteToDebug("In TCAPI_SaveTime");return true}function TCAPI_GetMaxTimeAllowed(){WriteToDebug("In TCAPI_GetMaxTimeAllowed");return null} +function TCAPI_SetScore(intScore,intMaxScore,intMinScore){WriteToDebug("In TCAPI_SetScore intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);TCAPI_ClearErrorInfo();TCAPI_SCORE["raw"]=intScore;TCAPI_SCORE["max"]=intMaxScore;TCAPI_SCORE["min"]=intMinScore;WriteToDebug("Returning "+TCAPI_SCORE);TCAPI_UPDATES_PENDING=true;return true} +function TCAPI_GetScore(){WriteToDebug("In TCAPI_GetScore");TCAPI_ClearErrorInfo();WriteToDebug("Returning "+TCAPI_SCORE["raw"]);return TCAPI_SCORE["raw"]}function TCAPI_SetPointBasedScore(intScore,intMaxScore,intMinScore){WriteToDebug("TCAPI_SetPointBasedScore - TCAPI does not support SetPointBasedScore, falling back to SetScore");return TCAPI_SetScore(intScore,intMaxScore,intMinScore)} +function TCAPI_GetScaledScore(intScore,intMaxScore,intMinScore){WriteToDebug("TCAPI_GetScaledScore - TCAPI does not support GetScaledScore, returning false");return false} +function TCAPI_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPIInteractionType,strAlternateResponse,strAlternateCorrectResponse){var blnTempResult,intInteractionIndex,strResult,actObj={},stmt,activityName,interactionActivityId=strID,interactionActivityType=TCAPI_INTERACTION;TCAPI_ClearErrorInfo();if(strID.indexOf(tincan.activity.id+"-")==0)activityName=strID.substring(tincan.activity.id.length+1);if(!TCAPI_DONT_USE_BROKEN_URN_IDS)interactionActivityId= +tincan.activity.id+"-urn:scormdriver:"+activityName;switch(TCAPIInteractionType){case "true-false":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"true-false",name:{"und":activityName}}};break;case "choice":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"choice",name:{"und":activityName}}};break;case "fill-in":actObj={id:interactionActivityId, +definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"fill-in",name:{"und":activityName}}};break;case "matching":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"matching",name:{"und":activityName}}};break;case "performance":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"performance",name:{"und":activityName}}}; +break;case "sequencing":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"sequencing",name:{"und":activityName}}};break;case "likert":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"likert",name:{"und":activityName}}};break;case "numeric":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType, +interactionType:"numeric",name:{"und":activityName}}};break;case "other":actObj={id:interactionActivityId,definition:{description:{"en-US":strDescription},type:interactionActivityType,interactionType:"other",name:{"und":activityName}}};break;default:WriteToDebug("TCAPI_RecordInteraction received an invalid TCPAIInteractionType of "+TCAPIInteractionType);return false}if(actObj.id!==null){if(strCorrectResponse!==null&&strCorrectResponse!=="")actObj.definition.correctResponsesPattern=[strCorrectResponse]; +stmt={verb:TCAPI_VERB_ANSWERED,object:actObj,context:{contextActivities:{parent:tincan.activity,grouping:{id:tincan.activity.id+"-"+strLearningObjectiveID}}}};if(strResponse!==null||intLatency!==null&&intLatency!==""||intWeighting!==null&&intWeighting!==""){stmt.result={};if(strResponse!==null){stmt.result.response=strResponse;if(blnCorrect===true||blnCorrect===INTERACTION_RESULT_CORRECT)stmt.result.success=true;else if(blnCorrect===false||blnCorrect===""||blnCorrect==="false"||blnCorrect===INTERACTION_RESULT_WRONG)stmt.result.success= +false}if(intLatency!==null&&intLatency!=="")stmt.result.duration=TinCan.Utils.convertMillisecondsToISO8601Duration(intLatency);if(intWeighting!==null&&intWeighting!==""){stmt.result.extensions=stmt.result.extensions||{};stmt.result.extensions["http://id.tincanapi.com/extension/cmi-interaction-weighting"]=intWeighting}}tcapi_cache.statementQueue.push(stmt)}return true} +function TCAPI_RecordTrueFalseInteraction(strID,blnResponse,blnCorrect,blnCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordTrueFalseInteraction strID="+strID+", blnResponse="+blnResponse+", blnCorrect="+blnCorrect+", blnCorrectResponse="+blnCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strCorrectResponse=null;if(blnResponse===true)strResponse="true";else if(blnResponse===false)strResponse="false";if(blnCorrectResponse===true)strCorrectResponse="true";else if(blnCorrectResponse===false)strCorrectResponse="false";return TCAPI_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_TRUE_FALSE,strResponse,strCorrectResponse)} +function TCAPI_RecordMultipleChoiceInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordMultipleChoiceInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strResponseLong=null,strCorrectResponse="",strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+="[,]";if(strResponseLong.length>0)strResponseLong+="[,]";strResponse+=aryResponse[i].Short;strResponseLong+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+="[,]";if(strCorrectResponseLong.length>0)strCorrectResponseLong+="[,]"; +strCorrectResponse+=aryCorrectResponse[i].Short;strCorrectResponseLong+=aryCorrectResponse[i].Long}return TCAPI_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_CHOICE,strResponse,strCorrectResponse)} +function TCAPI_RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strResponse!== +null){strResponse=new String(strResponse);if(strResponse.length>255)strResponse=strResponse.substr(0,255)}if(strCorrectResponse!==null){strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255)}return TCAPI_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_FILL_IN,strResponse,strCorrectResponse)} +function TCAPI_RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordMatchingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strResponseLong=null,strCorrectResponse="",strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+="[,]";if(strResponseLong.length>0)strResponseLong+="[,]";strResponse+=aryResponse[i].Source.Short+"[.]"+aryResponse[i].Target.Short;strResponseLong+=aryResponse[i].Source.Long+"[.]"+aryResponse[i].Target.Long}}for(var i=0;i0)strCorrectResponse+= +"[,]";if(strCorrectResponseLong.length>0)strCorrectResponseLong+="[,]";strCorrectResponse+=aryCorrectResponse[i].Source.Short+"[.]"+aryCorrectResponse[i].Target.Short;strCorrectResponseLong+=aryCorrectResponse[i].Source.Long+"[.]"+aryCorrectResponse[i].Target.Long}return TCAPI_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_MATCHING,strResponse,strCorrectResponse)} +function TCAPI_RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strResponse!== +null){strResponse=new String(strResponse);if(strResponse.length>255)strResponse=strResponse.substr(0,255)}if(strCorrectResponse!==null){strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>255)strCorrectResponse=strCorrectResponse.substr(0,255)}return TCAPI_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_PERFORMANCE,strResponse,strCorrectResponse)} +function TCAPI_RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordSequencingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strResponseLong=null,strCorrectResponse="",strCorrectResponseLong="";if(aryResponse!==null){strResponse="";strResponseLong="";for(var i=0;i0)strResponse+="[,]";if(strResponseLong.length>0)strResponseLong+="[,]";strResponse+=aryResponse[i].Short;strResponseLong+=aryResponse[i].Long}}for(var i=0;i0)strCorrectResponse+="[,]";if(strCorrectResponseLong.length>0)strCorrectResponseLong+="[,]"; +strCorrectResponse+=aryCorrectResponse[i].Short;strCorrectResponseLong+=aryCorrectResponse[i].Long}return TCAPI_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_SEQUENCING,strResponse,strCorrectResponse)} +function TCAPI_RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse=null,strResponseLong= +null,strCorrectResponse=null,strCorrectResponseLong=null;if(response!==null){strResponse=response.Short;strResponseLong=response.Long}if(correctResponse!==null){strCorrectResponse=correctResponse.Short;strCorrectResponseLong=correctResponse.Long}return TCAPI_RecordInteraction(strID,strResponseLong,blnCorrect,strCorrectResponseLong,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_LIKERT,strResponse,strCorrectResponse)} +function TCAPI_RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In TCAPI_RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(typeof strCorrectResponse!== +"undefined"&&strCorrectResponse!==null)if(!IsValidDecimalRange(strCorrectResponse)&&!IsValidDecimal(strCorrectResponse)){WriteToDebug("Returning False - TCAPI_RecordNumericInteraction received invalid correct response (not a decimal or range), strCorrectResponse="+strCorrectResponse);return false}return TCAPI_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,TCAPI_INTERACTION_TYPE_NUMERIC,strResponse,strCorrectResponse)} +function TCAPI_GetEntryMode(){WriteToDebug("In TCAPI_GetEntryMode");return null}function TCAPI_GetLessonMode(){WriteToDebug("In TCAPI_GetLessonMode");return null}function TCAPI_GetTakingForCredit(){WriteToDebug("In TCAPI_GetTakingForCredit");return null} +function TCAPI_SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore){WriteToDebug("In TCAPI_SetObjectiveScore, strObejctiveID="+strObjectiveID+", intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);return false}function TCAPI_SetObjectiveDescription(strObjectiveID,strObjectiveDescription){WriteToDebug("In TCAPI_SetObjectiveDescription, strObjectiveDescription="+strObjectiveDescription);return false} +function TCAPI_SetObjectiveStatus(strObjectiveID,Lesson_Status){WriteToDebug("In TCAPI_SetObjectiveStatus strObjectiveID="+strObjectiveID+", Lesson_Status="+Lesson_Status);return false}function TCAPI_GetObjectiveScore(strObjectiveID){WriteToDebug("In TCAPI_GetObjectiveScore, strObejctiveID="+strObjectiveID);return false}function TCAPI_GetObjectiveDescription(strObjectiveID){WriteToDebug("In TCAPI_GetObjectiveDescription, strObejctiveID="+strObjectiveID);return false} +function TCAPI_GetObjectiveStatus(strObjectiveID){WriteToDebug("In TCAPI_GetObjectiveStatus, strObejctiveID="+strObjectiveID);return false}function TCAPI_SetSuspended(){WriteToDebug("In TCAPI_SetSuspended");if(TCAPI_IN_PROGRESS){TCAPI_IN_PROGRESS=false;TCAPI_UPDATES_PENDING=true}return true} +function TCAPI_SetFailed(){WriteToDebug("In TCAPI_SetFailed");TCAPI_STATUS=TCAPI_VERB_FAILED;TCAPI_STATUS_CHANGED=true;TCAPI_SATISFACTION_STATUS=false;TCAPI_IN_PROGRESS=false;TCAPI_UPDATES_PENDING=true;return true}function TCAPI_SetPassed(){WriteToDebug("In TCAPI_SetPassed");TCAPI_STATUS=TCAPI_VERB_PASSED;TCAPI_STATUS_CHANGED=true;TCAPI_SATISFACTION_STATUS=true;TCAPI_IN_PROGRESS=false;TCAPI_UPDATES_PENDING=true;return true} +function TCAPI_SetCompleted(){WriteToDebug("In TCAPI_SetCompleted");TCAPI_ClearErrorInfo();if(TCAPI_STATUS===TCAPI_INIT_VERB){TCAPI_STATUS=TCAPI_VERB_COMPLETED;TCAPI_STATUS_CHANGED=true}TCAPI_COMPLETION_STATUS=TCAPI_VERB_COMPLETED;TCAPI_IN_PROGRESS=false;TCAPI_UPDATES_PENDING=true;return true} +function TCAPI_ResetStatus(){WriteToDebug("In TCAPI_ResetStatus");TCAPI_ClearErrorInfo();TCAPI_STATUS=TCAPI_INIT_VERB;TCAPI_STATUS_CHANGED=true;TCAPI_COMPLETION_STATUS="";TCAPI_SATISFACTION_STATUS=null;TCAPI_IN_PROGRESS=true;TCAPI_UPDATES_PENDING=true;return true} +function TCAPI_GetStatus(){WriteToDebug("In TCAPI_GetStatus");var strStatus="";TCAPI_ClearErrorInfo();if(TCAPI_STATUS===TCAPI_VERB_COMPLETED)strStatus="completed";else if(TCAPI_STATUS===TCAPI_VERB_ATTEMPTED)strStatus="attempted";else if(TCAPI_STATUS===TCAPI_VERB_PASSED)strStatus="passed";else if(TCAPI_STATUS===TCAPI_VERB_FAILED)strStatus="failed";else strStatus=TCAPI_STATUS;WriteToDebug("In TCAPI_GetStatus - strStatus="+strStatus);return strStatus} +function TCAPI_CreateValidIdentifier(str){return tincan.activity.id+"-"+encodeURIComponent(str)}function TCAPI_SetNavigationRequest(strNavRequest){WriteToDebug("TCAPI_GetNavigationRequest - TCAPI does not support navigation requests, returning false");return false}function TCAPI_GetNavigationRequest(){WriteToDebug("TCAPI_GetNavigationRequest - TCAPI does not support navigation requests, returning false");return false} +function TCAPI_CreateDataBucket(strBucketId,intMinSize,intMaxSize){WriteToDebug("TCAPI_CreateDataBucket - TCAPI does not support SSP, returning false");return false}function TCAPI_GetDataFromBucket(strBucketId){WriteToDebug("TCAPI_GetDataFromBucket - TCAPI does not support SSP, returning empty string");return""}function TCAPI_PutDataInBucket(strBucketId,strData,blnAppendToEnd){WriteToDebug("TCAPI_PutDataInBucket - TCAPI does not support SSP, returning false");return false} +function TCAPI_DetectSSPSupport(){WriteToDebug("TCAPI_DetectSSPSupport - TCAPI does not support SSP, returning false");return false}function TCAPI_GetBucketInfo(strBucketId){WriteToDebug("TCAPI_GetBucketInfo - TCAPI does not support SSP, returning empty SSPBucketSize");return new SSPBucketSize(0,0)}function TCAPI_WriteComment(strComment){WriteToDebug("In TCAPI_WriteComment - TCAPI does not support comments");return false} +function TCAPI_GetComments(){WriteToDebug("In TCAPI_GetComments - TCAPI does not support comments");return""}function TCAPI_GetLMSComments(){WriteToDebug("In TCAPI_GetLMSComments - TCAPI does not support LMS comments");return""}function TCAPI_GetLaunchData(){WriteToDebug("In TCAPI_GetLaunchData - TCAPI does not support launch data");return false} +function TCAPI_DisplayMessageOnTimeout(){TCAPI_ClearErrorInfo();WriteToDebug("In TCAPI_DisplayMessageOnTimeout - TCAPI does not support MessageOnTimeout");return false}function TCAPI_ExitOnTimeout(){WriteToDebug("In TCAPI_ExitOnTimeout - TCAPI does not support ExitOnTimeout");return false}function TCAPI_GetPassingScore(){WriteToDebug("In TCAPI_GetPassingScore - TCAPI does not support GetPassingScore");return false} +function TCAPI_GetProgressMeasure(){WriteToDebug("TCAPI_GetProgressMeasure - TCAPI does not support progress_measure, returning false");return false}function TCAPI_SetProgressMeasure(){WriteToDebug("TCAPI_SetProgressMeasure - TCAPI does not support progress_measure, returning false");return false}function TCAPI_GetObjectiveProgressMeasure(){WriteToDebug("TCAPI_GetObjectiveProgressMeasure - TCAPI does not support progress_measure, returning false");return false} +function TCAPI_SetObjectiveProgressMeasure(){WriteToDebug("TCAPI_SetObjectiveProgressMeasure - TCAPI does not support progress_measure, returning false");return false}function TCAPI_GetInteractionType(strInteractionID){WriteToDebug("TCAPI_GetInteractionType - TCAPI does not support interaction retrieval, returning empty string");return""} +function TCAPI_GetInteractionTimestamp(strInteractionID){WriteToDebug("TCAPI_GetInteractionTimestamp - TCAPI does not support interaction retrieval, returning empty string");return""}function TCAPI_GetInteractionCorrectResponses(strInteractionID){WriteToDebug("TCAPI_GetInteractionCorrectResponses - TCAPI does not support interaction retrieval, returning empty array");return[]} +function TCAPI_GetInteractionWeighting(strInteractionID){WriteToDebug("TCAPI_GetInteractionWeighting - TCAPI does not support interaction retrieval, returning empty string");return""}function TCAPI_GetInteractionLearnerResponses(strInteractionID){WriteToDebug("TCAPI_GetInteractionLearnerResponses - TCAPI does not support interaction retrieval, returning empty array");return[]} +function TCAPI_GetInteractionResult(strInteractionID){WriteToDebug("TCAPI_GetInteractionResult - TCAPI does not support interaction retrieval, returning empty string");return""}function TCAPI_GetInteractionLatency(strInteractionID){WriteToDebug("TCAPI_GetInteractionDescription - TCAPI does not support interaction retrieval, returning empty string");return""} +function TCAPI_GetInteractionDescription(strInteractionID){WriteToDebug("TCAPI_GetInteractionDescription - TCAPI does not support interaction retrieval, returning empty string");return""}function TCAPI_ClearErrorInfo(){WriteToDebug("In TCAPI_ClearErrorInfo");intTCAPIError=TCAPI_NO_ERROR;strTCAPIErrorString="";strTCAPIErrorDiagnostic=""} +function TCAPI_SetErrorInfoManually(intNum,strString,strDiagnostic){WriteToDebug("In TCAPI_SetErrorInfoManually");WriteToDebug("ERROR-Num="+intNum);WriteToDebug(" String="+strString);WriteToDebug(" Diag="+strDiagnostic);intTCAPIError=intNum;strTCAPIErrorString=strString;strTCAPIErrorDiagnostic=strDiagnostic} +function TCAPI_GetLastError(){WriteToDebug("In TCAPI_GetLastError");if(intTCAPIError===TCAPI_NO_ERROR){WriteToDebug("Returning No Error");return NO_ERROR}else{WriteToDebug("Returning "+intTCAPIError);return intTCAPIError}}function TCAPI_GetLastErrorDesc(){WriteToDebug("In TCAPI_GetLastErrorDesc, "+strTCAPIErrorString+"\n"+strTCAPIErrorDiagnostic);return strTCAPIErrorString+"\n"+strTCAPIErrorDiagnostic} +var CMI5_PENDING_STATUS={completion:null,success:null,score:null},CMI5_COMMITTED_STATUS={completion:null,success:null,score:null,launchModes:[]},CMI5_STATEMENT_QUEUE=[],CMI5_SESSION_DURATION=null,CMI5_TOTAL_PREV_DURATION=null,CMI5_ENTRY_MODE=null,CMI5_INTERACTIONS={},CMI5_SSP_BUCKETS={},CMI5_VERB_ID_FAILED="http://adlnet.gov/expapi/verbs/failed",CMI5_VERB_ID_PASSED="http://adlnet.gov/expapi/verbs/passed",CMI5_VERB_ID_COMPLETED="http://adlnet.gov/expapi/verbs/completed",CMI5_EXTENSION_MASTERY_SCORE= +"https://w3id.org/xapi/cmi5/context/extensions/masteryscore",CMI5_PREF_AUDIO_PLAY=null,CMI5_PREF_AUDIO_VOLUME=null,CMI5_PREF_LANGUAGE=null,CMI5_PREF_SPEED=null,CMI5_PREF_TEXT=null,CMI5_INTERACTION_ACTIVITY_TYPE="http://adlnet.gov/expapi/activities/cmi.interaction",CMI5_INTERACTION_TYPE_TRUE_FALSE="true-false",CMI5_INTERACTION_TYPE_CHOICE="choice",CMI5_INTERACTION_TYPE_FILL_IN="fill-in",CMI5_INTERACTION_TYPE_LONG_FILL_IN="long-fill-in",CMI5_INTERACTION_TYPE_MATCHING="matching",CMI5_INTERACTION_TYPE_PERFORMANCE= +"performance",CMI5_INTERACTION_TYPE_SEQUENCING="sequencing",CMI5_INTERACTION_TYPE_LIKERT="likert",CMI5_INTERACTION_TYPE_NUMERIC="numeric",CMI5_STATE_BOOKMARK="bookmark",CMI5_STATE_GENERIC_DATA="generic_data",CMI5_STATE_TOTAL_TIME="cumulative_time",CMI5_STATE_COMMITTED_STATUS="status",CMI5_STATE_COMMENTS="learner_comments",CMI5_STATE_SSP_BUCKET_PREFIX="sspBucket",CMI5_STATE_LANGUAGE_PREFERENCE="cmi.student_preference.language",CMI5_STATE_VOLUME_PREFERENCE="cmi.student_preference.audio",CMI5_STATE_SPEED_PREFERENCE= +"cmi.student_preference.speed",CMI5_STATE_TEXT_PREFERENCE="cmi.student_preference.text",CMI5_NO_ERROR="",CMI5_DEP_ERROR=999,CMI5_ERROR_NOT_IMPLEMENTED=998,CMI5_ERROR_INVALID_SCORE=1,CMI5_ERROR_UNRECOGNIZED_SSP_BUCKET=2,CMI5_ERROR_UNRECOGNIZED_INTERACTION=3,CMI5_ERROR_NON_NORMAL_MODE=4,CMI5_ERROR_ALREADY_COMMITTED=5,CMI5_ERROR_INVALID_STATUS_BASED_ON_SCORE=6,CMI5_ERROR_SSP_BUCKET_LOAD_FAILED=7,CMI5_ERROR_SSP_BUCKET_ALREADY_EXISTS=8,CMI5_ERROR_SSP_BUCKET_INVALID_JSON=9,CMI5_ERROR_INTERACTION_INVALID_JSON= +10,CMI5_ERROR_INTERACTION_LOAD_FAILED=11,intCMI5Error=CMI5_NO_ERROR,strCMI5ErrorString="",strCMI5ErrorDiagnostic="",cmi5; +function CMI5_SaveState(key,value,contentType,includeRegistration,callback){WriteToDebug("In CMI5_SaveState - key: "+key+", value: "+value);var saveStateCfg={agent:cmi5.getActor(),activity:cmi5.getActivity(),contentType:contentType},result,errCode,errMesg,errDiag;if(callback){WriteToDebug("In CMI5_SaveState - Setting callback to async!");saveStateCfg.callback=callback}if(typeof includeRegistration==="undefined"||includeRegistration===null||includeRegistration)saveStateCfg.registration=cmi5.getRegistration(); +result=cmi5.getLRS().saveState(key,value,saveStateCfg);if(typeof saveStateCfg.callback==="undefined"&&result.err!==null){WriteToDebug("Failed to save "+key+" in state: "+result.err);errMesg="Failed to save state: "+key;if(/^\d+$/.test(result.err)){errCode=result.err;if(result.err===0)errDiag="Aborted, offline, or invalid CORS endpoint";else errDiag=result.xhr.responseText}else{errCode=CMI5_DEP_ERROR;errDiag=result.err}CMI5_SetErrorInfoManually(errCode,errMesg,errDiag);return false}return true} +function CMI5_RetrieveState(key,includeRegistration){WriteToDebug("In CMI5_RetrieveState - key: "+key);var retrieveStateCfg={agent:cmi5.getActor(),activity:cmi5.getActivity()},result,value="",errCode,errMesg,errDiag;if(typeof includeRegistration==="undefined"||includeRegistration===null||includeRegistration)retrieveStateCfg.registration=cmi5.getRegistration();result=cmi5.getLRS().retrieveState(key,retrieveStateCfg);if(result.err!==null){WriteToDebug("Failed to retrieve "+key+" from state: "+result.err); +errMesg="Failed to retrieve state: "+key;if(/^\d+$/.test(result.err)){errCode=result.err;if(result.err===0)errDiag="Aborted, offline, or invalid CORS endpoint";else errDiag=result.xhr.responseText}else{errCode=CMI5_DEP_ERROR;errDiag=result.err}CMI5_SetErrorInfoManually(errCode,errMesg,errDiag);return""}if(result.state!==null)value=result.state.contents;return value}function CMI5_GetLaunchUrl(){WriteToDebug("In CMI5_GetLaunchUrl");return document.location.href} +function CMI5_Initialize(){WriteToDebug("In CMI5_Initialize");var launchUrl;Cmi5.prototype.log=function(){var mesg="cmi5.js:",i;for(i=0;i0)CMI5_ENTRY_MODE=ENTRY_RESUME;else CMI5_ENTRY_MODE=ENTRY_FIRST_TIME;CMI5_COMMITTED_STATUS.launchModes.push(cmi5.getLaunchMode());CMI5_SaveState(CMI5_STATE_COMMITTED_STATUS,CMI5_COMMITTED_STATUS,"application/json",undefined,function(err){if(err){WriteToDebug("CMI5_Initialize - failed to store committed status");InitializeExecuted(false,"Failed to initialize - failed to store committed status");return}WriteToDebug("CMI5_Initialize - succeeded"); +InitializeExecuted(true,"")});window.setTimeout(function(){CMI5_GetPreviouslyAccumulatedTime()},200)},{postFetch:function(err,response,parsed){var rootActivity;if(err!==null)return;rootActivity=cmi5.getActivity();cmi5.getLRS().retrieveActivity(rootActivity.id,{callback:function(err,result){if(err===null)cmi5.setActivity(result)}})}});return true} +function CMI5_CommitData(){WriteToDebug("In CMI5_CommitData");var i,st,auActivityId,errMesg,errCode,errDiag,saveCommittedStatus=false,sourceActivity=new TinCan.Activity({id:"http://id.tincanapi.com/activity/software/scormdriver/"+VERSION,definition:{name:{und:"ScormDriver ("+VERSION+")"},description:{en:"ScormDriver ("+VERSION+")"},type:"http://id.tincanapi.com/activitytype/source"}});CMI5_ClearErrorInfo();if(CMI5_PENDING_STATUS.completion!==null){saveCommittedStatus=true;CMI5_COMMITTED_STATUS.completion= +CMI5_PENDING_STATUS.completion}if(CMI5_PENDING_STATUS.success!==null){saveCommittedStatus=true;CMI5_COMMITTED_STATUS.success=CMI5_PENDING_STATUS.success;if(CMI5_PENDING_STATUS.score!==null)CMI5_COMMITTED_STATUS.score=CMI5_PENDING_STATUS.score}if(saveCommittedStatus){result=CMI5_SaveState(CMI5_STATE_COMMITTED_STATUS,CMI5_COMMITTED_STATUS,"application/json");if(!result){WriteToDebug("CMI5_CommitData - failed to commit status");return result}}if(CMI5_STATEMENT_QUEUE.length>0){if(CMI5_PENDING_STATUS.score!== +null&&CMI5_PENDING_STATUS.success!==null){auActivityId=cmi5.getActivity().id;for(i=0;i0)strResponse+="[,]";strResponse+=aryResponse[i].Long!==""?aryResponse[i].Long:aryResponse[i].Short}}for(i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=aryCorrectResponse[i].Long!==""?aryCorrectResponse[i].Long:aryCorrectResponse[i].Short}return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse, +strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_CHOICE)} +function CMI5_RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var interactionType= +CMI5_INTERACTION_TYPE_FILL_IN;if(strResponse!==null)strResponse=new String(strResponse);if(strCorrectResponse!==null){strCorrectResponse=new String(strCorrectResponse);if(strCorrectResponse.length>250)interactionType=CMI5_INTERACTION_TYPE_LONG_FILL_IN}return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,interactionType)} +function CMI5_RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordMatchingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strCorrectResponse="",i;if(aryResponse!==null){strResponse="";for(i=0;i0)strResponse+="[,]";strResponse+=(aryResponse[i].Source.Long!==""?aryResponse[i].Source.Long:aryResponse[i].Source.Short)+"[.]"+(aryResponse[i].Target.Long!==""?aryResponse[i].Target.Long:aryResponse[i].Target.Short)}}for(i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=(aryCorrectResponse[i].Source.Long!==""? +aryCorrectResponse[i].Source.Long:aryCorrectResponse[i].Source.Short)+"[.]"+(aryCorrectResponse[i].Target.Long!==""?aryCorrectResponse[i].Target.Long:aryCorrectResponse[i].Target.Short)}return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_MATCHING)} +function CMI5_RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(strResponse!== +null)strResponse=new String(strResponse);if(strCorrectResponse!==null)strCorrectResponse=new String(strCorrectResponse);return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_PERFORMANCE)} +function CMI5_RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordSequencingInteraction strID="+strID+", aryResponse="+aryResponse+", blnCorrect="+blnCorrect+", aryCorrectResponse="+aryCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse= +null,strCorrectResponse="",i;if(aryResponse!==null){strResponse="";for(i=0;i0)strResponse+="[,]";strResponse+=aryResponse[i].Long!==""?aryResponse[i].Long:aryResponse[i].Short}}for(i=0;i0)strCorrectResponse+="[,]";strCorrectResponse+=aryCorrectResponse[i].Long!==""?aryCorrectResponse[i].Long:aryCorrectResponse[i].Short}return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse, +strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_SEQUENCING)} +function CMI5_RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);var strResponse=null,strCorrectResponse= +"";if(response!==null)strResponse=response.Long!==""?response.Long:response.Short;if(correctResponse!==null)strCorrectResponse=correctResponse.Long!==""?correctResponse.Long:correctResponse.Short;return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_LIKERT)} +function CMI5_RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime){WriteToDebug("In CMI5_RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+strLearningObjectiveID+", dtmTime="+dtmTime);if(typeof strCorrectResponse!== +"undefined"&&strCorrectResponse!==null)if(!IsValidDecimalRange(strCorrectResponse)&&!IsValidDecimal(strCorrectResponse)){WriteToDebug("Returning False - CMI5_RecordNumericInteraction received invalid correct response (not a decimal or range), strCorrectResponse="+strCorrectResponse);return false}return CMI5_RecordInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,CMI5_INTERACTION_TYPE_NUMERIC)} +function CMI5_CreateInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime,interactionType,strAlternateResponse,strAlternateCorrectResponse){CMI5_INTERACTIONS[strID]={type:interactionType,timestamp:dtmTime.toJSON(),correctResponses:strCorrectResponse,learnerResponses:strResponse,weighting:intWeighting,result:blnCorrect,latency:intLatency,description:strDescription};return} +function CMI5_LoadInteraction(strInteractionId){WriteToDebug("CMI5_LoadInteraction - strInteractionId = "+strInteractionId);var result;if(typeof CMI5_INTERACTIONS[strInteractionId]!=="undefined"){WriteToDebug(" already locally cached, returning");return true}result=CMI5_RetrieveState(strInteractionId);if(intCMI5Error){WriteToDebug(" failed to retrieve state for interaction: "+strCMI5ErrorString);return false}if(result!==""&&typeof result.timestamp==="undefined"){CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_INVALID_JSON, +"Invalid JSON for interaction in State","result= "+result);return false}if(result==="")return true;CMI5_INTERACTIONS[strInteractionId]=result;WriteToDebug(" cached interaction locally");return true} +function CMI5_SaveInteraction(strInteractionId){WriteToDebug("CMI5_SaveInteraction - strInteractionId = "+strInteractionId);if(typeof CMI5_INTERACTIONS[strInteractionId]==="undefined"){CMI5_SetErrorInfoManually(CMI5_ERROR_UNRECOGNIZED_INTERACTION,"Cannot save unknown interaction: "+strInteractionId);return false}return CMI5_SaveState(strInteractionId,CMI5_INTERACTIONS[strInteractionId],"application/json",undefined,noop)} +function CMI5_GetInteractionType(strInteractionID){WriteToDebug("CMI5_GetInteractionType - strInteractionID = "+strInteractionID);var result;CMI5_ClearErrorInfo();result=CMI5_LoadInteraction(strInteractionID);if(!result){WriteToDebug("Failed to load interaction: "+strInteractionID);CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction type: "+strInteractionID,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")");return false}if(typeof CMI5_INTERACTIONS[strInteractionID]!== +"undefined")return CMI5_INTERACTIONS[strInteractionID].type;return""} +function CMI5_GetInteractionTimestamp(strInteractionID){WriteToDebug("CMI5_GetInteractionTimestamp - strInteractionID = "+strInteractionID);var result;CMI5_ClearErrorInfo();result=CMI5_LoadInteraction(strInteractionID);if(!result){WriteToDebug("Failed to load interaction: "+strInteractionID);CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction timestamp: "+strInteractionID,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+")");return false}if(typeof CMI5_INTERACTIONS[strInteractionID]!== +"undefined")return new Date(CMI5_INTERACTIONS[strInteractionID].timestamp);return""} +function CMI5_GetInteractionCorrectResponses(strInteractionID){WriteToDebug("CMI5_GetInteractionCorrectResponses - strInteractionID = "+strInteractionID);var result,responses=[];CMI5_ClearErrorInfo();result=CMI5_LoadInteraction(strInteractionID);if(!result){WriteToDebug("Failed to load interaction: "+strInteractionID);CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction correct responses: "+strInteractionID,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+ +")");return false}if(typeof CMI5_INTERACTIONS[strInteractionID]!=="undefined"){responses=CMI5_INTERACTIONS[strInteractionID].correctResponses.split("[,]");if(CMI5_INTERACTIONS[strInteractionID].type===CMI5_INTERACTION_TYPE_MATCHING)responses=CMI5_ProcessResponseArray(responses)}return responses} +function CMI5_GetInteractionLearnerResponses(strInteractionID){WriteToDebug("CMI5_GetInteractionLearnerResponses - strInteractionID = "+strInteractionID);var result,responses=[];CMI5_ClearErrorInfo();result=CMI5_LoadInteraction(strInteractionID);if(!result){WriteToDebug("Failed to load interaction: "+strInteractionID);CMI5_SetErrorInfoManually(CMI5_ERROR_INTERACTION_LOAD_FAILED,"Cannot get interaction learner responses: "+strInteractionID,"Failed to load interaction: "+strCMI5ErrorString+" ("+strCMI5ErrorDiagnostic+ +")");return false}if(typeof CMI5_INTERACTIONS[strInteractionID]!=="undefined"){responses=CMI5_INTERACTIONS[strInteractionID].learnerResponses.split("[,]");if(CMI5_INTERACTIONS[strInteractionID].type===CMI5_INTERACTION_TYPE_MATCHING)responses=CMI5_ProcessResponseArray(responses)}return responses}function CMI5_ProcessResponseArray(responses){var i;for(i=0;i=masteryScore){CMI5_SetErrorInfoManually(CMI5_ERROR_INVALID_STATUS_BASED_ON_SCORE,"Failed to SetFailed","Pending score conflicts with failure");return false}if(CMI5_PENDING_STATUS.success===true){auActivityId=cmi5.getActivity().id;for(i=0;iSCORM Driver starting up");WriteToDebug("----------------------------------------");WriteToDebug("----------------------------------------");WriteToDebug("In Start - Version: "+VERSION+" Last Modified="+window.document.lastModified);WriteToDebug("Browser Info ("+navigator.appName+" "+navigator.appVersion+")");WriteToDebug("URL: "+window.document.location.href); +WriteToDebug("----------------------------------------");WriteToDebug("----------------------------------------");ClearErrorInfo();strStandAlone=GetQueryStringValue("StandAlone",window.location.search);strShowInteractiveDebug=GetQueryStringValue("ShowDebug",window.location.search);WriteToDebug("strStandAlone="+strStandAlone+" strShowInteractiveDebug="+strShowInteractiveDebug);if(ConvertStringToBoolean(strStandAlone)){WriteToDebug("Entering Stand Alone Mode");blnStandAlone=true}if(blnStandAlone){WriteToDebug("Using NONE Standard"); +objLMS=new LMSStandardAPI("NONE")}else{WriteToDebug("Standard From Configuration File - "+strLMSStandard);if(strLMSStandard.toUpperCase()=="AUTO"){WriteToDebug("Searching for recognized querystring parameters");aiccUrl=GetQueryStringValue("AICC_URL",document.location.search);endpoint=GetQueryStringValue("endpoint",document.location.search);cmi5FetchUrl=GetQueryStringValue("fetch",document.location.search);if(aiccUrl!=null&&aiccUrl!=""){WriteToDebug("Found AICC querystring parameters, using AICC"); +objLMS=new LMSStandardAPI("AICC");blnLmsPresent=true}else if(endpoint!=null&&endpoint!=""){WriteToDebug("Found endpoint querystring parameter - checking cmi5 or Tin Can");if(cmi5FetchUrl!=null&&cmi5FetchUrl!=""){WriteToDebug("Found fetch querystring parameter, using cmi5");objLMS=new LMSStandardAPI("CMI5");blnLmsPresent=true}else{WriteToDebug("Did not find fetch querystring parameter, using Tin Can");objLMS=new LMSStandardAPI("TCAPI");blnLmsPresent=true;strLMSStandard="TCAPI"}}else{WriteToDebug("Auto-detecting standard - Searching for SCORM 2004 API"); +try{objTempAPI=SCORM2004_GrabAPI()}catch(e){WriteToDebug("Error grabbing 2004 API-"+e.name+":"+e.message)}if(!(typeof objTempAPI=="undefined"||objTempAPI==null)){WriteToDebug("Found SCORM 2004 API, using SCORM 2004");objLMS=new LMSStandardAPI("SCORM2004");blnLmsPresent=true}else{WriteToDebug("Searching for SCORM 1.2 API");try{objTempAPI=SCORM_GrabAPI()}catch(e$3){WriteToDebug("Error grabbing 1.2 API-"+e$3.name+":"+e$3.message)}if(!(typeof objTempAPI=="undefined"||objTempAPI==null)){WriteToDebug("Found SCORM API, using SCORM"); +objLMS=new LMSStandardAPI("SCORM");blnLmsPresent=true}else if(ALLOW_NONE_STANDARD===true){WriteToDebug("Could not determine standard, defaulting to Stand Alone");objLMS=new LMSStandardAPI("NONE")}else{WriteToDebug("Could not determine standard, Stand Alone is disabled in configuration");DisplayError("Could not determine standard. SCORM, AICC, Tin Can, and CMI5 APIs could not be found");return}}}}else{WriteToDebug("Using Standard From Configuration File - "+strLMSStandard);objLMS=new LMSStandardAPI(strLMSStandard); +blnLmsPresent=true}}if(ConvertStringToBoolean(strShowInteractiveDebug)||!(typeof SHOW_DEBUG_ON_LAUNCH=="undefined")&&SHOW_DEBUG_ON_LAUNCH===true){WriteToDebug("Showing Interactive Debug Windows");ShowDebugWindow()}WriteToDebug("Calling Standard Initialize");if(strLMSStandard.toUpperCase()=="TCAPI")loadScript("../tc-config.js",objLMS.Initialize);else objLMS.Initialize();TouchCloud();return} +function InitializeExecuted(blnSuccess,strErrorMessage){WriteToDebug("In InitializeExecuted, blnSuccess="+blnSuccess+", strErrorMessage="+strErrorMessage);if(!blnSuccess){WriteToDebug("ERROR - LMS Initialize Failed");if(strErrorMessage=="")strErrorMessage="An Error Has Occurred";blnLmsPresent=false;DisplayError(strErrorMessage);return}if(objLMS.Standard=="AICC")AICC_InitializeExecuted();blnLoaded=true;dtmStart=new Date;LoadContent();return} +function ExecFinish(ExitType){WriteToDebug("In ExecFinish, ExiType="+ExitType);ClearErrorInfo();if(blnLoaded&&!blnCalledFinish){WriteToDebug("Haven't called finish before, finishing");blnCalledFinish=true;if(blnReachedEnd&&!EXIT_SUSPEND_IF_COMPLETED){WriteToDebug("Reached End, overiding exit type to FINISH");ExitType=EXIT_TYPE_FINISH}if(EXIT_NORMAL_IF_PASSED==true&&objLMS.GetStatus()==LESSON_STATUS_PASSED){WriteToDebug("Passed status and config value set, overiding exit type to FINISH");ExitType= +EXIT_TYPE_FINISH}if(!blnOverrodeTime){WriteToDebug("Did not override time");dtmEnd=new Date;AccumulateTime();objLMS.SaveTime(intAccumulatedMS)}blnLoaded=false;WriteToDebug("Calling LMS Finish");return objLMS.Finish(ExitType,blnStatusWasSet)}return true}function IsLoaded(){WriteToDebug("In IsLoaded, returning -"+blnLoaded);return blnLoaded} +function WriteToDebug(strInfo){if(blnDebug){var dtm=new Date;var strLine;strLine=aryDebug.length+":"+dtm.toString()+" - "+strInfo;aryDebug[aryDebug.length]=strLine;if(winDebug&&!winDebug.closed){winDebug.document.body.appendChild(winDebug.document.createTextNode(strLine));winDebug.document.body.appendChild(winDebug.document.createElement("br"))}}return} +function ShowDebugWindow(){var renderLog=function(){var i,len=aryDebug.length;winDebug.document.body.innerHTML="";for(i=0;i100){WriteToDebug("ERROR - intScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (must be between 0-100), intScore="+intScore);return false}if(intMaxScore<0||intMaxScore>100){WriteToDebug("ERROR - intMaxScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (must be between 0-100), intMaxScore="+intMaxScore); +return false}if(intMinScore<0||intMinScore>100){WriteToDebug("ERROR - intMinScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (must be between 0-100), intMinScore="+intMinScore);return false}}if(SCORE_CAN_ONLY_IMPROVE===true){var previousScore=GetScore();if(previousScore!=null&&previousScore!=""&&previousScore>intScore){WriteToDebug("Previous score was greater than new score, configuration only allows scores to improve, returning.");return true}}WriteToDebug("Calling to LMS"); +return objLMS.SetScore(intScore,intMaxScore,intMinScore)} +function SetPointBasedScore(intScore,intMaxScore,intMinScore){WriteToDebug("In SetPointBasedScore, intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}if(!IsValidDecimal(intScore)){WriteToDebug("ERROR - intScore not a valid decimal");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (not a valid decimal), intScore="+intScore); +return false}if(!IsValidDecimal(intMaxScore)){WriteToDebug("ERROR - intMaxScore not a valid decimal");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (not a valid decimal), intMaxScore="+intMaxScore);return false}if(!IsValidDecimal(intMinScore)){WriteToDebug("ERROR - intMinScore not a valid decimal");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (not a valid decimal), intMinScore="+intMinScore);return false}WriteToDebug("Converting SCORES to floats"); +intScore=parseFloat(intScore);intMaxScore=parseFloat(intMaxScore);intMinScore=parseFloat(intMinScore);if(strLMSStandard=="SCORM"){if(intScore<0||intScore>100){WriteToDebug("ERROR - intScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetScore (must be between 0-100), intScore="+intScore);return false}if(intMaxScore<0||intMaxScore>100){WriteToDebug("ERROR - intMaxScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetScore (must be between 0-100), intMaxScore="+ +intMaxScore);return false}if(intMinScore<0||intMinScore>100){WriteToDebug("ERROR - intMinScore out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetScore (must be between 0-100), intMinScore="+intMinScore);return false}}if(SCORE_CAN_ONLY_IMPROVE===true){var previousScore=GetScore();if(previousScore!=null&&previousScore!=""&&previousScore>intScore){WriteToDebug("Previous score was greater than new score, configuration only allows scores to improve, returning.");return true}}WriteToDebug("Calling to LMS"); +return objLMS.SetPointBasedScore(intScore,intMaxScore,intMinScore)} +function CreateResponseIdentifier(strShort,strLong){if(strShort.replace(" ","")==""){WriteToDebug("Short Identifier is empty");SetErrorInfo(ERROR_INVALID_ID,"Invalid short identifier, strShort="+strShort);return false}if(strShort.length!=1){WriteToDebug("ERROR - Short Identifier not 1 character");SetErrorInfo(ERROR_INVALID_ID,"Invalid short identifier, strShort="+strShort);return false}if(!IsAlphaNumeric(strShort)){WriteToDebug("ERROR - Short Identifier not alpha numeric");SetErrorInfo(ERROR_INVALID_ID, +"Invalid short identifier, strShort="+strShort);return false}strShort=strShort.toLowerCase();strLong=CreateValidIdentifier(strLong);return new ResponseIdentifier(strShort,strLong)}function ResponseIdentifier(strShort,strLong){this.Short=new String(strShort);this.Long=new String(strLong);this.toString=function(){return"[Response Identifier "+this.Short+", "+this.Long+"]"}} +function MatchingResponse(source,target){if(source.constructor==String)source=CreateResponseIdentifier(source,source);if(target.constructor==String)target=CreateResponseIdentifier(target,target);this.Source=source;this.Target=target;this.toString=function(){return"[Matching Response "+this.Source+", "+this.Target+"]"}} +function CreateMatchingResponse(pattern){var aryPairs=new Array;var aryEachPair=new Array;pattern=new String(pattern);aryPairs=pattern.split("[,]");for(var i=0;i0)aryResponse=response;else if(window.console&&response.constructor.toString()=="(Internal Function)"&&response.length>0)aryResponse=response;else{if(window.console)window.console.log("ERROR_INVALID_INTERACTION_RESPONSE :: The response is not in the correct format.");SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}if(correctResponse!=null&&correctResponse!=undefined&&correctResponse!="")if(correctResponse.constructor== +String){aryCorrectResponse=new Array;responseIdentifier=CreateResponseIdentifier(correctResponse,correctResponse);if(responseIdentifier==false){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format");return false}aryCorrectResponse[0]=responseIdentifier}else if(correctResponse.constructor==ResponseIdentifier){aryCorrectResponse=new Array;aryCorrectResponse[0]=correctResponse}else if(correctResponse.constructor==Array||correctResponse.constructor.toString().search("Array")> +0)aryCorrectResponse=correctResponse;else if(window.console&&correctResponse.constructor.toString()=="(Internal Function)"&&correctResponse.length>0)aryCorrectResponse=correctResponse;else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format");return false}else aryCorrectResponse=new Array;var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordMultipleChoiceInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting, +intLatency,strLearningObjectiveID,dtmTime)} +function RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordFillInInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+ +strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordFillInInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting, +intLatency,strLearningObjectiveID,dtmTime)} +function RecordMatchingInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordMatchingInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+ +strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}var aryResponse;var aryCorrectResponse;if(response===null){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"); +return false}aryResponse=null}else if(response.constructor==MatchingResponse){aryResponse=new Array;aryResponse[0]=response}else if(response.constructor==Array||response.constructor.toString().search("Array")>0)aryResponse=response;else if(window.console&&response.constructor.toString()=="(Internal Function)"&&response.length>0)aryResponse=response;else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}if(correctResponse!=null&&correctResponse!= +undefined)if(correctResponse.constructor==MatchingResponse){aryCorrectResponse=new Array;aryCorrectResponse[0]=correctResponse}else if(correctResponse.constructor==Array||correctResponse.constructor.toString().search("Array")>0)aryCorrectResponse=correctResponse;else if(window.console&&correctResponse.constructor.toString()=="(Internal Function)"&&correctResponse.length>0)aryCorrectResponse=correctResponse;else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format"); +return false}else aryCorrectResponse=new Array;var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordMatchingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime)} +function RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordPerformanceInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+ +", strLearningObjectiveID="+strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordPerformanceInteraction(strID,strResponse,blnCorrect,strCorrectResponse, +strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime)} +function RecordSequencingInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordSequencingInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+ +strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}var aryResponse;var aryCorrectResponse;if(response===null){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"); +return false}aryResponse=null}else if(response.constructor==String){aryResponse=new Array;var responseIdentifier=CreateResponseIdentifier(response,response);if(responseIdentifier==false){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}aryResponse[0]=responseIdentifier}else if(response.constructor==ResponseIdentifier){aryResponse=new Array;aryResponse[0]=response}else if(response.constructor==Array||response.constructor.toString().search("Array")> +0)aryResponse=response;else if(window.console&&response.constructor.toString()=="(Internal Function)"&&response.length>0)aryResponse=response;else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}if(correctResponse!=null&&correctResponse!=undefined&&correctResponse!="")if(correctResponse.constructor==String){aryCorrectResponse=new Array;responseIdentifier=CreateResponseIdentifier(correctResponse,correctResponse);if(responseIdentifier==false){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE, +"The correct response is not in the correct format");return false}aryCorrectResponse[0]=responseIdentifier}else if(correctResponse.constructor==ResponseIdentifier){aryCorrectResponse=new Array;aryCorrectResponse[0]=correctResponse}else if(correctResponse.constructor==Array||correctResponse.constructor.toString().search("Array")>0)aryCorrectResponse=correctResponse;else if(window.console&&correctResponse.constructor.toString()=="(Internal Function)"&&correctResponse.length>0)aryCorrectResponse=correctResponse; +else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The correct response is not in the correct format");return false}else aryCorrectResponse=new Array;var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordSequencingInteraction(strID,aryResponse,blnCorrect,aryCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime)} +function RecordLikertInteraction(strID,response,blnCorrect,correctResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordLikertInteraction strID="+strID+", response="+response+", blnCorrect="+blnCorrect+", correctResponse="+correctResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+ +strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}var riResponse;var riCorrectResponse;if(response===null){if(!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE){SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format (null response not allowed)"); +return false}riResponse=null}else if(response.constructor==String)riResponse=CreateResponseIdentifier(response,response);else if(response.constructor==ResponseIdentifier)riResponse=response;else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}if(correctResponse==null||correctResponse==undefined)riCorrectResponse=null;else if(correctResponse.constructor==ResponseIdentifier)riCorrectResponse=correctResponse;else if(correctResponse.constructor== +String)riCorrectResponse=CreateResponseIdentifier(correctResponse,correctResponse);else{SetErrorInfo(ERROR_INVALID_INTERACTION_RESPONSE,"The response is not in the correct format");return false}var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordLikertInteraction(strID,riResponse,blnCorrect,riCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime)} +function RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID){strID=CreateValidIdentifier(strID);strLearningObjectiveID=CreateValidIdentifier(strLearningObjectiveID);WriteToDebug("In RecordNumericInteraction strID="+strID+", strResponse="+strResponse+", blnCorrect="+blnCorrect+", strCorrectResponse="+strCorrectResponse+", strDescription="+strDescription+", intWeighting="+intWeighting+", intLatency="+intLatency+", strLearningObjectiveID="+ +strLearningObjectiveID);if(!(typeof DO_NOT_REPORT_INTERACTIONS=="undefined")&&DO_NOT_REPORT_INTERACTIONS===true){WriteToDebug("Configuration specifies interactions should not be reported, exiting.");return true}ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}if(strResponse===null&&!ALLOW_INTERACTION_NULL_LEARNER_RESPONSE||strResponse!==null&&!IsValidDecimal(strResponse)){WriteToDebug("ERROR - Invalid Response, not a valid decmial"); +SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Response passed to RecordNumericInteraction (not a valid decimal), strResponse="+strResponse);return false}var dtmTime=new Date;WriteToDebug("Calling to LMS");return objLMS.RecordNumericInteraction(strID,strResponse,blnCorrect,strCorrectResponse,strDescription,intWeighting,intLatency,strLearningObjectiveID,dtmTime)} +function GetStatus(){WriteToDebug("In GetStatus");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return LESSON_STATUS_INCOMPLETE}return objLMS.GetStatus()} +function ResetStatus(){WriteToDebug("In ResetStatus");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}WriteToDebug("Setting blnStatusWasSet to false");blnStatusWasSet=false;return objLMS.ResetStatus()} +function GetProgressMeasure(){WriteToDebug("In GetProgressMeasure");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return LESSON_STATUS_INCOMPLETE}return objLMS.GetProgressMeasure()} +function SetProgressMeasure(numMeasure){WriteToDebug("In SetProgressMeasure, passing in: "+numMeasure);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return LESSON_STATUS_INCOMPLETE}return objLMS.SetProgressMeasure(numMeasure)} +function SetPassed(){WriteToDebug("In SetPassed");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}WriteToDebug("Setting blnStatusWasSet to true");blnStatusWasSet=true;return objLMS.SetPassed()} +function SetFailed(){WriteToDebug("In SetFailed");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}WriteToDebug("Setting blnStatusWasSet to true");blnStatusWasSet=true;return objLMS.SetFailed()}function GetEntryMode(){WriteToDebug("In GetEntryMode");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return ENTRY_FIRST_TIME}return objLMS.GetEntryMode()} +function GetLessonMode(){WriteToDebug("In GetLessonMode");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return MODE_NORMAL}return objLMS.GetLessonMode()}function GetTakingForCredit(){WriteToDebug("In GetTakingForCredit");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetTakingForCredit()} +function SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore){WriteToDebug("In SetObjectiveScore, intObjectiveID="+strObjectiveID+", intScore="+intScore+", intMaxScore="+intMaxScore+", intMinScore="+intMinScore);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strObjectiveID=new String(strObjectiveID);if(strObjectiveID.replace(" ","")==""){WriteToDebug("ERROR - Invalid ObjectiveID, empty string");SetErrorInfo(ERROR_INVALID_ID, +"Invalid ObjectiveID passed to SetObjectiveScore (must have a value), strObjectiveID="+strObjectiveID);return false}if(!IsValidDecimal(intScore)){WriteToDebug("ERROR - Invalid Score, not a valid decmial");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Score passed to SetObjectiveScore (not a valid decimal), intScore="+intScore);return false}if(!IsValidDecimal(intMaxScore)){WriteToDebug("ERROR - Invalid Max Score, not a valid decmial");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetObjectiveScore (not a valid decimal), intMaxScore="+ +intMaxScore);return false}if(!IsValidDecimal(intMinScore)){WriteToDebug("ERROR - Invalid Min Score, not a valid decmial");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetObjectiveScore (not a valid decimal), intMinScore="+intMinScore);return false}WriteToDebug("Converting Scores to floats");intScore=parseFloat(intScore);intMaxScore=parseFloat(intMaxScore);intMinScore=parseFloat(intMinScore);if(intScore<0||intScore>100){WriteToDebug("ERROR - Invalid Score, out of range");SetErrorInfo(ERROR_INVALID_NUMBER, +"Invalid Score passed to SetObjectiveScore (must be between 0-100), intScore="+intScore);return false}if(intMaxScore<0||intMaxScore>100){WriteToDebug("ERROR - Invalid Max Score, out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Score passed to SetObjectiveScore (must be between 0-100), intMaxScore="+intMaxScore);return false}if(intMinScore<0||intMinScore>100){WriteToDebug("ERROR - Invalid Min Score, out of range");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Score passed to SetObjectiveScore (must be between 0-100), intMinScore="+ +intMinScore);return false}WriteToDebug("Calling To LMS");return objLMS.SetObjectiveScore(strObjectiveID,intScore,intMaxScore,intMinScore)} +function SetObjectiveStatus(strObjectiveID,Lesson_Status){WriteToDebug("In SetObjectiveStatus strObjectiveID="+strObjectiveID+", Lesson_Status="+Lesson_Status);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strObjectiveID=new String(strObjectiveID);if(strObjectiveID.replace(" ","")==""){WriteToDebug("ERROR - Invalid ObjectiveID, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveStatus (must have a value), strObjectiveID="+ +strObjectiveID);return false}if(Lesson_Status!=LESSON_STATUS_PASSED&&Lesson_Status!=LESSON_STATUS_COMPLETED&&Lesson_Status!=LESSON_STATUS_FAILED&&Lesson_Status!=LESSON_STATUS_INCOMPLETE&&Lesson_Status!=LESSON_STATUS_BROWSED&&Lesson_Status!=LESSON_STATUS_NOT_ATTEMPTED){WriteToDebug("ERROR - Invalid Status");SetErrorInfo(ERROR_INVALID_STATUS,"Invalid status passed to SetObjectiveStatus, Lesson_Status="+Lesson_Status);return false}WriteToDebug("Calling To LMS");return objLMS.SetObjectiveStatus(strObjectiveID, +Lesson_Status)}function GetObjectiveStatus(strObjectiveID){WriteToDebug("In GetObjectiveStatus, strObjectiveID="+strObjectiveID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetObjectiveStatus(strObjectiveID)} +function SetObjectiveDescription(strObjectiveID,strObjectiveDescription){WriteToDebug("In SetObjectiveDescription strObjectiveID="+strObjectiveID+", strObjectiveDescription="+strObjectiveDescription);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strObjectiveID=new String(strObjectiveID);if(strObjectiveID.replace(" ","")==""){WriteToDebug("ERROR - Invalid ObjectiveID, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid ObjectiveID passed to SetObjectiveStatus (must have a value), strObjectiveID="+ +strObjectiveID);return false}WriteToDebug("Calling To LMS");return objLMS.SetObjectiveDescription(strObjectiveID,strObjectiveDescription)}function GetObjectiveDescription(strObjectiveID){WriteToDebug("In GetObjectiveDescription, strObjectiveID="+strObjectiveID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetObjectiveDescription(strObjectiveID)} +function GetObjectiveScore(strObjectiveID){WriteToDebug("In GetObjectiveScore, strObjectiveID="+strObjectiveID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetObjectiveScore(strObjectiveID)}function IsLmsPresent(){return blnLmsPresent} +function SetObjectiveProgressMeasure(strObjectiveID,strObjectiveProgressMeasure){WriteToDebug("In SetObjectiveProgressMeasure strObjectiveID="+strObjectiveID+", strObjectiveProgressMeasure="+strObjectiveProgressMeasure);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strObjectiveID=new String(strObjectiveID);if(strObjectiveID.replace(" ","")==""){WriteToDebug("ERROR - Invalid ObjectiveID, empty string");SetErrorInfo(ERROR_INVALID_ID, +"Invalid ObjectiveID passed to SetObjectiveProgressMeasure (must have a value), strObjectiveID="+strObjectiveID);return false}WriteToDebug("Calling To LMS");return objLMS.SetObjectiveProgressMeasure(strObjectiveID,strObjectiveProgressMeasure)} +function GetObjectiveProgressMeasure(strObjectiveID){WriteToDebug("In GetObjectiveProgressMeasure, strObjectiveID="+strObjectiveID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetObjectiveProgressMeasure(strObjectiveID)} +function SetNavigationRequest(strNavRequest){WriteToDebug("In SetNavigationRequest");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.SetNavigationRequest(strNavRequest)} +function GetNavigationRequest(){WriteToDebug("In GetNavigationRequest");ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetNavigationRequest()} +function GetInteractionType(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionType, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionType(strInteractionID)} +function GetInteractionTimestamp(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionTimestamp, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionTimestamp(strInteractionID)} +function GetInteractionCorrectResponses(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionCorrectResponses, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionCorrectResponses(strInteractionID)} +function GetInteractionWeighting(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionWeighting, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionWeighting(strInteractionID)} +function GetInteractionLearnerResponses(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionLearnerResponses, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionLearnerResponses(strInteractionID)} +function GetInteractionResult(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionResult, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionResult(strInteractionID)} +function GetInteractionLatency(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionLatency, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionLatency(strInteractionID)} +function GetInteractionDescription(strInteractionID){strInteractionID=CreateValidIdentifier(strInteractionID);WriteToDebug("In GetInteractionDescription, strInteractionID="+strInteractionID);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}return objLMS.GetInteractionDescription(strInteractionID)} +function CreateDataBucket(strBucketId,intMinSize,intMaxSize){WriteToDebug("In CreateDataBucket, strBucketId="+strBucketId+", intMinSize="+intMinSize+", intMaxSize="+intMaxSize);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strBucketId=new String(strBucketId);if(strBucketId.replace(" ","")==""){WriteToDebug("ERROR - Invalid BucketId, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to CreateDataBucket (must have a value), strBucketId="+ +strBucketId);return false}if(!ValidInteger(intMinSize)){WriteToDebug("ERROR Invalid Min Size, not an integer");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMinSize passed to CreateDataBucket (not an integer), intMinSize="+intMinSize);return false}if(!ValidInteger(intMaxSize)){WriteToDebug("ERROR Invalid Max Size, not an integer");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid intMaxSize passed to CreateDataBucket (not an integer), intMaxSize="+intMaxSize);return false}intMinSize=parseInt(intMinSize, +10);intMaxSize=parseInt(intMaxSize,10);if(intMinSize<0){WriteToDebug("ERROR Invalid Min Size, must be greater than or equal to 0");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Min Size passed to CreateDataBucket (must be greater than or equal to 0), intMinSize="+intMinSize);return false}if(intMaxSize<=0){WriteToDebug("ERROR Invalid Max Size, must be greater than 0");SetErrorInfo(ERROR_INVALID_NUMBER,"Invalid Max Size passed to CreateDataBucket (must be greater than 0), intMaxSize="+intMaxSize);return false}intMinSize= +intMinSize*2;intMaxSize=intMaxSize*2;return objLMS.CreateDataBucket(strBucketId,intMinSize,intMaxSize)} +function GetDataFromBucket(strBucketId){WriteToDebug("In GetDataFromBucket, strBucketId="+strBucketId);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strBucketId=new String(strBucketId);if(strBucketId.replace(" ","")==""){WriteToDebug("ERROR - Invalid BucketId, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to GetDataFromBucket (must have a value), strBucketId="+strBucketId);return false}return objLMS.GetDataFromBucket(strBucketId)} +function PutDataInBucket(strBucketId,strData,blnAppendToEnd){WriteToDebug("In PutDataInBucket, strBucketId="+strBucketId+", blnAppendToEnd="+blnAppendToEnd+", strData="+strData);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strBucketId=new String(strBucketId);if(strBucketId.replace(" ","")==""){WriteToDebug("ERROR - Invalid BucketId, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to PutDataInBucket (must have a value), strBucketId="+ +strBucketId);return false}if(blnAppendToEnd!=true){WriteToDebug("blnAppendToEnd was not explicitly true so setting it to false, blnAppendToEnd="+blnAppendToEnd);blnAppendToEnd=false}return objLMS.PutDataInBucket(strBucketId,strData,blnAppendToEnd)}function DetectSSPSupport(){return objLMS.DetectSSPSupport()} +function GetBucketInfo(strBucketId){WriteToDebug("In GetBucketInfo, strBucketId="+strBucketId);ClearErrorInfo();if(!IsLoaded()){SetErrorInfo(ERROR_NOT_LOADED,"Cannot make calls to the LMS before calling Start");return false}strBucketId=new String(strBucketId);if(strBucketId.replace(" ","")==""){WriteToDebug("ERROR - Invalid BucketId, empty string");SetErrorInfo(ERROR_INVALID_ID,"Invalid strBucketId passed to GetBucketInfo (must have a value), strBucketId="+strBucketId);return false}var bucketInfo= +objLMS.GetBucketInfo(strBucketId);bucketInfo.TotalSpace=bucketInfo.TotalSpace/2;bucketInfo.UsedSpace=bucketInfo.UsedSpace/2;WriteToDebug("GetBucketInfo returning "+bucketInfo);return bucketInfo}function SSPBucketSize(totalSpace,usedSpace){this.TotalSpace=totalSpace;this.UsedSpace=usedSpace;this.toString=function(){return"[SSPBucketSize "+this.TotalSpace+", "+this.UsedSpace+"]"}}; diff --git a/server/vbv_lernwelt/templates/base.html b/server/vbv_lernwelt/templates/base.html index 0c162dad..c9c1dd73 100644 --- a/server/vbv_lernwelt/templates/base.html +++ b/server/vbv_lernwelt/templates/base.html @@ -15,7 +15,7 @@ - + {% endblock %} @@ -27,6 +27,8 @@ + + {% endblock javascript %} diff --git a/server/vbv_lernwelt/templates/learnpath/circle.html b/server/vbv_lernwelt/templates/learnpath/circle.html new file mode 100644 index 00000000..057b190d --- /dev/null +++ b/server/vbv_lernwelt/templates/learnpath/circle.html @@ -0,0 +1,104 @@ +{% extends "base.html" %} + +{% load wagtailcore_tags %} + +{% block body_class %}template-cicle{% endblock %} + +{% block content %} +
+
+ + +
+ + + + + + + + +
+

{{ page.title }}

+
{{ page.description }}
+
{{ page.goals }}
+
+ +
+ {% for learning_sequence in page.learning_sequences.all %} +
+

{{ learning_sequence.title }}

+ {% for learning_unit in learning_sequence.learning_units.all %} + + {% endfor %} +
+ {% endfor %} +
+
+ + +{% endblock %} diff --git a/server/vbv_lernwelt/templates/learnpath/learning_path.html b/server/vbv_lernwelt/templates/learnpath/learning_path.html new file mode 100644 index 00000000..537dbbfc --- /dev/null +++ b/server/vbv_lernwelt/templates/learnpath/learning_path.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} + +{% load wagtailcore_tags %} + +{% block body_class %}template-learningpath{% endblock %} + +{% block content %} +

{{ page.title }}

+ +
{{ page.intro|richtext }}
+
+ + {% for topic in page.topics.all %} +
+

{{ topic.title }}

+
+ {% for circle in topic.circles.all %} + + {% endfor %} +
+
+ + {% endfor %} +
+ +{% endblock %} diff --git a/server/vbv_lernwelt/templates/learnpath/learning_unit.html b/server/vbv_lernwelt/templates/learnpath/learning_unit.html new file mode 100644 index 00000000..3e521f07 --- /dev/null +++ b/server/vbv_lernwelt/templates/learnpath/learning_unit.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} + +{% load wagtailcore_tags %} +{% load static %} + +{% block body_class %}template-learning_unit{% endblock %} + +{% block content %} + + + {% if not page.contents %} +
O0ps, in dieser Lerneinheit wurde kein Inhalt erfasst.
+ {% endif %} + + {% for block in page.contents %} + + {% if block.block_type == 'video' %} +

{{ block.block_type }}

+
+

{{ block.value.title }}

+
{{ block.value.description }}
+ + +
+ {% endif %} + + {% if block.block_type == 'web_based_training' %} +
Loading web based training...
+ Click me! + + {% endif %} + + {% endfor %} +
+ + + +{% endblock %} +