Advertisement
Guest User

Untitled

a guest
Feb 28th, 2014
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.41 KB | None | 0 0
  1.  
  2. <HTML>
  3. <HEAD>
  4. <LINK REL="stylesheet" TITLE="default" HREF="../../templates/safetylearning/style.css" />
  5. <LINK REL="stylesheet" TITLE="default" HREF="../../templates/safetylearning/viewerint.css" />
  6. <TITLE></TITLE>
  7. <SCRIPT LANGUAGE="JavaScript">
  8. <!--
  9. var blSectionBarrier = false;
  10. var blOnlyNavWhenLoaded = true;
  11. var blFreeRoam = false;
  12. var blReviewSectionOnly = false;
  13. var blNavPrevDisabled = false;
  14. var blNavNextDisabled = false;
  15. var blEnableForce = false;
  16. var blIsAssessment = false;
  17. var bAssessmentModule = false;
  18.  
  19. //updated by UL for Flash Fuctions
  20. var audioVolume=100;
  21. var transOpen="false";
  22. var backenb;
  23. var nextend = true;
  24. //
  25. var frag;
  26.  
  27.  
  28. function debugLog (strContent) {
  29. if (parent.hiddenLoaded) {parent.hiddenFrame.addLog(strContent);}
  30. }
  31.  
  32. function addMenuItem(intSectionID, strSectionText) {
  33. if (parent.intMaxSection > intSectionID) {
  34. strClass="menuItemBox MenuTabTextUnSelected ";
  35. }else if (parent.intMaxSection == intSectionID) {
  36. strClass="menuItemBox MenuTabSelected MenuTabTextSelected";
  37. }else{
  38. strClass="menuItemBox MenuTabTextUnSelected";
  39. }
  40.  
  41. return "<TR><TD onclick=\"javascript:loadPage("+intSectionID+",1,true);\" id=s"+intSectionID+" class =\"menuItemBox MenuTabTextUnSelected\">"+strSectionText+"</TD></TR>";
  42. }
  43.  
  44.  
  45. function addSummaryItem (intSectionID, intPageID, strSectionText) {
  46.  
  47. strClass="menuItemLink";
  48. return "<TR><TD onclick=\"javascript:loadPage("+intSectionID+","+intPageID+",true);\" ID=\"s"+intPageID+"\" id=s"+intSectionID+" class =\"menuItemBox MenuTabTextUnSelected\">"+strSectionText+"</TD></TR>";
  49. }
  50.  
  51.  
  52. function buildMenu() {
  53. oMenu=document.getElementById('menuTableBody');
  54. sTableHeight = "";
  55. var iPercent = ((parent.oSections.length *20)-5);
  56. if(iPercent <=0)
  57. sTableHeight = " style=\"height:10%;\"";
  58. else
  59. if(iPercent <=60)
  60. sTableHeight = " style=\"height:" + iPercent + "%;\"";
  61. strMenu="<TABLE ID=\"menuTable\" CLASS=\"menuTable\" CELLPADDING=\"0\" CELLSPACING=\"1\" BORDER=\"0\" " + sTableHeight + "><TR><TD CLASS=\"menuTitle menuTitleBg\">Menu";
  62. if( parent.blSummary && blReviewSectionOnly) strMenu=strMenu+"<br> <font size = 2> Summary </font>";
  63. strMenu=strMenu+"</TD></TR>";
  64.  
  65. if (!blReviewSectionOnly) {
  66. for (i=0; i < parent.oSections.length; i++) {
  67. if (parent.oSections[i].enabled) {strMenu+=addMenuItem((i+1),parent.oSections[i].sectionName);}
  68. }
  69. if (parent.blSummary) {strMenu+=addMenuItem((parent.oSections.length+1), "Summary");}
  70. if (parent.blChecklist) {strMenu+=addMenuItem((parent.oSections.length+2), "Checklist");}
  71. if (parent.blSelfTest) {strMenu+=addMenuItem((parent.oSections.length+3), "Selftest");}
  72.  
  73. } else if (parent.blSummary) {
  74.  
  75.  
  76. }
  77.  
  78.  
  79.  
  80. strMenu+="</TABLE>";
  81. oMenu.innerHTML=strMenu;
  82. }
  83.  
  84. function saveProgress(n) {
  85. if (n<11) { // Waits 10 deciseconds (1 second) for the hidden frame to load.
  86. if (!parent.hiddenLoaded) {
  87. debugLog("saveProgress("+n+"); failed");
  88. setTimeout("saveProgress("+(n+1)+");", 100);
  89. }else{
  90. if (parent.intMaxSection>=parent.oSections.length+4) {blCompleted=1;}else{blCompleted=0;}
  91. debugLog("saveProgress("+n+"); saving Module[218] Section["+parent.intMaxSection+"] Page["+parent.intMaxPage+"] Completed["+blCompleted+"]");
  92. parent.hiddenFrame.setPage(218, parent.intMaxSection, parent.intMaxPage, blCompleted);
  93. }
  94. }
  95. }
  96.  
  97. function saveVideoProgress(n,bookmark) {
  98. if (n<11) { // Waits 10 deciseconds (1 second) for the hidden frame to load.
  99. if (!parent.hiddenLoaded) {
  100. debugLog("saveVideoProgress("+n+","+bookmark+"); failed");
  101. setTimeout("saveVideoProgress("+(n+1)+","+bookmark+");", 100);
  102. }else{
  103. if (parent.intMaxSection>=parent.oSections.length+4) {blCompleted=1;}else{blCompleted=0;}
  104. debugLog("saveVideoProgress("+n+","+bookmark+"); saving Module[218] Section["+parent.intMaxSection+"] ["+bookmark+"] Completed["+blCompleted+"]");
  105. if (parent.hiddenFrame.setVideoPage) parent.hiddenFrame.setVideoPage(218, parent.intMaxSection, bookmark, blCompleted);
  106. }
  107. }
  108. }
  109.  
  110. function canMenuNav(intSection, intPage) {
  111. intTrueSection=parent.intCurrentSection;
  112. blCanNav = true;
  113. if (parent.intMaxSection<intSection && !blFreeRoam) {blCanNav=false;}
  114. if (!blCanNav) {
  115. if (intTrueSection > 0 && intTrueSection <= parent.oSections.length) { // Regular Sections
  116. if (intSection==parent.intMaxSection+1 && intPage==1 && parent.intMaxPage>=parent.oSections[intSection-2].pages) {blCanNav=true;}
  117. }
  118. if (intTrueSection == parent.oSections.length+1) { // Summary Section
  119.  
  120. }
  121. }
  122.  
  123. debugLog("canMenuNav("+intSection+", "+intPage+"); : returns "+blCanNav+";");
  124. if (bAssessmentModule)
  125. blCanNav = true;
  126. return blCanNav;
  127. }
  128.  
  129. function loadPage(intSection, intPage, blMenuNav) {
  130. debugLog ("");
  131. blNoNav=false;
  132. parent.hiddenFrame.intCycle=0;
  133. if (blMenuNav && intSection>1) {blNoNav = !canMenuNav(intSection, intPage);}else{blNoNav=false;}
  134.  
  135. parent.navFrame.blCPS=false; parent.navFrame.resetFrameset();
  136. if (parent.blClassroom) {parent.cpsFrame.resetInput();}
  137.  
  138. strURL="";
  139. if (blNoNav && !blReviewSectionOnly)
  140. {
  141. alert('Cannot begin section '+intSection+', because section '+parent.intCurrentSection+' needs to be completed');
  142. }
  143. else if(blMenuNav && parent.blLockInSelfTest && parent.intCurrentSection == parent.oSections.length+3)
  144. {
  145. alert('Can not revisit sections once you have started the self test');
  146. }
  147. else
  148. {
  149. if (intSection == parent.oSections.length+1) { //Summary
  150. blIsAssessment = false;
  151. parent.intCurrentSection=intSection;
  152. parent.intCurrentPage=intPage;
  153. pageLoading();
  154. strURL = "translate.php?c=dseflashint&s="+intSection+"&p="+intPage;
  155. }else if (intSection == parent.oSections.length+2 && !blReviewSectionOnly) { //Checklist
  156. blIsAssessment = true;
  157. strURL = "translate.php?v=checklist&c=dseflashint&p="+parent.intCurrentPage;
  158. parent.intCurrentSection=intSection;
  159. parent.intCurrentPage=intPage;
  160. }else if (intSection == parent.oSections.length+3 && !blReviewSectionOnly) { //Self Test
  161. blIsAssessment = true;
  162. strURL = "translate.php?v=selftest&c=dseflashint&p="+parent.intCurrentPage;
  163. parent.intCurrentSection=intSection;
  164. parent.intCurrentPage=intPage;
  165. }else if (intSection > parent.oSections.length+3 && !blReviewSectionOnly) { //Completion Page
  166. blIsAssessment = true;
  167. parent.intCurrentSection=intSection;
  168. parent.intCurrentPage=intPage;
  169. strURL = "translate.php?v=finish&c=dseflashint";
  170. }else if (intSection > 0 && intSection <= parent.oSections.length && !blReviewSectionOnly) {
  171. blIsAssessment = false;
  172. if ((intPage > 0 && intPage <= parent.oSections[intSection-1].pages) || (parent.oSections[intSection-1].video)) { //Regular Page
  173. if (parent.blNew) {intSection=1; intPage=1; parent.blNew=false;}
  174. parent.intCurrentSection=intSection;
  175. parent.intCurrentPage=intPage;
  176. pageLoading();
  177. strURL = "translate.php?c=dseflashint&s="+intSection+"&p="+intPage;
  178. if (parent.oSections[intSection-1].video)
  179. strURL+="&video=true";
  180.  
  181. }
  182. else{
  183. navNext();
  184. }
  185. }
  186. if (strURL.length>0) {
  187. if (parent.intClassID>0) {strURL+="&cid="+parent.intClassID;}
  188. parent.navNextFunction = "";
  189. parent.mainFrame.location.href = strURL;
  190. }
  191.  
  192. blSavePage = false;
  193. if (parent.intCurrentSection > parent.intMaxSection) {parent.intMaxSection=parent.intCurrentSection; parent.intMaxPage=1; blSavePage=true;}
  194. if (parent.intCurrentSection == parent.intMaxSection && parent.intCurrentPage > parent.intMaxPage) {parent.intMaxPage=parent.intCurrentPage; blSavePage=true;}
  195. if (intSection <= parent.oSections.length) {
  196. if (blSavePage && !parent.oSections[intSection-1].video) {saveProgress(0);}
  197. }else{
  198. if (blSavePage) {saveProgress(0);}
  199. }
  200.  
  201. if (isNextAvailable() && !blOnlyNavWhenLoaded && (!blIsAssessment || parent.blClassroom)) {navNextEnable();}else{navNextDisable();}
  202. if (isPrevAvailable() && (!blIsAssessment || parent.blClassroom)) {navPrevEnable();}else{navPrevDisable();}
  203. }
  204. debugLog ("loadPage("+intSection+", "+intPage+", "+blMenuNav+"); [URL:"+strURL+"]");
  205. debugLog ("current status: section="+parent.intCurrentSection+" page="+parent.intCurrentPage+"; maximum status: section="+parent.intMaxSection+" page="+parent.intMaxPage+";");
  206.  
  207. refreshMenu();
  208.  
  209. }
  210.  
  211.  
  212. function isNextAvailable() {
  213. if (parent.intCurrentSection>0) {
  214. if (parent.intCurrentSection <= parent.oSections.length ) {
  215. if (parent.intCurrentPage < parent.oSections[parent.intCurrentSection-1].pages+1) {
  216. return true;
  217. }else if (!blSectionBarrier) {
  218. if (parent.intCurrentSection < parent.oSections.length) {return true;}
  219. if (parent.intCurrentSection == parent.oSections.length && (parent.blSummary || parent.blSelfTest || parent.blChecklist)) {return true;}
  220. }
  221. }else{
  222. if (parent.intCurrentSection == parent.oSections.length+1 && parent.blSummary) {
  223. if (parent.intCurrentPage < parent.oSections.length) {return true;}
  224. if (!blSectionBarrier) {
  225. if (parent.blSelfTest || parent.blChecklist) {return true;}
  226. }
  227. }
  228. if (parent.intCurrentSection == parent.oSections.length+2 && parent.blChecklist) {return true;}
  229. if (parent.intCurrentSection == parent.oSections.length+3 && parent.blSelfTest) {return true;}
  230. }
  231. }else{
  232. return true;
  233. }
  234. return false;
  235. }
  236.  
  237. function isPrevAvailable() {
  238. if (parent.intCurrentPage > 1) {
  239. return true;
  240. }else if (!blSectionBarrier) {
  241. if (parent.intCurrentSection > 1) {return true;}
  242. }
  243. return false;
  244. }
  245.  
  246. function navNext() {
  247. if (!blNavNextDisabled && ((blOnlyNavWhenLoaded && parent.pageLoaded) || !blOnlyNavWhenLoaded)) {
  248. if (parent.navNextFunction.length > 0) {doNavNextFunction();return true;}
  249.  
  250. if (parent.intCurrentSection <= parent.oSections.length && parent.intCurrentPage < parent.oSections[parent.intCurrentSection-1].pages+1) {
  251. parent.intCurrentPage++;
  252. }else if ((parent.intCurrentSection == parent.oSections.length+1 && parent.blSummary) && (parent.intCurrentPage < parent.oSections.length)) {
  253. parent.intCurrentPage++;
  254. }else if (!blSectionBarrier && !blReviewSectionOnly) {
  255. parent.intCurrentSection++;
  256. if (parent.intCurrentSection == parent.oSections.length+1 && !parent.blSummary) {parent.intCurrentSection++;}
  257. if (parent.intCurrentSection == parent.oSections.length+2 && !parent.blChecklist) {parent.intCurrentSection++;}
  258. if (parent.intCurrentSection == parent.oSections.length+3 && !parent.blSelfTest) {parent.intCurrentSection++;}
  259.  
  260. if (parent.intCurrentSection > parent.oSections.length+3) {
  261. // Completed this module
  262. // Show finishing page
  263. }else{
  264. parent.intCurrentPage=1;
  265. }
  266. }
  267. loadPage(parent.intCurrentSection, parent.intCurrentPage, false);
  268. if (blOnlyNavWhenLoaded) {
  269. pageLoading();
  270. }
  271. }
  272. }
  273.  
  274. function doNavNextFunction() {
  275. if (parent.navNextFunction.length > 0) {
  276. eval(parent.navNextFunction);
  277. parent.navNextFunction='';
  278. }
  279. }
  280.  
  281. function navPrev() {
  282.  
  283. if (!blNavPrevDisabled) {
  284. if (parent.intCurrentPage > 1) {
  285. parent.intCurrentPage--;
  286. }else if (!blSectionBarrier) {
  287. if (parent.intCurrentSection > 1 && parent.intCurrentSection <= parent.oSections.length) {
  288. parent.intCurrentSection--;
  289. parent.intCurrentPage = parent.oSections[parent.intCurrentSection-1].pages;
  290. }
  291. //if (parent.intCurrentSection == parent.oSections.length+1 && !parent.blSummary) {parent.intCurrentSection--;}
  292. //if (parent.intCurrentSection == parent.oSections.length+2 && !parent.blChecklist) {parent.intCurrentSection--;}
  293. }
  294. loadPage(parent.intCurrentSection, parent.intCurrentPage, false);
  295. }
  296.  
  297. }
  298.  
  299.  
  300. function navPrevDisable() {
  301. if (!blNavPrevDisabled || blEnableForce) {
  302. blNavPrevDisabled = true;
  303. //parent.navFrame.navPrevLink.className="navButtonLinkDis";
  304. parent.navFrame.navPrevImage.src = parent.navFrame.navImgPrevDis.src;
  305. }
  306. }
  307. function navPrevEnable() {
  308. if (blNavPrevDisabled || blEnableForce) {
  309. blNavPrevDisabled = false;
  310. //parent.navFrame.navPrevLink.className="navButtonLink";
  311. parent.navFrame.navPrevImage.src = parent.navFrame.navImgPrev.src;
  312. }
  313. }
  314. function navNextDisable() {
  315. if (!blNavNextDisabled || blEnableForce) {
  316. blNavNextDisabled = true;
  317. //parent.navFrame.navNextLink.className="navButtonLinkDis";
  318. parent.navFrame.navNextImage.src = parent.navFrame.navImgNextDis.src;
  319. if (blSectionBarrier) {parent.navFrame.navSetStatus("Please click on the next section to continue training");}
  320. }
  321. }
  322. function navNextEnable() {
  323. if (blNavNextDisabled || blEnableForce) {
  324. blNavNextDisabled = false;
  325. parent.navFrame.navNextImage.src = parent.navFrame.navImgNext.src;
  326. if (blSectionBarrier) {parent.navFrame.statusBar.innerHTML="";}
  327. }
  328. }
  329.  
  330. function pageLoading() {
  331. parent.pageLoaded = false;
  332. if (!blNavNextDisabled) {
  333. if (blOnlyNavWhenLoaded) {
  334. navNextDisable();
  335. }else{
  336. navNextEnable();
  337. }
  338. }
  339. }
  340.  
  341. function pageLoaded() {
  342. parent.pageLoaded=true;
  343. checkNav();
  344. }
  345.  
  346. function refreshMenu() {
  347.  
  348. if(blReviewSectionOnly) {
  349. for (i=1; i<=1;i++) {
  350. if (i==parent.intCurrentPage ) {
  351. strClass="menuItemBox MenuTabTextSelected MenuTabSelected";
  352. }else{
  353. strClass="menuItemBox MenuTabTextUnSelected";
  354. }
  355. try {
  356. document.getElementById('s'+i).className = strClass;
  357. } catch (e) {;}
  358. }
  359. debugLog("refreshSummaryMenu();");
  360.  
  361. }else {
  362. for (i=1; i<=parent.oSections.length+3;i++){
  363.  
  364. if (i==parent.intCurrentSection){
  365. strClass="menuItemBox MenuTabTextSelected MenuTabSelected";
  366. }else if (i < parent.intCurrentSection) {
  367. strClass="menuItemBox MenuTabTextUnSelected MenuTabUnSelected";
  368. }else{
  369. strClass="menuItemBox MenuTabTextUnSelected";
  370. if (i==parent.intMaxSection){
  371. if (parent.intMaxSection <= parent.oSections.length){
  372. if (parent.intMaxPage>=parent.oSections[parent.intMaxSection-1].pages-1) {
  373. strClass = 'menuItemBox MenuTabTextUnSelected';
  374. }
  375. }
  376. if (parent.intMaxSection == parent.oSections.length+1) {
  377. if (parent.intMaxPage>=parent.oSections.length-1) {
  378. strClass = 'menuItemBox MenuTabTextUnSelected';}
  379. }
  380. }
  381. }
  382. try {
  383. document.getElementById('s'+i).className = strClass;
  384. } catch (e) {;}
  385. }
  386.  
  387. debugLog("refreshMenu();");
  388. }
  389. }
  390.  
  391. function checkNav() {
  392. blEnableForce=true;
  393.  
  394. if ((parent.pageLoaded || !blOnlyNavWhenLoaded) && (!blIsAssessment || parent.blClassroom)) {
  395. if (isNextAvailable() )
  396. {navNextEnable();}
  397. else
  398. {navNextDisable();}
  399. }else{
  400. navNextDisable();
  401. }
  402. if(bAssessmentModule && !blIsAssessment)
  403. navNextEnable();
  404. if (isPrevAvailable() && (!blIsAssessment || parent.blClassroom)) {navPrevEnable();}else{navPrevDisable();}
  405. blEnableForce=false;
  406. }
  407.  
  408. function StandAloneChecklist(){
  409. bAssessmentModule = true;
  410. }
  411.  
  412. var navPrevImage;
  413. var navPrevImage;
  414. var blDebug = false;
  415. var blCPS = false;
  416.  
  417. var navImgPrevDis = new Image(); navImgPrevDis.src = '../../templates/safetylearning/images/moduleviewer/left1-dis.gif';
  418. var navImgPrev = new Image(); navImgPrev.src = '../../templates/safetylearning/images/moduleviewer/left1.gif';
  419. var navImgPrevHigh = new Image(); navImgPrevHigh.src = '../../templates/safetylearning/images/moduleviewer/left2.gif';
  420. var navImgNextDis = new Image(); navImgNextDis.src = '../../templates/safetylearning/images/moduleviewer/right1-dis.gif';
  421. var navImgNext = new Image(); navImgNext.src = '../../templates/safetylearning/images/moduleviewer/right1.gif';
  422. var navImgNextHigh = new Image(); navImgNextHigh.src = '../../templates/safetylearning/images/moduleviewer/right2.gif';
  423.  
  424. function navPrevDance() {
  425. if (isPrevAvailable()) {
  426. parent.navFrame.navPrevImage.src = parent.navFrame.navImgPrevHigh.src;
  427. setTimeout("parent.navFrame.navPrevImage.src = parent.navFrame.navImgPrev.src;", 300);
  428. }
  429. }
  430.  
  431.  
  432. function navNextDance() {
  433. if (isNextAvailable()) {
  434. parent.navFrame.navNextImage.src = parent.navFrame.navImgNextHigh.src;
  435. setTimeout("parent.navFrame.navNextImage.src = parent.navFrame.navImgNext.src;", 300);
  436. }
  437. }
  438.  
  439.  
  440. //-->
  441. </SCRIPT>
  442. </HEAD>
  443.  
  444. <BODY onLoad="parent.menuLoaded=true;" id="menubg">
  445. <DIV ID="menuTableBody">
  446. </DIV>
  447. <BR />
  448. </BODY>
  449. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement