Esempio n. 1
0
// Add a binary option for a selection answer
func (question *QuestionForm) AddSelectionAnswerBinarySelection(
	selectionIdentifier, mimeType, mimeSubType string,
	dataURL *url.URL, altText string) {
	answer := question.getCurrentAnswer()
	if answer.SelectionAnswer == nil {
		answer.SelectionAnswer = &questionform.TSelectionAnswerType{}
	}
	if answer.SelectionAnswer.Selections == nil {
		answer.SelectionAnswer.Selections = &questionform.TxsdSelectionAnswerTypeSequenceSelections{}
	}
	selection := &questionform.TxsdSelectionAnswerTypeSequenceSelectionsSequenceSelection{}
	selection.SelectionIdentifier = xsdt.String(selectionIdentifier)
	selection.Binary = &questionform.TBinaryContentType{}
	if mimeType != "" || mimeSubType != "" {
		selection.Binary.MimeType = &questionform.TMimeType{}
		if mimeType != "" {
			selection.Binary.MimeType.Type = questionform.TxsdMimeTypeSequenceType(mimeType)
		}
		if mimeSubType != "" {
			selection.Binary.MimeType.SubType = xsdt.String(mimeSubType)
		}
	}
	selection.Binary.DataURL = questionform.TURLType(dataURL.String())
	if altText != "" {
		selection.Binary.AltText = xsdt.String(altText)
	}
	answer.SelectionAnswer.Selections.Selections = append(
		answer.SelectionAnswer.Selections.Selections, selection)
}
Esempio n. 2
0
// Add an EmbeddedBinary item to the most recent Question/Overview added.
func (question *QuestionForm) AddEmbeddedBinaryContent(
	dataURL *url.URL, altText string, width, height int,
	applicationParameters map[string]string, mimeType, mimeSubType string) {
	binary := &questionform.TEmbeddedBinaryContentType{}
	binary.DataURL = questionform.TURLType(dataURL.String())
	binary.AltText = xsdt.String(altText)
	binary.Width = xsdt.String(fmt.Sprint(width))
	binary.Height = xsdt.String(fmt.Sprint(height))
	for key, value := range applicationParameters {
		param := &questionform.TApplicationParameter{}
		param.Name = xsdt.String(key)
		param.Value = xsdt.String(value)
		binary.ApplicationParameters = append(
			binary.ApplicationParameters, param)
	}
	if mimeType != "" || mimeSubType != "" {
		binary.EmbeddedMimeType = &questionform.TEmbeddedMimeType{}
		if mimeType != "" {
			binary.EmbeddedMimeType.Type = xsdt.String(mimeType)
		}
		if mimeSubType != "" {
			binary.EmbeddedMimeType.SubType = xsdt.String(mimeSubType)
		}
	}

	content := question.getCurrentContent()
	content.EmbeddedBinaries = append(content.EmbeddedBinaries, binary)
}
Esempio n. 3
0
// Add a Flash Application item to the most recent Question/Overview added.
func (question *QuestionForm) AddFlashApplicationContent(flashMovieURL *url.URL,
	width, height int, applicationParameters map[string]string) {
	application := &questionform.TApplicationContentType{}
	application.Flash = &questionform.TFlashContentType{}
	application.Flash.FlashMovieURL = questionform.TURLType(flashMovieURL.String())
	application.Flash.Width = xsdt.String(fmt.Sprint(width))
	application.Flash.Height = xsdt.String(fmt.Sprint(height))
	for key, value := range applicationParameters {
		param := &questionform.TApplicationParameter{}
		param.Name = xsdt.String(key)
		param.Value = xsdt.String(value)
		application.Flash.ApplicationParameters = append(
			application.Flash.ApplicationParameters, param)
	}

	content := question.getCurrentContent()
	content.Applications = append(content.Applications, application)
}
Esempio n. 4
0
// Add a Binary item to the most recent Question/Overview added.
func (question *QuestionForm) AddBinaryContent(mimeType, mimeSubType string,
	dataURL *url.URL, altText string) {
	binary := &questionform.TBinaryContentType{}
	if mimeType != "" || mimeSubType != "" {
		binary.MimeType = &questionform.TMimeType{}
		if mimeType != "" {
			binary.MimeType.Type = questionform.TxsdMimeTypeSequenceType(mimeType)
		}
		if mimeSubType != "" {
			binary.MimeType.SubType = xsdt.String(mimeSubType)
		}
	}
	binary.DataURL = questionform.TURLType(dataURL.String())
	if altText != "" {
		binary.AltText = xsdt.String(altText)
	}

	content := question.getCurrentContent()
	content.Binaries = append(content.Binaries, binary)
}
Esempio n. 5
0
// Add a JavaApplet Application item to the most recent Question/Overview added.
func (question *QuestionForm) AddJavaAppletApplicationContent(
	appletFilename string, width, height int,
	applicationParameters map[string]string, appletPath *url.URL) {
	application := &questionform.TApplicationContentType{}
	application.JavaApplet = &questionform.TJavaAppletContentType{}
	application.JavaApplet.AppletFilename = xsdt.String(appletFilename)
	application.JavaApplet.Width = xsdt.String(fmt.Sprint(width))
	application.JavaApplet.Height = xsdt.String(fmt.Sprint(height))
	for key, value := range applicationParameters {
		param := &questionform.TApplicationParameter{}
		param.Name = xsdt.String(key)
		param.Value = xsdt.String(value)
		application.JavaApplet.ApplicationParameters = append(
			application.JavaApplet.ApplicationParameters, param)
	}
	if appletPath != nil {
		application.JavaApplet.AppletPath = questionform.TURLType(appletPath.String())
	}

	content := question.getCurrentContent()
	content.Applications = append(content.Applications, application)
}