﻿var surveyConsts = new Object();
surveyConsts.questionTypes =[
    {'type': 'CHOICE_RADIO',
     'name':'单选-单选按钮' },
     
    {'type': 'CHOICE_DROPDOWN',
     'name':'单选-下拉选单' },
     
    {'type': 'CHOICE_CHECKBOX',
     'name':'多选-(复选按钮)' },
     
    {'type': 'MAXTRIX_RADIO',
     'name':'阵列 - 每行单选' },
     
    {'type': 'MAXTRIX_CHECKBOX',
     'name':'阵列 - 每行选多择' },
     
    {'type': 'TEXT',
     'name':'用户输入-文本框' }
    ];

surveyConsts.questionTypes.findByType = function()
{
    if( arguments.length==0 ) return null;
    for( var i in this)
    {
        if( typeof( this[ i] ) ==='object'  )
        {
            if( this[ i].type.toString() == arguments[0].toString()  )
            {
                return this[i];
            }
        }
    }
    return null;
}

function SurveyAnswer()
{
    this.items = new Array();
}

function SurveyMaxtrixRows()
{
    this.items = new Array();
}
//问卷对象定义
function SurveyQuestion()
{
    this.text='';
    this.subText='';
    this.type='';
    this.allowAdditionalAnswer=false;
    this.additionalAnswerPropmt='';
    
    this.answers = new SurveyAnswer();
    this.maxtrixRows = new SurveyMaxtrixRows();
}

function SurveyPage()
{
    this.title='';
    this.intro='';
    this.questions = new Object();
    this.questions.items = new Array();
}


function SurveyForm()
{
    this.version = '1.0'
    this.name='[未命名问卷]'
    this.description = '';
    this.guid='';
    this.startDate='';
    this.endDate='';
    this.categoryCode='';
    this.securityType='';
    this.maxResponsesPerUser='';
    this.maxResponsesPerIp='';
    this.pages = new Object();
    this.pages.items = new Array();
}
