Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: JavaScript  |  size: 158.60 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. function CMIComponent(A, D, C, B) {
  3.     this.Name = A;
  4.     this.Value = D;
  5.     this.DefaultValue = D;
  6.     this.ReadStatus = C;
  7.     this.DataType = B
  8. }
  9. var ScormState = {
  10.     StateNotInitialized: "notinitialized",
  11.     StateRunning: "running",
  12.     StateTerminated: "terminated"
  13. };
  14. var ScormStatus = {
  15.     StatusReadOnly: "readonly",
  16.     StatusWriteOnly: "writeonly",
  17.     StatusBoth: "both"
  18. };
  19. RatingsPanel = Ext.extend(Ext.Panel, {
  20.     constructor: function(A) {
  21.         Ext.apply(this, A, {
  22.             width: "auto",
  23.             rating: 0,
  24.             averageRating: 0,
  25.             hoverRating: 0,
  26.             active: true
  27.         });
  28.         RatingsPanel.superclass.constructor.call(this, A);
  29.         this._Rate1Star = this._Rate1Star || "Click to rate this activity with 1 star";
  30.         this._RateNStars = this._RateNStars || "Click to rate this activity with {0} stars";
  31.         this._AverageRating = this._AverageRating || "Average: {0}";
  32.         this.addEvents("rated");
  33.         this.on("render", function(B) {
  34.             this.ratingsBar = Ext.DomHelper.append(B.body, {
  35.                 tag: "div",
  36.                 cls: "x-ratings-bar"
  37.             },
  38.             true);
  39.             this.ratingsDisplay = Ext.DomHelper.append(this.ratingsBar, {
  40.                 tag: "div",
  41.                 cls: "x-ratings-display x-ratings-chosen"
  42.             },
  43.             true);
  44.             this.ratingsLabel = Ext.DomHelper.append(B.body, {
  45.                 tag: "div",
  46.                 cls: "x-ratings-label"
  47.             },
  48.             true);
  49.             if (this.active) {
  50.                 this.ratingsBar.on("mousemove", this.onMouseMove, this, {
  51.                     buffer: 25
  52.                 });
  53.                 this.ratingsBar.on("mouseleave", this.onMouseLeave, this, {
  54.                     delay: 30
  55.                 });
  56.                 this.ratingsBar.on("click", this.onClick, this);
  57.                 this.tip = new Ext.ToolTip({
  58.                     id: "ratings-tip",
  59.                     anchorToTarget: false,
  60.                     autoShow: false,
  61.                     hideDelay: 0,
  62.                     showDelay: 10,
  63.                     target: this.ratingsDisplay,
  64.                     trackMouse: true
  65.                 })
  66.             }
  67.             this.updateRating()
  68.         },
  69.         this)
  70.     },
  71.     getRatingByMouse: function(D) {
  72.         var B = this.ratingsBar;
  73.         var A = D.getPageX() - B.getX();
  74.         var C = A / B.getWidth();
  75.         return Math.max(0, Math.min(5, Math.ceil(5 * C)))
  76.     },
  77.     onMouseMove: function(C, A, D) {
  78.         var B = this.getRatingByMouse(C);
  79.         if (B != this.hoverRating) {
  80.             this.hoverRating = B;
  81.             if (this.tip && !this.tip.targetXY) {
  82.                 this.tip.targetXY = C.getXY()
  83.             }
  84.             this.updateRating(true)
  85.         }
  86.     },
  87.     onMouseLeave: function(B, A, C) {
  88.         this.hoverRating = 0;
  89.         this.updateRating()
  90.     },
  91.     onClick: function(B, A, C) {
  92.         this.rating = this.getRatingByMouse(B);
  93.         this.hoverRating = this.rating;
  94.         this.updateRating(false);
  95.         this.fireEvent("rated", this, this.rating)
  96.     },
  97.     setQtip: function(B, A) {
  98.         if (this.tip) {
  99.             if (A && !Ext.isEmpty(B) && !this.tip.body) {
  100.                 this.tip.show()
  101.             }
  102.             if (this.tip.body) {
  103.                 this.tip.body.update(B);
  104.                 this.tip.doLayout()
  105.             }
  106.             if (A && !Ext.isEmpty(B)) {
  107.                 this.tip.show()
  108.             }
  109.             else {
  110.                 this.tip.hide()
  111.             }
  112.         }
  113.     },
  114.     updateRating: function(E) {
  115.         this.rating = Math.max(0, Math.min(5, Math.round(this.rating)));
  116.         this.averageRating = Math.max(0, Math.min(5, this.averageRating));
  117.         var D = this.rating;
  118.         var B = false;
  119.         if (!D) {
  120.             D = this.averageRating;
  121.             B = true
  122.         }
  123.         if (E) {
  124.             D = this.hoverRating
  125.         }
  126.         var C = (D / 5) * 100;
  127.         if (isNaN(C)) {
  128.             C = 0
  129.         }
  130.         this.ratingsDisplay.setWidth(C + "%");
  131.         if (E) {
  132.             this.ratingsDisplay.removeClass(["x-ratings-chosen", "x-ratings-average"]).addClass("x-ratings-hover")
  133.         }
  134.         else {
  135.             if (B) {
  136.                 this.ratingsDisplay.removeClass(["x-ratings-chosen", "x-ratings-hover"]).addClass("x-ratings-average")
  137.             }
  138.             else {
  139.                 this.ratingsDisplay.removeClass(["x-ratings-average", "x-ratings-hover"]).addClass("x-ratings-chosen")
  140.             }
  141.         }
  142.         if (E) {
  143.             this.setQtip((D == 1) ? this._Rate1Star : String.format(this._RateNStars, D), true)
  144.         }
  145.         else {
  146.             if (this.tip.body) {
  147.                 this.setQtip("", false)
  148.             }
  149.         }
  150.         var A = "";
  151.         if (this.averageRating) {
  152.             A = String.format(this._AverageRating, this.averageRating)
  153.         }
  154.         this.ratingsLabel.update(A)
  155.     },
  156.     setRating: function(B, A) {
  157.         this.rating = B.toFixed(1);
  158.         this.averageRating = A.toFixed(1);
  159.         this.updateRating()
  160.     }
  161. });
  162. Ext.reg("ratingspanel", RatingsPanel);
  163. PlayerPanel = function(E) {
  164.     Ext.apply(this, E, {
  165.         _DataDebug: false,
  166.         courseTree: null,
  167.         nodeLookup: null,
  168.         viewport: null,
  169.         messageBoxShouldBeClosed: true,
  170.         itemInfo: null,
  171.         itemId: null,
  172.         shortcutId: null,
  173.         lastLogicalId: null,
  174.         courseContent: null,
  175.         assignmentForm: null,
  176.         assignmentWindow: null,
  177.         rubricPanel: null,
  178.         rubricWindow: null,
  179.         detailsPanel: null,
  180.         detailsWindow: null,
  181.         peerReviewPanel: null,
  182.         peerReviewWindow: null,
  183.         lastItemInfoRequest: null,
  184.         dropboxDetailsButton: null,
  185.         dropboxCompletedButton: null,
  186.         dropboxSubmitButton: null,
  187.         dropboxOpenSubmitButton: null,
  188.         dropboxSaveProgressButton: null,
  189.         dropboxOpenSaveProgressButton: null,
  190.         dropboxOpenButton: null,
  191.         dropboxOpenSplitButton: null,
  192.         dropboxRubricButton: null,
  193.         dropboxSubmitTooltip: null,
  194.         dropboxSurveyButton: null,
  195.         mainCourseContentPanel: null,
  196.         attachmentPanel: null,
  197.         idealHeight: 800,
  198.         idealWidth: 850,
  199.         idealAssignmentHeight: 380,
  200.         idealAssignmentWidth: 620,
  201.         scoreColumnWidth: 92,
  202.         scoreColumnHeight: 18,
  203.         firstColumnWidthStyle: null,
  204.         allColumnsWidthStyle: null,
  205.         configureGroupSetupWindow: null,
  206.         playerInitialized: false,
  207.         needsItemInitialization: false,
  208.         needsTreeInitialization: false,
  209.         itemCurrentlyGrading: null,
  210.         downloadIframe: null,
  211.         sizeTimer: null,
  212.         autoScrollTree: Ext.isOpera
  213.     });
  214.     PlayerPanel.superclass.constructor.call(this);
  215.     this.setupStyles();
  216.     if (this.showToc) {
  217.         playerColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
  218.             focus: Ext.emptyFn,
  219.             scoreColumnWidth: 92,
  220.             scoreColumnHeight: 18,
  221.             playerId: this.playerId,
  222.             renderElements: function(P, X, T, Y) {
  223.                 this.indentMarkup = P.parentNode ? P.parentNode.ui.getChildIndent() : "";
  224.                 if (!T) {
  225.                     return
  226.                 }
  227.                 var Z = P.getOwnerTree();
  228.                 var W = Z.columns;
  229.                 var V = Z.borderWidth;
  230.                 var U = W[0];
  231.                 var O = ['<li class="x-tree-node"><div ext:tree-node-id="', P.id, '" style="height:', this.scoreColumnHeight, ';" class="x-tree-node-el x-tree-node-leaf ', X.cls, '">', '<div class="x-tree-col x-tree-col-first" style="overflow:visible">', '<span class="x-tree-node-indent">', this.indentMarkup, "</span>", '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">', '<img src="', X.icon || this.emptyIcon, '" class="x-tree-node-icon', (X.icon ? " x-tree-node-inline-icon" : ""), (X.iconCls ? " " + X.iconCls : ""), '" unselectable="on">', '<a hidefocus="on" class="x-tree-node-anchor" href="', X.href ? X.href : "#", '" tabIndex="1" ', X.hrefTarget ? ' target="' + X.hrefTarget + '"' : "", ">", '<span unselectable="on" class="x-tree-col-text ', X.excused ? "grade-excused" : "", '" ext:qtip="', Ext.util.Format.htmlEncode(P.text), '">', P.text || (U.renderer ? U.renderer(X[U.dataIndex], P, X) : X[U.dataIndex]), "</span></a>"];
  232.                 O.push("</div>");
  233.                 U = W[1];
  234.                 var R = "";
  235.                 if (P.isSelected()) {
  236.                     R = "x-tree-selected"
  237.                 }
  238.                 O.push('<div id="', P.id, "_", this.playerId, '_grade" class="x-tree-col color_light', (U.cls ? U.cls : ""), " ", R, '" style="float:right;margin-right:', V, 'px">');
  239.                 if (X.gradeHtml && (X.gradeHtml.indexOf("<span>&nbsp;</span>") == -1 || X.gradeHtml.indexOf("gbi-retry") > 0)) {
  240.                     var Q = 0;
  241.                     if (Ext.isIE) {
  242.                         Q = -2
  243.                     }
  244.                     Q -= 4;
  245.                     O.push('<div class="x-tree-col-text x-tree-grade" style="height:', this.scoreColumnHeight, "px;margin-top:-2px;margin-left:", Q, 'px">', X.gradeHtml, "</div>")
  246.                 }
  247.                 O.push("</div>");
  248.                 O.push('<div class="x-clear"></div></div>', '<ul class="x-tree-node-ct" style="display:none;"></ul>', "</li>");
  249.                 if (Y !== true && P.nextSibling && P.nextSibling.ui.getEl()) {
  250.                     this.wrap = Ext.DomHelper.insertHtml("beforeBegin", P.nextSibling.ui.getEl(), O.join(""))
  251.                 }
  252.                 else {
  253.                     this.wrap = Ext.DomHelper.insertHtml("beforeEnd", T, O.join(""))
  254.                 }
  255.                 this.elNode = this.wrap.childNodes[0];
  256.                 this.ctNode = this.wrap.childNodes[1];
  257.                 var S = this.elNode.firstChild.childNodes;
  258.                 this.indentNode = S[0];
  259.                 this.ecNode = S[1];
  260.                 this.iconNode = S[2];
  261.                 this.anchor = S[3];
  262.                 this.textNode = S[3].firstChild;
  263.                 var b = Ext.get(this.elNode);
  264.                 b.on("mouseover", this.addHighlight.createDelegate(this, [this.elNode]));
  265.                 b.on("mouseout", this.removeHighlight.createDelegate(this, [this.elNode]))
  266.             },
  267.             addHighlight: function(P) {
  268.                 if (P.childNodes.length > 1) {
  269.                     var O = Ext.get(P.childNodes[1]);
  270.                     O.removeClass("color_light");
  271.                     O.addClass("x-tree-node-over")
  272.                 }
  273.             },
  274.             removeHighlight: function(P) {
  275.                 var O = Ext.get(P);
  276.                 O.removeClass("x-tree-node-over");
  277.                 if (P.childNodes.length > 1) {
  278.                     O = Ext.get(P.childNodes[1]);
  279.                     O.removeClass("x-tree-node-over");
  280.                     O.addClass("color_light")
  281.                 }
  282.             }
  283.         });
  284.         var D = 280;
  285.         var C = Ext.util.CSS.getRule(".course-tree-initial-width");
  286.         if (C) {
  287.             D = parseInt(C.style.width)
  288.         }
  289.         this.courseTree = new Ext.tree.TreePanel({
  290.             id: "course-tree_" + this.playerId,
  291.             region: "west",
  292.             split: true,
  293.             width: D > 0 ? D.constrain(175, 500) : 280,
  294.             minSize: 175,
  295.             maxSize: 500,
  296.             collapsible: true,
  297.             hidden: !this.showToc,
  298.             margins: "0 0 0 0",
  299.             cmargins: "0 0 0 0",
  300.             rootVisible: false,
  301.             useArrows: true,
  302.             lines: false,
  303.             autoScroll: this.autoScrollTree,
  304.             animCollapse: false,
  305.             animate: (false && (Ext.isIE)),
  306.             collapseMode: "mini",
  307.             cls: "color_light tree_control default_border course_tree course_tree_" + this.playerId,
  308.             bodyStyle: "overflow-y:scroll; overflow-x:hidden",
  309.             loader: new Ext.tree.TreeLoader({
  310.                 preloadChildren: true,
  311.                 clearOnLoad: false,
  312.                 baseAttrs: {
  313.                     uiProvider: playerColumnNodeUI
  314.                 }
  315.             }), columns: [
  316.                 {
  317.                     width: 200,
  318.                     dataIndex: "text"
  319.                 },
  320.                 {
  321.                     width: this.scoreColumnWidth,
  322.                     dataIndex: "score"
  323.                 }
  324.             ], tbar: [
  325.                 {
  326.                     text: this._Configure,
  327.                     icon: this.appRoot + "/Images/gear.png",
  328.                     hidden: this.isTeacher,
  329.                     cls: "player-options",
  330.                     menu: {
  331.                         cls: "player-options-menu",
  332.                         items: [
  333.                             {
  334.                                 hidden: false,
  335.                                 text: this._ShowScores,
  336.                                 cls: "show-scores-option",
  337.                                 iconCls: this.showScores ? "menu_check_image" : "",
  338.                                 scope: this,
  339.                                 handler: function() {
  340.                                     this.recordItemTimeSpent();
  341.                                     window.location = this.pageRoot + "?enrollmentid=" + this.enrollmentId + "&itemid=" + this.shortcutId + "&showscores=" + !this.showScores
  342.                                 }
  343.                             },
  344.                             {
  345.                                 disabled: !this.showExcusedCheckbox,
  346.                                 text: this.showExcusedString,
  347.                                 cls: "show-excused-option",
  348.                                 iconCls: (this.showExcused && this.showExcusedCheckbox) ? "menu_check_image" : "",
  349.                                 scope: this,
  350.                                 handler: function() {
  351.                                     this.recordItemTimeSpent();
  352.                                     window.location = this.pageRoot + "?enrollmentid=" + this.enrollmentId + "&itemid=" + this.shortcutId + "&showexcused=" + !this.showExcused
  353.                                 }
  354.                             }
  355.                         ]
  356.                     }
  357.                 },
  358.                 {
  359.                     xtype: "tbfill"
  360.                 },
  361.                 {
  362.                     tooltip: this.refreshString,
  363.                     icon: this.appRoot + "/Images/refresh.png",
  364.                     cls: "x-btn-icon",
  365.                     handler: function() {
  366.                         this.recordItemTimeSpent();
  367.                         var O = this.getChildNavigateAwayFunction();
  368.                         if (O) {
  369.                             O(this.navToItem.createDelegate(this, [this.shortcutId, true]))
  370.                         }
  371.                         else {
  372.                             this.navToItem(this.shortcutId, true)
  373.                         }
  374.                     },
  375.                     scope: this
  376.                 }
  377.             ], root: new Ext.tree.AsyncTreeNode({
  378.                 expanded: true,
  379.                 children: this.CourseItems
  380.             }), collapseFirst: false,
  381.             listeners: {
  382.                 resize: this.sizeTree,
  383.                 expandnode: this.sizeTree,
  384.                 collapsenode: this.sizeTree,
  385.                 expand: this.resizeContentFrame,
  386.                 collapse: this.resizeContentFrame,
  387.                 contextmenu: function(P, O) {
  388.                     O.stopEvent()
  389.                 },
  390.                 scope: this
  391.             }
  392.         });
  393.         this.courseTree.on("click", function(P, Q) {
  394.             var O = this.getChildNavigateAwayFunction();
  395.             this.skipSelectionChange = true;
  396.             this.navToItem(P.id);
  397.             Q.stopEvent();
  398.             if (O) {
  399.                 return false
  400.             }
  401.             else {
  402.                 this.navigateTreeToNode(P, true);
  403.                 return true
  404.             }
  405.         },
  406.         this);
  407.         this.courseTree.getSelectionModel().on("beforeselect", function(Q, O, P) {
  408.             this.navigateTreeToNode(O, true, null, true)
  409.         },
  410.         this);
  411.         this.courseTree.getSelectionModel().on("selectionchange", function(Q, O, P) {
  412.             if (this.skipSelectionChange) {
  413.                 this.skipSelectionChange = false
  414.             }
  415.             else {
  416.                 if (O.id != this.itemId) {
  417.                     this.navToItem(O.id)
  418.                 }
  419.             }
  420.         },
  421.         this, {
  422.             buffer: 1000
  423.         })
  424.     }
  425.     this.mainCourseContentPanel = new Ext.Panel({
  426.         region: "center",
  427.         contentEl: "content_" + this.playerId,
  428.         listeners: {
  429.             resize: this.resizeContentFrame,
  430.             scope: this
  431.         }
  432.     });
  433.     var H = [];
  434.     if (this.showAdornments) {
  435.         this.attachmentPanel = new Ext.Panel({
  436.             region: "south",
  437.             autoHeight: true,
  438.             forceLayout: true,
  439.             hidden: true,
  440.             cls: "default_border color_medium",
  441.             style: "padding:8px; border-right-width: 0px; border-left-width: 0px; border-bottom-width:0px; border-top-width:1px",
  442.             html: "&nbsp;",
  443.             listeners: {
  444.                 scope: this,
  445.                 show: {
  446.                     fn: function(P) {
  447.                         var O = P.el.select("a[class=attachment-link]");
  448.                         O.each(function(R, T, Q) {
  449.                             var S = R.getAttribute("downloadFile");
  450.                             R.on("click", function(U) {
  451.                                 U.stopEvent();
  452.                                 this.downloadFile(S)
  453.                             },
  454.                             this)
  455.                         },
  456.                         this)
  457.                     },
  458.                     delay: 500
  459.                 }
  460.             }
  461.         });
  462.         H.push(this.attachmentPanel)
  463.     }
  464.     H.push(this.mainCourseContentPanel);
  465.     var L = null;
  466.     if (this.showHeader) {
  467.         L = [];
  468.         L.push({
  469.             id: "comments_" + this.playerId,
  470.             text: this._InstructorNote,
  471.             icon: this.appRoot + "/Images/document_dirty.png",
  472.             cls: "x-btn-text-icon",
  473.             hidden: true,
  474.             scope: this,
  475.             handler: this.showComments
  476.         },
  477.         {
  478.             xtype: "label",
  479.             id: "content_status_" + this.playerId,
  480.             cls: "default_font",
  481.             style: "font-size:10pt;font-style:italic;padding-left:6px;",
  482.             text: ""
  483.         });
  484.         var A = (this.componentType != "contentplayer") && this.showRatings;
  485.         if (A) {
  486.             this.ratingsPanel = new RatingsPanel({
  487.                 hidden: true,
  488.                 _Rate1Star: this._Rate1Star,
  489.                 _RateNStars: this._RateNStars,
  490.                 _AverageRating: this._AverageRating,
  491.                 listeners: {
  492.                     scope: this,
  493.                     rated: function(O, P) {
  494.                         Ext.Ajax.request({
  495.                             url: this.appRoot + "/Learn/ScormData.ashx",
  496.                             params: {
  497.                                 action: "rateitem",
  498.                                 enrollmentid: this.enrollmentId,
  499.                                 itemid: this.lastLogicalId,
  500.                                 data: (P / 5)
  501.                             },
  502.                             scope: this,
  503.                             callback: function(S, T, R) {
  504.                                 var Q = null;
  505.                                 if (!Ext.isEmpty(R.responseText)) {
  506.                                     Q = Ext.util.JSON.decode(R.responseText)
  507.                                 }
  508.                                 if (!T || Q == null || Q.success != true) {
  509.                                     T = false
  510.                                 }
  511.                                 if (T) {
  512.                                     this.ratingsPanel.setRating(Q.rating * 5, Q.avgRating * 5)
  513.                                 }
  514.                             }
  515.                         })
  516.                     }
  517.                 }
  518.             });
  519.             L.push(this.ratingsPanel)
  520.         }
  521.         L.push("->");
  522.         var G = (false && this.componentType != "contentplayer");
  523.         if (G) {
  524.             L.push({
  525.                 tooltip: this._GetContentUrl,
  526.                 icon: this.appRoot + "/Images/link.png",
  527.                 cls: "x-btn-icon",
  528.                 handler: function() {
  529.                     var P = "ActivityPlayer";
  530.                     var O = this.absoluteFrameRoot + "/Component/" + P + "?enrollmentid=" + this.courseId + "&itemid=" + this.itemId;
  531.                     FRAME_API.fireEvent("jswindowopening");
  532.                     Ext.Msg.prompt(this._ContentUrlTitle, this._ContentUrlInstructions, function(R) {
  533.                         FRAME_API.fireEvent("jswindowclosed")
  534.                     },
  535.                     this, false, O);
  536.                     var Q = Ext.Msg.getDialog().el;
  537.                     Q = Q.child("input", true);
  538.                     Q.focus();
  539.                     Q.select()
  540.                 },
  541.                 scope: this
  542.             })
  543.         }
  544.         if (this.showAuthorLink && this.componentType != "contentplayer") {
  545.             L.push({
  546.                 xtype: "panel",
  547.                 html: '<a class="course_player_edit_item default_font hover_link" href="javascript:void(0)">' + Ext.util.Format.htmlEncode(this._Edit) + "</a>",
  548.                 listeners: {
  549.                     scope: this,
  550.                     afterrender: function(P) {
  551.                         var O = P.getEl().child('a[class*=course_player_edit_item"]');
  552.                         O.on("click", function(Q) {
  553.                             Q.stopEvent();
  554.                             this.editActivity()
  555.                         },
  556.                         this)
  557.                     }
  558.                 }
  559.             })
  560.         }
  561.         if (this.componentType == "courseplayer") {
  562.             if (this.showNavPrev) {
  563.                 L.push({
  564.                     xtype: "panel",
  565.                     html: '<div class="course_player_nav_prev" ext:qtip="' + this._Previous + '"></div>',
  566.                     listeners: {
  567.                         scope: this,
  568.                         afterrender: function(P) {
  569.                             var O = P.getEl().child('div[class*=course_player_nav_prev"]');
  570.                             O.on("click", this.navPrev, this)
  571.                         }
  572.                     }
  573.                 })
  574.             }
  575.             if (this.showNavNext) {
  576.                 L.push({
  577.                     xtype: "panel",
  578.                     html: '<div class="course_player_nav_next" ext:qtip="' + this._Next + '"></div>',
  579.                     listeners: {
  580.                         scope: this,
  581.                         afterrender: function(P) {
  582.                             var O = P.getEl().child('div[class*=course_player_nav_next"]');
  583.                             O.on("click", this.navNext, this)
  584.                         }
  585.                     }
  586.                 })
  587.             }
  588.         }
  589.     }
  590.     this.mainContentLayout = new Ext.Panel({
  591.         layout: "border",
  592.         region: "center",
  593.         cls: this.showToc ? "course-main-content default_border" : "",
  594.         items: H,
  595.         tbar: L
  596.     });
  597.     var J = [];
  598.     if (this.showToc) {
  599.         J.push(new Ext.Panel({
  600.             layout: "border",
  601.             region: "center",
  602.             items: [this.courseTree, this.mainContentLayout]
  603.         }))
  604.     }
  605.     else {
  606.         J.push(this.mainContentLayout)
  607.     }
  608.     if (this.showAdornments) {
  609.         J.push(new Ext.Panel({
  610.             border: false,
  611.             region: "south",
  612.             autoHeight: true,
  613.             contentEl: "footer_" + this.playerId
  614.         }))
  615.     }
  616.     this.viewport = new Ext.Panel({
  617.         renderTo: "player_" + this.playerId,
  618.         layout: "border",
  619.         items: J
  620.     });
  621.     this.resizePlayerContainer();
  622.     Ext.EventManager.onWindowResize(this.resizePlayerContainer, this);
  623.     if (this.showHeader) {
  624.         var I = this.mainContentLayout.getTopToolbar();
  625.         if (I) {
  626.             I.hide()
  627.         }
  628.     }
  629.     if (this.showAdornments) {
  630.         this.dropboxSurveyButton = new Ext.Button({
  631.             renderTo: "dropboxSurvey_" + this.playerId,
  632.             text: this.surveyButtonString,
  633.             handler: this.dropboxSurveyClick,
  634.             scope: this
  635.         });
  636.         this.dropboxRubricButton = new Ext.Button({
  637.             renderTo: "dropboxRubric_" + this.playerId,
  638.             text: this.rubricButtonString,
  639.             handler: this.dropboxRubricClick,
  640.             scope: this
  641.         });
  642.         this.dropboxCompletedButton = new Ext.Button({
  643.             renderTo: "dropboxCompleted_" + this.playerId,
  644.             text: this.completedButtonString,
  645.             handler: this.dropboxCompletedClick,
  646.             scope: this
  647.         });
  648.         this.dropboxDetailsButton = new Ext.Button({
  649.             renderTo: "dropboxDetails_" + this.playerId,
  650.             text: this.detailsButtonString,
  651.             handler: this.dropboxDetailsClick,
  652.             scope: this
  653.         });
  654.         this.dropboxSubmitButton = new Ext.Button({
  655.             renderTo: "dropboxSubmit_" + this.playerId,
  656.             text: this.submitButtonString,
  657.             handler: this.submitAssignment,
  658.             scope: this
  659.         });
  660.         this.dropboxOpenButton = new Ext.Button({
  661.             renderTo: "dropboxOpen_" + this.playerId,
  662.             text: this.openButtonString,
  663.             handler: this.openAssignment,
  664.             scope: this
  665.         });
  666.         this.dropboxOpenSplitButton = new Ext.SplitButton({
  667.             renderTo: "dropboxOpenSplit_" + this.playerId,
  668.             text: this.openButtonString,
  669.             handler: this.openAssignment,
  670.             scope: this,
  671.             menu: new Ext.menu.Menu({
  672.                 items: [
  673.                     {
  674.                         text: this.openLatestString,
  675.                         handler: this.openWipAssignment,
  676.                         scope: this,
  677.                         tooltip: this.openLatestTipString,
  678.                         listeners: {
  679.                             afterrender: this.menuItemAfterRender,
  680.                             scope: this
  681.                         }
  682.                     },
  683.                     {
  684.                         text: this.openSubmittedString,
  685.                         handler: this.openSubmittedAssignment,
  686.                         scope: this,
  687.                         tooltip: this.openSubmittedTipString,
  688.                         listeners: {
  689.                             afterrender: this.menuItemAfterRender,
  690.                             scope: this
  691.                         }
  692.                     },
  693.                     {
  694.                         text: this.openOriginalString,
  695.                         handler: this.openAssignmentTemplate,
  696.                         scope: this,
  697.                         tooltip: this.openOriginalTipString,
  698.                         listeners: {
  699.                             afterrender: this.menuItemAfterRender,
  700.                             scope: this
  701.                         }
  702.                     }
  703.                 ]
  704.             })
  705.         });
  706.         this.dropboxSaveProgressButton = new Ext.Button({
  707.             renderTo: "dropboxSaveProgress_" + this.playerId,
  708.             text: this.saveButtonString,
  709.             tooltip: this.saveProgressString + "<br/><b>" + this.saveNotSubmitString + "</b>",
  710.             handler: this.saveProgress,
  711.             scope: this
  712.         });
  713.         this.dropboxPeerReviewButton = new Ext.Button({
  714.             renderTo: "dropboxPeerReview_" + this.playerId,
  715.             text: this._ReviewPeers,
  716.             minWidth: 110,
  717.             handler: this.peerReviewClick,
  718.             scope: this
  719.         })
  720.     }
  721.     FRAME_API.addListener("viewgradedetails", this.dropboxDetailsClick, this);
  722.     this.prepareForNavigation();
  723.     this.playerInitialized = true;
  724.     if (this.needsItemInitialization) {
  725.         this.recordBookmark();
  726.         this.updateForNewItemInfo();
  727.         this.needsItemInitialization = false
  728.     }
  729.     if (this.needsTreeInitialization) {
  730.         this.navigateTreeToItem(this.shortcutId)
  731.     }
  732.     function N(O) {
  733.         this.closePopup = function(P) {
  734.             if (typeof P == "boolean") {
  735.                 P = {
  736.                     refreshAll: P
  737.                 }
  738.             }
  739.             O.closeWindows(!P.cancelled);
  740.             O.showMainContent()
  741.         }
  742.     }
  743.     this.playerAssemblyApi = new N(this);
  744.     this.version12 = false;
  745.     this.lastError = "0";
  746.     this.sessionState = ScormState.StateNotInitialized;
  747.     this.dataModel = new Ext.util.MixedCollection();
  748.     this.argOnTerminate = null;
  749.     this.requestOnTerminate = "";
  750.     this.dataInitialized = false;
  751.     this.needsResetData = false;
  752.     this.readOnly = false;
  753.     if (typeof(FRAME_API) != "undefined") {
  754.         this.pageRoot = FRAME_API.frameRoot + "/Component/" + this.componentType;
  755.         FRAME_API.setComponentState(this.componentType, this.playerId, {
  756.             courseId: this.courseId,
  757.             sectionId: this.sectionId,
  758.             enrollmentId: this.enrollmentId,
  759.             pageTitle: this.pageTitle || "",
  760.             subTitle1: this.courseTitle,
  761.             subTitle2: this.sectionTitle,
  762.             helpToken: "STUDENT_VIEW_COURSE"
  763.         });
  764.         var K = FRAME_API.findEnrollment(this.enrollmentId);
  765.         this.readOnly = true;
  766.         if (K && K.userId == FRAME_API.proxyUserId) {
  767.             this.readOnly = false
  768.         }
  769.         FRAME_API.addListener("jswindowopening", this.hideMainContent, this);
  770.         FRAME_API.addListener("jswindowclosed", this.showMainContent, this);
  771.         var M = function(P, R, Q, O) {
  772.             if (P == this.componentType && R == this.playerId) {
  773.                 this.navToItem(Q, false, O)
  774.             }
  775.         };
  776.         FRAME_API.addListener("navtoitem", M, this);
  777.         var F = function(O) {
  778.             this.closeWindows(!O.cancelled)
  779.         };
  780.         FRAME_API.addListener("editorclosed", F, this);
  781.         var B = function(O) {
  782.             this.closeWindows(O)
  783.         };
  784.         FRAME_API.addListener("closegroupsetupwindow", B, this);
  785.         Ext.EventManager.on(window, "unload", function() {
  786.             FRAME_API.removeListener("jswindowopening", this.hideMainContent, this);
  787.             FRAME_API.removeListener("jswindowclosed", this.showMainContent, this);
  788.             FRAME_API.removeListener("navtoitem", M, this);
  789.             FRAME_API.removeListener("editorclosed", F, this);
  790.             FRAME_API.removeListener("closegroupsetupwindow", B, this);
  791.             FRAME_API.removeListener("viewgradedetails", this.dropboxDetailsClick, this)
  792.         },
  793.         this)
  794.     }
  795.     window.onunload = this.onUnload.createDelegate(this)
  796. };
  797. Ext.extend(PlayerPanel, Ext.Panel, {
  798.     onUnload: function() {
  799.         this.recordItemTimeSpent(true);
  800.         window.onunload = null
  801.     },
  802.     updateRatings: function() {
  803.         if (this.ratingsPanel) {
  804.             var B = 0;
  805.             var A = 0;
  806.             if (this.itemInfo != null) {
  807.                 if (this.itemInfo.rating || this.itemInfo.avgRating) {
  808.                     B = this.itemInfo.rating;
  809.                     A = this.itemInfo.avgRating
  810.                 }
  811.             }
  812.             this.ratingsPanel.setRating(B * 5, A * 5)
  813.         }
  814.     },
  815.     showComments: function() {
  816.         var C = Ext.get(document.body).getSize();
  817.         var D = Math.min(C.height / 1.5, this.idealHeight);
  818.         var A = Math.min(C.width / 1.5, this.idealWidth);
  819.         var B = String.format("{0}/Editor/GetActivityHtml.ashx?wrapper=1&entityid={1}&courseid={1}&enrollmentid={2}&sectionid={3}&itemid={4}&path={5}", this.appRoot, Ext.isEmpty(this.itemInfo.resourceEntityId) ? this.courseId : this.itemInfo.resourceEntityId, this.enrollmentId, this.sectionId, this.itemId, encodeURIComponent(this.itemInfo.comments));
  820.         this.commentsWindow = new Ext.Window({
  821.             title: this._InstructorNote,
  822.             constrainHeader: true,
  823.             height: D,
  824.             width: A,
  825.             layout: "fit",
  826.             plain: true,
  827.             buttonAlign: "center",
  828.             items: [
  829.                 {
  830.                     html: '<iframe class="x-panel-body page_color default_font" style="width:100%;height:100%;overflow:auto;" frameborder="0" src="' + B + '" title="' + this._InstructorNoteFrame + '"></iframe>'
  831.                 }
  832.             ], shim: true,
  833.             modal: true,
  834.             frame: true,
  835.             closable: true,
  836.             closeAction: "close",
  837.             listeners: {
  838.                 close: function() {
  839.                     FRAME_API.fireEvent("jswindowclosed")
  840.                 },
  841.                 scope: this
  842.             }
  843.         });
  844.         FRAME_API.fireEvent("jswindowopening");
  845.         this.commentsWindow.show()
  846.     },
  847.     processResponse: function(request, options) {
  848.         var root = eval("(" + request.responseText + ")");
  849.         var newURL = "";
  850.         if (root != null) {
  851.             this.Log("processResponse: " + root.url);
  852.             if (root.url && root.url.length > 0) {
  853.                 frames["contentBody_" + this.playerId].location = root.url
  854.             }
  855.             else {
  856.                 if (root.status == "empty") {
  857.                     this.messageBoxHide();
  858.                     frames["contentBody_" + this.playerId].location = this.appRoot + "/Learn/MissingContent.aspx"
  859.                 }
  860.                 else {
  861.                     this.messageBoxHide();
  862.                     this.messageBoxAlertWithMinWidth(this.errorTitle, String.format(this.failedToLoadItemString, root.status, options.url))
  863.                 }
  864.             }
  865.             if (!Ext.isEmpty(root.id)) {
  866.                 this.navigateTreeToItem(root.id)
  867.             }
  868.         }
  869.         else {
  870.             this.messageBoxHide();
  871.             this.messageBoxAlertWithMinWidth(this.errorTitle, String.format(this.failedToLoadItemString, "invalid response", options.url))
  872.         }
  873.     },
  874.     failedRequest: function(A, B) {
  875.         if (A.status == 403) {
  876.             location.reload(true)
  877.         }
  878.         else {
  879.             this.messageBoxHide();
  880.             FRAME_API.fireEvent("jswindowopening");
  881.             Ext.MessageBox.alert(this.errorTitle, String.format(this.failedToLoadItemString, A.statusText + ":" + A.status, B.url), function() {
  882.                 FRAME_API.fireEvent("jswindowclosed")
  883.             })
  884.         }
  885.     },
  886.     sizeTree: function() {
  887.         if ((this.courseTree == null) || (this.courseTree.collapsed)) {
  888.             return
  889.         }
  890.         if (this.sizeTimer != null) {
  891.             clearInterval(this.sizeTimer);
  892.             this.sizeTimer = null
  893.         }
  894.         this.sizeTimer = this.doSizeTree.defer(50, this)
  895.     },
  896.     doSizeTree: function() {
  897.         if (this.sizeTimer != null) {
  898.             clearInterval(this.sizeTimer);
  899.             this.sizeTimer = null
  900.         }
  901.         if ((this.courseTree == null) || (this.courseTree.collapsed)) {
  902.             return
  903.         }
  904.         var A = Math.max(0, this.courseTree.innerCt.getSize().width);
  905.         var B = Math.max(0, A - this.scoreColumnWidth);
  906.         B = Math.max(0, B - 2);
  907.         this.firstColumnWidthStyle.style.width = B + "px";
  908.         this.allColumnsWidthStyle.style.width = A + "px";
  909.         this.resizeContentFrame()
  910.     },
  911.     getStylesOnPage: function() {
  912.         if (!document.styleSheets) {
  913.             return null
  914.         }
  915.         var A = [];
  916.         var G = document.styleSheets;
  917.         for (var E = G.length - 1; E >= 0; E--) {
  918.             var D = G[E];
  919.             var C = null;
  920.             if (D.cssRules) {
  921.                 C = D.cssRules
  922.             }
  923.             else {
  924.                 if (D.rules) {
  925.                     C = D.rules
  926.                 }
  927.             }
  928.             if (C != null) {
  929.                 for (var B = 0; B <= C.length; B++) {
  930.                     var F = C[B];
  931.                     if (F) {
  932.                         A.push(F)
  933.                     }
  934.                 }
  935.             }
  936.         }
  937.         return A
  938.     },
  939.     getLocalCSSRule: function(D) {
  940.         var A = this.getStylesOnPage();
  941.         if (!A) {
  942.             return
  943.         }
  944.         for (var C = 0; C < A.length; C++) {
  945.             var B = A[C];
  946.             if (B.selectorText == D) {
  947.                 return B
  948.             }
  949.         }
  950.     },
  951.     setupStyles: function() {
  952.         this.firstColumnWidthStyle = this.getLocalCSSRule(".course_tree_" + this.playerId + " .x-tree-col-first");
  953.         this.allColumnsWidthStyle = this.getLocalCSSRule(".course_tree_" + this.playerId + " .x-tree-node-el")
  954.     },
  955.     menuItemAfterRender: function(A) {
  956.         if (A.initialConfig.tooltip) {
  957.             A.tip = new Ext.ToolTip({
  958.                 target: A.getEl().getAttribute("id"),
  959.                 delegate: ".x-menu-item",
  960.                 renderTo: document.body,
  961.                 html: A.initialConfig.tooltip,
  962.                 trackMouse: true,
  963.                 anchor: "bottom"
  964.             })
  965.         }
  966.     },
  967.     resizePlayerContainer: function() {
  968.         var A = Ext.get("player_" + this.playerId);
  969.         if (A != null) {
  970.             this.viewport.setSize(A.getSize());
  971.             this.viewport.doLayout()
  972.         }
  973.     },
  974.     resizeContentFrame: function(C, A) {
  975.         var B = Ext.get("content_" + this.playerId);
  976.         var D = this.mainCourseContentPanel.body.dom;
  977.         if (B != null && D != null) {
  978.             var A = D.offsetHeight;
  979.             var C = D.offsetWidth;
  980.             B.setSize(C, A)
  981.         }
  982.     },
  983.     resizeContent: function() {
  984.         var A = document.getElementById("contentBody_" + this.playerId);
  985.         var B = null;
  986.         try {
  987.             B = A.contentWindow.document.getElementsByTagName("iframe")[0].contentWindow.forceResize
  988.         }
  989.         catch (C) {}
  990.         if (B) {
  991.             B()
  992.         }
  993.     },
  994.     getChildNavigateAwayFunction: function() {
  995.         var A = null;
  996.         try {
  997.             var C = frames["contentBody_" + this.playerId].frameElement.contentWindow;
  998.             if (C) {
  999.                 if (C.navigateAway) {
  1000.                     A = C.navigateAway
  1001.                 }
  1002.                 else {
  1003.                     if (C.frames.length > 0) {
  1004.                         for (var B = 0; B < C.frames.length; B++) {
  1005.                             A = C.frames[B].frameElement.contentWindow.navigateAway;
  1006.                             if (A) {
  1007.                                 break
  1008.                             }
  1009.                         }
  1010.                     }
  1011.                 }
  1012.             }
  1013.         }
  1014.         catch (D) {
  1015.             A = null
  1016.         }
  1017.         return A
  1018.     },
  1019.     prepareForNavigation: function() {
  1020.         if (!this.courseTree) {
  1021.             return
  1022.         }
  1023.         this.nodeLookup = {};
  1024.         this.createNodeLookup(this.courseTree.root.childNodes[0])
  1025.     },
  1026.     createNodeLookup: function(D) {
  1027.         this.nodeLookup[D.id] = D;
  1028.         var B = D.childNodes;
  1029.         for (var A = 0, C = B.length; A < C; A++) {
  1030.             this.createNodeLookup(B[A])
  1031.         }
  1032.     },
  1033.     findNode: function(E, F) {
  1034.         if (E.id == F) {
  1035.             return E
  1036.         }
  1037.         if (this.nodeLookup && (this.nodeLookup[F] != null)) {
  1038.             return this.nodeLookup[F]
  1039.         }
  1040.         var C = E.childNodes;
  1041.         for (var B = 0, D = C.length; B < D; B++) {
  1042.             var A = this.findNode(C[B], F);
  1043.             if (A != null) {
  1044.                 return A
  1045.             }
  1046.         }
  1047.         return null
  1048.     },
  1049.     navigateTreeToItem: function(D) {
  1050.         if (!this.courseTree || Ext.isEmpty(D)) {
  1051.             return
  1052.         }
  1053.         var B = this.findNode(this.courseTree.root, D);
  1054.         if (!B) {
  1055.             var C = "_STUB";
  1056.             var A = D.length - C.length;
  1057.             if (A >= 0 && D.lastIndexOf(C) === A) {
  1058.                 D = D.substring(0, A)
  1059.             }
  1060.             B = this.findNode(this.courseTree.root, D);
  1061.             if (!B) {
  1062.                 return
  1063.             }
  1064.         }
  1065.         this.navigateTreeToNode(B)
  1066.     },
  1067.     navigateTreeToNode: function(A, C, I, D) {
  1068.         var H = this.courseTree.getSelectionModel();
  1069.         var B = H.getSelectedNode();
  1070.         if (B != null) {
  1071.             var F = B.getUI();
  1072.             var J = F.getAnchor();
  1073.             var G = J.parentNode.parentNode;
  1074.             if (G.childNodes.length > 1) {
  1075.                 var E = Ext.get(G.childNodes[1]);
  1076.                 E.removeClass("x-tree-selected");
  1077.                 E.addClass("color_light")
  1078.             }
  1079.         }
  1080.         if (!C && !A.isSelected()) {
  1081.             A.ensureVisible()
  1082.         }
  1083.         if (!D && !A.isSelected()) {
  1084.             A.select()
  1085.         }
  1086.         if (A.expanded) {
  1087.             if (I) {
  1088.                 I()
  1089.             }
  1090.         }
  1091.         else {
  1092.             A.expand(false, false, I)
  1093.         }
  1094.         this.courseTree.getTreeEl().dom.scrollLeft = 0;
  1095.         var F = A.getUI();
  1096.         var J = F.getAnchor();
  1097.         var G = J.parentNode.parentNode;
  1098.         if (G.childNodes.length > 1) {
  1099.             var E = Ext.get(G.childNodes[1]);
  1100.             E.addClass("x-tree-selected");
  1101.             E.removeClass("color_light")
  1102.         }
  1103.     },
  1104.     showLoadingMessageBox: function() {}, sendNavigationRequest: function(B) {
  1105.         var A = this.getChildNavigateAwayFunction();
  1106.         if (A) {
  1107.             A(this.sendNavigationRequestHelper.createDelegate(this, [B]), this.sendNavigationRequestCancel.createDelegate(this));
  1108.             return
  1109.         }
  1110.         this.sendNavigationRequestHelper(B)
  1111.     },
  1112.     sendNavigationRequestCancel: function() {
  1113.         if (this.showToc) {
  1114.             var A = this.findNode(this.courseTree.root, this.itemId);
  1115.             this.navigateTreeToNode(A, true)
  1116.         }
  1117.     },
  1118.     sendNavigationRequestHelper: function(A) {
  1119.         this.messageBoxShouldBeClosed = false;
  1120.         this.showLoadingMessageBox.defer(1000, this);
  1121.         Ext.Ajax.request({
  1122.             url: A,
  1123.             success: this.processResponse,
  1124.             failure: this.failedRequest,
  1125.             scope: this
  1126.         })
  1127.     },
  1128.     messageBoxHide: function() {
  1129.         this.messageBoxShouldBeClosed = true;
  1130.         FRAME_API.fireEvent("jswindowclosed");
  1131.         Ext.MessageBox.hide()
  1132.     },
  1133.     messageBoxHidden: function() {
  1134.         FRAME_API.fireEvent("jswindowclosed");
  1135.         var A = Ext.MessageBox.getDialog();
  1136.         A.un("move", this.testAndCloseDialog, this);
  1137.         A.un("hide", this.messageBoxHidden, this)
  1138.     },
  1139.     testAndCloseDialog: function() {
  1140.         if (this.messageBoxShouldBeClosed) {
  1141.             this.messageBoxHide()
  1142.         }
  1143.     },
  1144.     resetDropbox: function() {
  1145.         var A = document.getElementById("dropboxStatusAndButtons_" + this.playerId);
  1146.         if (this.ensureHidden(A)) {
  1147.             this.viewport.syncSize()
  1148.         }
  1149.         if (this.assignmentForm != null) {
  1150.             this.assignmentWindow.remove(this.assignmentForm, true);
  1151.             this.assignmentForm = null;
  1152.             if (Ext.isIE) {
  1153.                 document.body.focus()
  1154.             }
  1155.         }
  1156.         if (this.attachmentPanel) {
  1157.             this.attachmentPanel.hide()
  1158.         }
  1159.         this.mainContentLayout.doLayout();
  1160.         this.resizeContentFrame()
  1161.     },
  1162.     show: function(B, A) {
  1163.         if (A) {
  1164.             return this.ensureVisible(B)
  1165.         }
  1166.         return this.ensureHidden(B)
  1167.     },
  1168.     ensureVisible: function(A) {
  1169.         if (A != null && A.style.display != "") {
  1170.             A.style.display = "";
  1171.             return true
  1172.         }
  1173.         return false
  1174.     },
  1175.     ensureHidden: function(A) {
  1176.         if (A != null && A.style.display != "none") {
  1177.             A.style.display = "none";
  1178.             return true
  1179.         }
  1180.         return false
  1181.     },
  1182.     ensureClassName: function(B, A) {
  1183.         if (B.className != A) {
  1184.             B.className = A;
  1185.             return true
  1186.         }
  1187.         return false
  1188.     },
  1189.     closeWindows: function(A) {
  1190.         if (this.rubricWindow && this.rubricWindow.isVisible()) {
  1191.             this.rubricWindow.hide()
  1192.         }
  1193.         if (this.detailsWindow && this.detailsWindow.isVisible()) {
  1194.             this.detailsWindow.hide()
  1195.         }
  1196.         if (this.assignmentWindow && this.assignmentWindow.isVisible()) {
  1197.             this.assignmentWindow.hide()
  1198.         }
  1199.         if (this.peerReviewWindow && this.peerReviewPanel.isVisible()) {
  1200.             this.peerReviewWindow.hide()
  1201.         }
  1202.         if ((this.configureGroupSetupWindow != null) && (!this.configureGroupSetupWindow.hidden)) {
  1203.             this.configureGroupSetupWindow.hide();
  1204.             Ext.EventManager.removeResizeListener(this.resizeConfigureGroupSetupWindow, this)
  1205.         }
  1206.         if (A == true) {
  1207.             this.navToItem(this.shortcutId)
  1208.         }
  1209.     },
  1210.     configureGroupSetup: function(C) {
  1211.         this.closeWindows();
  1212.         if (this.itemId == null) {
  1213.             return
  1214.         }
  1215.         var B = Ext.get(document.body).getSize();
  1216.         if (this.configureGroupSetupWindow == null) {
  1217.             this.configureGroupSetupWindow = new Ext.Window({
  1218.                 width: B.width - 64,
  1219.                 height: B.height - 64,
  1220.                 layout: "fit",
  1221.                 plain: false,
  1222.                 buttonAlign: "center",
  1223.                 shim: true,
  1224.                 x: 32,
  1225.                 y: 32,
  1226.                 modal: true,
  1227.                 frame: true,
  1228.                 closable: false,
  1229.                 closeAction: "hide",
  1230.                 resizable: true,
  1231.                 draggable: true,
  1232.                 listeners: {
  1233.                     hide: function() {
  1234.                         FRAME_API.fireEvent("jswindowclosed")
  1235.                     },
  1236.                     scope: this
  1237.                 }
  1238.             })
  1239.         }
  1240.         else {
  1241.             this.configureGroupSetupWindow.remove(this.configureGroupSetupArea)
  1242.         }
  1243.         var A = this.appRoot + "/Component/GroupSetup?enrollmentid=" + C + "&itemid=" + encodeURIComponent(this.itemId);
  1244.         this.configureGroupSetupArea = new Ext.Panel({
  1245.             xtype: "panel",
  1246.             layout: "fit",
  1247.             monitorResize: true,
  1248.             id: "configureGroupSetupArea_" + this.playerId,
  1249.             html: '<iframe class="x-panel-body page_color default_font" style="width:100%;height:100%;" frameborder="0" src="' + A + '"></iframe>'
  1250.         });
  1251.         this.configureGroupSetupWindow.add(this.configureGroupSetupArea);
  1252.         this.configureGroupSetupWindow.setTitle(this.groupSetupString);
  1253.         FRAME_API.fireEvent("jswindowopening");
  1254.         this.configureGroupSetupWindow.show();
  1255.         this.resizeConfigureGroupSetupWindow();
  1256.         Ext.EventManager.onWindowResize(this.resizeConfigureGroupSetupWindow, this)
  1257.     },
  1258.     resizeConfigureGroupSetupWindow: function() {
  1259.         if (this.configureGroupSetupWindow == null) {
  1260.             return
  1261.         }
  1262.         if (this.configureGroupSetupWindow.hidden) {
  1263.             return
  1264.         }
  1265.         var A = Ext.get(document.body).getSize();
  1266.         this.configureGroupSetupWindow.setSize(A.width - 64, A.height - 64)
  1267.     },
  1268.     dropboxSurveyClick: function() {
  1269.         if (this.itemInfo == null || this.itemInfo.surveyUrl == null) {
  1270.             return
  1271.         }
  1272.         window.open(this.itemInfo.surveyUrl)
  1273.     },
  1274.     dropboxRubricClick: function() {
  1275.         if (this.rubricPanel == null) {
  1276.             this.rubricPanel = new Ext.Panel({
  1277.                 header: false,
  1278.                 autoScroll: true,
  1279.                 cls: "color_light",
  1280.                 buttons: [
  1281.                     {
  1282.                         xtype: "tbfill"
  1283.                     },
  1284.                     {
  1285.                         text: this.closeString,
  1286.                         handler: this.closeWindows,
  1287.                         scope: this
  1288.                     }
  1289.                 ]
  1290.             });
  1291.             this.rubricPanel.on("render", function() {
  1292.                 this.loadRubric()
  1293.             },
  1294.             this, {
  1295.                 delay: 50
  1296.             })
  1297.         }
  1298.         else {
  1299.             this.loadRubric()
  1300.         }
  1301.         if (this.rubricWindow == null) {
  1302.             var B = Ext.get(document.body).getSize();
  1303.             var C = Math.min(B.height / 1.5, this.idealHeight);
  1304.             var A = Math.min(B.width / 1.5, this.idealWidth);
  1305.             this.rubricWindow = new Ext.Window({
  1306.                 constrainHeader: true,
  1307.                 height: C,
  1308.                 width: A,
  1309.                 layout: "fit",
  1310.                 plain: true,
  1311.                 buttonAlign: "center",
  1312.                 items: [this.rubricPanel],
  1313.                 shim: true,
  1314.                 modal: true,
  1315.                 frame: true,
  1316.                 closable: true,
  1317.                 closeAction: "hide",
  1318.                 listeners: {
  1319.                     hide: function() {
  1320.                         FRAME_API.fireEvent("jswindowclosed")
  1321.                     },
  1322.                     scope: this
  1323.                 }
  1324.             })
  1325.         }
  1326.         FRAME_API.fireEvent("jswindowopening");
  1327.         this.rubricWindow.show()
  1328.     },
  1329.     loadRubric: function() {
  1330.         if (!this.rubricPanel) {
  1331.             return
  1332.         }
  1333.         this.rubricPanel.body.load({
  1334.             url: this.appRoot + "/Content/Dropbox/RubricDetails.ashx?" + Ext.urlEncode({
  1335.                 courseid: this.courseId,
  1336.                 enrollmentid: this.enrollmentId,
  1337.                 sectionid: this.sectionId,
  1338.                 itemid: this.itemId
  1339.             }), text: this.loadingMessage,
  1340.             callback: this.rubricLoadingFinished,
  1341.             scope: this
  1342.         })
  1343.     },
  1344.     rubricLoadingFinished: function(B, C) {
  1345.         if (!C) {
  1346.             var D = this.failedLoadingRubricString;
  1347.             D += " &nbsp;<a class='load-rubric' href='javascript:void(0)'>";
  1348.             D += this.clickToRetryString;
  1349.             D += "</a>";
  1350.             B.dom.innerHTML = D;
  1351.             var A = B.child("a[class=load-rubric]");
  1352.             A.on("click", this.loadRubric, this)
  1353.         }
  1354.         this.rubricPanel.footer.addClass("color_medium default_border dashboard_list_btns")
  1355.     },
  1356.     dropboxCompletedClick: function() {
  1357.         Ext.Ajax.request({
  1358.             url: this.appRoot + "/Content/Assignment.ashx",
  1359.             silent: true,
  1360.             params: {
  1361.                 actiontype: "complete",
  1362.                 enrollmentid: this.enrollmentId,
  1363.                 itemid: this.itemInfo.id
  1364.             },
  1365.             success: function(B, A) {
  1366.                 this.recordItemTimeSpent();
  1367.                 this.successUpdate(B, A)
  1368.             },
  1369.             failure: this.failureUpdate,
  1370.             scope: this
  1371.         })
  1372.     },
  1373.     dropboxDetailsClick: function() {
  1374.         if (this.detailsPanel == null) {
  1375.             this.detailsPanel = new Ext.Panel({
  1376.                 header: false,
  1377.                 layout: "fit",
  1378.                 cls: "color_light"
  1379.             });
  1380.             this.detailsPanel.on("render", function() {
  1381.                 this.loadGradingDetails()
  1382.             },
  1383.             this)
  1384.         }
  1385.         else {
  1386.             this.loadGradingDetails()
  1387.         }
  1388.         if (this.detailsWindow == null) {
  1389.             var B = Ext.get(document.body).getSize();
  1390.             var C = Math.min(B.height / 1.5, this.idealHeight);
  1391.             var A = Math.min(B.width / 1.5, this.idealWidth);
  1392.             this.detailsWindow = new Ext.Window({
  1393.                 constrainHeader: true,
  1394.                 height: C,
  1395.                 width: A,
  1396.                 layout: "fit",
  1397.                 plain: true,
  1398.                 buttonAlign: "center",
  1399.                 items: [this.detailsPanel],
  1400.                 modal: true,
  1401.                 frame: true,
  1402.                 closable: true,
  1403.                 closeAction: "hide",
  1404.                 listeners: {
  1405.                     hide: function() {
  1406.                         FRAME_API.fireEvent("jswindowclosed")
  1407.                     },
  1408.                     scope: this
  1409.                 }
  1410.             })
  1411.         }
  1412.         FRAME_API.fireEvent("jswindowopening");
  1413.         this.detailsWindow.show()
  1414.     },
  1415.     loadGradingDetails: function() {
  1416.         if (!this.detailsPanel) {
  1417.             return
  1418.         }
  1419.         if (!this.itemId) {
  1420.             return
  1421.         }
  1422.         var B = false;
  1423.         var A = FRAME_API.findEnrollment(this.enrollmentId);
  1424.         if (A && A.isTestStudent) {
  1425.             B = true
  1426.         }
  1427.         this.detailsPanel.body.load({
  1428.             url: this.appRoot + "/Gradebook/Grade.aspx?" + Ext.urlEncode({
  1429.                 courseid: this.courseId,
  1430.                 sectionid: this.sectionId,
  1431.                 enrollmentid: this.enrollmentId,
  1432.                 itemid: this.itemId,
  1433.                 list: "studentdropbox",
  1434.                 readonly: B,
  1435.                 linktoitem: false,
  1436.                 peerreview: false
  1437.             }), text: this.loadingMessage,
  1438.             scripts: true,
  1439.             callback: this.finishDetailsClick,
  1440.             scope: this
  1441.         })
  1442.     },
  1443.     peerReviewClick: function() {
  1444.         if (this.detailsPanel) {
  1445.             var A = this.detailsPanel;
  1446.             if (A.items) {
  1447.                 while (A.items.length > 0) {
  1448.                     A.remove(A.items.items[0])
  1449.                 }
  1450.             }
  1451.         }
  1452.         if (this.peerReviewPanel == null) {
  1453.             this.peerReviewPanel = new Ext.Panel({
  1454.                 id: "peerReviewContainer_" + this.playerId,
  1455.                 header: false,
  1456.                 layout: "fit",
  1457.                 cls: "color_light"
  1458.             });
  1459.             this.peerReviewPanel.on("render", function() {
  1460.                 this.loadPeerReviewContent()
  1461.             },
  1462.             this);
  1463.             this.peerReviewPanel.on("resize", function(E, I, H) {
  1464.                 var F = Ext.get("mainPeerReviewPanel");
  1465.                 if (F) {
  1466.                     F.setSize(I, H)
  1467.                 }
  1468.                 var G = Ext.getCmp("peerReviewBodyPanel");
  1469.                 if (G) {
  1470.                     G.setSize(I, H);
  1471.                     G.doLayout(false, true)
  1472.                 }
  1473.             },
  1474.             this)
  1475.         }
  1476.         else {
  1477.             this.loadPeerReviewContent()
  1478.         }
  1479.         if (this.peerReviewWindow == null) {
  1480.             var C = Ext.get(document.body).getSize();
  1481.             var D = Math.min(C.height / 1.1, this.idealHeight);
  1482.             var B = Math.min(C.width / 1.1, this.idealWidth);
  1483.             this.peerReviewWindow = new Ext.Window({
  1484.                 id: "peerReviewWindow_" + this.playerId,
  1485.                 constrainHeader: true,
  1486.                 height: D,
  1487.                 width: B,
  1488.                 layout: "fit",
  1489.                 plain: true,
  1490.                 items: [this.peerReviewPanel],
  1491.                 modal: true,
  1492.                 frame: true,
  1493.                 title: this._ReviewPeers,
  1494.                 resizable: true,
  1495.                 closable: true,
  1496.                 closeAction: "hide",
  1497.                 manager: Ext.WindowMgr,
  1498.                 listeners: {
  1499.                     hide: function() {
  1500.                         FRAME_API.fireEvent("jswindowclosed");
  1501.                         var E = Ext.getCmp("peerReviewBodyPanel");
  1502.                         if (E) {
  1503.                             E.destroy()
  1504.                         }
  1505.                     },
  1506.                     scope: this
  1507.                 }
  1508.             })
  1509.         }
  1510.         FRAME_API.fireEvent("jswindowopening");
  1511.         this.peerReviewWindow.show()
  1512.     },
  1513.     loadPeerReviewContent: function() {
  1514.         if (!this.peerReviewPanel) {
  1515.             return
  1516.         }
  1517.         if (!this.itemId) {
  1518.             return
  1519.         }
  1520.         this.peerReviewPanel.body.load({
  1521.             url: this.appRoot + "/Gradebook/PeerReview.aspx?" + Ext.urlEncode({
  1522.                 courseid: this.courseId,
  1523.                 sectionid: this.sectionId,
  1524.                 enrollmentid: this.enrollmentId,
  1525.                 itemid: this.itemId,
  1526.                 list: "student",
  1527.                 linktoitem: false,
  1528.                 playerid: this.playerId
  1529.             }), text: this.loadingMessage,
  1530.             scripts: true,
  1531.             callback: this.finishPeerReviewClick,
  1532.             scope: this
  1533.         })
  1534.     },
  1535.     finishPeerReviewClick: function(B, C) {
  1536.         if (!C) {
  1537.             var D = this.failedLoadingPeerReviewListString;
  1538.             D += " &nbsp;<a class='lanuch-peer-review-list' href='javascript:void(0)'>";
  1539.             D += this.clickToRetryString;
  1540.             D += "</a>";
  1541.             B.dom.innerHTML = D;
  1542.             var A = B.child("a[class=lanuch-peer-review-list]");
  1543.             A.on("click", this.loadPeerReviewContent, this);
  1544.             return
  1545.         }
  1546.     },
  1547.     setItem: function(A) {
  1548.         this.itemCurrentlyGrading = A
  1549.     },
  1550.     getItem: function() {
  1551.         return this.itemCurrentlyGrading
  1552.     },
  1553.     saveItem: function() {}, setItemPanel: function(B) {
  1554.         var A = this.detailsPanel;
  1555.         if (A) {
  1556.             if (A.items) {
  1557.                 while (A.items.length > 0) {
  1558.                     A.remove(A.items.items[0])
  1559.                 }
  1560.             }
  1561.             A.add(B);
  1562.             A.doLayout();
  1563.             this.itemCurrentlyGrading.focus()
  1564.         }
  1565.     },
  1566.     closeItem: function() {
  1567.         this.closeWindows()
  1568.     },
  1569.     itemSaving: function(A) {
  1570.         return null
  1571.     },
  1572.     itemSaved: function(A) {}, finishDetailsClick: function(B, C) {
  1573.         if (!C) {
  1574.             var D = this.failedLoadingGradeDetailsString;
  1575.             D += " &nbsp;<a class='load-grading-details' href='javascript:void(0)'>";
  1576.             D += this.clickToRetryString;
  1577.             D += "</a>";
  1578.             B.dom.innerHTML = D;
  1579.             var A = B.child("a[class=load-grading-details]");
  1580.             A.on("click", this.loadGradingDetails, this);
  1581.             return
  1582.         }
  1583.     },
  1584.     submitAssignment: function() {
  1585.         if (!this.itemInfo) {
  1586.             return
  1587.         }
  1588.         if (this.itemInfo.templateName) {
  1589.             this.submitTemplatedAssignment()
  1590.         }
  1591.         else {
  1592.             var C = Ext.getCmp("attachedUrl_" + this.playerId);
  1593.             if (C != null) {
  1594.                 if (!this.validateSiteAddress(C.getValue())) {
  1595.                     return
  1596.                 }
  1597.             }
  1598.             var A = Ext.get("fileInput_" + this.playerId);
  1599.             if (A != null) {
  1600.                 var B = A.child("input[@type=file]", true);
  1601.                 if (!Ext.isEmpty(B) && !Ext.isEmpty(B.value) && this.isProhib(B.value)) {
  1602.                     return
  1603.                 }
  1604.             }
  1605.             FRAME_API.fireEvent("jswindowopening");
  1606.             Ext.MessageBox.confirm(this.itemInfo.title, this.confirmSubmitAssignmentText, function(D) {
  1607.                 FRAME_API.fireEvent("jswindowclosed");
  1608.                 if (D == "yes") {
  1609.                     if (this.itemInfo.externalLink) {
  1610.                         Ext.Ajax.request({
  1611.                             url: this.appRoot + "/Content/Assignment.ashx",
  1612.                             success: this.successUpdate,
  1613.                             failure: this.failureUpdate,
  1614.                             params: {
  1615.                                 actiontype: "submit",
  1616.                                 enrollmentid: this.enrollmentId,
  1617.                                 itemid: this.itemInfo.id
  1618.                             },
  1619.                             scope: this
  1620.                         })
  1621.                     }
  1622.                     else {
  1623.                         var E = Ext.getCmp("notes_" + this.playerId);
  1624.                         E.syncValue();
  1625.                         document.getElementById("actiontype_" + this.playerId).value = "submit";
  1626.                         this.messageBoxShouldBeClosed = false;
  1627.                         this.showUploadingMessageBox(this.submittingYourAssignmentString, this.submittingDotDotDotString);
  1628.                         Ext.Ajax.request({
  1629.                             url: this.appRoot + "/Content/Assignment.ashx",
  1630.                             success: this.successUpdate,
  1631.                             failure: this.failureUpdate,
  1632.                             form: this.assignmentForm.getForm().getEl().dom,
  1633.                             method: "POST",
  1634.                             isUpload: true,
  1635.                             scope: this
  1636.                         })
  1637.                     }
  1638.                 }
  1639.             },
  1640.             this)
  1641.         }
  1642.     },
  1643.     submitTemplatedAssignment: function() {
  1644.         var D = "";
  1645.         var C = "";
  1646.         if (this.itemInfo.wipFileDisplay) {
  1647.             D = this.itemInfo.wipFileDisplay;
  1648.             C = this.itemInfo.wipDate
  1649.         }
  1650.         if (D) {
  1651.             var B = "<a href='javascript:void(0);' id='wipFileName_" + this.playerId + "'>" + D + "</a>";
  1652.             var A = '<div style="display:none;"><form id="submitTemplatedAssignmentForm_' + this.playerId + '" action="' + this.appRoot + '/Content/Assignment.ashx" enctype="multipart/form-data"><input type="hidden" id="actiontype_' + this.playerId + '" name="actiontype" value="submit" /><input type="hidden" name="enrollmentid" value="' + this.enrollmentId + '" /><input type="hidden" id="itemid_' + this.playerId + '" name="itemid" value="' + this.itemId + "\" /><input name='useWipFile' id='useWipFile_" + this.playerId + "' type='hidden' /></form></div>";
  1653.             if (C) {
  1654.                 A += String.format(this.wantToSubmitWithDateString, B, C)
  1655.             }
  1656.             else {
  1657.                 A += String.format(this.wantToSubmitString, B)
  1658.             }
  1659.             Ext.MessageBox.getDialog().on("show", this.onShowSubmitDialog, this);
  1660.             FRAME_API.fireEvent("jswindowopening");
  1661.             Ext.MessageBox.show({
  1662.                 title: this.itemInfo.title,
  1663.                 msg: A,
  1664.                 buttons: Ext.MessageBox.YESNOCANCEL,
  1665.                 icon: Ext.MessageBox.QUESTION,
  1666.                 scope: this,
  1667.                 fn: function(E) {
  1668.                     FRAME_API.fireEvent("jswindowclosed");
  1669.                     if (E == "yes") {
  1670.                         var F = document.getElementById("useWipFile_" + this.playerId);
  1671.                         F.value = "y";
  1672.                         this.submitTemplatedAssignmentButtonClick("ok")
  1673.                     }
  1674.                     else {
  1675.                         if (E == "no") {
  1676.                             this.submitTemplatedAssignmentHelper()
  1677.                         }
  1678.                     }
  1679.                 }
  1680.             })
  1681.         }
  1682.         else {
  1683.             this.submitTemplatedAssignmentHelper()
  1684.         }
  1685.     },
  1686.     onShowSubmitDialog: function(A) {
  1687.         A.un("show", this.onShowSubmitDialog, this);
  1688.         (function() {
  1689.             var B = A.el.child("a[id=wipFileName_" + this.playerId + "]");
  1690.             B.on("click", this.openWipOrSubmittedAssignment, this)
  1691.         }).defer(500, this)
  1692.     },
  1693.     submitTemplatedAssignmentHelper: function() {
  1694.         var D = String.format(this.submitAssignmentText, this.itemInfo.templateName);
  1695.         var A = D + '<br/><br/><form id="submitTemplatedAssignmentForm_' + this.playerId + '" action="' + this.appRoot + '/Content/Assignment.ashx" enctype="multipart/form-data"><div style="display:none;"><input type="hidden" id="actiontype_' + this.playerId + '" name="actiontype" value="submit" /><input type="hidden" name="enrollmentid" value="' + this.enrollmentId + '" /><input type="hidden" id="itemid_' + this.playerId + '" name="itemid" value="' + this.itemId + "\" /><input name='useWipFile' id='useWipFile_" + this.playerId + "' type='hidden' /></div><input name=\"fileUpload\" id=\"fileUpload_" + this.playerId + '" type="file" style="width:350px;"  onkeyup="return false;" onkeydown="return false;" onkeypress="return false;"/><br/>';
  1696.         A += "</form>";
  1697.         try {
  1698.             Ext.MessageBox.updateText("")
  1699.         }
  1700.         catch (C) {}
  1701.         var B = Math.min(600, this.getLabelWidth(D));
  1702.         FRAME_API.fireEvent("jswindowopening");
  1703.         Ext.MessageBox.show({
  1704.             title: this.submitAssignmentTitle,
  1705.             msg: A,
  1706.             buttons: Ext.MessageBox.OKCANCEL,
  1707.             fn: this.submitTemplatedAssignmentButtonClick,
  1708.             scope: this,
  1709.             icon: Ext.MessageBox.QUESTION,
  1710.             minWidth: B
  1711.         });
  1712.         Ext.MessageBox.getDialog().on("beforehide", this.returnFalse, this)
  1713.     },
  1714.     getFileExtension: function(B) {
  1715.         var A = B.replace(/.*\./, ".");
  1716.         return A.toLowerCase()
  1717.     },
  1718.     isProhib: function(A) {
  1719.         if (!Ext.isEmpty(this.prohibitedExts) && !Ext.isEmpty(A)) {
  1720.             if (A.indexOf(".") >= 0) {
  1721.                 var B = A.substr(A.lastIndexOf(".")).toLowerCase();
  1722.                 if (this.prohibitedExts.indexOf(B) >= 0) {
  1723.                     Ext.Msg.alert(this.errorTitle, String.format(this._SubmitProhibitedFileType, B));
  1724.                     return true
  1725.                 }
  1726.             }
  1727.         }
  1728.         return false
  1729.     },
  1730.     submitTemplatedAssignmentButtonClick: function(E) {
  1731.         FRAME_API.fireEvent("jswindowclosed");
  1732.         Ext.MessageBox.getDialog().un("beforehide", this.returnFalse, this);
  1733.         if (E == "ok") {
  1734.             var C = document.getElementById("fileUpload_" + this.playerId);
  1735.             var A = document.getElementById("useWipFile_" + this.playerId);
  1736.             if (!A || !A.value) {
  1737.                 var F = C.value;
  1738.                 if (!F) {
  1739.                     FRAME_API.fireEvent("jswindowopening");
  1740.                     Ext.MessageBox.alert(this.errorTitle, this.submitBlankAssignmentTypeText, function() {
  1741.                         FRAME_API.fireEvent("jswindowclosed")
  1742.                     });
  1743.                     return
  1744.                 }
  1745.                 F = F.replace(/.*\//, "");
  1746.                 F = F.replace(/.*\\/,"");if(this.isProhib(F)){return }var D=this.getFileExtension(this.itemInfo.templateName);var B=this.getFileExtension(F);if(B!=D){this.messageBoxAlertWithMinWidth(this.errorTitle,String.format(this.submitWrongAssignmentTypeText,D,B));return }}Ext.Ajax.request({url:this.appRoot+"/Content / Assignment.ashx ",success:this.successUpdate,failure:this.failureUpdate,scope:this,form:" submitTemplatedAssignmentForm_ "+this.playerId,method:" POST ",isUpload:true});this.messageBoxShouldBeClosed=false;this.showUploadingMessageBox(this.submittingYourAssignmentString,this.submittingDotDotDotString)}else{this.messageBoxHide()}},successUpdate:function(B,A){if(B.responseText!=" success "){this.failureUpdate(B,A);return }Ext.Ajax.request({url:this.appRoot+" / Learn / GetItemInfo.ashx ",originalOptions:A,params:{enrollmentid:this.enrollmentId,itemid:this.itemId},scope:this,failure:this.failureUpdate,success:function(G,O){O=O.originalOptions;this.messageBoxHide();var M=G.responseText;try{this.itemInfo=Ext.util.JSON.decode(M)}catch(L){this.failureUpdate(G,O);return }if(O.saveProgress){this.messageBoxAlertWithMinWidth(this.savedAssignmentTitle,O.successDisplayString?O.successDisplayString:this.savedAssignmentText,null,Ext.MessageBox.INFO)}else{this.closeWindows();if(!O.silent){this.messageBoxAlertWithMinWidth(this.submittedAssignmentTitle,this.submittedAssignmentText,null,Ext.MessageBox.INFO)}}this.updateForNewItemInfo();if(this.assignmentForm!=null){var D=document.getElementById(" wipFileDeleteFlag_ "+this.playerId);if(D!=null){D.value=" "}D=document.getElementById(" wipFileDelete_ "+this.playerId);if(D!=null){D.style.visibility=" visible "}var J=Ext.getCmp(" attachedUrl_ "+this.playerId);if(J!=null){if(this.itemInfo.wipUrl){J.setValue(this.itemInfo.wipUrl)}else{if(this.itemInfo.submittedUrl){J.setValue(this.itemInfo.submittedUrl)}else{J.setValue(" ")}}}var K=Ext.getCmp(" notes_ "+this.playerId);var N=Ext.getCmp(" lastpackage_ "+this.playerId);if(this.itemInfo.wipNotes){K.setValue(this.itemInfo.wipNotes);N.setValue(" wip ")}else{if(this.itemInfo.submittedNotes){K.setValue(this.itemInfo.submittedNotes);N.setValue(" submit ")}else{K.setValue(" ");N.setValue(" ")}}if(this.itemInfo.submitEnabled){this.dropboxOpenSubmitButton.enable();this.dropboxOpenSaveProgressButton.enable();this.ensureVisible(document.getElementById(" changeWipFile_ "+this.playerId))}else{this.dropboxOpenSubmitButton.disable();this.dropboxOpenSaveProgressButton.disable();this.ensureHidden(document.getElementById(" changeWipFile_ "+this.playerId))}if(!O.saveProgress){this.closeWindows()}var H=Ext.get(" fileInput_ "+this.playerId);if(H!=null){if(this.itemInfo.dropboxType==DropboxType.MultipleDocuments){H.update(" ");if(this.itemInfo.wipFiles||this.itemInfo.submittedFiles){var C=[];if(this.itemInfo.wipFiles){C=this.itemInfo.wipFiles}else{if(this.itemInfo.submittedFiles){C=this.itemInfo.submittedFiles}}var I=Ext.get(" wipFileInfo_ "+this.playerId);I.update(this.loadDropboxAttachments(C));this.ensureVisible(I.dom)}else{this.ensureHidden(document.getElementById(" wipFileInfo_ "+this.playerId))}var F=Ext.get(" addFileInput_ "+this.playerId).dom;if(this.itemInfo.submitEnabled){H.update('<input type=" file " name=" attachment " style=" width: 300 px; "  onkeyup=" return false; " onkeydown=" return false; " onkeypress=" return false; "/>');this.ensureVisible(F)}else{this.ensureHidden(F)}this.addMultipleAttachmentListeners()}else{if(this.itemInfo.wipFiles||this.itemInfo.submittedFiles){H.update(" ");var E=Ext.get(" wipFileName_ "+this.playerId);E.setOpacity(1,false);var D=document.getElementById(" changeAssignmentDocument_ "+this.playerId);if(D){D.checked=false}if(this.itemInfo.wipFiles){document.getElementById(" wipFileName_ "+this.playerId).innerHTML=this.itemInfo.wipFiles[0].display}else{document.getElementById(" wipFileName_ "+this.playerId).innerHTML=this.itemInfo.submittedFiles[0].display}if(this.itemInfo.submitEnabled){this.ensureVisible(document.getElementById(" wipFileDelete_ "+this.playerId))}else{this.ensureHidden(document.getElementById(" wipFileDelete_ "+this.playerId))}this.ensureVisible(document.getElementById(" wipFileInfo_ "+this.playerId))}else{if(this.itemInfo.submitEnabled){var H=Ext.get(" fileInput_ "+this.playerId);H.update('<input type=" file " id=" attachfile_ '+this.playerId+' " name=" attachment " style=" width: 300 px; "  onkeyup=" return false; " onkeydown=" return false; " onkeypress=" return false; "/>');this.ensureHidden(document.getElementById(" wipFileInfo_ "+this.playerId))}else{var H=Ext.get(" fileInput_ "+this.playerId);H.update(" ");this.ensureHidden(document.getElementById(" wipFileInfo_ "+this.playerId))}}}}}}})},failureUpdate:function(B,A){this.messageBoxHide();var C=B.responseText;FRAME_API.fireEvent(" jswindowopening ");if(A.saveProgress){Ext.MessageBox.alert(this.failedSavingAssignmentString,String.format(this.errorWithMessageString,C),function(){FRAME_API.fireEvent(" jswindowclosed ")})}else{Ext.MessageBox.alert(this.failedSubmittingAssignmentString,String.format(this.errorWithMessageString,C),function(){FRAME_API.fireEvent(" jswindowclosed ")})}},openWipAssignment:function(A){var B=this.appRoot+" / Content / Assignment.ashx ? "+Ext.urlEncode({enrollmentid:this.enrollmentId,itemid:this.itemId,actiontype:" wip ",filename:A,timestamp:(new Date()).format(" Y : m : d : H : i : s : u ")});this.downloadFile(B)},openSubmittedAssignment:function(A){var B=this.appRoot+" / Content / Assignment.ashx ? "+Ext.urlEncode({enrollmentid:this.enrollmentId,itemid:this.itemId,actiontype:" submitted ",filename:A,timestamp:(new Date()).format(" Y : m : d : H : i : s : u ")});this.downloadFile(B)},openAssignmentTemplate:function(){if(!this.itemInfo.templateName){return }var A=this.appRoot+" / Content / Assignment.ashx ? "+Ext.urlEncode({enrollmentid:this.enrollmentId,itemid:this.itemId,actiontype:" template ",timestamp:(new Date()).format(" Y : m : d : H : i : s : u ")});this.downloadFile(A)},openWipOrSubmittedAssignment:function(A){if(this.itemInfo.wipFiles){this.openWipAssignment(A)}else{if(this.itemInfo.submittedFiles){this.openSubmittedAssignment(A)}}},openAssignment:function(){if(!this.itemInfo){return }if(this.dropboxSubmitTooltip){this.dropboxSubmitTooltip.destroy()}if(this.itemInfo.templateName){var E=this.appRoot+" / Content / Assignment.ashx ? "+Ext.urlEncode({enrollmentid:this.enrollmentId,itemid:this.itemId,actiontype:" latest ",timestamp:(new Date()).format(" Y : m : d : H : i : s : u ")});this.downloadFile(E)}else{if(this.itemInfo.externalLink){window.open(this.itemInfo.externalLink)}else{var I=this.getLabelWidth(this.assignmentCommentsLabel);var G=0;switch(this.itemInfo.dropboxType){case DropboxType.Url:I=Math.max(I,this.getLabelWidth(this.assignmentURLLabel));G+=24;break;case DropboxType.SingleDocument:I=Math.max(I,this.getLabelWidth(this.assignmentAttachmentLabel));G+=24;break;case DropboxType.MultipleDocuments:I=Math.max(I,this.getLabelWidth(this.assignmentAttachmentLabel));G+=100;break;default:break}I+=10;var J=Ext.get(document.body).getSize();var A=Math.min(J.height/1.25,this.idealAssignmentHeight+G);var D=Math.min(J.width/1.25,this.idealAssignmentWidth+I);if(this.assignmentForm==null){this.dropboxOpenSaveProgressButton=new Ext.Button({id:" dropboxOpenSaveProgress_ "+this.playerId,text:this.saveButtonString,minWidth:75,tooltip:this.saveProgressString+" < br / > < b > "+this.saveNotSubmitString+" < /b>",handler:this.saveProgress,scope:this});this.dropboxOpenSubmitButton=new Ext.Button({id:"dropboxOpenSubmit_"+this.playerId,minWidth:75,text:this.submitButtonString,handler:this.submitAssignment,scope:this});this.assignmentForm=new Ext.form.FormPanel({header:false,autoScroll:true,labelWidth:I,fileUpload:true,url:this.appRoot+"/Content / Assignment.ashx ",items:[{xtype:" panel ",id:" assignmentTitle_ "+this.playerId,style:" margin - bottom : 8 px ",cls:" gradeHeaderText color_medium title_font "},{xtype:" tinymce ",id:" notes_ "+this.playerId,name:" notes ",fieldLabel:this.assignmentCommentsLabel,width:575,height:220,autoScroll:false,tinymceSettings:Ext.apply(tinymce_basic_with_images,{document_base_url:this.documentRoot,file_browser_callback:this.uploadImage.createDelegate(this),course_link_base_params:{courseId:this.courseId,enrollmentId:this.enrollmentId,forcePopup:true}})},{xtype:" panel ",border:false,bodyStyle:" clear : left; ",html:" < div id = 'progressSavedIndicator_"+this.playerId+"' class = 'small_font' style = 'padding-left:"+(I+5)+"px;' > "+this.getProgressSavedDateText()+" < /div>"},{xtype:"hidden",name:"enrollmentid",value:this.enrollmentId},{xtype:"hidden",name:"itemid",value:this.itemId},{xtype:"hidden",id:"lastpackage_"+this.playerId,name:"lastpackage",value:""},{xtype:"hidden",name:"actiontype",id:"actiontype_"+this.playerId,value:"submit"}],cls:"color_light assignment_area",buttonAlign:"right",buttons:[{xtype:"tbfill"},this.dropboxOpenSaveProgressButton,this.dropboxOpenSubmitButton,{text:this.closeString,handler:this.closeWindows,scope:this}],listeners:{scope:this,afterrender:{fn:function(){var L=this.assignmentForm.el.child("a[id=wipFileName_"+this.playerId+"]");if(L!=null){L.on("click",this.openWipOrSubmittedAssignment,this)}L=this.assignmentForm.el.child("a[id=wipFileDelete_"+this.playerId+"]");if(L!=null){L.on("click",this.deleteWipFile.createDelegate(this,[""]),this)}L=this.assignmentForm.el.child("input[id=changeAssignmentDocument_"+this.playerId+"]");if(L!=null){L.on("click",this.toggleChangeAssignmentDocument,this)}this.addMultipleAttachmentListeners();if(this.itemInfo.dropboxType==DropboxType.MultipleDocuments&&this.itemInfo.submitEnabled){L=this.assignmentWindow.el.child(".add-dropbox-attachment");if(L){L.on("click",function(){var M=Ext.get("fileInput_"+this.playerId);html='<input type="file" name="attachment" style="width:300px;"  onkeyup="return false;" onkeydown="return false;" onkeypress="return false;"/ > ';M.insertHtml("beforeEnd",html)},this)}}},delay:500}}});switch(this.itemInfo.dropboxType){case DropboxType.Url:this.assignmentForm.insert(1,{xtype:"textfield",fieldLabel:this.assignmentURLLabel,id:"attachedUrl_"+this.playerId,name:"attachedUrl",width:575,value:this.itemInfo.wipUrl?this.itemInfo.wipUrl:this.itemInfo.submittedUrl});this.assignmentForm.insert(2,{xtype:"label",style:"font-style:italic;margin-left:"+(I+5)+"px;",text:this.exampleURL});break;case DropboxType.SingleDocument:var F="";if(this.itemInfo.wipFiles){F=this.itemInfo.wipFiles[0].display}else{if(this.itemInfo.submittedFiles){F=this.itemInfo.submittedFiles[0].display}}var C="<div id=' wipFileInfo_ "+this.playerId+" '"+(F?"style=' margin - bottom : 6 px; '":"style=' display : none; white - space : nowrap; float : left; '")+"><a href=' javascript : void(0); ' id=' wipFileName_ "+this.playerId+" '>"+F+"</a>";C+="<a href=' javascript : void(0); ' id=' wipFileDelete_ "+this.playerId+" '"+((this.itemInfo.submitEnabled&&F)?"":" style=' display : none; '")+"><img class=' delete_saved_file_img ' src=' "+Ext.BLANK_IMAGE_URL+" ' alt=' "+this._Delete+" '/></a>";C+="<span id=' changeWipFile_ "+this.playerId+" '"+(this.itemInfo.submitEnabled?"":"style=' display : none; '")+">&nbsp;<input id=' changeAssignmentDocument_ "+this.playerId+" ' name=' changeAssignmentDocument ' type=' checkbox ' />&nbsp;<label for=' changeAssignmentDocument_ "+this.playerId+" '>"+this.changeFileString+"</label>&nbsp;</span></span><input type=' hidden ' name=' wipFileDeleteFlag ' id=' wipFileDeleteFlag_ "+this.playerId+" ' value=' ' />";C+="</div>";this.assignmentForm.insert(1,{xtype:"panel",layout:"table",border:false,autoHeight:true,style:"margin-bottom:8px",items:[{html:"<div style=' padding : 3 px; '>"+this.assignmentAttachmentLabel+":</div>",width:I+5,cls:"x-form-item-label"},{html:C+' < div id = "fileInput_'+this.playerId+'" style : "float:left;" > '+((!F&&this.itemInfo.submitEnabled)?' < input type = "file" name = "attachment" style = "width:300px;" onkeyup = "return false;" onkeydown = "return false;" onkeypress = "return false;" / > ':"")+"</div>"}]});break;case DropboxType.MultipleDocuments:var B=[];if(this.itemInfo.wipFiles){B=this.itemInfo.wipFiles}else{if(this.itemInfo.submittedFiles){B=this.itemInfo.submittedFiles}}var C=[];C.push("<div id=' wipFileInfo_ ",this.playerId," ' ",((B&&B.length)?"style=' margin - bottom : 6 px; '":"style=' display : none; white - space : nowrap; float : left; '"),">");C.push(this.loadDropboxAttachments(B));C.push("</div>");C.push(' < div id = "fileInput_',this.playerId,'" style : "float:left;" > ',(this.itemInfo.submitEnabled?' < input type = "file" name = "attachment" style = "width:300px;" onkeyup = "return false;" onkeydown = "return false;" onkeypress = "return false;" / > ':""),"</div>");C.push(' < div id = "addFileInput_',this.playerId,'" style = "margin-top:6px;',(this.itemInfo.submitEnabled?" ":" display : none; "),'" > < a href = "javascript:void(0)" class = "add-dropbox-attachment" > < img alt = "" height = "10" width = "10" style = "margin-right:4px;" src = "',this.appRoot,'/Images/add2.png" / > ',this._AddAttachment,"</a></div>");C.push("<input type=' hidden ' name=' wipFileDeleteFlag ' id=' wipFileDeleteFlag_ ",this.playerId," ' value=' ' />");this.assignmentForm.insert(1,{xtype:"panel",layout:"table",border:false,autoHeight:true,style:"margin-bottom:8px",items:[{html:"<div style=' padding : 3 px; '>"+this.assignmentAttachmentsLabel+":</div>",width:I+5,cls:"x-form-item-label"},{html:C.join("")}]});break;default:break}var H=Ext.getCmp("notes_"+this.playerId);var K=Ext.getCmp("lastpackage_"+this.playerId);if(this.itemInfo.wipNotes){H.setValue(this.itemInfo.wipNotes);K.setValue("wip")}else{if(this.itemInfo.submittedNotes){H.setValue(this.itemInfo.submittedNotes);K.setValue("submit")}else{H.setValue("");K.setValue("")}}}if(this.assignmentWindow==null){this.assignmentWindow=new Ext.Window({constrainHeader:true,height:A,width:D,layout:"fit",plain:true,items:[this.assignmentForm],shim:true,modal:true,frame:true,closable:true,closeAction:"hide",listeners:{hide:function(){FRAME_API.fireEvent("jswindowclosed")},scope:this}})}else{if(!this.assignmentWindow.items||this.assignmentWindow.items.length==0){this.assignmentWindow.add(this.assignmentForm)}}FRAME_API.fireEvent("jswindowopening");this.assignmentWindow.show();this.assignmentWindow.setSize(D,A);if(this.itemInfo.submitEnabled){this.dropboxOpenSubmitButton.enable();this.dropboxOpenSaveProgressButton.enable()}else{this.dropboxOpenSubmitButton.disable();if(this.itemInfo.submitDisabledReason){this.dropboxSubmitTooltip=new Ext.ToolTip({target:"dropboxOpenSubmit_"+this.playerId,title:this.itemInfo.submitDisabledReason,plain:true})}this.dropboxOpenSaveProgressButton.disable()}this.layoutHtmlEditor.defer(0,this)}}},addMultipleAttachmentListeners:function(){var A=this.assignmentForm.el.select("a[class~=dropbox-file-name]");if(A){A.each(function(C){var B=C.dom.attributes["data-file"].value;C.on("click",this.openWipOrSubmittedAssignment.createDelegate(this,[B]),this)},this)}A=this.assignmentForm.el.select("a[class~=dropbox-file-delete]");if(A){A.each(function(C){var B=C.dom.attributes["data-file"].value;C.on("click",this.deleteWipFile.createDelegate(this,[B]),this)},this)}},loadDropboxAttachments:function(B){var C=[];for(var A=0;A<B.length;A++){if(A>0){C.push("&nbsp;|&nbsp;")}if(this.itemInfo.submitEnabled){C.push("<a href=' javascript : void(0); ' class=' dropbox - file - delete ' data-file=' ",B[A].name," '>","<img alt=' ",this._Delete," height = '10' width = '10' style = 'margin-right:4px;' src = '",this.appRoot,"/Images/delete2.png' / > < /a>")}C.push("<a href='javascript:void(0);' class='dropbox-file-name' data-file='",B[A].name,"'>",B[A].display,"</a > ")}return C.join(" ")},showMainContent:function(){this.mainCourseContentPanel.show();this.mainContentLayout.doLayout();this.resizeContentFrame();if(Ext.isIE){this.viewport.doLayout()}},hideMainContent:function(){this.mainCourseContentPanel.hide()},proxyCallback:function(A){if(A){this.hideMainContent()}else{this.showMainContent()}},uploadImage:function(D,A,B,C){if(B===" image "){tinyMCE.activeEditor.windowManager.open({file:this.appRoot+" / Editor / UploadImage.aspx ? url = "+encodeURIComponent(A),title:this.uploadFileMessage,name:this.uploadFileMessage,width:275,height:95,resizable:" yes ",popup_css:false,inline:" yes ",close_previous:" no "},{window:C,input:D});return false}},layoutHtmlEditor:function(){if(this.assignmentForm!=null){var A=this.assignmentForm.findById(" assignmentTitle_ "+this.playerId).getEl();var C=String.format(this.assignmentSubmitPanelHeader,this.itemInfo.title);Ext.QuickTips.unregister(A);Ext.QuickTips.register({target:A,text:C});A.update(C);this.assignmentForm.footer.addClass(" color_medium default_border dashboard_list_btns ");this.assignmentForm.doLayout();var B=Ext.getCmp(" notes_ "+this.playerId);if(B!=null){B.setSize(574,221);B.setSize(575,222)}}},deleteWipFile:function(D){var B=" ";if(this.itemInfo.wipFiles){D=D||this.itemInfo.wipFiles[0].name;for(var C=0;C<this.itemInfo.wipFiles.length;C++){if(D==this.itemInfo.wipFiles[C].name){B=this.itemInfo.wipFiles[C].display;break}}}else{if(this.itemInfo.submittedFiles){D=D||this.itemInfo.submittedFiles[0].name;for(var C=0;C<this.itemInfo.submittedFiles.length;C++){if(D==this.itemInfo.submittedFiles[C].name){B=this.itemInfo.submittedFiles[C].display;break}}}}if(!B){B=D}var A=String.format(this.deletePermanentlyConfirmString," < a id = 'deleteWip_"+this.playerId+"' href = 'javascript:void(0);' > "+B+" < /a>");Ext.MessageBox.getDialog().on("show",this.onShowDeleteWipDialog.createDelegate(this,[D],true),this);FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.confirm(this.itemInfo.title,A,function(E){FRAME_API.fireEvent("jswindowclosed");if(E=="yes"){var F=Ext.getCmp("notes_"+this.playerId);F.syncValue();document.getElementById("actiontype_"+this.playerId).value="saveprogress";var G=document.getElementById("wipFileDeleteFlag_"+this.playerId);if(G!=null){G.value=D}messageBoxShouldBeClosed=false;this.showUploadingMessageBox(String.format(this.deletingAndSavingString,D),this.savingDotDotDotString);Ext.Ajax.request({url:this.appRoot+"/Content / Assignment.ashx ",success:this.successUpdate,failure:this.failureUpdate,scope:this,form:this.assignmentForm.getForm().getEl().dom,saveProgress:true,method:" POST ",successDisplayString:String.format(this.deleteAndSaveSuccessString,B),isUpload:true})}},this)},onShowDeleteWipDialog:function(A,B){A.un(" show ",this.onShowDeleteWipDialog,this);(function(){var C=A.el.child(" a[id = deleteWip_ "+this.playerId+"] ");if(C){C.on(" click ",this.openWipOrSubmittedAssignment.createDelegate(this,[B]),this)}}).defer(500,this)},toggleChangeAssignmentDocument:function(){var C=Ext.get(" fileInput_ "+this.playerId);if(C!=null){var D=Ext.get(" wipFileName_ "+this.playerId);var A=Ext.get(" wipFileDelete_ "+this.playerId);var B=document.getElementById(" changeAssignmentDocument_ "+this.playerId);if(B.checked){D.animate({opacity:{to:0.3}},0.35,function(){C.update('<input type=" file " name=" attachment " style=" width : 300 px; "  onkeyup=" return false; " onkeydown=" return false; " onkeypress=" return false; "/>');A.dom.style.visibility=" hidden "}," easeIn ")}else{D.animate({opacity:{to:1}},0.35,function(){C.update(" ");A.dom.style.visibility=" visible "}," easeIn ")}}},getProgressSavedDateText:function(){if(!this.itemInfo.wipDate){if(this.itemInfo.submittedDate){return String.format(this.submittedDateString,this.itemInfo.submittedDate)}else{if(!this.itemInfo.submitEnabled){return" "}}return this.noProgressString}return String.format(this.progressSavedString,this.itemInfo.wipDate)},getLabelWidth:function(A){var B=Ext.util.TextMetrics.measure(" footerLabelSizer_ "+this.playerId,A);return(Math.max(B.width,10)+10)},downloadFile:function(A){if(this.downloadIframe==null){this.downloadIframe=document.createElement(" iframe ");this.downloadIframe.style.display=" none ";document.body.appendChild(this.downloadIframe)}this.downloadIframe.src=A;return false},validateSiteAddress:function(B,C){var A=B.toLowerCase();if(C&&Ext.isEmpty(B)){return true}if(Ext.isEmpty(B)||(A.indexOf(" http :
  1747.                //")!=0&&A.indexOf("https://")!=0&&A.indexOf("gateway://")!=0)){Ext.Msg.alert(this._InvalidAddressCaption,this._InvalidAddress);return false}else{if(A=="http://"||A=="https://"||A=="gateway://"){Ext.Msg.alert(this._InvalidAddressCaption,this._MissingAddress);return false}}return true},saveProgress:function(){if(!this.itemInfo){return }if(this.itemInfo.templateName){this.saveTemplatedAssignmentProgress()}else{var C=Ext.getCmp("notes_"+this.playerId);C.syncValue();var D=Ext.getCmp("attachedUrl_"+this.playerId);if(D!=null){if(!this.validateSiteAddress(D.getValue(),true)){return }}var A=Ext.get("fileInput_"+this.playerId);if(A!=null){var B=A.child("input[@type=file]",true);if(!Ext.isEmpty(B)&&!Ext.isEmpty(B.value)&&this.isProhib(B.value)){return }}document.getElementById("actiontype_"+this.playerId).value="saveprogress";this.messageBoxShouldBeClosed=false;this.showUploadingMessageBox(this.savingYourProgressString,this.savingDotDotDotString);Ext.Ajax.request({url:this.appRoot+"/Content/Assignment.ashx",success:this.successUpdate,failure:this.failureUpdate,scope:this,form:this.assignmentForm.getForm().getEl().dom,saveProgress:true,method:"POST",isUpload:true})}},saveTemplatedAssignmentProgress:function(){var D=String.format(this.saveAssignmentText,this.itemInfo.templateName);var A=D+'<br/><br/><form id="saveProgressForm_'+this.playerId+'" action="'+this.appRoot+'/Content/Assignment.ashx" enctype="multipart/form-data"><div style="display:none;"><input type="hidden" id="actiontype_'+this.playerId+'" name="actiontype" value="saveprogress" /><input type="hidden" name="enrollmentid" value="'+this.enrollmentId+'" /><input type="hidden" id="itemid_'+this.playerId+'" name="itemid" value="'+this.itemId+'" /></div><input name="fileUpload" id="fileUpload_'+this.playerId+'" type="file" style="width:350px;"  onkeyup="return false;" onkeydown="return false;" onkeypress="return false;"/><br/></form>';try{Ext.MessageBox.updateText("")}catch(C){}var B=Math.min(600,this.getLabelWidth(D));FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.show({title:this.saveAssignmentTitle,msg:A,buttons:Ext.MessageBox.OKCANCEL,fn:this.saveTemplatedAssignmentProgressButtonClick,scope:this,icon:Ext.MessageBox.QUESTION,minWidth:B});Ext.MessageBox.getDialog().on("beforehide",this.returnFalse,this)},messageBoxAlertWithMinWidth:function(D,C,B,A){A=A||Ext.MessageBox.ERROR;B=B||Math.min(450,this.getLabelWidth(C));FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.show({title:D,msg:C,buttons:Ext.MessageBox.OK,minWidth:B,icon:A,fn:function(){FRAME_API.fireEvent("jswindowclosed")}})},saveTemplatedAssignmentProgressButtonClick:function(C){FRAME_API.fireEvent("jswindowclosed");Ext.MessageBox.getDialog().un("beforehide",this.returnFalse,this);if(C=="ok"){var D=document.getElementById("fileUpload_"+this.playerId).value;if(!D){FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.alert(this.errorTitle,this.saveBlankAssignmentTypeText,function(){FRAME_API.fireEvent("jswindowclosed")});return }D=D.replace(/.*\//,"");D=D.replace(/.*\\/,"");if(this.isProhib(D)){return }var B=this.getFileExtension(this.itemInfo.templateName);var A=this.getFileExtension(D);if(A!=B){this.messageBoxAlertWithMinWidth(this.errorTitle,String.format(this.submitWrongAssignmentTypeText,B,A));return }Ext.Ajax.request({url:this.appRoot+"/Content/Assignment.ashx",success:this.successUpdate,failure:this.failureUpdate,scope:this,form:"saveProgressForm_"+this.playerId,method:"POST",saveProgress:true,isUpload:true});this.messageBoxShouldBeClosed=false;this.showUploadingMessageBox(this.savingYourProgressString,this.savingDotDotDotString)}else{this.messageBoxHide()}},successSaveProgress:function(B,A){FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.alert(this.uploadingFileCompleteTitle,"<br/>"+this.uploadingFileCompleteMessage+"<br/>",function(){FRAME_API.fireEvent("jswindowclosed")})},failureSaveProgress:function(B,A){if(B.responseXML&&B.responseXML.lastChild&&B.responseXML.lastChild.firstChild){errorCode=this.getTextFromXMLNode(B.responseXML.lastChild.firstChild)}else{errorCode=this.serverErrorString}FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.alert(this.failedUploadingAssignmentString,String.format(this.errorWithMessageString,errorCode),function(){FRAME_API.fireEvent("jswindowclosed")})},returnFalse:function(){return false},showUploadingMessageBox:function(B,A){if(!this.messageBoxShouldBeClosed){FRAME_API.fireEvent("jswindowopening");Ext.MessageBox.show({msg:B?B:this.uploadingFileProgressMessage,progressText:A?A:this.savingDotDotDotString,width:300,wait:true,waitConfig:{interval:200},proxyDrag:true});var C=Ext.MessageBox.getDialog();C.on("move",this.testAndCloseDialog,this);C.on("hide",this.messageBoxHidden,this)}},getTextFromXMLNode:function(A){if(Ext.isIE){return A.text}return A.textContent},findShowEditWindow:function(A){if(A.showEditWindow!=null){return A.showEditWindow}if(A.parent!=A){return this.findShowEditWindow(A.parent)}return null},editActivity:function(){if(this.shortcutId&&frames["contentBody_"+this.playerId].location!="about:blank"){var B=this._Edit;if(this.itemInfo!=null){B+=" - "+this.itemInfo.typeDisplay+" - "+this.itemInfo.title}this.closeWindows(false);if(typeof (FRAME_API)!="undefined"){FRAME_API.editItem(this.enrollmentId,this.shortcutId,B)}else{var A=this.findShowEditWindow(window);if(A){A(this.courseId,this.shortcutId,B,this.playerAssemblyApi)}}}},navToItem:function(D,C,A){if(C){var B=this.pageRoot+"?enrollmentid="+this.enrollmentId+"&itemid="+encodeURIComponent(D);if(A){B+="&extra="+encodeURIComponent(A)}this.recordItemTimeSpent();window.location=B}else{var B=this.appRoot+"/Learn/GetNavItem.ashx?enrollmentid="+this.enrollmentId+"&cmd=absolute&itemid="+encodeURIComponent(D);if(A){B+="&extra="+encodeURIComponent(A)}this.sendNavigationRequest(B)}},navPrev:function(){if(this.shortcutId!=null){var A=this.appRoot+"/Learn/GetNavItem.ashx?enrollmentid="+this.enrollmentId+"&cmd=prev&itemid="+encodeURIComponent(this.shortcutId);this.sendNavigationRequest(A)}},navNext:function(){if(this.shortcutId!=null){var A=this.appRoot+"/Learn/GetNavItem.ashx?enrollmentid="+this.enrollmentId+"&cmd=next&itemid="+encodeURIComponent(this.shortcutId);this.sendNavigationRequest(A)}},navToExternal:function(C){var B="_blank";if(C.toLowerCase().indexOf("x-target://")==0){B="_top";var E=C.toLowerCase().substr(11);if(E.indexOf("_blank")==0||E.indexOf("_external")==0){B="_blank"}else{if(E.indexOf("_self")==0){B="_self"}}var D=C.toLowerCase().indexOf("?url=");if(D>=0){C=C.substr(D+5);var A=C.indexOf("&");if(A>=0){C=C.substr(0,A)}A=C.indexOf("#");if(A>=0){C=C.substr(0,A)}C=unescape(C)}}else{if(C.indexOf(this.appRoot)==0){B="_top"}}window.open(C,B)},navExit:function(){this.recordItemTimeSpent()},getSectionSummary:function(A){if(Ext.isObject(A)&&A.callback){Ext.Ajax.request({url:this.appRoot+"/Learn/ScormData.ashx",params:{action:"getsectionsummary",enrollmentid:this.enrollmentId,itemid:this.lastLogicalId,allstatus:A.allStatus?"1":"0"},callback:this.getSectionSummaryCallback,scope:this,agxOptions:A})}},enterItem:function(C,A){this.Log("enterItem:"+C);this.itemId=C;this.skipSelectionChange=false;this.shortcutId=A||C;this.lastLogicalId=C;this.newAttempt="1";this.itemStart=new Date();var B=encodeURIComponent(this.shortcutId);if(typeof (FRAME_API)!="undefined"){FRAME_API.setComponentState(this.componentType,this.playerId,{itemId:B})}if(this.courseTree){this.navigateTreeToItem(A)}else{this.needsTreeInitialization=true}this.closeWindows();this.messageBoxHide()},leaveItem:function(){this.Log("leaveItem");this.recordItemTimeSpent();this.itemId=null;this.shortcutId=null;this.itemInfo=null;try{this.ResetData.defer(1,this,[true]);this.resetDropbox()}catch(A){}},setItemInfoJson:function(json){this.Log("setItemInfoJson");this.itemInfo=eval("("+json+")");if(!this.playerInitialized){this.needsItemInitialization=true;return }this.recordBookmark();this.updateForNewItemInfo()},updateForNewItemInfo:function(){this.Log("updateForNewItemInfo");var V=true;if(this.itemInfo!=null){if(!this.itemInfo.sco){var c=this.itemInfo.maxMinutes;var b=c*60*1000;this.recordItemTimeSpent.defer(b,this)}var I=this.componentType=="courseplayer";var P=Ext.getCmp("content_status_"+this.playerId);if(P){if(this.itemInfo.flagEdits&&this.itemInfo.available){P.setText(this._ModifiedFromOriginal);I=true}else{P.setText("")}}var U=Ext.getCmp("comments_"+this.playerId);if(U){if(!Ext.isEmpty(this.itemInfo.comments)&&this.itemInfo.available){I=true;U.show()}else{U.hide()}}if(this.ratingsPanel){if(this.itemInfo.available){this.updateRatings();this.ratingsPanel.show()}else{this.ratingsPanel.hide.defer(10,this.ratingsPanel)}}var H=this.mainContentLayout.getTopToolbar();if(H){var M=(H.items.getCount()<=3)&&!I;if(M){H.hide()}else{H.show()}}if(this.itemInfo.showDropbox&&this.showAdornments&&this.itemInfo.available&&!this.itemInfo.isExam&&!this.itemInfo.isHomework){V=false;var R=Ext.get("dropboxScore_"+this.playerId);var D=Ext.get("dropboxScoreBox_"+this.playerId);if(this.itemInfo.grade!=null){R.update(this.itemInfo.grade,true);if(Ext.isIE){D.setStyle("width","auto")}}else{R.update("");if(Ext.isIE){D.setStyle("width","46px")}}if(this.itemInfo.dropboxStatus){document.getElementById("dropboxStatus_"+this.playerId).innerHTML=this.itemInfo.dropboxStatus}else{document.getElementById("dropboxStatus_"+this.playerId).innerHTML=""}var O=document.getElementById("dropboxScoreBox_"+this.playerId);var F=document.getElementById("dropboxDetails_"+this.playerId);var E=document.getElementById("dropboxOpen_"+this.playerId);var C=document.getElementById("dropboxOpenSplit_"+this.playerId);var A=document.getElementById("dropboxSubmit_"+this.playerId);var B=document.getElementById("dropboxSaveProgress_"+this.playerId);var d=document.getElementById("dropboxRubric_"+this.playerId);var J=document.getElementById("dropboxCompleted_"+this.playerId);var T=document.getElementById("dropboxSurvey_"+this.playerId);if(this.itemInfo.canSubmit&&!this.itemInfo.isDropboxDisabled){this.showOpenButton();this.ensureVisible(A);this.ensureVisible(B)}else{this.ensureHidden(E);this.ensureHidden(C);this.ensureHidden(A);this.ensureHidden(B)}if(this.itemInfo.gradable){this.ensureVisible(O);this.ensureVisible(F);this.ensureHidden(J)}else{if(this.itemInfo.isExam&&this.itemInfo.detailsEnabled){this.ensureVisible(O);this.ensureVisible(F)}else{this.ensureHidden(O);this.ensureHidden(F)}if(this.itemInfo.submitEnabled){this.dropboxCompletedButton.enable()}else{this.dropboxCompletedButton.disable()}if(this.itemInfo.completionTrigger==CompletionTrigger.Minutes||this.itemInfo.completionTrigger==CompletionTrigger.PassingScore||this.itemInfo.isExam||this.itemInfo.isHomework){this.ensureHidden(J)}else{this.ensureVisible(J)}}if(this.itemInfo.hasRubric){this.ensureVisible(d)}else{this.ensureHidden(d)}if(this.dropboxSubmitTooltip){this.dropboxSubmitTooltip.destroy()}var L=document.getElementById("dropboxSubmit_"+this.playerId);var Z=document.getElementById("dropboxSaveProgress_"+this.playerId);if(this.itemInfo.submitEnabled&&(this.itemInfo.templateName||this.itemInfo.externalLink)){this.ensureVisible(Z);this.ensureVisible(L);this.dropboxSubmitButton.enable();if(this.itemInfo.externalLink){this.dropboxSaveProgressButton.disable()}else{this.dropboxSaveProgressButton.enable()}}else{this.ensureHidden(Z);this.ensureHidden(L)}if(this.itemInfo.detailsEnabled){this.dropboxDetailsButton.enable()}else{this.dropboxDetailsButton.disable()}var N=document.getElementById("progressSavedIndicator_"+this.playerId);if(N){N.innerHTML=this.getProgressSavedDateText()}this.show(T,this.itemInfo.isSurvey);if(this.itemInfo.isSurvey){this.dropboxSurveyButton.setDisabled(this.itemInfo.surveyUrl==null)}var Y=document.getElementById("dropboxPeerReview_"+this.playerId);if(this.itemInfo.allowPeerReview){this.ensureVisible(Y);this.dropboxPeerReviewButton.setDisabled(!this.itemInfo.peerReviewEnabled)}else{this.ensureHidden(Y)}}}var K=document.getElementById("dropboxStatusAndButtons_"+this.playerId);if(this.showAdornments){if(V){if(this.ensureHidden(K)){this.viewport.syncSize()}}else{if(this.ensureVisible(K)){this.viewport.syncSize()}}}if(this.itemInfo==null||this.itemInfo.attachments.length==0){if(this.attachmentPanel){this.attachmentPanel.hide()}this.mainContentLayout.doLayout();this.resizeContentFrame()}else{if(this.showAdornments){var G='<span class="attachment-el bold_font">'+this.attachmentsLabel+":</span>";for(var X=0;X<this.itemInfo.attachments.length;X++){var W=this.appRoot+this.itemInfo.attachments[X][0];var Q=this.itemInfo.attachments[X][1];var S="";if(X>0){S="|"}G+=String.format('<span class="attachment-el">{3}</span><span class="attachment-el"><a href="{1}" class="attachment-link" downloadFile="{1}">{2}</a></span>',X,Ext.util.Format.htmlEncode(W),Q,S)}var a=this.attachmentPanel.body;if(a!=null&&this.attachmentPanel!=null){a.update(G);this.attachmentPanel.show()}}this.mainContentLayout.doLayout();this.resizeContentFrame();if(Ext.isWebKit){this.viewport.doLayout()}}},showOpenButton:function(){var B=document.getElementById("dropboxOpen_"+this.playerId);var A=document.getElementById("dropboxOpenSplit_"+this.playerId);if(this.itemInfo.templateName){if(this.itemInfo.wipFiles||this.itemInfo.submittedFiles){this.ensureVisible(A);this.ensureHidden(B);if(this.itemInfo.submittedFiles&&this.itemInfo.wipFiles){this.dropboxOpenSplitButton.menu.items.itemAt(0).show();this.dropboxOpenSplitButton.menu.items.itemAt(1).show()}else{if(this.itemInfo.submittedFiles){this.dropboxOpenSplitButton.menu.items.itemAt(0).hide();this.dropboxOpenSplitButton.menu.items.itemAt(1).show()}else{this.dropboxOpenSplitButton.menu.items.itemAt(0).show();this.dropboxOpenSplitButton.menu.items.itemAt(1).hide()}}}else{this.ensureHidden(A);this.ensureVisible(B)}}else{this.ensureHidden(A);this.ensureVisible(B)}},recordItemTimeSpent:function(D){if(this.itemId!=null&&this.itemStart!=null&&this.itemInfo!=null&&this.itemInfo.available&&!this.readOnly){var H=new Date();var K=Math.max(0,H.getTime()-this.itemStart.getTime());if(this.itemInfo.sco){if(!this.itemInfo.scoTimeRecorded){if(K>(31*60*1000)){K=15*60*1000}var C=this.dataModel.get("cmi.session_time");if(C!=null){if(!Ext.isEmpty(C.Value)){var F=this.StringToTimeSpan(C.Value);var J=this.dataModel.get("cmi.total_time");if(J!=null){var B=this.StringToTimeSpan(J.Value);B+=F;J.Value=this.TimeSpantoString(B)}K=Math.floor(F*10)}C.Value=""}this.itemInfo.scoTimeRecorded=true}else{K=0}}var I=this.itemId;if(this.itemId.indexOf("_STUB")>=0){I=this.itemId.replace("_STUB","")}var A=this.appRoot+"/Learn/RecordActivity.ashx?enrollmentid="+this.enrollmentId+"&newattempt="+this.newAttempt+"&itemid="+encodeURIComponent(I)+"&starttime="+encodeURIComponent(this.itemStart.toUTCString().replace(/UTC/,"GMT"))+"&timespent="+K;var L={url:A,recordedItemId:I,success:this.recordActivitySuccess,scope:this};var G=false;if(D){var E;if(window.XMLHttpRequest){E=new XMLHttpRequest()}else{E=new ActiveXObject("Microsoft.XMLHTTP")}if(E){E.open("GET",A,false);E.send(null);this.recordActivitySuccess(E,L);G=true}}if(!G){Ext.Ajax.request(L)}}this.newAttempt="0";this.itemStart=new Date()},recordActivitySuccess:function(request,options){if(!Ext.isEmpty(request.responseText)){var itemid=options.recordedItemId;var root=eval("("+request.responseText+")");if(root&&root.gradeHtml){var toUpdate=[];if(root.updateShortcuts){toUpdate=root.updateShortcuts}toUpdate.push(itemid);for(var i=0;i<toUpdate.length;i++){itemid=toUpdate[i];var div=Ext.get(itemid+"_"+this.playerId+"_grade");if(div){if(!Ext.isEmpty(root.gradeHtml)&&root.gradeHtml.indexOf("<span>&nbsp;</span>")==-1){var offset=0;if(Ext.isIE){offset=-2}offset-=4;div.update('<div class="x-tree-col-text x-tree-grade" style="height:'+this.scoreColumnHeight+"px;margin-top:-2px;margin-left:"+offset+'px">'+root.gradeHtml+"</div>")}else{div.update("")}}else{this.updateGradeHtml(this.CourseItems,itemid,root.gradeHtml)}}}}},updateGradeHtml:function(A,D,C){if(Ext.isEmpty(A)){return false}for(var B=0;B<A.length;B++){if(A[B].id==D){A[B].gradeHtml=C;return true}if(!Ext.isEmpty(A[B].children)){if(this.updateGradeHtml(A[B].children,D,C)){return true}}}return false},recordBookmark:function(){if(this.enrollmentId==this.sectionId||this.enrollmentId==this.courseId||!this.showToc||this.readOnly){return }if(this.itemInfo!=null&&this.itemInfo.logicalId!=null){var A='<sequence suspended="'+this.itemInfo.logicalId+'"/>';Ext.Ajax.request({url:this.appRoot+"/Learn/ScormData.ashx",params:{action:"postbookmark",courseid:this.courseId,sectionid:this.sectionId,enrollmentid:this.enrollmentId,data:A}})}},Log:function(A){if(this._DataDebug){console.log(A)}},Initialize:function(A){this.Log("Initialize('"+A+"')");var B;if(Ext.isObject(A)){B=""}else{B=A;A={}}if(B!=null&&B.length>0){this.lastError="201";return"false"}if(this.sessionState==ScormState.StateRunning){this.lastError="103";return"false"}if(this.sessionState==ScormState.StateTerminated){this.lastError="104";return"false"}this.InitializeData();this.LoadData();this.sessionState=ScormState.StateRunning;this.lastError="0";if(A.callback){this.initializeCallback.defer(1,A.scope||window,[A,true,new XMLHttpRequest()])}return"true"},Terminate:function(C){this.Log("Terminate('"+C+"')");if(C!=null&&C.length>0){this.lastError="201";return"false"}if(this.sessionState==ScormState.StateNotInitialized){this.lastError="112";return"false"}if(this.sessionState==ScormState.StateTerminated){this.lastError="113";return"false"}var B=false;var A="";if(this.dataModel.containsKey("cmi.exit")){A=this.dataModel.get("cmi.exit")}switch(A){case"suspend":this.dataModel.get("cmi.entry").Value="resume";break;case"logout":this.requestOnTerminate="suspendAll";this.argOnTerminate=null;this.dataModel.get("cmi.entry").Value="resume";B=true;break;case"time-out":this.requestOnTerminate="exitAll";this.argOnTerminate=null;this.dataModel.get("cmi.entry").Value="";B=true;break;default:if(this.requestOnTerminate=="suspendAll"){B=true;this.dataModel.get("cmi.entry").Value="resume"}else{this.dataModel.get("cmi.entry").Value=""}break}this.recordItemTimeSpent();this.Commit("");this.sessionState=ScormState.StateTerminated;if(!Ext.isEmpty(this.requestOnTerminate)){switch(this.requestOnTerminate){case"continue":this.navNext();break;case"previous":this.navPrev();break;case"choice":if(!Ext.isEmpty(this.argOnTerminate)){this.navToItem(this.argOnTerminate)}break;case"exit":case"exitAll":case"abandon":case"abandonAll":case"suspendAll":this.navExit();break;default:break}}if(B&&!this.version12){this.navExit()}if(this.requestOnTerminate=="abandon"||this.needsResetData){this.ResetData()}this.lastError="0";this.requestOnTerminate="";this.argOnTerminate=null;return"true"},setLoaded:function(){this.bhVars.loaded=true},getBrainHoneyValue:function(A){this.lastError="0";switch(A){case"bh.domain_id":return this.bhVars.domainId;case"bh.domain_name":return this.bhVars.domainName;case"bh.user_id":return this.bhVars.userId;case"bh.username":return this.bhVars.userName;case"bh.userspace":return this.bhVars.userSpace;case"bh.user_display":return this.userDisplayName||"";case"bh.user_first":return this.bhVars.userFirst||"";case"bh.user_last":return this.bhVars.userLast||"";case"bh.user_rights":return this.bhVars.userRights||"";case"bh.enrollment_id":return this.enrollmentId||"";case"bh.enrollment_first":return this.bhVars.enrollmentFirst||"";case"bh.enrollment_last":return this.bhVars.enrollmentLast||"";case"bh.enrollment_username":return this.bhVars.enrollmentUser||"";case"bh.enrollment_rights":return this.bhVars.enrollmentRights||"";case"bh.course_id":return this.courseId||"";case"bh.course_name":return this.bhVars.courseName||"";case"bh.section_id":return this.sectionId||"";case"bh.section_name":return this.bhVars.sectionName;case"bh.item_id":return this.itemId||"";case"bh.item_duedate":if(this.itemInfo!=null&&!Ext.isEmpty(this.itemInfo.itemDuedate)){return this.itemInfo.itemDuedate}else{return""}case"bh.item_name":if(this.itemInfo!=null&&!Ext.isEmpty(this.itemInfo.title)){return this.itemInfo.title}else{return""}case"bh.loaded":return !!this.bhVars.loaded;default:this.lastError="401";return""}},GetValue:function(C){this.Log("GetValue('"+C+"')");if(Ext.isEmpty(C)){this.lastError="301";return"false"}if(this.startsWith(C,"bh.")&&!this.startsWith(C,"bh.custom.")){return this.getBrainHoneyValue(C)}if(this.sessionState==ScormState.StateNotInitialized){this.lastError="122";return"false"}if(this.sessionState==ScormState.StateTerminated){this.lastError="123";return"false"}var B="";if(this.version12){B=C;if(B=="cmi.core.lesson_status"){C="cmi.success_status"}else{C=this.ConvertScorm12Name(C)}}if(C.indexOf(".")==-1){this.lastError="401";return""}if(this.startsWith(C,"adl.nav.request_valid.")){return this.GetNavRequestValid(C)}if(this.startsWith(C,"cmi.comments_from_learner.")){return this.GetCommentsFromLearnerValue(C)}if(this.startsWith(C,"cmi.comments_from_lms.")){return this.GetCommentsFromLmsValue(C)}if(this.startsWith(C,"cmi.objectives.")){return this.GetObjectiveValue(C)}if(this.startsWith(C,"cmi.interactions.")){return this.GetInteractionValue(C)}if(this.endsWith(C,"._count")){this.lastError="1001";return""}if(this.endsWith(C,"._children")&&C!="cmi.learner_preference._children"&&C!="cmi.score._children"&&(!this.version12||C!="cmi._children")){this.lastError="1000";return""}if(!this.dataModel.containsKey(C)){this.lastError="401";return""}var A=this.dataModel.get(C);if(A.ReadStautus==ScormStatus.StatusWriteOnly){this.lastError="405";return""}else{var D=A.Value;if(C=="cmi.completion_status"){D=this.GetCompletionStatus(D)}else{if(C=="cmi.success_status"){D=this.GetSuccessStatus(D)}}if(B=="cmi.core.lesson_status"){if(D==null||D=="unknown"){A=this.dataModel.get("cmi.completion_status");D=A.Value;D=this.GetCompletionStatus(D)}}this.lastError="0";if(D==null){if(this.contains(C,".score.")||C=="cmi.location"||C=="cmi.suspend_data"||C=="cmi.max_time_allowed"||C=="cmi.progress_measure"||C=="cmi.scaled_passing_score"){this.lastError="403"}D=""}return D}},SetValue:function(A,B){this.Log("SetValue('"+A+", "+B+"')");if(Ext.isEmpty(A)){this.lastError="351";return"false"}if(this.startsWith(A,"bh.")){lastError="404";return"false"}if(this.sessionState==ScormState.StateNotInitialized){this.lastError="132";return"false"}if(this.sessionState==ScormState.StateTerminated){this.lastError="133";return"false"}if(this.version12){if(A=="cmi.core.lesson_status"){switch(B){case"passed":case"failed":case"unknown":A="cmi.success_status";break;case"completed":case"incomplete":case"not attempted":default:A="cmi.completion_status";break}}else{A=this.ConvertScorm12Name(A)}}if(A.indexOf("._children")!=-1||A.indexOf("._count")!=-1){this.lastError="404";return"false"}if(A.indexOf(".")==-1){this.lastError="401";return"false"}if(this.endsWith(A,"._count")){this.lastError="1001";return"false"}if(this.endsWith(A,"._children")){this.lastError="1001";return"false"}if(A=="adl.nav.request"){return this.SetNavRequest(B)}if(this.startsWith(A,"adl.nav.request_valid.")){this.lastError="404";return"false"}if(this.startsWith(A,"cmi.comments_from_learner.")){return this.SetCommentsFromLearnerValue(A,B)}if(this.startsWith(A,"cmi.comments_from_lms.")){return this.SetCommentsFromLmsValue(A,B)}if(this.startsWith(A,"cmi.objectives.")){return this.SetObjectiveValue(A,B)}if(this.startsWith(A,"cmi.interactions.")){return this.SetInteractionValue(A,B)}return this.DoSetValue(A,B)},Commit:function(A){this.Log("Commit('"+A+"')");var B;if(Ext.isObject(A)){B=""}else{B=A}if(B!=null&&B.length>0){this.lastError="201";return"false"}if(this.sessionState==ScormState.StateNotInitialized){this.lastError="142";return"false"}if(this.sessionState==ScormState.StateTerminated){lastError="143";return"false"}if(this.dataNeedsSave()){this.SaveData(A)}this.lastError="0";return"true"},GetLastError:function(){this.Log("GetLastError(): "+this.lastError);return this.lastError},GetErrorString:function(A){this.Log("GetErrorString('"+A+"')");switch(A){case"0":return"Success";case"101":return"General Exception";case"102":return"General Initialization Failure";case"103":return"Already Initialized";case"104":return"Content Instance Terminated";case"111":return"General Termination Failure";case"112":return"Termination Before Initialization";case"113":return"Termination After Termination";case"122":return"Retrieve Data Before Initialization";case"123":return"Retrieve Data After Termination";case"132":return"Store Data Before Initialization";case"133":return"Store Data After Termination";case"142":return"Commit Before Initialization";case"143":return"Commit After Termination";case"201":return"General Argument Error";case"301":return"General Get Failure";case"351":return"General Set Failure";case"391":return"General Commit Failure";case"401":return"Undefined Data Model Element";case"402":return"Unimplemented Data Model Element";case"403":return"Data Model Element Value Not Initialized";case"404":return"Data Model Element Is Read Only";case"405":return"Data Model Element Is Write Only";case"406":return"Data Model Element Type Mismatch";case"407":return"Data Model Element Value Out Of Range";case"408":return"Data Model Dependency Not Established";case"1000":return"Data Model Element Does Not Have Children";case"1001":return"Data Model Element Cannot Have Count";case"1002":return"Data Model Element Collection Set Out Of Order";case"1003":return"Data Model Collection Element Request Out Of Range";case"1004":return"Data Model Element Not Specified";case"1005":return"Unique Identifier Constraint Violated";case"1006":return"Smallest Permitted Maximum Exceeded";case"1007":return"Data Model Element Does Not Have Version"}return"Unknown Error Code"},GetDiagnostic:function(A){this.Log("GetDiagnostic('"+A+"')");var B=this.GetErrorString(A);if(B=="Unknown Error Code"){return""}return B},LMSInitialize:function(A){this.Log("LMSInitialize('"+A+"')");this.version12=true;return this.Initialize(A)},LMSFinish:function(A){this.Log("LMSFinish('"+A+"')");return this.Terminate(A)},LMSGetValue:function(A){var B=this.GetValue(A);this.Log("LMSGetValue('"+A+"') = '"+B+"'");return B},LMSSetValue:function(A,B){this.Log("LMSSetValue('"+A+"', '"+B+"')");if(A=="cmi.core.score.raw"){this.InternalSetValue("cmi.score.min","0");this.InternalSetValue("cmi.score.max","100")}return this.SetValue(A,B)},LMSCommit:function(A){this.Log("LMSCommit('"+A+"')");return this.Commit(A)},LMSGetLastError:function(){this.Log("LMSGetLastError()");return this.GetLastError()},LMSGetErrorString:function(A){this.Log("LMSGetErrorString('"+A+"')");return this.GetErrorString(A)},LMSGetDiagnostic:function(A){this.Log("LMSDiagnostic('"+A+"')");return this.GetDiagnostic(A)},ResetData:function(A){if(this.sessionState==ScormState.StateNotInitialized){return }if(!A&&this.sessionState!=ScormState.StateTerminated){this.needsResetData=true;return }this.Log("ResetData");this.dataModel.clear();this.version12=false;this.dataInitialized=false;this.lastError="0";this.requestOnTerminate="";this.argOnTerminate=null;this.sessionState=ScormState.StateNotInitialized;this.needsResetData=false},InternalSetValue:function(A,B){if(this.dataModel.containsKey(A)){this.dataModel.get(A).Value=B}},InternalGetValue:function(A){if(this.dataModel.containsKey(A)){return this.dataModel.get(A).Value}return""},dataNeedsSave:function(){var B=false;for(i=0;i<this.dataModel.getCount();i++){var A=this.dataModel.get(i);if(A.Value!=A.DefaultValue){B=true;break}}return B},initializeCallback:function(B,C,A){if(B.callback){B.callback.call(B.scope||window,B,C,A)}},getSectionSummaryCallback:function(C,E,B){if(C.agxOptions.callback){var D=null;var A=null;if(!Ext.isEmpty(B.responseText)){A=Ext.util.JSON.decode(B.responseText)}if(!E||A==null||A.success!=true){E=false;D=[]}else{D=A.data||[]}C.agxOptions.callback.call(C.agxOptions.scope||window,C.agxOptions,E,D,B)}},commitCallback:function(B,C,A){if(B.agxOptions.callback){B.agxOptions.callback.call(B.agxOptions.scope||window,B.agxOptions,C,A)}},SaveData:function(C){if(this.enrollmentId==this.sectionId||this.enrollmentId==this.courseId){return }if(this.readOnly){if(this.itemInfo&&this.itemInfo.allowScoReviewCommit){}else{return }}var D="";if(this.version12){D=D.concat('<data version="1.2">')}else{D=D.concat('<data version="2004">')}for(i=0;i<this.dataModel.getCount();i++){var B=this.dataModel.get(i);if(B.Value!=B.DefaultValue){D=D.concat('<entry name="'+Ext.util.Format.htmlEncode(B.Name)+'" value="'+Ext.util.Format.htmlEncode(B.Value)+'"/>')}}D=D.concat("</data>");var A={url:this.appRoot+"/Learn/ScormData.ashx",params:{action:"postdata",courseid:this.courseId,sectionid:this.sectionId,enrollmentid:this.enrollmentId,itemid:this.lastLogicalId,data:D}};if(C&&C.callback){A.callback=this.commitCallback;A.scope=this;A.agxOptions=C}Ext.Ajax.request(A)},LoadData:function(){if(this.itemInfo!=null&&this.itemInfo.scormData!=null){this.Log("Loading itemInfo.scormData");for(var B=0;B<this.itemInfo.scormData.length;B++){var A=this.itemInfo.scormData[B].name;var C=this.itemInfo.scormData[B].value;if(!Ext.isEmpty(A)){if(A=="cmi.session_time"){continue}if(!this.dataModel.containsKey(A)){if(this.startsWith(A,"cmi.interactions")){this.CreateInteraction(A,true);if(this.contains(A,".objectives.")){this.CreateObjectivesInteraction(A,true)}if(this.contains(A,".correct_responses.")){this.CreateCorrectResponsesInteraction(A,true)}}else{if(this.startsWith(A,"cmi.objectives")){this.CreateObjective(A,true)}else{if(this.startsWith(A,"cmi.comments_from_learner")){this.CreateCommentFromLearner(A,true)}else{if(this.startsWith(A,"cmi.comments_from_lms")){this.CreateCommentFromLms(A,true)}}}}}if(this.dataModel.containsKey(A)){this.dataModel.get(A).Value=C}}}}},InitializeData:function(){if(!this.dataInitialized){this.Log("InitializeData()");this.dataModel.replace("adl.nav.request",new CMIComponent("adl.nav.request","_none_",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi._version",new CMIComponent("cmi._version","1.0",ScormStatus.StatusReadOnly,"CMIIdentifier"));if(this.version12){this.dataModel.replace("cmi._children",new CMIComponent("cmi._children","student_id,student_name,lesson_location,credit,lesson_status,entry,score,total_time,exit,session_time",ScormStatus.StatusReadOnly,"CMIIdentifier"))}this.dataModel.replace("cmi.completion_status",new CMIComponent("cmi.completion_status",(this.version12?"not attempted":""),ScormStatus.StatusBoth,"CMIVocabularyStatus"));var A=null;this.dataModel.replace("cmi.completion_threshold",new CMIComponent("cmi.completion_threshold",A,ScormStatus.StatusReadOnly,"CMIDecimalZeroToOne"));this.dataModel.replace("cmi.credit",new CMIComponent("cmi.credit","credit",ScormStatus.StatusReadOnly,"CMIVocabularyCredit"));this.dataModel.replace("cmi.entry",new CMIComponent("cmi.entry","ab-initio",ScormStatus.StatusReadOnly,"CMIVocabularyEntry"));this.dataModel.replace("cmi.exit",new CMIComponent("cmi.exit","",ScormStatus.StatusWriteOnly,"CMIVocabularyExit"));this.dataModel.replace("cmi.launch_data",new CMIComponent("cmi.launch_data","",ScormStatus.StatusReadOnly,"CMIString4096"));this.dataModel.replace("cmi.learner_id",new CMIComponent("cmi.learner_id",this.enrollmentId,ScormStatus.StatusReadOnly,"CMIIdentifier"));this.dataModel.replace("cmi.learner_name",new CMIComponent("cmi.learner_name",this.userDisplayName,ScormStatus.StatusReadOnly,"CMILocalizedString"));this.dataModel.replace("cmi.learner_preference._children",new CMIComponent("cmi.learner_preference._children","audio_level,language,audio_captioning,delivery_speed",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.learner_preference.audio_level",new CMIComponent("cmi.learner_preference.audio_level","1",ScormStatus.StatusBoth,"CMIDecimalPositive"));this.dataModel.replace("cmi.learner_preference.language",new CMIComponent("cmi.learner_preference.language","",ScormStatus.StatusBoth,"CMILanguage"));this.dataModel.replace("cmi.learner_preference.delivery_speed",new CMIComponent("cmi.learner_preference.delivery_speed","1",ScormStatus.StatusBoth,"CMIDecimalPositive"));this.dataModel.replace("cmi.learner_preference.audio_captioning",new CMIComponent("cmi.learner_preference.audio_captioning","0",ScormStatus.StatusBoth,"CMISInteger"));this.dataModel.replace("cmi.location",new CMIComponent("cmi.location",null,ScormStatus.StatusBoth,"CMIString4096"));var G=null;this.dataModel.replace("cmi.max_time_allowed",new CMIComponent("cmi.max_time_allowed",G,ScormStatus.StatusReadOnly,"CMITimespan"));this.dataModel.replace("cmi.mode",new CMIComponent("cmi.mode","normal",ScormStatus.StatusReadOnly,"CMIVocabularyMode"));this.dataModel.replace("cmi.progress_measure",new CMIComponent("cmi.progress_measure",null,ScormStatus.StatusBoth,"CMIDecimalZeroToOne"));var C=Number.NaN;this.dataModel.replace("cmi.scaled_passing_score",new CMIComponent("cmi.scaled_passing_score",(isNaN(C))?null:C.toString(),ScormStatus.StatusReadOnly,"CMIDecimalMinusOneToOne"));this.dataModel.replace("cmi.score._children",new CMIComponent("cmi.score._children","scaled,min,max,raw",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.score.scaled",new CMIComponent("cmi.score.scaled",null,ScormStatus.StatusBoth,"CMIDecimalMinusOneToOne"));this.dataModel.replace("cmi.score.raw",new CMIComponent("cmi.score.raw",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));this.dataModel.replace("cmi.score.max",new CMIComponent("cmi.score.max",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));this.dataModel.replace("cmi.score.min",new CMIComponent("cmi.score.min",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));this.dataModel.replace("cmi.session_time",new CMIComponent("cmi.session_time","",ScormStatus.StatusWriteOnly,"CMITimespan"));this.dataModel.replace("cmi.success_status",new CMIComponent("cmi.success_status","",ScormStatus.StatusBoth,"CMIVocabularyStatus"));this.dataModel.replace("cmi.suspend_data",new CMIComponent("cmi.suspend_data",null,ScormStatus.StatusBoth,"CMIString4096"));this.dataModel.replace("cmi.time_limit_action",new CMIComponent("cmi.time_limit_action","continue,no message",ScormStatus.StatusReadOnly,"CMIVocabularyTimeLimitAction"));var E="PT0H0M0S";if(this.version12){E="00:00:00"}this.dataModel.replace("cmi.total_time",new CMIComponent("cmi.total_time",E,ScormStatus.StatusReadOnly,"CMITimespan"));this.dataModel.replace("cmi.comments_from_learner._children",new CMIComponent("cmi.comments_from_learner._children","comment,location,timestamp",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.comments_from_learner._count",new CMIComponent("cmi.comments_from_learner._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));this.dataModel.replace("cmi.comments_from_lms._children",new CMIComponent("comments_from_lms._children","comment,location,timestamp",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.comments_from_lms._count",new CMIComponent("cmi.comments_from_lms._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));this.dataModel.replace("cmi.objectives._children",new CMIComponent("cmi.objectives._children","id,score,success_status,completion_status,description,progress_measure",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.objectives._count",new CMIComponent("cmi.objectives._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));var B="cmi.objectives.0.id";this.CreateObjective(B,false);this.dataModel.replace("cmi.interactions._children",new CMIComponent("cmi.interactions._children","id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace("cmi.interactions._count",new CMIComponent("cmi.interactions._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));if(this.itemInfo.customFields!=null){for(var D=0;D<this.itemInfo.customFields.length;D++){var B=this.itemInfo.customFields[D][0];var F=this.itemInfo.customFields[D][1];if(!Ext.isEmpty(B)){B="bh.custom."+B;this.dataModel.replace(B,new CMIComponent(B,F,ScormStatus.StatusReadOnly,"CMIString4096"))}}}this.dataInitialized=true}},StringToTimeSpan:function(A){if(this.version12){return this.SCORM12DurationToCs(A)}return this.ISODurationToCentisec(A)},TimeSpantoString:function(A){if(this.version12){return this.centisecsToSCORM12Duration(A)}return this.centisecsToISODuration(A,false)},centisecsToISODuration:function(n,bPrecise){var str="P";var nCs=n;var nY=0,nM=0,nD=0,nH=0,nMin=0,nS=0;n=Math.max(n,0);var nCs=n;with(Math){nCs=round(nCs);if(bPrecise==true){nD=floor(nCs/8640000)}else{nY=floor(nCs/3155760000);nCs-=nY*3155760000;nM=floor(nCs/262980000);nCs-=nM*262980000;nD=floor(nCs/8640000)}nCs-=nD*8640000;nH=floor(nCs/360000);nCs-=nH*360000;var nMin=floor(nCs/6000);nCs-=nMin*6000}if(nY>0){str+=nY+"Y"}if(nM>0){str+=nM+"M"}if(nD>0){str+=nD+"D"}if((nH>0)||(nMin>0)||(nCs>0)){str+="T";if(nH>0){str+=nH+"H"}if(nMin>0){str+=nMin+"M"}if(nCs>0){str+=(nCs/100)+"S"}}if(str=="P"){str="PT0H0M0S"}return str},ISODurationToCentisec:function(F){var D=new Array(0,0,0,0,0,0);var B=false;var E=false;if(F.indexOf("P")!=0){B=true}if(!B){var G=new Array("Y","M","D","H","M","S");var C=0,A=0;F=F.substr(1);for(A=0;A<G.length;A++){if(F.indexOf("T")==0){F=F.substr(1);A=Math.max(A,3);E=true}C=F.indexOf(G[A]);if(C>-1){if((A==1)&&(F.indexOf("T")>-1)&&(F.indexOf("T")<C)){continue}if(G[A]=="S"){D[A]=parseFloat(F.substr(0,C))}else{D[A]=parseInt(F.substr(0,C))}if(isNaN(D[A])){B=true;break}else{if((A>2)&&(!E)){B=true;break}}F=F.substr(C+1)}}if((!B)&&(F.length!=0)){B=true}}if(B){return }return D[0]*3155760000+D[1]*262980000+D[2]*8640000+D[3]*360000+D[4]*6000+Math.round(D[5]*100)},SCORM12DurationToCs:function(E){var A=E.split(":");var B=0,F=0;var D=1;var C=((A.length<2)||(A.length>3));if(!C){for(i=A.length-1;i>=0;i--){F=parseFloat(A[i]);if(isNaN(F)){C=true;break}B+=F*D;D*=60}}if(C){alert("Incorrect format: "+E+"\n\nFormat must be [HH]HH:MM:SS[.SS]");return NaN}return Math.round(B*100)},centisecsToSCORM12Duration:function(n){var bTruncated=false;with(Math){n=round(n);var nH=floor(n/360000);var nCs=n-nH*360000;var nM=floor(nCs/6000);nCs=nCs-nM*6000;var nS=floor(nCs/100);nCs=nCs-nS*100}if(nH>9999){nH=9999;bTruncated=true}var str="0000"+nH+":";str=str.substr(str.length-5,5);if(nM<10){str+="0"}str+=nM+":";if(nS<10){str+="0"}str+=nS;if(nCs>0){str+=".";if(nCs<10){str+="0"}str+=nCs}return str},ConvertScorm12Name:function(A){if(!this.version12){return A}var B=A;switch(A){case"cmi.core.student_id":B="cmi.learner_id";break;case"cmi.core.student_name":B="cmi.learner_name";break;case"cmi.core.lesson_location":B="cmi.location";break;case"cmi.core.lesson_mode":B="cmi.mode";break;case"cmi.core.lesson_status":B="cmi.success_status";break;case"cmi.comments":B="cmi.comments_from_learner.0.comment";break;case"cmi.student_data.mastery_score":B="cmi.scaled_passing_score";break;case"cmi.student_preference.audio":B="cmi.learner_preference.audio_level";break;case"cmi.student_preference.speed":B="cmi.learner_preference.delivery_speed";break;case"cmi.student_preference.text":B="cmi.learner_preference.audio_captioning";break}if(B.indexOf(".core.")>=0){B=B.replace(".core","")}if(B.indexOf(".student_data.")>=0){B=B.replace(".student_data","")}if(B.indexOf(".student_preference.")>=0){B=B.replace(".student_preference.",".learner_preference.")}if(this.startsWith(B,"cmi.objectives.")&&this.endsWith(B,".status")){B.replace(".status",".completion_status")}if(this.startsWith(B,"cmi.interactions.")){if(this.endsWith(B,".time")){B+="stamp"}else{if(this.endsWith(B,".student_response")){B=B.replace(".student_",".learner_")}}}return B},startsWith:function(B,A){return(B.indexOf(A)==0)},endsWith:function(B,A){return(B.indexOf(A)==Math.max(0,(B.length-A.length)))},contains:function(B,A){return(B.indexOf(A)>=0)},DoSetValue:function(B,E){if(!this.dataModel.containsKey(B)){this.lastError="401";return"false"}var A=this.dataModel.get(B);if(A.ReadStautus==ScormStatus.StatusReadOnly){this.lastError="404";return"false"}else{var C=A.DataType;if(this.CheckDataTypeAndVocab(B,E,C)){if(C=="CMIDecimalZeroToOne"){var D=Number(E);if(isNaN(D)||D<0||D>1){this.lastError="407";return"false"}}if(C=="CMIDecimalMinusOneToOne"){var D=Number(E);if(isNaN(D)||D<-1||D>1){this.lastError="407";return"false"}}if(C=="CMIDecimalPositive"){var D=Number(E);if(isNaN(D)||D<0){this.lastError="407";return"false"}}A.Value=E;this.lastError="0";return"true"}else{this.lastError="406";return"false"}}},GetNavRequestValid:function(A){var B=A.substr("adl.nav.request_valid.".length);if(B=="continue"){this.lastError="0";return true}if(B=="previous"){this.lastError="0";return true}if(this.startsWith(B,"choice.{target=")){this.lastError="0";return true}this.lastError="401";return""},SetNavRequest:function(A){this.requestOnTerminate="";this.argOnTerminate=null;switch(A){case"continue":case"previous":case"exit":case"exitAll":case"abandon":case"abandonAll":case"suspendAll":this.requestOnTerminate=A;break;case"_none_":break;default:if(this.endsWith(A,"choice")){this.requestOnTerminate="choice";if(this.startsWith(A,"{target=")){this.argOnTerminate=A.substr(0,A.indexOf("}")).substr("{target=".length)}}else{this.lastError="406";return"false"}break}this.lastError="0";this.InternalSetValue("adl.nav.request",A);return"true"},GetCommentsFromLearnerValue:function(A){if(A=="cmi.comments_from_learner._children"||A=="cmi.comments_from_learner._count"){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidCommentsFromLearnerIndex(A,false)){this.lastError="301";return""}if(this.dataModel.containsKey(A)){this.lastError="0";var B=this.dataModel.get(A).Value;if(B==null){if(this.endsWith(A,".comment")){this.lastError="301"}else{if(this.endsWith(A,".location")||this.endsWith(A,".timestamp")){this.lastError="403"}}B=""}return B}this.lastError="401";return""},SetCommentsFromLearnerValue:function(A,B){if(this.contains(A,"._children")||this.contains(A,"._count")){this.lastError="404";return"false"}if(!this.IsValidCommentsFromLearnerIndex(A,true)){this.lastError="351";return"false"}return this.DoSetValue(A,B)},IsValidCommentsFromLearnerIndex:function(B,C){var F=B;if(this.startsWith(B,"cmi.comments_from_learner.")){F=B.substr("cmi.comments_from_learner.".length)}var G=F.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var E="cmi.comments_from_learner."+G[0]+".";var D=Number(this.dataModel.get("cmi.comments_from_learner._count").Value);if(A>D-1){if(A==D&&(C||this.version12)){this.CreateCommentFromLearner(B,false);return true}else{return false}}else{if(A>=0){if(this.dataModel.get(B)==null&&this.version12){this.CreateCommentFromLearner(B,true)}return true}}}return false},CreateCommentFromLearner:function(B,F){var E=B;if(this.startsWith(B,"cmi.comments_from_learner.")){E=B.substr("cmi.comments_from_learner.".length)}var G=E.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var D="cmi.comments_from_learner."+G[0]+".";var C=Number(this.dataModel.get("cmi.comments_from_learner._count").Value);if(A>C-1||F){if(A==C||F){this.dataModel.replace(D+"comment",new CMIComponent(D+"comment",(this.version12?"":null),ScormStatus.StatusBoth,"CMILocalizedString"));this.dataModel.replace(D+"location",new CMIComponent(D+"location",null,ScormStatus.StatusBoth,"CMIString255"));this.dataModel.replace(D+"timestamp",new CMIComponent(D+"timestamp",null,ScormStatus.StatusBoth,"CMITime"));if(A>C-1){this.dataModel.get("cmi.comments_from_learner._count").Value=(A+1).toString()}}}}},GetCommentsFromLmsValue:function(A){if(A=="cmi.comments_from_lms._children"||A=="cmi.comments_from_lms._count"){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidCommentsFromLmsIndex(A,false)){this.lastError="301";return""}if(this.dataModel.containsKey(A)){this.lastError="0";var B=this.dataModel.get(A).Value;if(B==null){if(this.endsWith(A,".comment")||this.endsWith(A,".location")||this.endsWith(A,".timestamp")){this.lastError="403"}B=""}return B}this.lastError="401";return""},SetCommentsFromLmsValue:function(A,B){if(this.contains(A,"._children")||this.contains(A,"._count")){this.lastError="404";return"false"}if(!this.IsValidCommentsFromLmsIndex(A,true)){this.lastError="351";return"false"}return this.DoSetValue(A,B)},IsValidCommentsFromLmsIndex:function(B,C){var F=B;if(this.startsWith(B,"cmi.comments_from_lms.")){F=B.substr("cmi.comments_from_lms.".length)}var G=F.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var E="cmi.comments_from_lms."+G[0]+".";var D=Number(this.dataModel.get("cmi.comments_from_lms._count").Value);if(A>D-1){if(A==D&&C){this.CreateCommentFromLms(B,false);return true}else{return false}}else{if(A>=0){return true}}}return false},CreateCommentFromLms:function(B,F){var E=B;if(this.startsWith(B,"cmi.comments_from_lms.")){E=B.substr("cmi.comments_from_lms.".length)}var G=E.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var D="cmi.comments_from_lms."+G[0]+".";var C=Number(this.dataModel.get("cmi.comments_from_lms._count").Value);if(A>C-1||F){if(A==C||F){this.dataModel.replace(D+"comment",new CMIComponent(D+"comment",null,ScormStatus.StatusReadOnly,"CMILocalizedString"));this.dataModel.replace(D+"location",new CMIComponent(D+"location",null,ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace(D+"timestamp",new CMIComponent(D+"timestamp",null,ScormStatus.StatusReadOnly,"CMITime"));if(A>C-1){this.dataModel.get("cmi.comments_from_lms._count").Value=(A+1).toString()}}}}},GetObjectiveValue:function(A){if(A=="cmi.objectives._children"||A=="cmi.objectives._count"){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidObjectiveIndex(A,false)){this.lastError="301";return""}if(this.dataModel.containsKey(A)){var B=this.dataModel.get(A).Value;this.lastError="0";if(B==null){if(this.contains(A,".score.")||this.endsWith(A,".progress_measure")||this.endsWith(A,".description")){this.lastError="403"}else{if(this.endsWith(A,".id")){this.lastError="301"}}B=""}return B}this.lastError="401";return""},SetObjectiveValue:function(D,G){if(this.contains(D,"._children")||this.contains(D,"._count")){this.lastError="404";return"false"}if(!this.IsValidObjectiveIndex(D,true)){this.lastError="351";return"false"}if(this.contains(D,".score.")){var H=D.substr(0,D.indexOf(".score."))+".id";if(!this.dataModel.containsKey(H)||Ext.isEmpty(this.dataModel.get(H).Value)){this.lastError="408";return"false"}}if(this.endsWith(D,".success_status")||this.endsWith(D,".completion_status")){var H=D.substr(0,D.lastIndexOf("."))+".id";if(!this.dataModel.containsKey(H)||Ext.isEmpty(this.dataModel.get(H).Value)){this.lastError="408";return"false"}}if(this.endsWith(D,".id")){var C=0;var F="cmi.objectives.";var A=F+C.toString()+".id";while(this.dataModel.containsKey(A)){if(A==D){var E=this.dataModel.get(D).Value;if(!Ext.isEmpty(E)&&E!=G){this.lastError="351";return"false"}}else{if(this.dataModel.get(A).Value==G){this.lastError="351";return"false"}}C++;A=F+C.toString()+".id"}}var B="CMIDecimalOrCMIBlank";if(this.endsWith(D,".id")){B="CMIIdentifier"}else{if(this.endsWith(D,".success_status")||this.endsWith(D,".completion_status")){B="CMIVocabularyStatus"}else{if(this.endsWith(D,".description")){B="CMILocalizedString"}else{if(this.endsWith(D,".progress_measure")){B="CMIString255"}else{if(this.endsWith(D,".score.scaled")){B="CMIDecimalMinusOneToOne"}}}}}if(!this.CheckDataTypeAndVocab(D,G,B)){this.lastError="406";return"false"}this.CreateObjective(D,false);return this.DoSetValue(D,G)},IsValidObjectiveIndex:function(B,C){var F=B;if(this.startsWith(B,"cmi.objectives.")){F=B.substr("cmi.objectives.".length)}var G=F.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var E="cmi.objectives."+G[0]+".";var D=Number(this.dataModel.get("cmi.objectives._count").Value);if(A>D-1){if(A==D&&C){return true}else{return false}}else{if(A>=0){return true}}}return false},CreateObjective:function(B,F){var E=B;if(this.startsWith(B,"cmi.objectives.")){E=B.substr("cmi.objectives.".length)}var G=E.split(".");if(G.length>1){var A=Number(G[0]);if(!isNaN(A)){var D="cmi.objectives."+G[0]+".";var C=Number(this.dataModel.get("cmi.objectives._count").Value);if(A>C-1||F){if(A==C||F){this.dataModel.replace(D+"id",new CMIComponent(D+"id",null,ScormStatus.StatusBoth,"CMIIdentifier"));this.dataModel.replace(D+"success_status",new CMIComponent(D+"success_status","unknown",ScormStatus.StatusBoth,"CMIVocabularyStatus"));this.dataModel.replace(D+"completion_status",new CMIComponent(D+"completion_status","unknown",ScormStatus.StatusBoth,"CMIVocabularyStatus"));this.dataModel.replace(D+"description",new CMIComponent(D+"description",null,ScormStatus.StatusBoth,"CMILocalizedString"));this.dataModel.replace(D+"progress_measure",new CMIComponent(D+"progress_measure",null,ScormStatus.StatusBoth,"CMIDecimalZeroToOne"));this.dataModel.replace(D+"score._children",new CMIComponent(D+"score._children","scaled,min,max,raw",ScormStatus.StatusReadOnly,"CMIString255"));this.dataModel.replace(D+"score.scaled",new CMIComponent(D+"score.scaled",null,ScormStatus.StatusBoth,"CMIDecimalMinusOneToOne"));this.dataModel.replace(D+"score.raw",new CMIComponent(D+"score.raw",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));this.dataModel.replace(D+"score.max",new CMIComponent(D+"score.max",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));this.dataModel.replace(D+"score.min",new CMIComponent(D+"score.min",null,ScormStatus.StatusBoth,"CMIDecimalOrCMIBlank"));if(A>C-1){this.dataModel.get("cmi.objectives._count").Value=(A+1).toString()}}}}}},GetInteractionValue:function(A){if(A=="cmi.interactions._children"||A=="cmi.interactions._count"){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidInteractionIndex(A,false)){this.lastError="301";return""}if(this.contains(A,".correct_responses.")){return this.GetCorrectResponsesInteractionValue(A)}if(this.contains(A,".objectives.")){return this.GetObjectivesInteractionValue(A)}if(this.dataModel.containsKey(A)){this.lastError="0";var B=this.dataModel.get(A).Value;if(B==null){if(this.endsWith(A,".type")||this.endsWith(A,".timestamp")||this.endsWith(A,".learner_response")||this.endsWith(A,".result")||this.endsWith(A,".latency")||this.endsWith(A,".description")||this.endsWith(A,".weighting")){this.lastError="403"}B=""}return B}this.lastError="401";return""},SetInteractionValue:function(A,C){if(this.contains(A,"._children")||this.contains(A,"._count")){this.lastError="404";return"false"}if(!this.IsValidInteractionIndex(A,true)){this.lastError="351";return"false"}if(this.contains(A,".correct_responses.")){return this.SetCorrectResponsesInteractionValue(A,C)}if(this.contains(A,".objectives.")){return this.SetObjectivesInteractionValue(A,C)}if(this.endsWith(A,".type")||this.endsWith(A,".timestamp")||this.endsWith(A,".timestamp")||this.endsWith(A,".result")||this.endsWith(A,".latency")||this.endsWith(A,".description")||this.endsWith(A,".weighting")){var D=A.substr(0,A.lastIndexOf("."))+".id";if(!this.dataModel.containsKey(D)||Ext.isEmpty(this.dataModel.get(D).Value)){this.lastError="408";return"false"}}else{if(this.endsWith(A,".learner_response")){var D=A.substr(0,A.lastIndexOf("."))+".id";if(!this.dataModel.containsKey(D)||Ext.isEmpty(this.dataModel.get(D).Value)){this.lastError="408";return"false"}var B=A.substr(0,A.lastIndexOf("."))+".type";if(!this.dataModel.containsKey(B)||Ext.isEmpty(this.dataModel.get(B).Value)){this.lastError="408";return"false"}}}this.CreateInteraction(A,false);return this.DoSetValue(A,C)},IsValidInteractionIndex:function(B,C){var F=B;if(this.startsWith(B,"cmi.interactions.")){F=B.substr("cmi.interactions.".length)}var G=F.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var E="cmi.interactions."+G[0]+".";var D=Number(this.dataModel.get("cmi.interactions._count").Value);if(A>D-1){if(A==D&&C){return true}else{return false}}else{if(A>=0){return true}}}return false},CreateInteraction:function(B,F){var E=B;if(this.startsWith(B,"cmi.interactions.")){E=B.substr("cmi.interactions.".length)}var G=E.split(".");if(G.length>1){var A=Number(G[0]);if(isNaN(A)){return false}var D="cmi.interactions."+G[0]+".";var C=Number(this.dataModel.get("cmi.interactions._count").Value);if(A==C||F){if(!this.dataModel.containsKey(D+"id")){this.dataModel.replace(D+"id",new CMIComponent(D+"id","",ScormStatus.StatusBoth,"CMIIdentifier"));this.dataModel.replace(D+"type",new CMIComponent(D+"type",null,ScormStatus.StatusBoth,"CMIVocabularyInteraction"));this.dataModel.replace(D+"timestamp",new CMIComponent(D+"timestamp",null,ScormStatus.StatusBoth,"CMITime"));this.dataModel.replace(D+"weighting",new CMIComponent(D+"weighting",null,ScormStatus.StatusBoth,"CMIDecimal"));this.dataModel.replace(D+"learner_response",new CMIComponent(D+"learner_response",null,ScormStatus.StatusBoth,"CMIFeedback"));this.dataModel.replace(D+"result",new CMIComponent(D+"result",null,ScormStatus.StatusBoth,"CMIVocabularyResult"));this.dataModel.replace(D+"latency",new CMIComponent(D+"latency",null,ScormStatus.StatusBoth,"CMITimespan"));this.dataModel.replace(D+"description",new CMIComponent(D+"description",null,ScormStatus.StatusBoth,"CMILocalizedString"));this.dataModel.replace(D+"displaytype",new CMIComponent(D+"displaytype",null,ScormStatus.StatusBoth,"CMIString4096"));this.dataModel.replace(D+"tag",new CMIComponent(D+"tag",null,ScormStatus.StatusBoth,"CMIString4096"));this.dataModel.replace(D+"objectives._count",new CMIComponent(D+"objectives._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));this.dataModel.replace(D+"correct_responses._count",new CMIComponent(D+"correct_responses._count","0",ScormStatus.StatusReadOnly,"CMIInteger"));if(A>C-1){this.dataModel.get("cmi.interactions._count").Value=(A+1).toString()}}}}},GetObjectivesInteractionValue:function(A){if(this.endsWith(A,".objectives._count")){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidObjectivesInteractionIndex(A,false)){this.lastError="301";return""}if(this.dataModel.containsKey(A)){var B=this.dataModel.get(A).Value;this.lastError="0";if(B==null){if(this.endsWith(A,".id")){this.lastError="301"}B=""}return B}this.lastError="401";return""},SetObjectivesInteractionValue:function(C,E){if(this.endsWith(C,".objectives._count")){this.lastError="404";return"false"}if(!this.IsValidObjectivesInteractionIndex(C,true)){this.lastError="351";return"false"}if(this.contains(C,".objectives.")&&this.endsWith(C,".id")){var F=C.substr(0,C.indexOf(".objectives."))+".id";if(!this.dataModel.containsKey(F)||Ext.isEmpty(this.dataModel.get(F).Value)){this.lastError="408";return"false"}var B=0;var D=C.substr(0,C.indexOf(".objectives."))+".objectives.";var A=D+B.toString()+".id";while(this.dataModel.containsKey(A)){if(A!=C){if(this.dataModel.get(A).Value==E){this.lastError="351";return"false"}}B++;A=D+B.toString()+".id"}}this.CreateObjectivesInteraction(C,false);return this.DoSetValue(C,E)},IsValidObjectivesInteractionIndex:function(C,D){var G=C;if(this.startsWith(C,"cmi.interactions.")){G=C.substr("cmi.interactions.".length)}var H=G.split(".");if(H.length>3&&H[1]=="objectives"){var A=Number(H[0]);var B=Number(H[2]);if(isNaN(B)||isNaN(A)){return false}var F="cmi.interactions."+H[0]+".objectives."+H[2]+".";var E=0;if(this.dataModel.containsKey("cmi.interactions."+H[0]+".objectives._count")){E=Number(this.dataModel.get("cmi.interactions."+H[0]+".objectives._count").Value)}if(B>E-1){if(B==E&&D){return true}else{return false}}else{if(B>=0){return true}}}return false},CreateObjectivesInteraction:function(C,G){var F=C;if(this.startsWith(C,"cmi.interactions.")){F=C.substr("cmi.interactions.".length)}var H=F.split(".");if(H.length>3&&H[1]=="objectives"){var A=Number(H[0]);var B=Number(H[2]);if(isNaN(B)||isNaN(A)){return false}var E="cmi.interactions."+H[0]+".objectives."+H[2]+".";if(!this.dataModel.containsKey("cmi.interactions."+H[0]+".objectives._count")){this.CreateInteraction(C,G)}var D=Number(this.dataModel.get("cmi.interactions."+H[0]+".objectives._count").Value);if(B>D-1||G){if(B==D||G){this.dataModel.replace(E+"id",new CMIComponent(E+"id",null,ScormStatus.StatusBoth,"CMIIdentifier"));if(B>D-1){this.dataModel.get("cmi.interactions."+H[0]+".objectives._count").Value=(B+1).toString()}}}}},GetCorrectResponsesInteractionValue:function(A){if(this.endsWith(A,".correct_responses._count")){this.lastError="0";return this.dataModel.get(A).Value}if(!this.IsValidCorrectResponsesInteractionIndex(A,false)){this.lastError="301";return""}if(this.dataModel.containsKey(A)){var B=this.dataModel.get(A).Value;this.lastError="0";if(B==null){if(this.endsWith(A,".pattern")){this.lastError="301"}B=""}return B}this.lastError="401";return""},SetCorrectResponsesInteractionValue:function(D,G){if(this.endsWith(D,".correct_responses._count")){this.lastError="404";return"false"}if(!this.IsValidCorrectResponsesInteractionIndex(D,true)){this.lastError="351";return"false"}if(this.contains(D,".correct_responses.")&&this.endsWith(D,".pattern")){var H=D.substr(0,D.indexOf(".correct_responses."))+".id";if(!this.dataModel.containsKey(H)||Ext.isEmpty(this.dataModel.get(H).Value)){this.lastError="408";return"false"}var E=D.substr(0,D.indexOf(".correct_responses."))+".type";if(!this.dataModel.containsKey(E)||Ext.isEmpty(this.dataModel.get(E).Value)){this.lastError="408";return"false"}var B=this.GetValue(E);switch(B){case"true-false":case"likert":case"numeric":case"other":var C=Number(D.split(".")[4]);if(isNaN(C)||C!=0){this.lastError="351";return"false"}break;case"choice":case"multiple-choice":case"sequencing":var C=0;var F=D.substr(0,D.indexOf(".correct_responses."))+".correct_responses.";var A=F+C.toString()+".pattern";while(this.dataModel.containsKey(A)){if(A!=D){if(this.dataModel.get(A).Value==G){this.lastError="351";return"false"}}C++;A=F+C.toString()+".pattern"}break}if(!this.CheckDataTypeAndVocab(D,G,"CMIFeedback")){this.lastError="406";return"false"}}this.CreateCorrectResponsesInteraction(D,false);return this.DoSetValue(D,G)},IsValidCorrectResponsesInteractionIndex:function(C,D){var G=C;if(this.startsWith(C,"cmi.interactions.")){G=C.substr("cmi.interactions.".length)}var H=G.split(".");if(H.length>3&&H[1]=="correct_responses"){var A=Number(H[0]);var B=Number(H[2]);if(isNaN(B)||isNaN(A)){return false}var F="cmi.interactions."+H[0]+".correct_responses."+H[2]+".";var E=0;if(this.dataModel.containsKey("cmi.interactions."+H[0]+".correct_responses._count")){E=Number(this.dataModel.get("cmi.interactions."+H[0]+".correct_responses._count").Value)}if(B>E-1){if(B==E&&D){return true}else{return false}}else{if(B>=0){return true}}}return false},CreateCorrectResponsesInteraction:function(C,G){var F=C;if(this.startsWith(C,"cmi.interactions.")){F=C.substr("cmi.interactions.".length)}var H=F.split(".");if(H.length>3&&H[1]=="correct_responses"){var A=Number(H[0]);var B=Number(H[2]);if(isNaN(B)||isNaN(A)){return false}var E="cmi.interactions."+H[0]+".correct_responses."+H[2]+".";if(!this.dataModel.containsKey("cmi.interactions."+H[0]+".correct_responses._count")){this.CreateInteraction(C,G)}var D=Number(this.dataModel.get("cmi.interactions."+H[0]+".correct_responses._count").Value);if(B>D-1||G){if(B==D||G){this.dataModel.replace(E+"pattern",new CMIComponent(E+"pattern",null,ScormStatus.StatusBoth,"CMIFeedback"));if(B>D-1){this.dataModel.get("cmi.interactions."+H[0]+".correct_responses._count").Value=(B+1).toString()}}}}},GetCompletionStatus:function(E){var C=this.InternalGetValue("cmi.completion_threshold");if(Ext.isEmpty(C)){return Ext.isEmpty(E)?"unknown":E}var B=this.InternalGetValue("cmi.progress_measure");if(Ext.isEmpty(B)){return"unknown"}var D=Number(B);var A=Number(C);if(!isNaN(D)&&!isNaN(A)){if(D>=A){return"completed"}else{return"incomplete"}}return E},GetSuccessStatus:function(A){var E=this.GetValue("cmi.scaled_passing_score");if(Ext.isEmpty(E)){return Ext.isEmpty(A)?"unknown":A}var D=this.GetValue("cmi.score.scaled");if(Ext.isEmpty(D)){return"unknown"}var B=Number(E);var C=Number(D);if(!isNaN(B)&&!isNaN(C)){if(C>=B){return"passed"}else{return"failed"}}return A},CheckDataTypeAndVocab:function(A,C,B){switch(B){case"CMIBlank":return this.CheckCMIBlank(C);case"CMIBoolean":return this.CheckCMIBoolean(C);case"CMIDecimalZeroToOne":case"CMIDecimalMinusOneToOne":case"CMIDecimalPositive":case"CMIDecimal":return this.CheckCMIDecimal(C);case"CMIFeedback":return this.CheckCMIFeedback(A,C);case"CMIIdentifier":return this.CheckCMIIdentifier(C);case"CMIInteger":return this.CheckCMIInteger(C);case"CMISInteger":return this.CheckCMISInteger(A,C);case"CMIString255":return this.CheckCMIString255(C);case"CMIString4096":return this.CheckCMIString4096(C);case"CMITime":return this.CheckCMITime(C);case"CMITimespan":return this.CheckCMITimespan(C);case"CMIVocabularyCredit":return this.CheckCMIVocabularyCredit(C);case"CMIVocabularyStatus":return this.CheckCMIVocabularyStatus(A,C);case"CMIVocabularyEntry":return this.CheckCMIVocabularyEntry(C);case"CMIVocabularyMode":return this.CheckCMIVocabularyMode(C);case"CMIVocabularyExit":return this.CheckCMIVocabularyExit(C);case"CMIVocabularyTimeLimitAction":return this.CheckCMIVocabularyTimeLimitAction(C);case"CMIVocabularyInteraction":return this.CheckCMIVocabularyInteraction(C);case"CMIVocabularyResult":return this.CheckCMIVocabularyResult(C);case"CMIDecimalOrCMIBlank":return this.CheckCMIDecimalOrCMIBlank(C);case"CMILocalizedString":return this.CheckCMILocalizedString(C);case"CMILanguage":return this.CheckCMILanguage(C);default:return true}},CheckCMILanguage:function(D){if(Ext.isEmpty(D)){return true}var C=D.split("-");if(C.length<1){return false}if(C[0].length!=2&&C[0].length!=3&&C[0]!="i"&&C[0]!="x"){return false}if(C[0]!="i"&&C[0]!="x"){var B="ab,aa,af,ak,sq,am,ar,an,hy,as,av,ae,ay,az,bm,ba,eu,be,bn,bh,bi,nb,bs,br,bg,my,es,ca,ch,ce,ny,zh,za,cu,cv,kw,co,cr,hr,cs,da,dv,nl,dz,en,eo,et,ee,fo,fj,fi,nl,fr,fy,ff,gd,gl,lg,ka,de,ki,el,kl,gn,gu,ht,ha,he,hz,hi,ho,hu,is,io,ig,id,ia,ie,iu,ik,ga,it,ja,jv,kl,kn,kr,ks,kk,km,ki,rw,ky,kv,kg,ko,kj,ku,kj,lo,la,lv,lb,li,ln,lt,lu,lb,mk,mg,ms,ml,mt,gv,mi,mr,mh,mo,mn,na,nv,nd,nr,ng,ne,se,nd,no,nb,nn,ny,nn,oc,oj,cu,or,om,os,os,pi,pa,fa,pl,pt,oc,pa,ps,qu,rm,ro,rn,ru,sm,sg,sa,sc,gd,sr,sn,ii,sd,si,sk,sl,so,st,nr,es,su,sw,ss,sv,tl,ty,tg,ta,tt,te,th,bo,ti,to,ts,tn,tr,tk,tw,ug,uk,ur,uz,ca,ve,vi,vo,wa,cy,wo,xh,yi,yo,za,zu,";var A="abk,ace,ach,ada,ady,ady,aar,afh,afr,afa,aka,akk,alb,sqi,ale,alg,tut,amh,apa,ara,arg,arc,arp,arn,arw,arm,hye,art,asm,ast,ath,aus,map,ava,ave,awa,aym,aze,ast,ban,bat,bal,bam,bai,bad,bnt,bas,bak,baq,eus,btk,bej,bel,bem,ben,ber,bho,bih,bik,byn,bin,bis,byn,nob,bos,bra,bre,bug,bul,bua,bur,mya,cad,car,spa,cat,cau,ceb,cel,cai,chg,cmc,cha,che,chr,nya,chy,chb,nya,chi,zho,chn,chp,cho,zha,chu,chk,chv,nwc,nwc,cop,cor,cos,cre,mus,and,crp,cpe,cpf,cpp,crh,crh,scr,hrv,cus,cze,ces,dak,dan,dar,day,del,din,div,doi,dgr,dra,dua,dut,nld,dum,dyu,dzo,efi,egy,eka,elx,eng,enm,ang,myv,epo,est,ewe,ewo,fan,fat,fao,fij,fil,fin,fiu,fon,fre,fra,frm,fro,fry,fur,ful,gaa,gla,glg,lug,gay,gba,gez,geo,kat,ger,deu,nds,gmh,goh,gem,kik,gil,gon,gor,got,grb,grc,gre,ell,grn,guj,gwi,hai,hat,hat,hau,haw,heb,her,hil,him,hin,hmo,hit,hmn,hun,hup,iba,ice,isl,ido,ibo,ijo,ilo,smn,inc,ine,ind,inh,ina,ile,iku,ipk,ira,gle,mga,sga,iro,ita,jpn,jav,jrb,jpr,kbd,kab,kac,kal,xal,kam,kan,kau,krc,kaa,kar,kas,csb,kaw,kaz,kha,khm,khi,kho,kik,kmb,kin,kir,tlh,kom,kon,kok,kor,kos,kpe,kro,kua,kum,kur,kru,kut,kua,lad,lah,lam,lao,lat,lav,ltz,lez,lim,lim,lim,lin,lit,jbo,dsb,loz,lub,lua,lui,smj,lun,luo,ltz,lus,mac,mkd,mad,mag,mai,mak,mlg,may,msa,mal,mlt,mnc,mdr,man,mni,mno,glv,mao,mri,mar,chm,mah,mwr,mas,myn,men,mic,min,mwl,mis,moh,mdf,mol,mkh,lol,mon,mos,mul,mun,nah,nau,nav,nde,nbl,ndo,nap,new,nep,new,nia,nic,ssa,niu,nog,non,nai,sme,nde,nor,nob,nno,nub,nym,nya,nyn,nno,nyo,nzi,oci,oji,chu,nwc,ori,orm,osa,oss,oto,pal,pau,pli,pam,pag,pan,pap,paa,per,fas,peo,phi,phn,fil,pon,pol,por,pra,oci,pro,pan,pus,que,roh,raj,rap,rar,roa,rum,ron,rom,run,rus,sal,sam,smi,smo,sad,sag,san,sat,srd,sas,sco,gla,sel,sem,scc,srp,srr,shn,sna,iii,scn,sid,sgn,bla,snd,sin,sit,sio,sms,den,sla,slo,slk,slv,sog,som,son,snk,wen,nso,sot,sai,sma,nbl,spa,suk,sux,sun,sus,swa,ssw,swe,syr,tgl,tah,tai,tgk,tmh,tam,tat,tel,ter,tet,tha,tib,bod,tig,tir,tem,tiv,tlh,tli,tpi,tkl,tog,ton,tsi,tso,tsn,tum,tup,tur,ota,tuk,tvl,tyv,twi,udm,uga,uig,ukr,umb,und,hsb,urd,uzb,vai,cat,ven,vie,vol,vot,wak,wal,wln,war,was,wel,cym,wol,xho,sah,yao,yap,yid,yor,ypk,znd,zap,zen,zha,zul,zun,";if(C[0].length==2&&!this.contains(B,C[0].toLowerCase()+",")){return false}if(C[0].length==3&&!this.contains(A,C[0].toLowerCase()+",")){return false}}if(C.length>1){var E=D.substr(D.indexOf("-")+1);while(!Ext.isEmpty(E)&&E[0]=="("){E=E.substr(1)}while(!Ext.isEmpty(E)&&E[E.length-1]==")"){E=E.substr(0,Math.max(0,E.length-2))}if(E.length<2||E.length>8){return false}}return true},CheckCMILocalizedString:function(D){var B=D;if(this.startsWith(D,"{lang=")){var A=D.indexOf("}");if(A!=-1){var C=D.substr(0,A).substr("{lang=".length);B=D.substr(A+1);if(Ext.isEmpty(C)){return false}if(!this.CheckCMILanguage(C)){return false}}}return this.CheckCMIString4096(B)},CheckCMIDecimalOrCMIBlank:function(D){var A=this.CheckCMIBlank(D);var C=this.CheckCMIDecimal(D);if(A==true||C==true){var B=Number(D);if(!isNaN(B)&&(B>100||B<0)){return false}else{return true}}else{return false}},CheckCMIVocabularyResult:function(B){var A=this.CheckCMIDecimal(B);if(A==true){return true}if(B=="correct"||B=="incorrect"||B=="unanticipated"||B=="neutral"){return true}else{return(this.version12&&B=="wrong")}},CheckCMIVocabularyInteraction:function(A){if(A=="true-false"||A=="multiple-choice"||A=="choice"||A=="fill-in"||A=="long-fill-in"||A=="matching"||A=="other"||A=="performance"||A=="likert"||A=="sequencing"||A=="numeric"){return true}else{return false}},CheckCMIVocabularyTimeLimitAction:function(A){if(A=="exit,message"||A=="exit,no message"||A=="continue,message"||A=="continue,no message"){return true}else{return false}},CheckCMIVocabularyExit:function(A){if(A=="time-out"||A=="suspend"||A=="logout"||A=="normal"||A==""){return true}else{return false}},CheckCMIVocabularyMode:function(A){if(A=="normal"||A=="review"||A=="browse"){return true}else{return false}},CheckCMIVocabularyEntry:function(A){if(A=="ab-initio"||A=="resume"||A==""){return true}else{return false}},CheckCMIVocabularyStatus:function(A,B){if(B=="passed"||B=="completed"||B=="failed"||B=="incomplete"||B=="unknown"||B=="not attempted"){return true}else{if(this.version12){return(B=="browsed")}return false}},CheckCMIVocabularyCredit:function(A){if(A=="credit"||A=="no-credit"){return true}else{return false}},CheckCMITimespan:function(H){if(this.version12){return this.Check12Timespan(H)}if(Ext.isEmpty(H)||!this.startsWith(H,"P")){return false}H=H.substr(1);var G=H.split("T");if(G.length<1||G.length>2){return false}var C=G[0];var E="";if(G.length>1){E=G[1];if(Ext.isEmpty(E)){return false}}var B="";var F;var D;D=C.indexOf("Y");if(D!=-1){B=C.substr(0,D);F=Number(B);if(Ext.isEmpty(B)||isNaN(F)||F<0){return false}C=C.substr(D+1)}D=C.indexOf("M");if(D!=-1){B=C.substr(0,D);F=Number(B);if(Ext.isEmpty(B)||isNaN(F)||F<0){return false}C=C.substr(D+1)}D=C.indexOf("D");if(D!=-1){B=C.substr(0,D);F=Number(B);if(Ext.isEmpty(B)||isNaN(F)||F<0){return false}C=C.substr(D+1)}if(!Ext.isEmpty(C)){return false}if(!Ext.isEmpty(E)){D=E.indexOf("H");if(D!=-1){B=E.substr(0,D);F=Number(B);if(Ext.isEmpty(B)||isNaN(F)||F<0){return false}E=E.substr(D+1)}D=E.indexOf("M");if(D!=-1){B=E.substr(0,D);F=Number(B);if(Ext.isEmpty(B)||isNaN(F)||F<0){return false}E=E.substr(D+1)}D=E.indexOf("S");if(D!=-1){B=E.substr(0,D);if(Ext.isEmpty(B)){return false}var A=B.split(".");if(A.length<1||A.length>2){return false}F=Number(A[0]);if(isNaN(F)||F<0){return false}if(A.length>1){F=Number(A[1]);if(isNaN(F)||F<0||A[1].length>2){return false}}}}return true},Check12Timespan:function(D){if(Ext.isEmpty(D)||!this.contains(D,":")){return false}var C=D.split(":");if(C.length!=3||Ext.isEmpty(C[0])||Ext.isEmpty(C[1])||Ext.isEmpty(C[2])){return false}var B;B=Number(C[0]);if(C[0].length>4||isNaN(B)||B<0){return false}B=Number(C[1]);if(C[1].length!=2||isNaN(B)||B<0||B>59){return false}var A=C[2].split(".");if(A.length<1||A.length>2){return false}B=Number(A[0]);if(A[0].length!=2||isNaN(B)||B<0||B>59){return false}if(A.length>1){B=Number(A[1]);if(A[1].length<1||A[1].length>2||isNaN(B)||B<0){return false}}return true},CheckCMITime:function(B){if(this.version12){return this.Check12Timespan(B)}if(Ext.isEmpty(B)){return false}var G=B.split("T");if(G.length>2){return false}var D=G[0];var C="";if(G.length>1){C=G[1];if(Ext.isEmpty(C)){return false}}var K=D.split("-");if(K.length<1||K.length>3){return false}var F;F=Number(K[0]);if(K[0].length!=4||isNaN(F)||F<1970||F>2038){return false}if(K.length>1){F=Number(K[1]);if(K[1].length!=2||isNaN(F)||F<1||F>12){return false}}if(K.length>2){F=Number(K[2]);if(K[2].length!=2||isNaN(F)||F<1||F>31){return false}}if(!Ext.isEmpty(C)){var J=C.split(":");if(J.length<1||J.length>4){return false}F=Number(J[0]);if(J[0].length!=2||isNaN(F)||F<0||F>23){return false}if(J.length>1){F=Number(J[1]);if(J[1].length!=2||isNaN(F)||F<0||F>59){return false}}if(J.length>2){var L=J[2].split(".");if(L.length<1||L.length>2){return false}F=Number(L[0]);if(L[0].length!=2||isNaN(F)||F<0||F>59){return false}if(L.length>1){var A=L[1];if(J.length>3){A+=":"+J[3]}if(this.endsWith(A,"Z")){A=A.substr(0,A.length-1)}var E="";var I=-1;if(this.contains(A,"+")){I=A.indexOf("+")}else{if(this.contains(A,"-")){I=A.indexOf("-")}}if(I!=-1){E=A.substr(I);A=A.substr(0,I)}F=Number(A);if(A.length<1||A.length>2||isNaN(F)){return false}if(!Ext.isEmpty(E)){if(!this.startsWith(E,"+")&&!this.startsWith(E,"-")){return false}E=E.substr(1);var H=E.split(":");if(H.length<1||H.length>2){return false}F=Number(H[0]);if(H[0].length!=2||isNaN(F)||F<0||F>23){return false}if(H.length>1){F=Number(H[1]);if(H[1].length!=2||isNaN(F)||F<0||F>59){return false}}}}}}return true},CheckCMIString4096:function(A){return true},CheckCMIString255:function(A){return true},CheckCMISInteger:function(B,C){var A=Number(C);if(isNaN(A)){return false}else{if(A>=-32768&&A<=32768){if(B=="cmi.student_preference.audio"){if(A<-1||A>100){return false}else{return true}}else{if(B=="cmi.student_preference.speed"){if(A<-100||A>100){return false}else{return true}}else{if(B=="cmi.student_preference.text"){if(A<-1||A>1){return false}else{return true}}else{return true}}}}else{return false}}},CheckCMIInteger:function(B){var A=Number(B);if(isNaN(A)){return false}else{if(A>=0&&A<=65536){return true}else{return false}}},CheckCMIIdentifier:function(F){var D=" ";var A="\t";var C="\r";var E="\n";if(this.startsWith(F,"urn:")){F=F.substr("urn:".length);var B=F.indexOf(":");if(B==-1){return false}F=F.substr(B+1)}if(F.indexOf(D)==-1&&F.indexOf(A)==-1&&F.indexOf(C)==-1&&F.indexOf(E)==-1){if(F.length>0&&F.length<4000){return true}else{return false}}else{return false}},CheckCMIFeedback:function(A,C){var I=A.split(".");var D=Number(I[2]);if(isNaN(D)){return false}var G=this.GetValue("cmi.interactions._count");var H=Number(G);if(isNaN(H)||D>=H){return false}var B="cmi.interactions."+D+".type";var E=this.GetValue(B);if(Ext.isEmpty(E)){return false}var F=this.endsWith(A,".pattern");switch(E){case"true-false":return this.CheckTrueFalse(C);case"choice":case"multiple-choice":return this.CheckChoice(C);case"fill-in":if(F){return this.CheckFillInPattern(C)}return this.CheckFillIn(C);case"long-fill-in":if(F){return this.CheckLongFillInPattern(C)}return this.CheckLongFillIn(C);case"numeric":if(F){return this.CheckNumericPattern(C)}return this.CheckCMIDecimal(C);case"likert":return this.CheckLikert(C);case"matching":return this.CheckMatching(C);case"performance":if(F){return this.CheckPerformancePattern(C)}return this.CheckPerformance(C);case"sequencing":return this.CheckSequencing(C);case"other":return this.CheckCMIString4096(C);default:return false}},CheckNumericPattern:function(D){if(Ext.isEmpty(D))