[virtualcommons-svn] SF.net SVN: virtualcommons:[175] mentalmodels/trunk
Status: Beta
Brought to you by:
alllee
|
From: <see...@us...> - 2009-07-10 21:02:32
|
Revision: 175
http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=175&view=rev
Author: seematalele
Date: 2009-07-10 21:02:20 +0000 (Fri, 10 Jul 2009)
Log Message:
-----------
Database initialization working fine. It loads data from database if any. Rename some files. Clean up the folder flex folder. Deleted duplicated files.
Modified Paths:
--------------
mentalmodels/trunk/flex/src/InitialiseDatabase.mxml
mentalmodels/trunk/flex/src/actionscript/Block.as
mentalmodels/trunk/flex/src/actionscript/Module.as
mentalmodels/trunk/flex/src/actionscript/QuestionGroup.as
mentalmodels/trunk/flex/src/custom/db/Block.mxml
mentalmodels/trunk/flex/src/custom/db/Module.mxml
mentalmodels/trunk/flex/src/custom/db/Question.mxml
mentalmodels/trunk/flex/src/custom/db/QuestionGroup.mxml
mentalmodels/trunk/flex/src/custom/db/questions/Categorical.mxml
mentalmodels/trunk/flex/src/custom/db/questions/CategoricalRelative.mxml
mentalmodels/trunk/flex/src/custom/db/questions/CategoricalSimple.mxml
mentalmodels/trunk/flex/src/custom/db/questions/Psychometric.mxml
mentalmodels/trunk/src/main/db/init-mme.sql
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateModuleDao.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Block.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/CategoricalOption.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Game.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Module.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/PsychometricQuestion.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/Question.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/QuestionGroup.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/entity/RoundConfig.java
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/service/QuestionCreatorService.java
mentalmodels/trunk/src/main/webapp/WEB-INF/applicationContext.xml
Added Paths:
-----------
mentalmodels/trunk/flex/src/actionscript/Categorical.as
mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as
mentalmodels/trunk/flex/src/actionscript/Psychometric.as
mentalmodels/trunk/flex/src/actionscript/Question.as
mentalmodels/trunk/src/main/java/edu/asu/commons/mme/dao/HibernateQuestionGroupDao.java
Removed Paths:
-------------
mentalmodels/trunk/flex/src/actionscript/ASCategorical.as
mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as
mentalmodels/trunk/flex/src/actionscript/ASQuestion.as
mentalmodels/trunk/flex/src/actionscript/ASResults.as
Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml
===================================================================
--- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,28 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
-<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.*"
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.db.questions.*" xmlns:basicComp="customComponents.db.*"
backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]"
- width="100%" height="100%" clipContent="false" layout="absolute" currentState="none">
+ width="100%" height="100%" clipContent="false" layout="absolute" currentState="none" initialize="init()">
<mx:Script>
<![CDATA[
+ import mx.binding.utils.BindingUtils;
+ import customComponents.db.questions.Psychometric;
import customComponents.db.questions.CategoricalSimple;
import customComponents.db.questions.CategoricalRelative;
import customComponents.db.questions.Categorical;
+
+ import actionscript.Block;
+ import actionscript.Module;
+ import actionscript.Question;
+ import actionscript.QuestionGroup;
+ import actionscript.Categorical;
+ import actionscript.CategoricalOption;
+
+
import mx.collections.ArrayCollection;
import mx.effects.Fade;
import mx.collections.XMLListCollection;
import mx.controls.Alert;
+ import mx.rpc.events.FaultEvent;
+ import mx.rpc.events.ResultEvent;
- import actionscript.*;
+
/* id field of module, block and questiongroup and questions should come from database,
so when module info is transfered to the server, it should return the id for that module */
- public static var Qid:int = 2;
+ //public static var Qid:int = 2;
+
[Bindable]
- private var company:XML =
- <list>
-
- <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1">
+ private var survey:XML =
+ <list>
+ <module title="Preexperiment" sequenceNo="1" hours="0" min="3" sec="0" id="1">
<block name="Introduction" sequenceNo="1" hours="0" min="3" sec="0" id="1">
<questiongroup header="Welcome to E-Fishery Experiment" description="In this experiment you will design..." sequenceNo="1" id="1"/>
@@ -32,29 +45,295 @@
<module title ="Game Round" sequenceNo="2" hours="1" min="30" sec="0" id="2">
<block name="Characterizing Own Strategy" sequenceNo="1" hours="0" min="30" sec="0" id="2">
<questiongroup header="What goals did you follow when designing your strategy" description="Please specify three goals..." sequenceNo="1" id="2">
- <question title="Most important goal" type="psychometric" sequenceNo="1" id="1">
-
+ <question title="Most important goal" type="categorical" sequenceNo="1" id="1" >
</question>
- <question title="second important goal" type="catgorical" sequenceNo="2" id="2">
- </question>
+ <question title="second important goal" type="psychometric" sequenceNo="2" id="2" >
+ </question>
+
+
</questiongroup>
</block>
- </module>
-
- </list>;
-
+ </module>
+ </list>;
+ /*[Bindable]
+ private var survey:XML =
+ <list>
+ <module title="Survey Questions" />
+ </list>;*/
+
+
+ /*[Bindable]
+ private var questions:XML =
+ <list>
+ <categorical id="1" type="relative">
+ <optionKey name="fish" >
+
+ </optionKey>
+ </categorical>
+ <categorical id="2" type="simple">
+ <optionKey name="poeple" >
+
+ </optionKey>
+ </categorical>
+ <psychometric id="1" scale="bipolar" numberOfIntervals="21">
+
+ </psychometric>
+
+ </list>; */
+
+
+ [Bindable]
+ private var categoricalQuestions:XML =
+ <list>
+ <categorical type="Categorical Questions" id="0"/>
+ <categorical type="relative" id="2">
+ <option name="focus on earning" choice1="less" choice2="more" choice3="most" />
+ <option name="focus on fish" choice1="123" choice2="more than 123" choice3="none" />
+ </categorical>
+ <categorical type="simple" id="1">
+ <option choice1="less" choice2="more" choice3="most" />
+
+ </categorical>
+
+ </list>;
+
+ [Bindable]
+ private var psychometricQuestions:XML =
+ <list>
+ <psychometric scale="Psychometric Questions" id="0"/>
+ <psychometric scale="bipolar" id="2" choice1="good" choice2="better" choice3="best" interval="21" />
+
+
+ </list>;
+
+
[Bindable]
- private var companyData:XMLListCollection = new XMLListCollection(company.module);
+ private var surveyData:XMLListCollection = new XMLListCollection(survey.module);
+
+ private var CategoricalquestionsData:XMLListCollection = new XMLListCollection(categoricalQuestions.categorical);
+
+ private var PsychometricquestionsData:XMLListCollection = new XMLListCollection(psychometricQuestions.psychometric);
- public var tempQuestion:ArrayCollection = new ArrayCollection();
+ public var tempQuestion:ArrayCollection = new ArrayCollection();
+
+ private function init():void
+ {
+ roQuestionCreator.initializeData();
+ }
+
+ private function resultInitializeDataHandler(event:ResultEvent):void
+ {
+ //Alert.show(event.result.toString());
+ var modulelist:ArrayCollection = new ArrayCollection();
+ modulelist = event.result as ArrayCollection;
+
+
+ if(modulelist != null)
+ {
+ for(var i:int = 0 ; i < modulelist.length ; i++)
+ {
+ var module:Module = new Module();
+ module = modulelist[i];
+
+
+ //create module node and add into the tree
+ var newModuleNode:XML = createModuleNode(module);
+
+ survey.appendChild(newModuleNode);
+
+ //if any blocks, add into the module
+ if(module.blocks != null)
+ {
+ for(var blockCounter:int = 0; blockCounter < module.blocks.length; blockCounter++)
+ {
+ var block:Block = new Block();
+ block = module.blocks[blockCounter];
+
+ var newBlockNode:XML = createBlockNode(block);
+ newModuleNode.appendChild(newBlockNode);
+
+
+ if(block.questionGroups != null)
+ {
+ //if any question Group, add into the block
+ for(var qgCounter:int = 0; qgCounter < block.questionGroups.length; qgCounter++)
+ {
+ var qg:QuestionGroup = new QuestionGroup();
+ qg = block.questionGroups[qgCounter];
+
+ var newQuestionGroupNode:XML = createQuestionGroupNode(qg);
+ newBlockNode.appendChild(newQuestionGroupNode);
+ if(qg.questions != null)
+ {
+ for(var QCounter:int = 0; QCounter < qg.questions.length; QCounter++)
+ {
+ var question:Question = new Question();
+ question = qg.questions[QCounter];
+ var newQuestionNode:XML = createQuestionNode(question);
+ newQuestionGroupNode.appendChild(newQuestionNode);
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+
+ private function createModuleNode(module:Module):XML
+ {
+
+
+ var newModuleNode:XML = <module/>;
+ newModuleNode.setLocalName("module");
+ newModuleNode.@title= module.description;
+ newModuleNode.@sequenceNo = module.sequenceNo;
+ newModuleNode.@hours = module.getHours();
+ newModuleNode.@min = module.getMinutes();
+ newModuleNode.@sec = module.getSeconds();
+ newModuleNode.@id = module.id;
+
+
+ return newModuleNode;
+
+ }
+ private function createBlockNode(block:Block):XML
+ {
+ var newBlockNode:XML = <block/>;
+ newBlockNode.setLocalName("block");
+ newBlockNode.@name = block.description;
+ newBlockNode.@sequenceNo = block.sequenceNo;
+ newBlockNode.@hours = block.getHours();
+ newBlockNode.@min = block.getMinutes();
+ newBlockNode.@sec = block.getSeconds();
+ newBlockNode.@id = block.id;
+
+ return newBlockNode;
+
+ }
+
+ private function createQuestionGroupNode(questionGroup:QuestionGroup):XML
+ {
+ var newNode:XML = <questiongroup/>;
+ newNode.setLocalName("questiongroup");
+ newNode.@header = questionGroup.header;
+ newNode.@description = questionGroup.description;
+ newNode.@sequenceNo = questionGroup.sequenceNo;
+ newNode.@id = questionGroup.id;
+
+ return newNode;
+
+ }
+
+ private function createQuestionNode(question:Question):XML
+ {
+ var newQNode:XML = <question/>;
+ newQNode.setLocalName("question");
+ if(question.type.toLowerCase() == "psychometric")
+ {
+ var psychometricResult:Psychometric = Psychometric(question);
+ Alert.show("Id is: " + psychometricResult.id);
+ Alert.show("Question is: " + psychometricResult.question);
+ Alert.show("Type is: " + psychometricResult.type);
+ Alert.show("SeQNo is: " + psychometricResult.sequenceNo);
+
+ var newPNode:XML = <psychometric/>;
+ newPNode.setLocalName("psychometric");
+ newPNode.@id = psychometricResult.id;
+ newPNode.@scale = psychometricResult.scale;
+ newPNode.@noOfInterval = psychometricResult.maxSliderValue;
+
+ newQNode.@sequenceNo = psychometricResult.sequenceNo;
+ newQNode.@title = psychometricResult.question;
+ newQNode.@type = psychometricResult.type;
+ newQNode.@id = psychometricResult.id;
+
+
+ for(var j:int = 0; j < psychometricResult.choices.length; j++)
+ {
+ var str:String = "choice";
+ str = str + j;
+ newPNode.@str = psychometricResult.choices[j];
+ }
+
+ psychometricQuestions.appendChild(newPNode);
+
+ }
+ else if(question.type.toLowerCase() == "categorical")
+ {
+ var categoricalResult:Categorical = Categorical(question);
+
+ newQNode.@sequenceNo = categoricalResult.sequenceNo;
+ newQNode.@title = categoricalResult.question;
+ newQNode.@type = categoricalResult.type;
+ newQNode.@id = categoricalResult.id;
+ /*var questionGroup:XMLList =survey.module.block.questiongroup.(@header == node.@header);
+
+ if( questionGroup.length() > 0 )
+ {
+ questionGroup[0].appendChild(newQNode);
+ currentState = "none";
+ btnsaveQuestion.enabled = false;
+ }*/
+
+ var newCNode:XML = <categorical/>;
+ newCNode.setLocalName("categorical");
+ newCNode.@id = categoricalResult.id;
+ categoricalQuestions.appendChild(newCNode);
+
+ for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++)
+ {
+ var options:CategoricalOption = new CategoricalOption();
+ options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i));
+ var newOptionNode:XML = <option/>;
+ newOptionNode.setLocalName("option");
+ newOptionNode.@name = options.optionKey;
+ if(options.choices.length <= 0)
+ {
+ newCNode.@type = "simple";
+
+ }
+ else
+ {
+ newCNode.@type = "relative";
+ for(var k:int = 0; k < options.choices.length; k++)
+ {
+ var choice:String = "choice";
+ choice = choice + k;
+ newOptionNode.@choice = options.choices[k];
+ }
+ }
+
+ /*var module:XMLList = survey.module.(@id == tempmodule.id);
+ if( module.length() > 0 )
+ {
+ module[0].appendChild(newBlockNode);
+ }*/
+ newCNode.appendChild(newOptionNode);
+ }
+
+
+ }
+ return newQNode;
+
+ }
+
+ private function faultHandler(event:FaultEvent):void
+ {
+ Alert.show("event fault is " + event.fault.getStackTrace());
+ }
+
private function treeLabel(item:Object):String
{
-
var node:XML = XML(item);
if( node.localName() == "module" )
@@ -73,17 +352,43 @@
return null;
}
-
+ private function treeLabelPsychometricQ(item:Object):String
+ {
+ var node:XML = XML(item);
+
+ if( node.localName() == "psychometric" )
+ return node.@scale;
+
+ else
+ return node.@name;
+
+ }
+
+ private function treeLabelCategoricalQ(item:Object):String
+ {
+ var node:XML = XML(item);
+
+ if( node.localName() == "categorical" )
+ return node.@type;
+
+
+ else
+ return node.@name;
+
+ }
+
public function isDurationValid(hours:Number,minutes:Number,seconds:Number):Boolean
{
return (hours == 0 && minutes == 0 && seconds == 0);
}
+ //Module Functionality Start
private function addModule():void
{
currentState = "module";
var obj:DisplayObject = pnlComponent.getChildAt(1);
+
var moduleInfo:Module = Module(obj);
moduleInfo.reset();
btnsaveModule.enabled = true;
@@ -91,7 +396,7 @@
btnsaveBlock.enabled = false;
btnsaveQuestionGroup.enabled = false;
btnsaveQuestion.enabled = false;
-
+
}
private function saveModule(event:Event):void
@@ -110,18 +415,17 @@
}
else
{
- var newNode:XML = <module/>
- newNode.setLocalName("module");
- newNode.@title=moduleInfo.getName();
- newNode.@sequenceNo =moduleInfo.getSequenceNo();
- newNode.@hours = moduleInfo.getHours();
- newNode.@min = moduleInfo.getMinutes();
- newNode.@sec = moduleInfo.getSeconds();
- company.appendChild(newNode);
+ var title:String = moduleInfo.getName();
+ var seqNo:int = int(moduleInfo.getSequenceNo());
+ if(moduleInfo.getId() == 0)
+ {
+ roQuestionCreator.saveModule(seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds()));
+ }
+ else
+ roQuestionCreator.updateModule(moduleInfo.getId(),seqNo, title, getDuration(moduleInfo.getHours(),moduleInfo.getMinutes(),moduleInfo.getSeconds()));
currentState = "none";
btnsaveModule.enabled = false;
- // pnlComponent.removeChildAt(1);
-
+ //pnlComponent.removeChildAt(1);
}
}
@@ -132,8 +436,50 @@
}
+ private function getDuration(hours:int,min:int,sec:int):int
+ {
+ return hours * 3600 + min * 60 + sec;
+ }
-
+ //when module is created, the result will come to resultSaveModuleHandler
+ public function resultSaveModuleHandler(event:ResultEvent):void
+ {
+ var module:Module = Module(event.result as Object);
+ Alert.show("Id is: " + module.id);
+ var newModuleNode:XML = <module/>;
+ newModuleNode.setLocalName("module");
+ newModuleNode.@title= module.description;
+ newModuleNode.@sequenceNo = module.sequenceNo;
+ newModuleNode.@hours = module.getHours();
+ newModuleNode.@min = module.getMinutes();
+ newModuleNode.@sec = module.getSeconds();
+ newModuleNode.@id = module.id;
+ survey.appendChild(newModuleNode);
+ if(surveyData == null)
+ {
+ surveyData= new XMLListCollection(survey.module);
+ }
+
+
+
+ }
+
+ //when module is updated, the result will come to resultUpdateModuleHandler
+ public function resultUpdateModuleHandler(event:ResultEvent):void
+ {
+ var module:Module = Module(event.result as Object);
+ var moduleXML:XMLList = survey.module.(@id == module.id);
+ moduleXML.@title = module.description;
+ moduleXML.@sequenceNo = module.sequenceNo;
+ moduleXML.@hours = module.getHours();
+ moduleXML.@min = module.getMinutes();
+ moduleXML.@sec = module.getSeconds();
+
+ }
+
+ //Module Functionality Stop
+
+ //Block functionality Start
private function addBlock():void
{
currentState = "block";
@@ -144,8 +490,7 @@
btnsaveModule.enabled = false;
btnsaveQuestionGroup.enabled = false;
btnsaveQuestion.enabled = false;
-
-
+
}
private function saveBlock(event:Event):void
@@ -154,53 +499,114 @@
var obj:DisplayObject = pnlComponent.getChildAt(1);
var blockInfo:Block = Block(obj);
- var node:XML = tree.selectedItem as XML;
-
+ var selectedNode:XML = tree.selectedItem as XML;
+ //Alert.show("enter info","",Alert.OK | Alert.);
if(tree.selectedItem == null)
{
Alert.show("Please select the module from tree to which block should be added.");
+ return;
}
else
{
var isBlockFormValid:Boolean = blockInfo.validateForm(event);
+ //Alert.show("Local name is: " + selectedNode.localName());
+
if(isBlockFormValid)
{
var durationflag:Boolean = this.isDurationValid(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds());
if(durationflag)
{
Alert.show("Please enter the valid duration for the given block.");
+ return;
}
- else
+ else
{
- var newNode:XML = <block/>
- newNode.setLocalName("block");
- newNode.@name=blockInfo.getName();
- newNode.@sequenceNo =blockInfo.getSequenceNo();
- newNode.@hours = blockInfo.getHours();
- newNode.@min = blockInfo.getMinutes();
- newNode.@sec = blockInfo.getSeconds();
-
-
- var module:XMLList =company.module.(@title == node.@title);
+
+ var node:XML;
+ if(selectedNode.localName() == "module")
+ {
+ node = selectedNode;
+ }
+ else
+ {
+ var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML;
+ node = parentNode;
+ }
+ var module:XMLList = survey.module.(@title == node.@title);
+ //Alert.show("Module length is : " + module.length());
if( module.length() > 0 )
{
- module[0].appendChild(newNode);
- currentState = "none";
- btnsaveBlock.enabled = false;
-
- }
-
- }
+ // Alert.show("Block id is : " + blockInfo.getId());
+ if(blockInfo.getId() == 0)
+ {
+ roQuestionCreator.saveBlock(int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id));
+ }
+ else
+ {
+ roQuestionCreator.updateBlock(blockInfo.getId(), int(blockInfo.getSequenceNo()),blockInfo.getName(),getDuration(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()),int(module[0].@id));
+ }
+ currentState = "none";
+ btnsaveBlock.enabled = false;
+ // pnlComponent.removeChildAt(1);
+ }
+ }
}
else
{
Alert.show("Please fill the form correctly");
+ return;
}
}
}
+ //when block is created, the result will come to resultSaveBlockHandler
+ public function resultSaveBlockHandler(event:ResultEvent):void
+ {
+ var block:Block = Block(event.result as Object);
+ if(block != null)
+ {
+
+ var newBlockNode:XML = <block/>;
+ newBlockNode.setLocalName("block");
+ newBlockNode.@name = block.description;
+ newBlockNode.@sequenceNo = block.sequenceNo;
+ newBlockNode.@hours = block.getHours();
+ newBlockNode.@min = block.getMinutes();
+ newBlockNode.@sec = block.getSeconds();
+ newBlockNode.@id = block.id;
+ var tempmodule:Module = block.module;
+
+ var module:XMLList = survey.module.(@id == tempmodule.id);
+ if( module.length() > 0 )
+ {
+ module[0].appendChild(newBlockNode);
+ }
+ }
+
+
+ }
+
+ public function resultUpdateBlockHandler(event:ResultEvent):void
+ {
+ var block:Block = Block(event.result as Object);
+
+ var tempmodule:Module = block.module;
+
+ var blockXML:XMLList = survey.module.block.(@id == block.id);
+
+ blockXML.@name = block.description;
+ blockXML.@sequenceNo = block.sequenceNo;
+ blockXML.@hours = block.getHours();
+ blockXML.@min = block.getMinutes();
+ blockXML.@sec = block.getSeconds();
+
+ }
+ //Block functioanlity Stop
+
+
+ //QuestionGroup functionality Start
private function addQuestionGroup():void
{
currentState = "questionGroup";
@@ -217,10 +623,11 @@
private function saveQuestionGroup(event:Event):void
{
-
-
- var node:XML = tree.selectedItem as XML;
-
+
+ var selectedNode:XML = tree.selectedItem as XML;
+ var obj:DisplayObject = pnlComponent.getChildAt(1);
+ var questionGroupInfo:QuestionGroup = QuestionGroup(obj);
+ Alert.show("Question Group Id is: " + questionGroupInfo.getId());
if(tree.selectedItem == null)
{
Alert.show("Please select the block from tree to which Question Group should be added.");
@@ -230,14 +637,14 @@
{
//if(tree.getParentItem(tree.selectedItem) == null)
- if(node.localName() == "module")
+ if(selectedNode.localName() == "module")
{
Alert.show("You can not add QuestionGroup to Module.");
return;
}
else
{
- if(node.localName() == "questiongroup" )
+ if(selectedNode.localName() == "questiongroup" && questionGroupInfo.getId() == 0)
{
Alert.show("You can not add QuestionGroup to QuestionGroup.");
return;
@@ -247,33 +654,90 @@
{
//find out the parent module
var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML;
- var obj:DisplayObject = pnlComponent.getChildAt(1);
- var questionGroupInfo:QuestionGroup = QuestionGroup(obj);
+
+
var isQuestionGroupFormValid:Boolean = questionGroupInfo.validateForm(event);
if(isQuestionGroupFormValid)
{
-
- var newNode:XML = <questiongroup/>;
- newNode.setLocalName("questiongroup");
- newNode.@header = questionGroupInfo.getHeader();
- newNode.@description = questionGroupInfo.getDescription();
- newNode.@sequenceNo = questionGroupInfo.getSequenceNo();
-
- var block:XMLList =company.module.block.(@name == node.@name);
- Alert.show(block.@name + "is name of the block");
+ var node:XML;
+ /**
+ * Check if the selected node is block, if it is new Question Group needs to be created.
+ else if selected node is Question Group, then Question Group needs to be updated.*/
+
+ if(selectedNode.localName() == "block")
+ {
+ node = selectedNode;
+ }
+ else if(selectedNode.localName() == "questiongroup")
+ {
+ var parentNode:XML = tree.getParentItem(tree.selectedItem) as XML;
+ node = parentNode;
+ }
+ var block:XMLList = survey.module.block.(@id == node.@id);
+ //Alert.show("block id is : " + block[0].@id + "length is: " + block.length());
if( block.length() > 0 )
- {
- block[0].appendChild(newNode);
- currentState = "none";
- btnsaveQuestionGroup.enabled = false;
-
- }
+ {
+ if(questionGroupInfo.getId() == 0)
+ {
+ roQuestionCreator.saveQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id));
+ }
+ else
+ {
+ roQuestionCreator.updateQuestionGroup(int(questionGroupInfo.getSequenceNo()),questionGroupInfo.getHeader(),questionGroupInfo.getDescription(),int(block[0].@id),questionGroup.getId());
+ }
+ currentState = "none";
+ btnsaveQuestionGroup.enabled = false;
+ //pnlComponent.removeChildAt(1);
+ }
}
}
}
}
}
+
+ //when QuestionGroup is created, the result will come to resultSaveQuestionGroupHandler
+ public function resultSaveQuestionGroupHandler(event:ResultEvent):void
+ {
+ var questionGroup:QuestionGroup = QuestionGroup(event.result as Object);
+ Alert.show("Id is: " + questionGroup.id);
+ var newNode:XML = <questiongroup/>;
+ newNode.setLocalName("questiongroup");
+ newNode.@header = questionGroup.header;
+ newNode.@description = questionGroup.description;
+ newNode.@sequenceNo = questionGroup.sequenceNo;
+ newNode.@id = questionGroup.id;
+
+ var block:Block = questionGroup.block;
+
+ var blockXML:XMLList =survey.module.block.(@id == block.id);
+
+ if( blockXML.length() > 0 )
+ {
+ blockXML[0].appendChild(newNode);
+
+ }
+
+ }
+
+ //when QuestionGroup is updated, the result will come to resultUpdateQuestionGroupHandler
+ public function resultUpdateQuestionGroupHandler(event:ResultEvent):void
+ {
+ var questionGroup:QuestionGroup = QuestionGroup(event.result as Object);
+ Alert.show("Id is: " + questionGroup.id);
+ var newNode:XML = <questiongroup/>;
+ newNode.setLocalName("questiongroup");
+ newNode.@header = questionGroup.header;
+ newNode.@description = questionGroup.description;
+ newNode.@sequenceNo = questionGroup.sequenceNo;
+ var block:Block = questionGroup.block;
+
+ }
+
+ //QuestionGroup functionality Stop
+
+
+ //Question functionality Start
private function addQuestion():void
{
currentState = "question";
@@ -287,6 +751,25 @@
btnsaveQuestion.enabled = true;
}
+ private function QuestionHandler(event:Event):void
+ {
+ if(question.cmbType.selectedItem.toString().toLowerCase() == "psychometric")
+ currentState = "psychometric";
+ else if(question.cmbType.selectedItem.toString().toLowerCase() == "categorical")
+ currentState = "categorical";
+
+ }
+
+ private function CategoricalTypeHandler(event:Event):void
+ {
+ if(categorical.cmbType.selectedItem.toString().toLowerCase() == "relative")
+ currentState = "relative";
+ else if(categorical.cmbType.selectedItem.toString().toLowerCase() == "simple")
+ currentState = "simple";
+ }
+
+
+
private function saveQuestion(event:Event):void
{
var node:XML = tree.selectedItem as XML;
@@ -315,49 +798,195 @@
if(isQuestionGroupFormValid)
{
-
- var newNode:XML = <question/>;
- newNode.setLocalName("question");
- newNode.@sequenceNo = questionInfo.getSequenceNo();
- newNode.@title = questionInfo.getQuestion();
- newNode.@type = questionInfo.getType();
- newNode.@id = ++Qid;
- var questionGroup:XMLList =company.module.block.questiongroup.(@header == node.@header);
-
- if( questionGroup.length() > 0 )
- {
- questionGroup[0].appendChild(newNode);
- currentState = "none";
- btnsaveQuestion.enabled = false;
-
- }
- var ques:ASQuestion = new ASQuestion(newNode.@id);
- if(questionInfo.getType().toLowerCase() == "categorical")
- {
- var cat:ASCategorical = new ASCategorical(newNode.@id);
-
- var compCategorical:Categorical = Categorical(questionInfo.getQuestionInfo());
- if(compCategorical.getCategoricalType().toLowerCase() == "relative")
- {
- var relative:CategoricalRelative = CategoricalRelative(compCategorical.getCategoricalInfo());
- cat.setDictionary(relative.dict);
- }
- else
- {
- var simple:CategoricalSimple = CategoricalSimple(compCategorical.getCategoricalInfo());
- cat.setDictionary(simple.dict);
- }
- ques.setQtype(cat);
- }
-
- tempQuestion.addItem(ques);
+
+ if(currentState == "psychometric")
+ {
+ var psychobj:DisplayObject = pnlComponent.getChildAt(2);
+
+ var compPsychometric:Psychometric = Psychometric(psychobj);
+
+ var asPsychometric:Psychometric = new Psychometric();
+ asPsychometric.scale = compPsychometric.getScale();
+ asPsychometric.maxSliderValue = int(compPsychometric.getNumberofIntervals());
+ asPsychometric.choices = compPsychometric.getChoices();
+ asPsychometric.question = questionInfo.getQuestion();
+ asPsychometric.sequenceNo = int(questionInfo.getSequenceNo());
+ asPsychometric.type = questionInfo.getType();
+
+ Alert.show("Psychometric Object :");
+ Alert.show("Question: " + asPsychometric.question);
+ Alert.show("SeQ No: " + asPsychometric.sequenceNo);
+ Alert.show("Type : " + asPsychometric.type);
+ roQuestionCreator.saveQuestion(asPsychometric,1);
+ }
+ else if(currentState == "relative")
+ {
+ var catobj:DisplayObject = pnlComponent.getChildAt(3);
+ var compCategorical:CategoricalRelative = CategoricalRelative(catobj);
+ var categoricalQuestion:Categorical = new Categorical();
+
+ var dict:Dictionary = new Dictionary();
+ dict = compCategorical.getDictionary();
+ for (var key:Object in dict)
+ {
+ var Options:CategoricalOption = new CategoricalOption();
+ Options.optionKey = key.toString();
+ Options.choices = dict[key];
+ categoricalQuestion.categoricalOptions.addItem(Options);
+ }
+ categoricalQuestion.type = questionInfo.getType();
+ categoricalQuestion.question = questionInfo.getQuestion();
+ categoricalQuestion.sequenceNo = int(questionInfo.getSequenceNo());
+ for(var i:int = 0; i < categoricalQuestion.categoricalOptions.length ; i++)
+ {
+ var testoption:CategoricalOption = new CategoricalOption();
+ testoption = CategoricalOption(categoricalQuestion.categoricalOptions.getItemAt(i));
+ trace(testoption.optionKey);
+ trace(testoption.choices);
+ }
+ roQuestionCreator.saveQuestion(categoricalQuestion,1);
+
+ }
+ else if(currentState == "simple")
+ {
+ Alert.show("simple state");
+ var catSimpleobj:DisplayObject = pnlComponent.getChildAt(3);
+ var compCategoricalSimple:CategoricalSimple = CategoricalSimple(catSimpleobj);
+ var categoricalSimpleQuestion:Categorical = new Categorical();
+
+
+ var Simpledict:Dictionary = new Dictionary();
+ Simpledict = compCategoricalSimple.getDictionary();
+ for (var option:Object in Simpledict)
+ {
+ var OptionsSimple:CategoricalOption = new CategoricalOption();
+ OptionsSimple.optionKey = option.toString();
+ Alert.show("Key : " + option.toString());
+ OptionsSimple.choices = Simpledict[key];
+ categoricalSimpleQuestion.categoricalOptions.addItem(OptionsSimple);
+ }
+ categoricalSimpleQuestion.type = questionInfo.getType();
+ categoricalSimpleQuestion.question = questionInfo.getQuestion();
+ categoricalSimpleQuestion.sequenceNo = int(questionInfo.getSequenceNo());
+ /*for(var j:int = 0; j < categoricalSimpleQuestion.categoricalOptions.length ; j++)
+ {
+ var testoption:ASCategoricalOption = new ASCategoricalOption();
+ testoption = ASCategoricalOption(categoricalSimpleQuestion.categoricalOptions.getItemAt(i));
+ trace(testoption.optionKey);
+ trace(testoption.choices);
+ }*/
+ Alert.show("Question: " + categoricalSimpleQuestion.question);
+ Alert.show("SeQ No: " + categoricalSimpleQuestion.sequenceNo);
+ Alert.show("Type : " + categoricalSimpleQuestion.type);
+
+
+ roQuestionCreator.saveQuestion(categoricalSimpleQuestion,1);
+
+ }
+ //roQuestionCreator.saveQuestion(int(questionInfo.getSequenceNo()),questionInfo.getQuestion(),questionInfo.getType(),int(parentModule.@id));
+ }
+
}
}
- }
-
+
}
+ public function resultSaveQuestionHandler(event:ResultEvent):void
+ {
+ var test_object:Object = event.result as Object;
+ Alert.show("Type came from server is: " + test_object.type);
+ if(test_object.type == "psychometric")
+ {
+ var questionResult:Psychometric = Psychometric(event.result as Object);
+ Alert.show("Id is: " + questionResult.id);
+ Alert.show("Question is: " + questionResult.question);
+ Alert.show("Type is: " + questionResult.type);
+ Alert.show("SeQNo is: " + questionResult.sequenceNo);
+
+ var newPNode:XML = <psychometric/>;
+ newPNode.setLocalName("psychometric");
+ newPNode.@id = questionResult.id;
+ newPNode.@scale = questionResult.scale;
+ newPNode.@noOfInterval = questionResult.maxSliderValue;
+ for(var j:int = 0; j < questionResult.choices.length; j++)
+ {
+ var str:String = "choice";
+ str = str + j;
+ newPNode.@str = questionResult.choices[j];
+ }
+
+ psychometricQuestions.appendChild(newPNode);
+
+ }
+ else if(test_object.type.toLowerCase() == "categorical")
+ {
+ var categoricalResult:Categorical = Categorical(test_object);
+ var newQNode:XML = <question/>;
+ newQNode.setLocalName("question");
+ newQNode.@sequenceNo = categoricalResult.sequenceNo;
+ newQNode.@title = categoricalResult.question;
+ newQNode.@type = categoricalResult.type;
+ newQNode.@id = categoricalResult.id;
+ var questionGroup:XMLList =survey.module.block.questiongroup.(@header == node.@header);
+
+ if( questionGroup.length() > 0 )
+ {
+ questionGroup[0].appendChild(newQNode);
+ currentState = "none";
+ btnsaveQuestion.enabled = false;
+ }
+
+ var newCNode:XML = <categorical/>;
+ newCNode.setLocalName("categorical");
+ newCNode.@id = categoricalResult.id;
+ categoricalQuestions.appendChild(newCNode);
+
+ for(var i:int = 0; i < categoricalResult.categoricalOptions.length ; i++)
+ {
+ var options:CategoricalOption = new CategoricalOption();
+ options = CategoricalOption(categoricalResult.categoricalOptions.getItemAt(i));
+ var newOptionNode:XML = <option/>;
+ newOptionNode.setLocalName("option");
+ newOptionNode.@name = options.optionKey;
+ if(options.choices.length <= 0)
+ {
+ newCNode.@type = "simple";
+
+ }
+ else
+ {
+ newCNode.@type = "relative";
+ for(var k:int = 0; k < options.choices.length; k++)
+ {
+ var choice:String = "choice";
+ choice = choice + k;
+ newOptionNode.@choice = options.choices[k];
+ }
+ }
+
+ /*var module:XMLList = survey.module.(@id == tempmodule.id);
+ if( module.length() > 0 )
+ {
+ module[0].appendChild(newBlockNode);
+ }*/
+ newCNode.appendChild(newOptionNode);
+ }
+
+
+ }
+
+ currentState = "none";
+ btnsaveQuestion.enabled = false;
+
+
+ }
+
+ public function resultUpdateQuestionHandler(event:Event):void
+ {
+
+ }
+ //Question functionality Stop
public function removeItem():void
{
currentState = "none";
@@ -380,7 +1009,7 @@
if( children[i].@name == node.@name )
{
- delete children[i];
+ delete children[i].@*;
}
}
@@ -410,6 +1039,7 @@
moduleInfo.setHours(node.@hours);
moduleInfo.setMinutes(node.@min);
moduleInfo.setSeconds(node.@sec);
+ moduleInfo.setId(node.@id);
}
if(node.localName() == "block")
@@ -427,7 +1057,8 @@
blockInfo.setSequenceNo(node.@sequenceNo);
blockInfo.setHours(node.@hours);
blockInfo.setMinutes(node.@min);
- blockInfo.setSeconds(node.@sec);
+ blockInfo.setSeconds(node.@sec);
+ blockInfo.setId(node.@id);
}
if(node.localName() == "questiongroup")
@@ -446,7 +1077,8 @@
questionGroupInfo.setHeader(node.@header);
questionGroupInfo.setDescription(node.@description);
questionGroupInfo.setSequenceNo(node.@sequenceNo);
-
+ questionGroupInfo.setId(node.@id);
+ //Alert.show("Question group id assigned is: " + node.@id);
}
if(node.localName() == "question")
@@ -459,71 +1091,186 @@
btnsaveBlock.enabled = false;
btnsaveQuestionGroup.enabled = false;
btnsaveQuestion.enabled = true;
- //questionInfo.reset();
+ questionInfo.reset();
+
//set all fields
- questionInfo.setType(node.@type);
+ //get question infromation like sequence number , type, id and title
questionInfo.setQuestion(node.@title);
questionInfo.setSequenceNo(node.@sequenceNo);
- var id:int = node.@id;
- var Q:ASQuestion;
+ questionInfo.setId(node.@id);
- for(var i:int = 0; i<tempQuestion.length; i++)
+
+
+ if(node.@type == "categorical")
{
- Q = tempQuestion[i];
- if(Q.getId() == id )
+ currentState = "categorical";
+ var catobj:DisplayObject = pnlComponent.getChildAt(2);
+ var compCategorical:Categorical = Categorical(catobj);
+ compCategorical.reset();
+
+ questionInfo.cmbType.selectedItem = "Categorical";
+ var categoricalQ:XMLList = categoricalQuestions.categorical.(@id == node.@id);
+
+ if(categoricalQ.length() > 0)
{
- if(Q.getType().toLowerCase() == "categorical")
+ if(categoricalQ[0].@type == "relative")
{
- var cat:ASCategorical = ASCategorical(Q.getQtype());
- Alert.show(cat.dict[0]);
+ compCategorical.setType("relative");
- }
+ currentState = "relative";
+
+ var cat1obj:DisplayObject = pnlComponent.getChildAt(3);
+ var compRelative:CategoricalRelative = CategoricalRelative(cat1obj);
+
+ var dict:Dictionary = new Dictionary();
+ var optionList:XMLList = categoricalQ[0].option.@name;
+ //Alert.show("option key: " + optionList.length());
+ for(var j:int = 0; j<optionList.length(); j++)
+ {
+ var str:String = optionList[j];
+ compRelative.header1List.addItem(str);
+
+ dict[str] = new ArrayCollection();
+ var attributeList:XMLList = categoricalQ[0].option[j].attributes();
+
+ for(var i:int = 0; i < attributeList.length(); i++)
+ {
+ if(attributeList[i] != optionList[j])
+ {
+ dict[str].addItem(attributeList[i]);
+ }
+
+ }
+ }
+
+ compRelative.setDictionary(dict);
+
+ }
+ else if(categoricalQ[0].@type == "simple")
+ {
+ compCategorical.setType("simple");
+ currentState = "simple";
+ var cat2obj:DisplayObject = pnlComponent.getChildAt(3);
+ var compSimple:CategoricalSimple = CategoricalSimple(cat2obj);
+
+ var dictionary:Dictionary = new Dictionary();
+
+ var attributeSimpleList:XMLList = categoricalQ[0].option.attributes();
+ var str1:String;
+
+ for(var k:int = 0; k < attributeSimpleList.length(); k++)
+ {
+ str1 = attributeSimpleList[k];
+ compSimple.header.addItem(str1);
+ dictionary[str1] = new ArrayCollection();
+ dictionary[str1].addItem(null);
+ }
+
+ }
+ compSimple.setDictionary(dictionary);
+ }
- }
- }
+ }
-
- }
+ else if(node.@type == "psychometric")
+ {
+ currentState = "psychometric";
+ var psychobj:DisplayObject = pnlComponent.getChildAt(2);
+ var compPsychometric:Psychometric = Psychometric(psychobj);
+ compPsychometric.reset();
+ questionInfo.cmbType.selectedItem = "Psychometric";
+ var psychometricQ:XMLList = psychometricQuestions.psychometric.(@id == node.@id);
+ if(psychometricQ.length() > 0)
+ {
+ compPsychometric.setScale(psychometricQ[0].@scale);
+ compPsychometric.setNumberofIntervals(psychometricQ[0].@interval);
+ var psychometricAttributes:XMLList = psychometricQ[0].attributes();
+
+ compPsychometric.vboxChoices.visible = true;
+ for(var l:int =0; l < psychometricAttributes.length(); l++)
+ {
+ Alert.show("Attribute is : " +psychometricAttributes[l]);
+ if((psychometricAttributes[l] != psychometricQ[0].@id) && (psychometricAttributes[l] != psychometricQ[0].@scale) && (psychometricAttributes[l] != psychometricQ[0].@interval))
+ {
+ compPsychometric.choice.addItem(psychometricAttributes[l]);
+ }
+ }
+ }
+ }
+ else
+ currentState = "none";
+ }
}
-
-
+
]]>
</mx:Script>
<mx:states>
<mx:State name="module">
<mx:AddChild relativeTo="{pnlComponent}">
- <comp:Module id="module"/>
+ <basicComp:Module id="module"/>
</mx:AddChild>
</mx:State>
<mx:State name="block">
<mx:AddChild relativeTo="{pnlComponent}">
- <comp:Block id="block"/>
+ <basicComp:Block id="block"/>
</mx:AddChild>
</mx:State>
<mx:State name="questionGroup">
<mx:AddChild relativeTo="{pnlComponent}">
- <comp:QuestionGroup id="questionGroup"/>
+ <basicComp:QuestionGroup id="questionGroup"/>
</mx:AddChild>
</mx:State>
<mx:State name="question">
<mx:AddChild relativeTo="{pnlComponent}">
- <comp:Question id="question"/>
+ <basicComp:Question id="question"/>
</mx:AddChild>
+ <mx:SetEventHandler handlerFunction="QuestionHandler" target="{question.cmbType}" name="change" />
</mx:State>
+ <mx:State name="none"/>
+ <mx:State name="psychometric" basedOn="question">
+ <mx:AddChild relativeTo="{pnlComponent}">
+ <comp:Psychometric id="psychometric" width="335"/>
+ </mx:AddChild>
+ </mx:State>
+
+ <mx:State name="categorical" basedOn="question" >
+ <mx:AddChild relativeTo="{pnlComponent}">
+ <comp:Categorical id="categorical" width="335"/>
+ </mx:AddChild>
+
+ <mx:SetEventHandler handlerFunction="CategoricalTypeHandler" target="{categorical.cmbType}" name="change" />
+
+ </mx:State>
+
+ <mx:State name="relative" basedOn="categorical">
+ <mx:AddChild relativeTo="{pnlComponent}">
+ <comp:CategoricalRelative id="categoricalRelative" width="100%"/>
+ </mx:AddChild>
+ </mx:State>
+
+
+ <mx:State name="simple" basedOn="categorical">
+ <mx:AddChild relativeTo="{pnlComponent}">
+ <comp:CategoricalSimple id="categoricalSimple" width="100%"/>
+ </mx:AddChild>
+ <mx:SetProperty target="{categorical}" name="width" value="335"/>
+ </mx:State>
+
+ <!-- <mx:State name="text" basedOn="question"/> -->
- <mx:State name="none">
- </mx:State>
+
+
</mx:states>
<mx:Spacer width="40"/>
<mx:HDividedBox width="100%" height="100%" id="hdMain">
<mx:Spacer width="40"/>
<mx:VBox height="100%" id="vboxLeft" width ="40%">
<mx:Spacer width="40"/>
- <mx:Tree id="tree" dataProvider="{companyData}"
+ <mx:Tree id="tree" dataProvider="{surveyData}"
labelFunction="treeLabel" allowMultipleSelection="false" selectable="true"
showRoot="true" change="{treeChanged(event)}"
height="50%" width="80%" textAlign="center"/>
@@ -554,6 +1301,7 @@
<mx:GridRow width="100%" height="100%" id="gridrow2">
<mx:GridItem width="100%" height="100%" id="griditem1">
<mx:Button label="Remove Item" id="butRemModule" click ="{removeItem()}"/>
+ <mx:Button id="butnTest" label="Test" click="{init()}"/>
</mx:GridItem>
@@ -561,6 +1309,16 @@
</mx:Grid>
</mx:Canvas>
+ <mx:Tree id="treeCQ" dataProvider="{categoricalQuestions}"
+ labelFunction="treeLabelCategoricalQ" allowMultipleSelection="false" selectable="true"
+ showRoot="true" change="{treeChanged(event)}"
+ height="50%" width="80%" textAlign="center"/>
+
+ <mx:Spacer width="20"/>
+ <mx:Tree id="treePQ" dataProvider="{psychometricQuestions}"
+ labelFunction="treeLabelPsychometricQ" allowMultipleSelection="false" selectable="true"
+ showRoot="true" change="{treeChanged(event)}"
+ height="50%" width="80%" textAlign="center"/>
</mx:VBox>
<mx:Panel id = "pnlComponent" height="100%" layout="vertical">
<mx:HBox width="100%">
@@ -573,10 +1331,23 @@
<mx:Spacer width="40"/>
<mx:Button id = "btnsaveQuestion" enabled="false" label="Save Question" click="{saveQuestion(event)}" />
<mx:Spacer width="40"/>
-
+ <mx:Label id="lbltest" />
</mx:HBox>
</mx:Panel>
+
</mx:HDividedBox>
+ <mx:RemoteObject id="roQuestionCreator" destination="questionCreatorService" fault="faultHandler(event)" >
+ <mx:method name="saveModule" result="resultSaveModuleHandler(event)" />
+ <mx:method name="updateModule" result="resultUpdateModuleHandler(event)" />
+ <mx:method name="saveBlock" result="resultSaveBlockHandler(event)" />
+ <mx:method name="updateBlock" result="resultUpdateBlockHandler(event)" />
+ <mx:method name="saveQuestionGroup" result="resultSaveQuestionGroupHandler(event)" />
+ <mx:method name="updateQuestionGroup" result="resultUpdateQuestionGroupHandler(event)" />
+ <mx:method name="saveQuestion" result="resultSaveQuestionHandler(event)" />
+ <mx:method name="updateQuestion" result="resultUpdateQuestionHandler(event)" />
+ <mx:method name="initializeData" result="resultInitializeDataHandler(event)" />
+
+ </mx:RemoteObject>
</mx:Application>
Deleted: mentalmodels/trunk/flex/src/actionscript/ASCategorical.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/ASCategorical.as 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/actionscript/ASCategorical.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,30 +0,0 @@
-package actionscript
-{
- import flash.utils.Dictionary;
-
- import mx.collections.ArrayCollection;
-
- public class ASCategorical
- {
- public var id:int;
-
- public function ASCategorical(id:int)
- {
- this.id = id;
- }
-
- public var type:String;
- public var dict:Dictionary = new Dictionary();
-
- public function setDictionary(dictionary:Dictionary):void
- {
- dict = dictionary;
- }
-
- public function getDictionary():Dictionary
- {
- return dict;
- }
-
- }
-}
\ No newline at end of file
Deleted: mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/actionscript/ASPsychometric.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,20 +0,0 @@
-package actionscript
-{
- import mx.collections.ArrayCollection;
-
- public class ASPsychometric
- {
- public function ASPsychometric()
- {
- }
-
-
- public var scale:String;
-
- public var numberOfIntervals:Number;
-
- public var choices:ArrayCollection;
-
-
- }
-}
\ No newline at end of file
Deleted: mentalmodels/trunk/flex/src/actionscript/ASQuestion.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/ASQuestion.as 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/actionscript/ASQuestion.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,46 +0,0 @@
-package actionscript
-{
- import mx.collections.ArrayCollection;
-
- public class ASQuestion
- {
- private var id:int;
- public var question:String;
- private var type:String;
- private var Qtype:Object;
-
- public function ASQuestion(id:int)
- {
- this.id = id;
-
- }
-
- public function setType(type:String):void
- {
- this.type = type;
-
- }
-
- public function getType():String
- {
- return type;
- }
-
- public function setQtype(questionInfo:Object):void
- {
- this.Qtype = questionInfo;
- }
-
- public function getQtype():Object
- {
- return Qtype;
- }
-
- public function getId():int
- {
- return id;
- }
-
-
- }
-}
\ No newline at end of file
Deleted: mentalmodels/trunk/flex/src/actionscript/ASResults.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/ASResults.as 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/actionscript/ASResults.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,18 +0,0 @@
-package actionscript
-{
- import mx.messaging.channels.StreamingHTTPChannel;
-
- public class ASResults
- {
- public function ASResults()
- {
- }
- public function calculateString():String
- {
- var greeting:String;
- greeting="Welcome Kalin!!";
- return String(greeting);
- }
-
- }
-}
\ No newline at end of file
Modified: mentalmodels/trunk/flex/src/actionscript/Block.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 07:04:06 UTC (rev 174)
+++ mentalmodels/trunk/flex/src/actionscript/Block.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -1,6 +1,9 @@
package actionscript
{
+
import mx.collections.ArrayCollection;
+ import mx.formatters.NumberFormatter;
+ import mx.formatters.NumberBaseRoundType;
[Bindable]
[RemoteClass(alias="edu.asu.commons.mme.entity.Block")]
@@ -10,7 +13,25 @@
public var sequenceNo:int;
public var description:String;
public var duration:int;
+ public var module:ASModule;
public var questionGroups:ArrayCollection;
public var informationWindows:ArrayCollection;
+
+ public function getHours():int
+ {
+ return int(Math.floor(duration/3600));
+ }
+
+ public function getMinutes():int
+ {
+ var tempDuration:int;
+ tempDuration = duration - (getHours() * 3600);
+ return int(Math.floor(tempDuration/60));
+ }
+
+ public function getSeconds():int
+ {
+ return (duration - (getMinutes() * 60));
+ }
}
}
\ No newline at end of file
Added: mentalmodels/trunk/flex/src/actionscript/Categorical.as
===================================================================
--- mentalmodels/trunk/flex/src/actionscript/Categorical.as (rev 0)
+++ mentalmodels/trunk/flex/src/actionscript/Categorical.as 2009-07-10 21:02:20 UTC (rev 175)
@@ -0,0 +1,12 @@
+package actionscript
+{
+ import mx.collections.ArrayCollection;
+
+ [Bindable]
+ [RemoteClass(alias="edu.asu.commons.mme.entity.CategoricalQuestion")]
+ public class Categorical extends Question
+ {
+
+ public var categoricalOptions:ArrayCollection = new ArrayCollection();
+ }
+}
\ No newline at end of file
Added: mentalmodels/trunk/flex/src/actionscript/CategoricalOption.as
===================================================================
--- mentalmode...
[truncated message content] |