diff --git a/src/main/webapp/wise5/authoringTool/node/nodeController.es6 b/src/main/webapp/wise5/authoringTool/node/nodeController.es6 index 162fb82f44..a6e22ad97f 100644 --- a/src/main/webapp/wise5/authoringTool/node/nodeController.es6 +++ b/src/main/webapp/wise5/authoringTool/node/nodeController.es6 @@ -32,7 +32,7 @@ class NodeController { // the array of component types that can be created this.componentTypes = [ - {componentType: 'AudioPlayer', componentName: 'Audio Player'}, + {componentType: 'AudioOscillator', componentName: 'Audio Oscillator'}, {componentType: 'Discussion', componentName: 'Discussion'}, {componentType: 'Draw', componentName: 'Draw'}, {componentType: 'Embedded', componentName: 'Embedded'}, diff --git a/src/main/webapp/wise5/authoringTool/node/nodeController.js b/src/main/webapp/wise5/authoringTool/node/nodeController.js index 7281f42919..c842e5cc2b 100644 --- a/src/main/webapp/wise5/authoringTool/node/nodeController.js +++ b/src/main/webapp/wise5/authoringTool/node/nodeController.js @@ -30,7 +30,7 @@ var NodeController = function () { this.undoStack = []; // the array of component types that can be created - this.componentTypes = [{ componentType: 'AudioPlayer', componentName: 'Audio Player' }, { componentType: 'Discussion', componentName: 'Discussion' }, { componentType: 'Draw', componentName: 'Draw' }, { componentType: 'Embedded', componentName: 'Embedded' }, { componentType: 'Graph', componentName: 'Graph' }, { componentType: 'HTML', componentName: 'HTML' }, { componentType: 'Label', componentName: 'Label' }, { componentType: 'Match', componentName: 'Match' }, { componentType: 'MultipleChoice', componentName: 'Multiple Choice' }, { componentType: 'OpenResponse', componentName: 'Open Response' }, { componentType: 'OutsideURL', componentName: 'Outside URL' }, { componentType: 'Table', componentName: 'Table' }]; + this.componentTypes = [{ componentType: 'AudioOscillator', componentName: 'Audio Oscillator' }, { componentType: 'Discussion', componentName: 'Discussion' }, { componentType: 'Draw', componentName: 'Draw' }, { componentType: 'Embedded', componentName: 'Embedded' }, { componentType: 'Graph', componentName: 'Graph' }, { componentType: 'HTML', componentName: 'HTML' }, { componentType: 'Label', componentName: 'Label' }, { componentType: 'Match', componentName: 'Match' }, { componentType: 'MultipleChoice', componentName: 'Multiple Choice' }, { componentType: 'OpenResponse', componentName: 'Open Response' }, { componentType: 'OutsideURL', componentName: 'Outside URL' }, { componentType: 'Table', componentName: 'Table' }]; // set the drop down to the first item this.selectedComponent = this.componentTypes[0].componentType; diff --git a/src/main/webapp/wise5/authoringTool/node/nodeController.js.map b/src/main/webapp/wise5/authoringTool/node/nodeController.js.map index 6b6f911a74..fae3c2b222 100644 --- a/src/main/webapp/wise5/authoringTool/node/nodeController.js.map +++ b/src/main/webapp/wise5/authoringTool/node/nodeController.js.map @@ -1 +1 @@ -{"version":3,"sources":["nodeController.es6"],"names":[],"mappings":"AAAA;;;;;;;;;;IAEM;AAEF,aAFE,cAEF,CAAY,aAAZ,EACY,SADZ,EAEY,MAFZ,EAGY,MAHZ,EAIY,YAJZ,EAKY,QALZ,EAMY,UANZ,EAOY,aAPZ,EAQY,cARZ,EASY,WATZ,EASyB;8BAXvB,gBAWuB;;AAErB,aAAK,aAAL,GAAqB,aAArB,CAFqB;AAGrB,aAAK,SAAL,GAAiB,SAAjB,CAHqB;AAIrB,aAAK,MAAL,GAAc,MAAd,CAJqB;AAKrB,aAAK,MAAL,GAAc,MAAd,CALqB;AAMrB,aAAK,YAAL,GAAoB,YAApB,CANqB;AAOrB,aAAK,QAAL,GAAgB,QAAhB,CAPqB;AAQrB,aAAK,UAAL,GAAkB,UAAlB,CARqB;AASrB,aAAK,aAAL,GAAqB,aAArB,CATqB;AAUrB,aAAK,cAAL,GAAsB,cAAtB,CAVqB;AAWrB,aAAK,WAAL,GAAmB,WAAnB,CAXqB;AAYrB,aAAK,SAAL,GAAiB,aAAa,SAAb,CAZI;AAarB,aAAK,MAAL,GAAc,aAAa,MAAb,CAbO;AAcrB,aAAK,mBAAL,GAA2B,KAA3B,CAdqB;AAerB,aAAK,iBAAL,GAAyB,IAAzB,CAfqB;AAgBrB,aAAK,QAAL,GAAgB,IAAhB,CAhBqB;AAiBrB,aAAK,SAAL,GAAiB,EAA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L,CAA5C;;;AARQ,8BAWR,CAAK,UAAL,GAAkB,OAAK,cAAL,CAAoB,qBAApB,CAA0C,OAAK,MAAL,CAA5D;;;AAXQ,8BAcR,CAAK,cAAL,CAAoB,WAApB,GAdQ;qBAAZ;iBAL0C,CAA9C,CAHkC;aAA/B;;;;WApNT;;;AA+OL;;AAED,eAAe,OAAf,GAAyB,CAAC,eAAD,EAAkB,WAAlB,EAA+B,QAA/B,EAAyC,QAAzC,EAAmD,cAAnD,EAAmE,UAAnE,EAA+E,YAA/E,EAA6F,eAA7F,EAA8G,gBAA9G,EAAgI,aAAhI,CAAzB;;kBAEe","file":"nodeController.js","sourcesContent":["'use strict';\n\nclass NodeController {\n\n constructor($anchorScroll,\n $location,\n $scope,\n $state,\n $stateParams,\n $timeout,\n $translate,\n ConfigService,\n ProjectService,\n UtilService) {\n\n this.$anchorScroll = $anchorScroll;\n this.$location = $location;\n this.$scope = $scope;\n this.$state = $state;\n this.$stateParams = $stateParams;\n this.$timeout = $timeout;\n this.$translate = $translate;\n this.ConfigService = ConfigService;\n this.ProjectService = ProjectService;\n this.UtilService = UtilService;\n this.projectId = $stateParams.projectId;\n this.nodeId = $stateParams.nodeId;\n this.showCreateComponent = false;\n this.selectedComponent = null;\n this.nodeCopy = null;\n this.undoStack = [];\n\n // the array of component types that can be created\n this.componentTypes = [\n {componentType: 'AudioPlayer', componentName: 'Audio Player'},\n {componentType: 'Discussion', componentName: 'Discussion'},\n {componentType: 'Draw', componentName: 'Draw'},\n {componentType: 'Embedded', componentName: 'Embedded'},\n {componentType: 'Graph', componentName: 'Graph'},\n {componentType: 'HTML', componentName: 'HTML'},\n {componentType: 'Label', componentName: 'Label'},\n {componentType: 'Match', componentName: 'Match'},\n {componentType: 'MultipleChoice', componentName: 'Multiple Choice'},\n {componentType: 'OpenResponse', componentName: 'Open Response'},\n {componentType: 'OutsideURL', componentName: 'Outside URL'},\n {componentType: 'Table', componentName: 'Table'}\n ];\n\n // set the drop down to the first item\n this.selectedComponent = this.componentTypes[0].componentType;\n\n // get the node\n this.node = this.ProjectService.getNodeById(this.nodeId);\n\n // get the components in the node\n this.components = this.ProjectService.getComponentsByNodeId(this.nodeId);\n\n /*\n * remember a copy of the node at the beginning of this node authoring\n * session in case we need to roll back if the user decides to\n * cancel/revert all the changes.\n */\n this.originalNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n\n /*\n * remember the current version of the node. this will be updated each\n * time the user makes a change.\n */\n this.currentNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n }\n\n /**\n * Launch VLE with this current step as the initial step\n */\n previewStep() {\n let previewProjectURL = this.ConfigService.getConfigParam(\"previewProjectURL\");\n let previewStepURL = previewProjectURL + \"#/vle/\" + this.nodeId;\n window.open(previewStepURL);\n };\n\n /**\n * Close the node authoring view\n */\n close() {\n this.$state.go('root.project', {projectId: this.projectId});\n };\n\n /**\n * The author has clicked the cancel button which will revert all\n * the recent changes since they opened the node.\n */\n cancel() {\n\n // check if the user has made any changes\n if (!angular.equals(this.node, this.originalNodeCopy)) {\n // the user has made changes\n\n this.$translate('confirmUndo').then((confirmUndo) => {\n var result = confirm(confirmUndo);\n\n if (result) {\n // revert the node back to the previous version\n this.ProjectService.replaceNode(this.nodeId, this.originalNodeCopy);\n\n // save the project\n this.ProjectService.saveProject();\n\n // close the node authoring view\n this.close();\n }\n });\n } else {\n // the user has not made any changes\n\n //close the node authoring view\n this.close();\n }\n }\n\n /**\n * Create a component in this node\n */\n createComponent() {\n\n // create a component and add it to this node\n this.ProjectService.createComponent(this.nodeId, this.selectedComponent);\n\n // save the project\n this.ProjectService.saveProject();\n\n // hide the create component elements\n this.showCreateComponent = false;\n\n // Scroll to the bottom of the page where the new component was added\n this.$timeout(() => {\n this.$location.hash('bottom');\n this.$anchorScroll();\n });\n }\n\n /**\n * Move a component up within this node\n * @param componentId the component id\n */\n moveComponentUp(componentId) {\n\n // move the component up within the node\n this.ProjectService.moveComponentUp(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n\n /**\n * Move a component up within this node\n * @param componentId the component id\n */\n moveComponentDown(componentId) {\n\n // move the component down within the node\n this.ProjectService.moveComponentDown(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n\n /**\n * Delete the component from this node\n * @param componentId the component id\n */\n deleteComponent(componentId) {\n\n this.$translate('confirmDeleteComponent').then((confirmDeleteComponent) => {\n\n // ask the user to confirm the delete\n var answer = confirm(confirmDeleteComponent);\n\n if (answer) {\n // the user confirmed yes\n\n // delete the component from the node\n this.ProjectService.deleteComponent(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n });\n }\n\n /**\n * The node has changed in the authoring view\n */\n authoringViewNodeChanged() {\n // put the previous version of the node on to the undo stack\n this.undoStack.push(this.currentNodeCopy);\n\n // save the project\n this.ProjectService.saveProject();\n\n // update the current node copy\n this.currentNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n }\n\n /**\n * Undo the last change by reverting the node to the previous version\n */\n undo() {\n\n if (this.undoStack.length === 0) {\n // the undo stack is empty so there are no changes to undo\n this.$translate('noUndoAvailable').then((noUndoAvailable) => {\n alert(noUndoAvailable);\n });\n\n } else if (this.undoStack.length > 0) {\n // the undo stack has elements\n\n this.$translate('confirmUndoLastChange').then((confirmUndoLastChange) => {\n\n // ask the user to confirm the delete\n var result = confirm(confirmUndoLastChange);\n\n if (result) {\n // get the previous version of the node\n var nodeCopy = this.undoStack.pop();\n\n // revert the node back to the previous version\n this.ProjectService.replaceNode(this.nodeId, nodeCopy);\n\n // get the node\n this.node = this.ProjectService.getNodeById(this.nodeId);\n\n // get the components in the node\n this.components = this.ProjectService.getComponentsByNodeId(this.nodeId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n });\n }\n }\n};\n\nNodeController.$inject = ['$anchorScroll', '$location', '$scope', '$state', '$stateParams', '$timeout', '$translate', 'ConfigService', 'ProjectService', 'UtilService'];\n\nexport default NodeController;\n"]} \ No newline at end of file +{"version":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hI,CAAzB;;kBAEe","file":"nodeController.js","sourcesContent":["'use strict';\n\nclass NodeController {\n\n constructor($anchorScroll,\n $location,\n $scope,\n $state,\n $stateParams,\n $timeout,\n $translate,\n ConfigService,\n ProjectService,\n UtilService) {\n\n this.$anchorScroll = $anchorScroll;\n this.$location = $location;\n this.$scope = $scope;\n this.$state = $state;\n this.$stateParams = $stateParams;\n this.$timeout = $timeout;\n this.$translate = $translate;\n this.ConfigService = ConfigService;\n this.ProjectService = ProjectService;\n this.UtilService = UtilService;\n this.projectId = $stateParams.projectId;\n this.nodeId = $stateParams.nodeId;\n this.showCreateComponent = false;\n this.selectedComponent = null;\n this.nodeCopy = null;\n this.undoStack = [];\n\n // the array of component types that can be created\n this.componentTypes = [\n {componentType: 'AudioOscillator', componentName: 'Audio Oscillator'},\n {componentType: 'Discussion', componentName: 'Discussion'},\n {componentType: 'Draw', componentName: 'Draw'},\n {componentType: 'Embedded', componentName: 'Embedded'},\n {componentType: 'Graph', componentName: 'Graph'},\n {componentType: 'HTML', componentName: 'HTML'},\n {componentType: 'Label', componentName: 'Label'},\n {componentType: 'Match', componentName: 'Match'},\n {componentType: 'MultipleChoice', componentName: 'Multiple Choice'},\n {componentType: 'OpenResponse', componentName: 'Open Response'},\n {componentType: 'OutsideURL', componentName: 'Outside URL'},\n {componentType: 'Table', componentName: 'Table'}\n ];\n\n // set the drop down to the first item\n this.selectedComponent = this.componentTypes[0].componentType;\n\n // get the node\n this.node = this.ProjectService.getNodeById(this.nodeId);\n\n // get the components in the node\n this.components = this.ProjectService.getComponentsByNodeId(this.nodeId);\n\n /*\n * remember a copy of the node at the beginning of this node authoring\n * session in case we need to roll back if the user decides to\n * cancel/revert all the changes.\n */\n this.originalNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n\n /*\n * remember the current version of the node. this will be updated each\n * time the user makes a change.\n */\n this.currentNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n }\n\n /**\n * Launch VLE with this current step as the initial step\n */\n previewStep() {\n let previewProjectURL = this.ConfigService.getConfigParam(\"previewProjectURL\");\n let previewStepURL = previewProjectURL + \"#/vle/\" + this.nodeId;\n window.open(previewStepURL);\n };\n\n /**\n * Close the node authoring view\n */\n close() {\n this.$state.go('root.project', {projectId: this.projectId});\n };\n\n /**\n * The author has clicked the cancel button which will revert all\n * the recent changes since they opened the node.\n */\n cancel() {\n\n // check if the user has made any changes\n if (!angular.equals(this.node, this.originalNodeCopy)) {\n // the user has made changes\n\n this.$translate('confirmUndo').then((confirmUndo) => {\n var result = confirm(confirmUndo);\n\n if (result) {\n // revert the node back to the previous version\n this.ProjectService.replaceNode(this.nodeId, this.originalNodeCopy);\n\n // save the project\n this.ProjectService.saveProject();\n\n // close the node authoring view\n this.close();\n }\n });\n } else {\n // the user has not made any changes\n\n //close the node authoring view\n this.close();\n }\n }\n\n /**\n * Create a component in this node\n */\n createComponent() {\n\n // create a component and add it to this node\n this.ProjectService.createComponent(this.nodeId, this.selectedComponent);\n\n // save the project\n this.ProjectService.saveProject();\n\n // hide the create component elements\n this.showCreateComponent = false;\n\n // Scroll to the bottom of the page where the new component was added\n this.$timeout(() => {\n this.$location.hash('bottom');\n this.$anchorScroll();\n });\n }\n\n /**\n * Move a component up within this node\n * @param componentId the component id\n */\n moveComponentUp(componentId) {\n\n // move the component up within the node\n this.ProjectService.moveComponentUp(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n\n /**\n * Move a component up within this node\n * @param componentId the component id\n */\n moveComponentDown(componentId) {\n\n // move the component down within the node\n this.ProjectService.moveComponentDown(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n\n /**\n * Delete the component from this node\n * @param componentId the component id\n */\n deleteComponent(componentId) {\n\n this.$translate('confirmDeleteComponent').then((confirmDeleteComponent) => {\n\n // ask the user to confirm the delete\n var answer = confirm(confirmDeleteComponent);\n\n if (answer) {\n // the user confirmed yes\n\n // delete the component from the node\n this.ProjectService.deleteComponent(this.nodeId, componentId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n });\n }\n\n /**\n * The node has changed in the authoring view\n */\n authoringViewNodeChanged() {\n // put the previous version of the node on to the undo stack\n this.undoStack.push(this.currentNodeCopy);\n\n // save the project\n this.ProjectService.saveProject();\n\n // update the current node copy\n this.currentNodeCopy = this.UtilService.makeCopyOfJSONObject(this.node);\n }\n\n /**\n * Undo the last change by reverting the node to the previous version\n */\n undo() {\n\n if (this.undoStack.length === 0) {\n // the undo stack is empty so there are no changes to undo\n this.$translate('noUndoAvailable').then((noUndoAvailable) => {\n alert(noUndoAvailable);\n });\n\n } else if (this.undoStack.length > 0) {\n // the undo stack has elements\n\n this.$translate('confirmUndoLastChange').then((confirmUndoLastChange) => {\n\n // ask the user to confirm the delete\n var result = confirm(confirmUndoLastChange);\n\n if (result) {\n // get the previous version of the node\n var nodeCopy = this.undoStack.pop();\n\n // revert the node back to the previous version\n this.ProjectService.replaceNode(this.nodeId, nodeCopy);\n\n // get the node\n this.node = this.ProjectService.getNodeById(this.nodeId);\n\n // get the components in the node\n this.components = this.ProjectService.getComponentsByNodeId(this.nodeId);\n\n // save the project\n this.ProjectService.saveProject();\n }\n });\n }\n }\n};\n\nNodeController.$inject = ['$anchorScroll', '$location', '$scope', '$state', '$stateParams', '$timeout', '$translate', 'ConfigService', 'ProjectService', 'UtilService'];\n\nexport default NodeController;\n"]} \ No newline at end of file diff --git a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.es6 b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.es6 index 47a748004d..3f600bdea8 100644 --- a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.es6 +++ b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.es6 @@ -16,7 +16,7 @@ class AudioOscillatorService extends NodeService { var component = {}; component.id = this.UtilService.generateKey(); - component.type = 'AudioPlayer'; + component.type = 'AudioOscillator'; component.prompt = 'Enter prompt here'; component.oscillatorTypes = [ 'sine' diff --git a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js index ff5e06f159..93d8b423d6 100644 --- a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js +++ b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js @@ -43,7 +43,7 @@ var AudioOscillatorService = function (_NodeService) { var component = {}; component.id = this.UtilService.generateKey(); - component.type = 'AudioPlayer'; + component.type = 'AudioOscillator'; component.prompt = 'Enter prompt here'; component.oscillatorTypes = ['sine']; component.startingFrequency = 440; diff --git a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js.map b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js.map index b02ab19360..ede2043918 100644 --- a/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js.map +++ b/src/main/webapp/wise5/components/audioOscillator/audioOscillatorService.js.map @@ -1 +1 @@ -{"version":3,"sources":["audioOscillatorService.es6"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;IAEM;;;AACF,aADE,sBACF,CAAY,kBAAZ,EACY,WADZ,EACyB;8BAFvB,wBAEuB;;2EAFvB,oCAEuB;;AAErB,cAAK,kBAAL,GAA0B,kBAA1B,CAFqB;AAGrB,cAAK,WAAL,GAAmB,WAAnB,CAHqB;;KADzB;;;;;;;;iBADE;;0CAYgB;;AAEd,gBAAI,YAAY,EAAZ,CAFU;AAGd,sBAAU,EAAV,GAAe,KAAK,WAAL,CAAiB,WAAjB,EAAf,CAHc;AAId,sBAAU,IAAV,GAAiB,aAAjB,CAJc;AAKd,sBAAU,MAAV,GAAmB,mBAAnB,CALc;AAMd,sBAAU,eAAV,GAA4B,CACxB,MADwB,CAA5B,CANc;AASd,sBAAU,iBAAV,GAA8B,GAA9B,CATc;AAUd,sBAAU,iBAAV,GAA8B,GAA9B,CAVc;AAWd,sBAAU,kBAAV,GAA+B,GAA/B,CAXc;AAYd,sBAAU,YAAV,GAAyB,EAAzB,CAZc;AAad,sBAAU,iBAAV,GAA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FJ;qBAFJ;iBAFJ,MAaO;;AAEH,wBAAI,KAAI,gBAAgB,MAAhB,GAAyB,CAAzB,CAFL;AAGH,wBAAI,iBAAiB,gBAAgB,EAAhB,CAAjB,CAHD;;AAKH,wBAAI,cAAc,eAAe,WAAf,CALf;;AAOH,wBAAI,eAAe,IAAf,EAAqB;AACrB,4BAAI,YAAY,QAAZ,EAAsB;;AAEtB,qCAAS,IAAT,CAFsB;yBAA1B;qBADJ;iBApBJ;aAHJ;;AAgCA,mBAAO,MAAP,CAnCuE;;;;WA7EzE;;;AAqHN,uBAAuB,OAAvB,GAAiC,CAC7B,oBAD6B,EAE7B,aAF6B,CAAjC;;kBAKe","file":"audioOscillatorService.js","sourcesContent":["import NodeService from '../../services/nodeService';\n\nclass AudioOscillatorService extends NodeService {\n constructor(StudentDataService,\n UtilService) {\n super();\n this.StudentDataService = StudentDataService;\n this.UtilService = UtilService;\n }\n\n /**\n * Create a AudioPlayer component object\n * @returns a new AudioPlayer component object\n */\n createComponent() {\n\n var component = {};\n component.id = this.UtilService.generateKey();\n component.type = 'AudioPlayer';\n component.prompt = 'Enter prompt here';\n component.oscillatorTypes = [\n 'sine'\n ];\n component.startingFrequency = 440;\n component.oscilloscopeWidth = 800;\n component.oscilloscopeHeight = 400;\n component.gridCellSize = 50;\n component.stopAfterGoodDraw = true;\n component.showSaveButton = false;\n component.showSubmitButton = false;\n component.starterSentence = null;\n component.isStudentAttachmentEnabled = false;\n\n return component;\n }\n\n /**\n * Populate a component state with the data from another component state\n * @param componentStateFromOtherComponent the component state to obtain the data from\n * @return a new component state that contains the student data from the other\n * component state\n */\n populateComponentState(componentStateFromOtherComponent) {\n var componentState = null;\n\n if (componentStateFromOtherComponent != null) {\n\n // create an empty component state\n componentState = this.StudentDataService.createComponentState();\n\n // get the component type of the other component state\n var otherComponentType = componentStateFromOtherComponent.componentType;\n\n if (otherComponentType === 'AudioPlayer') {\n // the other component is an OpenResponse component\n\n // get the student data from the other component state\n var studentData = componentStateFromOtherComponent.studentData;\n\n // create a copy of the student data\n var studentDataCopy = this.UtilService.makeCopyOfJSONObject(studentData);\n\n // set the student data into the new component state\n componentState.studentData = studentDataCopy;\n }\n }\n\n return componentState;\n };\n\n /**\n * Check if the component was completed\n * @param component the component object\n * @param componentStates the component states for the specific component\n * @param componentEvents the events for the specific component\n * @param nodeEvents the events for the parent node of the component\n * @param node parent node of the component\n * @returns whether the component was completed\n */\n isCompleted(component, componentStates, componentEvents, nodeEvents, node) {\n let result = false;\n\n if (componentStates && componentStates.length) {\n let submitRequired = node.showSubmitButton || (component.showSubmitButton && !node.showSaveButton);\n\n if (submitRequired) {\n // completion requires a submission, so check for isSubmit in any component states\n for (let i = 0, l = componentStates.length; i < l; i++) {\n let state = componentStates[i];\n if (state.isSubmit && state.studentData) {\n // component state is a submission\n if (state.studentData.response) {\n // there is a response so the component is completed\n result = true;\n break;\n }\n }\n }\n } else {\n // get the last component state\n let l = componentStates.length - 1;\n let componentState = componentStates[l];\n\n let studentData = componentState.studentData;\n\n if (studentData != null) {\n if (studentData.response) {\n // there is a response so the component is completed\n result = true;\n }\n }\n }\n }\n\n return result;\n };\n\n}\n\nAudioOscillatorService.$inject = [\n 'StudentDataService',\n 'UtilService'\n];\n\nexport default AudioOscillatorService;\n"]} \ No newline at end of file +{"version":3,"sources":["audioOscillatorService.es6"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;IAEM;;;AACF,aADE,sBACF,CAAY,kBAAZ,EACY,WADZ,EACyB;8BAFvB,wBAEuB;;2EAFvB,oCAEuB;;AAErB,cAAK,kBAAL,GAA0B,kBAA1B,CAFqB;AAGrB,cAAK,WAAL,GAAmB,WAAnB,CAHqB;;KADzB;;;;;;;;iBADE;;0CAYgB;;AAEd,gBAAI,YAAY,EAAZ,CAFU;AAGd,sBAAU,EAAV,GAAe,KAAK,WAAL,CAAiB,WAAjB,EAAf,CAHc;AAId,sBAAU,IAAV,GAAiB,iBAAjB,CAJc;AAKd,sBAAU,MAAV,GAAm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B,EAAwB,IAAI,CAAJ,EAAO,GAAnD,EAAwD;AACpD,4BAAI,QAAQ,gBAAgB,CAAhB,CAAR,CADgD;AAEpD,4BAAI,MAAM,QAAN,IAAkB,MAAM,WAAN,EAAmB;;AAErC,gCAAI,MAAM,WAAN,CAAkB,QAAlB,EAA4B;;AAE5B,yCAAS,IAAT,CAF4B;AAG5B,sCAH4B;6BAAhC;yBAFJ;qBAFJ;iBAFJ,MAaO;;AAEH,wBAAI,KAAI,gBAAgB,MAAhB,GAAyB,CAAzB,CAFL;AAGH,wBAAI,iBAAiB,gBAAgB,EAAhB,CAAjB,CAHD;;AAKH,wBAAI,cAAc,eAAe,WAAf,CALf;;AAOH,wBAAI,eAAe,IAAf,EAAqB;AACrB,4BAAI,YAAY,QAAZ,EAAsB;;AAEtB,qCAAS,IAAT,CAFsB;yBAA1B;qBADJ;iBApBJ;aAHJ;;AAgCA,mBAAO,MAAP,CAnCuE;;;;WA7EzE;;;AAqHN,uBAAuB,OAAvB,GAAiC,CAC7B,oBAD6B,EAE7B,aAF6B,CAAjC;;kBAKe","file":"audioOscillatorService.js","sourcesContent":["import NodeService from '../../services/nodeService';\n\nclass AudioOscillatorService extends NodeService {\n constructor(StudentDataService,\n UtilService) {\n super();\n this.StudentDataService = StudentDataService;\n this.UtilService = UtilService;\n }\n\n /**\n * Create a AudioPlayer component object\n * @returns a new AudioPlayer component object\n */\n createComponent() {\n\n var component = {};\n component.id = this.UtilService.generateKey();\n component.type = 'AudioOscillator';\n component.prompt = 'Enter prompt here';\n component.oscillatorTypes = [\n 'sine'\n ];\n component.startingFrequency = 440;\n component.oscilloscopeWidth = 800;\n component.oscilloscopeHeight = 400;\n component.gridCellSize = 50;\n component.stopAfterGoodDraw = true;\n component.showSaveButton = false;\n component.showSubmitButton = false;\n component.starterSentence = null;\n component.isStudentAttachmentEnabled = false;\n\n return component;\n }\n\n /**\n * Populate a component state with the data from another component state\n * @param componentStateFromOtherComponent the component state to obtain the data from\n * @return a new component state that contains the student data from the other\n * component state\n */\n populateComponentState(componentStateFromOtherComponent) {\n var componentState = null;\n\n if (componentStateFromOtherComponent != null) {\n\n // create an empty component state\n componentState = this.StudentDataService.createComponentState();\n\n // get the component type of the other component state\n var otherComponentType = componentStateFromOtherComponent.componentType;\n\n if (otherComponentType === 'AudioPlayer') {\n // the other component is an OpenResponse component\n\n // get the student data from the other component state\n var studentData = componentStateFromOtherComponent.studentData;\n\n // create a copy of the student data\n var studentDataCopy = this.UtilService.makeCopyOfJSONObject(studentData);\n\n // set the student data into the new component state\n componentState.studentData = studentDataCopy;\n }\n }\n\n return componentState;\n };\n\n /**\n * Check if the component was completed\n * @param component the component object\n * @param componentStates the component states for the specific component\n * @param componentEvents the events for the specific component\n * @param nodeEvents the events for the parent node of the component\n * @param node parent node of the component\n * @returns whether the component was completed\n */\n isCompleted(component, componentStates, componentEvents, nodeEvents, node) {\n let result = false;\n\n if (componentStates && componentStates.length) {\n let submitRequired = node.showSubmitButton || (component.showSubmitButton && !node.showSaveButton);\n\n if (submitRequired) {\n // completion requires a submission, so check for isSubmit in any component states\n for (let i = 0, l = componentStates.length; i < l; i++) {\n let state = componentStates[i];\n if (state.isSubmit && state.studentData) {\n // component state is a submission\n if (state.studentData.response) {\n // there is a response so the component is completed\n result = true;\n break;\n }\n }\n }\n } else {\n // get the last component state\n let l = componentStates.length - 1;\n let componentState = componentStates[l];\n\n let studentData = componentState.studentData;\n\n if (studentData != null) {\n if (studentData.response) {\n // there is a response so the component is completed\n result = true;\n }\n }\n }\n }\n\n return result;\n };\n\n}\n\nAudioOscillatorService.$inject = [\n 'StudentDataService',\n 'UtilService'\n];\n\nexport default AudioOscillatorService;\n"]} \ No newline at end of file