OSDN Git Service

Support SCORM 1.2 output.
authorTakeyuki NAGAO <nagaotakeyuki@gmail.com>
Tue, 5 Mar 2013 18:41:39 +0000 (03:41 +0900)
committerTakeyuki NAGAO <nagaotakeyuki@gmail.com>
Tue, 5 Mar 2013 18:41:39 +0000 (03:41 +0900)
14 files changed:
licenses/APIWrapper.js.txt [new file with mode: 0644]
licenses/SCOFunctions.js.txt [new file with mode: 0644]
licenses/dvi2epub.txt [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/blank.html [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/data/pages.js [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/disp.html [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/imsmanifest.xml [new file with mode: 0755]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/index.html [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/APIWrapper.js [new file with mode: 0755]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/SCOFunctions.js [new file with mode: 0755]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub-page.js [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub.js [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/manifest.txt [new file with mode: 0644]
src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/page.html [new file with mode: 0644]

diff --git a/licenses/APIWrapper.js.txt b/licenses/APIWrapper.js.txt
new file mode 100644 (file)
index 0000000..a1dcd38
--- /dev/null
@@ -0,0 +1,79 @@
+APIWrapper.js\r
+/****************************************************************************\r
+SCORM_12_APIWrapper.js\r
+© 2000, 2011 Advanced Distributed Learning (ADL). Some Rights Reserved.\r
+*****************************************************************************\r
+\r
+Advanced Distributed Learning ("ADL") grants you ("Licensee") a  non-exclusive, \r
+royalty free, license to use and redistribute this  software in source and binary \r
+code form, provided that i) this copyright  notice and license appear on all \r
+copies of the software; and ii) Licensee does not utilize the software in a \r
+manner which is disparaging to ADL.\r
+\r
+This software is provided "AS IS," without a warranty of any kind.  \r
+ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING \r
+ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR \r
+NON-INFRINGEMENT, ARE HEREBY EXCLUDED.  ADL AND ITS LICENSORS SHALL NOT BE LIABLE \r
+FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR \r
+DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL ADL OR ITS LICENSORS \r
+BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, \r
+CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE \r
+THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF \r
+ADL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+\r
+*****************************************************************************\r
+*SCORM_12_APIwrapper.js code is licensed under the Creative Commons\r
+Attribution-ShareAlike 3.0 Unported License.\r
+\r
+To view a copy of this license:\r
+\r
+     - Visit http://creativecommons.org/licenses/by-sa/3.0/ \r
+     - Or send a letter to\r
+            Creative Commons, 444 Castro Street,  Suite 900, Mountain View,\r
+            California, 94041, USA.\r
+\r
+The following is a summary of the full license which is available at:\r
+\r
+      - http://creativecommons.org/licenses/by-sa/3.0/legalcode\r
+\r
+*****************************************************************************\r
+\r
+Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)\r
+\r
+You are free to:\r
+\r
+     - Share : to copy, distribute and transmit the work\r
+     - Remix : to adapt the work\r
+\r
+Under the following conditions:\r
+\r
+     - Attribution: You must attribute the work in the manner specified by \r
+       the author or licensor (but not in any way that suggests that they \r
+       endorse you or your use of the work).\r
+\r
+     - Share Alike: If you alter, transform, or build upon this work, you \r
+       may distribute the resulting work only under the same or similar \r
+       license to this one.\r
+\r
+With the understanding that:\r
+\r
+     - Waiver: Any of the above conditions can be waived if you get permission \r
+       from the copyright holder.\r
+\r
+     - Public Domain: Where the work or any of its elements is in the public \r
+       domain under applicable law, that status is in no way affected by the license.\r
+\r
+     - Other Rights: In no way are any of the following rights affected by the license:\r
+\r
+           * Your fair dealing or fair use rights, or other applicable copyright \r
+             exceptions and limitations;\r
+\r
+           * The author's moral rights;\r
+\r
+           * Rights other persons may have either in the work itself or in how the \r
+             work is used, such as publicity or privacy rights.\r
+\r
+     - Notice: For any reuse or distribution, you must make clear to others the \r
+               license terms of this work.\r
+\r
+****************************************************************************/\r
diff --git a/licenses/SCOFunctions.js.txt b/licenses/SCOFunctions.js.txt
new file mode 100644 (file)
index 0000000..26059eb
--- /dev/null
@@ -0,0 +1,43 @@
+/*******************************************************************************\r
+** \r
+** Filename: SCOFunctions.js\r
+**\r
+** File Description: This file contains several JavaScript functions that are \r
+**                   used by the Sample SCOs contained in the Sample Course.\r
+**                   These functions encapsulate actions that are taken when the\r
+**                   user navigates between SCOs, or exits the Lesson.\r
+**\r
+** Author: ADL Technical Team\r
+**\r
+** Contract Number:\r
+** Company Name: CTC\r
+**\r
+** Design Issues:\r
+**\r
+** Implementation Issues:\r
+** Known Problems:\r
+** Side Effects:\r
+**\r
+** References: ADL SCORM\r
+**\r
+/*******************************************************************************\r
+**\r
+** Concurrent Technologies Corporation (CTC) grants you ("Licensee") a non-\r
+** exclusive, royalty free, license to use, modify and redistribute this\r
+** software in source and binary code form, provided that i) this copyright\r
+** notice and license appear on all copies of the software; and ii) Licensee\r
+** does not utilize the software in a manner which is disparaging to CTC.\r
+**\r
+** This software is provided "AS IS," without a warranty of any kind.  ALL\r
+** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY\r
+** IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-\r
+** INFRINGEMENT, ARE HEREBY EXCLUDED.  CTC AND ITS LICENSORS SHALL NOT BE LIABLE\r
+** FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR\r
+** DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL CTC  OR ITS\r
+** LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,\r
+** INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER\r
+** CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF\r
+** OR INABILITY TO USE SOFTWARE, EVEN IF CTC  HAS BEEN ADVISED OF THE\r
+** POSSIBILITY OF SUCH DAMAGES.\r
+**\r
+*******************************************************************************/\r
diff --git a/licenses/dvi2epub.txt b/licenses/dvi2epub.txt
new file mode 100644 (file)
index 0000000..726ca68
--- /dev/null
@@ -0,0 +1,30 @@
+Copyright (c) 2012-2013, Takeyuki Nagao\r
+All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or\r
+without modification, are permitted provided that the\r
+following conditions are met:\r
+\r
+ * Redistributions of source code must retain the above\r
+   copyright notice, this list of conditions and the\r
+   following disclaimer.\r
+ * Redistributions in binary form must reproduce the above\r
+   copyright notice, this list of conditions and the\r
+   following disclaimer in the documentation and/or other\r
+   materials provided with the distribution.\r
+   \r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\r
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\r
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\r
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\r
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\r
+OF SUCH DAMAGE.\r
+\r
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/blank.html b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/blank.html
new file mode 100644 (file)
index 0000000..540ed8a
--- /dev/null
@@ -0,0 +1,5 @@
+<html> 
+<head> 
+  <title>blank page</title> 
+</head> 
+<body>&nbsp;</body> 
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/data/pages.js b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/data/pages.js
new file mode 100644 (file)
index 0000000..cf85195
--- /dev/null
@@ -0,0 +1 @@
+dvi2epub.loadTable($(PAGES));
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/disp.html b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/disp.html
new file mode 100644 (file)
index 0000000..9559bc9
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ja' lang='ja'>
+<head> 
+  <script type="text/javascript" language="JavaScript"> 
+    function init() {
+      window.parent.dvi2epub.openPage(0);
+    }
+  </script> 
+  <title></title> 
+</head> 
+<body onload='init()'>&nbsp;</body> 
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/imsmanifest.xml b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/imsmanifest.xml
new file mode 100755 (executable)
index 0000000..e1de0ef
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"\r
+ xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2"\r
+ xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2"\r
+ xsi:schemaLocation="http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p4.xsd"\r
+ identifier="$(UUID)">\r
+  \r
+  <organizations default="$(ORG_UUID)">\r
+    <organization identifier="$(ORG_UUID)">\r
+      <title>$(TITLE)</title>\r
+      <item identifier="$(ITEM_UUID)" identifierref="$(RES_UUID)" isvisible="true">\r
+        <title>$(ITEM_TITLE)</title>\r
+      </item>\r
+    </organization>\r
+  </organizations>\r
+  <resources>\r
+    <resource href="index.html" identifier="$(RES_UUID)" type="webcontent" adlcp:scormtype="sco">\r
+      <file href="index.html"/>\r
+      <file href="page.html"/>\r
+      <file href="dist.html"/>\r
+      <file href="blank.html"/>\r
+      <file href="js/APIWrapper.js"/>\r
+      <file href="js/SCOFunctions.js"/>\r
+      <file href="js/dvi2epub.js"/>\r
+      <file href="js/dvi2epub-page.js"/>\r
+    </resource>\r
+  </resources>\r
+</manifest>\r
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/index.html b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/index.html
new file mode 100644 (file)
index 0000000..8aba771
--- /dev/null
@@ -0,0 +1,22 @@
+<html> 
+<head> 
+  <script language="JavaScript" src="js/APIWrapper.js"></script>
+  <script language="JavaScript" src="js/SCOFunctions.js"></script>
+  <script language="JavaScript" src="js/dvi2epub.js"></script>
+  <script language="JavaScript" src="data/pages.js"></script>
+  <script type="text/javascript" language="JavaScript"> 
+  </script> 
+  <title>dvi2epub - SCORM View</title> 
+</head> 
+<frameset rows="100%,*"
+  onload="dvi2epub.init();"
+  onunload="dvi2epub.done()" 
+  onbeforeunload="dvi2epub.done()"
+  >
+  <frame name="dvi2epubStage" title="Content" src="disp.html" /> 
+  <frame src="blank.html" /> 
+</frameset>
+</html> 
+<html> 
+<head></head> 
+<body>&nbsp;</body> 
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/APIWrapper.js b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/APIWrapper.js
new file mode 100755 (executable)
index 0000000..7052df8
--- /dev/null
@@ -0,0 +1,512 @@
+/****************************************************************************\r
+SCORM_12_APIWrapper.js\r
+© 2000, 2011 Advanced Distributed Learning (ADL). Some Rights Reserved.\r
+*****************************************************************************\r
+\r
+Advanced Distributed Learning ("ADL") grants you ("Licensee") a  non-exclusive, \r
+royalty free, license to use and redistribute this  software in source and binary \r
+code form, provided that i) this copyright  notice and license appear on all \r
+copies of the software; and ii) Licensee does not utilize the software in a \r
+manner which is disparaging to ADL.\r
+\r
+This software is provided "AS IS," without a warranty of any kind.  \r
+ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING \r
+ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR \r
+NON-INFRINGEMENT, ARE HEREBY EXCLUDED.  ADL AND ITS LICENSORS SHALL NOT BE LIABLE \r
+FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR \r
+DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL ADL OR ITS LICENSORS \r
+BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, \r
+CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE \r
+THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF \r
+ADL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+\r
+*****************************************************************************\r
+*SCORM_12_APIwrapper.js code is licensed under the Creative Commons\r
+Attribution-ShareAlike 3.0 Unported License.\r
+\r
+To view a copy of this license:\r
+\r
+     - Visit http://creativecommons.org/licenses/by-sa/3.0/ \r
+     - Or send a letter to\r
+            Creative Commons, 444 Castro Street,  Suite 900, Mountain View,\r
+            California, 94041, USA.\r
+\r
+The following is a summary of the full license which is available at:\r
+\r
+      - http://creativecommons.org/licenses/by-sa/3.0/legalcode\r
+\r
+*****************************************************************************\r
+\r
+Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)\r
+\r
+You are free to:\r
+\r
+     - Share : to copy, distribute and transmit the work\r
+     - Remix : to adapt the work\r
+\r
+Under the following conditions:\r
+\r
+     - Attribution: You must attribute the work in the manner specified by \r
+       the author or licensor (but not in any way that suggests that they \r
+       endorse you or your use of the work).\r
+\r
+     - Share Alike: If you alter, transform, or build upon this work, you \r
+       may distribute the resulting work only under the same or similar \r
+       license to this one.\r
+\r
+With the understanding that:\r
+\r
+     - Waiver: Any of the above conditions can be waived if you get permission \r
+       from the copyright holder.\r
+\r
+     - Public Domain: Where the work or any of its elements is in the public \r
+       domain under applicable law, that status is in no way affected by the license.\r
+\r
+     - Other Rights: In no way are any of the following rights affected by the license:\r
+\r
+           * Your fair dealing or fair use rights, or other applicable copyright \r
+             exceptions and limitations;\r
+\r
+           * The author's moral rights;\r
+\r
+           * Rights other persons may have either in the work itself or in how the \r
+             work is used, such as publicity or privacy rights.\r
+\r
+     - Notice: For any reuse or distribution, you must make clear to others the \r
+               license terms of this work.\r
+\r
+****************************************************************************/\r
+/*******************************************************************************\r
+** Usage: Executable course content can call the API Wrapper\r
+**      functions as follows:\r
+**\r
+**    javascript:\r
+**          var result = doLMSInitialize();\r
+**          if (result != true) \r
+**          {\r
+**             // handle error\r
+**          }\r
+**\r
+**    authorware:\r
+**          result := ReadURL("javascript:doLMSInitialize()", 100)\r
+**\r
+**    director:\r
+**          result = externalEvent("javascript:doLMSInitialize()")\r
+**\r
+**\r
+*******************************************************************************/\r
+\r
+var debug = true;  // set this to false to turn debugging off\r
+\r
+var output = window.console; // output can be set to any object that has a log(string) function\r
+                             // such as: var output = { log: function(str){alert(str);} };\r
+\r
+// Define exception/error codes\r
+var _NoError = {"code":"0","string":"No Error","diagnostic":"No Error"};\r
+var _GeneralException = {"code":"101","string":"General Exception","diagnostic":"General Exception"};\r
+\r
+var initialized = false;\r
+\r
+// local variable definitions\r
+var apiHandle = null;\r
+\r
+/*******************************************************************************\r
+**\r
+** Function: doLMSInitialize()\r
+** Inputs:  None\r
+** Return:  true if the initialization was successful, or\r
+**          false if the initialization failed.\r
+**\r
+** Description:\r
+** Initialize communication with LMS by calling the LMSInitialize\r
+** function which will be implemented by the LMS.\r
+**\r
+*******************************************************************************/\r
+function doLMSInitialize()\r
+{\r
+   if (initialized) return "true";\r
+   \r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");\r
+      return "false";\r
+   }\r
+\r
+   var result = api.LMSInitialize("");\r
+   if (result.toString() != "true")\r
+   {\r
+      var err = ErrorHandler();\r
+      message("LMSInitialize failed with error code: " + err.code);\r
+   }\r
+   else\r
+   {\r
+          initialized = true;\r
+   }\r
+\r
+   return result.toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSFinish()\r
+** Inputs:  None\r
+** Return:  true if successful\r
+**          false if failed.\r
+**\r
+** Description:\r
+** Close communication with LMS by calling the LMSFinish\r
+** function which will be implemented by the LMS\r
+**\r
+*******************************************************************************/\r
+function doLMSFinish()\r
+{\r
+   if (! initialized) return "true";\r
+   \r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");\r
+      return "false";\r
+   }\r
+   else\r
+   {\r
+      // call the LMSFinish function that should be implemented by the API\r
+      var result = api.LMSFinish("");\r
+      if (result.toString() != "true")\r
+      {\r
+         var err = ErrorHandler();\r
+         message("LMSFinish failed with error code: " + err.code);\r
+      }\r
+   }\r
+\r
+   initialized = false;\r
+   \r
+   return result.toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSGetValue(name)\r
+** Inputs:  name - string representing the cmi data model defined category or\r
+**             element (e.g. cmi.core.student_id)\r
+** Return:  The value presently assigned by the LMS to the cmi data model\r
+**       element defined by the element or category identified by the name\r
+**       input value.\r
+**\r
+** Description:\r
+** Wraps the call to the LMS LMSGetValue method\r
+**\r
+*******************************************************************************/\r
+function doLMSGetValue(name)\r
+{\r
+   var api = getAPIHandle();\r
+   var result = "";\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");\r
+   }\r
+   else if (! initialized && ! doLMSInitialize())\r
+   {\r
+      var err = ErrorHandler(); // get why doLMSInitialize() returned false\r
+      message("LMSGetValue failed - Could not initialize communication with the LMS - error code: " + err.code);\r
+   }\r
+   else\r
+   {\r
+      result = api.LMSGetValue(name);\r
+\r
+      var error = ErrorHandler();\r
+      if (error.code != _NoError.code)\r
+      {\r
+         // an error was encountered so display the error description\r
+         message("LMSGetValue("+name+") failed. \n"+ error.code + ": " + error.string);\r
+         result = "";\r
+      }\r
+   }\r
+   return result.toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSSetValue(name, value)\r
+** Inputs:  name -string representing the data model defined category or element\r
+**          value -the value that the named element or category will be assigned\r
+** Return:  true if successful\r
+**          false if failed.\r
+**\r
+** Description:\r
+** Wraps the call to the LMS LMSSetValue function\r
+**\r
+*******************************************************************************/\r
+function doLMSSetValue(name, value)\r
+{\r
+   var api = getAPIHandle();\r
+   var result = "false";\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");\r
+   }\r
+   else if (! initialized && ! doLMSInitialize())\r
+   {\r
+      var err = ErrorHandler(); // get why doLMSInitialize() returned false\r
+      message("LMSSetValue failed - Could not initialize communication with the LMS - error code: " + err.code);\r
+   }\r
+   else\r
+   {\r
+      result = api.LMSSetValue(name, value);\r
+      if (result.toString() != "true")\r
+      {\r
+         var err = ErrorHandler();\r
+         message("LMSSetValue("+name+", "+value+") failed. \n"+ err.code + ": " + err.string);\r
+      }\r
+   }\r
+\r
+   return result.toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSCommit()\r
+** Inputs:  None\r
+** Return:  true if successful\r
+**          false if failed.\r
+**\r
+** Description:\r
+** Commits the data to the LMS. \r
+**\r
+*******************************************************************************/\r
+function doLMSCommit()\r
+{\r
+   var api = getAPIHandle();\r
+   var result = "false";\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");\r
+   }\r
+   else if (! initialized && ! doLMSInitialize())\r
+   {\r
+      var err = ErrorHandler(); // get why doLMSInitialize() returned false\r
+      message("LMSCommit failed - Could not initialize communication with the LMS - error code: " + err.code);\r
+   }\r
+   else\r
+   {\r
+      result = api.LMSCommit("");\r
+      if (result != "true")\r
+      {\r
+         var err = ErrorHandler();\r
+         message("LMSCommit failed - error code: " + err.code);\r
+      }\r
+   }\r
+\r
+   return result.toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSGetLastError()\r
+** Inputs:  None\r
+** Return:  The error code that was set by the last LMS function call\r
+**\r
+** Description:\r
+** Call the LMSGetLastError function \r
+**\r
+*******************************************************************************/\r
+function doLMSGetLastError()\r
+{\r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");\r
+      //since we can't get the error code from the LMS, return a general error\r
+      return _GeneralException.code; //General Exception\r
+   }\r
+\r
+   return api.LMSGetLastError().toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSGetErrorString(errorCode)\r
+** Inputs:  errorCode - Error Code\r
+** Return:  The textual description that corresponds to the input error code\r
+**\r
+** Description:\r
+** Call the LMSGetErrorString function \r
+**\r
+********************************************************************************/\r
+function doLMSGetErrorString(errorCode)\r
+{\r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");\r
+      return _GeneralException.string;\r
+   }\r
+\r
+   return api.LMSGetErrorString(errorCode).toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function doLMSGetDiagnostic(errorCode)\r
+** Inputs:  errorCode - Error Code(integer format), or null\r
+** Return:  The vendor specific textual description that corresponds to the \r
+**          input error code\r
+**\r
+** Description:\r
+** Call the LMSGetDiagnostic function\r
+**\r
+*******************************************************************************/\r
+function doLMSGetDiagnostic(errorCode)\r
+{\r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");\r
+      return "Unable to locate the LMS's API Implementation. LMSGetDiagnostic was not successful.";\r
+   }\r
+\r
+   return api.LMSGetDiagnostic(errorCode).toString();\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function ErrorHandler()\r
+** Inputs:  None\r
+** Return:  The current error\r
+**\r
+** Description:\r
+** Determines if an error was encountered by the previous API call\r
+** and if so, returns the error.\r
+**\r
+** Usage:\r
+** var last_error = ErrorHandler();\r
+** if (last_error.code != _NoError.code)\r
+** {\r
+**    message("Encountered an error. Code: " + last_error.code + \r
+**                                "\nMessage: " + last_error.string +\r
+**                                "\nDiagnostics: " + last_error.diagnostic);\r
+** }\r
+*******************************************************************************/\r
+function ErrorHandler()\r
+{\r
+   var error = {"code":_NoError.code, "string":_NoError.string, "diagnostic":_NoError.diagnostic};\r
+   var api = getAPIHandle();\r
+   if (api == null)\r
+   {\r
+      message("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");\r
+      error.code = _GeneralException.code;\r
+      error.string = _GeneralException.string;\r
+      error.diagnostic = "Unable to locate the LMS's API Implementation. Cannot determine LMS error code.";\r
+      return error;\r
+   }\r
+\r
+   // check for errors caused by or from the LMS\r
+   error.code = api.LMSGetLastError().toString();\r
+   if (error.code != _NoError.code)\r
+   {\r
+      // an error was encountered so display the error description\r
+      error.string = api.LMSGetErrorString(error.code);\r
+      error.diagnostic = api.LMSGetDiagnostic(""); \r
+   }\r
+\r
+   return error;\r
+}\r
+\r
+/******************************************************************************\r
+**\r
+** Function getAPIHandle()\r
+** Inputs:  None\r
+** Return:  value contained by APIHandle\r
+**\r
+** Description:\r
+** Returns the handle to API object if it was previously set,\r
+** otherwise it returns null\r
+**\r
+*******************************************************************************/\r
+function getAPIHandle()\r
+{\r
+   if (apiHandle == null)\r
+   {\r
+      apiHandle = getAPI();\r
+   }\r
+\r
+   return apiHandle;\r
+}\r
+\r
+\r
+/*******************************************************************************\r
+**\r
+** Function findAPI(win)\r
+** Inputs:  win - a Window Object\r
+** Return:  If an API object is found, it's returned, otherwise null is returned\r
+**\r
+** Description:\r
+** This function looks for an object named API in parent and opener windows\r
+**\r
+*******************************************************************************/\r
+function findAPI(win)\r
+{\r
+       var findAPITries = 0;\r
+   while ((win.API == null) && (win.parent != null) && (win.parent != win))\r
+   {\r
+      findAPITries++;\r
+      // Note: 7 is an arbitrary number, but should be more than sufficient\r
+      if (findAPITries > 7) \r
+      {\r
+         message("Error finding API -- too deeply nested.");\r
+         return null;\r
+      }\r
+      \r
+      win = win.parent;\r
+   }\r
+   return win.API;\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function getAPI()\r
+** Inputs:  none\r
+** Return:  If an API object is found, it's returned, otherwise null is returned\r
+**\r
+** Description:\r
+** This function looks for an object named API, first in the current window's \r
+** frame hierarchy and then, if necessary, in the current window's opener window\r
+** hierarchy (if there is an opener window).\r
+**\r
+*******************************************************************************/\r
+function getAPI()\r
+{\r
+   var theAPI = findAPI(window);\r
+   if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined"))\r
+   {\r
+      theAPI = findAPI(window.opener);\r
+   }\r
+   if (theAPI == null)\r
+   {\r
+      message("Unable to find an API adapter");\r
+   }\r
+   return theAPI\r
+}\r
+\r
+/*******************************************************************************\r
+**\r
+** Function message(str)\r
+** Inputs:  String - message you want to send to the designated output\r
+** Return:  none\r
+** Depends on: boolean debug to indicate if output is wanted\r
+**             object output to handle the messages. must implement a function \r
+**             log(string)\r
+**\r
+** Description:\r
+** This function outputs messages to a specified output. You can define your own \r
+** output object. It will just need to implement a log(string) function. This \r
+** interface was used so that the output could be assigned the window.console object.\r
+*******************************************************************************/\r
+function message(str)\r
+{\r
+   if(debug)\r
+   {\r
+      output.log(str);\r
+   }\r
+}
\ No newline at end of file
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/SCOFunctions.js b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/SCOFunctions.js
new file mode 100755 (executable)
index 0000000..60c26f0
--- /dev/null
@@ -0,0 +1,227 @@
+/*******************************************************************************
+** 
+** Filename: SCOFunctions.js
+**
+** File Description: This file contains several JavaScript functions that are 
+**                   used by the Sample SCOs contained in the Sample Course.
+**                   These functions encapsulate actions that are taken when the
+**                   user navigates between SCOs, or exits the Lesson.
+**
+** Author: ADL Technical Team
+**
+** Contract Number:
+** Company Name: CTC
+**
+** Design Issues:
+**
+** Implementation Issues:
+** Known Problems:
+** Side Effects:
+**
+** References: ADL SCORM
+**
+/*******************************************************************************
+**
+** Concurrent Technologies Corporation (CTC) grants you ("Licensee") a non-
+** exclusive, royalty free, license to use, modify and redistribute this
+** software in source and binary code form, provided that i) this copyright
+** notice and license appear on all copies of the software; and ii) Licensee
+** does not utilize the software in a manner which is disparaging to CTC.
+**
+** This software is provided "AS IS," without a warranty of any kind.  ALL
+** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
+** IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-
+** INFRINGEMENT, ARE HEREBY EXCLUDED.  CTC AND ITS LICENSORS SHALL NOT BE LIABLE
+** FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+** DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL CTC  OR ITS
+** LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
+** INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
+** CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
+** OR INABILITY TO USE SOFTWARE, EVEN IF CTC  HAS BEEN ADVISED OF THE
+** POSSIBILITY OF SUCH DAMAGES.
+**
+*******************************************************************************/
+var startDate;
+var exitPageStatus;
+
+function loadPage()
+{
+   var result = doLMSInitialize();
+
+   var status = doLMSGetValue( "cmi.core.lesson_status" );
+
+   if (status == "not attempted")
+   {
+         // the student is now attempting the lesson
+         doLMSSetValue( "cmi.core.lesson_status", "incomplete" );
+   }
+
+   exitPageStatus = false;
+   startTimer();
+}
+
+
+function startTimer()
+{
+   startDate = new Date().getTime();
+}
+
+function computeTime()
+{
+   if ( startDate != 0 )
+   {
+      var currentDate = new Date().getTime();
+      var elapsedSeconds = ( (currentDate - startDate) / 1000 );
+      var formattedTime = convertTotalSeconds( elapsedSeconds );
+   }
+   else
+   {
+      formattedTime = "00:00:00.0";
+   }
+
+   doLMSSetValue( "cmi.core.session_time", formattedTime );
+}
+
+function doBack()
+{
+   doLMSSetValue( "cmi.core.exit", "suspend" );
+
+   computeTime();
+   exitPageStatus = true;
+   
+   var result;
+
+   result = doLMSCommit();
+
+       // NOTE: LMSFinish will unload the current SCO.  All processing
+       //       relative to the current page must be performed prior
+       //               to calling LMSFinish.   
+   
+   result = doLMSFinish();
+
+}
+
+function doContinue( status )
+{
+   // Reinitialize Exit to blank
+   doLMSSetValue( "cmi.core.exit", "" );
+
+   var mode = doLMSGetValue( "cmi.core.lesson_mode" );
+
+   if ( mode != "review"  &&  mode != "browse" )
+   {
+      doLMSSetValue( "cmi.core.lesson_status", status );
+   }
+   computeTime();
+   exitPageStatus = true;
+   
+   var result;
+   result = doLMSCommit();
+       // NOTE: LMSFinish will unload the current SCO.  All processing
+       //       relative to the current page must be performed prior
+       //               to calling LMSFinish.   
+
+   result = doLMSFinish();
+
+}
+
+function doQuit()
+{
+   doLMSSetValue( "cmi.core.exit", "logout" );
+
+   computeTime();
+   exitPageStatus = true;
+   
+   var result;
+
+   result = doLMSCommit();
+
+       // NOTE: LMSFinish will unload the current SCO.  All processing
+       //       relative to the current page must be performed prior
+       //               to calling LMSFinish.   
+
+   result = doLMSFinish();
+}
+
+/*******************************************************************************
+** The purpose of this function is to handle cases where the current SCO may be 
+** unloaded via some user action other than using the navigation controls 
+** embedded in the content.   This function will be called every time an SCO
+** is unloaded.  If the user has caused the page to be unloaded through the
+** preferred SCO control mechanisms, the value of the "exitPageStatus" var
+** will be true so we'll just allow the page to be unloaded.   If the value
+** of "exitPageStatus" is false, we know the user caused to the page to be
+** unloaded through use of some other mechanism... most likely the back
+** button on the browser.  We'll handle this situation the same way we 
+** would handle a "quit" - as in the user pressing the SCO's quit button.
+*******************************************************************************/
+function unloadPage()
+{
+
+       if (exitPageStatus != true)
+       {
+               doQuit();
+       }
+
+       // NOTE:  don't return anything that resembles a javascript
+       //                string from this function or IE will take the
+       //                liberty of displaying a confirm message box.
+       
+}
+
+/*******************************************************************************
+** this function will convert seconds into hours, minutes, and seconds in
+** CMITimespan type format - HHHH:MM:SS.SS (Hours has a max of 4 digits &
+** Min of 2 digits
+*******************************************************************************/
+function convertTotalSeconds(ts)
+{
+   var sec = (ts % 60);
+
+   ts -= sec;
+   var tmp = (ts % 3600);  //# of seconds in the total # of minutes
+   ts -= tmp;              //# of seconds in the total # of hours
+
+   // convert seconds to conform to CMITimespan type (e.g. SS.00)
+   sec = Math.round(sec*100)/100;
+   
+   var strSec = new String(sec);
+   var strWholeSec = strSec;
+   var strFractionSec = "";
+
+   if (strSec.indexOf(".") != -1)
+   {
+      strWholeSec =  strSec.substring(0, strSec.indexOf("."));
+      strFractionSec = strSec.substring(strSec.indexOf(".")+1, strSec.length);
+   }
+   
+   if (strWholeSec.length < 2)
+   {
+      strWholeSec = "0" + strWholeSec;
+   }
+   strSec = strWholeSec;
+   
+   if (strFractionSec.length)
+   {
+      strSec = strSec+ "." + strFractionSec;
+   }
+
+
+   if ((ts % 3600) != 0 )
+      var hour = 0;
+   else var hour = (ts / 3600);
+   if ( (tmp % 60) != 0 )
+      var min = 0;
+   else var min = (tmp / 60);
+
+   if ((new String(hour)).length < 2)
+      hour = "0"+hour;
+   if ((new String(min)).length < 2)
+      min = "0"+min;
+
+   var rtnVal = hour+":"+min+":"+strSec;
+
+   return rtnVal;
+}
+
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub-page.js b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub-page.js
new file mode 100644 (file)
index 0000000..e7fba5c
--- /dev/null
@@ -0,0 +1,36 @@
+function render_page() {
+  var dvi2epub = window.parent.dvi2epub;
+  var div = document.createElement('div');
+  var h = '<hr />';
+  var sep = '';
+  if (dvi2epub.hasPrevPage()) {
+    h += sep + '<a href="JavaScript:window.parent.dvi2epub.prevPage()">Previous</a>';
+    sep = ' ';
+  }
+  if (dvi2epub.hasNextPage()) {
+    h += sep + '<a href="JavaScript:window.parent.dvi2epub.nextPage()">Next</a>';
+    sep = ' ';
+  }
+  div.innerHTML = h;
+  document.body.appendChild(div);
+}
+
+function render_page_with_image() {
+  var dvi2epub = window.parent.dvi2epub;
+  var div = document.createElement('div');
+  var h = '';
+  var img = dvi2epub.getPage(dvi2epub.getCurrentPage()).image;
+  h += '<img src="' + img + '" alt="' + img + '"/>';
+  h += '<hr />';
+  var sep = '';
+  if (dvi2epub.hasPrevPage()) {
+    h += sep + '<a href="JavaScript:window.parent.dvi2epub.prevPage()">Previous</a>';
+    sep = ' ';
+  }
+  if (dvi2epub.hasNextPage()) {
+    h += sep + '<a href="JavaScript:window.parent.dvi2epub.nextPage()">Next</a>';
+    sep = ' ';
+  }
+  div.innerHTML = h;
+  document.body.appendChild(div);
+}
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub.js b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/js/dvi2epub.js
new file mode 100644 (file)
index 0000000..cc2c788
--- /dev/null
@@ -0,0 +1,85 @@
+var dvi2epub = {};
+
+dvi2epub.stageId = 'dvi2epubStage';
+dvi2epub.state = {};
+
+dvi2epub.loadTable = function (json) {
+  message("dvi2epub: loadTable().");
+  var as = new Array();
+  for (var i in json) {
+    var rec = json[i];
+    as.push(rec);
+  }
+  dvi2epub.table = as;
+  dvi2epub.total_pages = as.length;
+  message("dvi2epub: " + dvi2epub.total_pages + " page(s).");
+};
+
+dvi2epub.openPage = function (n) {
+  message("dvi2epub: openPage: n=" + n);
+  //var stage = document.getElementById(dvi2epub.stageId);
+  var stage = dvi2epubStage;
+  if (stage == null) {
+    throw new Error("Failed to find stage: " + dvi2epub.stageId);
+  }
+  var url = this.table[n].url;
+  message("Open: " + url);
+  stage.location.href = url;
+  this.state.currentPage = n;
+};
+
+dvi2epub.isValidPage = function (n) {
+  return (0 <= n && n < this.total_pages);
+};
+
+dvi2epub.hasNextPage = function () {
+  return this.isValidPage(this.state.currentPage + 1);
+};
+
+dvi2epub.hasPrevPage = function () {
+  return this.isValidPage(this.state.currentPage - 1);
+};
+
+dvi2epub.nextPage = function () {
+  message("dvi2epub: nextPage");
+  if (this.hasNextPage) {
+    this.openPage(this.state.currentPage + 1);
+  }
+};
+
+dvi2epub.prevPage = function () {
+  message("dvi2epub: prevPage");
+  if (this.hasPrevPage) {
+    this.openPage(this.state.currentPage - 1);
+  }
+};
+
+dvi2epub.getCurrentPage = function () {
+  return this.state.currentPage;
+};
+
+dvi2epub.getPage = function (n) {
+  if (this.isValidPage(n)) {
+    return this.table[n];
+  }
+  return undefined;
+};
+
+dvi2epub.init = function () {
+  try {
+    loadPage();
+  } catch (e) {
+    message("Caught exception: " + e);
+  }
+  message("dvi2epub: Initialized");
+  this.state.initialized = true;
+};
+
+dvi2epub.done = function () {
+  try {
+    unloadPage();
+  } catch (e) {
+    message("Caught exception: " + e);
+  }
+  message("dvi2epub: Finalized.");
+};
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/manifest.txt b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/manifest.txt
new file mode 100644 (file)
index 0000000..a67bfe2
--- /dev/null
@@ -0,0 +1,10 @@
+application/x-html,index.html\r
+application/x-html,blank.html\r
+application/x-html,disp.html\r
+application/x-html,page.html\r
+application/xml,imsmanifest.xml\r
+text/javascript,js/APIWrapper.js\r
+text/javascript,js/SCOFunctions.js\r
+text/javascript,js/dvi2epub-page.js\r
+text/javascript,js/dvi2epub.js\r
+text/javascript,data/pages.js\r
diff --git a/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/page.html b/src/main/resources/jp/sourceforge/dvibrowser/dvi2epub/tpl/page.html
new file mode 100644 (file)
index 0000000..e396614
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='ja' lang='ja'>
+<head> 
+  <script language="JavaScript" src="js/dvi2epub-page.js"></script>
+  <title></title> 
+</head> 
+<body onload='render_page_with_image()'>
+</body>
+</html>